From fd0586072579f04957377285a89490135fe20aa2 Mon Sep 17 00:00:00 2001 From: Alan Garny Date: Mon, 5 Aug 2024 17:55:57 +0200 Subject: [PATCH 01/85] Python docstrings tests: don't test for CellmlElementType. --- tests/bindings/python/test_docstrings.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/bindings/python/test_docstrings.py b/tests/bindings/python/test_docstrings.py index a3b63037d5..64eb54222c 100644 --- a/tests/bindings/python/test_docstrings.py +++ b/tests/bindings/python/test_docstrings.py @@ -13,7 +13,7 @@ def test_docstrings(self): # Scan for missing or empty docstrings def scan(root, missing, prefix=''): prefix += root.__name__ - if not root.__doc__: + if not root.__doc__ and root.__name__ != 'CellmlElementType': missing.append(prefix) prefix += '.' # Scan children, using dict instead of dir to avoid inherited From 0207ff9d9d71a4a492c710dca22c5ba3172e4a8e Mon Sep 17 00:00:00 2001 From: Alan Garny Date: Fri, 12 Jul 2024 14:57:17 +1200 Subject: [PATCH 02/85] Code generator: use different arrays for constants, computed constants, and algebraic variables. --- src/analyser.cpp | 13 +- src/analyserequation.cpp | 49 ++++- src/analyserequation_p.h | 6 +- src/analysermodel.cpp | 68 +++++- src/analysermodel_p.h | 4 +- src/api/libcellml/analyserequation.h | 55 +++-- src/api/libcellml/analysermodel.h | 86 ++++++-- src/api/libcellml/generatorprofile.h | 134 ++++++++++-- src/bindings/interface/analyserequation.i | 21 +- src/bindings/interface/analysermodel.i | 30 ++- src/bindings/interface/generatorprofile.i | 44 +++- src/bindings/javascript/analyserequation.cpp | 9 +- src/bindings/javascript/analysermodel.cpp | 12 +- src/bindings/javascript/generatorprofile.cpp | 16 +- src/debug.cpp | 37 +++- src/generator.cpp | 196 ++++++++++-------- src/generator_p.h | 2 + src/generatorprofile.cpp | 92 ++++++-- src/generatorprofilesha1values.h | 4 +- src/generatorprofiletools.cpp | 10 +- src/utilities.cpp | 32 +++ src/utilities.h | 22 ++ .../javascript/analyserequation.test.js | 25 ++- .../bindings/javascript/analysermodel.test.js | 20 +- .../javascript/analyservariable.test.js | 18 +- tests/bindings/javascript/generator.test.js | 6 +- .../javascript/generatorprofile.test.js | 36 +++- .../bindings/javascript/importsource.test.js | 2 +- tests/bindings/javascript/reset.test.js | 4 +- tests/bindings/javascript/variable.test.js | 4 +- tests/bindings/python/test_analyser.py | 23 +- .../bindings/python/test_generator_profile.py | 56 ++++- tests/coverage/coverage.cpp | 70 +++++-- tests/generator/generatorprofile.cpp | 34 ++- tests/resources/coverage/generator/model.c | 6 +- tests/resources/coverage/generator/model.h | 6 +- .../generator/model.implementation.out | 2 +- .../coverage/generator/model.interface.out | 2 +- .../generator/model.modified.profile.c | 6 +- .../generator/model.modified.profile.h | 6 +- .../generator/model.modified.profile.py | 6 +- tests/resources/coverage/generator/model.out | 2 +- tests/resources/coverage/generator/model.py | 6 +- .../algebraic_eqn_computed_var_on_rhs/model.c | 6 +- .../model.external.c | 6 +- .../model.external.h | 6 +- .../model.external.py | 6 +- .../algebraic_eqn_computed_var_on_rhs/model.h | 6 +- .../model.py | 6 +- .../algebraic_eqn_const_var_on_rhs/model.c | 6 +- .../algebraic_eqn_const_var_on_rhs/model.h | 6 +- .../algebraic_eqn_const_var_on_rhs/model.py | 6 +- .../algebraic_eqn_constant_on_rhs/model.c | 6 +- .../algebraic_eqn_constant_on_rhs/model.h | 6 +- .../algebraic_eqn_constant_on_rhs/model.py | 6 +- .../algebraic_eqn_derivative_on_rhs/model.c | 6 +- .../algebraic_eqn_derivative_on_rhs/model.h | 6 +- .../algebraic_eqn_derivative_on_rhs/model.py | 6 +- .../model.c | 6 +- .../model.h | 6 +- .../model.py | 6 +- .../algebraic_eqn_state_var_on_rhs/model.c | 6 +- .../algebraic_eqn_state_var_on_rhs/model.h | 6 +- .../algebraic_eqn_state_var_on_rhs/model.py | 6 +- .../model.c | 6 +- .../model.h | 6 +- .../model.py | 6 +- .../model.c | 6 +- .../model.external.c | 6 +- .../model.external.h | 6 +- .../model.external.py | 6 +- .../model.h | 6 +- .../model.py | 6 +- .../model.c | 6 +- .../model.h | 6 +- .../model.one.external.c | 6 +- .../model.one.external.h | 6 +- .../model.one.external.py | 6 +- .../model.py | 6 +- .../model.three.externals.c | 6 +- .../model.three.externals.h | 6 +- .../model.three.externals.py | 6 +- .../model.two.externals.c | 6 +- .../model.two.externals.h | 6 +- .../model.two.externals.py | 6 +- .../model.not.ordered.c | 6 +- .../model.not.ordered.h | 6 +- .../model.not.ordered.py | 6 +- .../model.ordered.c | 6 +- .../model.ordered.h | 6 +- .../model.ordered.py | 6 +- .../algebraic_unknown_var_on_rhs/model.c | 6 +- .../algebraic_unknown_var_on_rhs/model.h | 6 +- .../algebraic_unknown_var_on_rhs/model.py | 6 +- .../generator/cell_geometry_model/model.c | 6 +- .../cell_geometry_model/model.external.c | 6 +- .../cell_geometry_model/model.external.h | 6 +- .../cell_geometry_model/model.external.py | 6 +- .../generator/cell_geometry_model/model.h | 6 +- .../generator/cell_geometry_model/model.py | 6 +- .../model.c | 6 +- .../model.h | 6 +- .../model.py | 6 +- .../generator/cellml_slc_example/model.py | 6 +- .../model.c | 6 +- .../model.h | 6 +- .../model.py | 6 +- .../cellml_unit_scaling_constant/model.c | 6 +- .../cellml_unit_scaling_constant/model.h | 6 +- .../cellml_unit_scaling_constant/model.py | 6 +- .../cellml_unit_scaling_rate/model.c | 6 +- .../cellml_unit_scaling_rate/model.h | 6 +- .../cellml_unit_scaling_rate/model.py | 6 +- .../cellml_unit_scaling_state/model.c | 6 +- .../cellml_unit_scaling_state/model.h | 6 +- .../cellml_unit_scaling_state/model.py | 6 +- .../model.c | 6 +- .../model.h | 6 +- .../model.py | 6 +- .../model.c | 6 +- .../model.h | 6 +- .../model.py | 6 +- .../cellml_unit_scaling_voi_direct/model.c | 6 +- .../cellml_unit_scaling_voi_direct/model.h | 6 +- .../cellml_unit_scaling_voi_direct/model.py | 6 +- .../cellml_unit_scaling_voi_indirect/model.c | 6 +- .../cellml_unit_scaling_voi_indirect/model.h | 6 +- .../cellml_unit_scaling_voi_indirect/model.py | 6 +- .../generator/dae_cellml_1_1_model/model.c | 6 +- .../generator/dae_cellml_1_1_model/model.h | 6 +- .../generator/dae_cellml_1_1_model/model.py | 6 +- .../generator/dependent_eqns/model.c | 6 +- .../generator/dependent_eqns/model.h | 6 +- .../generator/dependent_eqns/model.py | 6 +- .../model.c | 6 +- .../model.h | 6 +- .../model.py | 6 +- .../model.c | 6 +- .../model.h | 6 +- .../model.py | 6 +- .../model.algebraic.c | 6 +- .../model.algebraic.h | 6 +- .../model.algebraic.py | 6 +- .../model.c | 6 +- .../model.computed.constant.c | 6 +- .../model.computed.constant.h | 6 +- .../model.computed.constant.py | 6 +- .../model.constant.c | 6 +- .../model.constant.h | 6 +- .../model.constant.py | 6 +- .../model.dae.c | 6 +- .../model.dae.h | 6 +- .../model.dae.py | 6 +- .../model.dependent.algebraic.c | 6 +- .../model.dependent.algebraic.h | 6 +- .../model.dependent.algebraic.py | 6 +- .../model.dependent.computed.constant.c | 6 +- .../model.dependent.computed.constant.h | 6 +- .../model.dependent.computed.constant.py | 6 +- .../model.dependent.constant.c | 6 +- .../model.dependent.constant.h | 6 +- .../model.dependent.constant.py | 6 +- .../model.dependent.state.c | 6 +- .../model.dependent.state.h | 6 +- .../model.dependent.state.py | 6 +- .../model.external.c | 6 +- .../model.external.h | 6 +- .../model.external.py | 6 +- .../model.h | 6 +- .../model.py | 6 +- .../model.state.c | 6 +- .../model.state.h | 6 +- .../model.state.py | 6 +- .../generator/noble_model_1962/model.c | 6 +- .../generator/noble_model_1962/model.h | 6 +- .../generator/noble_model_1962/model.py | 6 +- .../generator/ode_computed_var_on_rhs/model.c | 6 +- .../generator/ode_computed_var_on_rhs/model.h | 6 +- .../ode_computed_var_on_rhs/model.py | 6 +- .../model.c | 6 +- .../model.h | 6 +- .../model.py | 6 +- .../generator/ode_const_var_on_rhs/model.c | 6 +- .../generator/ode_const_var_on_rhs/model.h | 6 +- .../generator/ode_const_var_on_rhs/model.py | 6 +- .../model.c | 6 +- .../model.h | 6 +- .../model.py | 6 +- .../generator/ode_constant_on_rhs/model.c | 6 +- .../generator/ode_constant_on_rhs/model.h | 6 +- .../generator/ode_constant_on_rhs/model.py | 6 +- .../ode_constant_on_rhs_one_component/model.c | 6 +- .../ode_constant_on_rhs_one_component/model.h | 6 +- .../model.py | 6 +- .../ode_multiple_dependent_odes/model.c | 6 +- .../ode_multiple_dependent_odes/model.h | 6 +- .../ode_multiple_dependent_odes/model.py | 6 +- .../model.c | 6 +- .../model.h | 6 +- .../model.py | 6 +- .../ode_multiple_odes_with_same_name/model.c | 6 +- .../ode_multiple_odes_with_same_name/model.h | 6 +- .../ode_multiple_odes_with_same_name/model.py | 6 +- .../generator/ode_unknown_var_on_rhs/model.c | 6 +- .../generator/ode_unknown_var_on_rhs/model.h | 6 +- .../generator/ode_unknown_var_on_rhs/model.py | 6 +- .../robertson_model_1966/model.dae.c | 6 +- .../robertson_model_1966/model.dae.h | 6 +- .../robertson_model_1966/model.dae.py | 6 +- .../robertson_model_1966/model.ode.c | 6 +- .../robertson_model_1966/model.ode.h | 6 +- .../robertson_model_1966/model.ode.py | 6 +- .../generator/sine_model_imports/model.c | 6 +- .../generator/sine_model_imports/model.h | 6 +- .../generator/sine_model_imports/model.py | 6 +- .../model.c | 6 +- .../model.h | 6 +- .../model.py | 6 +- .../model.c | 6 +- .../model.h | 6 +- .../model.py | 6 +- 221 files changed, 1684 insertions(+), 666 deletions(-) diff --git a/src/analyser.cpp b/src/analyser.cpp index 8b7c869481..23a6938618 100644 --- a/src/analyser.cpp +++ b/src/analyser.cpp @@ -2502,8 +2502,8 @@ bool Analyser::AnalyserImpl::isStateRateBased(const AnalyserEquationPtr &equatio if ((dependency->type() == AnalyserEquation::Type::ODE) || ((dependency->type() == AnalyserEquation::Type::NLA) - && (dependency->variableCount() == 1) - && (dependency->variable(0)->type() == AnalyserVariable::Type::STATE)) + && (dependency->algebraicCount() == 1) + && (dependency->algebraic(0)->type() == AnalyserVariable::Type::STATE)) || isStateRateBased(dependency, checkedEquations)) { return true; } @@ -3121,7 +3121,7 @@ void Analyser::AnalyserImpl::analyseModel(const ModelPtr &model) if (type == AnalyserVariable::Type::STATE) { mModel->mPimpl->mStates.push_back(variable); } else { - mModel->mPimpl->mVariables.push_back(variable); + mModel->mPimpl->mAlgebraic.push_back(variable); } } @@ -3131,13 +3131,13 @@ void Analyser::AnalyserImpl::analyseModel(const ModelPtr &model) // Determine all the variables computed by the equation, as well as // whether the equation is an external one. - AnalyserVariablePtrs variables; + AnalyserVariablePtrs algebraic; auto externalEquation = true; for (const auto &unknownVariable : internalEquation->mUnknownVariables) { auto variable = aiv2avMappings[unknownVariable]; - variables.push_back(variable); + algebraic.push_back(variable); if (variable->type() != AnalyserVariable::Type::EXTERNAL) { externalEquation = false; @@ -3264,7 +3264,8 @@ void Analyser::AnalyserImpl::analyseModel(const ModelPtr &model) equationDependencies, internalEquation->mNlaSystemIndex, equationNlaSiblings, - variables); + {}, + algebraic); mModel->mPimpl->mEquations.push_back(equation); } diff --git a/src/analyserequation.cpp b/src/analyserequation.cpp index 228dd119e0..7869e910d1 100644 --- a/src/analyserequation.cpp +++ b/src/analyserequation.cpp @@ -33,7 +33,8 @@ void AnalyserEquation::AnalyserEquationImpl::populate(AnalyserEquation::Type typ const std::vector &dependencies, size_t nlaSystemIndex, const std::vector &nlaSiblings, - const std::vector &variables) + const std::vector &computedConstants, + const std::vector &algebraic) { mType = type; mAst = ast; @@ -41,14 +42,21 @@ void AnalyserEquation::AnalyserEquationImpl::populate(AnalyserEquation::Type typ std::copy(dependencies.begin(), dependencies.end(), back_inserter(mDependencies)); std::copy(nlaSiblings.begin(), nlaSiblings.end(), back_inserter(mNlaSiblings)); - std::copy(variables.begin(), variables.end(), back_inserter(mVariables)); + std::copy(computedConstants.begin(), computedConstants.end(), back_inserter(mComputedConstants)); + std::copy(algebraic.begin(), algebraic.end(), back_inserter(mAlgebraic)); } bool AnalyserEquation::AnalyserEquationImpl::isEmptyDependency(const AnalyserEquationWeakPtr &dependency) { - auto variables = dependency.lock()->variables(); + auto computedConstants = dependency.lock()->computedConstants(); - if (std::any_of(variables.begin(), variables.end(), [](const auto &v) { return v != nullptr; })) { + if (std::any_of(computedConstants.begin(), computedConstants.end(), [](const auto &v) { return v != nullptr; })) { + return false; + } + + auto algebraic = dependency.lock()->algebraic(); + + if (std::any_of(algebraic.begin(), algebraic.end(), [](const auto &v) { return v != nullptr; })) { return false; } @@ -153,23 +161,42 @@ bool AnalyserEquation::isStateRateBased() const return mPimpl->mIsStateRateBased; } -size_t AnalyserEquation::variableCount() const +size_t AnalyserEquation::computedConstantCount() const +{ + return mPimpl->mComputedConstants.size(); +} + +std::vector AnalyserEquation::computedConstants() const +{ + return mPimpl->mComputedConstants; +} + +AnalyserVariablePtr AnalyserEquation::computedConstant(size_t index) const +{ + if (index >= mPimpl->mComputedConstants.size()) { + return {}; + } + + return mPimpl->mComputedConstants[index]; +} + +size_t AnalyserEquation::algebraicCount() const { - return mPimpl->mVariables.size(); + return mPimpl->mAlgebraic.size(); } -std::vector AnalyserEquation::variables() const +std::vector AnalyserEquation::algebraic() const { - return mPimpl->mVariables; + return mPimpl->mAlgebraic; } -AnalyserVariablePtr AnalyserEquation::variable(size_t index) const +AnalyserVariablePtr AnalyserEquation::algebraic(size_t index) const { - if (index >= mPimpl->mVariables.size()) { + if (index >= mPimpl->mAlgebraic.size()) { return {}; } - return mPimpl->mVariables[index]; + return mPimpl->mAlgebraic[index]; } } // namespace libcellml diff --git a/src/analyserequation_p.h b/src/analyserequation_p.h index 79d9fa63ad..ae3e576afb 100644 --- a/src/analyserequation_p.h +++ b/src/analyserequation_p.h @@ -35,7 +35,8 @@ struct AnalyserEquation::AnalyserEquationImpl size_t mNlaSystemIndex; std::vector mNlaSiblings; bool mIsStateRateBased = false; - std::vector mVariables; + std::vector mComputedConstants; + std::vector mAlgebraic; static AnalyserEquationPtr create(); @@ -44,7 +45,8 @@ struct AnalyserEquation::AnalyserEquationImpl const std::vector &dependencies, size_t nlaSystemIndex, const std::vector &nlaSiblings, - const std::vector &variables); + const std::vector &computedConstants, + const std::vector &algebraic); static bool isEmptyDependency(const AnalyserEquationWeakPtr &dependency); diff --git a/src/analysermodel.cpp b/src/analysermodel.cpp index 1931ca3893..459b4795b1 100644 --- a/src/analysermodel.cpp +++ b/src/analysermodel.cpp @@ -121,31 +121,85 @@ AnalyserVariablePtr AnalyserModel::state(size_t index) const return mPimpl->mStates[index]; } -size_t AnalyserModel::variableCount() const +size_t AnalyserModel::constantCount() const { if (!isValid()) { return 0; } - return mPimpl->mVariables.size(); + return mPimpl->mConstants.size(); } -std::vector AnalyserModel::variables() const +std::vector AnalyserModel::constants() const { if (!isValid()) { return {}; } - return mPimpl->mVariables; + return mPimpl->mConstants; } -AnalyserVariablePtr AnalyserModel::variable(size_t index) const +AnalyserVariablePtr AnalyserModel::constant(size_t index) const { - if (!isValid() || (index >= mPimpl->mVariables.size())) { + if (!isValid() || (index >= mPimpl->mConstants.size())) { return {}; } - return mPimpl->mVariables[index]; + return mPimpl->mConstants[index]; +} + +size_t AnalyserModel::computedConstantCount() const +{ + if (!isValid()) { + return 0; + } + + return mPimpl->mComputedConstants.size(); +} + +std::vector AnalyserModel::computedConstants() const +{ + if (!isValid()) { + return {}; + } + + return mPimpl->mComputedConstants; +} + +AnalyserVariablePtr AnalyserModel::computedConstant(size_t index) const +{ + if (!isValid() || (index >= mPimpl->mComputedConstants.size())) { + return {}; + } + + return mPimpl->mComputedConstants[index]; +} + +size_t AnalyserModel::algebraicCount() const +{ + if (!isValid()) { + return 0; + } + + return mPimpl->mAlgebraic.size(); +} + +std::vector AnalyserModel::algebraic() const +{ + if (!isValid()) { + return {}; + } + + return mPimpl->mAlgebraic; +} + +AnalyserVariablePtr AnalyserModel::algebraic(size_t index) const +{ + if (!isValid() || (index >= mPimpl->mAlgebraic.size())) { + return {}; + } + + return mPimpl->mAlgebraic[index]; } size_t AnalyserModel::equationCount() const diff --git a/src/analysermodel_p.h b/src/analysermodel_p.h index 2933e8a948..ae7d9709c8 100644 --- a/src/analysermodel_p.h +++ b/src/analysermodel_p.h @@ -35,7 +35,9 @@ struct AnalyserModel::AnalyserModelImpl AnalyserVariablePtr mVoi; std::vector mStates; - std::vector mVariables; + std::vector mConstants; + std::vector mComputedConstants; + std::vector mAlgebraic; std::vector mEquations; bool mNeedEqFunction = false; diff --git a/src/api/libcellml/analyserequation.h b/src/api/libcellml/analyserequation.h index d8a961e6ba..b2ca20ca01 100644 --- a/src/api/libcellml/analyserequation.h +++ b/src/api/libcellml/analyserequation.h @@ -166,33 +166,62 @@ class LIBCELLML_EXPORT AnalyserEquation bool isStateRateBased() const; /** - * @brief Get the number of variables computed by this @ref AnalyserEquation. + * @brief Get the number of computed constants computed by this @ref AnalyserEquation. * - * Return the number of variables computed by this @ref AnalyserEquation. + * Return the number of computed constants computed by this @ref AnalyserEquation. * - * @return The number of variables. + * @return The number of computed constants. */ - size_t variableCount() const; + size_t computedConstantCount() const; /** - * @brief Get the variables computed by this @ref AnalyserEquation. + * @brief Get the computed constants computed by this @ref AnalyserEquation. * - * Return the variables computed by this @ref AnalyserEquation. + * Return the computed constants computed by this @ref AnalyserEquation. * - * @return The variables as a @c std::vector. + * @return The computed constants as a @c std::vector. */ - std::vector variables() const; + std::vector computedConstants() const; /** - * @brief Get the variable, at @p index, computed by this @ref AnalyserEquation. + * @brief Get the computed constant, at @p index, computed by this @ref AnalyserEquation. * - * Return the variable, at @p index, computed by this @ref AnalyserEquation. + * Return the computed constant, at @p index, computed by this @ref AnalyserEquation. * - * @param index The index of the variable to return. + * @param index The index of the computed constant to return. * - * @return The variable, at @p index, on success, @c nullptr on failure. + * @return The computed constant, at @p index, on success, @c nullptr on failure. */ - AnalyserVariablePtr variable(size_t index) const; + AnalyserVariablePtr computedConstant(size_t index) const; + + /** + * @brief Get the number of algebraic variables computed by this @ref AnalyserEquation. + * + * Return the number of algebraic variables computed by this @ref AnalyserEquation. + * + * @return The number of algebraic variables. + */ + size_t algebraicCount() const; + + /** + * @brief Get the algebraic variables computed by this @ref AnalyserEquation. + * + * Return the algebraic variables computed by this @ref AnalyserEquation. + * + * @return The algebraic variables as a @c std::vector. + */ + std::vector algebraic() const; + + /** + * @brief Get the algebraic variable, at @p index, computed by this @ref AnalyserEquation. + * + * Return the algebraic variable, at @p index, computed by this @ref AnalyserEquation. + * + * @param index The index of the algebraic variable to return. + * + * @return The algebraic variable, at @p index, on success, @c nullptr on failure. + */ + AnalyserVariablePtr algebraic(size_t index) const; private: AnalyserEquation(); /**< Constructor, @private. */ diff --git a/src/api/libcellml/analysermodel.h b/src/api/libcellml/analysermodel.h index e6358dcb7e..d8e075bd78 100644 --- a/src/api/libcellml/analysermodel.h +++ b/src/api/libcellml/analysermodel.h @@ -142,34 +142,94 @@ class LIBCELLML_EXPORT AnalyserModel AnalyserVariablePtr state(size_t index) const; /** - * @brief Get the number of variables. + * @brief Get the number of constants. * - * Return the number of variables in the @ref AnalyserModel. + * Return the number of constants in the @ref AnalyserModel. * - * @return The number of variables. + * @return The number of constants. */ - size_t variableCount() const; + size_t constantCount() const; /** - * @brief Get the variables. + * @brief Get the constants. * - * Return the variables in the @ref AnalyserModel. + * Return the constants in the @ref AnalyserModel. * - * @return The variables as a @c std::vector. + * @return The constants as a @c std::vector. */ - std::vector variables() const; + std::vector constants() const; /** - * @brief Get the variable at @p index. + * @brief Get the constant at @p index. * - * Return the variable at the index @p index for the @ref AnalyserModel. + * Return the constant at the index @p index for the @ref AnalyserModel. * - * @param index The index of the variable to return. + * @param index The index of the constant to return. * - * @return The variable at the given @p index on success, @c nullptr on + * @return The constant at the given @p index on success, @c nullptr on * failure. */ - AnalyserVariablePtr variable(size_t index) const; + AnalyserVariablePtr constant(size_t index) const; + + /** + * @brief Get the number of computed constants. + * + * Return the number of computed constants in the @ref AnalyserModel. + * + * @return The number of computed constants. + */ + size_t computedConstantCount() const; + + /** + * @brief Get the computed constants. + * + * Return the computed constants in the @ref AnalyserModel. + * + * @return The computed constants as a @c std::vector. + */ + std::vector computedConstants() const; + + /** + * @brief Get the computed constant at @p index. + * + * Return the computed constant at the index @p index for the @ref AnalyserModel. + * + * @param index The index of the computed constant to return. + * + * @return The computed constant at the given @p index on success, @c nullptr on + * failure. + */ + AnalyserVariablePtr computedConstant(size_t index) const; + + /** + * @brief Get the number of algebraic variables. + * + * Return the number of algebraic variables in the @ref AnalyserModel. + * + * @return The number of algebraic variables. + */ + size_t algebraicCount() const; + + /** + * @brief Get the algebraic variables. + * + * Return the algebraic variables in the @ref AnalyserModel. + * + * @return The algebraic variables as a @c std::vector. + */ + std::vector algebraic() const; + + /** + * @brief Get the algebraic variable at @p index. + * + * Return the algebraic variable at the index @p index for the @ref AnalyserModel. + * + * @param index The index of the algebraic variable to return. + * + * @return The algebraic variable at the given @p index on success, @c nullptr on + * failure. + */ + AnalyserVariablePtr algebraic(size_t index) const; /** * @brief Get the number of equations. diff --git a/src/api/libcellml/generatorprofile.h b/src/api/libcellml/generatorprofile.h index 10335d24d8..cb85018fbe 100644 --- a/src/api/libcellml/generatorprofile.h +++ b/src/api/libcellml/generatorprofile.h @@ -2462,52 +2462,148 @@ class LIBCELLML_EXPORT GeneratorProfile void setImplementationStateCountString(const std::string &implementationStateCountString); /** - * @brief Get the @c std::string for the interface of the variable count + * @brief Get the @c std::string for the interface of the constant count * constant. * - * Return the @c std::string for the interface of the variable count + * Return the @c std::string for the interface of the constant count * constant. * - * @return The @c std::string for the interface of the variable count + * @return The @c std::string for the interface of the constant count * constant. */ - std::string interfaceVariableCountString() const; + std::string interfaceConstantCountString() const; /** - * @brief Set the @c std::string for the interface of the variable count + * @brief Set the @c std::string for the interface of the constant count * constant. * - * Set the @c std::string for the interface of the variable count constant. + * Set the @c std::string for the interface of the constant count constant. * - * @param interfaceVariableCountString The @c std::string to use for the - * interface of the variable count constant. + * @param interfaceConstantCountString The @c std::string to use for the + * interface of the constant count constant. */ - void setInterfaceVariableCountString(const std::string &interfaceVariableCountString); + void setInterfaceConstantCountString(const std::string &interfaceConstantCountString); /** - * @brief Get the @c std::string for the implementation of the variable + * @brief Get the @c std::string for the implementation of the constant * count constant. * - * Return the @c std::string for the implementation of the variable count + * Return the @c std::string for the implementation of the constant count * constant. * - * @return The @c std::string for the implementation of the variable count + * @return The @c std::string for the implementation of the constant count * constant. */ - std::string implementationVariableCountString() const; + std::string implementationConstantCountString() const; /** - * @brief Set the @c std::string for the implementation of the variable + * @brief Set the @c std::string for the implementation of the constant * count constant. * - * Set the @c std::string for the implementation of the variable count - * constant. To be useful, the string should contain the [VARIABLE_COUNT] + * Set the @c std::string for the implementation of the constant count + * constant. To be useful, the string should contain the [CONSTANT_COUNT] * tag, which will be replaced with the number of states in the model. * - * @param implementationVariableCountString The @c std::string to use for - * the implementation of the variable count constant. + * @param implementationConstantCountString The @c std::string to use for + * the implementation of the constant count constant. */ - void setImplementationVariableCountString(const std::string &implementationVariableCountString); + void setImplementationConstantCountString(const std::string &implementationConstantCountString); + + /** + * @brief Get the @c std::string for the interface of the computed constant count + * constant. + * + * Return the @c std::string for the interface of the computed constant count + * constant. + * + * @return The @c std::string for the interface of the computed constant count + * constant. + */ + std::string interfaceComputedConstantCountString() const; + + /** + * @brief Set the @c std::string for the interface of the computed constant count + * constant. + * + * Set the @c std::string for the interface of the computed constant count constant. + * + * @param interfaceComputedConstantCountString The @c std::string to use for the + * interface of the computed constant count constant. + */ + void setInterfaceComputedConstantCountString(const std::string &interfaceComputedConstantCountString); + + /** + * @brief Get the @c std::string for the implementation of the computed constant + * count constant. + * + * Return the @c std::string for the implementation of the computed constant count + * constant. + * + * @return The @c std::string for the implementation of the computed constant count + * constant. + */ + std::string implementationComputedConstantCountString() const; + + /** + * @brief Set the @c std::string for the implementation of the computed constant + * count constant. + * + * Set the @c std::string for the implementation of the computed constant count + * constant. To be useful, the string should contain the [COMPUTED_CONSTANT_COUNT] + * tag, which will be replaced with the number of states in the model. + * + * @param implementationComputedConstantCountString The @c std::string to use for + * the implementation of the computed constant count constant. + */ + void setImplementationComputedConstantCountString(const std::string &implementationComputedConstantCountString); + + /** + * @brief Get the @c std::string for the interface of the algebraic count + * constant. + * + * Return the @c std::string for the interface of the algebraic count + * constant. + * + * @return The @c std::string for the interface of the algebraic count + * constant. + */ + std::string interfaceAlgebraicCountString() const; + + /** + * @brief Set the @c std::string for the interface of the algebraic count + * constant. + * + * Set the @c std::string for the interface of the algebraic count constant. + * + * @param interfaceAlgebraicCountString The @c std::string to use for the + * interface of the algebraic count constant. + */ + void setInterfaceAlgebraicCountString(const std::string &interfaceAlgebraicCountString); + + /** + * @brief Get the @c std::string for the implementation of the algebraic + * count constant. + * + * Return the @c std::string for the implementation of the algebraic count + * constant. + * + * @return The @c std::string for the implementation of the algebraic count + * constant. + */ + std::string implementationAlgebraicCountString() const; + + /** + * @brief Set the @c std::string for the implementation of the algebraic + * count constant. + * + * Set the @c std::string for the implementation of the algebraic count + * constant. To be useful, the string should contain the [ALGEBRAIC_COUNT] + * tag, which will be replaced with the number of states in the model. + * + * @param implementationAlgebraicCountString The @c std::string to use for + * the implementation of the algebraic count constant. + */ + void setImplementationAlgebraicCountString(const std::string &implementationAlgebraicCountString); /** * @brief Get the @c std::string for the data structure for the variable diff --git a/src/bindings/interface/analyserequation.i b/src/bindings/interface/analyserequation.i index 208290c498..8cdce8a0d8 100644 --- a/src/bindings/interface/analyserequation.i +++ b/src/bindings/interface/analyserequation.i @@ -43,14 +43,23 @@ %feature("docstring") libcellml::AnalyserEquation::isStateRateBased "Tests if this :class:`AnalyserEquation` object relies on states and/or rates."; -%feature("docstring") libcellml::AnalyserEquation::variableCount -"Returns the number of variables computed by this :class:`AnalyserEquation` object."; +%feature("docstring") libcellml::AnalyserEquation::computedConstantCount +"Returns the number of computed constants computed by this :class:`AnalyserEquation` object."; -%feature("docstring") libcellml::AnalyserEquation::variables -"Returns the variables computed by this :class:`AnalyserEquation` object."; +%feature("docstring") libcellml::AnalyserEquation::computedConstants +"Returns the computed constants computed by this :class:`AnalyserEquation` object."; -%feature("docstring") libcellml::AnalyserEquation::variable -"Returns the variable, at the given index, computed by this :class:`AnalyserEquation` object."; +%feature("docstring") libcellml::AnalyserEquation::computedConstant +"Returns the computed constant, at the given index, computed by this :class:`AnalyserEquation` object."; + +%feature("docstring") libcellml::AnalyserEquation::algebraicCount +"Returns the number of algebraic variables computed by this :class:`AnalyserEquation` object."; + +%feature("docstring") libcellml::AnalyserEquation::algebraic +"Returns the algebraic variables computed by this :class:`AnalyserEquation` object."; + +%feature("docstring") libcellml::AnalyserEquation::algebraic +"Returns the algebraic variable, at the given index, computed by this :class:`AnalyserEquation` object."; %{ #include "libcellml/analyserequation.h" diff --git a/src/bindings/interface/analysermodel.i b/src/bindings/interface/analysermodel.i index 704d3e2f41..8933692ddd 100644 --- a/src/bindings/interface/analysermodel.i +++ b/src/bindings/interface/analysermodel.i @@ -34,14 +34,32 @@ %feature("docstring") libcellml::AnalyserModel::state "Returns the state, specified by index, contained by this :class:`AnalyserModel` object."; -%feature("docstring") libcellml::AnalyserModel::variableCount -"Returns the number of variables contained by this :class:`AnalyserModel` object."; +%feature("docstring") libcellml::AnalyserModel::constantCount +"Returns the number of constants contained by this :class:`AnalyserModel` object."; -%feature("docstring") libcellml::AnalyserModel::variables -"Returns the variables contained by this :class:`AnalyserModel` object."; +%feature("docstring") libcellml::AnalyserModel::constants +"Returns the constants contained by this :class:`AnalyserModel` object."; -%feature("docstring") libcellml::AnalyserModel::variable -"Returns the variable, specified by index, contained by this :class:`AnalyserModel` object."; +%feature("docstring") libcellml::AnalyserModel::constant +"Returns the constant, specified by index, contained by this :class:`AnalyserModel` object."; + +%feature("docstring") libcellml::AnalyserModel::computedConstantCount +"Returns the number of computed constants contained by this :class:`AnalyserModel` object."; + +%feature("docstring") libcellml::AnalyserModel::computedConstants +"Returns the computed constants contained by this :class:`AnalyserModel` object."; + +%feature("docstring") libcellml::AnalyserModel::computedConstant +"Returns the computed constant, specified by index, contained by this :class:`AnalyserModel` object."; + +%feature("docstring") libcellml::AnalyserModel::algebraicCount +"Returns the number of algebraic variables contained by this :class:`AnalyserModel` object."; + +%feature("docstring") libcellml::AnalyserModel::algebraic +"Returns the algebraic variables contained by this :class:`AnalyserModel` object."; + +%feature("docstring") libcellml::AnalyserModel::algebraic +"Returns the algebraic variable, specified by index, contained by this :class:`AnalyserModel` object."; %feature("docstring") libcellml::AnalyserModel::equationCount "Returns the number of equations contained by this :class:`AnalyserModel` object."; diff --git a/src/bindings/interface/generatorprofile.i b/src/bindings/interface/generatorprofile.i index 603ccd5b07..e8da17ba39 100644 --- a/src/bindings/interface/generatorprofile.i +++ b/src/bindings/interface/generatorprofile.i @@ -677,18 +677,44 @@ used respectively."; "Sets the string for the implementation of the state count constant. To be useful, the string should contain the tag, which will be replaced with the number of states in the model."; -%feature("docstring") libcellml::GeneratorProfile::interfaceVariableCountString -"Returns the string for the interface of the variable count constant."; +%feature("docstring") libcellml::GeneratorProfile::interfaceConstantCountString +"Returns the string for the interface of the constant count constant."; -%feature("docstring") libcellml::GeneratorProfile::setInterfaceVariableCountString -"Sets the string for the interface of the variable count constant."; +%feature("docstring") libcellml::GeneratorProfile::setInterfaceConstantCountString +"Sets the string for the interface of the constant count constant."; -%feature("docstring") libcellml::GeneratorProfile::implementationVariableCountString -"Returns the string for the implementation of the variable count constant."; +%feature("docstring") libcellml::GeneratorProfile::implementationConstantCountString +"Returns the string for the implementation of the constant count constant."; -%feature("docstring") libcellml::GeneratorProfile::setImplementationVariableCountString -"Sets the string for the implementation of the variable count constant. To be useful, the string should contain -the tag, which will be replaced with the number of states in the model."; +%feature("docstring") libcellml::GeneratorProfile::setImplementationConstantCountString +"Sets the string for the implementation of the constant count constant. To be useful, the string should contain +the tag, which will be replaced with the number of states in the model."; + +%feature("docstring") libcellml::GeneratorProfile::interfaceComputedConstantCountString +"Returns the string for the interface of the computed constant count constant."; + +%feature("docstring") libcellml::GeneratorProfile::setInterfaceComputedConstantCountString +"Sets the string for the interface of the computed constant count constant."; + +%feature("docstring") libcellml::GeneratorProfile::implementationComputedConstantCountString +"Returns the string for the implementation of the computed constant count constant."; + +%feature("docstring") libcellml::GeneratorProfile::setImplementationComputedConstantCountString +"Sets the string for the implementation of the computed constant count constant. To be useful, the string should contain +the tag, which will be replaced with the number of states in the model."; + +%feature("docstring") libcellml::GeneratorProfile::interfaceAlgebraicCountString +"Returns the string for the interface of the algebraic count constant."; + +%feature("docstring") libcellml::GeneratorProfile::setInterfaceAlgebraicCountString +"Sets the string for the interface of the algebraic count constant."; + +%feature("docstring") libcellml::GeneratorProfile::implementationAlgebraicCountString +"Returns the string for the implementation of the algebraic count constant."; + +%feature("docstring") libcellml::GeneratorProfile::setImplementationAlgebraicCountString +"Sets the string for the implementation of the algebraic count constant. To be useful, the string should contain +the tag, which will be replaced with the number of states in the model."; %feature("docstring") libcellml::GeneratorProfile::variableTypeObjectString "Returns the string for the data structure for the variable type object."; diff --git a/src/bindings/javascript/analyserequation.cpp b/src/bindings/javascript/analyserequation.cpp index d7579751f8..c7a9daf695 100644 --- a/src/bindings/javascript/analyserequation.cpp +++ b/src/bindings/javascript/analyserequation.cpp @@ -45,9 +45,12 @@ EMSCRIPTEN_BINDINGS(libcellml_analyserequation) .function("nlaSiblings", &libcellml::AnalyserEquation::nlaSiblings) .function("nlaSibling", &libcellml::AnalyserEquation::nlaSibling) .function("isStateRateBased", &libcellml::AnalyserEquation::isStateRateBased) - .function("variableCount", &libcellml::AnalyserEquation::variableCount) - .function("variables", &libcellml::AnalyserEquation::variables) - .function("variable", &libcellml::AnalyserEquation::variable) + .function("computedConstantCount", &libcellml::AnalyserEquation::computedConstantCount) + .function("computedConstants", &libcellml::AnalyserEquation::computedConstants) + .function("computedConstant", &libcellml::AnalyserEquation::computedConstant) + .function("algebraicCount", &libcellml::AnalyserEquation::algebraicCount) + .function("algebraicVariables", select_overload() const>(&libcellml::AnalyserEquation::algebraic)) + .function("algebraicVariable", select_overload(&libcellml::AnalyserEquation::algebraic)) ; EM_ASM( diff --git a/src/bindings/javascript/analysermodel.cpp b/src/bindings/javascript/analysermodel.cpp index 87a74085f5..3103e413a7 100644 --- a/src/bindings/javascript/analysermodel.cpp +++ b/src/bindings/javascript/analysermodel.cpp @@ -45,9 +45,15 @@ EMSCRIPTEN_BINDINGS(libcellml_analysermodel) .function("stateCount", &libcellml::AnalyserModel::stateCount) .function("states", &libcellml::AnalyserModel::states) .function("state", &libcellml::AnalyserModel::state) - .function("variableCount", &libcellml::AnalyserModel::variableCount) - .function("variables", &libcellml::AnalyserModel::variables) - .function("variable", &libcellml::AnalyserModel::variable) + .function("constantCount", &libcellml::AnalyserModel::constantCount) + .function("constants", &libcellml::AnalyserModel::constants) + .function("constant", &libcellml::AnalyserModel::constant) + .function("computedConstantCount", &libcellml::AnalyserModel::computedConstantCount) + .function("computedConstants", &libcellml::AnalyserModel::computedConstants) + .function("computedConstant", &libcellml::AnalyserModel::computedConstant) + .function("algebraicCount", &libcellml::AnalyserModel::algebraicCount) + .function("algebraicVariables", select_overload() const>(&libcellml::AnalyserModel::algebraic)) + .function("algebraicVariable", select_overload(&libcellml::AnalyserModel::algebraic)) .function("equationCount", &libcellml::AnalyserModel::equationCount) .function("equations", &libcellml::AnalyserModel::equations) .function("equation", &libcellml::AnalyserModel::equation) diff --git a/src/bindings/javascript/generatorprofile.cpp b/src/bindings/javascript/generatorprofile.cpp index 41e4115fe0..97a6ee651d 100644 --- a/src/bindings/javascript/generatorprofile.cpp +++ b/src/bindings/javascript/generatorprofile.cpp @@ -251,10 +251,18 @@ EMSCRIPTEN_BINDINGS(libcellml_generatorprofile) .function("setInterfaceStateCountString", &libcellml::GeneratorProfile::setInterfaceStateCountString) .function("implementationStateCountString", &libcellml::GeneratorProfile::implementationStateCountString) .function("setImplementationStateCountString", &libcellml::GeneratorProfile::setImplementationStateCountString) - .function("interfaceVariableCountString", &libcellml::GeneratorProfile::interfaceVariableCountString) - .function("setInterfaceVariableCountString", &libcellml::GeneratorProfile::setInterfaceVariableCountString) - .function("implementationVariableCountString", &libcellml::GeneratorProfile::implementationVariableCountString) - .function("setImplementationVariableCountString", &libcellml::GeneratorProfile::setImplementationVariableCountString) + .function("interfaceConstantCountString", &libcellml::GeneratorProfile::interfaceConstantCountString) + .function("setInterfaceConstantCountString", &libcellml::GeneratorProfile::setInterfaceConstantCountString) + .function("implementationConstantCountString", &libcellml::GeneratorProfile::implementationConstantCountString) + .function("setImplementationConstantCountString", &libcellml::GeneratorProfile::setImplementationConstantCountString) + .function("interfaceComputedConstantCountString", &libcellml::GeneratorProfile::interfaceComputedConstantCountString) + .function("setInterfaceComputedConstantCountString", &libcellml::GeneratorProfile::setInterfaceComputedConstantCountString) + .function("implementationComputedConstantCountString", &libcellml::GeneratorProfile::implementationComputedConstantCountString) + .function("setImplementationComputedConstantCountString", &libcellml::GeneratorProfile::setImplementationComputedConstantCountString) + .function("interfaceAlgebraicCountString", &libcellml::GeneratorProfile::interfaceAlgebraicCountString) + .function("setInterfaceAlgebraicCountString", &libcellml::GeneratorProfile::setInterfaceAlgebraicCountString) + .function("implementationAlgebraicCountString", &libcellml::GeneratorProfile::implementationAlgebraicCountString) + .function("setImplementationAlgebraicCountString", &libcellml::GeneratorProfile::setImplementationAlgebraicCountString) .function("variableTypeObjectString", &libcellml::GeneratorProfile::variableTypeObjectString) .function("setVariableTypeObjectString", &libcellml::GeneratorProfile::setVariableTypeObjectString) .function("variableOfIntegrationVariableTypeString", &libcellml::GeneratorProfile::variableOfIntegrationVariableTypeString) diff --git a/src/debug.cpp b/src/debug.cpp index b78d788535..179a80935c 100644 --- a/src/debug.cpp +++ b/src/debug.cpp @@ -85,14 +85,24 @@ void printAnalyserModelEquations(const AnalyserModelPtr &model) Debug() << "\nType: " << AnalyserEquation::typeAsString(eqn->type()); - if (eqn->variableCount() != 0) { - Debug() << "\nVariables:"; + if (eqn->computedConstantCount() != 0) { + Debug() << "\nComputed constants:"; - for (const auto &var : eqn->variables()) { + for (const auto &var : eqn->computedConstants()) { Debug() << " - " << var->variable()->name(); } } else { - Debug() << "\nNo variables"; + Debug() << "\nNo computed constants"; + } + + if (eqn->algebraicCount() != 0) { + Debug() << "\nAlgebraic variables:"; + + for (const auto &var : eqn->algebraic()) { + Debug() << " - " << var->variable()->name(); + } + } else { + Debug() << "\nNo algebraic variables"; } if (eqn->dependencyCount() != 0) { @@ -102,7 +112,7 @@ void printAnalyserModelEquations(const AnalyserModelPtr &model) if (dep->ast() != nullptr) { Debug() << " - " << astAsCode(dep->ast()); } else if (dep->type() == AnalyserEquation::Type::EXTERNAL) { - Debug() << " - External equation for '" << dep->variable(0)->variable()->name() << "'"; + Debug() << " - External equation for '" << dep->algebraic(0)->variable()->name() << "'"; } else { Debug() << " - ??? [" << AnalyserEquation::typeAsString(dep->type()) << "]"; } @@ -119,7 +129,7 @@ void printAnalyserModelEquations(const AnalyserModelPtr &model) if (nlaSibling->ast() != nullptr) { Debug() << " - " << astAsCode(nlaSibling->ast()); } else if (nlaSibling->type() == AnalyserEquation::Type::EXTERNAL) { - Debug() << " - External equation for '" << nlaSibling->variable(0)->variable()->name() << "'"; + Debug() << " - External equation for '" << nlaSibling->algebraic(0)->variable()->name() << "'"; } else { Debug() << " - ??? [" << AnalyserEquation::typeAsString(nlaSibling->type()) << "]"; } @@ -133,12 +143,12 @@ void printAnalyserModelEquations(const AnalyserModelPtr &model) Debug() << "\n---------------------------------------[END]\n"; } -void printAnalyserModelVariables(const AnalyserModelPtr &model) +void printAnalyserModelVariables(const std::vector &variables) { size_t varNb = 0; - for (const auto &var : model->variables()) { - Debug() << "\n---------------------------------------[API variable " << ++varNb << "]"; + for (const auto &var : variables) { + Debug() << "\n---------------------------------------[API variable #" << ++varNb << "]"; Debug() << "\nName: " << var->variable()->name(); Debug() << "Type: " << AnalyserVariable::typeAsString(var->type()); @@ -149,7 +159,7 @@ void printAnalyserModelVariables(const AnalyserModelPtr &model) if (eqn->ast() != nullptr) { Debug() << " - " << astAsCode(eqn->ast()); } else if (eqn->type() == AnalyserEquation::Type::EXTERNAL) { - Debug() << " - External equation for '" << eqn->variable(0)->variable()->name() << "'"; + Debug() << " - External equation for '" << eqn->algebraic(0)->variable()->name() << "'"; } else { Debug() << " - ??? [" << AnalyserEquation::typeAsString(eqn->type()) << "]"; } @@ -160,6 +170,13 @@ void printAnalyserModelVariables(const AnalyserModelPtr &model) } } +void printAnalyserModelVariables(const AnalyserModelPtr &model) +{ + printAnalyserModelVariables(model->constants()); + printAnalyserModelVariables(model->computedConstants()); + printAnalyserModelVariables(model->algebraic()); +} + void printHistory(const History &history) { for (const auto &h : history) { diff --git a/src/generator.cpp b/src/generator.cpp index a018a63449..51a4e51b4b 100644 --- a/src/generator.cpp +++ b/src/generator.cpp @@ -64,6 +64,22 @@ bool Generator::GeneratorImpl::modelHasNlas() const } } +AnalyserVariablePtr Generator::GeneratorImpl::doAnalyserVariable(const VariablePtr &variable, + const std::vector &variables) const +{ + AnalyserVariablePtr res; + + for (const auto &var : variables) { + if (mModel->areEquivalentVariables(variable, var->variable())) { + res = var; + + break; + } + } + + return res; +} + AnalyserVariablePtr Generator::GeneratorImpl::analyserVariable(const VariablePtr &variable) const { // Find and return the analyser variable associated with the given variable. @@ -76,39 +92,18 @@ AnalyserVariablePtr Generator::GeneratorImpl::analyserVariable(const VariablePtr && mModel->areEquivalentVariables(variable, modelVoiVariable)) { res = modelVoi; } else { - for (const auto &modelState : mModel->states()) { - if (mModel->areEquivalentVariables(variable, modelState->variable())) { - res = modelState; + res = doAnalyserVariable(variable, mModel->states()); - break; - } + if (res == nullptr) { + res = doAnalyserVariable(variable, mModel->constants()); } if (res == nullptr) { - // Normally, we would have: - // - // for (const auto &modelVariable : mModel->variables()) { - // if (mModel->areEquivalentVariables(variable, modelVariable->variable())) { - // res = modelVariable; - // - // break; - // } - // } - // - // but we always have variables, so llvm-cov will complain that the - // false branch of our for loop is never reached. The below code is - // a bit more verbose but at least it makes llvm-cov happy. - - auto modelVariables = mModel->variables(); - auto modelVariable = modelVariables.begin(); - - do { - if (mModel->areEquivalentVariables(variable, (*modelVariable)->variable())) { - res = *modelVariable; - } else { - ++modelVariable; - } - } while (res == nullptr); + res = doAnalyserVariable(variable, mModel->computedConstants()); + } + + if (res == nullptr) { + res = doAnalyserVariable(variable, mModel->algebraic()); } } @@ -293,64 +288,80 @@ void Generator::GeneratorImpl::addImplementationHeaderCode() void Generator::GeneratorImpl::addVersionAndLibcellmlVersionCode(bool interface) { - std::string versionAndLibcellmlCode; + std::string code; if ((interface && !mProfile->interfaceVersionString().empty()) || (!interface && !mProfile->implementationVersionString().empty())) { if (interface) { - versionAndLibcellmlCode += mProfile->interfaceVersionString(); + code += mProfile->interfaceVersionString(); } else { if (modifiedProfile()) { static const std::regex regEx("([0-9]+\\.[0-9]+\\.[0-9]+)"); - versionAndLibcellmlCode += std::regex_replace(mProfile->implementationVersionString(), regEx, "$1.post0"); + code += std::regex_replace(mProfile->implementationVersionString(), regEx, "$1.post0"); } else { - versionAndLibcellmlCode += mProfile->implementationVersionString(); + code += mProfile->implementationVersionString(); } } } if ((interface && !mProfile->interfaceLibcellmlVersionString().empty()) || (!interface && !mProfile->implementationLibcellmlVersionString().empty())) { - versionAndLibcellmlCode += interface ? - mProfile->interfaceLibcellmlVersionString() : - replace(mProfile->implementationLibcellmlVersionString(), - "[LIBCELLML_VERSION]", versionString()); + code += interface ? + mProfile->interfaceLibcellmlVersionString() : + replace(mProfile->implementationLibcellmlVersionString(), + "[LIBCELLML_VERSION]", versionString()); } - if (!versionAndLibcellmlCode.empty()) { + if (!code.empty()) { mCode += "\n"; } - mCode += versionAndLibcellmlCode; + mCode += code; } void Generator::GeneratorImpl::addStateAndVariableCountCode(bool interface) { - std::string stateAndVariableCountCode; + std::string code; if (modelHasOdes() && ((interface && !mProfile->interfaceStateCountString().empty()) || (!interface && !mProfile->implementationStateCountString().empty()))) { - stateAndVariableCountCode += interface ? - mProfile->interfaceStateCountString() : - replace(mProfile->implementationStateCountString(), - "[STATE_COUNT]", std::to_string(mModel->stateCount())); + code += interface ? + mProfile->interfaceStateCountString() : + replace(mProfile->implementationStateCountString(), + "[STATE_COUNT]", std::to_string(mModel->stateCount())); } - if ((interface && !mProfile->interfaceVariableCountString().empty()) - || (!interface && !mProfile->implementationVariableCountString().empty())) { - stateAndVariableCountCode += interface ? - mProfile->interfaceVariableCountString() : - replace(mProfile->implementationVariableCountString(), - "[VARIABLE_COUNT]", std::to_string(mModel->variableCount())); + if ((interface && !mProfile->interfaceConstantCountString().empty()) + || (!interface && !mProfile->implementationConstantCountString().empty())) { + code += interface ? + mProfile->interfaceConstantCountString() : + replace(mProfile->implementationConstantCountString(), + "[CONSTANT_COUNT]", std::to_string(mModel->constantCount())); } - if (!stateAndVariableCountCode.empty()) { + if ((interface && !mProfile->interfaceComputedConstantCountString().empty()) + || (!interface && !mProfile->implementationComputedConstantCountString().empty())) { + code += interface ? + mProfile->interfaceComputedConstantCountString() : + replace(mProfile->implementationComputedConstantCountString(), + "[COMPUTED_CONSTANT_COUNT]", std::to_string(mModel->computedConstantCount())); + } + + if ((interface && !mProfile->interfaceAlgebraicCountString().empty()) + || (!interface && !mProfile->implementationAlgebraicCountString().empty())) { + code += interface ? + mProfile->interfaceAlgebraicCountString() : + replace(mProfile->implementationAlgebraicCountString(), + "[ALGEBRAIC_COUNT]", std::to_string(mModel->algebraicCount())); + } + + if (!code.empty()) { mCode += "\n"; } - mCode += stateAndVariableCountCode; + mCode += code; } void Generator::GeneratorImpl::addVariableTypeObjectCode() @@ -378,8 +389,16 @@ std::string Generator::GeneratorImpl::generateVariableInfoObjectCode(const std:: } } - for (const auto &variable : mModel->variables()) { - updateVariableInfoSizes(componentSize, nameSize, unitsSize, variable); + for (const auto &constant : mModel->constants()) { + updateVariableInfoSizes(componentSize, nameSize, unitsSize, constant); + } + + for (const auto &computedConstant : mModel->computedConstants()) { + updateVariableInfoSizes(componentSize, nameSize, unitsSize, computedConstant); + } + + for (const auto &algebraicVariable : mModel->algebraic()) { + updateVariableInfoSizes(componentSize, nameSize, unitsSize, algebraicVariable); } return replace(replace(replace(objectString, @@ -410,27 +429,27 @@ std::string Generator::GeneratorImpl::generateVariableInfoEntryCode(const std::s void Generator::GeneratorImpl::addInterfaceVoiStateAndVariableInfoCode() { - std::string interfaceVoiStateAndVariableInfoCode; + std::string code; if (modelHasOdes() && !mProfile->interfaceVoiInfoString().empty()) { - interfaceVoiStateAndVariableInfoCode += mProfile->interfaceVoiInfoString(); + code += mProfile->interfaceVoiInfoString(); } if (modelHasOdes() && !mProfile->interfaceStateInfoString().empty()) { - interfaceVoiStateAndVariableInfoCode += mProfile->interfaceStateInfoString(); + code += mProfile->interfaceStateInfoString(); } if (!mProfile->interfaceVariableInfoString().empty()) { - interfaceVoiStateAndVariableInfoCode += mProfile->interfaceVariableInfoString(); + code += mProfile->interfaceVariableInfoString(); } - if (!interfaceVoiStateAndVariableInfoCode.empty()) { + if (!code.empty()) { mCode += "\n"; } - mCode += interfaceVoiStateAndVariableInfoCode; + mCode += code; } void Generator::GeneratorImpl::addImplementationVoiInfoCode() @@ -495,8 +514,9 @@ void Generator::GeneratorImpl::addImplementationVariableInfoCode() && !mProfile->algebraicVariableTypeString().empty() && !mProfile->externalVariableTypeString().empty()) { std::string infoElementsCode; + auto variables = libcellml::variables(mModel); - for (const auto &variable : mModel->variables()) { + for (const auto &variable : variables) { if (!infoElementsCode.empty()) { infoElementsCode += mProfile->arrayElementSeparatorString() + "\n"; } @@ -694,26 +714,26 @@ void Generator::GeneratorImpl::addTrigonometricFunctionsCode() void Generator::GeneratorImpl::addInterfaceCreateDeleteArrayMethodsCode() { - std::string interfaceCreateDeleteArraysCode; + std::string code; if (modelHasOdes() && !mProfile->interfaceCreateStatesArrayMethodString().empty()) { - interfaceCreateDeleteArraysCode += mProfile->interfaceCreateStatesArrayMethodString(); + code += mProfile->interfaceCreateStatesArrayMethodString(); } if (!mProfile->interfaceCreateVariablesArrayMethodString().empty()) { - interfaceCreateDeleteArraysCode += mProfile->interfaceCreateVariablesArrayMethodString(); + code += mProfile->interfaceCreateVariablesArrayMethodString(); } if (!mProfile->interfaceDeleteArrayMethodString().empty()) { - interfaceCreateDeleteArraysCode += mProfile->interfaceDeleteArrayMethodString(); + code += mProfile->interfaceDeleteArrayMethodString(); } - if (!interfaceCreateDeleteArraysCode.empty()) { + if (!code.empty()) { mCode += "\n"; } - mCode += interfaceCreateDeleteArraysCode; + mCode += code; } void Generator::GeneratorImpl::addExternalVariableMethodTypeDefinitionCode() @@ -784,10 +804,10 @@ void Generator::GeneratorImpl::addNlaSystemsCode() && (std::find(handledNlaEquations.begin(), handledNlaEquations.end(), equation) == handledNlaEquations.end())) { std::string methodBody; auto i = MAX_SIZE_T; - auto variables = equation->variables(); - auto variablesSize = variables.size(); + auto variables = libcellml::variables(equation); + auto variablesCount = variables.size(); - for (i = 0; i < variablesSize; ++i) { + for (i = 0; i < variablesCount; ++i) { auto arrayString = (variables[i]->type() == AnalyserVariable::Type::STATE) ? mProfile->ratesArrayString() : mProfile->variablesArrayString(); @@ -828,7 +848,7 @@ void Generator::GeneratorImpl::addNlaSystemsCode() methodBody = {}; - for (i = 0; i < variablesSize; ++i) { + for (i = 0; i < variablesCount; ++i) { auto arrayString = (variables[i]->type() == AnalyserVariable::Type::STATE) ? mProfile->ratesArrayString() : mProfile->variablesArrayString(); @@ -844,11 +864,11 @@ void Generator::GeneratorImpl::addNlaSystemsCode() + mProfile->indentString() + replace(replace(mProfile->nlaSolveCallString(modelHasOdes()), "[INDEX]", convertToString(equation->nlaSystemIndex())), - "[SIZE]", convertToString(equation->variableCount())); + "[SIZE]", convertToString(variablesCount)); methodBody += newLineIfNeeded(); - for (i = 0; i < variablesSize; ++i) { + for (i = 0; i < variablesCount; ++i) { auto arrayString = (variables[i]->type() == AnalyserVariable::Type::STATE) ? mProfile->ratesArrayString() : mProfile->variablesArrayString(); @@ -863,7 +883,7 @@ void Generator::GeneratorImpl::addNlaSystemsCode() mCode += newLineIfNeeded() + replace(replace(replace(mProfile->findRootMethodString(modelHasOdes()), "[INDEX]", convertToString(equation->nlaSystemIndex())), - "[SIZE]", convertToString(variablesSize)), + "[SIZE]", convertToString(variablesCount)), "[CODE]", generateMethodBodyCode(methodBody)); } } @@ -1744,9 +1764,11 @@ std::string Generator::GeneratorImpl::generateEquationCode(const AnalyserEquatio // Generate the equation code itself, based on the equation type. + auto variables = libcellml::variables(equation); + switch (equation->type()) { case AnalyserEquation::Type::EXTERNAL: - for (const auto &variable : equation->variables()) { + for (const auto &variable : variables) { res += mProfile->indentString() + generateVariableNameCode(variable->variable()) + mProfile->equalityString() @@ -1786,35 +1808,35 @@ void Generator::GeneratorImpl::addInterfaceComputeModelMethodsCode() { auto interfaceInitialiseVariablesMethodString = mProfile->interfaceInitialiseVariablesMethodString(modelHasOdes(), mModel->hasExternalVariables()); - std::string interfaceComputeModelMethodsCode; + std::string code; if (!interfaceInitialiseVariablesMethodString.empty()) { - interfaceComputeModelMethodsCode += interfaceInitialiseVariablesMethodString; + code += interfaceInitialiseVariablesMethodString; } if (!mProfile->interfaceComputeComputedConstantsMethodString().empty()) { - interfaceComputeModelMethodsCode += mProfile->interfaceComputeComputedConstantsMethodString(); + code += mProfile->interfaceComputeComputedConstantsMethodString(); } auto interfaceComputeRatesMethodString = mProfile->interfaceComputeRatesMethodString(mModel->hasExternalVariables()); if (modelHasOdes() && !interfaceComputeRatesMethodString.empty()) { - interfaceComputeModelMethodsCode += interfaceComputeRatesMethodString; + code += interfaceComputeRatesMethodString; } auto interfaceComputeVariablesMethodString = mProfile->interfaceComputeVariablesMethodString(modelHasOdes(), mModel->hasExternalVariables()); if (!interfaceComputeVariablesMethodString.empty()) { - interfaceComputeModelMethodsCode += interfaceComputeVariablesMethodString; + code += interfaceComputeVariablesMethodString; } - if (!interfaceComputeModelMethodsCode.empty()) { + if (!code.empty()) { mCode += "\n"; } - mCode += interfaceComputeModelMethodsCode; + mCode += code; } void Generator::GeneratorImpl::addImplementationInitialiseVariablesMethodCode(std::vector &remainingEquations) @@ -1834,8 +1856,9 @@ void Generator::GeneratorImpl::addImplementationInitialiseVariablesMethodCode(st // such an NLA system has only one solution. std::string methodBody; + auto variables = libcellml::variables(mModel); - for (const auto &variable : mModel->variables()) { + for (const auto &variable : variables) { switch (variable->type()) { case AnalyserVariable::Type::CONSTANT: methodBody += generateInitialisationCode(variable); @@ -1931,10 +1954,13 @@ void Generator::GeneratorImpl::addImplementationComputeRatesMethodCode(std::vect // NLA equation in case the rate is not on its own on either the LHS // or RHS of the equation. + auto variables = libcellml::variables(equation); + auto variablesCount = variables.size(); + if ((equation->type() == AnalyserEquation::Type::ODE) || ((equation->type() == AnalyserEquation::Type::NLA) - && (equation->variableCount() == 1) - && (equation->variable(0)->type() == AnalyserVariable::Type::STATE))) { + && (variablesCount == 1) + && (variables[0]->type() == AnalyserVariable::Type::STATE))) { methodBody += generateEquationCode(equation, remainingEquations); } } diff --git a/src/generator_p.h b/src/generator_p.h index 2ddb812e96..4f9165da51 100644 --- a/src/generator_p.h +++ b/src/generator_p.h @@ -44,6 +44,8 @@ struct Generator::GeneratorImpl bool modelHasOdes() const; bool modelHasNlas() const; + AnalyserVariablePtr doAnalyserVariable(const VariablePtr &variable, + const std::vector &variables) const; AnalyserVariablePtr analyserVariable(const VariablePtr &variable) const; double scalingFactor(const VariablePtr &variable) const; diff --git a/src/generatorprofile.cpp b/src/generatorprofile.cpp index 1362bc3875..39fb8c39c4 100644 --- a/src/generatorprofile.cpp +++ b/src/generatorprofile.cpp @@ -184,8 +184,14 @@ struct GeneratorProfile::GeneratorProfileImpl std::string mInterfaceStateCountString; std::string mImplementationStateCountString; - std::string mInterfaceVariableCountString; - std::string mImplementationVariableCountString; + std::string mInterfaceConstantCountString; + std::string mImplementationConstantCountString; + + std::string mInterfaceComputedConstantCountString; + std::string mImplementationComputedConstantCountString; + + std::string mInterfaceAlgebraicCountString; + std::string mImplementationAlgebraicCountString; std::string mVariableTypeObjectFamWoevString; std::string mVariableTypeObjectFamWevString; @@ -505,8 +511,14 @@ void GeneratorProfile::GeneratorProfileImpl::loadProfile(GeneratorProfile::Profi mInterfaceStateCountString = "extern const size_t STATE_COUNT;\n"; mImplementationStateCountString = "const size_t STATE_COUNT = [STATE_COUNT];\n"; - mInterfaceVariableCountString = "extern const size_t VARIABLE_COUNT;\n"; - mImplementationVariableCountString = "const size_t VARIABLE_COUNT = [VARIABLE_COUNT];\n"; + mInterfaceConstantCountString = "extern const size_t CONSTANT_COUNT;\n"; + mImplementationConstantCountString = "const size_t CONSTANT_COUNT = [CONSTANT_COUNT];\n"; + + mInterfaceComputedConstantCountString = "extern const size_t COMPUTED_CONSTANT_COUNT;\n"; + mImplementationComputedConstantCountString = "const size_t COMPUTED_CONSTANT_COUNT = [COMPUTED_CONSTANT_COUNT];\n"; + + mInterfaceAlgebraicCountString = "extern const size_t ALGEBRAIC_COUNT;\n"; + mImplementationAlgebraicCountString = "const size_t ALGEBRAIC_COUNT = [ALGEBRAIC_COUNT];\n"; mVariableTypeObjectFamWoevString = "typedef enum {\n" " CONSTANT,\n" @@ -677,8 +689,8 @@ void GeneratorProfile::GeneratorProfileImpl::loadProfile(GeneratorProfile::Profi "[CODE]" "}\n"; - mInterfaceComputeComputedConstantsMethodString = "void computeComputedConstants(double *variables);\n"; - mImplementationComputeComputedConstantsMethodString = "void computeComputedConstants(double *variables)\n" + mInterfaceComputeComputedConstantsMethodString = "void computeComputedConstants(double *computedConstants);\n"; + mImplementationComputeComputedConstantsMethodString = "void computeComputedConstants(double *computedConstants)\n" "{\n" "[CODE]" "}\n"; @@ -934,8 +946,14 @@ void GeneratorProfile::GeneratorProfileImpl::loadProfile(GeneratorProfile::Profi mInterfaceStateCountString = ""; mImplementationStateCountString = "STATE_COUNT = [STATE_COUNT]\n"; - mInterfaceVariableCountString = ""; - mImplementationVariableCountString = "VARIABLE_COUNT = [VARIABLE_COUNT]\n"; + mInterfaceConstantCountString = ""; + mImplementationConstantCountString = "CONSTANT_COUNT = [CONSTANT_COUNT]\n"; + + mInterfaceComputedConstantCountString = ""; + mImplementationComputedConstantCountString = "COMPUTED_CONSTANT_COUNT = [COMPUTED_CONSTANT_COUNT]\n"; + + mInterfaceAlgebraicCountString = ""; + mImplementationAlgebraicCountString = "ALGEBRAIC_COUNT = [ALGEBRAIC_COUNT]\n"; mVariableTypeObjectFamWoevString = "\n" "class VariableType(Enum):\n" @@ -1074,7 +1092,7 @@ void GeneratorProfile::GeneratorProfileImpl::loadProfile(GeneratorProfile::Profi mInterfaceComputeComputedConstantsMethodString = ""; mImplementationComputeComputedConstantsMethodString = "\n" - "def compute_computed_constants(variables):\n" + "def compute_computed_constants(computed_constants):\n" "[CODE]"; mInterfaceComputeRatesMethodWoevString = ""; @@ -2250,24 +2268,64 @@ void GeneratorProfile::setImplementationStateCountString(const std::string &impl mPimpl->mImplementationStateCountString = implementationStateCountString; } -std::string GeneratorProfile::interfaceVariableCountString() const +std::string GeneratorProfile::interfaceConstantCountString() const +{ + return mPimpl->mInterfaceConstantCountString; +} + +void GeneratorProfile::setInterfaceConstantCountString(const std::string &interfaceConstantCountString) +{ + mPimpl->mInterfaceConstantCountString = interfaceConstantCountString; +} + +std::string GeneratorProfile::implementationConstantCountString() const +{ + return mPimpl->mImplementationConstantCountString; +} + +void GeneratorProfile::setImplementationConstantCountString(const std::string &implementationConstantCountString) +{ + mPimpl->mImplementationConstantCountString = implementationConstantCountString; +} + +std::string GeneratorProfile::interfaceComputedConstantCountString() const +{ + return mPimpl->mInterfaceComputedConstantCountString; +} + +void GeneratorProfile::setInterfaceComputedConstantCountString(const std::string &interfaceComputedConstantCountString) +{ + mPimpl->mInterfaceComputedConstantCountString = interfaceComputedConstantCountString; +} + +std::string GeneratorProfile::implementationComputedConstantCountString() const +{ + return mPimpl->mImplementationComputedConstantCountString; +} + +void GeneratorProfile::setImplementationComputedConstantCountString(const std::string &implementationComputedConstantCountString) +{ + mPimpl->mImplementationComputedConstantCountString = implementationComputedConstantCountString; +} + +std::string GeneratorProfile::interfaceAlgebraicCountString() const { - return mPimpl->mInterfaceVariableCountString; + return mPimpl->mInterfaceAlgebraicCountString; } -void GeneratorProfile::setInterfaceVariableCountString(const std::string &interfaceVariableCountString) +void GeneratorProfile::setInterfaceAlgebraicCountString(const std::string &interfaceAlgebraicCountString) { - mPimpl->mInterfaceVariableCountString = interfaceVariableCountString; + mPimpl->mInterfaceAlgebraicCountString = interfaceAlgebraicCountString; } -std::string GeneratorProfile::implementationVariableCountString() const +std::string GeneratorProfile::implementationAlgebraicCountString() const { - return mPimpl->mImplementationVariableCountString; + return mPimpl->mImplementationAlgebraicCountString; } -void GeneratorProfile::setImplementationVariableCountString(const std::string &implementationVariableCountString) +void GeneratorProfile::setImplementationAlgebraicCountString(const std::string &implementationAlgebraicCountString) { - mPimpl->mImplementationVariableCountString = implementationVariableCountString; + mPimpl->mImplementationAlgebraicCountString = implementationAlgebraicCountString; } std::string GeneratorProfile::variableTypeObjectString(bool forDifferentialModel, diff --git a/src/generatorprofilesha1values.h b/src/generatorprofilesha1values.h index 9216e6171b..e99328e5aa 100644 --- a/src/generatorprofilesha1values.h +++ b/src/generatorprofilesha1values.h @@ -24,7 +24,7 @@ namespace libcellml { * The content of this file is generated, do not edit this file directly. * See docs/dev_utilities.rst for further information. */ -static const char C_GENERATOR_PROFILE_SHA1[] = "1ac959303d5e8d6623cbe0979cb608ef48aff653"; -static const char PYTHON_GENERATOR_PROFILE_SHA1[] = "41f70a8d0486fdb3638b310814ebaa7d3ddd6771"; +static const char C_GENERATOR_PROFILE_SHA1[] = "9e017d3075c0036910fad2326986a996c466de5d"; +static const char PYTHON_GENERATOR_PROFILE_SHA1[] = "34bc02948f9f9939303facbb0a0c2b8428d4b4aa"; } // namespace libcellml diff --git a/src/generatorprofiletools.cpp b/src/generatorprofiletools.cpp index 2dce65f310..4a1613b8da 100644 --- a/src/generatorprofiletools.cpp +++ b/src/generatorprofiletools.cpp @@ -442,8 +442,14 @@ std::string generatorProfileAsString(const GeneratorProfilePtr &generatorProfile profileContents += generatorProfile->interfaceStateCountString() + generatorProfile->implementationStateCountString(); - profileContents += generatorProfile->interfaceVariableCountString() - + generatorProfile->implementationVariableCountString(); + profileContents += generatorProfile->interfaceConstantCountString() + + generatorProfile->implementationConstantCountString(); + + profileContents += generatorProfile->interfaceComputedConstantCountString() + + generatorProfile->implementationComputedConstantCountString(); + + profileContents += generatorProfile->interfaceAlgebraicCountString() + + generatorProfile->implementationAlgebraicCountString(); profileContents += generatorProfile->variableTypeObjectString(false, false); profileContents += generatorProfile->variableTypeObjectString(false, true); diff --git a/src/utilities.cpp b/src/utilities.cpp index 51cb29a65c..f59b00d29a 100644 --- a/src/utilities.cpp +++ b/src/utilities.cpp @@ -26,6 +26,8 @@ limitations under the License. #include #include +#include "libcellml/analyserequation.h" +#include "libcellml/analysermodel.h" #include "libcellml/component.h" #include "libcellml/importsource.h" #include "libcellml/model.h" @@ -1315,4 +1317,34 @@ XmlNodePtr mathmlChildNode(const XmlNodePtr &node, size_t index) return res; } +std::vector variables(const AnalyserModelPtr &model) +{ + auto res = model->constants(); + auto computedConstants = model->computedConstants(); + + if (!computedConstants.empty()) { + res.insert(res.end(), computedConstants.begin(), computedConstants.end()); + } + + auto algebraic = model->algebraic(); + + if (!algebraic.empty()) { + res.insert(res.end(), algebraic.begin(), algebraic.end()); + } + + return res; +} + +std::vector variables(const AnalyserEquationPtr &equation) +{ + auto res = equation->computedConstants(); + auto algebraic = equation->algebraic(); + + if (!algebraic.empty()) { + res.insert(res.end(), algebraic.begin(), algebraic.end()); + } + + return res; +} + } // namespace libcellml diff --git a/src/utilities.h b/src/utilities.h index cf3830c81f..87beda8aff 100644 --- a/src/utilities.h +++ b/src/utilities.h @@ -870,4 +870,26 @@ size_t mathmlChildCount(const XmlNodePtr &node); */ XmlNodePtr mathmlChildNode(const XmlNodePtr &node, size_t index); +/** + * @brief Return the variables in the given model. + * + * Return the variables in the given model. + * + * @param model The model for which we want the variables. + * + * @return The variables in the given model. + */ +std::vector variables(const AnalyserModelPtr &model); + +/** + * @brief Return the variables in the given equation. + * + * Return the variables in the given equation. + * + * @param equation The equation for which we want the variables. + * + * @return The variables in the given equation. + */ +std::vector variables(const AnalyserEquationPtr &equation); + } // namespace libcellml diff --git a/tests/bindings/javascript/analyserequation.test.js b/tests/bindings/javascript/analyserequation.test.js index 4f1a5cc317..7619bdebdc 100644 --- a/tests/bindings/javascript/analyserequation.test.js +++ b/tests/bindings/javascript/analyserequation.test.js @@ -56,7 +56,7 @@ describe("Analyser Equation tests", () => { expect(eqn.dependencies().size()).toBe(0) }); test('Checking Analyser Equation dependency.', () => { - expect(eqn.dependency(0)).toBe(null) + expect(eqn.dependency(0)).toBeNull() }); test('Checking Analyser Equation nlaSystemIndex.', () => { expect(eqn.nlaSystemIndex()).toBe(4294967295) @@ -68,16 +68,25 @@ describe("Analyser Equation tests", () => { expect(eqn.nlaSiblings().size()).toBe(0) }); test('Checking Analyser Equation nlaSibling.', () => { - expect(eqn.nlaSibling(0)).toBe(null) + expect(eqn.nlaSibling(0)).toBeNull() }); - test('Checking Analyser Equation variableCount.', () => { - expect(eqn.variableCount()).toBe(1) + test('Checking Analyser Equation computedConstantCount.', () => { + expect(eqn.computedConstantCount()).toBe(0) }); - test('Checking Analyser Equation variables.', () => { - expect(eqn.variables().size()).toBe(1) + test('Checking Analyser Equation computedConstants.', () => { + expect(eqn.computedConstants().size()).toBe(0) }); - test('Checking Analyser Equation variable.', () => { - expect(eqn.variable(0).variable().name()).toBe("x") + test('Checking Analyser Equation computedConstant.', () => { + expect(eqn.computedConstant(0)).toBeNull() + }); + test('Checking Analyser Equation algebraicCount.', () => { + expect(eqn.algebraicCount()).toBe(1) + }); + test('Checking Analyser Equation algebraicVariables.', () => { + expect(eqn.algebraicVariables().size()).toBe(1) + }); + test('Checking Analyser Equation algebraicVariable.', () => { + expect(eqn.algebraicVariable(0).variable().name()).toBe("x") }); test('Checking Analyser Equation AST.', () => { expect(eqn.ast().value()).toBe("") diff --git a/tests/bindings/javascript/analysermodel.test.js b/tests/bindings/javascript/analysermodel.test.js index a84ad5e3d2..c709d93684 100644 --- a/tests/bindings/javascript/analysermodel.test.js +++ b/tests/bindings/javascript/analysermodel.test.js @@ -61,10 +61,20 @@ describe("Analyser Model tests", () => { expect(am.states().size()).toBe(4) expect(am.state(2).variable().name()).toBe("m") }); - test('Checking Analyser Model variables related API.', () => { - expect(am.variableCount()).toBe(18) - expect(am.variables().size()).toBe(18) - expect(am.variable(2).variable().name()).toBe("i_K") + test('Checking Analyser Model constants related API.', () => { + expect(am.constantCount()).toBe(0) + expect(am.constants().size()).toBe(0) + expect(am.constant(2)).toBeNull() + }); + test('Checking Analyser Model computed constants related API.', () => { + expect(am.computedConstantCount()).toBe(0) + expect(am.computedConstants().size()).toBe(0) + expect(am.computedConstant(2)).toBeNull() + }); + test('Checking Analyser Model algebraic variables related API.', () => { + expect(am.algebraicCount()).toBe(18) + expect(am.algebraicVariables().size()).toBe(18) + expect(am.algebraicVariable(2).variable().name()).toBe("i_K") }); test('Checking Analyser Model need* API.', () => { expect(am.needEqFunction()).toBe(false) @@ -93,6 +103,6 @@ describe("Analyser Model tests", () => { expect(am.needAcothFunction()).toBe(false) }); test('Checking Analyser Model are equivalent variables.', () => { - expect(am.areEquivalentVariables(am.variable(2).variable(), am.variable(7).variable())).toBe(false) + expect(am.areEquivalentVariables(am.algebraicVariable(2).variable(), am.algebraicVariable(7).variable())).toBe(false) }); }) diff --git a/tests/bindings/javascript/analyservariable.test.js b/tests/bindings/javascript/analyservariable.test.js index 52b5ef7496..6aa1f4f8d1 100644 --- a/tests/bindings/javascript/analyservariable.test.js +++ b/tests/bindings/javascript/analyservariable.test.js @@ -37,35 +37,37 @@ describe("Analyser Variable tests", () => { am = a.model() - expect(am.variableCount()).toBe(18) + expect(am.constantCount()).toBe(0) + expect(am.computedConstantCount()).toBe(0) + expect(am.algebraicCount()).toBe(18) }); test('Checking Analyser Variable type.', () => { - const av = am.variable(0) + const av = am.algebraicVariable(0) expect(av.type().value).toBe(libcellml.AnalyserVariable.Type.ALGEBRAIC.value) expect(libcellml.AnalyserVariable.typeAsString(av.type())).toBe("algebraic") }); test('Checking Analyser Variable index.', () => { - const av = am.variable(7) + const av = am.algebraicVariable(7) expect(av.index()).toBe(7) }); test('Checking Analyser Variable initialising variable.', () => { - const av = am.variable(15) + const av = am.algebraicVariable(15) expect(av.initialisingVariable().name()).toBe("g_K") }); test('Checking Analyser Variable variable.', () => { - const av = am.variable(10) + const av = am.algebraicVariable(10) expect(av.variable().name()).toBe("alpha_m") }); test('Checking Analyser Equation equationCount.', () => { - const av = am.variable(14) + const av = am.algebraicVariable(14) expect(av.equationCount()).toBe(1) }); test('Checking Analyser Variable equations.', () => { - const av = am.variable(14) + const av = am.algebraicVariable(14) expect(av.equations().size()).toBe(1) }); test('Checking Analyser Variable equation.', () => { - const av = am.variable(14) + const av = am.algebraicVariable(14) expect(av.equation(0).type().value).toBe(libcellml.AnalyserEquation.Type.VARIABLE_BASED_CONSTANT.value) }); }) diff --git a/tests/bindings/javascript/generator.test.js b/tests/bindings/javascript/generator.test.js index 0fd13e18a5..bd854e65f8 100644 --- a/tests/bindings/javascript/generator.test.js +++ b/tests/bindings/javascript/generator.test.js @@ -43,7 +43,7 @@ describe("Generator tests", () => { a.analyseModel(m) - expect(g.model()).toBe(null) + expect(g.model()).toBeNull() g.setModel(a.model()) @@ -62,10 +62,10 @@ describe("Generator tests", () => { g.setModel(a.model()) const interface_lines = g.interfaceCode().split('\n') - expect(interface_lines.length).toBe(40) + expect(interface_lines.length).toBe(42) const implementation_lines = g.implementationCode().split('\n') - expect(implementation_lines.length).toBe(67) + expect(implementation_lines.length).toBe(69) const equation_line_1 = libcellml.Generator.equationCode(a.model().equation(0).ast()) expect(equation_line_1.length).toBe(14) diff --git a/tests/bindings/javascript/generatorprofile.test.js b/tests/bindings/javascript/generatorprofile.test.js index be6ff9f397..7c5bd368e6 100644 --- a/tests/bindings/javascript/generatorprofile.test.js +++ b/tests/bindings/javascript/generatorprofile.test.js @@ -684,17 +684,41 @@ describe("GeneratorProfile tests", () => { x.setImplementationStateCountString("something") expect(x.implementationStateCountString()).toBe("something") }); - test("Checking GeneratorProfile.interfaceVariableCountString.", () => { + test("Checking GeneratorProfile.interfaceConstantCountString.", () => { const x = new libcellml.GeneratorProfile(libcellml.GeneratorProfile.Profile.C) - x.setInterfaceVariableCountString("something") - expect(x.interfaceVariableCountString()).toBe("something") + x.setInterfaceConstantCountString("something") + expect(x.interfaceConstantCountString()).toBe("something") }); - test("Checking GeneratorProfile.implementationVariableCountString.", () => { + test("Checking GeneratorProfile.implementationConstantCountString.", () => { const x = new libcellml.GeneratorProfile(libcellml.GeneratorProfile.Profile.C) - x.setImplementationVariableCountString("something") - expect(x.implementationVariableCountString()).toBe("something") + x.setImplementationConstantCountString("something") + expect(x.implementationConstantCountString()).toBe("something") + }); + test("Checking GeneratorProfile.interfaceComputedConstantCountString.", () => { + const x = new libcellml.GeneratorProfile(libcellml.GeneratorProfile.Profile.C) + + x.setInterfaceComputedConstantCountString("something") + expect(x.interfaceComputedConstantCountString()).toBe("something") + }); + test("Checking GeneratorProfile.implementationComputedConstantCountString.", () => { + const x = new libcellml.GeneratorProfile(libcellml.GeneratorProfile.Profile.C) + + x.setImplementationComputedConstantCountString("something") + expect(x.implementationComputedConstantCountString()).toBe("something") + }); + test("Checking GeneratorProfile.interfaceAlgebraicCountString.", () => { + const x = new libcellml.GeneratorProfile(libcellml.GeneratorProfile.Profile.C) + + x.setInterfaceAlgebraicCountString("something") + expect(x.interfaceAlgebraicCountString()).toBe("something") + }); + test("Checking GeneratorProfile.implementationAlgebraicCountString.", () => { + const x = new libcellml.GeneratorProfile(libcellml.GeneratorProfile.Profile.C) + + x.setImplementationAlgebraicCountString("something") + expect(x.implementationAlgebraicCountString()).toBe("something") }); test("Checking GeneratorProfile.variableTypeObjectString.", () => { const x = new libcellml.GeneratorProfile(libcellml.GeneratorProfile.Profile.C) diff --git a/tests/bindings/javascript/importsource.test.js b/tests/bindings/javascript/importsource.test.js index e349be0880..f3b48c307a 100644 --- a/tests/bindings/javascript/importsource.test.js +++ b/tests/bindings/javascript/importsource.test.js @@ -34,7 +34,7 @@ describe("Import Source tests", () => { const iS = new libcellml.ImportSource() const m = new libcellml.Model() - expect(iS.model()).toBe(null) + expect(iS.model()).toBeNull() iS.setModel(m) diff --git a/tests/bindings/javascript/reset.test.js b/tests/bindings/javascript/reset.test.js index ab70a879bc..72a905f3f6 100644 --- a/tests/bindings/javascript/reset.test.js +++ b/tests/bindings/javascript/reset.test.js @@ -41,7 +41,7 @@ describe("Reset tests", () => { const r = new libcellml.Reset() const v = new libcellml.Variable() - expect(r.variable()).toBe(null) + expect(r.variable()).toBeNull() r.setVariable(v) expect(r.variable()).toStrictEqual(v) @@ -50,7 +50,7 @@ describe("Reset tests", () => { const r = new libcellml.Reset() const v = new libcellml.Variable() - expect(r.testVariable()).toBe(null) + expect(r.testVariable()).toBeNull() r.setTestVariable(v) expect(r.testVariable()).toStrictEqual(v) diff --git a/tests/bindings/javascript/variable.test.js b/tests/bindings/javascript/variable.test.js index 9dbc06c2fb..a3d863b0da 100644 --- a/tests/bindings/javascript/variable.test.js +++ b/tests/bindings/javascript/variable.test.js @@ -70,7 +70,7 @@ describe("Variable tests", () => { const v = new libcellml.Variable("V") const u = new libcellml.Units("mV") - expect(v.units()).toBe(null) + expect(v.units()).toBeNull() v.setUnitsByName("A") @@ -82,7 +82,7 @@ describe("Variable tests", () => { v.removeUnits() - expect(v.units()).toBe(null) + expect(v.units()).toBeNull() v.delete() u.delete() diff --git a/tests/bindings/python/test_analyser.py b/tests/bindings/python/test_analyser.py index 654daf1a20..3895e4b40d 100644 --- a/tests/bindings/python/test_analyser.py +++ b/tests/bindings/python/test_analyser.py @@ -115,9 +115,15 @@ def test_coverage(self): self.assertIsNotNone(am.states()) self.assertIsNotNone(am.state(3)) - self.assertEqual(17, am.variableCount()) - self.assertIsNotNone(am.variables()) - self.assertIsNotNone(am.variable(3)) + self.assertEqual(0, am.constantCount()) + self.assertIsNotNone(am.constants()) + self.assertIsNone(am.constant(3)) + self.assertEqual(0, am.computedConstantCount()) + self.assertIsNotNone(am.computedConstants()) + self.assertIsNone(am.computedConstant(3)) + self.assertEqual(17, am.algebraicCount()) + self.assertIsNotNone(am.algebraic()) + self.assertIsNotNone(am.algebraic(3)) self.assertEqual(16, am.equationCount()) self.assertIsNotNone(am.equations()) @@ -152,7 +158,7 @@ def test_coverage(self): # Ensure coverage for AnalyserVariable. - av = am.variable(3) + av = am.algebraic(3) self.assertEqual(AnalyserVariable.Type.CONSTANT, av.type()) self.assertEqual("constant", AnalyserVariable.typeAsString(av.type())) @@ -180,9 +186,12 @@ def test_coverage(self): self.assertIsNotNone(ae.nlaSiblings()) self.assertIsNone(ae.nlaSibling(0)) self.assertTrue(ae.isStateRateBased()) - self.assertEqual(1, ae.variableCount()) - self.assertIsNotNone(ae.variables()) - self.assertIsNotNone(ae.variable(0)) + self.assertEqual(0, ae.computedConstantCount()) + self.assertIsNotNone(ae.computedConstants()) + self.assertIsNone(ae.computedConstant(0)) + self.assertEqual(1, ae.algebraicCount()) + self.assertIsNotNone(ae.algebraic()) + self.assertIsNotNone(ae.algebraic(0)) # Check Analyser Equation type with invalid values. diff --git a/tests/bindings/python/test_generator_profile.py b/tests/bindings/python/test_generator_profile.py index f91a0645a9..a3bedd3a06 100644 --- a/tests/bindings/python/test_generator_profile.py +++ b/tests/bindings/python/test_generator_profile.py @@ -761,7 +761,7 @@ def test_implementation_compute_computed_constants_method_string(self): g = GeneratorProfile() - self.assertEqual('void computeComputedConstants(double *variables)\n{\n[CODE]}\n', + self.assertEqual('void computeComputedConstants(double *computedConstants)\n{\n[CODE]}\n', g.implementationComputeComputedConstantsMethodString()) g.setImplementationComputeComputedConstantsMethodString(GeneratorProfileTestCase.VALUE) self.assertEqual(GeneratorProfileTestCase.VALUE, g.implementationComputeComputedConstantsMethodString()) @@ -907,14 +907,32 @@ def test_implementation_state_info_string(self): g.setImplementationStateInfoString(GeneratorProfileTestCase.VALUE) self.assertEqual(GeneratorProfileTestCase.VALUE, g.implementationStateInfoString()) - def test_implementation_variable_count_string(self): + def test_implementation_constant_count_string(self): from libcellml import GeneratorProfile g = GeneratorProfile() - self.assertEqual('const size_t VARIABLE_COUNT = [VARIABLE_COUNT];\n', g.implementationVariableCountString()) - g.setImplementationVariableCountString(GeneratorProfileTestCase.VALUE) - self.assertEqual(GeneratorProfileTestCase.VALUE, g.implementationVariableCountString()) + self.assertEqual('const size_t CONSTANT_COUNT = [CONSTANT_COUNT];\n', g.implementationConstantCountString()) + g.setImplementationConstantCountString(GeneratorProfileTestCase.VALUE) + self.assertEqual(GeneratorProfileTestCase.VALUE, g.implementationConstantCountString()) + + def test_implementation_computed_constant_count_string(self): + from libcellml import GeneratorProfile + + g = GeneratorProfile() + + self.assertEqual('const size_t COMPUTED_CONSTANT_COUNT = [COMPUTED_CONSTANT_COUNT];\n', g.implementationComputedConstantCountString()) + g.setImplementationComputedConstantCountString(GeneratorProfileTestCase.VALUE) + self.assertEqual(GeneratorProfileTestCase.VALUE, g.implementationComputedConstantCountString()) + + def test_implementation_algebraic_count_string(self): + from libcellml import GeneratorProfile + + g = GeneratorProfile() + + self.assertEqual('const size_t ALGEBRAIC_COUNT = [ALGEBRAIC_COUNT];\n', g.implementationAlgebraicCountString()) + g.setImplementationAlgebraicCountString(GeneratorProfileTestCase.VALUE) + self.assertEqual(GeneratorProfileTestCase.VALUE, g.implementationAlgebraicCountString()) def test_implementation_variable_info_string(self): from libcellml import GeneratorProfile @@ -967,7 +985,7 @@ def test_interface_compute_computed_constants_method_string(self): g = GeneratorProfile() - self.assertEqual('void computeComputedConstants(double *variables);\n', + self.assertEqual('void computeComputedConstants(double *computedConstants);\n', g.interfaceComputeComputedConstantsMethodString()) g.setInterfaceComputeComputedConstantsMethodString(GeneratorProfileTestCase.VALUE) self.assertEqual(GeneratorProfileTestCase.VALUE, g.interfaceComputeComputedConstantsMethodString()) @@ -1115,14 +1133,32 @@ def test_interface_state_info_string(self): g.setInterfaceStateInfoString(GeneratorProfileTestCase.VALUE) self.assertEqual(GeneratorProfileTestCase.VALUE, g.interfaceStateInfoString()) - def test_interface_variable_count_string(self): + def test_interface_constant_count_string(self): + from libcellml import GeneratorProfile + + g = GeneratorProfile() + + self.assertEqual('extern const size_t CONSTANT_COUNT;\n', g.interfaceConstantCountString()) + g.setInterfaceConstantCountString(GeneratorProfileTestCase.VALUE) + self.assertEqual(GeneratorProfileTestCase.VALUE, g.interfaceConstantCountString()) + + def test_interface_computed_constant_count_string(self): + from libcellml import GeneratorProfile + + g = GeneratorProfile() + + self.assertEqual('extern const size_t COMPUTED_CONSTANT_COUNT;\n', g.interfaceComputedConstantCountString()) + g.setInterfaceComputedConstantCountString(GeneratorProfileTestCase.VALUE) + self.assertEqual(GeneratorProfileTestCase.VALUE, g.interfaceComputedConstantCountString()) + + def test_interface_algebraic_count_string(self): from libcellml import GeneratorProfile g = GeneratorProfile() - self.assertEqual('extern const size_t VARIABLE_COUNT;\n', g.interfaceVariableCountString()) - g.setInterfaceVariableCountString(GeneratorProfileTestCase.VALUE) - self.assertEqual(GeneratorProfileTestCase.VALUE, g.interfaceVariableCountString()) + self.assertEqual('extern const size_t ALGEBRAIC_COUNT;\n', g.interfaceAlgebraicCountString()) + g.setInterfaceAlgebraicCountString(GeneratorProfileTestCase.VALUE) + self.assertEqual(GeneratorProfileTestCase.VALUE, g.interfaceAlgebraicCountString()) def test_interface_variable_info_string(self): from libcellml import GeneratorProfile diff --git a/tests/coverage/coverage.cpp b/tests/coverage/coverage.cpp index 0b1b24495f..5805d78035 100644 --- a/tests/coverage/coverage.cpp +++ b/tests/coverage/coverage.cpp @@ -452,9 +452,17 @@ TEST(Coverage, analyser) EXPECT_EQ(size_t(0), analyserModel->states().size()); EXPECT_EQ(nullptr, analyserModel->state(0)); - EXPECT_EQ(size_t(0), analyserModel->variableCount()); - EXPECT_EQ(size_t(0), analyserModel->variables().size()); - EXPECT_EQ(nullptr, analyserModel->variable(0)); + EXPECT_EQ(size_t(0), analyserModel->constantCount()); + EXPECT_EQ(size_t(0), analyserModel->constants().size()); + EXPECT_EQ(nullptr, analyserModel->constant(0)); + + EXPECT_EQ(size_t(0), analyserModel->computedConstantCount()); + EXPECT_EQ(size_t(0), analyserModel->computedConstants().size()); + EXPECT_EQ(nullptr, analyserModel->computedConstant(0)); + + EXPECT_EQ(size_t(0), analyserModel->algebraicCount()); + EXPECT_EQ(size_t(0), analyserModel->algebraic().size()); + EXPECT_EQ(nullptr, analyserModel->algebraic(0)); EXPECT_EQ(size_t(0), analyserModel->equationCount()); EXPECT_EQ(size_t(0), analyserModel->equations().size()); @@ -548,7 +556,7 @@ TEST(Coverage, analyserTypes) auto analyserModel = analyser->model(); EXPECT_EQ("algebraic", libcellml::AnalyserEquation::typeAsString(analyserModel->equation(0)->type())); - EXPECT_EQ("algebraic", libcellml::AnalyserVariable::typeAsString(analyserModel->variable(0)->type())); + EXPECT_EQ("algebraic", libcellml::AnalyserVariable::typeAsString(analyserModel->algebraic(0)->type())); } void checkAstTypeAsString(const libcellml::AnalyserEquationAstPtr &ast) @@ -582,7 +590,9 @@ TEST(Coverage, generator) EXPECT_EQ("dae", libcellml::AnalyserModel::typeAsString(analyserModel->type())); EXPECT_EQ(size_t(1), analyserModel->stateCount()); - EXPECT_EQ(size_t(209), analyserModel->variableCount()); + EXPECT_EQ(size_t(0), analyserModel->constantCount()); + EXPECT_EQ(size_t(0), analyserModel->computedConstantCount()); + EXPECT_EQ(size_t(209), analyserModel->algebraicCount()); EXPECT_EQ(size_t(203), analyserModel->equationCount()); EXPECT_NE(nullptr, analyserModel->voi()); @@ -594,8 +604,12 @@ TEST(Coverage, generator) EXPECT_NE(size_t(0), analyserModel->state(0)->equations().size()); EXPECT_NE(nullptr, analyserModel->state(0)->equation(0)); EXPECT_EQ(nullptr, analyserModel->state(analyserModel->stateCount())); - EXPECT_NE(nullptr, analyserModel->variable(0)); - EXPECT_EQ(nullptr, analyserModel->variable(analyserModel->variableCount())); + EXPECT_EQ(nullptr, analyserModel->constant(0)); + EXPECT_EQ(nullptr, analyserModel->constant(analyserModel->constantCount())); + EXPECT_EQ(nullptr, analyserModel->computedConstant(0)); + EXPECT_EQ(nullptr, analyserModel->computedConstant(analyserModel->computedConstantCount())); + EXPECT_NE(nullptr, analyserModel->algebraic(0)); + EXPECT_EQ(nullptr, analyserModel->algebraic(analyserModel->algebraicCount())); EXPECT_NE(nullptr, analyserModel->equation(199)); EXPECT_NE(size_t(0), analyserModel->equation(199)->dependencyCount()); EXPECT_NE(size_t(0), analyserModel->equation(199)->dependencies().size()); @@ -605,10 +619,14 @@ TEST(Coverage, generator) EXPECT_EQ(size_t(1), analyserModel->equation(199)->nlaSiblings().size()); EXPECT_NE(nullptr, analyserModel->equation(199)->nlaSibling(0)); EXPECT_EQ(nullptr, analyserModel->equation(199)->nlaSibling(analyserModel->equation(199)->nlaSiblingCount())); - EXPECT_NE(size_t(0), analyserModel->equation(199)->variableCount()); - EXPECT_NE(size_t(0), analyserModel->equation(199)->variables().size()); - EXPECT_NE(nullptr, analyserModel->equation(199)->variable(0)); - EXPECT_EQ(nullptr, analyserModel->equation(199)->variable(analyserModel->equation(199)->variableCount())); + EXPECT_EQ(size_t(0), analyserModel->equation(199)->computedConstantCount()); + EXPECT_EQ(size_t(0), analyserModel->equation(199)->computedConstants().size()); + EXPECT_EQ(nullptr, analyserModel->equation(199)->computedConstant(0)); + EXPECT_EQ(nullptr, analyserModel->equation(199)->computedConstant(analyserModel->equation(199)->computedConstantCount())); + EXPECT_NE(size_t(0), analyserModel->equation(199)->algebraicCount()); + EXPECT_NE(size_t(0), analyserModel->equation(199)->algebraic().size()); + EXPECT_NE(nullptr, analyserModel->equation(199)->algebraic(0)); + EXPECT_EQ(nullptr, analyserModel->equation(199)->algebraic(analyserModel->equation(199)->algebraicCount())); EXPECT_EQ(nullptr, analyserModel->equation(analyserModel->equationCount())); for (const auto &equation : analyserModel->equations()) { @@ -623,9 +641,21 @@ TEST(Coverage, generator) EXPECT_NE(nullptr, analyserModel->state(i)->initialisingVariable()); } - for (size_t i = 0; i < analyserModel->variableCount(); ++i) { + for (size_t i = 0; i < analyserModel->constantCount(); ++i) { + if ((i == 1) || (i == 2) || (i == 6) || (i == 18) || (i == 179) || (i == 180) || (i == 182) || (i == 205) || (i == 206)) { + EXPECT_TRUE(analyserModel->constant(i)->initialisingVariable() != nullptr); + } + } + + for (size_t i = 0; i < analyserModel->computedConstantCount(); ++i) { if ((i == 1) || (i == 2) || (i == 6) || (i == 18) || (i == 179) || (i == 180) || (i == 182) || (i == 205) || (i == 206)) { - EXPECT_TRUE(analyserModel->variable(i)->initialisingVariable() != nullptr); + EXPECT_TRUE(analyserModel->computedConstant(i)->initialisingVariable() != nullptr); + } + } + + for (size_t i = 0; i < analyserModel->algebraicCount(); ++i) { + if ((i == 1) || (i == 2) || (i == 6) || (i == 18) || (i == 179) || (i == 180) || (i == 182) || (i == 205) || (i == 206)) { + EXPECT_TRUE(analyserModel->algebraic(i)->initialisingVariable() != nullptr); } } @@ -683,7 +713,9 @@ TEST(Coverage, generator) profile->setImplementationStateCountString(""); - profile->setImplementationVariableCountString(""); + profile->setImplementationConstantCountString(""); + profile->setImplementationComputedConstantCountString(""); + profile->setImplementationAlgebraicCountString(""); profile->setVariableTypeObjectString(false, false, ""); profile->setVariableTypeObjectString(false, true, ""); @@ -758,8 +790,14 @@ TEST(Coverage, generator) profile->setInterfaceStateCountString(""); profile->setImplementationStateCountString(""); - profile->setInterfaceVariableCountString(""); - profile->setImplementationVariableCountString(""); + profile->setInterfaceConstantCountString(""); + profile->setImplementationConstantCountString(""); + + profile->setInterfaceComputedConstantCountString(""); + profile->setImplementationComputedConstantCountString(""); + + profile->setInterfaceAlgebraicCountString(""); + profile->setImplementationAlgebraicCountString(""); profile->setVariableTypeObjectString(false, false, ""); profile->setVariableTypeObjectString(false, true, ""); diff --git a/tests/generator/generatorprofile.cpp b/tests/generator/generatorprofile.cpp index 479b29d239..46c2850ec3 100644 --- a/tests/generator/generatorprofile.cpp +++ b/tests/generator/generatorprofile.cpp @@ -279,8 +279,14 @@ TEST(GeneratorProfile, defaultMiscellaneousValues) EXPECT_EQ("extern const size_t STATE_COUNT;\n", generatorProfile->interfaceStateCountString()); EXPECT_EQ("const size_t STATE_COUNT = [STATE_COUNT];\n", generatorProfile->implementationStateCountString()); - EXPECT_EQ("extern const size_t VARIABLE_COUNT;\n", generatorProfile->interfaceVariableCountString()); - EXPECT_EQ("const size_t VARIABLE_COUNT = [VARIABLE_COUNT];\n", generatorProfile->implementationVariableCountString()); + EXPECT_EQ("extern const size_t CONSTANT_COUNT;\n", generatorProfile->interfaceConstantCountString()); + EXPECT_EQ("const size_t CONSTANT_COUNT = [CONSTANT_COUNT];\n", generatorProfile->implementationConstantCountString()); + + EXPECT_EQ("extern const size_t COMPUTED_CONSTANT_COUNT;\n", generatorProfile->interfaceComputedConstantCountString()); + EXPECT_EQ("const size_t COMPUTED_CONSTANT_COUNT = [COMPUTED_CONSTANT_COUNT];\n", generatorProfile->implementationComputedConstantCountString()); + + EXPECT_EQ("extern const size_t ALGEBRAIC_COUNT;\n", generatorProfile->interfaceAlgebraicCountString()); + EXPECT_EQ("const size_t ALGEBRAIC_COUNT = [ALGEBRAIC_COUNT];\n", generatorProfile->implementationAlgebraicCountString()); EXPECT_EQ("typedef enum {\n" " CONSTANT,\n" @@ -485,9 +491,9 @@ TEST(GeneratorProfile, defaultMiscellaneousValues) "}\n", generatorProfile->implementationInitialiseVariablesMethodString(true, true)); - EXPECT_EQ("void computeComputedConstants(double *variables);\n", + EXPECT_EQ("void computeComputedConstants(double *computedConstants);\n", generatorProfile->interfaceComputeComputedConstantsMethodString()); - EXPECT_EQ("void computeComputedConstants(double *variables)\n" + EXPECT_EQ("void computeComputedConstants(double *computedConstants)\n" "{\n" "[CODE]" "}\n", @@ -865,8 +871,14 @@ TEST(GeneratorProfile, miscellaneous) generatorProfile->setInterfaceStateCountString(value); generatorProfile->setImplementationStateCountString(value); - generatorProfile->setInterfaceVariableCountString(value); - generatorProfile->setImplementationVariableCountString(value); + generatorProfile->setInterfaceConstantCountString(value); + generatorProfile->setImplementationConstantCountString(value); + + generatorProfile->setInterfaceComputedConstantCountString(value); + generatorProfile->setImplementationComputedConstantCountString(value); + + generatorProfile->setInterfaceAlgebraicCountString(value); + generatorProfile->setImplementationAlgebraicCountString(value); generatorProfile->setVariableTypeObjectString(false, false, value); generatorProfile->setVariableTypeObjectString(false, true, value); @@ -994,8 +1006,14 @@ TEST(GeneratorProfile, miscellaneous) EXPECT_EQ(value, generatorProfile->interfaceStateCountString()); EXPECT_EQ(value, generatorProfile->implementationStateCountString()); - EXPECT_EQ(value, generatorProfile->interfaceVariableCountString()); - EXPECT_EQ(value, generatorProfile->implementationVariableCountString()); + EXPECT_EQ(value, generatorProfile->interfaceConstantCountString()); + EXPECT_EQ(value, generatorProfile->implementationConstantCountString()); + + EXPECT_EQ(value, generatorProfile->interfaceComputedConstantCountString()); + EXPECT_EQ(value, generatorProfile->implementationComputedConstantCountString()); + + EXPECT_EQ(value, generatorProfile->interfaceAlgebraicCountString()); + EXPECT_EQ(value, generatorProfile->implementationAlgebraicCountString()); EXPECT_EQ(value, generatorProfile->variableTypeObjectString(false, false)); EXPECT_EQ(value, generatorProfile->variableTypeObjectString(false, true)); diff --git a/tests/resources/coverage/generator/model.c b/tests/resources/coverage/generator/model.c index 3d96745ba3..eb07d205f5 100644 --- a/tests/resources/coverage/generator/model.c +++ b/tests/resources/coverage/generator/model.c @@ -9,7 +9,9 @@ const char VERSION[] = "0.5.0"; const char LIBCELLML_VERSION[] = "0.5.0"; const size_t STATE_COUNT = 1; -const size_t VARIABLE_COUNT = 209; +const size_t CONSTANT_COUNT = 0; +const size_t COMPUTED_CONSTANT_COUNT = 0; +const size_t ALGEBRAIC_COUNT = 209; const VariableInfo VOI_INFO = {"t", "second", "my_component", VARIABLE_OF_INTEGRATION}; @@ -401,7 +403,7 @@ void initialiseVariables(double *states, double *rates, double *variables) states[0] = 0.0; } -void computeComputedConstants(double *variables) +void computeComputedConstants(double *computedConstants) { variables[0] = variables[1] == variables[2]; variables[3] = variables[1]/(variables[2] == variables[2]); diff --git a/tests/resources/coverage/generator/model.h b/tests/resources/coverage/generator/model.h index 3ff486183e..371d0cf0f3 100644 --- a/tests/resources/coverage/generator/model.h +++ b/tests/resources/coverage/generator/model.h @@ -8,7 +8,9 @@ extern const char VERSION[]; extern const char LIBCELLML_VERSION[]; extern const size_t STATE_COUNT; -extern const size_t VARIABLE_COUNT; +extern const size_t CONSTANT_COUNT; +extern const size_t COMPUTED_CONSTANT_COUNT; +extern const size_t ALGEBRAIC_COUNT; typedef enum { VARIABLE_OF_INTEGRATION, @@ -34,6 +36,6 @@ double * createVariablesArray(); void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *variables); -void computeComputedConstants(double *variables); +void computeComputedConstants(double *computedConstants); void computeRates(double voi, double *states, double *rates, double *variables); void computeVariables(double voi, double *states, double *rates, double *variables); diff --git a/tests/resources/coverage/generator/model.implementation.out b/tests/resources/coverage/generator/model.implementation.out index eefbce8eb8..ec60b6b08a 100644 --- a/tests/resources/coverage/generator/model.implementation.out +++ b/tests/resources/coverage/generator/model.implementation.out @@ -172,7 +172,7 @@ void initialiseVariables(double *states, double *rates, double *variables) states[0] = 0.0; } -void computeComputedConstants(double *variables) +void computeComputedConstants(double *computedConstants) { variables[0] = eq(variables[1], variables[2]); variables[3] = variables[1]/eq(variables[2], variables[2]); diff --git a/tests/resources/coverage/generator/model.interface.out b/tests/resources/coverage/generator/model.interface.out index e50441a8b7..73818239f9 100644 --- a/tests/resources/coverage/generator/model.interface.out +++ b/tests/resources/coverage/generator/model.interface.out @@ -9,6 +9,6 @@ double * createVariablesArray(); void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *variables); -void computeComputedConstants(double *variables); +void computeComputedConstants(double *computedConstants); void computeRates(double voi, double *states, double *rates, double *variables); void computeVariables(double voi, double *states, double *rates, double *variables); diff --git a/tests/resources/coverage/generator/model.modified.profile.c b/tests/resources/coverage/generator/model.modified.profile.c index 56c23a2903..90dca2c5ad 100644 --- a/tests/resources/coverage/generator/model.modified.profile.c +++ b/tests/resources/coverage/generator/model.modified.profile.c @@ -9,7 +9,9 @@ const char VERSION[] = "0.5.0.post0"; const char LIBCELLML_VERSION[] = "0.5.0"; const size_t STATE_COUNT = 1; -const size_t VARIABLE_COUNT = 209; +const size_t CONSTANT_COUNT = 0; +const size_t COMPUTED_CONSTANT_COUNT = 0; +const size_t ALGEBRAIC_COUNT = 209; const VariableInfo VOI_INFO = {"t", "second", "my_component", VARIABLE_OF_INTEGRATION}; @@ -401,7 +403,7 @@ void initialiseVariables(double *states, double *rates, double *variables) states[0] = 0.0; } -void computeComputedConstants(double *variables) +void computeComputedConstants(double *computedConstants) { variables[0] = variables[1] == variables[2]; variables[3] = variables[1]/(variables[2] == variables[2]); diff --git a/tests/resources/coverage/generator/model.modified.profile.h b/tests/resources/coverage/generator/model.modified.profile.h index dc602c289b..9466150a4d 100644 --- a/tests/resources/coverage/generator/model.modified.profile.h +++ b/tests/resources/coverage/generator/model.modified.profile.h @@ -8,7 +8,9 @@ extern const char VERSION[]; extern const char LIBCELLML_VERSION[]; extern const size_t STATE_COUNT; -extern const size_t VARIABLE_COUNT; +extern const size_t CONSTANT_COUNT; +extern const size_t COMPUTED_CONSTANT_COUNT; +extern const size_t ALGEBRAIC_COUNT; typedef enum { VARIABLE_OF_INTEGRATION, @@ -34,6 +36,6 @@ double * createVariablesArray(); void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *variables); -void computeComputedConstants(double *variables); +void computeComputedConstants(double *computedConstants); void computeRates(double voi, double *states, double *rates, double *variables); void computeVariables(double voi, double *states, double *rates, double *variables); diff --git a/tests/resources/coverage/generator/model.modified.profile.py b/tests/resources/coverage/generator/model.modified.profile.py index e99214ce32..b14261b732 100644 --- a/tests/resources/coverage/generator/model.modified.profile.py +++ b/tests/resources/coverage/generator/model.modified.profile.py @@ -8,7 +8,9 @@ LIBCELLML_VERSION = "0.5.0" STATE_COUNT = 1 -VARIABLE_COUNT = 209 +CONSTANT_COUNT = 0 +COMPUTED_CONSTANT_COUNT = 0 +ALGEBRAIC_COUNT = 209 class VariableType(Enum): @@ -401,7 +403,7 @@ def initialise_variables(states, rates, variables): states[0] = 0.0 -def compute_computed_constants(variables): +def compute_computed_constants(computed_constants): variables[0] = eq_func(variables[1], variables[2]) variables[3] = variables[1]/eq_func(variables[2], variables[2]) variables[4] = neq_func(variables[1], variables[2]) diff --git a/tests/resources/coverage/generator/model.out b/tests/resources/coverage/generator/model.out index b68591e82f..a6f1743191 100644 --- a/tests/resources/coverage/generator/model.out +++ b/tests/resources/coverage/generator/model.out @@ -142,7 +142,7 @@ void initialiseVariables(double *states, double *rates, double *variables) states[0] = 0.0; } -void computeComputedConstants(double *variables) +void computeComputedConstants(double *computedConstants) { variables[0] = variables[1] == variables[2]; variables[3] = variables[1]/(variables[2] == variables[2]); diff --git a/tests/resources/coverage/generator/model.py b/tests/resources/coverage/generator/model.py index 9e75327d15..1f84e1dfc3 100644 --- a/tests/resources/coverage/generator/model.py +++ b/tests/resources/coverage/generator/model.py @@ -8,7 +8,9 @@ LIBCELLML_VERSION = "0.5.0" STATE_COUNT = 1 -VARIABLE_COUNT = 209 +CONSTANT_COUNT = 0 +COMPUTED_CONSTANT_COUNT = 0 +ALGEBRAIC_COUNT = 209 class VariableType(Enum): @@ -401,7 +403,7 @@ def initialise_variables(states, rates, variables): states[0] = 0.0 -def compute_computed_constants(variables): +def compute_computed_constants(computed_constants): variables[0] = eq_func(variables[1], variables[2]) variables[3] = variables[1]/eq_func(variables[2], variables[2]) variables[4] = neq_func(variables[1], variables[2]) diff --git a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.c b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.c index af60dcddf7..546eab6c15 100644 --- a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.c +++ b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.c @@ -8,7 +8,9 @@ const char VERSION[] = "0.5.0"; const char LIBCELLML_VERSION[] = "0.5.0"; -const size_t VARIABLE_COUNT = 2; +const size_t CONSTANT_COUNT = 0; +const size_t COMPUTED_CONSTANT_COUNT = 0; +const size_t ALGEBRAIC_COUNT = 2; const VariableInfo VARIABLE_INFO[] = { {"x", "dimensionless", "my_algebraic_eqn", COMPUTED_CONSTANT}, @@ -36,7 +38,7 @@ void initialiseVariables(double *variables) variables[1] = 1.0; } -void computeComputedConstants(double *variables) +void computeComputedConstants(double *computedConstants) { variables[0] = variables[1]; } diff --git a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.c b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.c index 75e9d7dfe1..aea7852aa8 100644 --- a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.c +++ b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.c @@ -8,7 +8,9 @@ const char VERSION[] = "0.5.0"; const char LIBCELLML_VERSION[] = "0.5.0"; -const size_t VARIABLE_COUNT = 2; +const size_t CONSTANT_COUNT = 0; +const size_t COMPUTED_CONSTANT_COUNT = 0; +const size_t ALGEBRAIC_COUNT = 2; const VariableInfo VARIABLE_INFO[] = { {"x", "dimensionless", "my_algebraic_eqn", ALGEBRAIC}, @@ -36,7 +38,7 @@ void initialiseVariables(double *variables, ExternalVariable externalVariable) variables[1] = externalVariable(variables, 1); } -void computeComputedConstants(double *variables) +void computeComputedConstants(double *computedConstants) { } diff --git a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.h b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.h index 9c1fc0d543..e3fc1c9e33 100644 --- a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.h +++ b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.h @@ -7,7 +7,9 @@ extern const char VERSION[]; extern const char LIBCELLML_VERSION[]; -extern const size_t VARIABLE_COUNT; +extern const size_t CONSTANT_COUNT; +extern const size_t COMPUTED_CONSTANT_COUNT; +extern const size_t ALGEBRAIC_COUNT; typedef enum { CONSTANT, @@ -31,5 +33,5 @@ void deleteArray(double *array); typedef double (* ExternalVariable)(double *variables, size_t index); void initialiseVariables(double *variables, ExternalVariable externalVariable); -void computeComputedConstants(double *variables); +void computeComputedConstants(double *computedConstants); void computeVariables(double *variables, ExternalVariable externalVariable); diff --git a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.py b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.py index e162bd368a..acf2568cf8 100644 --- a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.py +++ b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.py @@ -7,7 +7,9 @@ __version__ = "0.4.0" LIBCELLML_VERSION = "0.5.0" -VARIABLE_COUNT = 2 +CONSTANT_COUNT = 0 +COMPUTED_CONSTANT_COUNT = 0 +ALGEBRAIC_COUNT = 2 class VariableType(Enum): @@ -31,7 +33,7 @@ def initialise_variables(variables, external_variable): variables[1] = external_variable(variables, 1) -def compute_computed_constants(variables): +def compute_computed_constants(computed_constants): pass diff --git a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.h b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.h index 599f170506..ccf06f8d41 100644 --- a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.h +++ b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.h @@ -7,7 +7,9 @@ extern const char VERSION[]; extern const char LIBCELLML_VERSION[]; -extern const size_t VARIABLE_COUNT; +extern const size_t CONSTANT_COUNT; +extern const size_t COMPUTED_CONSTANT_COUNT; +extern const size_t ALGEBRAIC_COUNT; typedef enum { CONSTANT, @@ -28,5 +30,5 @@ double * createVariablesArray(); void deleteArray(double *array); void initialiseVariables(double *variables); -void computeComputedConstants(double *variables); +void computeComputedConstants(double *computedConstants); void computeVariables(double *variables); diff --git a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.py b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.py index ace02c5427..11a1d35654 100644 --- a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.py +++ b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.py @@ -7,7 +7,9 @@ __version__ = "0.4.0" LIBCELLML_VERSION = "0.5.0" -VARIABLE_COUNT = 2 +CONSTANT_COUNT = 0 +COMPUTED_CONSTANT_COUNT = 0 +ALGEBRAIC_COUNT = 2 class VariableType(Enum): @@ -30,7 +32,7 @@ def initialise_variables(variables): variables[1] = 1.0 -def compute_computed_constants(variables): +def compute_computed_constants(computed_constants): variables[0] = variables[1] diff --git a/tests/resources/generator/algebraic_eqn_const_var_on_rhs/model.c b/tests/resources/generator/algebraic_eqn_const_var_on_rhs/model.c index e4c39d4c7f..98a5119e76 100644 --- a/tests/resources/generator/algebraic_eqn_const_var_on_rhs/model.c +++ b/tests/resources/generator/algebraic_eqn_const_var_on_rhs/model.c @@ -8,7 +8,9 @@ const char VERSION[] = "0.5.0"; const char LIBCELLML_VERSION[] = "0.5.0"; -const size_t VARIABLE_COUNT = 2; +const size_t CONSTANT_COUNT = 0; +const size_t COMPUTED_CONSTANT_COUNT = 0; +const size_t ALGEBRAIC_COUNT = 2; const VariableInfo VARIABLE_INFO[] = { {"x", "dimensionless", "my_algebraic_eqn", COMPUTED_CONSTANT}, @@ -36,7 +38,7 @@ void initialiseVariables(double *variables) variables[1] = 1.0; } -void computeComputedConstants(double *variables) +void computeComputedConstants(double *computedConstants) { variables[0] = variables[1]; } diff --git a/tests/resources/generator/algebraic_eqn_const_var_on_rhs/model.h b/tests/resources/generator/algebraic_eqn_const_var_on_rhs/model.h index 599f170506..ccf06f8d41 100644 --- a/tests/resources/generator/algebraic_eqn_const_var_on_rhs/model.h +++ b/tests/resources/generator/algebraic_eqn_const_var_on_rhs/model.h @@ -7,7 +7,9 @@ extern const char VERSION[]; extern const char LIBCELLML_VERSION[]; -extern const size_t VARIABLE_COUNT; +extern const size_t CONSTANT_COUNT; +extern const size_t COMPUTED_CONSTANT_COUNT; +extern const size_t ALGEBRAIC_COUNT; typedef enum { CONSTANT, @@ -28,5 +30,5 @@ double * createVariablesArray(); void deleteArray(double *array); void initialiseVariables(double *variables); -void computeComputedConstants(double *variables); +void computeComputedConstants(double *computedConstants); void computeVariables(double *variables); diff --git a/tests/resources/generator/algebraic_eqn_const_var_on_rhs/model.py b/tests/resources/generator/algebraic_eqn_const_var_on_rhs/model.py index 93b0b86988..145fc08791 100644 --- a/tests/resources/generator/algebraic_eqn_const_var_on_rhs/model.py +++ b/tests/resources/generator/algebraic_eqn_const_var_on_rhs/model.py @@ -7,7 +7,9 @@ __version__ = "0.4.0" LIBCELLML_VERSION = "0.5.0" -VARIABLE_COUNT = 2 +CONSTANT_COUNT = 0 +COMPUTED_CONSTANT_COUNT = 0 +ALGEBRAIC_COUNT = 2 class VariableType(Enum): @@ -30,7 +32,7 @@ def initialise_variables(variables): variables[1] = 1.0 -def compute_computed_constants(variables): +def compute_computed_constants(computed_constants): variables[0] = variables[1] diff --git a/tests/resources/generator/algebraic_eqn_constant_on_rhs/model.c b/tests/resources/generator/algebraic_eqn_constant_on_rhs/model.c index ed5b2779ed..23a92bc974 100644 --- a/tests/resources/generator/algebraic_eqn_constant_on_rhs/model.c +++ b/tests/resources/generator/algebraic_eqn_constant_on_rhs/model.c @@ -8,7 +8,9 @@ const char VERSION[] = "0.5.0"; const char LIBCELLML_VERSION[] = "0.5.0"; -const size_t VARIABLE_COUNT = 1; +const size_t CONSTANT_COUNT = 0; +const size_t COMPUTED_CONSTANT_COUNT = 0; +const size_t ALGEBRAIC_COUNT = 1; const VariableInfo VARIABLE_INFO[] = { {"x", "dimensionless", "my_component", COMPUTED_CONSTANT} @@ -35,7 +37,7 @@ void initialiseVariables(double *variables) variables[0] = 1.0; } -void computeComputedConstants(double *variables) +void computeComputedConstants(double *computedConstants) { } diff --git a/tests/resources/generator/algebraic_eqn_constant_on_rhs/model.h b/tests/resources/generator/algebraic_eqn_constant_on_rhs/model.h index 32566495be..0ca7442cf0 100644 --- a/tests/resources/generator/algebraic_eqn_constant_on_rhs/model.h +++ b/tests/resources/generator/algebraic_eqn_constant_on_rhs/model.h @@ -7,7 +7,9 @@ extern const char VERSION[]; extern const char LIBCELLML_VERSION[]; -extern const size_t VARIABLE_COUNT; +extern const size_t CONSTANT_COUNT; +extern const size_t COMPUTED_CONSTANT_COUNT; +extern const size_t ALGEBRAIC_COUNT; typedef enum { CONSTANT, @@ -28,5 +30,5 @@ double * createVariablesArray(); void deleteArray(double *array); void initialiseVariables(double *variables); -void computeComputedConstants(double *variables); +void computeComputedConstants(double *computedConstants); void computeVariables(double *variables); diff --git a/tests/resources/generator/algebraic_eqn_constant_on_rhs/model.py b/tests/resources/generator/algebraic_eqn_constant_on_rhs/model.py index 76067ecc64..f2c1b3fa71 100644 --- a/tests/resources/generator/algebraic_eqn_constant_on_rhs/model.py +++ b/tests/resources/generator/algebraic_eqn_constant_on_rhs/model.py @@ -7,7 +7,9 @@ __version__ = "0.4.0" LIBCELLML_VERSION = "0.5.0" -VARIABLE_COUNT = 1 +CONSTANT_COUNT = 0 +COMPUTED_CONSTANT_COUNT = 0 +ALGEBRAIC_COUNT = 1 class VariableType(Enum): @@ -29,7 +31,7 @@ def initialise_variables(variables): variables[0] = 1.0 -def compute_computed_constants(variables): +def compute_computed_constants(computed_constants): pass diff --git a/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.c b/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.c index 0be2751ba0..513c8f0a9e 100644 --- a/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.c +++ b/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.c @@ -9,7 +9,9 @@ const char VERSION[] = "0.5.0"; const char LIBCELLML_VERSION[] = "0.5.0"; const size_t STATE_COUNT = 1; -const size_t VARIABLE_COUNT = 2; +const size_t CONSTANT_COUNT = 0; +const size_t COMPUTED_CONSTANT_COUNT = 0; +const size_t ALGEBRAIC_COUNT = 2; const VariableInfo VOI_INFO = {"t", "second", "environment", VARIABLE_OF_INTEGRATION}; @@ -55,7 +57,7 @@ void initialiseVariables(double *states, double *rates, double *variables) states[0] = 1.0; } -void computeComputedConstants(double *variables) +void computeComputedConstants(double *computedConstants) { } diff --git a/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.h b/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.h index 9cbab2d888..ee190e0f53 100644 --- a/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.h +++ b/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.h @@ -8,7 +8,9 @@ extern const char VERSION[]; extern const char LIBCELLML_VERSION[]; extern const size_t STATE_COUNT; -extern const size_t VARIABLE_COUNT; +extern const size_t CONSTANT_COUNT; +extern const size_t COMPUTED_CONSTANT_COUNT; +extern const size_t ALGEBRAIC_COUNT; typedef enum { VARIABLE_OF_INTEGRATION, @@ -34,6 +36,6 @@ double * createVariablesArray(); void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *variables); -void computeComputedConstants(double *variables); +void computeComputedConstants(double *computedConstants); void computeRates(double voi, double *states, double *rates, double *variables); void computeVariables(double voi, double *states, double *rates, double *variables); diff --git a/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.py b/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.py index ea246e37bd..d6dfe896a6 100644 --- a/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.py +++ b/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.py @@ -8,7 +8,9 @@ LIBCELLML_VERSION = "0.5.0" STATE_COUNT = 1 -VARIABLE_COUNT = 2 +CONSTANT_COUNT = 0 +COMPUTED_CONSTANT_COUNT = 0 +ALGEBRAIC_COUNT = 2 class VariableType(Enum): @@ -44,7 +46,7 @@ def initialise_variables(states, rates, variables): states[0] = 1.0 -def compute_computed_constants(variables): +def compute_computed_constants(computed_constants): pass diff --git a/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.c b/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.c index c76bbd6ef8..eba334d859 100644 --- a/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.c +++ b/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.c @@ -9,7 +9,9 @@ const char VERSION[] = "0.5.0"; const char LIBCELLML_VERSION[] = "0.5.0"; const size_t STATE_COUNT = 1; -const size_t VARIABLE_COUNT = 2; +const size_t CONSTANT_COUNT = 0; +const size_t COMPUTED_CONSTANT_COUNT = 0; +const size_t ALGEBRAIC_COUNT = 2; const VariableInfo VOI_INFO = {"t", "second", "my_component", VARIABLE_OF_INTEGRATION}; @@ -55,7 +57,7 @@ void initialiseVariables(double *states, double *rates, double *variables) states[0] = 1.0; } -void computeComputedConstants(double *variables) +void computeComputedConstants(double *computedConstants) { } diff --git a/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.h b/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.h index 9aad67f7aa..d1084de7ab 100644 --- a/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.h +++ b/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.h @@ -8,7 +8,9 @@ extern const char VERSION[]; extern const char LIBCELLML_VERSION[]; extern const size_t STATE_COUNT; -extern const size_t VARIABLE_COUNT; +extern const size_t CONSTANT_COUNT; +extern const size_t COMPUTED_CONSTANT_COUNT; +extern const size_t ALGEBRAIC_COUNT; typedef enum { VARIABLE_OF_INTEGRATION, @@ -34,6 +36,6 @@ double * createVariablesArray(); void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *variables); -void computeComputedConstants(double *variables); +void computeComputedConstants(double *computedConstants); void computeRates(double voi, double *states, double *rates, double *variables); void computeVariables(double voi, double *states, double *rates, double *variables); diff --git a/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.py b/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.py index 93e6241916..506f622845 100644 --- a/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.py +++ b/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.py @@ -8,7 +8,9 @@ LIBCELLML_VERSION = "0.5.0" STATE_COUNT = 1 -VARIABLE_COUNT = 2 +CONSTANT_COUNT = 0 +COMPUTED_CONSTANT_COUNT = 0 +ALGEBRAIC_COUNT = 2 class VariableType(Enum): @@ -44,7 +46,7 @@ def initialise_variables(states, rates, variables): states[0] = 1.0 -def compute_computed_constants(variables): +def compute_computed_constants(computed_constants): pass diff --git a/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.c b/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.c index c974f5a062..81ab0a6dc7 100644 --- a/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.c +++ b/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.c @@ -9,7 +9,9 @@ const char VERSION[] = "0.5.0"; const char LIBCELLML_VERSION[] = "0.5.0"; const size_t STATE_COUNT = 1; -const size_t VARIABLE_COUNT = 2; +const size_t CONSTANT_COUNT = 0; +const size_t COMPUTED_CONSTANT_COUNT = 0; +const size_t ALGEBRAIC_COUNT = 2; const VariableInfo VOI_INFO = {"t", "second", "environment", VARIABLE_OF_INTEGRATION}; @@ -55,7 +57,7 @@ void initialiseVariables(double *states, double *rates, double *variables) states[0] = 1.0; } -void computeComputedConstants(double *variables) +void computeComputedConstants(double *computedConstants) { } diff --git a/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.h b/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.h index 5a4e26be3d..8b5e1fc7f3 100644 --- a/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.h +++ b/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.h @@ -8,7 +8,9 @@ extern const char VERSION[]; extern const char LIBCELLML_VERSION[]; extern const size_t STATE_COUNT; -extern const size_t VARIABLE_COUNT; +extern const size_t CONSTANT_COUNT; +extern const size_t COMPUTED_CONSTANT_COUNT; +extern const size_t ALGEBRAIC_COUNT; typedef enum { VARIABLE_OF_INTEGRATION, @@ -34,6 +36,6 @@ double * createVariablesArray(); void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *variables); -void computeComputedConstants(double *variables); +void computeComputedConstants(double *computedConstants); void computeRates(double voi, double *states, double *rates, double *variables); void computeVariables(double voi, double *states, double *rates, double *variables); diff --git a/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.py b/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.py index 819c48815b..945c837bd4 100644 --- a/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.py +++ b/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.py @@ -8,7 +8,9 @@ LIBCELLML_VERSION = "0.5.0" STATE_COUNT = 1 -VARIABLE_COUNT = 2 +CONSTANT_COUNT = 0 +COMPUTED_CONSTANT_COUNT = 0 +ALGEBRAIC_COUNT = 2 class VariableType(Enum): @@ -44,7 +46,7 @@ def initialise_variables(states, rates, variables): states[0] = 1.0 -def compute_computed_constants(variables): +def compute_computed_constants(computed_constants): pass diff --git a/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.c b/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.c index 942fa8c585..e79a9e6964 100644 --- a/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.c +++ b/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.c @@ -9,7 +9,9 @@ const char VERSION[] = "0.5.0"; const char LIBCELLML_VERSION[] = "0.5.0"; const size_t STATE_COUNT = 1; -const size_t VARIABLE_COUNT = 2; +const size_t CONSTANT_COUNT = 0; +const size_t COMPUTED_CONSTANT_COUNT = 0; +const size_t ALGEBRAIC_COUNT = 2; const VariableInfo VOI_INFO = {"t", "second", "my_model", VARIABLE_OF_INTEGRATION}; @@ -55,7 +57,7 @@ void initialiseVariables(double *states, double *rates, double *variables) states[0] = 1.0; } -void computeComputedConstants(double *variables) +void computeComputedConstants(double *computedConstants) { } diff --git a/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.h b/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.h index 6801dd9c04..e6c0ef1cc1 100644 --- a/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.h +++ b/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.h @@ -8,7 +8,9 @@ extern const char VERSION[]; extern const char LIBCELLML_VERSION[]; extern const size_t STATE_COUNT; -extern const size_t VARIABLE_COUNT; +extern const size_t CONSTANT_COUNT; +extern const size_t COMPUTED_CONSTANT_COUNT; +extern const size_t ALGEBRAIC_COUNT; typedef enum { VARIABLE_OF_INTEGRATION, @@ -34,6 +36,6 @@ double * createVariablesArray(); void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *variables); -void computeComputedConstants(double *variables); +void computeComputedConstants(double *computedConstants); void computeRates(double voi, double *states, double *rates, double *variables); void computeVariables(double voi, double *states, double *rates, double *variables); diff --git a/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.py b/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.py index 186d408c84..6991739626 100644 --- a/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.py +++ b/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.py @@ -8,7 +8,9 @@ LIBCELLML_VERSION = "0.5.0" STATE_COUNT = 1 -VARIABLE_COUNT = 2 +CONSTANT_COUNT = 0 +COMPUTED_CONSTANT_COUNT = 0 +ALGEBRAIC_COUNT = 2 class VariableType(Enum): @@ -44,7 +46,7 @@ def initialise_variables(states, rates, variables): states[0] = 1.0 -def compute_computed_constants(variables): +def compute_computed_constants(computed_constants): pass diff --git a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.c b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.c index 0d9cfb7a81..c7cae1bd4b 100644 --- a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.c +++ b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.c @@ -8,7 +8,9 @@ const char VERSION[] = "0.5.0"; const char LIBCELLML_VERSION[] = "0.5.0"; -const size_t VARIABLE_COUNT = 4; +const size_t CONSTANT_COUNT = 0; +const size_t COMPUTED_CONSTANT_COUNT = 0; +const size_t ALGEBRAIC_COUNT = 4; const VariableInfo VARIABLE_INFO[] = { {"b", "dimensionless", "my_algebraic_eqn", COMPUTED_CONSTANT}, @@ -69,7 +71,7 @@ void initialiseVariables(double *variables) variables[2] = 7.0; } -void computeComputedConstants(double *variables) +void computeComputedConstants(double *computedConstants) { } diff --git a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.c b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.c index a9235ddb87..406e43a244 100644 --- a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.c +++ b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.c @@ -8,7 +8,9 @@ const char VERSION[] = "0.5.0"; const char LIBCELLML_VERSION[] = "0.5.0"; -const size_t VARIABLE_COUNT = 4; +const size_t CONSTANT_COUNT = 0; +const size_t COMPUTED_CONSTANT_COUNT = 0; +const size_t ALGEBRAIC_COUNT = 4; const VariableInfo VARIABLE_INFO[] = { {"b", "dimensionless", "my_algebraic_eqn", COMPUTED_CONSTANT}, @@ -41,7 +43,7 @@ void initialiseVariables(double *variables, ExternalVariable externalVariable) variables[3] = externalVariable(variables, 3); } -void computeComputedConstants(double *variables) +void computeComputedConstants(double *computedConstants) { } diff --git a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.h b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.h index 9c1fc0d543..e3fc1c9e33 100644 --- a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.h +++ b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.h @@ -7,7 +7,9 @@ extern const char VERSION[]; extern const char LIBCELLML_VERSION[]; -extern const size_t VARIABLE_COUNT; +extern const size_t CONSTANT_COUNT; +extern const size_t COMPUTED_CONSTANT_COUNT; +extern const size_t ALGEBRAIC_COUNT; typedef enum { CONSTANT, @@ -31,5 +33,5 @@ void deleteArray(double *array); typedef double (* ExternalVariable)(double *variables, size_t index); void initialiseVariables(double *variables, ExternalVariable externalVariable); -void computeComputedConstants(double *variables); +void computeComputedConstants(double *computedConstants); void computeVariables(double *variables, ExternalVariable externalVariable); diff --git a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.py b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.py index 6122ce6299..52f6a82aa5 100644 --- a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.py +++ b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.py @@ -7,7 +7,9 @@ __version__ = "0.4.0" LIBCELLML_VERSION = "0.5.0" -VARIABLE_COUNT = 4 +CONSTANT_COUNT = 0 +COMPUTED_CONSTANT_COUNT = 0 +ALGEBRAIC_COUNT = 4 class VariableType(Enum): @@ -36,7 +38,7 @@ def initialise_variables(variables, external_variable): variables[3] = external_variable(variables, 3) -def compute_computed_constants(variables): +def compute_computed_constants(computed_constants): pass diff --git a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.h b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.h index 599f170506..ccf06f8d41 100644 --- a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.h +++ b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.h @@ -7,7 +7,9 @@ extern const char VERSION[]; extern const char LIBCELLML_VERSION[]; -extern const size_t VARIABLE_COUNT; +extern const size_t CONSTANT_COUNT; +extern const size_t COMPUTED_CONSTANT_COUNT; +extern const size_t ALGEBRAIC_COUNT; typedef enum { CONSTANT, @@ -28,5 +30,5 @@ double * createVariablesArray(); void deleteArray(double *array); void initialiseVariables(double *variables); -void computeComputedConstants(double *variables); +void computeComputedConstants(double *computedConstants); void computeVariables(double *variables); diff --git a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.py b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.py index 64e6fded56..e64d422e57 100644 --- a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.py +++ b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.py @@ -7,7 +7,9 @@ __version__ = "0.4.0" LIBCELLML_VERSION = "0.5.0" -VARIABLE_COUNT = 4 +CONSTANT_COUNT = 0 +COMPUTED_CONSTANT_COUNT = 0 +ALGEBRAIC_COUNT = 4 class VariableType(Enum): @@ -56,7 +58,7 @@ def initialise_variables(variables): variables[2] = 7.0 -def compute_computed_constants(variables): +def compute_computed_constants(computed_constants): pass diff --git a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.c b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.c index b8339db9e9..0e950fa1f6 100644 --- a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.c +++ b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.c @@ -8,7 +8,9 @@ const char VERSION[] = "0.5.0"; const char LIBCELLML_VERSION[] = "0.5.0"; -const size_t VARIABLE_COUNT = 3; +const size_t CONSTANT_COUNT = 0; +const size_t COMPUTED_CONSTANT_COUNT = 0; +const size_t ALGEBRAIC_COUNT = 3; const VariableInfo VARIABLE_INFO[] = { {"x", "dimensionless", "my_algebraic_system", ALGEBRAIC}, @@ -75,7 +77,7 @@ void initialiseVariables(double *variables) variables[2] = 1.0; } -void computeComputedConstants(double *variables) +void computeComputedConstants(double *computedConstants) { } diff --git a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.h b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.h index 5c5224a4cc..d09497bd09 100644 --- a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.h +++ b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.h @@ -7,7 +7,9 @@ extern const char VERSION[]; extern const char LIBCELLML_VERSION[]; -extern const size_t VARIABLE_COUNT; +extern const size_t CONSTANT_COUNT; +extern const size_t COMPUTED_CONSTANT_COUNT; +extern const size_t ALGEBRAIC_COUNT; typedef enum { CONSTANT, @@ -28,5 +30,5 @@ double * createVariablesArray(); void deleteArray(double *array); void initialiseVariables(double *variables); -void computeComputedConstants(double *variables); +void computeComputedConstants(double *computedConstants); void computeVariables(double *variables); diff --git a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.one.external.c b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.one.external.c index 21337829c7..e722bff088 100644 --- a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.one.external.c +++ b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.one.external.c @@ -8,7 +8,9 @@ const char VERSION[] = "0.5.0"; const char LIBCELLML_VERSION[] = "0.5.0"; -const size_t VARIABLE_COUNT = 3; +const size_t CONSTANT_COUNT = 0; +const size_t COMPUTED_CONSTANT_COUNT = 0; +const size_t ALGEBRAIC_COUNT = 3; const VariableInfo VARIABLE_INFO[] = { {"x", "dimensionless", "my_algebraic_system", EXTERNAL}, @@ -72,7 +74,7 @@ void initialiseVariables(double *variables, ExternalVariable externalVariable) variables[0] = externalVariable(variables, 0); } -void computeComputedConstants(double *variables) +void computeComputedConstants(double *computedConstants) { } diff --git a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.one.external.h b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.one.external.h index 1313c36870..e1fdbe0980 100644 --- a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.one.external.h +++ b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.one.external.h @@ -7,7 +7,9 @@ extern const char VERSION[]; extern const char LIBCELLML_VERSION[]; -extern const size_t VARIABLE_COUNT; +extern const size_t CONSTANT_COUNT; +extern const size_t COMPUTED_CONSTANT_COUNT; +extern const size_t ALGEBRAIC_COUNT; typedef enum { CONSTANT, @@ -31,5 +33,5 @@ void deleteArray(double *array); typedef double (* ExternalVariable)(double *variables, size_t index); void initialiseVariables(double *variables, ExternalVariable externalVariable); -void computeComputedConstants(double *variables); +void computeComputedConstants(double *computedConstants); void computeVariables(double *variables, ExternalVariable externalVariable); diff --git a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.one.external.py b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.one.external.py index 43e635b6d8..89a57c41c2 100644 --- a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.one.external.py +++ b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.one.external.py @@ -7,7 +7,9 @@ __version__ = "0.4.0" LIBCELLML_VERSION = "0.5.0" -VARIABLE_COUNT = 3 +CONSTANT_COUNT = 0 +COMPUTED_CONSTANT_COUNT = 0 +ALGEBRAIC_COUNT = 3 class VariableType(Enum): @@ -60,7 +62,7 @@ def initialise_variables(variables, external_variable): variables[0] = external_variable(variables, 0) -def compute_computed_constants(variables): +def compute_computed_constants(computed_constants): pass diff --git a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.py b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.py index 2f54c8121a..9125b7c1db 100644 --- a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.py +++ b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.py @@ -7,7 +7,9 @@ __version__ = "0.4.0" LIBCELLML_VERSION = "0.5.0" -VARIABLE_COUNT = 3 +CONSTANT_COUNT = 0 +COMPUTED_CONSTANT_COUNT = 0 +ALGEBRAIC_COUNT = 3 class VariableType(Enum): @@ -62,7 +64,7 @@ def initialise_variables(variables): variables[2] = 1.0 -def compute_computed_constants(variables): +def compute_computed_constants(computed_constants): pass diff --git a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.c b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.c index 837d3e0ec8..a5ec7515f2 100644 --- a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.c +++ b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.c @@ -8,7 +8,9 @@ const char VERSION[] = "0.5.0"; const char LIBCELLML_VERSION[] = "0.5.0"; -const size_t VARIABLE_COUNT = 3; +const size_t CONSTANT_COUNT = 0; +const size_t COMPUTED_CONSTANT_COUNT = 0; +const size_t ALGEBRAIC_COUNT = 3; const VariableInfo VARIABLE_INFO[] = { {"x", "dimensionless", "my_algebraic_system", EXTERNAL}, @@ -39,7 +41,7 @@ void initialiseVariables(double *variables, ExternalVariable externalVariable) variables[2] = externalVariable(variables, 2); } -void computeComputedConstants(double *variables) +void computeComputedConstants(double *computedConstants) { } diff --git a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.h b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.h index 1313c36870..e1fdbe0980 100644 --- a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.h +++ b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.h @@ -7,7 +7,9 @@ extern const char VERSION[]; extern const char LIBCELLML_VERSION[]; -extern const size_t VARIABLE_COUNT; +extern const size_t CONSTANT_COUNT; +extern const size_t COMPUTED_CONSTANT_COUNT; +extern const size_t ALGEBRAIC_COUNT; typedef enum { CONSTANT, @@ -31,5 +33,5 @@ void deleteArray(double *array); typedef double (* ExternalVariable)(double *variables, size_t index); void initialiseVariables(double *variables, ExternalVariable externalVariable); -void computeComputedConstants(double *variables); +void computeComputedConstants(double *computedConstants); void computeVariables(double *variables, ExternalVariable externalVariable); diff --git a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.py b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.py index 5816ca0291..2dde0e0323 100644 --- a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.py +++ b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.py @@ -7,7 +7,9 @@ __version__ = "0.4.0" LIBCELLML_VERSION = "0.5.0" -VARIABLE_COUNT = 3 +CONSTANT_COUNT = 0 +COMPUTED_CONSTANT_COUNT = 0 +ALGEBRAIC_COUNT = 3 class VariableType(Enum): @@ -34,7 +36,7 @@ def initialise_variables(variables, external_variable): variables[2] = external_variable(variables, 2) -def compute_computed_constants(variables): +def compute_computed_constants(computed_constants): pass diff --git a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.two.externals.c b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.two.externals.c index 392e8f3ad8..b4213f7a30 100644 --- a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.two.externals.c +++ b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.two.externals.c @@ -8,7 +8,9 @@ const char VERSION[] = "0.5.0"; const char LIBCELLML_VERSION[] = "0.5.0"; -const size_t VARIABLE_COUNT = 3; +const size_t CONSTANT_COUNT = 0; +const size_t COMPUTED_CONSTANT_COUNT = 0; +const size_t ALGEBRAIC_COUNT = 3; const VariableInfo VARIABLE_INFO[] = { {"x", "dimensionless", "my_algebraic_system", EXTERNAL}, @@ -109,7 +111,7 @@ void initialiseVariables(double *variables, ExternalVariable externalVariable) variables[2] = externalVariable(variables, 2); } -void computeComputedConstants(double *variables) +void computeComputedConstants(double *computedConstants) { } diff --git a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.two.externals.h b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.two.externals.h index 1313c36870..e1fdbe0980 100644 --- a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.two.externals.h +++ b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.two.externals.h @@ -7,7 +7,9 @@ extern const char VERSION[]; extern const char LIBCELLML_VERSION[]; -extern const size_t VARIABLE_COUNT; +extern const size_t CONSTANT_COUNT; +extern const size_t COMPUTED_CONSTANT_COUNT; +extern const size_t ALGEBRAIC_COUNT; typedef enum { CONSTANT, @@ -31,5 +33,5 @@ void deleteArray(double *array); typedef double (* ExternalVariable)(double *variables, size_t index); void initialiseVariables(double *variables, ExternalVariable externalVariable); -void computeComputedConstants(double *variables); +void computeComputedConstants(double *computedConstants); void computeVariables(double *variables, ExternalVariable externalVariable); diff --git a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.two.externals.py b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.two.externals.py index 34b77ef864..d18695e148 100644 --- a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.two.externals.py +++ b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.two.externals.py @@ -7,7 +7,9 @@ __version__ = "0.4.0" LIBCELLML_VERSION = "0.5.0" -VARIABLE_COUNT = 3 +CONSTANT_COUNT = 0 +COMPUTED_CONSTANT_COUNT = 0 +ALGEBRAIC_COUNT = 3 class VariableType(Enum): @@ -91,7 +93,7 @@ def initialise_variables(variables, external_variable): variables[2] = external_variable(variables, 2) -def compute_computed_constants(variables): +def compute_computed_constants(computed_constants): pass diff --git a/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.c b/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.c index 55630e0113..002200921c 100644 --- a/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.c +++ b/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.c @@ -8,7 +8,9 @@ const char VERSION[] = "0.5.0"; const char LIBCELLML_VERSION[] = "0.5.0"; -const size_t VARIABLE_COUNT = 6; +const size_t CONSTANT_COUNT = 0; +const size_t COMPUTED_CONSTANT_COUNT = 0; +const size_t ALGEBRAIC_COUNT = 6; const VariableInfo VARIABLE_INFO[] = { {"d", "dimensionless", "my_algebraic_system", ALGEBRAIC}, @@ -75,7 +77,7 @@ void initialiseVariables(double *variables) variables[5] = 5.0; } -void computeComputedConstants(double *variables) +void computeComputedConstants(double *computedConstants) { variables[3] = 3.0*variables[4]+variables[5]; } diff --git a/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.h b/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.h index 5c5224a4cc..d09497bd09 100644 --- a/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.h +++ b/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.h @@ -7,7 +7,9 @@ extern const char VERSION[]; extern const char LIBCELLML_VERSION[]; -extern const size_t VARIABLE_COUNT; +extern const size_t CONSTANT_COUNT; +extern const size_t COMPUTED_CONSTANT_COUNT; +extern const size_t ALGEBRAIC_COUNT; typedef enum { CONSTANT, @@ -28,5 +30,5 @@ double * createVariablesArray(); void deleteArray(double *array); void initialiseVariables(double *variables); -void computeComputedConstants(double *variables); +void computeComputedConstants(double *computedConstants); void computeVariables(double *variables); diff --git a/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.py b/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.py index 0fbf42a74c..5b34036e40 100644 --- a/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.py +++ b/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.py @@ -7,7 +7,9 @@ __version__ = "0.4.0" LIBCELLML_VERSION = "0.5.0" -VARIABLE_COUNT = 6 +CONSTANT_COUNT = 0 +COMPUTED_CONSTANT_COUNT = 0 +ALGEBRAIC_COUNT = 6 class VariableType(Enum): @@ -62,7 +64,7 @@ def initialise_variables(variables): variables[5] = 5.0 -def compute_computed_constants(variables): +def compute_computed_constants(computed_constants): variables[3] = 3.0*variables[4]+variables[5] diff --git a/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.c b/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.c index e887e28b88..7ee14bfeb3 100644 --- a/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.c +++ b/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.c @@ -8,7 +8,9 @@ const char VERSION[] = "0.5.0"; const char LIBCELLML_VERSION[] = "0.5.0"; -const size_t VARIABLE_COUNT = 6; +const size_t CONSTANT_COUNT = 0; +const size_t COMPUTED_CONSTANT_COUNT = 0; +const size_t ALGEBRAIC_COUNT = 6; const VariableInfo VARIABLE_INFO[] = { {"a", "dimensionless", "my_algebraic_system", COMPUTED_CONSTANT}, @@ -75,7 +77,7 @@ void initialiseVariables(double *variables) variables[4] = 1.0; } -void computeComputedConstants(double *variables) +void computeComputedConstants(double *computedConstants) { variables[0] = 3.0*variables[1]+variables[2]; } diff --git a/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.h b/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.h index 5c5224a4cc..d09497bd09 100644 --- a/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.h +++ b/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.h @@ -7,7 +7,9 @@ extern const char VERSION[]; extern const char LIBCELLML_VERSION[]; -extern const size_t VARIABLE_COUNT; +extern const size_t CONSTANT_COUNT; +extern const size_t COMPUTED_CONSTANT_COUNT; +extern const size_t ALGEBRAIC_COUNT; typedef enum { CONSTANT, @@ -28,5 +30,5 @@ double * createVariablesArray(); void deleteArray(double *array); void initialiseVariables(double *variables); -void computeComputedConstants(double *variables); +void computeComputedConstants(double *computedConstants); void computeVariables(double *variables); diff --git a/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.py b/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.py index 3295b1d2c8..640f553c3c 100644 --- a/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.py +++ b/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.py @@ -7,7 +7,9 @@ __version__ = "0.4.0" LIBCELLML_VERSION = "0.5.0" -VARIABLE_COUNT = 6 +CONSTANT_COUNT = 0 +COMPUTED_CONSTANT_COUNT = 0 +ALGEBRAIC_COUNT = 6 class VariableType(Enum): @@ -62,7 +64,7 @@ def initialise_variables(variables): variables[4] = 1.0 -def compute_computed_constants(variables): +def compute_computed_constants(computed_constants): variables[0] = 3.0*variables[1]+variables[2] diff --git a/tests/resources/generator/algebraic_unknown_var_on_rhs/model.c b/tests/resources/generator/algebraic_unknown_var_on_rhs/model.c index 817c6ff7bf..7991acc69d 100644 --- a/tests/resources/generator/algebraic_unknown_var_on_rhs/model.c +++ b/tests/resources/generator/algebraic_unknown_var_on_rhs/model.c @@ -8,7 +8,9 @@ const char VERSION[] = "0.5.0"; const char LIBCELLML_VERSION[] = "0.5.0"; -const size_t VARIABLE_COUNT = 2; +const size_t CONSTANT_COUNT = 0; +const size_t COMPUTED_CONSTANT_COUNT = 0; +const size_t ALGEBRAIC_COUNT = 2; const VariableInfo VARIABLE_INFO[] = { {"x", "dimensionless", "my_component", COMPUTED_CONSTANT}, @@ -36,7 +38,7 @@ void initialiseVariables(double *variables) variables[0] = 1.0; } -void computeComputedConstants(double *variables) +void computeComputedConstants(double *computedConstants) { variables[1] = variables[0]; } diff --git a/tests/resources/generator/algebraic_unknown_var_on_rhs/model.h b/tests/resources/generator/algebraic_unknown_var_on_rhs/model.h index 32566495be..0ca7442cf0 100644 --- a/tests/resources/generator/algebraic_unknown_var_on_rhs/model.h +++ b/tests/resources/generator/algebraic_unknown_var_on_rhs/model.h @@ -7,7 +7,9 @@ extern const char VERSION[]; extern const char LIBCELLML_VERSION[]; -extern const size_t VARIABLE_COUNT; +extern const size_t CONSTANT_COUNT; +extern const size_t COMPUTED_CONSTANT_COUNT; +extern const size_t ALGEBRAIC_COUNT; typedef enum { CONSTANT, @@ -28,5 +30,5 @@ double * createVariablesArray(); void deleteArray(double *array); void initialiseVariables(double *variables); -void computeComputedConstants(double *variables); +void computeComputedConstants(double *computedConstants); void computeVariables(double *variables); diff --git a/tests/resources/generator/algebraic_unknown_var_on_rhs/model.py b/tests/resources/generator/algebraic_unknown_var_on_rhs/model.py index b2ae5ff203..a7b0a114c2 100644 --- a/tests/resources/generator/algebraic_unknown_var_on_rhs/model.py +++ b/tests/resources/generator/algebraic_unknown_var_on_rhs/model.py @@ -7,7 +7,9 @@ __version__ = "0.4.0" LIBCELLML_VERSION = "0.5.0" -VARIABLE_COUNT = 2 +CONSTANT_COUNT = 0 +COMPUTED_CONSTANT_COUNT = 0 +ALGEBRAIC_COUNT = 2 class VariableType(Enum): @@ -30,7 +32,7 @@ def initialise_variables(variables): variables[0] = 1.0 -def compute_computed_constants(variables): +def compute_computed_constants(computed_constants): variables[1] = variables[0] diff --git a/tests/resources/generator/cell_geometry_model/model.c b/tests/resources/generator/cell_geometry_model/model.c index dc9b50fd8c..02f1470c4b 100644 --- a/tests/resources/generator/cell_geometry_model/model.c +++ b/tests/resources/generator/cell_geometry_model/model.c @@ -8,7 +8,9 @@ const char VERSION[] = "0.5.0"; const char LIBCELLML_VERSION[] = "0.5.0"; -const size_t VARIABLE_COUNT = 4; +const size_t CONSTANT_COUNT = 0; +const size_t COMPUTED_CONSTANT_COUNT = 0; +const size_t ALGEBRAIC_COUNT = 4; const VariableInfo VARIABLE_INFO[] = { {"vcell", "microlitre", "cell_geometry", COMPUTED_CONSTANT}, @@ -39,7 +41,7 @@ void initialiseVariables(double *variables) variables[2] = 0.0011; } -void computeComputedConstants(double *variables) +void computeComputedConstants(double *computedConstants) { variables[0] = 1000.0*3.14*variables[2]*variables[2]*variables[1]; variables[3] = 0.02*variables[0]; diff --git a/tests/resources/generator/cell_geometry_model/model.external.c b/tests/resources/generator/cell_geometry_model/model.external.c index b93bdb5653..23c8e5b5b7 100644 --- a/tests/resources/generator/cell_geometry_model/model.external.c +++ b/tests/resources/generator/cell_geometry_model/model.external.c @@ -8,7 +8,9 @@ const char VERSION[] = "0.5.0"; const char LIBCELLML_VERSION[] = "0.5.0"; -const size_t VARIABLE_COUNT = 4; +const size_t CONSTANT_COUNT = 0; +const size_t COMPUTED_CONSTANT_COUNT = 0; +const size_t ALGEBRAIC_COUNT = 4; const VariableInfo VARIABLE_INFO[] = { {"vcell", "microlitre", "cell_geometry", ALGEBRAIC}, @@ -39,7 +41,7 @@ void initialiseVariables(double *variables, ExternalVariable externalVariable) variables[2] = externalVariable(variables, 2); } -void computeComputedConstants(double *variables) +void computeComputedConstants(double *computedConstants) { } diff --git a/tests/resources/generator/cell_geometry_model/model.external.h b/tests/resources/generator/cell_geometry_model/model.external.h index 3664a6d38c..be4c0a8329 100644 --- a/tests/resources/generator/cell_geometry_model/model.external.h +++ b/tests/resources/generator/cell_geometry_model/model.external.h @@ -7,7 +7,9 @@ extern const char VERSION[]; extern const char LIBCELLML_VERSION[]; -extern const size_t VARIABLE_COUNT; +extern const size_t CONSTANT_COUNT; +extern const size_t COMPUTED_CONSTANT_COUNT; +extern const size_t ALGEBRAIC_COUNT; typedef enum { CONSTANT, @@ -31,5 +33,5 @@ void deleteArray(double *array); typedef double (* ExternalVariable)(double *variables, size_t index); void initialiseVariables(double *variables, ExternalVariable externalVariable); -void computeComputedConstants(double *variables); +void computeComputedConstants(double *computedConstants); void computeVariables(double *variables, ExternalVariable externalVariable); diff --git a/tests/resources/generator/cell_geometry_model/model.external.py b/tests/resources/generator/cell_geometry_model/model.external.py index 5dda92b0a2..741f7235d6 100644 --- a/tests/resources/generator/cell_geometry_model/model.external.py +++ b/tests/resources/generator/cell_geometry_model/model.external.py @@ -7,7 +7,9 @@ __version__ = "0.4.0" LIBCELLML_VERSION = "0.5.0" -VARIABLE_COUNT = 4 +CONSTANT_COUNT = 0 +COMPUTED_CONSTANT_COUNT = 0 +ALGEBRAIC_COUNT = 4 class VariableType(Enum): @@ -34,7 +36,7 @@ def initialise_variables(variables, external_variable): variables[2] = external_variable(variables, 2) -def compute_computed_constants(variables): +def compute_computed_constants(computed_constants): pass diff --git a/tests/resources/generator/cell_geometry_model/model.h b/tests/resources/generator/cell_geometry_model/model.h index aecf1d8125..2eeadc793f 100644 --- a/tests/resources/generator/cell_geometry_model/model.h +++ b/tests/resources/generator/cell_geometry_model/model.h @@ -7,7 +7,9 @@ extern const char VERSION[]; extern const char LIBCELLML_VERSION[]; -extern const size_t VARIABLE_COUNT; +extern const size_t CONSTANT_COUNT; +extern const size_t COMPUTED_CONSTANT_COUNT; +extern const size_t ALGEBRAIC_COUNT; typedef enum { CONSTANT, @@ -28,5 +30,5 @@ double * createVariablesArray(); void deleteArray(double *array); void initialiseVariables(double *variables); -void computeComputedConstants(double *variables); +void computeComputedConstants(double *computedConstants); void computeVariables(double *variables); diff --git a/tests/resources/generator/cell_geometry_model/model.py b/tests/resources/generator/cell_geometry_model/model.py index 09f2093d3e..b6844d13fd 100644 --- a/tests/resources/generator/cell_geometry_model/model.py +++ b/tests/resources/generator/cell_geometry_model/model.py @@ -7,7 +7,9 @@ __version__ = "0.4.0" LIBCELLML_VERSION = "0.5.0" -VARIABLE_COUNT = 4 +CONSTANT_COUNT = 0 +COMPUTED_CONSTANT_COUNT = 0 +ALGEBRAIC_COUNT = 4 class VariableType(Enum): @@ -33,7 +35,7 @@ def initialise_variables(variables): variables[2] = 0.0011 -def compute_computed_constants(variables): +def compute_computed_constants(computed_constants): variables[0] = 1000.0*3.14*variables[2]*variables[2]*variables[1] variables[3] = 0.02*variables[0] diff --git a/tests/resources/generator/cellml_mappings_and_encapsulations/model.c b/tests/resources/generator/cellml_mappings_and_encapsulations/model.c index 2a4a3782e8..70dec9ba69 100644 --- a/tests/resources/generator/cellml_mappings_and_encapsulations/model.c +++ b/tests/resources/generator/cellml_mappings_and_encapsulations/model.c @@ -9,7 +9,9 @@ const char VERSION[] = "0.5.0"; const char LIBCELLML_VERSION[] = "0.5.0"; const size_t STATE_COUNT = 2; -const size_t VARIABLE_COUNT = 2; +const size_t CONSTANT_COUNT = 0; +const size_t COMPUTED_CONSTANT_COUNT = 0; +const size_t ALGEBRAIC_COUNT = 2; const VariableInfo VOI_INFO = {"t", "ms", "environment", VARIABLE_OF_INTEGRATION}; @@ -56,7 +58,7 @@ void initialiseVariables(double *states, double *rates, double *variables) states[1] = 0.0; } -void computeComputedConstants(double *variables) +void computeComputedConstants(double *computedConstants) { } diff --git a/tests/resources/generator/cellml_mappings_and_encapsulations/model.h b/tests/resources/generator/cellml_mappings_and_encapsulations/model.h index acc99f2a48..5127bc9de5 100644 --- a/tests/resources/generator/cellml_mappings_and_encapsulations/model.h +++ b/tests/resources/generator/cellml_mappings_and_encapsulations/model.h @@ -8,7 +8,9 @@ extern const char VERSION[]; extern const char LIBCELLML_VERSION[]; extern const size_t STATE_COUNT; -extern const size_t VARIABLE_COUNT; +extern const size_t CONSTANT_COUNT; +extern const size_t COMPUTED_CONSTANT_COUNT; +extern const size_t ALGEBRAIC_COUNT; typedef enum { VARIABLE_OF_INTEGRATION, @@ -34,6 +36,6 @@ double * createVariablesArray(); void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *variables); -void computeComputedConstants(double *variables); +void computeComputedConstants(double *computedConstants); void computeRates(double voi, double *states, double *rates, double *variables); void computeVariables(double voi, double *states, double *rates, double *variables); diff --git a/tests/resources/generator/cellml_mappings_and_encapsulations/model.py b/tests/resources/generator/cellml_mappings_and_encapsulations/model.py index 414b539eb6..ed00088c54 100644 --- a/tests/resources/generator/cellml_mappings_and_encapsulations/model.py +++ b/tests/resources/generator/cellml_mappings_and_encapsulations/model.py @@ -8,7 +8,9 @@ LIBCELLML_VERSION = "0.5.0" STATE_COUNT = 2 -VARIABLE_COUNT = 2 +CONSTANT_COUNT = 0 +COMPUTED_CONSTANT_COUNT = 0 +ALGEBRAIC_COUNT = 2 class VariableType(Enum): @@ -45,7 +47,7 @@ def initialise_variables(states, rates, variables): states[1] = 0.0 -def compute_computed_constants(variables): +def compute_computed_constants(computed_constants): pass diff --git a/tests/resources/generator/cellml_slc_example/model.py b/tests/resources/generator/cellml_slc_example/model.py index 65742c972a..657ee35e49 100644 --- a/tests/resources/generator/cellml_slc_example/model.py +++ b/tests/resources/generator/cellml_slc_example/model.py @@ -7,7 +7,9 @@ __version__ = "0.4.0" LIBCELLML_VERSION = "0.5.0" -VARIABLE_COUNT = 10 +CONSTANT_COUNT = 0 +COMPUTED_CONSTANT_COUNT = 0 +ALGEBRAIC_COUNT = 10 class VariableType(Enum): @@ -46,7 +48,7 @@ def initialise_variables(variables): variables[9] = 2902500.0 -def compute_computed_constants(variables): +def compute_computed_constants(computed_constants): variables[0] = variables[1]*(variables[2]*variables[3]-variables[4]*variables[5])/(variables[6]*variables[5]+variables[9]*variables[3]+variables[8]*variables[5]*variables[3]+variables[7]) diff --git a/tests/resources/generator/cellml_state_initialised_using_variable/model.c b/tests/resources/generator/cellml_state_initialised_using_variable/model.c index fe4a89bfcf..67bf67f149 100644 --- a/tests/resources/generator/cellml_state_initialised_using_variable/model.c +++ b/tests/resources/generator/cellml_state_initialised_using_variable/model.c @@ -9,7 +9,9 @@ const char VERSION[] = "0.5.0"; const char LIBCELLML_VERSION[] = "0.5.0"; const size_t STATE_COUNT = 1; -const size_t VARIABLE_COUNT = 1; +const size_t CONSTANT_COUNT = 0; +const size_t COMPUTED_CONSTANT_COUNT = 0; +const size_t ALGEBRAIC_COUNT = 1; const VariableInfo VOI_INFO = {"t", "ms", "environment", VARIABLE_OF_INTEGRATION}; @@ -54,7 +56,7 @@ void initialiseVariables(double *states, double *rates, double *variables) states[0] = variables[0]; } -void computeComputedConstants(double *variables) +void computeComputedConstants(double *computedConstants) { } diff --git a/tests/resources/generator/cellml_state_initialised_using_variable/model.h b/tests/resources/generator/cellml_state_initialised_using_variable/model.h index d683c7fb00..353681ed98 100644 --- a/tests/resources/generator/cellml_state_initialised_using_variable/model.h +++ b/tests/resources/generator/cellml_state_initialised_using_variable/model.h @@ -8,7 +8,9 @@ extern const char VERSION[]; extern const char LIBCELLML_VERSION[]; extern const size_t STATE_COUNT; -extern const size_t VARIABLE_COUNT; +extern const size_t CONSTANT_COUNT; +extern const size_t COMPUTED_CONSTANT_COUNT; +extern const size_t ALGEBRAIC_COUNT; typedef enum { VARIABLE_OF_INTEGRATION, @@ -34,6 +36,6 @@ double * createVariablesArray(); void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *variables); -void computeComputedConstants(double *variables); +void computeComputedConstants(double *computedConstants); void computeRates(double voi, double *states, double *rates, double *variables); void computeVariables(double voi, double *states, double *rates, double *variables); diff --git a/tests/resources/generator/cellml_state_initialised_using_variable/model.py b/tests/resources/generator/cellml_state_initialised_using_variable/model.py index 6e0d3a8da2..ee8ef14789 100644 --- a/tests/resources/generator/cellml_state_initialised_using_variable/model.py +++ b/tests/resources/generator/cellml_state_initialised_using_variable/model.py @@ -8,7 +8,9 @@ LIBCELLML_VERSION = "0.5.0" STATE_COUNT = 1 -VARIABLE_COUNT = 1 +CONSTANT_COUNT = 0 +COMPUTED_CONSTANT_COUNT = 0 +ALGEBRAIC_COUNT = 1 class VariableType(Enum): @@ -43,7 +45,7 @@ def initialise_variables(states, rates, variables): states[0] = variables[0] -def compute_computed_constants(variables): +def compute_computed_constants(computed_constants): pass diff --git a/tests/resources/generator/cellml_unit_scaling_constant/model.c b/tests/resources/generator/cellml_unit_scaling_constant/model.c index 6a467f9f63..9131b2ba14 100644 --- a/tests/resources/generator/cellml_unit_scaling_constant/model.c +++ b/tests/resources/generator/cellml_unit_scaling_constant/model.c @@ -8,7 +8,9 @@ const char VERSION[] = "0.5.0"; const char LIBCELLML_VERSION[] = "0.5.0"; -const size_t VARIABLE_COUNT = 3; +const size_t CONSTANT_COUNT = 0; +const size_t COMPUTED_CONSTANT_COUNT = 0; +const size_t ALGEBRAIC_COUNT = 3; const VariableInfo VARIABLE_INFO[] = { {"k", "mM", "constants", CONSTANT}, @@ -37,7 +39,7 @@ void initialiseVariables(double *variables) variables[0] = 123.0; } -void computeComputedConstants(double *variables) +void computeComputedConstants(double *computedConstants) { variables[1] = variables[0]+variables[0]; variables[2] = 0.001*variables[0]+0.001*variables[0]; diff --git a/tests/resources/generator/cellml_unit_scaling_constant/model.h b/tests/resources/generator/cellml_unit_scaling_constant/model.h index d43c10c5ac..7d11520a14 100644 --- a/tests/resources/generator/cellml_unit_scaling_constant/model.h +++ b/tests/resources/generator/cellml_unit_scaling_constant/model.h @@ -7,7 +7,9 @@ extern const char VERSION[]; extern const char LIBCELLML_VERSION[]; -extern const size_t VARIABLE_COUNT; +extern const size_t CONSTANT_COUNT; +extern const size_t COMPUTED_CONSTANT_COUNT; +extern const size_t ALGEBRAIC_COUNT; typedef enum { CONSTANT, @@ -28,5 +30,5 @@ double * createVariablesArray(); void deleteArray(double *array); void initialiseVariables(double *variables); -void computeComputedConstants(double *variables); +void computeComputedConstants(double *computedConstants); void computeVariables(double *variables); diff --git a/tests/resources/generator/cellml_unit_scaling_constant/model.py b/tests/resources/generator/cellml_unit_scaling_constant/model.py index ce3805d201..2380d4c77d 100644 --- a/tests/resources/generator/cellml_unit_scaling_constant/model.py +++ b/tests/resources/generator/cellml_unit_scaling_constant/model.py @@ -7,7 +7,9 @@ __version__ = "0.4.0" LIBCELLML_VERSION = "0.5.0" -VARIABLE_COUNT = 3 +CONSTANT_COUNT = 0 +COMPUTED_CONSTANT_COUNT = 0 +ALGEBRAIC_COUNT = 3 class VariableType(Enum): @@ -31,7 +33,7 @@ def initialise_variables(variables): variables[0] = 123.0 -def compute_computed_constants(variables): +def compute_computed_constants(computed_constants): variables[1] = variables[0]+variables[0] variables[2] = 0.001*variables[0]+0.001*variables[0] diff --git a/tests/resources/generator/cellml_unit_scaling_rate/model.c b/tests/resources/generator/cellml_unit_scaling_rate/model.c index 7ad69ffe8d..48c0c0e0c1 100644 --- a/tests/resources/generator/cellml_unit_scaling_rate/model.c +++ b/tests/resources/generator/cellml_unit_scaling_rate/model.c @@ -9,7 +9,9 @@ const char VERSION[] = "0.5.0"; const char LIBCELLML_VERSION[] = "0.5.0"; const size_t STATE_COUNT = 1; -const size_t VARIABLE_COUNT = 2; +const size_t CONSTANT_COUNT = 0; +const size_t COMPUTED_CONSTANT_COUNT = 0; +const size_t ALGEBRAIC_COUNT = 2; const VariableInfo VOI_INFO = {"t", "ms", "environment", VARIABLE_OF_INTEGRATION}; @@ -54,7 +56,7 @@ void initialiseVariables(double *states, double *rates, double *variables) states[0] = 123.0; } -void computeComputedConstants(double *variables) +void computeComputedConstants(double *computedConstants) { } diff --git a/tests/resources/generator/cellml_unit_scaling_rate/model.h b/tests/resources/generator/cellml_unit_scaling_rate/model.h index d683c7fb00..353681ed98 100644 --- a/tests/resources/generator/cellml_unit_scaling_rate/model.h +++ b/tests/resources/generator/cellml_unit_scaling_rate/model.h @@ -8,7 +8,9 @@ extern const char VERSION[]; extern const char LIBCELLML_VERSION[]; extern const size_t STATE_COUNT; -extern const size_t VARIABLE_COUNT; +extern const size_t CONSTANT_COUNT; +extern const size_t COMPUTED_CONSTANT_COUNT; +extern const size_t ALGEBRAIC_COUNT; typedef enum { VARIABLE_OF_INTEGRATION, @@ -34,6 +36,6 @@ double * createVariablesArray(); void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *variables); -void computeComputedConstants(double *variables); +void computeComputedConstants(double *computedConstants); void computeRates(double voi, double *states, double *rates, double *variables); void computeVariables(double voi, double *states, double *rates, double *variables); diff --git a/tests/resources/generator/cellml_unit_scaling_rate/model.py b/tests/resources/generator/cellml_unit_scaling_rate/model.py index 74bcb203fd..99005d82b7 100644 --- a/tests/resources/generator/cellml_unit_scaling_rate/model.py +++ b/tests/resources/generator/cellml_unit_scaling_rate/model.py @@ -8,7 +8,9 @@ LIBCELLML_VERSION = "0.5.0" STATE_COUNT = 1 -VARIABLE_COUNT = 2 +CONSTANT_COUNT = 0 +COMPUTED_CONSTANT_COUNT = 0 +ALGEBRAIC_COUNT = 2 class VariableType(Enum): @@ -43,7 +45,7 @@ def initialise_variables(states, rates, variables): states[0] = 123.0 -def compute_computed_constants(variables): +def compute_computed_constants(computed_constants): pass diff --git a/tests/resources/generator/cellml_unit_scaling_state/model.c b/tests/resources/generator/cellml_unit_scaling_state/model.c index 2c207a86e7..1e434a6242 100644 --- a/tests/resources/generator/cellml_unit_scaling_state/model.c +++ b/tests/resources/generator/cellml_unit_scaling_state/model.c @@ -9,7 +9,9 @@ const char VERSION[] = "0.5.0"; const char LIBCELLML_VERSION[] = "0.5.0"; const size_t STATE_COUNT = 1; -const size_t VARIABLE_COUNT = 2; +const size_t CONSTANT_COUNT = 0; +const size_t COMPUTED_CONSTANT_COUNT = 0; +const size_t ALGEBRAIC_COUNT = 2; const VariableInfo VOI_INFO = {"t", "ms", "environment", VARIABLE_OF_INTEGRATION}; @@ -54,7 +56,7 @@ void initialiseVariables(double *states, double *rates, double *variables) states[0] = 123.0; } -void computeComputedConstants(double *variables) +void computeComputedConstants(double *computedConstants) { } diff --git a/tests/resources/generator/cellml_unit_scaling_state/model.h b/tests/resources/generator/cellml_unit_scaling_state/model.h index d683c7fb00..353681ed98 100644 --- a/tests/resources/generator/cellml_unit_scaling_state/model.h +++ b/tests/resources/generator/cellml_unit_scaling_state/model.h @@ -8,7 +8,9 @@ extern const char VERSION[]; extern const char LIBCELLML_VERSION[]; extern const size_t STATE_COUNT; -extern const size_t VARIABLE_COUNT; +extern const size_t CONSTANT_COUNT; +extern const size_t COMPUTED_CONSTANT_COUNT; +extern const size_t ALGEBRAIC_COUNT; typedef enum { VARIABLE_OF_INTEGRATION, @@ -34,6 +36,6 @@ double * createVariablesArray(); void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *variables); -void computeComputedConstants(double *variables); +void computeComputedConstants(double *computedConstants); void computeRates(double voi, double *states, double *rates, double *variables); void computeVariables(double voi, double *states, double *rates, double *variables); diff --git a/tests/resources/generator/cellml_unit_scaling_state/model.py b/tests/resources/generator/cellml_unit_scaling_state/model.py index bcf2cc6cc0..67c70992ca 100644 --- a/tests/resources/generator/cellml_unit_scaling_state/model.py +++ b/tests/resources/generator/cellml_unit_scaling_state/model.py @@ -8,7 +8,9 @@ LIBCELLML_VERSION = "0.5.0" STATE_COUNT = 1 -VARIABLE_COUNT = 2 +CONSTANT_COUNT = 0 +COMPUTED_CONSTANT_COUNT = 0 +ALGEBRAIC_COUNT = 2 class VariableType(Enum): @@ -43,7 +45,7 @@ def initialise_variables(states, rates, variables): states[0] = 123.0 -def compute_computed_constants(variables): +def compute_computed_constants(computed_constants): pass diff --git a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.c b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.c index 034ff677ce..d84efc4cd0 100644 --- a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.c +++ b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.c @@ -9,7 +9,9 @@ const char VERSION[] = "0.5.0"; const char LIBCELLML_VERSION[] = "0.5.0"; const size_t STATE_COUNT = 2; -const size_t VARIABLE_COUNT = 0; +const size_t CONSTANT_COUNT = 0; +const size_t COMPUTED_CONSTANT_COUNT = 0; +const size_t ALGEBRAIC_COUNT = 0; const VariableInfo VOI_INFO = {"t", "ms", "environment", VARIABLE_OF_INTEGRATION}; @@ -54,7 +56,7 @@ void initialiseVariables(double *states, double *rates, double *variables) states[1] = 0.001*789.0; } -void computeComputedConstants(double *variables) +void computeComputedConstants(double *computedConstants) { } diff --git a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.h b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.h index 3137b91f18..aa242b8afe 100644 --- a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.h +++ b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.h @@ -8,7 +8,9 @@ extern const char VERSION[]; extern const char LIBCELLML_VERSION[]; extern const size_t STATE_COUNT; -extern const size_t VARIABLE_COUNT; +extern const size_t CONSTANT_COUNT; +extern const size_t COMPUTED_CONSTANT_COUNT; +extern const size_t ALGEBRAIC_COUNT; typedef enum { VARIABLE_OF_INTEGRATION, @@ -34,6 +36,6 @@ double * createVariablesArray(); void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *variables); -void computeComputedConstants(double *variables); +void computeComputedConstants(double *computedConstants); void computeRates(double voi, double *states, double *rates, double *variables); void computeVariables(double voi, double *states, double *rates, double *variables); diff --git a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.py b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.py index f07685af61..b60faccff7 100644 --- a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.py +++ b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.py @@ -8,7 +8,9 @@ LIBCELLML_VERSION = "0.5.0" STATE_COUNT = 2 -VARIABLE_COUNT = 0 +CONSTANT_COUNT = 0 +COMPUTED_CONSTANT_COUNT = 0 +ALGEBRAIC_COUNT = 0 class VariableType(Enum): @@ -43,7 +45,7 @@ def initialise_variables(states, rates, variables): states[1] = 0.001*789.0 -def compute_computed_constants(variables): +def compute_computed_constants(computed_constants): pass diff --git a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.c b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.c index ed97d14b47..fdd80b0950 100644 --- a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.c +++ b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.c @@ -9,7 +9,9 @@ const char VERSION[] = "0.5.0"; const char LIBCELLML_VERSION[] = "0.5.0"; const size_t STATE_COUNT = 2; -const size_t VARIABLE_COUNT = 2; +const size_t CONSTANT_COUNT = 0; +const size_t COMPUTED_CONSTANT_COUNT = 0; +const size_t ALGEBRAIC_COUNT = 2; const VariableInfo VOI_INFO = {"t", "ms", "environment", VARIABLE_OF_INTEGRATION}; @@ -58,7 +60,7 @@ void initialiseVariables(double *states, double *rates, double *variables) states[1] = 0.001*variables[1]; } -void computeComputedConstants(double *variables) +void computeComputedConstants(double *computedConstants) { } diff --git a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.h b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.h index 05eed874d3..28a98085da 100644 --- a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.h +++ b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.h @@ -8,7 +8,9 @@ extern const char VERSION[]; extern const char LIBCELLML_VERSION[]; extern const size_t STATE_COUNT; -extern const size_t VARIABLE_COUNT; +extern const size_t CONSTANT_COUNT; +extern const size_t COMPUTED_CONSTANT_COUNT; +extern const size_t ALGEBRAIC_COUNT; typedef enum { VARIABLE_OF_INTEGRATION, @@ -34,6 +36,6 @@ double * createVariablesArray(); void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *variables); -void computeComputedConstants(double *variables); +void computeComputedConstants(double *computedConstants); void computeRates(double voi, double *states, double *rates, double *variables); void computeVariables(double voi, double *states, double *rates, double *variables); diff --git a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.py b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.py index bc6233809d..f04a5b9365 100644 --- a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.py +++ b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.py @@ -8,7 +8,9 @@ LIBCELLML_VERSION = "0.5.0" STATE_COUNT = 2 -VARIABLE_COUNT = 2 +CONSTANT_COUNT = 0 +COMPUTED_CONSTANT_COUNT = 0 +ALGEBRAIC_COUNT = 2 class VariableType(Enum): @@ -47,7 +49,7 @@ def initialise_variables(states, rates, variables): states[1] = 0.001*variables[1] -def compute_computed_constants(variables): +def compute_computed_constants(computed_constants): pass diff --git a/tests/resources/generator/cellml_unit_scaling_voi_direct/model.c b/tests/resources/generator/cellml_unit_scaling_voi_direct/model.c index 60ab45f369..1f652c7881 100644 --- a/tests/resources/generator/cellml_unit_scaling_voi_direct/model.c +++ b/tests/resources/generator/cellml_unit_scaling_voi_direct/model.c @@ -9,7 +9,9 @@ const char VERSION[] = "0.5.0"; const char LIBCELLML_VERSION[] = "0.5.0"; const size_t STATE_COUNT = 2; -const size_t VARIABLE_COUNT = 0; +const size_t CONSTANT_COUNT = 0; +const size_t COMPUTED_CONSTANT_COUNT = 0; +const size_t ALGEBRAIC_COUNT = 0; const VariableInfo VOI_INFO = {"t", "ms", "environment", VARIABLE_OF_INTEGRATION}; @@ -54,7 +56,7 @@ void initialiseVariables(double *states, double *rates, double *variables) states[1] = 5.0; } -void computeComputedConstants(double *variables) +void computeComputedConstants(double *computedConstants) { } diff --git a/tests/resources/generator/cellml_unit_scaling_voi_direct/model.h b/tests/resources/generator/cellml_unit_scaling_voi_direct/model.h index caeb40bab6..614cdc5ec6 100644 --- a/tests/resources/generator/cellml_unit_scaling_voi_direct/model.h +++ b/tests/resources/generator/cellml_unit_scaling_voi_direct/model.h @@ -8,7 +8,9 @@ extern const char VERSION[]; extern const char LIBCELLML_VERSION[]; extern const size_t STATE_COUNT; -extern const size_t VARIABLE_COUNT; +extern const size_t CONSTANT_COUNT; +extern const size_t COMPUTED_CONSTANT_COUNT; +extern const size_t ALGEBRAIC_COUNT; typedef enum { VARIABLE_OF_INTEGRATION, @@ -34,6 +36,6 @@ double * createVariablesArray(); void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *variables); -void computeComputedConstants(double *variables); +void computeComputedConstants(double *computedConstants); void computeRates(double voi, double *states, double *rates, double *variables); void computeVariables(double voi, double *states, double *rates, double *variables); diff --git a/tests/resources/generator/cellml_unit_scaling_voi_direct/model.py b/tests/resources/generator/cellml_unit_scaling_voi_direct/model.py index 25a75e71f3..6dfca0a422 100644 --- a/tests/resources/generator/cellml_unit_scaling_voi_direct/model.py +++ b/tests/resources/generator/cellml_unit_scaling_voi_direct/model.py @@ -8,7 +8,9 @@ LIBCELLML_VERSION = "0.5.0" STATE_COUNT = 2 -VARIABLE_COUNT = 0 +CONSTANT_COUNT = 0 +COMPUTED_CONSTANT_COUNT = 0 +ALGEBRAIC_COUNT = 0 class VariableType(Enum): @@ -43,7 +45,7 @@ def initialise_variables(states, rates, variables): states[1] = 5.0 -def compute_computed_constants(variables): +def compute_computed_constants(computed_constants): pass diff --git a/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.c b/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.c index bdaea3fb38..54994da7db 100644 --- a/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.c +++ b/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.c @@ -9,7 +9,9 @@ const char VERSION[] = "0.5.0"; const char LIBCELLML_VERSION[] = "0.5.0"; const size_t STATE_COUNT = 3; -const size_t VARIABLE_COUNT = 0; +const size_t CONSTANT_COUNT = 0; +const size_t COMPUTED_CONSTANT_COUNT = 0; +const size_t ALGEBRAIC_COUNT = 0; const VariableInfo VOI_INFO = {"t", "second", "environment", VARIABLE_OF_INTEGRATION}; @@ -56,7 +58,7 @@ void initialiseVariables(double *states, double *rates, double *variables) states[2] = 11.0; } -void computeComputedConstants(double *variables) +void computeComputedConstants(double *computedConstants) { } diff --git a/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.h b/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.h index 63103f19b5..0ae9861118 100644 --- a/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.h +++ b/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.h @@ -8,7 +8,9 @@ extern const char VERSION[]; extern const char LIBCELLML_VERSION[]; extern const size_t STATE_COUNT; -extern const size_t VARIABLE_COUNT; +extern const size_t CONSTANT_COUNT; +extern const size_t COMPUTED_CONSTANT_COUNT; +extern const size_t ALGEBRAIC_COUNT; typedef enum { VARIABLE_OF_INTEGRATION, @@ -34,6 +36,6 @@ double * createVariablesArray(); void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *variables); -void computeComputedConstants(double *variables); +void computeComputedConstants(double *computedConstants); void computeRates(double voi, double *states, double *rates, double *variables); void computeVariables(double voi, double *states, double *rates, double *variables); diff --git a/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.py b/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.py index bd6d5e2beb..4bc1c304cc 100644 --- a/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.py +++ b/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.py @@ -8,7 +8,9 @@ LIBCELLML_VERSION = "0.5.0" STATE_COUNT = 3 -VARIABLE_COUNT = 0 +CONSTANT_COUNT = 0 +COMPUTED_CONSTANT_COUNT = 0 +ALGEBRAIC_COUNT = 0 class VariableType(Enum): @@ -45,7 +47,7 @@ def initialise_variables(states, rates, variables): states[2] = 11.0 -def compute_computed_constants(variables): +def compute_computed_constants(computed_constants): pass diff --git a/tests/resources/generator/dae_cellml_1_1_model/model.c b/tests/resources/generator/dae_cellml_1_1_model/model.c index 8d6be4763d..3a1022aa72 100644 --- a/tests/resources/generator/dae_cellml_1_1_model/model.c +++ b/tests/resources/generator/dae_cellml_1_1_model/model.c @@ -9,7 +9,9 @@ const char VERSION[] = "0.5.0"; const char LIBCELLML_VERSION[] = "0.5.0"; const size_t STATE_COUNT = 2; -const size_t VARIABLE_COUNT = 10; +const size_t CONSTANT_COUNT = 0; +const size_t COMPUTED_CONSTANT_COUNT = 0; +const size_t ALGEBRAIC_COUNT = 10; const VariableInfo VOI_INFO = {"t", "second", "main", VARIABLE_OF_INTEGRATION}; @@ -129,7 +131,7 @@ void initialiseVariables(double *states, double *rates, double *variables) states[1] = 0.0; } -void computeComputedConstants(double *variables) +void computeComputedConstants(double *computedConstants) { } diff --git a/tests/resources/generator/dae_cellml_1_1_model/model.h b/tests/resources/generator/dae_cellml_1_1_model/model.h index 0a6670a370..4b380a3b49 100644 --- a/tests/resources/generator/dae_cellml_1_1_model/model.h +++ b/tests/resources/generator/dae_cellml_1_1_model/model.h @@ -8,7 +8,9 @@ extern const char VERSION[]; extern const char LIBCELLML_VERSION[]; extern const size_t STATE_COUNT; -extern const size_t VARIABLE_COUNT; +extern const size_t CONSTANT_COUNT; +extern const size_t COMPUTED_CONSTANT_COUNT; +extern const size_t ALGEBRAIC_COUNT; typedef enum { VARIABLE_OF_INTEGRATION, @@ -34,6 +36,6 @@ double * createVariablesArray(); void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *variables); -void computeComputedConstants(double *variables); +void computeComputedConstants(double *computedConstants); void computeRates(double voi, double *states, double *rates, double *variables); void computeVariables(double voi, double *states, double *rates, double *variables); diff --git a/tests/resources/generator/dae_cellml_1_1_model/model.py b/tests/resources/generator/dae_cellml_1_1_model/model.py index 3dc413e02e..fd86ef428a 100644 --- a/tests/resources/generator/dae_cellml_1_1_model/model.py +++ b/tests/resources/generator/dae_cellml_1_1_model/model.py @@ -8,7 +8,9 @@ LIBCELLML_VERSION = "0.5.0" STATE_COUNT = 2 -VARIABLE_COUNT = 10 +CONSTANT_COUNT = 0 +COMPUTED_CONSTANT_COUNT = 0 +ALGEBRAIC_COUNT = 10 class VariableType(Enum): @@ -105,7 +107,7 @@ def initialise_variables(states, rates, variables): states[1] = 0.0 -def compute_computed_constants(variables): +def compute_computed_constants(computed_constants): pass diff --git a/tests/resources/generator/dependent_eqns/model.c b/tests/resources/generator/dependent_eqns/model.c index f8c2b7877b..6aa94c3bf3 100644 --- a/tests/resources/generator/dependent_eqns/model.c +++ b/tests/resources/generator/dependent_eqns/model.c @@ -9,7 +9,9 @@ const char VERSION[] = "0.5.0"; const char LIBCELLML_VERSION[] = "0.5.0"; const size_t STATE_COUNT = 1; -const size_t VARIABLE_COUNT = 2; +const size_t CONSTANT_COUNT = 0; +const size_t COMPUTED_CONSTANT_COUNT = 0; +const size_t ALGEBRAIC_COUNT = 2; const VariableInfo VOI_INFO = {"time", "second", "my_component", VARIABLE_OF_INTEGRATION}; @@ -54,7 +56,7 @@ void initialiseVariables(double *states, double *rates, double *variables) states[0] = 0.0; } -void computeComputedConstants(double *variables) +void computeComputedConstants(double *computedConstants) { } diff --git a/tests/resources/generator/dependent_eqns/model.h b/tests/resources/generator/dependent_eqns/model.h index 762e2e4573..8387ea6e26 100644 --- a/tests/resources/generator/dependent_eqns/model.h +++ b/tests/resources/generator/dependent_eqns/model.h @@ -8,7 +8,9 @@ extern const char VERSION[]; extern const char LIBCELLML_VERSION[]; extern const size_t STATE_COUNT; -extern const size_t VARIABLE_COUNT; +extern const size_t CONSTANT_COUNT; +extern const size_t COMPUTED_CONSTANT_COUNT; +extern const size_t ALGEBRAIC_COUNT; typedef enum { VARIABLE_OF_INTEGRATION, @@ -34,6 +36,6 @@ double * createVariablesArray(); void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *variables); -void computeComputedConstants(double *variables); +void computeComputedConstants(double *computedConstants); void computeRates(double voi, double *states, double *rates, double *variables); void computeVariables(double voi, double *states, double *rates, double *variables); diff --git a/tests/resources/generator/dependent_eqns/model.py b/tests/resources/generator/dependent_eqns/model.py index 21f76ea6bd..cee82a74be 100644 --- a/tests/resources/generator/dependent_eqns/model.py +++ b/tests/resources/generator/dependent_eqns/model.py @@ -8,7 +8,9 @@ LIBCELLML_VERSION = "0.5.0" STATE_COUNT = 1 -VARIABLE_COUNT = 2 +CONSTANT_COUNT = 0 +COMPUTED_CONSTANT_COUNT = 0 +ALGEBRAIC_COUNT = 2 class VariableType(Enum): @@ -43,7 +45,7 @@ def initialise_variables(states, rates, variables): states[0] = 0.0 -def compute_computed_constants(variables): +def compute_computed_constants(computed_constants): pass diff --git a/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.c b/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.c index 00801300ea..29744dac79 100644 --- a/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.c +++ b/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.c @@ -9,7 +9,9 @@ const char VERSION[] = "0.5.0"; const char LIBCELLML_VERSION[] = "0.5.0"; const size_t STATE_COUNT = 33; -const size_t VARIABLE_COUNT = 217; +const size_t CONSTANT_COUNT = 0; +const size_t COMPUTED_CONSTANT_COUNT = 0; +const size_t ALGEBRAIC_COUNT = 217; const VariableInfo VOI_INFO = {"time", "second", "environment", VARIABLE_OF_INTEGRATION}; @@ -424,7 +426,7 @@ void initialiseVariables(double *states, double *rates, double *variables) states[32] = 0.00277; } -void computeComputedConstants(double *variables) +void computeComputedConstants(double *computedConstants) { variables[3] = variables[119]*variables[120]/variables[17]; variables[6] = variables[3]*log(variables[7]/variables[8]); diff --git a/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.h b/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.h index b76a0a63a7..91f60ad4ec 100644 --- a/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.h +++ b/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.h @@ -8,7 +8,9 @@ extern const char VERSION[]; extern const char LIBCELLML_VERSION[]; extern const size_t STATE_COUNT; -extern const size_t VARIABLE_COUNT; +extern const size_t CONSTANT_COUNT; +extern const size_t COMPUTED_CONSTANT_COUNT; +extern const size_t ALGEBRAIC_COUNT; typedef enum { VARIABLE_OF_INTEGRATION, @@ -34,6 +36,6 @@ double * createVariablesArray(); void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *variables); -void computeComputedConstants(double *variables); +void computeComputedConstants(double *computedConstants); void computeRates(double voi, double *states, double *rates, double *variables); void computeVariables(double voi, double *states, double *rates, double *variables); diff --git a/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.py b/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.py index 5c73b4ca5c..d21a0dd175 100644 --- a/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.py +++ b/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.py @@ -8,7 +8,9 @@ LIBCELLML_VERSION = "0.5.0" STATE_COUNT = 33 -VARIABLE_COUNT = 217 +CONSTANT_COUNT = 0 +COMPUTED_CONSTANT_COUNT = 0 +ALGEBRAIC_COUNT = 217 class VariableType(Enum): @@ -433,7 +435,7 @@ def initialise_variables(states, rates, variables): states[32] = 0.00277 -def compute_computed_constants(variables): +def compute_computed_constants(computed_constants): variables[3] = variables[119]*variables[120]/variables[17] variables[6] = variables[3]*log(variables[7]/variables[8]) variables[20] = 1.2 if gt_func(variables[1], 0.0) else 1.0 diff --git a/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.c b/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.c index 55b5e82071..c473d0e8cd 100644 --- a/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.c +++ b/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.c @@ -9,7 +9,9 @@ const char VERSION[] = "0.5.0"; const char LIBCELLML_VERSION[] = "0.5.0"; const size_t STATE_COUNT = 15; -const size_t VARIABLE_COUNT = 185; +const size_t CONSTANT_COUNT = 0; +const size_t COMPUTED_CONSTANT_COUNT = 0; +const size_t ALGEBRAIC_COUNT = 185; const VariableInfo VOI_INFO = {"time", "second", "environment", VARIABLE_OF_INTEGRATION}; @@ -375,7 +377,7 @@ void initialiseVariables(double *states, double *rates, double *variables) states[14] = 0.03889291759; } -void computeComputedConstants(double *variables) +void computeComputedConstants(double *computedConstants) { variables[0] = (variables[2] == 0.0)?1.07*(3.0*variables[1]-0.1)/(3.0*(1.0+0.7745*exp(-(3.0*variables[1]-2.05)/0.295))):(variables[2] == 1.0)?variables[3]*variables[1]/(1.0+0.7745*exp(-(3.0*variables[1]-2.05)/0.295)):1.07*29.0*variables[1]/(30.0*(1.0+0.7745*exp(-(29.0*variables[1]-24.5)/1.95))); variables[4] = variables[5]+variables[0]*(variables[6]-variables[5]); diff --git a/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.h b/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.h index c5d5585fa5..9c13c3f347 100644 --- a/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.h +++ b/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.h @@ -8,7 +8,9 @@ extern const char VERSION[]; extern const char LIBCELLML_VERSION[]; extern const size_t STATE_COUNT; -extern const size_t VARIABLE_COUNT; +extern const size_t CONSTANT_COUNT; +extern const size_t COMPUTED_CONSTANT_COUNT; +extern const size_t ALGEBRAIC_COUNT; typedef enum { VARIABLE_OF_INTEGRATION, @@ -34,6 +36,6 @@ double * createVariablesArray(); void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *variables); -void computeComputedConstants(double *variables); +void computeComputedConstants(double *computedConstants); void computeRates(double voi, double *states, double *rates, double *variables); void computeVariables(double voi, double *states, double *rates, double *variables); diff --git a/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.py b/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.py index ae48f667d4..c2cb441551 100644 --- a/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.py +++ b/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.py @@ -8,7 +8,9 @@ LIBCELLML_VERSION = "0.5.0" STATE_COUNT = 15 -VARIABLE_COUNT = 185 +CONSTANT_COUNT = 0 +COMPUTED_CONSTANT_COUNT = 0 +ALGEBRAIC_COUNT = 185 class VariableType(Enum): @@ -372,7 +374,7 @@ def initialise_variables(states, rates, variables): states[14] = 0.03889291759 -def compute_computed_constants(variables): +def compute_computed_constants(computed_constants): variables[0] = 1.07*(3.0*variables[1]-0.1)/(3.0*(1.0+0.7745*exp(-(3.0*variables[1]-2.05)/0.295))) if eq_func(variables[2], 0.0) else variables[3]*variables[1]/(1.0+0.7745*exp(-(3.0*variables[1]-2.05)/0.295)) if eq_func(variables[2], 1.0) else 1.07*29.0*variables[1]/(30.0*(1.0+0.7745*exp(-(29.0*variables[1]-24.5)/1.95))) variables[4] = variables[5]+variables[0]*(variables[6]-variables[5]) variables[25] = variables[26]+variables[0]*(variables[27]-variables[26]) if eq_func(variables[2], 0.0) else variables[30]+variables[0]*(variables[31]-variables[30]) if eq_func(variables[2], 1.0) else variables[28]+variables[0]*(variables[29]-variables[28]) diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.c index e3b3365460..b148c0bbd1 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.c @@ -9,7 +9,9 @@ const char VERSION[] = "0.5.0"; const char LIBCELLML_VERSION[] = "0.5.0"; const size_t STATE_COUNT = 4; -const size_t VARIABLE_COUNT = 18; +const size_t CONSTANT_COUNT = 0; +const size_t COMPUTED_CONSTANT_COUNT = 0; +const size_t ALGEBRAIC_COUNT = 18; const VariableInfo VOI_INFO = {"time", "millisecond", "environment", VARIABLE_OF_INTEGRATION}; @@ -82,7 +84,7 @@ void initialiseVariables(double voi, double *states, double *rates, double *vari variables[0] = externalVariable(voi, states, rates, variables, 0); } -void computeComputedConstants(double *variables) +void computeComputedConstants(double *computedConstants) { variables[6] = variables[5]-10.613; variables[8] = variables[5]-115.0; diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.h index 90f2f2d76b..e1fb1b494c 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.h +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.h @@ -8,7 +8,9 @@ extern const char VERSION[]; extern const char LIBCELLML_VERSION[]; extern const size_t STATE_COUNT; -extern const size_t VARIABLE_COUNT; +extern const size_t CONSTANT_COUNT; +extern const size_t COMPUTED_CONSTANT_COUNT; +extern const size_t ALGEBRAIC_COUNT; typedef enum { VARIABLE_OF_INTEGRATION, @@ -37,6 +39,6 @@ void deleteArray(double *array); typedef double (* ExternalVariable)(double voi, double *states, double *rates, double *variables, size_t index); void initialiseVariables(double voi, double *states, double *rates, double *variables, ExternalVariable externalVariable); -void computeComputedConstants(double *variables); +void computeComputedConstants(double *computedConstants); void computeRates(double voi, double *states, double *rates, double *variables, ExternalVariable externalVariable); void computeVariables(double voi, double *states, double *rates, double *variables, ExternalVariable externalVariable); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.py index 48c80dcdfe..72dbf27cf3 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.py @@ -8,7 +8,9 @@ LIBCELLML_VERSION = "0.5.0" STATE_COUNT = 4 -VARIABLE_COUNT = 18 +CONSTANT_COUNT = 0 +COMPUTED_CONSTANT_COUNT = 0 +ALGEBRAIC_COUNT = 18 class VariableType(Enum): @@ -84,7 +86,7 @@ def initialise_variables(voi, states, rates, variables, external_variable): variables[0] = external_variable(voi, states, rates, variables, 0) -def compute_computed_constants(variables): +def compute_computed_constants(computed_constants): variables[6] = variables[5]-10.613 variables[8] = variables[5]-115.0 variables[14] = variables[5]+12.0 diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.c index 18cd266056..a30ed76d2b 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.c @@ -9,7 +9,9 @@ const char VERSION[] = "0.5.0"; const char LIBCELLML_VERSION[] = "0.5.0"; const size_t STATE_COUNT = 4; -const size_t VARIABLE_COUNT = 18; +const size_t CONSTANT_COUNT = 0; +const size_t COMPUTED_CONSTANT_COUNT = 0; +const size_t ALGEBRAIC_COUNT = 18; const VariableInfo VOI_INFO = {"time", "millisecond", "environment", VARIABLE_OF_INTEGRATION}; @@ -81,7 +83,7 @@ void initialiseVariables(double *states, double *rates, double *variables) states[3] = 0.325; } -void computeComputedConstants(double *variables) +void computeComputedConstants(double *computedConstants) { variables[6] = variables[5]-10.613; variables[8] = variables[5]-115.0; diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.c index 65d01ca6f2..8ef6fb89f4 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.c @@ -9,7 +9,9 @@ const char VERSION[] = "0.5.0"; const char LIBCELLML_VERSION[] = "0.5.0"; const size_t STATE_COUNT = 4; -const size_t VARIABLE_COUNT = 18; +const size_t CONSTANT_COUNT = 0; +const size_t COMPUTED_CONSTANT_COUNT = 0; +const size_t ALGEBRAIC_COUNT = 18; const VariableInfo VOI_INFO = {"time", "millisecond", "environment", VARIABLE_OF_INTEGRATION}; @@ -82,7 +84,7 @@ void initialiseVariables(double voi, double *states, double *rates, double *vari variables[6] = externalVariable(voi, states, rates, variables, 6); } -void computeComputedConstants(double *variables) +void computeComputedConstants(double *computedConstants) { variables[8] = variables[5]-115.0; variables[14] = variables[5]+12.0; diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.h index 90f2f2d76b..e1fb1b494c 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.h +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.h @@ -8,7 +8,9 @@ extern const char VERSION[]; extern const char LIBCELLML_VERSION[]; extern const size_t STATE_COUNT; -extern const size_t VARIABLE_COUNT; +extern const size_t CONSTANT_COUNT; +extern const size_t COMPUTED_CONSTANT_COUNT; +extern const size_t ALGEBRAIC_COUNT; typedef enum { VARIABLE_OF_INTEGRATION, @@ -37,6 +39,6 @@ void deleteArray(double *array); typedef double (* ExternalVariable)(double voi, double *states, double *rates, double *variables, size_t index); void initialiseVariables(double voi, double *states, double *rates, double *variables, ExternalVariable externalVariable); -void computeComputedConstants(double *variables); +void computeComputedConstants(double *computedConstants); void computeRates(double voi, double *states, double *rates, double *variables, ExternalVariable externalVariable); void computeVariables(double voi, double *states, double *rates, double *variables, ExternalVariable externalVariable); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.py index 638c26a9d5..4e2c615a68 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.py @@ -8,7 +8,9 @@ LIBCELLML_VERSION = "0.5.0" STATE_COUNT = 4 -VARIABLE_COUNT = 18 +CONSTANT_COUNT = 0 +COMPUTED_CONSTANT_COUNT = 0 +ALGEBRAIC_COUNT = 18 class VariableType(Enum): @@ -84,7 +86,7 @@ def initialise_variables(voi, states, rates, variables, external_variable): variables[6] = external_variable(voi, states, rates, variables, 6) -def compute_computed_constants(variables): +def compute_computed_constants(computed_constants): variables[8] = variables[5]-115.0 variables[14] = variables[5]+12.0 diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.c index 10cd748721..f28ef90f48 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.c @@ -9,7 +9,9 @@ const char VERSION[] = "0.5.0"; const char LIBCELLML_VERSION[] = "0.5.0"; const size_t STATE_COUNT = 4; -const size_t VARIABLE_COUNT = 18; +const size_t CONSTANT_COUNT = 0; +const size_t COMPUTED_CONSTANT_COUNT = 0; +const size_t ALGEBRAIC_COUNT = 18; const VariableInfo VOI_INFO = {"time", "millisecond", "environment", VARIABLE_OF_INTEGRATION}; @@ -81,7 +83,7 @@ void initialiseVariables(double voi, double *states, double *rates, double *vari variables[4] = externalVariable(voi, states, rates, variables, 4); } -void computeComputedConstants(double *variables) +void computeComputedConstants(double *computedConstants) { variables[6] = variables[5]-10.613; variables[8] = variables[5]-115.0; diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.h index 90f2f2d76b..e1fb1b494c 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.h +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.h @@ -8,7 +8,9 @@ extern const char VERSION[]; extern const char LIBCELLML_VERSION[]; extern const size_t STATE_COUNT; -extern const size_t VARIABLE_COUNT; +extern const size_t CONSTANT_COUNT; +extern const size_t COMPUTED_CONSTANT_COUNT; +extern const size_t ALGEBRAIC_COUNT; typedef enum { VARIABLE_OF_INTEGRATION, @@ -37,6 +39,6 @@ void deleteArray(double *array); typedef double (* ExternalVariable)(double voi, double *states, double *rates, double *variables, size_t index); void initialiseVariables(double voi, double *states, double *rates, double *variables, ExternalVariable externalVariable); -void computeComputedConstants(double *variables); +void computeComputedConstants(double *computedConstants); void computeRates(double voi, double *states, double *rates, double *variables, ExternalVariable externalVariable); void computeVariables(double voi, double *states, double *rates, double *variables, ExternalVariable externalVariable); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.py index 0a44cad717..efb48bb7ba 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.py @@ -8,7 +8,9 @@ LIBCELLML_VERSION = "0.5.0" STATE_COUNT = 4 -VARIABLE_COUNT = 18 +CONSTANT_COUNT = 0 +COMPUTED_CONSTANT_COUNT = 0 +ALGEBRAIC_COUNT = 18 class VariableType(Enum): @@ -83,7 +85,7 @@ def initialise_variables(voi, states, rates, variables, external_variable): variables[4] = external_variable(voi, states, rates, variables, 4) -def compute_computed_constants(variables): +def compute_computed_constants(computed_constants): variables[6] = variables[5]-10.613 variables[8] = variables[5]-115.0 variables[14] = variables[5]+12.0 diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.c index 6ddde8da1f..f84acb2cd3 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.c @@ -9,7 +9,9 @@ const char VERSION[] = "0.5.0"; const char LIBCELLML_VERSION[] = "0.5.0"; const size_t STATE_COUNT = 4; -const size_t VARIABLE_COUNT = 18; +const size_t CONSTANT_COUNT = 0; +const size_t COMPUTED_CONSTANT_COUNT = 0; +const size_t ALGEBRAIC_COUNT = 18; const VariableInfo VOI_INFO = {"time", "millisecond", "environment", VARIABLE_OF_INTEGRATION}; @@ -516,7 +518,7 @@ void initialiseVariables(double *states, double *rates, double *variables) rates[3] = 0.0; } -void computeComputedConstants(double *variables) +void computeComputedConstants(double *computedConstants) { } diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.h index a6105918ae..18f278fee6 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.h +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.h @@ -8,7 +8,9 @@ extern const char VERSION[]; extern const char LIBCELLML_VERSION[]; extern const size_t STATE_COUNT; -extern const size_t VARIABLE_COUNT; +extern const size_t CONSTANT_COUNT; +extern const size_t COMPUTED_CONSTANT_COUNT; +extern const size_t ALGEBRAIC_COUNT; typedef enum { VARIABLE_OF_INTEGRATION, @@ -34,6 +36,6 @@ double * createVariablesArray(); void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *variables); -void computeComputedConstants(double *variables); +void computeComputedConstants(double *computedConstants); void computeRates(double voi, double *states, double *rates, double *variables); void computeVariables(double voi, double *states, double *rates, double *variables); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.py index 3142e999bb..b377d909c5 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.py @@ -8,7 +8,9 @@ LIBCELLML_VERSION = "0.5.0" STATE_COUNT = 4 -VARIABLE_COUNT = 18 +CONSTANT_COUNT = 0 +COMPUTED_CONSTANT_COUNT = 0 +ALGEBRAIC_COUNT = 18 class VariableType(Enum): @@ -459,7 +461,7 @@ def initialise_variables(states, rates, variables): rates[3] = 0.0 -def compute_computed_constants(variables): +def compute_computed_constants(computed_constants): pass diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.c index 1d24bd440c..3bff290982 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.c @@ -9,7 +9,9 @@ const char VERSION[] = "0.5.0"; const char LIBCELLML_VERSION[] = "0.5.0"; const size_t STATE_COUNT = 4; -const size_t VARIABLE_COUNT = 18; +const size_t CONSTANT_COUNT = 0; +const size_t COMPUTED_CONSTANT_COUNT = 0; +const size_t ALGEBRAIC_COUNT = 18; const VariableInfo VOI_INFO = {"time", "millisecond", "environment", VARIABLE_OF_INTEGRATION}; @@ -83,7 +85,7 @@ void initialiseVariables(double voi, double *states, double *rates, double *vari variables[0] = externalVariable(voi, states, rates, variables, 0); } -void computeComputedConstants(double *variables) +void computeComputedConstants(double *computedConstants) { variables[6] = variables[5]-10.613; variables[8] = variables[5]-115.0; diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.h index 90f2f2d76b..e1fb1b494c 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.h +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.h @@ -8,7 +8,9 @@ extern const char VERSION[]; extern const char LIBCELLML_VERSION[]; extern const size_t STATE_COUNT; -extern const size_t VARIABLE_COUNT; +extern const size_t CONSTANT_COUNT; +extern const size_t COMPUTED_CONSTANT_COUNT; +extern const size_t ALGEBRAIC_COUNT; typedef enum { VARIABLE_OF_INTEGRATION, @@ -37,6 +39,6 @@ void deleteArray(double *array); typedef double (* ExternalVariable)(double voi, double *states, double *rates, double *variables, size_t index); void initialiseVariables(double voi, double *states, double *rates, double *variables, ExternalVariable externalVariable); -void computeComputedConstants(double *variables); +void computeComputedConstants(double *computedConstants); void computeRates(double voi, double *states, double *rates, double *variables, ExternalVariable externalVariable); void computeVariables(double voi, double *states, double *rates, double *variables, ExternalVariable externalVariable); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.py index 044d7d84db..b3482e4bc8 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.py @@ -8,7 +8,9 @@ LIBCELLML_VERSION = "0.5.0" STATE_COUNT = 4 -VARIABLE_COUNT = 18 +CONSTANT_COUNT = 0 +COMPUTED_CONSTANT_COUNT = 0 +ALGEBRAIC_COUNT = 18 class VariableType(Enum): @@ -85,7 +87,7 @@ def initialise_variables(voi, states, rates, variables, external_variable): variables[0] = external_variable(voi, states, rates, variables, 0) -def compute_computed_constants(variables): +def compute_computed_constants(computed_constants): variables[6] = variables[5]-10.613 variables[8] = variables[5]-115.0 variables[14] = variables[5]+12.0 diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.c index 0a069ee840..8820f3fac2 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.c @@ -9,7 +9,9 @@ const char VERSION[] = "0.5.0"; const char LIBCELLML_VERSION[] = "0.5.0"; const size_t STATE_COUNT = 4; -const size_t VARIABLE_COUNT = 18; +const size_t CONSTANT_COUNT = 0; +const size_t COMPUTED_CONSTANT_COUNT = 0; +const size_t ALGEBRAIC_COUNT = 18; const VariableInfo VOI_INFO = {"time", "millisecond", "environment", VARIABLE_OF_INTEGRATION}; @@ -82,7 +84,7 @@ void initialiseVariables(double voi, double *states, double *rates, double *vari variables[5] = externalVariable(voi, states, rates, variables, 5); } -void computeComputedConstants(double *variables) +void computeComputedConstants(double *computedConstants) { } diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.h index 90f2f2d76b..e1fb1b494c 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.h +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.h @@ -8,7 +8,9 @@ extern const char VERSION[]; extern const char LIBCELLML_VERSION[]; extern const size_t STATE_COUNT; -extern const size_t VARIABLE_COUNT; +extern const size_t CONSTANT_COUNT; +extern const size_t COMPUTED_CONSTANT_COUNT; +extern const size_t ALGEBRAIC_COUNT; typedef enum { VARIABLE_OF_INTEGRATION, @@ -37,6 +39,6 @@ void deleteArray(double *array); typedef double (* ExternalVariable)(double voi, double *states, double *rates, double *variables, size_t index); void initialiseVariables(double voi, double *states, double *rates, double *variables, ExternalVariable externalVariable); -void computeComputedConstants(double *variables); +void computeComputedConstants(double *computedConstants); void computeRates(double voi, double *states, double *rates, double *variables, ExternalVariable externalVariable); void computeVariables(double voi, double *states, double *rates, double *variables, ExternalVariable externalVariable); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.py index d1744f67cb..1906e26f00 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.py @@ -8,7 +8,9 @@ LIBCELLML_VERSION = "0.5.0" STATE_COUNT = 4 -VARIABLE_COUNT = 18 +CONSTANT_COUNT = 0 +COMPUTED_CONSTANT_COUNT = 0 +ALGEBRAIC_COUNT = 18 class VariableType(Enum): @@ -84,7 +86,7 @@ def initialise_variables(voi, states, rates, variables, external_variable): variables[5] = external_variable(voi, states, rates, variables, 5) -def compute_computed_constants(variables): +def compute_computed_constants(computed_constants): pass diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.c index 943d980c95..ec4314811c 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.c @@ -9,7 +9,9 @@ const char VERSION[] = "0.5.0"; const char LIBCELLML_VERSION[] = "0.5.0"; const size_t STATE_COUNT = 4; -const size_t VARIABLE_COUNT = 18; +const size_t CONSTANT_COUNT = 0; +const size_t COMPUTED_CONSTANT_COUNT = 0; +const size_t ALGEBRAIC_COUNT = 18; const VariableInfo VOI_INFO = {"time", "millisecond", "environment", VARIABLE_OF_INTEGRATION}; @@ -81,7 +83,7 @@ void initialiseVariables(double voi, double *states, double *rates, double *vari variables[4] = externalVariable(voi, states, rates, variables, 4); } -void computeComputedConstants(double *variables) +void computeComputedConstants(double *computedConstants) { variables[6] = variables[5]-10.613; variables[8] = variables[5]-115.0; diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.h index 90f2f2d76b..e1fb1b494c 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.h +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.h @@ -8,7 +8,9 @@ extern const char VERSION[]; extern const char LIBCELLML_VERSION[]; extern const size_t STATE_COUNT; -extern const size_t VARIABLE_COUNT; +extern const size_t CONSTANT_COUNT; +extern const size_t COMPUTED_CONSTANT_COUNT; +extern const size_t ALGEBRAIC_COUNT; typedef enum { VARIABLE_OF_INTEGRATION, @@ -37,6 +39,6 @@ void deleteArray(double *array); typedef double (* ExternalVariable)(double voi, double *states, double *rates, double *variables, size_t index); void initialiseVariables(double voi, double *states, double *rates, double *variables, ExternalVariable externalVariable); -void computeComputedConstants(double *variables); +void computeComputedConstants(double *computedConstants); void computeRates(double voi, double *states, double *rates, double *variables, ExternalVariable externalVariable); void computeVariables(double voi, double *states, double *rates, double *variables, ExternalVariable externalVariable); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.py index 5794985f2b..eb9c6b8d0a 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.py @@ -8,7 +8,9 @@ LIBCELLML_VERSION = "0.5.0" STATE_COUNT = 4 -VARIABLE_COUNT = 18 +CONSTANT_COUNT = 0 +COMPUTED_CONSTANT_COUNT = 0 +ALGEBRAIC_COUNT = 18 class VariableType(Enum): @@ -83,7 +85,7 @@ def initialise_variables(voi, states, rates, variables, external_variable): variables[4] = external_variable(voi, states, rates, variables, 4) -def compute_computed_constants(variables): +def compute_computed_constants(computed_constants): variables[6] = variables[5]-10.613 variables[8] = variables[5]-115.0 variables[14] = variables[5]+12.0 diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.c index 1d9663beae..8157734aa5 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.c @@ -9,7 +9,9 @@ const char VERSION[] = "0.5.0"; const char LIBCELLML_VERSION[] = "0.5.0"; const size_t STATE_COUNT = 2; -const size_t VARIABLE_COUNT = 20; +const size_t CONSTANT_COUNT = 0; +const size_t COMPUTED_CONSTANT_COUNT = 0; +const size_t ALGEBRAIC_COUNT = 20; const VariableInfo VOI_INFO = {"time", "millisecond", "environment", VARIABLE_OF_INTEGRATION}; @@ -81,7 +83,7 @@ void initialiseVariables(double voi, double *states, double *rates, double *vari variables[11] = externalVariable(voi, states, rates, variables, 11); } -void computeComputedConstants(double *variables) +void computeComputedConstants(double *computedConstants) { variables[7] = variables[6]-10.613; variables[9] = variables[6]-115.0; diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.h index 90f2f2d76b..e1fb1b494c 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.h +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.h @@ -8,7 +8,9 @@ extern const char VERSION[]; extern const char LIBCELLML_VERSION[]; extern const size_t STATE_COUNT; -extern const size_t VARIABLE_COUNT; +extern const size_t CONSTANT_COUNT; +extern const size_t COMPUTED_CONSTANT_COUNT; +extern const size_t ALGEBRAIC_COUNT; typedef enum { VARIABLE_OF_INTEGRATION, @@ -37,6 +39,6 @@ void deleteArray(double *array); typedef double (* ExternalVariable)(double voi, double *states, double *rates, double *variables, size_t index); void initialiseVariables(double voi, double *states, double *rates, double *variables, ExternalVariable externalVariable); -void computeComputedConstants(double *variables); +void computeComputedConstants(double *computedConstants); void computeRates(double voi, double *states, double *rates, double *variables, ExternalVariable externalVariable); void computeVariables(double voi, double *states, double *rates, double *variables, ExternalVariable externalVariable); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.py index 58ab6ce157..1140741296 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.py @@ -8,7 +8,9 @@ LIBCELLML_VERSION = "0.5.0" STATE_COUNT = 2 -VARIABLE_COUNT = 20 +CONSTANT_COUNT = 0 +COMPUTED_CONSTANT_COUNT = 0 +ALGEBRAIC_COUNT = 20 class VariableType(Enum): @@ -83,7 +85,7 @@ def initialise_variables(voi, states, rates, variables, external_variable): variables[11] = external_variable(voi, states, rates, variables, 11) -def compute_computed_constants(variables): +def compute_computed_constants(computed_constants): variables[7] = variables[6]-10.613 variables[9] = variables[6]-115.0 variables[16] = variables[6]+12.0 diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.c index aaccf7ec0a..d824807857 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.c @@ -9,7 +9,9 @@ const char VERSION[] = "0.5.0"; const char LIBCELLML_VERSION[] = "0.5.0"; const size_t STATE_COUNT = 3; -const size_t VARIABLE_COUNT = 19; +const size_t CONSTANT_COUNT = 0; +const size_t COMPUTED_CONSTANT_COUNT = 0; +const size_t ALGEBRAIC_COUNT = 19; const VariableInfo VOI_INFO = {"time", "millisecond", "environment", VARIABLE_OF_INTEGRATION}; @@ -83,7 +85,7 @@ void initialiseVariables(double voi, double *states, double *rates, double *vari variables[4] = externalVariable(voi, states, rates, variables, 4); } -void computeComputedConstants(double *variables) +void computeComputedConstants(double *computedConstants) { variables[7] = variables[6]-10.613; variables[9] = variables[6]-115.0; diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.h index 90f2f2d76b..e1fb1b494c 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.h +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.h @@ -8,7 +8,9 @@ extern const char VERSION[]; extern const char LIBCELLML_VERSION[]; extern const size_t STATE_COUNT; -extern const size_t VARIABLE_COUNT; +extern const size_t CONSTANT_COUNT; +extern const size_t COMPUTED_CONSTANT_COUNT; +extern const size_t ALGEBRAIC_COUNT; typedef enum { VARIABLE_OF_INTEGRATION, @@ -37,6 +39,6 @@ void deleteArray(double *array); typedef double (* ExternalVariable)(double voi, double *states, double *rates, double *variables, size_t index); void initialiseVariables(double voi, double *states, double *rates, double *variables, ExternalVariable externalVariable); -void computeComputedConstants(double *variables); +void computeComputedConstants(double *computedConstants); void computeRates(double voi, double *states, double *rates, double *variables, ExternalVariable externalVariable); void computeVariables(double voi, double *states, double *rates, double *variables, ExternalVariable externalVariable); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.py index 2caf7951d1..cc74a6a438 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.py @@ -8,7 +8,9 @@ LIBCELLML_VERSION = "0.5.0" STATE_COUNT = 3 -VARIABLE_COUNT = 19 +CONSTANT_COUNT = 0 +COMPUTED_CONSTANT_COUNT = 0 +ALGEBRAIC_COUNT = 19 class VariableType(Enum): @@ -85,7 +87,7 @@ def initialise_variables(voi, states, rates, variables, external_variable): variables[4] = external_variable(voi, states, rates, variables, 4) -def compute_computed_constants(variables): +def compute_computed_constants(computed_constants): variables[7] = variables[6]-10.613 variables[9] = variables[6]-115.0 variables[15] = variables[6]+12.0 diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.h index a6105918ae..18f278fee6 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.h +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.h @@ -8,7 +8,9 @@ extern const char VERSION[]; extern const char LIBCELLML_VERSION[]; extern const size_t STATE_COUNT; -extern const size_t VARIABLE_COUNT; +extern const size_t CONSTANT_COUNT; +extern const size_t COMPUTED_CONSTANT_COUNT; +extern const size_t ALGEBRAIC_COUNT; typedef enum { VARIABLE_OF_INTEGRATION, @@ -34,6 +36,6 @@ double * createVariablesArray(); void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *variables); -void computeComputedConstants(double *variables); +void computeComputedConstants(double *computedConstants); void computeRates(double voi, double *states, double *rates, double *variables); void computeVariables(double voi, double *states, double *rates, double *variables); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.py index 4ccccffa1a..cdbfc277a1 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.py @@ -8,7 +8,9 @@ LIBCELLML_VERSION = "0.5.0" STATE_COUNT = 4 -VARIABLE_COUNT = 18 +CONSTANT_COUNT = 0 +COMPUTED_CONSTANT_COUNT = 0 +ALGEBRAIC_COUNT = 18 class VariableType(Enum): @@ -82,7 +84,7 @@ def initialise_variables(states, rates, variables): states[3] = 0.325 -def compute_computed_constants(variables): +def compute_computed_constants(computed_constants): variables[6] = variables[5]-10.613 variables[8] = variables[5]-115.0 variables[14] = variables[5]+12.0 diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.c index 6b8cab0639..4689c74e68 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.c @@ -9,7 +9,9 @@ const char VERSION[] = "0.5.0"; const char LIBCELLML_VERSION[] = "0.5.0"; const size_t STATE_COUNT = 3; -const size_t VARIABLE_COUNT = 19; +const size_t CONSTANT_COUNT = 0; +const size_t COMPUTED_CONSTANT_COUNT = 0; +const size_t ALGEBRAIC_COUNT = 19; const VariableInfo VOI_INFO = {"time", "millisecond", "environment", VARIABLE_OF_INTEGRATION}; @@ -81,7 +83,7 @@ void initialiseVariables(double voi, double *states, double *rates, double *vari variables[10] = externalVariable(voi, states, rates, variables, 10); } -void computeComputedConstants(double *variables) +void computeComputedConstants(double *computedConstants) { variables[6] = variables[5]-10.613; variables[8] = variables[5]-115.0; diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.h index 90f2f2d76b..e1fb1b494c 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.h +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.h @@ -8,7 +8,9 @@ extern const char VERSION[]; extern const char LIBCELLML_VERSION[]; extern const size_t STATE_COUNT; -extern const size_t VARIABLE_COUNT; +extern const size_t CONSTANT_COUNT; +extern const size_t COMPUTED_CONSTANT_COUNT; +extern const size_t ALGEBRAIC_COUNT; typedef enum { VARIABLE_OF_INTEGRATION, @@ -37,6 +39,6 @@ void deleteArray(double *array); typedef double (* ExternalVariable)(double voi, double *states, double *rates, double *variables, size_t index); void initialiseVariables(double voi, double *states, double *rates, double *variables, ExternalVariable externalVariable); -void computeComputedConstants(double *variables); +void computeComputedConstants(double *computedConstants); void computeRates(double voi, double *states, double *rates, double *variables, ExternalVariable externalVariable); void computeVariables(double voi, double *states, double *rates, double *variables, ExternalVariable externalVariable); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.py index 670866666b..771fbc441c 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.py @@ -8,7 +8,9 @@ LIBCELLML_VERSION = "0.5.0" STATE_COUNT = 3 -VARIABLE_COUNT = 19 +CONSTANT_COUNT = 0 +COMPUTED_CONSTANT_COUNT = 0 +ALGEBRAIC_COUNT = 19 class VariableType(Enum): @@ -83,7 +85,7 @@ def initialise_variables(voi, states, rates, variables, external_variable): variables[10] = external_variable(voi, states, rates, variables, 10) -def compute_computed_constants(variables): +def compute_computed_constants(computed_constants): variables[6] = variables[5]-10.613 variables[8] = variables[5]-115.0 variables[15] = variables[5]+12.0 diff --git a/tests/resources/generator/noble_model_1962/model.c b/tests/resources/generator/noble_model_1962/model.c index fcf26ac8f2..af60ee489b 100644 --- a/tests/resources/generator/noble_model_1962/model.c +++ b/tests/resources/generator/noble_model_1962/model.c @@ -9,7 +9,9 @@ const char VERSION[] = "0.5.0"; const char LIBCELLML_VERSION[] = "0.5.0"; const size_t STATE_COUNT = 4; -const size_t VARIABLE_COUNT = 17; +const size_t CONSTANT_COUNT = 0; +const size_t COMPUTED_CONSTANT_COUNT = 0; +const size_t ALGEBRAIC_COUNT = 17; const VariableInfo VOI_INFO = {"time", "millisecond", "environment", VARIABLE_OF_INTEGRATION}; @@ -80,7 +82,7 @@ void initialiseVariables(double *states, double *rates, double *variables) states[3] = 0.01; } -void computeComputedConstants(double *variables) +void computeComputedConstants(double *computedConstants) { } diff --git a/tests/resources/generator/noble_model_1962/model.h b/tests/resources/generator/noble_model_1962/model.h index 1f66de15d5..6988d2d31c 100644 --- a/tests/resources/generator/noble_model_1962/model.h +++ b/tests/resources/generator/noble_model_1962/model.h @@ -8,7 +8,9 @@ extern const char VERSION[]; extern const char LIBCELLML_VERSION[]; extern const size_t STATE_COUNT; -extern const size_t VARIABLE_COUNT; +extern const size_t CONSTANT_COUNT; +extern const size_t COMPUTED_CONSTANT_COUNT; +extern const size_t ALGEBRAIC_COUNT; typedef enum { VARIABLE_OF_INTEGRATION, @@ -34,6 +36,6 @@ double * createVariablesArray(); void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *variables); -void computeComputedConstants(double *variables); +void computeComputedConstants(double *computedConstants); void computeRates(double voi, double *states, double *rates, double *variables); void computeVariables(double voi, double *states, double *rates, double *variables); diff --git a/tests/resources/generator/noble_model_1962/model.py b/tests/resources/generator/noble_model_1962/model.py index 2f5b868b5c..52a828364b 100644 --- a/tests/resources/generator/noble_model_1962/model.py +++ b/tests/resources/generator/noble_model_1962/model.py @@ -8,7 +8,9 @@ LIBCELLML_VERSION = "0.5.0" STATE_COUNT = 4 -VARIABLE_COUNT = 17 +CONSTANT_COUNT = 0 +COMPUTED_CONSTANT_COUNT = 0 +ALGEBRAIC_COUNT = 17 class VariableType(Enum): @@ -69,7 +71,7 @@ def initialise_variables(states, rates, variables): states[3] = 0.01 -def compute_computed_constants(variables): +def compute_computed_constants(computed_constants): pass diff --git a/tests/resources/generator/ode_computed_var_on_rhs/model.c b/tests/resources/generator/ode_computed_var_on_rhs/model.c index 05a03e5a3a..529cf18048 100644 --- a/tests/resources/generator/ode_computed_var_on_rhs/model.c +++ b/tests/resources/generator/ode_computed_var_on_rhs/model.c @@ -9,7 +9,9 @@ const char VERSION[] = "0.5.0"; const char LIBCELLML_VERSION[] = "0.5.0"; const size_t STATE_COUNT = 1; -const size_t VARIABLE_COUNT = 1; +const size_t CONSTANT_COUNT = 0; +const size_t COMPUTED_CONSTANT_COUNT = 0; +const size_t ALGEBRAIC_COUNT = 1; const VariableInfo VOI_INFO = {"t", "second", "environment", VARIABLE_OF_INTEGRATION}; @@ -54,7 +56,7 @@ void initialiseVariables(double *states, double *rates, double *variables) states[0] = 1.0; } -void computeComputedConstants(double *variables) +void computeComputedConstants(double *computedConstants) { } diff --git a/tests/resources/generator/ode_computed_var_on_rhs/model.h b/tests/resources/generator/ode_computed_var_on_rhs/model.h index caeb40bab6..614cdc5ec6 100644 --- a/tests/resources/generator/ode_computed_var_on_rhs/model.h +++ b/tests/resources/generator/ode_computed_var_on_rhs/model.h @@ -8,7 +8,9 @@ extern const char VERSION[]; extern const char LIBCELLML_VERSION[]; extern const size_t STATE_COUNT; -extern const size_t VARIABLE_COUNT; +extern const size_t CONSTANT_COUNT; +extern const size_t COMPUTED_CONSTANT_COUNT; +extern const size_t ALGEBRAIC_COUNT; typedef enum { VARIABLE_OF_INTEGRATION, @@ -34,6 +36,6 @@ double * createVariablesArray(); void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *variables); -void computeComputedConstants(double *variables); +void computeComputedConstants(double *computedConstants); void computeRates(double voi, double *states, double *rates, double *variables); void computeVariables(double voi, double *states, double *rates, double *variables); diff --git a/tests/resources/generator/ode_computed_var_on_rhs/model.py b/tests/resources/generator/ode_computed_var_on_rhs/model.py index d7af941393..ec7afe8e0e 100644 --- a/tests/resources/generator/ode_computed_var_on_rhs/model.py +++ b/tests/resources/generator/ode_computed_var_on_rhs/model.py @@ -8,7 +8,9 @@ LIBCELLML_VERSION = "0.5.0" STATE_COUNT = 1 -VARIABLE_COUNT = 1 +CONSTANT_COUNT = 0 +COMPUTED_CONSTANT_COUNT = 0 +ALGEBRAIC_COUNT = 1 class VariableType(Enum): @@ -43,7 +45,7 @@ def initialise_variables(states, rates, variables): states[0] = 1.0 -def compute_computed_constants(variables): +def compute_computed_constants(computed_constants): pass diff --git a/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.c b/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.c index 7501f479cb..5d8747a404 100644 --- a/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.c +++ b/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.c @@ -9,7 +9,9 @@ const char VERSION[] = "0.5.0"; const char LIBCELLML_VERSION[] = "0.5.0"; const size_t STATE_COUNT = 1; -const size_t VARIABLE_COUNT = 1; +const size_t CONSTANT_COUNT = 0; +const size_t COMPUTED_CONSTANT_COUNT = 0; +const size_t ALGEBRAIC_COUNT = 1; const VariableInfo VOI_INFO = {"t", "second", "my_component", VARIABLE_OF_INTEGRATION}; @@ -54,7 +56,7 @@ void initialiseVariables(double *states, double *rates, double *variables) states[0] = 1.0; } -void computeComputedConstants(double *variables) +void computeComputedConstants(double *computedConstants) { } diff --git a/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.h b/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.h index 9aad67f7aa..d1084de7ab 100644 --- a/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.h +++ b/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.h @@ -8,7 +8,9 @@ extern const char VERSION[]; extern const char LIBCELLML_VERSION[]; extern const size_t STATE_COUNT; -extern const size_t VARIABLE_COUNT; +extern const size_t CONSTANT_COUNT; +extern const size_t COMPUTED_CONSTANT_COUNT; +extern const size_t ALGEBRAIC_COUNT; typedef enum { VARIABLE_OF_INTEGRATION, @@ -34,6 +36,6 @@ double * createVariablesArray(); void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *variables); -void computeComputedConstants(double *variables); +void computeComputedConstants(double *computedConstants); void computeRates(double voi, double *states, double *rates, double *variables); void computeVariables(double voi, double *states, double *rates, double *variables); diff --git a/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.py b/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.py index eb791199cb..e15d14089f 100644 --- a/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.py +++ b/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.py @@ -8,7 +8,9 @@ LIBCELLML_VERSION = "0.5.0" STATE_COUNT = 1 -VARIABLE_COUNT = 1 +CONSTANT_COUNT = 0 +COMPUTED_CONSTANT_COUNT = 0 +ALGEBRAIC_COUNT = 1 class VariableType(Enum): @@ -43,7 +45,7 @@ def initialise_variables(states, rates, variables): states[0] = 1.0 -def compute_computed_constants(variables): +def compute_computed_constants(computed_constants): pass diff --git a/tests/resources/generator/ode_const_var_on_rhs/model.c b/tests/resources/generator/ode_const_var_on_rhs/model.c index 50fe9e1d40..59be2f295d 100644 --- a/tests/resources/generator/ode_const_var_on_rhs/model.c +++ b/tests/resources/generator/ode_const_var_on_rhs/model.c @@ -9,7 +9,9 @@ const char VERSION[] = "0.5.0"; const char LIBCELLML_VERSION[] = "0.5.0"; const size_t STATE_COUNT = 1; -const size_t VARIABLE_COUNT = 1; +const size_t CONSTANT_COUNT = 0; +const size_t COMPUTED_CONSTANT_COUNT = 0; +const size_t ALGEBRAIC_COUNT = 1; const VariableInfo VOI_INFO = {"t", "second", "environment", VARIABLE_OF_INTEGRATION}; @@ -54,7 +56,7 @@ void initialiseVariables(double *states, double *rates, double *variables) states[0] = 1.0; } -void computeComputedConstants(double *variables) +void computeComputedConstants(double *computedConstants) { } diff --git a/tests/resources/generator/ode_const_var_on_rhs/model.h b/tests/resources/generator/ode_const_var_on_rhs/model.h index caeb40bab6..614cdc5ec6 100644 --- a/tests/resources/generator/ode_const_var_on_rhs/model.h +++ b/tests/resources/generator/ode_const_var_on_rhs/model.h @@ -8,7 +8,9 @@ extern const char VERSION[]; extern const char LIBCELLML_VERSION[]; extern const size_t STATE_COUNT; -extern const size_t VARIABLE_COUNT; +extern const size_t CONSTANT_COUNT; +extern const size_t COMPUTED_CONSTANT_COUNT; +extern const size_t ALGEBRAIC_COUNT; typedef enum { VARIABLE_OF_INTEGRATION, @@ -34,6 +36,6 @@ double * createVariablesArray(); void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *variables); -void computeComputedConstants(double *variables); +void computeComputedConstants(double *computedConstants); void computeRates(double voi, double *states, double *rates, double *variables); void computeVariables(double voi, double *states, double *rates, double *variables); diff --git a/tests/resources/generator/ode_const_var_on_rhs/model.py b/tests/resources/generator/ode_const_var_on_rhs/model.py index 171d3eb75d..5d5b92520c 100644 --- a/tests/resources/generator/ode_const_var_on_rhs/model.py +++ b/tests/resources/generator/ode_const_var_on_rhs/model.py @@ -8,7 +8,9 @@ LIBCELLML_VERSION = "0.5.0" STATE_COUNT = 1 -VARIABLE_COUNT = 1 +CONSTANT_COUNT = 0 +COMPUTED_CONSTANT_COUNT = 0 +ALGEBRAIC_COUNT = 1 class VariableType(Enum): @@ -43,7 +45,7 @@ def initialise_variables(states, rates, variables): states[0] = 1.0 -def compute_computed_constants(variables): +def compute_computed_constants(computed_constants): pass diff --git a/tests/resources/generator/ode_const_var_on_rhs_one_component/model.c b/tests/resources/generator/ode_const_var_on_rhs_one_component/model.c index f2ccf698e3..a5074645db 100644 --- a/tests/resources/generator/ode_const_var_on_rhs_one_component/model.c +++ b/tests/resources/generator/ode_const_var_on_rhs_one_component/model.c @@ -9,7 +9,9 @@ const char VERSION[] = "0.5.0"; const char LIBCELLML_VERSION[] = "0.5.0"; const size_t STATE_COUNT = 1; -const size_t VARIABLE_COUNT = 1; +const size_t CONSTANT_COUNT = 0; +const size_t COMPUTED_CONSTANT_COUNT = 0; +const size_t ALGEBRAIC_COUNT = 1; const VariableInfo VOI_INFO = {"t", "second", "my_component", VARIABLE_OF_INTEGRATION}; @@ -54,7 +56,7 @@ void initialiseVariables(double *states, double *rates, double *variables) states[0] = 1.0; } -void computeComputedConstants(double *variables) +void computeComputedConstants(double *computedConstants) { } diff --git a/tests/resources/generator/ode_const_var_on_rhs_one_component/model.h b/tests/resources/generator/ode_const_var_on_rhs_one_component/model.h index 9aad67f7aa..d1084de7ab 100644 --- a/tests/resources/generator/ode_const_var_on_rhs_one_component/model.h +++ b/tests/resources/generator/ode_const_var_on_rhs_one_component/model.h @@ -8,7 +8,9 @@ extern const char VERSION[]; extern const char LIBCELLML_VERSION[]; extern const size_t STATE_COUNT; -extern const size_t VARIABLE_COUNT; +extern const size_t CONSTANT_COUNT; +extern const size_t COMPUTED_CONSTANT_COUNT; +extern const size_t ALGEBRAIC_COUNT; typedef enum { VARIABLE_OF_INTEGRATION, @@ -34,6 +36,6 @@ double * createVariablesArray(); void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *variables); -void computeComputedConstants(double *variables); +void computeComputedConstants(double *computedConstants); void computeRates(double voi, double *states, double *rates, double *variables); void computeVariables(double voi, double *states, double *rates, double *variables); diff --git a/tests/resources/generator/ode_const_var_on_rhs_one_component/model.py b/tests/resources/generator/ode_const_var_on_rhs_one_component/model.py index 05e7479b1b..801a2997d3 100644 --- a/tests/resources/generator/ode_const_var_on_rhs_one_component/model.py +++ b/tests/resources/generator/ode_const_var_on_rhs_one_component/model.py @@ -8,7 +8,9 @@ LIBCELLML_VERSION = "0.5.0" STATE_COUNT = 1 -VARIABLE_COUNT = 1 +CONSTANT_COUNT = 0 +COMPUTED_CONSTANT_COUNT = 0 +ALGEBRAIC_COUNT = 1 class VariableType(Enum): @@ -43,7 +45,7 @@ def initialise_variables(states, rates, variables): states[0] = 1.0 -def compute_computed_constants(variables): +def compute_computed_constants(computed_constants): pass diff --git a/tests/resources/generator/ode_constant_on_rhs/model.c b/tests/resources/generator/ode_constant_on_rhs/model.c index fa52eb92dc..c026c74041 100644 --- a/tests/resources/generator/ode_constant_on_rhs/model.c +++ b/tests/resources/generator/ode_constant_on_rhs/model.c @@ -9,7 +9,9 @@ const char VERSION[] = "0.5.0"; const char LIBCELLML_VERSION[] = "0.5.0"; const size_t STATE_COUNT = 1; -const size_t VARIABLE_COUNT = 0; +const size_t CONSTANT_COUNT = 0; +const size_t COMPUTED_CONSTANT_COUNT = 0; +const size_t ALGEBRAIC_COUNT = 0; const VariableInfo VOI_INFO = {"t", "second", "environment", VARIABLE_OF_INTEGRATION}; @@ -52,7 +54,7 @@ void initialiseVariables(double *states, double *rates, double *variables) states[0] = 1.0; } -void computeComputedConstants(double *variables) +void computeComputedConstants(double *computedConstants) { } diff --git a/tests/resources/generator/ode_constant_on_rhs/model.h b/tests/resources/generator/ode_constant_on_rhs/model.h index caeb40bab6..614cdc5ec6 100644 --- a/tests/resources/generator/ode_constant_on_rhs/model.h +++ b/tests/resources/generator/ode_constant_on_rhs/model.h @@ -8,7 +8,9 @@ extern const char VERSION[]; extern const char LIBCELLML_VERSION[]; extern const size_t STATE_COUNT; -extern const size_t VARIABLE_COUNT; +extern const size_t CONSTANT_COUNT; +extern const size_t COMPUTED_CONSTANT_COUNT; +extern const size_t ALGEBRAIC_COUNT; typedef enum { VARIABLE_OF_INTEGRATION, @@ -34,6 +36,6 @@ double * createVariablesArray(); void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *variables); -void computeComputedConstants(double *variables); +void computeComputedConstants(double *computedConstants); void computeRates(double voi, double *states, double *rates, double *variables); void computeVariables(double voi, double *states, double *rates, double *variables); diff --git a/tests/resources/generator/ode_constant_on_rhs/model.py b/tests/resources/generator/ode_constant_on_rhs/model.py index 36a70b444f..20c1034b04 100644 --- a/tests/resources/generator/ode_constant_on_rhs/model.py +++ b/tests/resources/generator/ode_constant_on_rhs/model.py @@ -8,7 +8,9 @@ LIBCELLML_VERSION = "0.5.0" STATE_COUNT = 1 -VARIABLE_COUNT = 0 +CONSTANT_COUNT = 0 +COMPUTED_CONSTANT_COUNT = 0 +ALGEBRAIC_COUNT = 0 class VariableType(Enum): @@ -41,7 +43,7 @@ def initialise_variables(states, rates, variables): states[0] = 1.0 -def compute_computed_constants(variables): +def compute_computed_constants(computed_constants): pass diff --git a/tests/resources/generator/ode_constant_on_rhs_one_component/model.c b/tests/resources/generator/ode_constant_on_rhs_one_component/model.c index 7ff69acaab..07897e662d 100644 --- a/tests/resources/generator/ode_constant_on_rhs_one_component/model.c +++ b/tests/resources/generator/ode_constant_on_rhs_one_component/model.c @@ -9,7 +9,9 @@ const char VERSION[] = "0.5.0"; const char LIBCELLML_VERSION[] = "0.5.0"; const size_t STATE_COUNT = 1; -const size_t VARIABLE_COUNT = 0; +const size_t CONSTANT_COUNT = 0; +const size_t COMPUTED_CONSTANT_COUNT = 0; +const size_t ALGEBRAIC_COUNT = 0; const VariableInfo VOI_INFO = {"t", "second", "my_component", VARIABLE_OF_INTEGRATION}; @@ -52,7 +54,7 @@ void initialiseVariables(double *states, double *rates, double *variables) states[0] = 1.0; } -void computeComputedConstants(double *variables) +void computeComputedConstants(double *computedConstants) { } diff --git a/tests/resources/generator/ode_constant_on_rhs_one_component/model.h b/tests/resources/generator/ode_constant_on_rhs_one_component/model.h index 9aad67f7aa..d1084de7ab 100644 --- a/tests/resources/generator/ode_constant_on_rhs_one_component/model.h +++ b/tests/resources/generator/ode_constant_on_rhs_one_component/model.h @@ -8,7 +8,9 @@ extern const char VERSION[]; extern const char LIBCELLML_VERSION[]; extern const size_t STATE_COUNT; -extern const size_t VARIABLE_COUNT; +extern const size_t CONSTANT_COUNT; +extern const size_t COMPUTED_CONSTANT_COUNT; +extern const size_t ALGEBRAIC_COUNT; typedef enum { VARIABLE_OF_INTEGRATION, @@ -34,6 +36,6 @@ double * createVariablesArray(); void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *variables); -void computeComputedConstants(double *variables); +void computeComputedConstants(double *computedConstants); void computeRates(double voi, double *states, double *rates, double *variables); void computeVariables(double voi, double *states, double *rates, double *variables); diff --git a/tests/resources/generator/ode_constant_on_rhs_one_component/model.py b/tests/resources/generator/ode_constant_on_rhs_one_component/model.py index 5dbb6e4a2d..096a989a79 100644 --- a/tests/resources/generator/ode_constant_on_rhs_one_component/model.py +++ b/tests/resources/generator/ode_constant_on_rhs_one_component/model.py @@ -8,7 +8,9 @@ LIBCELLML_VERSION = "0.5.0" STATE_COUNT = 1 -VARIABLE_COUNT = 0 +CONSTANT_COUNT = 0 +COMPUTED_CONSTANT_COUNT = 0 +ALGEBRAIC_COUNT = 0 class VariableType(Enum): @@ -41,7 +43,7 @@ def initialise_variables(states, rates, variables): states[0] = 1.0 -def compute_computed_constants(variables): +def compute_computed_constants(computed_constants): pass diff --git a/tests/resources/generator/ode_multiple_dependent_odes/model.c b/tests/resources/generator/ode_multiple_dependent_odes/model.c index 06889b8f3d..d0ae434332 100644 --- a/tests/resources/generator/ode_multiple_dependent_odes/model.c +++ b/tests/resources/generator/ode_multiple_dependent_odes/model.c @@ -9,7 +9,9 @@ const char VERSION[] = "0.5.0"; const char LIBCELLML_VERSION[] = "0.5.0"; const size_t STATE_COUNT = 2; -const size_t VARIABLE_COUNT = 1; +const size_t CONSTANT_COUNT = 0; +const size_t COMPUTED_CONSTANT_COUNT = 0; +const size_t ALGEBRAIC_COUNT = 1; const VariableInfo VOI_INFO = {"t", "second", "environment", VARIABLE_OF_INTEGRATION}; @@ -56,7 +58,7 @@ void initialiseVariables(double *states, double *rates, double *variables) states[1] = 0.0; } -void computeComputedConstants(double *variables) +void computeComputedConstants(double *computedConstants) { } diff --git a/tests/resources/generator/ode_multiple_dependent_odes/model.h b/tests/resources/generator/ode_multiple_dependent_odes/model.h index a685abb66c..b5625ea2db 100644 --- a/tests/resources/generator/ode_multiple_dependent_odes/model.h +++ b/tests/resources/generator/ode_multiple_dependent_odes/model.h @@ -8,7 +8,9 @@ extern const char VERSION[]; extern const char LIBCELLML_VERSION[]; extern const size_t STATE_COUNT; -extern const size_t VARIABLE_COUNT; +extern const size_t CONSTANT_COUNT; +extern const size_t COMPUTED_CONSTANT_COUNT; +extern const size_t ALGEBRAIC_COUNT; typedef enum { VARIABLE_OF_INTEGRATION, @@ -34,6 +36,6 @@ double * createVariablesArray(); void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *variables); -void computeComputedConstants(double *variables); +void computeComputedConstants(double *computedConstants); void computeRates(double voi, double *states, double *rates, double *variables); void computeVariables(double voi, double *states, double *rates, double *variables); diff --git a/tests/resources/generator/ode_multiple_dependent_odes/model.py b/tests/resources/generator/ode_multiple_dependent_odes/model.py index 4aec9e3420..37a213fb21 100644 --- a/tests/resources/generator/ode_multiple_dependent_odes/model.py +++ b/tests/resources/generator/ode_multiple_dependent_odes/model.py @@ -8,7 +8,9 @@ LIBCELLML_VERSION = "0.5.0" STATE_COUNT = 2 -VARIABLE_COUNT = 1 +CONSTANT_COUNT = 0 +COMPUTED_CONSTANT_COUNT = 0 +ALGEBRAIC_COUNT = 1 class VariableType(Enum): @@ -45,7 +47,7 @@ def initialise_variables(states, rates, variables): states[1] = 0.0 -def compute_computed_constants(variables): +def compute_computed_constants(computed_constants): pass diff --git a/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.c b/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.c index b4132dcb87..627806b477 100644 --- a/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.c +++ b/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.c @@ -9,7 +9,9 @@ const char VERSION[] = "0.5.0"; const char LIBCELLML_VERSION[] = "0.5.0"; const size_t STATE_COUNT = 2; -const size_t VARIABLE_COUNT = 1; +const size_t CONSTANT_COUNT = 0; +const size_t COMPUTED_CONSTANT_COUNT = 0; +const size_t ALGEBRAIC_COUNT = 1; const VariableInfo VOI_INFO = {"t", "second", "my_component", VARIABLE_OF_INTEGRATION}; @@ -56,7 +58,7 @@ void initialiseVariables(double *states, double *rates, double *variables) states[1] = 0.0; } -void computeComputedConstants(double *variables) +void computeComputedConstants(double *computedConstants) { } diff --git a/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.h b/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.h index 6ac98c1de8..a559621fea 100644 --- a/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.h +++ b/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.h @@ -8,7 +8,9 @@ extern const char VERSION[]; extern const char LIBCELLML_VERSION[]; extern const size_t STATE_COUNT; -extern const size_t VARIABLE_COUNT; +extern const size_t CONSTANT_COUNT; +extern const size_t COMPUTED_CONSTANT_COUNT; +extern const size_t ALGEBRAIC_COUNT; typedef enum { VARIABLE_OF_INTEGRATION, @@ -34,6 +36,6 @@ double * createVariablesArray(); void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *variables); -void computeComputedConstants(double *variables); +void computeComputedConstants(double *computedConstants); void computeRates(double voi, double *states, double *rates, double *variables); void computeVariables(double voi, double *states, double *rates, double *variables); diff --git a/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.py b/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.py index 599f63c55b..a020f51011 100644 --- a/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.py +++ b/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.py @@ -8,7 +8,9 @@ LIBCELLML_VERSION = "0.5.0" STATE_COUNT = 2 -VARIABLE_COUNT = 1 +CONSTANT_COUNT = 0 +COMPUTED_CONSTANT_COUNT = 0 +ALGEBRAIC_COUNT = 1 class VariableType(Enum): @@ -45,7 +47,7 @@ def initialise_variables(states, rates, variables): states[1] = 0.0 -def compute_computed_constants(variables): +def compute_computed_constants(computed_constants): pass diff --git a/tests/resources/generator/ode_multiple_odes_with_same_name/model.c b/tests/resources/generator/ode_multiple_odes_with_same_name/model.c index 23a6527e44..40cc955aba 100644 --- a/tests/resources/generator/ode_multiple_odes_with_same_name/model.c +++ b/tests/resources/generator/ode_multiple_odes_with_same_name/model.c @@ -9,7 +9,9 @@ const char VERSION[] = "0.5.0"; const char LIBCELLML_VERSION[] = "0.5.0"; const size_t STATE_COUNT = 2; -const size_t VARIABLE_COUNT = 1; +const size_t CONSTANT_COUNT = 0; +const size_t COMPUTED_CONSTANT_COUNT = 0; +const size_t ALGEBRAIC_COUNT = 1; const VariableInfo VOI_INFO = {"t", "second", "environment", VARIABLE_OF_INTEGRATION}; @@ -56,7 +58,7 @@ void initialiseVariables(double *states, double *rates, double *variables) states[1] = 1.0; } -void computeComputedConstants(double *variables) +void computeComputedConstants(double *computedConstants) { } diff --git a/tests/resources/generator/ode_multiple_odes_with_same_name/model.h b/tests/resources/generator/ode_multiple_odes_with_same_name/model.h index 7b5c06ff36..2b904e6bcb 100644 --- a/tests/resources/generator/ode_multiple_odes_with_same_name/model.h +++ b/tests/resources/generator/ode_multiple_odes_with_same_name/model.h @@ -8,7 +8,9 @@ extern const char VERSION[]; extern const char LIBCELLML_VERSION[]; extern const size_t STATE_COUNT; -extern const size_t VARIABLE_COUNT; +extern const size_t CONSTANT_COUNT; +extern const size_t COMPUTED_CONSTANT_COUNT; +extern const size_t ALGEBRAIC_COUNT; typedef enum { VARIABLE_OF_INTEGRATION, @@ -34,6 +36,6 @@ double * createVariablesArray(); void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *variables); -void computeComputedConstants(double *variables); +void computeComputedConstants(double *computedConstants); void computeRates(double voi, double *states, double *rates, double *variables); void computeVariables(double voi, double *states, double *rates, double *variables); diff --git a/tests/resources/generator/ode_multiple_odes_with_same_name/model.py b/tests/resources/generator/ode_multiple_odes_with_same_name/model.py index 07a516dd11..06b202ef8f 100644 --- a/tests/resources/generator/ode_multiple_odes_with_same_name/model.py +++ b/tests/resources/generator/ode_multiple_odes_with_same_name/model.py @@ -8,7 +8,9 @@ LIBCELLML_VERSION = "0.5.0" STATE_COUNT = 2 -VARIABLE_COUNT = 1 +CONSTANT_COUNT = 0 +COMPUTED_CONSTANT_COUNT = 0 +ALGEBRAIC_COUNT = 1 class VariableType(Enum): @@ -45,7 +47,7 @@ def initialise_variables(states, rates, variables): states[1] = 1.0 -def compute_computed_constants(variables): +def compute_computed_constants(computed_constants): pass diff --git a/tests/resources/generator/ode_unknown_var_on_rhs/model.c b/tests/resources/generator/ode_unknown_var_on_rhs/model.c index 79d02f6081..0f39593a52 100644 --- a/tests/resources/generator/ode_unknown_var_on_rhs/model.c +++ b/tests/resources/generator/ode_unknown_var_on_rhs/model.c @@ -9,7 +9,9 @@ const char VERSION[] = "0.5.0"; const char LIBCELLML_VERSION[] = "0.5.0"; const size_t STATE_COUNT = 2; -const size_t VARIABLE_COUNT = 0; +const size_t CONSTANT_COUNT = 0; +const size_t COMPUTED_CONSTANT_COUNT = 0; +const size_t ALGEBRAIC_COUNT = 0; const VariableInfo VOI_INFO = {"t", "second", "environment", VARIABLE_OF_INTEGRATION}; @@ -54,7 +56,7 @@ void initialiseVariables(double *states, double *rates, double *variables) states[1] = 1.0; } -void computeComputedConstants(double *variables) +void computeComputedConstants(double *computedConstants) { } diff --git a/tests/resources/generator/ode_unknown_var_on_rhs/model.h b/tests/resources/generator/ode_unknown_var_on_rhs/model.h index caeb40bab6..614cdc5ec6 100644 --- a/tests/resources/generator/ode_unknown_var_on_rhs/model.h +++ b/tests/resources/generator/ode_unknown_var_on_rhs/model.h @@ -8,7 +8,9 @@ extern const char VERSION[]; extern const char LIBCELLML_VERSION[]; extern const size_t STATE_COUNT; -extern const size_t VARIABLE_COUNT; +extern const size_t CONSTANT_COUNT; +extern const size_t COMPUTED_CONSTANT_COUNT; +extern const size_t ALGEBRAIC_COUNT; typedef enum { VARIABLE_OF_INTEGRATION, @@ -34,6 +36,6 @@ double * createVariablesArray(); void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *variables); -void computeComputedConstants(double *variables); +void computeComputedConstants(double *computedConstants); void computeRates(double voi, double *states, double *rates, double *variables); void computeVariables(double voi, double *states, double *rates, double *variables); diff --git a/tests/resources/generator/ode_unknown_var_on_rhs/model.py b/tests/resources/generator/ode_unknown_var_on_rhs/model.py index b5e0efba7c..eb04fc9df5 100644 --- a/tests/resources/generator/ode_unknown_var_on_rhs/model.py +++ b/tests/resources/generator/ode_unknown_var_on_rhs/model.py @@ -8,7 +8,9 @@ LIBCELLML_VERSION = "0.5.0" STATE_COUNT = 2 -VARIABLE_COUNT = 0 +CONSTANT_COUNT = 0 +COMPUTED_CONSTANT_COUNT = 0 +ALGEBRAIC_COUNT = 0 class VariableType(Enum): @@ -43,7 +45,7 @@ def initialise_variables(states, rates, variables): states[1] = 1.0 -def compute_computed_constants(variables): +def compute_computed_constants(computed_constants): pass diff --git a/tests/resources/generator/robertson_model_1966/model.dae.c b/tests/resources/generator/robertson_model_1966/model.dae.c index f1812a2537..36df485fd7 100644 --- a/tests/resources/generator/robertson_model_1966/model.dae.c +++ b/tests/resources/generator/robertson_model_1966/model.dae.c @@ -9,7 +9,9 @@ const char VERSION[] = "0.5.0"; const char LIBCELLML_VERSION[] = "0.5.0"; const size_t STATE_COUNT = 2; -const size_t VARIABLE_COUNT = 5; +const size_t CONSTANT_COUNT = 0; +const size_t COMPUTED_CONSTANT_COUNT = 0; +const size_t ALGEBRAIC_COUNT = 5; const VariableInfo VOI_INFO = {"t", "dimensionless", "main", VARIABLE_OF_INTEGRATION}; @@ -97,7 +99,7 @@ void initialiseVariables(double *states, double *rates, double *variables) states[1] = 0.0; } -void computeComputedConstants(double *variables) +void computeComputedConstants(double *computedConstants) { } diff --git a/tests/resources/generator/robertson_model_1966/model.dae.h b/tests/resources/generator/robertson_model_1966/model.dae.h index 3dcbda5b4e..e5229113ea 100644 --- a/tests/resources/generator/robertson_model_1966/model.dae.h +++ b/tests/resources/generator/robertson_model_1966/model.dae.h @@ -8,7 +8,9 @@ extern const char VERSION[]; extern const char LIBCELLML_VERSION[]; extern const size_t STATE_COUNT; -extern const size_t VARIABLE_COUNT; +extern const size_t CONSTANT_COUNT; +extern const size_t COMPUTED_CONSTANT_COUNT; +extern const size_t ALGEBRAIC_COUNT; typedef enum { VARIABLE_OF_INTEGRATION, @@ -34,6 +36,6 @@ double * createVariablesArray(); void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *variables); -void computeComputedConstants(double *variables); +void computeComputedConstants(double *computedConstants); void computeRates(double voi, double *states, double *rates, double *variables); void computeVariables(double voi, double *states, double *rates, double *variables); diff --git a/tests/resources/generator/robertson_model_1966/model.dae.py b/tests/resources/generator/robertson_model_1966/model.dae.py index 553cb6f9b0..9e6f0c27e1 100644 --- a/tests/resources/generator/robertson_model_1966/model.dae.py +++ b/tests/resources/generator/robertson_model_1966/model.dae.py @@ -8,7 +8,9 @@ LIBCELLML_VERSION = "0.5.0" STATE_COUNT = 2 -VARIABLE_COUNT = 5 +CONSTANT_COUNT = 0 +COMPUTED_CONSTANT_COUNT = 0 +ALGEBRAIC_COUNT = 5 class VariableType(Enum): @@ -76,7 +78,7 @@ def initialise_variables(states, rates, variables): states[1] = 0.0 -def compute_computed_constants(variables): +def compute_computed_constants(computed_constants): pass diff --git a/tests/resources/generator/robertson_model_1966/model.ode.c b/tests/resources/generator/robertson_model_1966/model.ode.c index 6d01ea6aea..56108226b9 100644 --- a/tests/resources/generator/robertson_model_1966/model.ode.c +++ b/tests/resources/generator/robertson_model_1966/model.ode.c @@ -9,7 +9,9 @@ const char VERSION[] = "0.5.0"; const char LIBCELLML_VERSION[] = "0.5.0"; const size_t STATE_COUNT = 3; -const size_t VARIABLE_COUNT = 4; +const size_t CONSTANT_COUNT = 0; +const size_t COMPUTED_CONSTANT_COUNT = 0; +const size_t ALGEBRAIC_COUNT = 4; const VariableInfo VOI_INFO = {"t", "dimensionless", "main", VARIABLE_OF_INTEGRATION}; @@ -63,7 +65,7 @@ void initialiseVariables(double *states, double *rates, double *variables) states[2] = 0.0; } -void computeComputedConstants(double *variables) +void computeComputedConstants(double *computedConstants) { } diff --git a/tests/resources/generator/robertson_model_1966/model.ode.h b/tests/resources/generator/robertson_model_1966/model.ode.h index 3dcbda5b4e..e5229113ea 100644 --- a/tests/resources/generator/robertson_model_1966/model.ode.h +++ b/tests/resources/generator/robertson_model_1966/model.ode.h @@ -8,7 +8,9 @@ extern const char VERSION[]; extern const char LIBCELLML_VERSION[]; extern const size_t STATE_COUNT; -extern const size_t VARIABLE_COUNT; +extern const size_t CONSTANT_COUNT; +extern const size_t COMPUTED_CONSTANT_COUNT; +extern const size_t ALGEBRAIC_COUNT; typedef enum { VARIABLE_OF_INTEGRATION, @@ -34,6 +36,6 @@ double * createVariablesArray(); void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *variables); -void computeComputedConstants(double *variables); +void computeComputedConstants(double *computedConstants); void computeRates(double voi, double *states, double *rates, double *variables); void computeVariables(double voi, double *states, double *rates, double *variables); diff --git a/tests/resources/generator/robertson_model_1966/model.ode.py b/tests/resources/generator/robertson_model_1966/model.ode.py index 3c0078a47e..0f7a9c0391 100644 --- a/tests/resources/generator/robertson_model_1966/model.ode.py +++ b/tests/resources/generator/robertson_model_1966/model.ode.py @@ -8,7 +8,9 @@ LIBCELLML_VERSION = "0.5.0" STATE_COUNT = 3 -VARIABLE_COUNT = 4 +CONSTANT_COUNT = 0 +COMPUTED_CONSTANT_COUNT = 0 +ALGEBRAIC_COUNT = 4 class VariableType(Enum): @@ -52,7 +54,7 @@ def initialise_variables(states, rates, variables): states[2] = 0.0 -def compute_computed_constants(variables): +def compute_computed_constants(computed_constants): pass diff --git a/tests/resources/generator/sine_model_imports/model.c b/tests/resources/generator/sine_model_imports/model.c index 9914549557..5dbedca639 100644 --- a/tests/resources/generator/sine_model_imports/model.c +++ b/tests/resources/generator/sine_model_imports/model.c @@ -9,7 +9,9 @@ const char VERSION[] = "0.5.0"; const char LIBCELLML_VERSION[] = "0.5.0"; const size_t STATE_COUNT = 1; -const size_t VARIABLE_COUNT = 10; +const size_t CONSTANT_COUNT = 0; +const size_t COMPUTED_CONSTANT_COUNT = 0; +const size_t ALGEBRAIC_COUNT = 10; const VariableInfo VOI_INFO = {"x", "dimensionless", "main", VARIABLE_OF_INTEGRATION}; @@ -69,7 +71,7 @@ void initialiseVariables(double *states, double *rates, double *variables) states[0] = variables[1]; } -void computeComputedConstants(double *variables) +void computeComputedConstants(double *computedConstants) { } diff --git a/tests/resources/generator/sine_model_imports/model.h b/tests/resources/generator/sine_model_imports/model.h index 58ad0cde86..442d67f1cf 100644 --- a/tests/resources/generator/sine_model_imports/model.h +++ b/tests/resources/generator/sine_model_imports/model.h @@ -8,7 +8,9 @@ extern const char VERSION[]; extern const char LIBCELLML_VERSION[]; extern const size_t STATE_COUNT; -extern const size_t VARIABLE_COUNT; +extern const size_t CONSTANT_COUNT; +extern const size_t COMPUTED_CONSTANT_COUNT; +extern const size_t ALGEBRAIC_COUNT; typedef enum { VARIABLE_OF_INTEGRATION, @@ -34,6 +36,6 @@ double * createVariablesArray(); void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *variables); -void computeComputedConstants(double *variables); +void computeComputedConstants(double *computedConstants); void computeRates(double voi, double *states, double *rates, double *variables); void computeVariables(double voi, double *states, double *rates, double *variables); diff --git a/tests/resources/generator/sine_model_imports/model.py b/tests/resources/generator/sine_model_imports/model.py index d2846546b0..0feacef131 100644 --- a/tests/resources/generator/sine_model_imports/model.py +++ b/tests/resources/generator/sine_model_imports/model.py @@ -8,7 +8,9 @@ LIBCELLML_VERSION = "0.5.0" STATE_COUNT = 1 -VARIABLE_COUNT = 10 +CONSTANT_COUNT = 0 +COMPUTED_CONSTANT_COUNT = 0 +ALGEBRAIC_COUNT = 10 class VariableType(Enum): @@ -62,7 +64,7 @@ def initialise_variables(states, rates, variables): states[0] = variables[1] -def compute_computed_constants(variables): +def compute_computed_constants(computed_constants): pass diff --git a/tests/resources/generator/unknown_variable_as_external_variable/model.c b/tests/resources/generator/unknown_variable_as_external_variable/model.c index 1dc61a8786..ccabbc6bb8 100644 --- a/tests/resources/generator/unknown_variable_as_external_variable/model.c +++ b/tests/resources/generator/unknown_variable_as_external_variable/model.c @@ -8,7 +8,9 @@ const char VERSION[] = "0.5.0"; const char LIBCELLML_VERSION[] = "0.5.0"; -const size_t VARIABLE_COUNT = 10; +const size_t CONSTANT_COUNT = 0; +const size_t COMPUTED_CONSTANT_COUNT = 0; +const size_t ALGEBRAIC_COUNT = 10; const VariableInfo VARIABLE_INFO[] = { {"v", "fmol_per_sec", "SLC_template3_ss", ALGEBRAIC}, @@ -52,7 +54,7 @@ void initialiseVariables(double *variables, ExternalVariable externalVariable) variables[9] = externalVariable(variables, 9); } -void computeComputedConstants(double *variables) +void computeComputedConstants(double *computedConstants) { } diff --git a/tests/resources/generator/unknown_variable_as_external_variable/model.h b/tests/resources/generator/unknown_variable_as_external_variable/model.h index 21c1b1569b..0673bd2f68 100644 --- a/tests/resources/generator/unknown_variable_as_external_variable/model.h +++ b/tests/resources/generator/unknown_variable_as_external_variable/model.h @@ -7,7 +7,9 @@ extern const char VERSION[]; extern const char LIBCELLML_VERSION[]; -extern const size_t VARIABLE_COUNT; +extern const size_t CONSTANT_COUNT; +extern const size_t COMPUTED_CONSTANT_COUNT; +extern const size_t ALGEBRAIC_COUNT; typedef enum { CONSTANT, @@ -31,5 +33,5 @@ void deleteArray(double *array); typedef double (* ExternalVariable)(double *variables, size_t index); void initialiseVariables(double *variables, ExternalVariable externalVariable); -void computeComputedConstants(double *variables); +void computeComputedConstants(double *computedConstants); void computeVariables(double *variables, ExternalVariable externalVariable); diff --git a/tests/resources/generator/unknown_variable_as_external_variable/model.py b/tests/resources/generator/unknown_variable_as_external_variable/model.py index 6557837966..90ace85bd2 100644 --- a/tests/resources/generator/unknown_variable_as_external_variable/model.py +++ b/tests/resources/generator/unknown_variable_as_external_variable/model.py @@ -7,7 +7,9 @@ __version__ = "0.4.0" LIBCELLML_VERSION = "0.5.0" -VARIABLE_COUNT = 10 +CONSTANT_COUNT = 0 +COMPUTED_CONSTANT_COUNT = 0 +ALGEBRAIC_COUNT = 10 class VariableType(Enum): @@ -47,7 +49,7 @@ def initialise_variables(variables, external_variable): variables[9] = external_variable(variables, 9) -def compute_computed_constants(variables): +def compute_computed_constants(computed_constants): pass diff --git a/tests/resources/generator/variable_initialised_using_a_constant/model.c b/tests/resources/generator/variable_initialised_using_a_constant/model.c index 63c674fd83..4f6983da4b 100644 --- a/tests/resources/generator/variable_initialised_using_a_constant/model.c +++ b/tests/resources/generator/variable_initialised_using_a_constant/model.c @@ -9,7 +9,9 @@ const char VERSION[] = "0.5.0"; const char LIBCELLML_VERSION[] = "0.5.0"; const size_t STATE_COUNT = 1; -const size_t VARIABLE_COUNT = 1; +const size_t CONSTANT_COUNT = 0; +const size_t COMPUTED_CONSTANT_COUNT = 0; +const size_t ALGEBRAIC_COUNT = 1; const VariableInfo VOI_INFO = {"t", "second", "component_1", VARIABLE_OF_INTEGRATION}; @@ -54,7 +56,7 @@ void initialiseVariables(double *states, double *rates, double *variables) states[0] = variables[0]; } -void computeComputedConstants(double *variables) +void computeComputedConstants(double *computedConstants) { } diff --git a/tests/resources/generator/variable_initialised_using_a_constant/model.h b/tests/resources/generator/variable_initialised_using_a_constant/model.h index caeedf9c64..4db60c5e23 100644 --- a/tests/resources/generator/variable_initialised_using_a_constant/model.h +++ b/tests/resources/generator/variable_initialised_using_a_constant/model.h @@ -8,7 +8,9 @@ extern const char VERSION[]; extern const char LIBCELLML_VERSION[]; extern const size_t STATE_COUNT; -extern const size_t VARIABLE_COUNT; +extern const size_t CONSTANT_COUNT; +extern const size_t COMPUTED_CONSTANT_COUNT; +extern const size_t ALGEBRAIC_COUNT; typedef enum { VARIABLE_OF_INTEGRATION, @@ -34,6 +36,6 @@ double * createVariablesArray(); void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *variables); -void computeComputedConstants(double *variables); +void computeComputedConstants(double *computedConstants); void computeRates(double voi, double *states, double *rates, double *variables); void computeVariables(double voi, double *states, double *rates, double *variables); diff --git a/tests/resources/generator/variable_initialised_using_a_constant/model.py b/tests/resources/generator/variable_initialised_using_a_constant/model.py index 4e53eb9454..929ca69ecf 100644 --- a/tests/resources/generator/variable_initialised_using_a_constant/model.py +++ b/tests/resources/generator/variable_initialised_using_a_constant/model.py @@ -8,7 +8,9 @@ LIBCELLML_VERSION = "0.5.0" STATE_COUNT = 1 -VARIABLE_COUNT = 1 +CONSTANT_COUNT = 0 +COMPUTED_CONSTANT_COUNT = 0 +ALGEBRAIC_COUNT = 1 class VariableType(Enum): @@ -43,7 +45,7 @@ def initialise_variables(states, rates, variables): states[0] = variables[0] -def compute_computed_constants(variables): +def compute_computed_constants(computed_constants): pass From 329b01f5e9573cd8f607bffd878bb600da3ba3cc Mon Sep 17 00:00:00 2001 From: Alan Garny Date: Wed, 7 Aug 2024 15:20:32 +0200 Subject: [PATCH 03/85] Generator: use different arrays for constants, computed constants, and algebraic variables for initialiseVariables(). --- src/generatorprofile.cpp | 24 +++++++++---------- src/generatorprofilesha1values.h | 4 ++-- .../bindings/python/test_generator_profile.py | 16 ++++++------- tests/generator/generatorprofile.cpp | 16 ++++++------- tests/resources/coverage/generator/model.c | 2 +- tests/resources/coverage/generator/model.h | 2 +- .../generator/model.implementation.out | 2 +- .../coverage/generator/model.interface.out | 2 +- .../generator/model.modified.profile.c | 2 +- .../generator/model.modified.profile.h | 2 +- .../generator/model.modified.profile.py | 2 +- tests/resources/coverage/generator/model.out | 2 +- tests/resources/coverage/generator/model.py | 2 +- .../algebraic_eqn_computed_var_on_rhs/model.c | 2 +- .../model.external.c | 2 +- .../model.external.h | 2 +- .../model.external.py | 2 +- .../algebraic_eqn_computed_var_on_rhs/model.h | 2 +- .../model.py | 2 +- .../algebraic_eqn_const_var_on_rhs/model.c | 2 +- .../algebraic_eqn_const_var_on_rhs/model.h | 2 +- .../algebraic_eqn_const_var_on_rhs/model.py | 2 +- .../algebraic_eqn_constant_on_rhs/model.c | 2 +- .../algebraic_eqn_constant_on_rhs/model.h | 2 +- .../algebraic_eqn_constant_on_rhs/model.py | 2 +- .../algebraic_eqn_derivative_on_rhs/model.c | 2 +- .../algebraic_eqn_derivative_on_rhs/model.h | 2 +- .../algebraic_eqn_derivative_on_rhs/model.py | 2 +- .../model.c | 2 +- .../model.h | 2 +- .../model.py | 2 +- .../algebraic_eqn_state_var_on_rhs/model.c | 2 +- .../algebraic_eqn_state_var_on_rhs/model.h | 2 +- .../algebraic_eqn_state_var_on_rhs/model.py | 2 +- .../model.c | 2 +- .../model.h | 2 +- .../model.py | 2 +- .../model.c | 2 +- .../model.external.c | 2 +- .../model.external.h | 2 +- .../model.external.py | 2 +- .../model.h | 2 +- .../model.py | 2 +- .../model.c | 2 +- .../model.h | 2 +- .../model.one.external.c | 2 +- .../model.one.external.h | 2 +- .../model.one.external.py | 2 +- .../model.py | 2 +- .../model.three.externals.c | 2 +- .../model.three.externals.h | 2 +- .../model.three.externals.py | 2 +- .../model.two.externals.c | 2 +- .../model.two.externals.h | 2 +- .../model.two.externals.py | 2 +- .../model.not.ordered.c | 2 +- .../model.not.ordered.h | 2 +- .../model.not.ordered.py | 2 +- .../model.ordered.c | 2 +- .../model.ordered.h | 2 +- .../model.ordered.py | 2 +- .../algebraic_unknown_var_on_rhs/model.c | 2 +- .../algebraic_unknown_var_on_rhs/model.h | 2 +- .../algebraic_unknown_var_on_rhs/model.py | 2 +- .../generator/cell_geometry_model/model.c | 2 +- .../cell_geometry_model/model.external.c | 2 +- .../cell_geometry_model/model.external.h | 2 +- .../cell_geometry_model/model.external.py | 2 +- .../generator/cell_geometry_model/model.h | 2 +- .../generator/cell_geometry_model/model.py | 2 +- .../model.c | 2 +- .../model.h | 2 +- .../model.py | 2 +- .../generator/cellml_slc_example/model.py | 2 +- .../model.c | 2 +- .../model.h | 2 +- .../model.py | 2 +- .../cellml_unit_scaling_constant/model.c | 2 +- .../cellml_unit_scaling_constant/model.h | 2 +- .../cellml_unit_scaling_constant/model.py | 2 +- .../cellml_unit_scaling_rate/model.c | 2 +- .../cellml_unit_scaling_rate/model.h | 2 +- .../cellml_unit_scaling_rate/model.py | 2 +- .../cellml_unit_scaling_state/model.c | 2 +- .../cellml_unit_scaling_state/model.h | 2 +- .../cellml_unit_scaling_state/model.py | 2 +- .../model.c | 2 +- .../model.h | 2 +- .../model.py | 2 +- .../model.c | 2 +- .../model.h | 2 +- .../model.py | 2 +- .../cellml_unit_scaling_voi_direct/model.c | 2 +- .../cellml_unit_scaling_voi_direct/model.h | 2 +- .../cellml_unit_scaling_voi_direct/model.py | 2 +- .../cellml_unit_scaling_voi_indirect/model.c | 2 +- .../cellml_unit_scaling_voi_indirect/model.h | 2 +- .../cellml_unit_scaling_voi_indirect/model.py | 2 +- .../generator/dae_cellml_1_1_model/model.c | 2 +- .../generator/dae_cellml_1_1_model/model.h | 2 +- .../generator/dae_cellml_1_1_model/model.py | 2 +- .../generator/dependent_eqns/model.c | 2 +- .../generator/dependent_eqns/model.h | 2 +- .../generator/dependent_eqns/model.py | 2 +- .../model.c | 2 +- .../model.h | 2 +- .../model.py | 2 +- .../model.c | 2 +- .../model.h | 2 +- .../model.py | 2 +- .../model.algebraic.c | 2 +- .../model.algebraic.h | 2 +- .../model.algebraic.py | 2 +- .../model.c | 2 +- .../model.computed.constant.c | 2 +- .../model.computed.constant.h | 2 +- .../model.computed.constant.py | 2 +- .../model.constant.c | 2 +- .../model.constant.h | 2 +- .../model.constant.py | 2 +- .../model.dae.c | 2 +- .../model.dae.h | 2 +- .../model.dae.py | 2 +- .../model.dependent.algebraic.c | 2 +- .../model.dependent.algebraic.h | 2 +- .../model.dependent.algebraic.py | 2 +- .../model.dependent.computed.constant.c | 2 +- .../model.dependent.computed.constant.h | 2 +- .../model.dependent.computed.constant.py | 2 +- .../model.dependent.constant.c | 2 +- .../model.dependent.constant.h | 2 +- .../model.dependent.constant.py | 2 +- .../model.dependent.state.c | 2 +- .../model.dependent.state.h | 2 +- .../model.dependent.state.py | 2 +- .../model.external.c | 2 +- .../model.external.h | 2 +- .../model.external.py | 2 +- .../model.h | 2 +- .../model.py | 2 +- .../model.state.c | 2 +- .../model.state.h | 2 +- .../model.state.py | 2 +- .../generator/noble_model_1962/model.c | 2 +- .../generator/noble_model_1962/model.h | 2 +- .../generator/noble_model_1962/model.py | 2 +- .../generator/ode_computed_var_on_rhs/model.c | 2 +- .../generator/ode_computed_var_on_rhs/model.h | 2 +- .../ode_computed_var_on_rhs/model.py | 2 +- .../model.c | 2 +- .../model.h | 2 +- .../model.py | 2 +- .../generator/ode_const_var_on_rhs/model.c | 2 +- .../generator/ode_const_var_on_rhs/model.h | 2 +- .../generator/ode_const_var_on_rhs/model.py | 2 +- .../model.c | 2 +- .../model.h | 2 +- .../model.py | 2 +- .../generator/ode_constant_on_rhs/model.c | 2 +- .../generator/ode_constant_on_rhs/model.h | 2 +- .../generator/ode_constant_on_rhs/model.py | 2 +- .../ode_constant_on_rhs_one_component/model.c | 2 +- .../ode_constant_on_rhs_one_component/model.h | 2 +- .../model.py | 2 +- .../ode_multiple_dependent_odes/model.c | 2 +- .../ode_multiple_dependent_odes/model.h | 2 +- .../ode_multiple_dependent_odes/model.py | 2 +- .../model.c | 2 +- .../model.h | 2 +- .../model.py | 2 +- .../ode_multiple_odes_with_same_name/model.c | 2 +- .../ode_multiple_odes_with_same_name/model.h | 2 +- .../ode_multiple_odes_with_same_name/model.py | 2 +- .../generator/ode_unknown_var_on_rhs/model.c | 2 +- .../generator/ode_unknown_var_on_rhs/model.h | 2 +- .../generator/ode_unknown_var_on_rhs/model.py | 2 +- .../robertson_model_1966/model.dae.c | 2 +- .../robertson_model_1966/model.dae.h | 2 +- .../robertson_model_1966/model.dae.py | 2 +- .../robertson_model_1966/model.ode.c | 2 +- .../robertson_model_1966/model.ode.h | 2 +- .../robertson_model_1966/model.ode.py | 2 +- .../generator/sine_model_imports/model.c | 2 +- .../generator/sine_model_imports/model.h | 2 +- .../generator/sine_model_imports/model.py | 2 +- .../model.c | 2 +- .../model.h | 2 +- .../model.py | 2 +- .../model.c | 2 +- .../model.h | 2 +- .../model.py | 2 +- 191 files changed, 217 insertions(+), 217 deletions(-) diff --git a/src/generatorprofile.cpp b/src/generatorprofile.cpp index 39fb8c39c4..f69e51b920 100644 --- a/src/generatorprofile.cpp +++ b/src/generatorprofile.cpp @@ -665,26 +665,26 @@ void GeneratorProfile::GeneratorProfileImpl::loadProfile(GeneratorProfile::Profi " free(array);\n" "}\n"; - mInterfaceInitialiseVariablesMethodFamWoevString = "void initialiseVariables(double *variables);\n"; - mImplementationInitialiseVariablesMethodFamWoevString = "void initialiseVariables(double *variables)\n" + mInterfaceInitialiseVariablesMethodFamWoevString = "void initialiseVariables(double *constants);\n"; + mImplementationInitialiseVariablesMethodFamWoevString = "void initialiseVariables(double *constants)\n" "{\n" "[CODE]" "}\n"; - mInterfaceInitialiseVariablesMethodFamWevString = "void initialiseVariables(double *variables, ExternalVariable externalVariable);\n"; - mImplementationInitialiseVariablesMethodFamWevString = "void initialiseVariables(double *variables, ExternalVariable externalVariable)\n" + mInterfaceInitialiseVariablesMethodFamWevString = "void initialiseVariables(double *constants, ExternalVariable externalVariable);\n"; + mImplementationInitialiseVariablesMethodFamWevString = "void initialiseVariables(double *constants, ExternalVariable externalVariable)\n" "{\n" "[CODE]" "}\n"; - mInterfaceInitialiseVariablesMethodFdmWoevString = "void initialiseVariables(double *states, double *rates, double *variables);\n"; - mImplementationInitialiseVariablesMethodFdmWoevString = "void initialiseVariables(double *states, double *rates, double *variables)\n" + mInterfaceInitialiseVariablesMethodFdmWoevString = "void initialiseVariables(double *states, double *rates, double *constants);\n"; + mImplementationInitialiseVariablesMethodFdmWoevString = "void initialiseVariables(double *states, double *rates, double *constants)\n" "{\n" "[CODE]" "}\n"; - mInterfaceInitialiseVariablesMethodFdmWevString = "void initialiseVariables(double voi, double *states, double *rates, double *variables, ExternalVariable externalVariable);\n"; - mImplementationInitialiseVariablesMethodFdmWevString = "void initialiseVariables(double voi, double *states, double *rates, double *variables, ExternalVariable externalVariable)\n" + mInterfaceInitialiseVariablesMethodFdmWevString = "void initialiseVariables(double voi, double *states, double *rates, double *constants, ExternalVariable externalVariable);\n"; + mImplementationInitialiseVariablesMethodFdmWevString = "void initialiseVariables(double voi, double *states, double *rates, double *constants, ExternalVariable externalVariable)\n" "{\n" "[CODE]" "}\n"; @@ -1072,22 +1072,22 @@ void GeneratorProfile::GeneratorProfileImpl::loadProfile(GeneratorProfile::Profi mInterfaceInitialiseVariablesMethodFamWoevString = ""; mImplementationInitialiseVariablesMethodFamWoevString = "\n" - "def initialise_variables(variables):\n" + "def initialise_variables(constants):\n" "[CODE]"; mInterfaceInitialiseVariablesMethodFamWevString = ""; mImplementationInitialiseVariablesMethodFamWevString = "\n" - "def initialise_variables(variables, external_variable):\n" + "def initialise_variables(constants, external_variable):\n" "[CODE]"; mInterfaceInitialiseVariablesMethodFdmWoevString = ""; mImplementationInitialiseVariablesMethodFdmWoevString = "\n" - "def initialise_variables(states, rates, variables):\n" + "def initialise_variables(states, rates, constants):\n" "[CODE]"; mInterfaceInitialiseVariablesMethodFdmWevString = ""; mImplementationInitialiseVariablesMethodFdmWevString = "\n" - "def initialise_variables(voi, states, rates, variables, external_variable):\n" + "def initialise_variables(voi, states, rates, constants, external_variable):\n" "[CODE]"; mInterfaceComputeComputedConstantsMethodString = ""; diff --git a/src/generatorprofilesha1values.h b/src/generatorprofilesha1values.h index e99328e5aa..8661315d27 100644 --- a/src/generatorprofilesha1values.h +++ b/src/generatorprofilesha1values.h @@ -24,7 +24,7 @@ namespace libcellml { * The content of this file is generated, do not edit this file directly. * See docs/dev_utilities.rst for further information. */ -static const char C_GENERATOR_PROFILE_SHA1[] = "9e017d3075c0036910fad2326986a996c466de5d"; -static const char PYTHON_GENERATOR_PROFILE_SHA1[] = "34bc02948f9f9939303facbb0a0c2b8428d4b4aa"; +static const char C_GENERATOR_PROFILE_SHA1[] = "12b8069d68c8c5ebe36b14a90c0bfb880d61b73d"; +static const char PYTHON_GENERATOR_PROFILE_SHA1[] = "ed70973a0cf394f386857d43bb4497b9b7f99e03"; } // namespace libcellml diff --git a/tests/bindings/python/test_generator_profile.py b/tests/bindings/python/test_generator_profile.py index a3bedd3a06..0d48a9a24d 100644 --- a/tests/bindings/python/test_generator_profile.py +++ b/tests/bindings/python/test_generator_profile.py @@ -859,22 +859,22 @@ def test_implementation_initialise_constants_method_string(self): g = GeneratorProfile() - self.assertEqual('void initialiseVariables(double *variables)\n{\n[CODE]}\n', + self.assertEqual('void initialiseVariables(double *constants)\n{\n[CODE]}\n', g.implementationInitialiseVariablesMethodString(False, False)) g.setImplementationInitialiseVariablesMethodString(False, False, GeneratorProfileTestCase.VALUE) self.assertEqual(GeneratorProfileTestCase.VALUE, g.implementationInitialiseVariablesMethodString(False, False)) - self.assertEqual('void initialiseVariables(double *variables, ExternalVariable externalVariable)\n{\n[CODE]}\n', + self.assertEqual('void initialiseVariables(double *constants, ExternalVariable externalVariable)\n{\n[CODE]}\n', g.implementationInitialiseVariablesMethodString(False, True)) g.setImplementationInitialiseVariablesMethodString(False, True, GeneratorProfileTestCase.VALUE) self.assertEqual(GeneratorProfileTestCase.VALUE, g.implementationInitialiseVariablesMethodString(False, True)) - self.assertEqual('void initialiseVariables(double *states, double *rates, double *variables)\n{\n[CODE]}\n', + self.assertEqual('void initialiseVariables(double *states, double *rates, double *constants)\n{\n[CODE]}\n', g.implementationInitialiseVariablesMethodString(True, False)) g.setImplementationInitialiseVariablesMethodString(True, False, GeneratorProfileTestCase.VALUE) self.assertEqual(GeneratorProfileTestCase.VALUE, g.implementationInitialiseVariablesMethodString(True, False)) - self.assertEqual('void initialiseVariables(double voi, double *states, double *rates, double *variables, ExternalVariable externalVariable)\n{\n[CODE]}\n', + self.assertEqual('void initialiseVariables(double voi, double *states, double *rates, double *constants, ExternalVariable externalVariable)\n{\n[CODE]}\n', g.implementationInitialiseVariablesMethodString(True, True)) g.setImplementationInitialiseVariablesMethodString(True, True, GeneratorProfileTestCase.VALUE) self.assertEqual(GeneratorProfileTestCase.VALUE, g.implementationInitialiseVariablesMethodString(True, True)) @@ -1086,22 +1086,22 @@ def test_interface_initialise_constants_method_string(self): g = GeneratorProfile() - self.assertEqual('void initialiseVariables(double *variables);\n', + self.assertEqual('void initialiseVariables(double *constants);\n', g.interfaceInitialiseVariablesMethodString(False, False)) g.setInterfaceInitialiseVariablesMethodString(False, False, GeneratorProfileTestCase.VALUE) self.assertEqual(GeneratorProfileTestCase.VALUE, g.interfaceInitialiseVariablesMethodString(False, False)) - self.assertEqual('void initialiseVariables(double *variables, ExternalVariable externalVariable);\n', + self.assertEqual('void initialiseVariables(double *constants, ExternalVariable externalVariable);\n', g.interfaceInitialiseVariablesMethodString(False, True)) g.setInterfaceInitialiseVariablesMethodString(False, True, GeneratorProfileTestCase.VALUE) self.assertEqual(GeneratorProfileTestCase.VALUE, g.interfaceInitialiseVariablesMethodString(False, True)) - self.assertEqual('void initialiseVariables(double *states, double *rates, double *variables);\n', + self.assertEqual('void initialiseVariables(double *states, double *rates, double *constants);\n', g.interfaceInitialiseVariablesMethodString(True, False)) g.setInterfaceInitialiseVariablesMethodString(True, False, GeneratorProfileTestCase.VALUE) self.assertEqual(GeneratorProfileTestCase.VALUE, g.interfaceInitialiseVariablesMethodString(True, False)) - self.assertEqual('void initialiseVariables(double voi, double *states, double *rates, double *variables, ExternalVariable externalVariable);\n', + self.assertEqual('void initialiseVariables(double voi, double *states, double *rates, double *constants, ExternalVariable externalVariable);\n', g.interfaceInitialiseVariablesMethodString(True, True)) g.setInterfaceInitialiseVariablesMethodString(True, True, GeneratorProfileTestCase.VALUE) self.assertEqual(GeneratorProfileTestCase.VALUE, g.interfaceInitialiseVariablesMethodString(True, True)) diff --git a/tests/generator/generatorprofile.cpp b/tests/generator/generatorprofile.cpp index 46c2850ec3..401b6ddddc 100644 --- a/tests/generator/generatorprofile.cpp +++ b/tests/generator/generatorprofile.cpp @@ -459,33 +459,33 @@ TEST(GeneratorProfile, defaultMiscellaneousValues) "}\n", generatorProfile->implementationDeleteArrayMethodString()); - EXPECT_EQ("void initialiseVariables(double *variables);\n", + EXPECT_EQ("void initialiseVariables(double *constants);\n", generatorProfile->interfaceInitialiseVariablesMethodString(false, false)); - EXPECT_EQ("void initialiseVariables(double *variables)\n" + EXPECT_EQ("void initialiseVariables(double *constants)\n" "{\n" "[CODE]" "}\n", generatorProfile->implementationInitialiseVariablesMethodString(false, false)); - EXPECT_EQ("void initialiseVariables(double *variables, ExternalVariable externalVariable);\n", + EXPECT_EQ("void initialiseVariables(double *constants, ExternalVariable externalVariable);\n", generatorProfile->interfaceInitialiseVariablesMethodString(false, true)); - EXPECT_EQ("void initialiseVariables(double *variables, ExternalVariable externalVariable)\n" + EXPECT_EQ("void initialiseVariables(double *constants, ExternalVariable externalVariable)\n" "{\n" "[CODE]" "}\n", generatorProfile->implementationInitialiseVariablesMethodString(false, true)); - EXPECT_EQ("void initialiseVariables(double *states, double *rates, double *variables);\n", + EXPECT_EQ("void initialiseVariables(double *states, double *rates, double *constants);\n", generatorProfile->interfaceInitialiseVariablesMethodString(true, false)); - EXPECT_EQ("void initialiseVariables(double *states, double *rates, double *variables)\n" + EXPECT_EQ("void initialiseVariables(double *states, double *rates, double *constants)\n" "{\n" "[CODE]" "}\n", generatorProfile->implementationInitialiseVariablesMethodString(true, false)); - EXPECT_EQ("void initialiseVariables(double voi, double *states, double *rates, double *variables, ExternalVariable externalVariable);\n", + EXPECT_EQ("void initialiseVariables(double voi, double *states, double *rates, double *constants, ExternalVariable externalVariable);\n", generatorProfile->interfaceInitialiseVariablesMethodString(true, true)); - EXPECT_EQ("void initialiseVariables(double voi, double *states, double *rates, double *variables, ExternalVariable externalVariable)\n" + EXPECT_EQ("void initialiseVariables(double voi, double *states, double *rates, double *constants, ExternalVariable externalVariable)\n" "{\n" "[CODE]" "}\n", diff --git a/tests/resources/coverage/generator/model.c b/tests/resources/coverage/generator/model.c index eb07d205f5..f42a715695 100644 --- a/tests/resources/coverage/generator/model.c +++ b/tests/resources/coverage/generator/model.c @@ -377,7 +377,7 @@ void findRoot0(double voi, double *states, double *rates, double *variables) variables[206] = u[1]; } -void initialiseVariables(double *states, double *rates, double *variables) +void initialiseVariables(double *states, double *rates, double *constants) { variables[1] = 1.0; variables[2] = 2.0; diff --git a/tests/resources/coverage/generator/model.h b/tests/resources/coverage/generator/model.h index 371d0cf0f3..33bedee9ef 100644 --- a/tests/resources/coverage/generator/model.h +++ b/tests/resources/coverage/generator/model.h @@ -35,7 +35,7 @@ double * createStatesArray(); double * createVariablesArray(); void deleteArray(double *array); -void initialiseVariables(double *states, double *rates, double *variables); +void initialiseVariables(double *states, double *rates, double *constants); void computeComputedConstants(double *computedConstants); void computeRates(double voi, double *states, double *rates, double *variables); void computeVariables(double voi, double *states, double *rates, double *variables); diff --git a/tests/resources/coverage/generator/model.implementation.out b/tests/resources/coverage/generator/model.implementation.out index ec60b6b08a..64b0e5915f 100644 --- a/tests/resources/coverage/generator/model.implementation.out +++ b/tests/resources/coverage/generator/model.implementation.out @@ -146,7 +146,7 @@ void findRoot0(double voi, double *states, double *rates, double *variables) variables[206] = u[1]; } -void initialiseVariables(double *states, double *rates, double *variables) +void initialiseVariables(double *states, double *rates, double *constants) { variables[1] = 1.0; variables[2] = 2.0; diff --git a/tests/resources/coverage/generator/model.interface.out b/tests/resources/coverage/generator/model.interface.out index 73818239f9..4efd4f2dff 100644 --- a/tests/resources/coverage/generator/model.interface.out +++ b/tests/resources/coverage/generator/model.interface.out @@ -8,7 +8,7 @@ double * createStatesArray(); double * createVariablesArray(); void deleteArray(double *array); -void initialiseVariables(double *states, double *rates, double *variables); +void initialiseVariables(double *states, double *rates, double *constants); void computeComputedConstants(double *computedConstants); void computeRates(double voi, double *states, double *rates, double *variables); void computeVariables(double voi, double *states, double *rates, double *variables); diff --git a/tests/resources/coverage/generator/model.modified.profile.c b/tests/resources/coverage/generator/model.modified.profile.c index 90dca2c5ad..105e8415b9 100644 --- a/tests/resources/coverage/generator/model.modified.profile.c +++ b/tests/resources/coverage/generator/model.modified.profile.c @@ -377,7 +377,7 @@ void findRoot0(double voi, double *states, double *rates, double *variables) variables[206] = u[1]; } -void initialiseVariables(double *states, double *rates, double *variables) +void initialiseVariables(double *states, double *rates, double *constants) { variables[1] = 1.0; variables[2] = 2.0; diff --git a/tests/resources/coverage/generator/model.modified.profile.h b/tests/resources/coverage/generator/model.modified.profile.h index 9466150a4d..15b44e7e6d 100644 --- a/tests/resources/coverage/generator/model.modified.profile.h +++ b/tests/resources/coverage/generator/model.modified.profile.h @@ -35,7 +35,7 @@ double * createStatesVector(); double * createVariablesArray(); void deleteArray(double *array); -void initialiseVariables(double *states, double *rates, double *variables); +void initialiseVariables(double *states, double *rates, double *constants); void computeComputedConstants(double *computedConstants); void computeRates(double voi, double *states, double *rates, double *variables); void computeVariables(double voi, double *states, double *rates, double *variables); diff --git a/tests/resources/coverage/generator/model.modified.profile.py b/tests/resources/coverage/generator/model.modified.profile.py index b14261b732..178219f7e3 100644 --- a/tests/resources/coverage/generator/model.modified.profile.py +++ b/tests/resources/coverage/generator/model.modified.profile.py @@ -378,7 +378,7 @@ def find_root_0(voi, states, rates, variables): variables[206] = u[1] -def initialise_variables(states, rates, variables): +def initialise_variables(states, rates, constants): variables[1] = 1.0 variables[2] = 2.0 variables[6] = 3.0 diff --git a/tests/resources/coverage/generator/model.out b/tests/resources/coverage/generator/model.out index a6f1743191..a8b63dc145 100644 --- a/tests/resources/coverage/generator/model.out +++ b/tests/resources/coverage/generator/model.out @@ -116,7 +116,7 @@ void findRoot0(double voi, double *states, double *rates, double *variables) variables[206] = u[1]; } -void initialiseVariables(double *states, double *rates, double *variables) +void initialiseVariables(double *states, double *rates, double *constants) { variables[1] = 1.0; variables[2] = 2.0; diff --git a/tests/resources/coverage/generator/model.py b/tests/resources/coverage/generator/model.py index 1f84e1dfc3..ef25765870 100644 --- a/tests/resources/coverage/generator/model.py +++ b/tests/resources/coverage/generator/model.py @@ -378,7 +378,7 @@ def find_root_0(voi, states, rates, variables): variables[206] = u[1] -def initialise_variables(states, rates, variables): +def initialise_variables(states, rates, constants): variables[1] = 1.0 variables[2] = 2.0 variables[6] = 3.0 diff --git a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.c b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.c index 546eab6c15..54cf101ec0 100644 --- a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.c +++ b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.c @@ -33,7 +33,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double *variables) +void initialiseVariables(double *constants) { variables[1] = 1.0; } diff --git a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.c b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.c index aea7852aa8..7cc4b66ed4 100644 --- a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.c +++ b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.c @@ -33,7 +33,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double *variables, ExternalVariable externalVariable) +void initialiseVariables(double *constants, ExternalVariable externalVariable) { variables[1] = externalVariable(variables, 1); } diff --git a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.h b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.h index e3fc1c9e33..4e430ed5cf 100644 --- a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.h +++ b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.h @@ -32,6 +32,6 @@ void deleteArray(double *array); typedef double (* ExternalVariable)(double *variables, size_t index); -void initialiseVariables(double *variables, ExternalVariable externalVariable); +void initialiseVariables(double *constants, ExternalVariable externalVariable); void computeComputedConstants(double *computedConstants); void computeVariables(double *variables, ExternalVariable externalVariable); diff --git a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.py b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.py index acf2568cf8..db4e1a2732 100644 --- a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.py +++ b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.py @@ -29,7 +29,7 @@ def create_variables_array(): return [nan]*VARIABLE_COUNT -def initialise_variables(variables, external_variable): +def initialise_variables(constants, external_variable): variables[1] = external_variable(variables, 1) diff --git a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.h b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.h index ccf06f8d41..7be31b5901 100644 --- a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.h +++ b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.h @@ -29,6 +29,6 @@ extern const VariableInfo VARIABLE_INFO[]; double * createVariablesArray(); void deleteArray(double *array); -void initialiseVariables(double *variables); +void initialiseVariables(double *constants); void computeComputedConstants(double *computedConstants); void computeVariables(double *variables); diff --git a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.py b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.py index 11a1d35654..f5a2420788 100644 --- a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.py +++ b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.py @@ -28,7 +28,7 @@ def create_variables_array(): return [nan]*VARIABLE_COUNT -def initialise_variables(variables): +def initialise_variables(constants): variables[1] = 1.0 diff --git a/tests/resources/generator/algebraic_eqn_const_var_on_rhs/model.c b/tests/resources/generator/algebraic_eqn_const_var_on_rhs/model.c index 98a5119e76..b3bebf874e 100644 --- a/tests/resources/generator/algebraic_eqn_const_var_on_rhs/model.c +++ b/tests/resources/generator/algebraic_eqn_const_var_on_rhs/model.c @@ -33,7 +33,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double *variables) +void initialiseVariables(double *constants) { variables[1] = 1.0; } diff --git a/tests/resources/generator/algebraic_eqn_const_var_on_rhs/model.h b/tests/resources/generator/algebraic_eqn_const_var_on_rhs/model.h index ccf06f8d41..7be31b5901 100644 --- a/tests/resources/generator/algebraic_eqn_const_var_on_rhs/model.h +++ b/tests/resources/generator/algebraic_eqn_const_var_on_rhs/model.h @@ -29,6 +29,6 @@ extern const VariableInfo VARIABLE_INFO[]; double * createVariablesArray(); void deleteArray(double *array); -void initialiseVariables(double *variables); +void initialiseVariables(double *constants); void computeComputedConstants(double *computedConstants); void computeVariables(double *variables); diff --git a/tests/resources/generator/algebraic_eqn_const_var_on_rhs/model.py b/tests/resources/generator/algebraic_eqn_const_var_on_rhs/model.py index 145fc08791..d9e835d39f 100644 --- a/tests/resources/generator/algebraic_eqn_const_var_on_rhs/model.py +++ b/tests/resources/generator/algebraic_eqn_const_var_on_rhs/model.py @@ -28,7 +28,7 @@ def create_variables_array(): return [nan]*VARIABLE_COUNT -def initialise_variables(variables): +def initialise_variables(constants): variables[1] = 1.0 diff --git a/tests/resources/generator/algebraic_eqn_constant_on_rhs/model.c b/tests/resources/generator/algebraic_eqn_constant_on_rhs/model.c index 23a92bc974..218da97664 100644 --- a/tests/resources/generator/algebraic_eqn_constant_on_rhs/model.c +++ b/tests/resources/generator/algebraic_eqn_constant_on_rhs/model.c @@ -32,7 +32,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double *variables) +void initialiseVariables(double *constants) { variables[0] = 1.0; } diff --git a/tests/resources/generator/algebraic_eqn_constant_on_rhs/model.h b/tests/resources/generator/algebraic_eqn_constant_on_rhs/model.h index 0ca7442cf0..230086c604 100644 --- a/tests/resources/generator/algebraic_eqn_constant_on_rhs/model.h +++ b/tests/resources/generator/algebraic_eqn_constant_on_rhs/model.h @@ -29,6 +29,6 @@ extern const VariableInfo VARIABLE_INFO[]; double * createVariablesArray(); void deleteArray(double *array); -void initialiseVariables(double *variables); +void initialiseVariables(double *constants); void computeComputedConstants(double *computedConstants); void computeVariables(double *variables); diff --git a/tests/resources/generator/algebraic_eqn_constant_on_rhs/model.py b/tests/resources/generator/algebraic_eqn_constant_on_rhs/model.py index f2c1b3fa71..a0f2837908 100644 --- a/tests/resources/generator/algebraic_eqn_constant_on_rhs/model.py +++ b/tests/resources/generator/algebraic_eqn_constant_on_rhs/model.py @@ -27,7 +27,7 @@ def create_variables_array(): return [nan]*VARIABLE_COUNT -def initialise_variables(variables): +def initialise_variables(constants): variables[0] = 1.0 diff --git a/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.c b/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.c index 513c8f0a9e..72996b13ea 100644 --- a/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.c +++ b/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.c @@ -51,7 +51,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double *states, double *rates, double *variables) +void initialiseVariables(double *states, double *rates, double *constants) { variables[0] = 1.0; states[0] = 1.0; diff --git a/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.h b/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.h index ee190e0f53..b7c0c64e35 100644 --- a/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.h +++ b/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.h @@ -35,7 +35,7 @@ double * createStatesArray(); double * createVariablesArray(); void deleteArray(double *array); -void initialiseVariables(double *states, double *rates, double *variables); +void initialiseVariables(double *states, double *rates, double *constants); void computeComputedConstants(double *computedConstants); void computeRates(double voi, double *states, double *rates, double *variables); void computeVariables(double voi, double *states, double *rates, double *variables); diff --git a/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.py b/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.py index d6dfe896a6..a7ae59d7c6 100644 --- a/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.py +++ b/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.py @@ -41,7 +41,7 @@ def create_variables_array(): return [nan]*VARIABLE_COUNT -def initialise_variables(states, rates, variables): +def initialise_variables(states, rates, constants): variables[0] = 1.0 states[0] = 1.0 diff --git a/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.c b/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.c index eba334d859..600e336508 100644 --- a/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.c +++ b/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.c @@ -51,7 +51,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double *states, double *rates, double *variables) +void initialiseVariables(double *states, double *rates, double *constants) { variables[0] = 1.0; states[0] = 1.0; diff --git a/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.h b/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.h index d1084de7ab..be002fd715 100644 --- a/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.h +++ b/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.h @@ -35,7 +35,7 @@ double * createStatesArray(); double * createVariablesArray(); void deleteArray(double *array); -void initialiseVariables(double *states, double *rates, double *variables); +void initialiseVariables(double *states, double *rates, double *constants); void computeComputedConstants(double *computedConstants); void computeRates(double voi, double *states, double *rates, double *variables); void computeVariables(double voi, double *states, double *rates, double *variables); diff --git a/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.py b/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.py index 506f622845..546587aa93 100644 --- a/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.py +++ b/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.py @@ -41,7 +41,7 @@ def create_variables_array(): return [nan]*VARIABLE_COUNT -def initialise_variables(states, rates, variables): +def initialise_variables(states, rates, constants): variables[0] = 1.0 states[0] = 1.0 diff --git a/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.c b/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.c index 81ab0a6dc7..55b34a5167 100644 --- a/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.c +++ b/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.c @@ -51,7 +51,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double *states, double *rates, double *variables) +void initialiseVariables(double *states, double *rates, double *constants) { variables[0] = 1.0; states[0] = 1.0; diff --git a/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.h b/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.h index 8b5e1fc7f3..e1313e3957 100644 --- a/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.h +++ b/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.h @@ -35,7 +35,7 @@ double * createStatesArray(); double * createVariablesArray(); void deleteArray(double *array); -void initialiseVariables(double *states, double *rates, double *variables); +void initialiseVariables(double *states, double *rates, double *constants); void computeComputedConstants(double *computedConstants); void computeRates(double voi, double *states, double *rates, double *variables); void computeVariables(double voi, double *states, double *rates, double *variables); diff --git a/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.py b/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.py index 945c837bd4..6ea7c7cd78 100644 --- a/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.py +++ b/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.py @@ -41,7 +41,7 @@ def create_variables_array(): return [nan]*VARIABLE_COUNT -def initialise_variables(states, rates, variables): +def initialise_variables(states, rates, constants): variables[0] = 1.0 states[0] = 1.0 diff --git a/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.c b/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.c index e79a9e6964..03905f2818 100644 --- a/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.c +++ b/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.c @@ -51,7 +51,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double *states, double *rates, double *variables) +void initialiseVariables(double *states, double *rates, double *constants) { variables[0] = 1.0; states[0] = 1.0; diff --git a/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.h b/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.h index e6c0ef1cc1..90ebf612d7 100644 --- a/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.h +++ b/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.h @@ -35,7 +35,7 @@ double * createStatesArray(); double * createVariablesArray(); void deleteArray(double *array); -void initialiseVariables(double *states, double *rates, double *variables); +void initialiseVariables(double *states, double *rates, double *constants); void computeComputedConstants(double *computedConstants); void computeRates(double voi, double *states, double *rates, double *variables); void computeVariables(double voi, double *states, double *rates, double *variables); diff --git a/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.py b/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.py index 6991739626..866f33265e 100644 --- a/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.py +++ b/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.py @@ -41,7 +41,7 @@ def create_variables_array(): return [nan]*VARIABLE_COUNT -def initialise_variables(states, rates, variables): +def initialise_variables(states, rates, constants): variables[0] = 1.0 states[0] = 1.0 diff --git a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.c b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.c index c7cae1bd4b..fdf043a001 100644 --- a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.c +++ b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.c @@ -63,7 +63,7 @@ void findRoot0(double *variables) variables[3] = u[0]; } -void initialiseVariables(double *variables) +void initialiseVariables(double *constants) { variables[3] = 1.0; variables[0] = 3.0; diff --git a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.c b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.c index 406e43a244..300066fb2f 100644 --- a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.c +++ b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.c @@ -35,7 +35,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double *variables, ExternalVariable externalVariable) +void initialiseVariables(double *constants, ExternalVariable externalVariable) { variables[0] = 3.0; variables[1] = 5.0; diff --git a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.h b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.h index e3fc1c9e33..4e430ed5cf 100644 --- a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.h +++ b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.h @@ -32,6 +32,6 @@ void deleteArray(double *array); typedef double (* ExternalVariable)(double *variables, size_t index); -void initialiseVariables(double *variables, ExternalVariable externalVariable); +void initialiseVariables(double *constants, ExternalVariable externalVariable); void computeComputedConstants(double *computedConstants); void computeVariables(double *variables, ExternalVariable externalVariable); diff --git a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.py b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.py index 52f6a82aa5..2f516f834c 100644 --- a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.py +++ b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.py @@ -31,7 +31,7 @@ def create_variables_array(): return [nan]*VARIABLE_COUNT -def initialise_variables(variables, external_variable): +def initialise_variables(constants, external_variable): variables[0] = 3.0 variables[1] = 5.0 variables[2] = 7.0 diff --git a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.h b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.h index ccf06f8d41..7be31b5901 100644 --- a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.h +++ b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.h @@ -29,6 +29,6 @@ extern const VariableInfo VARIABLE_INFO[]; double * createVariablesArray(); void deleteArray(double *array); -void initialiseVariables(double *variables); +void initialiseVariables(double *constants); void computeComputedConstants(double *computedConstants); void computeVariables(double *variables); diff --git a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.py b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.py index e64d422e57..3f07e38d57 100644 --- a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.py +++ b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.py @@ -51,7 +51,7 @@ def find_root_0(variables): variables[3] = u[0] -def initialise_variables(variables): +def initialise_variables(constants): variables[3] = 1.0 variables[0] = 3.0 variables[1] = 5.0 diff --git a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.c b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.c index 0e950fa1f6..3f08eb3638 100644 --- a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.c +++ b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.c @@ -70,7 +70,7 @@ void findRoot0(double *variables) variables[2] = u[2]; } -void initialiseVariables(double *variables) +void initialiseVariables(double *constants) { variables[0] = 1.0; variables[1] = 1.0; diff --git a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.h b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.h index d09497bd09..95cddbeb4b 100644 --- a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.h +++ b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.h @@ -29,6 +29,6 @@ extern const VariableInfo VARIABLE_INFO[]; double * createVariablesArray(); void deleteArray(double *array); -void initialiseVariables(double *variables); +void initialiseVariables(double *constants); void computeComputedConstants(double *computedConstants); void computeVariables(double *variables); diff --git a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.one.external.c b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.one.external.c index e722bff088..379ddae4ea 100644 --- a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.one.external.c +++ b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.one.external.c @@ -67,7 +67,7 @@ void findRoot0(double *variables) variables[2] = u[1]; } -void initialiseVariables(double *variables, ExternalVariable externalVariable) +void initialiseVariables(double *constants, ExternalVariable externalVariable) { variables[1] = 1.0; variables[2] = 1.0; diff --git a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.one.external.h b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.one.external.h index e1fdbe0980..df0655d6fb 100644 --- a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.one.external.h +++ b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.one.external.h @@ -32,6 +32,6 @@ void deleteArray(double *array); typedef double (* ExternalVariable)(double *variables, size_t index); -void initialiseVariables(double *variables, ExternalVariable externalVariable); +void initialiseVariables(double *constants, ExternalVariable externalVariable); void computeComputedConstants(double *computedConstants); void computeVariables(double *variables, ExternalVariable externalVariable); diff --git a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.one.external.py b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.one.external.py index 89a57c41c2..d51f24510e 100644 --- a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.one.external.py +++ b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.one.external.py @@ -56,7 +56,7 @@ def find_root_0(variables): variables[2] = u[1] -def initialise_variables(variables, external_variable): +def initialise_variables(constants, external_variable): variables[1] = 1.0 variables[2] = 1.0 variables[0] = external_variable(variables, 0) diff --git a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.py b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.py index 9125b7c1db..ad98c51d75 100644 --- a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.py +++ b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.py @@ -58,7 +58,7 @@ def find_root_0(variables): variables[2] = u[2] -def initialise_variables(variables): +def initialise_variables(constants): variables[0] = 1.0 variables[1] = 1.0 variables[2] = 1.0 diff --git a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.c b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.c index a5ec7515f2..7cbf8256ae 100644 --- a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.c +++ b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.c @@ -34,7 +34,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double *variables, ExternalVariable externalVariable) +void initialiseVariables(double *constants, ExternalVariable externalVariable) { variables[0] = externalVariable(variables, 0); variables[1] = externalVariable(variables, 1); diff --git a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.h b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.h index e1fdbe0980..df0655d6fb 100644 --- a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.h +++ b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.h @@ -32,6 +32,6 @@ void deleteArray(double *array); typedef double (* ExternalVariable)(double *variables, size_t index); -void initialiseVariables(double *variables, ExternalVariable externalVariable); +void initialiseVariables(double *constants, ExternalVariable externalVariable); void computeComputedConstants(double *computedConstants); void computeVariables(double *variables, ExternalVariable externalVariable); diff --git a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.py b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.py index 2dde0e0323..bf285d55d8 100644 --- a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.py +++ b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.py @@ -30,7 +30,7 @@ def create_variables_array(): return [nan]*VARIABLE_COUNT -def initialise_variables(variables, external_variable): +def initialise_variables(constants, external_variable): variables[0] = external_variable(variables, 0) variables[1] = external_variable(variables, 1) variables[2] = external_variable(variables, 2) diff --git a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.two.externals.c b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.two.externals.c index b4213f7a30..9be838cc48 100644 --- a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.two.externals.c +++ b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.two.externals.c @@ -104,7 +104,7 @@ void findRoot2(double *variables) variables[1] = u[0]; } -void initialiseVariables(double *variables, ExternalVariable externalVariable) +void initialiseVariables(double *constants, ExternalVariable externalVariable) { variables[1] = 1.0; variables[0] = externalVariable(variables, 0); diff --git a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.two.externals.h b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.two.externals.h index e1fdbe0980..df0655d6fb 100644 --- a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.two.externals.h +++ b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.two.externals.h @@ -32,6 +32,6 @@ void deleteArray(double *array); typedef double (* ExternalVariable)(double *variables, size_t index); -void initialiseVariables(double *variables, ExternalVariable externalVariable); +void initialiseVariables(double *constants, ExternalVariable externalVariable); void computeComputedConstants(double *computedConstants); void computeVariables(double *variables, ExternalVariable externalVariable); diff --git a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.two.externals.py b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.two.externals.py index d18695e148..2001d60800 100644 --- a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.two.externals.py +++ b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.two.externals.py @@ -87,7 +87,7 @@ def find_root_2(variables): variables[1] = u[0] -def initialise_variables(variables, external_variable): +def initialise_variables(constants, external_variable): variables[1] = 1.0 variables[0] = external_variable(variables, 0) variables[2] = external_variable(variables, 2) diff --git a/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.c b/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.c index 002200921c..fc31362799 100644 --- a/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.c +++ b/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.c @@ -69,7 +69,7 @@ void findRoot0(double *variables) variables[1] = u[1]; } -void initialiseVariables(double *variables) +void initialiseVariables(double *constants) { variables[1] = 1.0; variables[2] = 1.0; diff --git a/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.h b/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.h index d09497bd09..95cddbeb4b 100644 --- a/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.h +++ b/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.h @@ -29,6 +29,6 @@ extern const VariableInfo VARIABLE_INFO[]; double * createVariablesArray(); void deleteArray(double *array); -void initialiseVariables(double *variables); +void initialiseVariables(double *constants); void computeComputedConstants(double *computedConstants); void computeVariables(double *variables); diff --git a/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.py b/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.py index 5b34036e40..389dbfc4db 100644 --- a/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.py +++ b/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.py @@ -57,7 +57,7 @@ def find_root_0(variables): variables[1] = u[1] -def initialise_variables(variables): +def initialise_variables(constants): variables[1] = 1.0 variables[2] = 1.0 variables[4] = 3.0 diff --git a/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.c b/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.c index 7ee14bfeb3..35fe86e31b 100644 --- a/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.c +++ b/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.c @@ -69,7 +69,7 @@ void findRoot0(double *variables) variables[4] = u[1]; } -void initialiseVariables(double *variables) +void initialiseVariables(double *constants) { variables[1] = 3.0; variables[2] = 5.0; diff --git a/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.h b/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.h index d09497bd09..95cddbeb4b 100644 --- a/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.h +++ b/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.h @@ -29,6 +29,6 @@ extern const VariableInfo VARIABLE_INFO[]; double * createVariablesArray(); void deleteArray(double *array); -void initialiseVariables(double *variables); +void initialiseVariables(double *constants); void computeComputedConstants(double *computedConstants); void computeVariables(double *variables); diff --git a/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.py b/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.py index 640f553c3c..ec5c0bbf2a 100644 --- a/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.py +++ b/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.py @@ -57,7 +57,7 @@ def find_root_0(variables): variables[4] = u[1] -def initialise_variables(variables): +def initialise_variables(constants): variables[1] = 3.0 variables[2] = 5.0 variables[3] = 1.0 diff --git a/tests/resources/generator/algebraic_unknown_var_on_rhs/model.c b/tests/resources/generator/algebraic_unknown_var_on_rhs/model.c index 7991acc69d..e02a8b1421 100644 --- a/tests/resources/generator/algebraic_unknown_var_on_rhs/model.c +++ b/tests/resources/generator/algebraic_unknown_var_on_rhs/model.c @@ -33,7 +33,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double *variables) +void initialiseVariables(double *constants) { variables[0] = 1.0; } diff --git a/tests/resources/generator/algebraic_unknown_var_on_rhs/model.h b/tests/resources/generator/algebraic_unknown_var_on_rhs/model.h index 0ca7442cf0..230086c604 100644 --- a/tests/resources/generator/algebraic_unknown_var_on_rhs/model.h +++ b/tests/resources/generator/algebraic_unknown_var_on_rhs/model.h @@ -29,6 +29,6 @@ extern const VariableInfo VARIABLE_INFO[]; double * createVariablesArray(); void deleteArray(double *array); -void initialiseVariables(double *variables); +void initialiseVariables(double *constants); void computeComputedConstants(double *computedConstants); void computeVariables(double *variables); diff --git a/tests/resources/generator/algebraic_unknown_var_on_rhs/model.py b/tests/resources/generator/algebraic_unknown_var_on_rhs/model.py index a7b0a114c2..a273db38c4 100644 --- a/tests/resources/generator/algebraic_unknown_var_on_rhs/model.py +++ b/tests/resources/generator/algebraic_unknown_var_on_rhs/model.py @@ -28,7 +28,7 @@ def create_variables_array(): return [nan]*VARIABLE_COUNT -def initialise_variables(variables): +def initialise_variables(constants): variables[0] = 1.0 diff --git a/tests/resources/generator/cell_geometry_model/model.c b/tests/resources/generator/cell_geometry_model/model.c index 02f1470c4b..b69bd0e05c 100644 --- a/tests/resources/generator/cell_geometry_model/model.c +++ b/tests/resources/generator/cell_geometry_model/model.c @@ -35,7 +35,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double *variables) +void initialiseVariables(double *constants) { variables[1] = 0.01; variables[2] = 0.0011; diff --git a/tests/resources/generator/cell_geometry_model/model.external.c b/tests/resources/generator/cell_geometry_model/model.external.c index 23c8e5b5b7..3ceea7e7a7 100644 --- a/tests/resources/generator/cell_geometry_model/model.external.c +++ b/tests/resources/generator/cell_geometry_model/model.external.c @@ -35,7 +35,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double *variables, ExternalVariable externalVariable) +void initialiseVariables(double *constants, ExternalVariable externalVariable) { variables[1] = externalVariable(variables, 1); variables[2] = externalVariable(variables, 2); diff --git a/tests/resources/generator/cell_geometry_model/model.external.h b/tests/resources/generator/cell_geometry_model/model.external.h index be4c0a8329..86e769ee4e 100644 --- a/tests/resources/generator/cell_geometry_model/model.external.h +++ b/tests/resources/generator/cell_geometry_model/model.external.h @@ -32,6 +32,6 @@ void deleteArray(double *array); typedef double (* ExternalVariable)(double *variables, size_t index); -void initialiseVariables(double *variables, ExternalVariable externalVariable); +void initialiseVariables(double *constants, ExternalVariable externalVariable); void computeComputedConstants(double *computedConstants); void computeVariables(double *variables, ExternalVariable externalVariable); diff --git a/tests/resources/generator/cell_geometry_model/model.external.py b/tests/resources/generator/cell_geometry_model/model.external.py index 741f7235d6..3d69c78eda 100644 --- a/tests/resources/generator/cell_geometry_model/model.external.py +++ b/tests/resources/generator/cell_geometry_model/model.external.py @@ -31,7 +31,7 @@ def create_variables_array(): return [nan]*VARIABLE_COUNT -def initialise_variables(variables, external_variable): +def initialise_variables(constants, external_variable): variables[1] = external_variable(variables, 1) variables[2] = external_variable(variables, 2) diff --git a/tests/resources/generator/cell_geometry_model/model.h b/tests/resources/generator/cell_geometry_model/model.h index 2eeadc793f..882e0d6ab7 100644 --- a/tests/resources/generator/cell_geometry_model/model.h +++ b/tests/resources/generator/cell_geometry_model/model.h @@ -29,6 +29,6 @@ extern const VariableInfo VARIABLE_INFO[]; double * createVariablesArray(); void deleteArray(double *array); -void initialiseVariables(double *variables); +void initialiseVariables(double *constants); void computeComputedConstants(double *computedConstants); void computeVariables(double *variables); diff --git a/tests/resources/generator/cell_geometry_model/model.py b/tests/resources/generator/cell_geometry_model/model.py index b6844d13fd..48ad53c10f 100644 --- a/tests/resources/generator/cell_geometry_model/model.py +++ b/tests/resources/generator/cell_geometry_model/model.py @@ -30,7 +30,7 @@ def create_variables_array(): return [nan]*VARIABLE_COUNT -def initialise_variables(variables): +def initialise_variables(constants): variables[1] = 0.01 variables[2] = 0.0011 diff --git a/tests/resources/generator/cellml_mappings_and_encapsulations/model.c b/tests/resources/generator/cellml_mappings_and_encapsulations/model.c index 70dec9ba69..cf7fe6f05b 100644 --- a/tests/resources/generator/cellml_mappings_and_encapsulations/model.c +++ b/tests/resources/generator/cellml_mappings_and_encapsulations/model.c @@ -52,7 +52,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double *states, double *rates, double *variables) +void initialiseVariables(double *states, double *rates, double *constants) { states[0] = 1.0; states[1] = 0.0; diff --git a/tests/resources/generator/cellml_mappings_and_encapsulations/model.h b/tests/resources/generator/cellml_mappings_and_encapsulations/model.h index 5127bc9de5..714fa4d81f 100644 --- a/tests/resources/generator/cellml_mappings_and_encapsulations/model.h +++ b/tests/resources/generator/cellml_mappings_and_encapsulations/model.h @@ -35,7 +35,7 @@ double * createStatesArray(); double * createVariablesArray(); void deleteArray(double *array); -void initialiseVariables(double *states, double *rates, double *variables); +void initialiseVariables(double *states, double *rates, double *constants); void computeComputedConstants(double *computedConstants); void computeRates(double voi, double *states, double *rates, double *variables); void computeVariables(double voi, double *states, double *rates, double *variables); diff --git a/tests/resources/generator/cellml_mappings_and_encapsulations/model.py b/tests/resources/generator/cellml_mappings_and_encapsulations/model.py index ed00088c54..c45ea5a1c1 100644 --- a/tests/resources/generator/cellml_mappings_and_encapsulations/model.py +++ b/tests/resources/generator/cellml_mappings_and_encapsulations/model.py @@ -42,7 +42,7 @@ def create_variables_array(): return [nan]*VARIABLE_COUNT -def initialise_variables(states, rates, variables): +def initialise_variables(states, rates, constants): states[0] = 1.0 states[1] = 0.0 diff --git a/tests/resources/generator/cellml_slc_example/model.py b/tests/resources/generator/cellml_slc_example/model.py index 657ee35e49..4afceca0c5 100644 --- a/tests/resources/generator/cellml_slc_example/model.py +++ b/tests/resources/generator/cellml_slc_example/model.py @@ -36,7 +36,7 @@ def create_variables_array(): return [nan]*VARIABLE_COUNT -def initialise_variables(variables): +def initialise_variables(constants): variables[1] = 1.1 variables[2] = 21262500.0 variables[3] = 150.0 diff --git a/tests/resources/generator/cellml_state_initialised_using_variable/model.c b/tests/resources/generator/cellml_state_initialised_using_variable/model.c index 67bf67f149..ba79edb18d 100644 --- a/tests/resources/generator/cellml_state_initialised_using_variable/model.c +++ b/tests/resources/generator/cellml_state_initialised_using_variable/model.c @@ -50,7 +50,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double *states, double *rates, double *variables) +void initialiseVariables(double *states, double *rates, double *constants) { variables[0] = 123.0; states[0] = variables[0]; diff --git a/tests/resources/generator/cellml_state_initialised_using_variable/model.h b/tests/resources/generator/cellml_state_initialised_using_variable/model.h index 353681ed98..3140db530e 100644 --- a/tests/resources/generator/cellml_state_initialised_using_variable/model.h +++ b/tests/resources/generator/cellml_state_initialised_using_variable/model.h @@ -35,7 +35,7 @@ double * createStatesArray(); double * createVariablesArray(); void deleteArray(double *array); -void initialiseVariables(double *states, double *rates, double *variables); +void initialiseVariables(double *states, double *rates, double *constants); void computeComputedConstants(double *computedConstants); void computeRates(double voi, double *states, double *rates, double *variables); void computeVariables(double voi, double *states, double *rates, double *variables); diff --git a/tests/resources/generator/cellml_state_initialised_using_variable/model.py b/tests/resources/generator/cellml_state_initialised_using_variable/model.py index ee8ef14789..690365c51a 100644 --- a/tests/resources/generator/cellml_state_initialised_using_variable/model.py +++ b/tests/resources/generator/cellml_state_initialised_using_variable/model.py @@ -40,7 +40,7 @@ def create_variables_array(): return [nan]*VARIABLE_COUNT -def initialise_variables(states, rates, variables): +def initialise_variables(states, rates, constants): variables[0] = 123.0 states[0] = variables[0] diff --git a/tests/resources/generator/cellml_unit_scaling_constant/model.c b/tests/resources/generator/cellml_unit_scaling_constant/model.c index 9131b2ba14..790526d9ca 100644 --- a/tests/resources/generator/cellml_unit_scaling_constant/model.c +++ b/tests/resources/generator/cellml_unit_scaling_constant/model.c @@ -34,7 +34,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double *variables) +void initialiseVariables(double *constants) { variables[0] = 123.0; } diff --git a/tests/resources/generator/cellml_unit_scaling_constant/model.h b/tests/resources/generator/cellml_unit_scaling_constant/model.h index 7d11520a14..5499853e34 100644 --- a/tests/resources/generator/cellml_unit_scaling_constant/model.h +++ b/tests/resources/generator/cellml_unit_scaling_constant/model.h @@ -29,6 +29,6 @@ extern const VariableInfo VARIABLE_INFO[]; double * createVariablesArray(); void deleteArray(double *array); -void initialiseVariables(double *variables); +void initialiseVariables(double *constants); void computeComputedConstants(double *computedConstants); void computeVariables(double *variables); diff --git a/tests/resources/generator/cellml_unit_scaling_constant/model.py b/tests/resources/generator/cellml_unit_scaling_constant/model.py index 2380d4c77d..7a674f9014 100644 --- a/tests/resources/generator/cellml_unit_scaling_constant/model.py +++ b/tests/resources/generator/cellml_unit_scaling_constant/model.py @@ -29,7 +29,7 @@ def create_variables_array(): return [nan]*VARIABLE_COUNT -def initialise_variables(variables): +def initialise_variables(constants): variables[0] = 123.0 diff --git a/tests/resources/generator/cellml_unit_scaling_rate/model.c b/tests/resources/generator/cellml_unit_scaling_rate/model.c index 48c0c0e0c1..78c1c72529 100644 --- a/tests/resources/generator/cellml_unit_scaling_rate/model.c +++ b/tests/resources/generator/cellml_unit_scaling_rate/model.c @@ -51,7 +51,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double *states, double *rates, double *variables) +void initialiseVariables(double *states, double *rates, double *constants) { states[0] = 123.0; } diff --git a/tests/resources/generator/cellml_unit_scaling_rate/model.h b/tests/resources/generator/cellml_unit_scaling_rate/model.h index 353681ed98..3140db530e 100644 --- a/tests/resources/generator/cellml_unit_scaling_rate/model.h +++ b/tests/resources/generator/cellml_unit_scaling_rate/model.h @@ -35,7 +35,7 @@ double * createStatesArray(); double * createVariablesArray(); void deleteArray(double *array); -void initialiseVariables(double *states, double *rates, double *variables); +void initialiseVariables(double *states, double *rates, double *constants); void computeComputedConstants(double *computedConstants); void computeRates(double voi, double *states, double *rates, double *variables); void computeVariables(double voi, double *states, double *rates, double *variables); diff --git a/tests/resources/generator/cellml_unit_scaling_rate/model.py b/tests/resources/generator/cellml_unit_scaling_rate/model.py index 99005d82b7..ed0b68c4d9 100644 --- a/tests/resources/generator/cellml_unit_scaling_rate/model.py +++ b/tests/resources/generator/cellml_unit_scaling_rate/model.py @@ -41,7 +41,7 @@ def create_variables_array(): return [nan]*VARIABLE_COUNT -def initialise_variables(states, rates, variables): +def initialise_variables(states, rates, constants): states[0] = 123.0 diff --git a/tests/resources/generator/cellml_unit_scaling_state/model.c b/tests/resources/generator/cellml_unit_scaling_state/model.c index 1e434a6242..633c056f53 100644 --- a/tests/resources/generator/cellml_unit_scaling_state/model.c +++ b/tests/resources/generator/cellml_unit_scaling_state/model.c @@ -51,7 +51,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double *states, double *rates, double *variables) +void initialiseVariables(double *states, double *rates, double *constants) { states[0] = 123.0; } diff --git a/tests/resources/generator/cellml_unit_scaling_state/model.h b/tests/resources/generator/cellml_unit_scaling_state/model.h index 353681ed98..3140db530e 100644 --- a/tests/resources/generator/cellml_unit_scaling_state/model.h +++ b/tests/resources/generator/cellml_unit_scaling_state/model.h @@ -35,7 +35,7 @@ double * createStatesArray(); double * createVariablesArray(); void deleteArray(double *array); -void initialiseVariables(double *states, double *rates, double *variables); +void initialiseVariables(double *states, double *rates, double *constants); void computeComputedConstants(double *computedConstants); void computeRates(double voi, double *states, double *rates, double *variables); void computeVariables(double voi, double *states, double *rates, double *variables); diff --git a/tests/resources/generator/cellml_unit_scaling_state/model.py b/tests/resources/generator/cellml_unit_scaling_state/model.py index 67c70992ca..f29570cd38 100644 --- a/tests/resources/generator/cellml_unit_scaling_state/model.py +++ b/tests/resources/generator/cellml_unit_scaling_state/model.py @@ -41,7 +41,7 @@ def create_variables_array(): return [nan]*VARIABLE_COUNT -def initialise_variables(states, rates, variables): +def initialise_variables(states, rates, constants): states[0] = 123.0 diff --git a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.c b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.c index d84efc4cd0..31ae730d05 100644 --- a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.c +++ b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.c @@ -50,7 +50,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double *states, double *rates, double *variables) +void initialiseVariables(double *states, double *rates, double *constants) { states[0] = 123.0; states[1] = 0.001*789.0; diff --git a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.h b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.h index aa242b8afe..75763d81b3 100644 --- a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.h +++ b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.h @@ -35,7 +35,7 @@ double * createStatesArray(); double * createVariablesArray(); void deleteArray(double *array); -void initialiseVariables(double *states, double *rates, double *variables); +void initialiseVariables(double *states, double *rates, double *constants); void computeComputedConstants(double *computedConstants); void computeRates(double voi, double *states, double *rates, double *variables); void computeVariables(double voi, double *states, double *rates, double *variables); diff --git a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.py b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.py index b60faccff7..8adebd9681 100644 --- a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.py +++ b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.py @@ -40,7 +40,7 @@ def create_variables_array(): return [nan]*VARIABLE_COUNT -def initialise_variables(states, rates, variables): +def initialise_variables(states, rates, constants): states[0] = 123.0 states[1] = 0.001*789.0 diff --git a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.c b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.c index fdd80b0950..c8b1b99cd6 100644 --- a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.c +++ b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.c @@ -52,7 +52,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double *states, double *rates, double *variables) +void initialiseVariables(double *states, double *rates, double *constants) { variables[0] = 123.0; variables[1] = 789.0; diff --git a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.h b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.h index 28a98085da..267e6b8b3a 100644 --- a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.h +++ b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.h @@ -35,7 +35,7 @@ double * createStatesArray(); double * createVariablesArray(); void deleteArray(double *array); -void initialiseVariables(double *states, double *rates, double *variables); +void initialiseVariables(double *states, double *rates, double *constants); void computeComputedConstants(double *computedConstants); void computeRates(double voi, double *states, double *rates, double *variables); void computeVariables(double voi, double *states, double *rates, double *variables); diff --git a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.py b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.py index f04a5b9365..b3b95e4e87 100644 --- a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.py +++ b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.py @@ -42,7 +42,7 @@ def create_variables_array(): return [nan]*VARIABLE_COUNT -def initialise_variables(states, rates, variables): +def initialise_variables(states, rates, constants): variables[0] = 123.0 variables[1] = 789.0 states[0] = variables[0] diff --git a/tests/resources/generator/cellml_unit_scaling_voi_direct/model.c b/tests/resources/generator/cellml_unit_scaling_voi_direct/model.c index 1f652c7881..33e574ae52 100644 --- a/tests/resources/generator/cellml_unit_scaling_voi_direct/model.c +++ b/tests/resources/generator/cellml_unit_scaling_voi_direct/model.c @@ -50,7 +50,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double *states, double *rates, double *variables) +void initialiseVariables(double *states, double *rates, double *constants) { states[0] = 3.0; states[1] = 5.0; diff --git a/tests/resources/generator/cellml_unit_scaling_voi_direct/model.h b/tests/resources/generator/cellml_unit_scaling_voi_direct/model.h index 614cdc5ec6..2279ebcc10 100644 --- a/tests/resources/generator/cellml_unit_scaling_voi_direct/model.h +++ b/tests/resources/generator/cellml_unit_scaling_voi_direct/model.h @@ -35,7 +35,7 @@ double * createStatesArray(); double * createVariablesArray(); void deleteArray(double *array); -void initialiseVariables(double *states, double *rates, double *variables); +void initialiseVariables(double *states, double *rates, double *constants); void computeComputedConstants(double *computedConstants); void computeRates(double voi, double *states, double *rates, double *variables); void computeVariables(double voi, double *states, double *rates, double *variables); diff --git a/tests/resources/generator/cellml_unit_scaling_voi_direct/model.py b/tests/resources/generator/cellml_unit_scaling_voi_direct/model.py index 6dfca0a422..7e51296b60 100644 --- a/tests/resources/generator/cellml_unit_scaling_voi_direct/model.py +++ b/tests/resources/generator/cellml_unit_scaling_voi_direct/model.py @@ -40,7 +40,7 @@ def create_variables_array(): return [nan]*VARIABLE_COUNT -def initialise_variables(states, rates, variables): +def initialise_variables(states, rates, constants): states[0] = 3.0 states[1] = 5.0 diff --git a/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.c b/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.c index 54994da7db..aac78a605c 100644 --- a/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.c +++ b/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.c @@ -51,7 +51,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double *states, double *rates, double *variables) +void initialiseVariables(double *states, double *rates, double *constants) { states[0] = 3.0; states[1] = 7.0; diff --git a/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.h b/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.h index 0ae9861118..176d863193 100644 --- a/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.h +++ b/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.h @@ -35,7 +35,7 @@ double * createStatesArray(); double * createVariablesArray(); void deleteArray(double *array); -void initialiseVariables(double *states, double *rates, double *variables); +void initialiseVariables(double *states, double *rates, double *constants); void computeComputedConstants(double *computedConstants); void computeRates(double voi, double *states, double *rates, double *variables); void computeVariables(double voi, double *states, double *rates, double *variables); diff --git a/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.py b/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.py index 4bc1c304cc..c14ff09f07 100644 --- a/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.py +++ b/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.py @@ -41,7 +41,7 @@ def create_variables_array(): return [nan]*VARIABLE_COUNT -def initialise_variables(states, rates, variables): +def initialise_variables(states, rates, constants): states[0] = 3.0 states[1] = 7.0 states[2] = 11.0 diff --git a/tests/resources/generator/dae_cellml_1_1_model/model.c b/tests/resources/generator/dae_cellml_1_1_model/model.c index 3a1022aa72..21cfacf835 100644 --- a/tests/resources/generator/dae_cellml_1_1_model/model.c +++ b/tests/resources/generator/dae_cellml_1_1_model/model.c @@ -118,7 +118,7 @@ void findRoot1(double voi, double *states, double *rates, double *variables) variables[6] = u[0]; } -void initialiseVariables(double *states, double *rates, double *variables) +void initialiseVariables(double *states, double *rates, double *constants) { variables[0] = 0.0; variables[1] = 1.0; diff --git a/tests/resources/generator/dae_cellml_1_1_model/model.h b/tests/resources/generator/dae_cellml_1_1_model/model.h index 4b380a3b49..e11fde1f1d 100644 --- a/tests/resources/generator/dae_cellml_1_1_model/model.h +++ b/tests/resources/generator/dae_cellml_1_1_model/model.h @@ -35,7 +35,7 @@ double * createStatesArray(); double * createVariablesArray(); void deleteArray(double *array); -void initialiseVariables(double *states, double *rates, double *variables); +void initialiseVariables(double *states, double *rates, double *constants); void computeComputedConstants(double *computedConstants); void computeRates(double voi, double *states, double *rates, double *variables); void computeVariables(double voi, double *states, double *rates, double *variables); diff --git a/tests/resources/generator/dae_cellml_1_1_model/model.py b/tests/resources/generator/dae_cellml_1_1_model/model.py index fd86ef428a..931f4c83c5 100644 --- a/tests/resources/generator/dae_cellml_1_1_model/model.py +++ b/tests/resources/generator/dae_cellml_1_1_model/model.py @@ -95,7 +95,7 @@ def find_root_1(voi, states, rates, variables): variables[6] = u[0] -def initialise_variables(states, rates, variables): +def initialise_variables(states, rates, constants): variables[0] = 0.0 variables[1] = 1.0 variables[3] = 1.0 diff --git a/tests/resources/generator/dependent_eqns/model.c b/tests/resources/generator/dependent_eqns/model.c index 6aa94c3bf3..76910519b1 100644 --- a/tests/resources/generator/dependent_eqns/model.c +++ b/tests/resources/generator/dependent_eqns/model.c @@ -51,7 +51,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double *states, double *rates, double *variables) +void initialiseVariables(double *states, double *rates, double *constants) { states[0] = 0.0; } diff --git a/tests/resources/generator/dependent_eqns/model.h b/tests/resources/generator/dependent_eqns/model.h index 8387ea6e26..7485defac7 100644 --- a/tests/resources/generator/dependent_eqns/model.h +++ b/tests/resources/generator/dependent_eqns/model.h @@ -35,7 +35,7 @@ double * createStatesArray(); double * createVariablesArray(); void deleteArray(double *array); -void initialiseVariables(double *states, double *rates, double *variables); +void initialiseVariables(double *states, double *rates, double *constants); void computeComputedConstants(double *computedConstants); void computeRates(double voi, double *states, double *rates, double *variables); void computeVariables(double voi, double *states, double *rates, double *variables); diff --git a/tests/resources/generator/dependent_eqns/model.py b/tests/resources/generator/dependent_eqns/model.py index cee82a74be..c9ee52382e 100644 --- a/tests/resources/generator/dependent_eqns/model.py +++ b/tests/resources/generator/dependent_eqns/model.py @@ -41,7 +41,7 @@ def create_variables_array(): return [nan]*VARIABLE_COUNT -def initialise_variables(states, rates, variables): +def initialise_variables(states, rates, constants): states[0] = 0.0 diff --git a/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.c b/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.c index 29744dac79..8ddf41a6ec 100644 --- a/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.c +++ b/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.c @@ -298,7 +298,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double *states, double *rates, double *variables) +void initialiseVariables(double *states, double *rates, double *constants) { variables[0] = 0.0; variables[1] = 0.0; diff --git a/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.h b/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.h index 91f60ad4ec..64a364e175 100644 --- a/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.h +++ b/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.h @@ -35,7 +35,7 @@ double * createStatesArray(); double * createVariablesArray(); void deleteArray(double *array); -void initialiseVariables(double *states, double *rates, double *variables); +void initialiseVariables(double *states, double *rates, double *constants); void computeComputedConstants(double *computedConstants); void computeRates(double voi, double *states, double *rates, double *variables); void computeVariables(double voi, double *states, double *rates, double *variables); diff --git a/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.py b/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.py index d21a0dd175..a5cc60a71c 100644 --- a/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.py +++ b/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.py @@ -308,7 +308,7 @@ def create_variables_array(): return [nan]*VARIABLE_COUNT -def initialise_variables(states, rates, variables): +def initialise_variables(states, rates, constants): variables[0] = 0.0 variables[1] = 0.0 variables[4] = 140.0 diff --git a/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.c b/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.c index c473d0e8cd..81355e42cb 100644 --- a/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.c +++ b/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.c @@ -248,7 +248,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double *states, double *rates, double *variables) +void initialiseVariables(double *states, double *rates, double *constants) { variables[1] = 0.0; variables[2] = 1.0; diff --git a/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.h b/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.h index 9c13c3f347..09c8efc8c7 100644 --- a/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.h +++ b/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.h @@ -35,7 +35,7 @@ double * createStatesArray(); double * createVariablesArray(); void deleteArray(double *array); -void initialiseVariables(double *states, double *rates, double *variables); +void initialiseVariables(double *states, double *rates, double *constants); void computeComputedConstants(double *computedConstants); void computeRates(double voi, double *states, double *rates, double *variables); void computeVariables(double voi, double *states, double *rates, double *variables); diff --git a/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.py b/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.py index c2cb441551..86fa99ce99 100644 --- a/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.py +++ b/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.py @@ -246,7 +246,7 @@ def create_variables_array(): return [nan]*VARIABLE_COUNT -def initialise_variables(states, rates, variables): +def initialise_variables(states, rates, constants): variables[1] = 0.0 variables[2] = 1.0 variables[3] = 1.0309347 diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.c index b148c0bbd1..7e75a99826 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.c @@ -70,7 +70,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double voi, double *states, double *rates, double *variables, ExternalVariable externalVariable) +void initialiseVariables(double voi, double *states, double *rates, double *constants, ExternalVariable externalVariable) { variables[4] = 1.0; variables[5] = 0.0; diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.h index e1fb1b494c..b6719b8af9 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.h +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.h @@ -38,7 +38,7 @@ void deleteArray(double *array); typedef double (* ExternalVariable)(double voi, double *states, double *rates, double *variables, size_t index); -void initialiseVariables(double voi, double *states, double *rates, double *variables, ExternalVariable externalVariable); +void initialiseVariables(double voi, double *states, double *rates, double *constants, ExternalVariable externalVariable); void computeComputedConstants(double *computedConstants); void computeRates(double voi, double *states, double *rates, double *variables, ExternalVariable externalVariable); void computeVariables(double voi, double *states, double *rates, double *variables, ExternalVariable externalVariable); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.py index 72dbf27cf3..5c9aa53b78 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.py @@ -73,7 +73,7 @@ def create_variables_array(): return [nan]*VARIABLE_COUNT -def initialise_variables(voi, states, rates, variables, external_variable): +def initialise_variables(voi, states, rates, constants, external_variable): variables[4] = 1.0 variables[5] = 0.0 variables[7] = 0.3 diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.c index a30ed76d2b..b423facc66 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.c @@ -70,7 +70,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double *states, double *rates, double *variables) +void initialiseVariables(double *states, double *rates, double *constants) { variables[4] = 1.0; variables[5] = 0.0; diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.c index 8ef6fb89f4..6c97d8386c 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.c @@ -70,7 +70,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double voi, double *states, double *rates, double *variables, ExternalVariable externalVariable) +void initialiseVariables(double voi, double *states, double *rates, double *constants, ExternalVariable externalVariable) { variables[4] = 1.0; variables[5] = 0.0; diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.h index e1fb1b494c..b6719b8af9 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.h +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.h @@ -38,7 +38,7 @@ void deleteArray(double *array); typedef double (* ExternalVariable)(double voi, double *states, double *rates, double *variables, size_t index); -void initialiseVariables(double voi, double *states, double *rates, double *variables, ExternalVariable externalVariable); +void initialiseVariables(double voi, double *states, double *rates, double *constants, ExternalVariable externalVariable); void computeComputedConstants(double *computedConstants); void computeRates(double voi, double *states, double *rates, double *variables, ExternalVariable externalVariable); void computeVariables(double voi, double *states, double *rates, double *variables, ExternalVariable externalVariable); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.py index 4e2c615a68..46fd133305 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.py @@ -73,7 +73,7 @@ def create_variables_array(): return [nan]*VARIABLE_COUNT -def initialise_variables(voi, states, rates, variables, external_variable): +def initialise_variables(voi, states, rates, constants, external_variable): variables[4] = 1.0 variables[5] = 0.0 variables[7] = 0.3 diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.c index f28ef90f48..92007545fb 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.c @@ -70,7 +70,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double voi, double *states, double *rates, double *variables, ExternalVariable externalVariable) +void initialiseVariables(double voi, double *states, double *rates, double *constants, ExternalVariable externalVariable) { variables[5] = 0.0; variables[7] = 0.3; diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.h index e1fb1b494c..b6719b8af9 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.h +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.h @@ -38,7 +38,7 @@ void deleteArray(double *array); typedef double (* ExternalVariable)(double voi, double *states, double *rates, double *variables, size_t index); -void initialiseVariables(double voi, double *states, double *rates, double *variables, ExternalVariable externalVariable); +void initialiseVariables(double voi, double *states, double *rates, double *constants, ExternalVariable externalVariable); void computeComputedConstants(double *computedConstants); void computeRates(double voi, double *states, double *rates, double *variables, ExternalVariable externalVariable); void computeVariables(double voi, double *states, double *rates, double *variables, ExternalVariable externalVariable); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.py index efb48bb7ba..c171a09b76 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.py @@ -73,7 +73,7 @@ def create_variables_array(): return [nan]*VARIABLE_COUNT -def initialise_variables(voi, states, rates, variables, external_variable): +def initialise_variables(voi, states, rates, constants, external_variable): variables[5] = 0.0 variables[7] = 0.3 variables[9] = 120.0 diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.c index f84acb2cd3..38f83ab657 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.c @@ -488,7 +488,7 @@ void findRoot16(double voi, double *states, double *rates, double *variables) rates[3] = u[0]; } -void initialiseVariables(double *states, double *rates, double *variables) +void initialiseVariables(double *states, double *rates, double *constants) { variables[0] = 0.0; variables[1] = 0.0; diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.h index 18f278fee6..44cab4bacd 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.h +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.h @@ -35,7 +35,7 @@ double * createStatesArray(); double * createVariablesArray(); void deleteArray(double *array); -void initialiseVariables(double *states, double *rates, double *variables); +void initialiseVariables(double *states, double *rates, double *constants); void computeComputedConstants(double *computedConstants); void computeRates(double voi, double *states, double *rates, double *variables); void computeVariables(double voi, double *states, double *rates, double *variables); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.py index b377d909c5..a31fb836bd 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.py @@ -432,7 +432,7 @@ def find_root_16(voi, states, rates, variables): rates[3] = u[0] -def initialise_variables(states, rates, variables): +def initialise_variables(states, rates, constants): variables[0] = 0.0 variables[1] = 0.0 variables[2] = 0.0 diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.c index 3bff290982..89e69a335e 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.c @@ -70,7 +70,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double voi, double *states, double *rates, double *variables, ExternalVariable externalVariable) +void initialiseVariables(double voi, double *states, double *rates, double *constants, ExternalVariable externalVariable) { variables[4] = 1.0; variables[5] = 0.0; diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.h index e1fb1b494c..b6719b8af9 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.h +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.h @@ -38,7 +38,7 @@ void deleteArray(double *array); typedef double (* ExternalVariable)(double voi, double *states, double *rates, double *variables, size_t index); -void initialiseVariables(double voi, double *states, double *rates, double *variables, ExternalVariable externalVariable); +void initialiseVariables(double voi, double *states, double *rates, double *constants, ExternalVariable externalVariable); void computeComputedConstants(double *computedConstants); void computeRates(double voi, double *states, double *rates, double *variables, ExternalVariable externalVariable); void computeVariables(double voi, double *states, double *rates, double *variables, ExternalVariable externalVariable); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.py index b3482e4bc8..7970569a12 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.py @@ -73,7 +73,7 @@ def create_variables_array(): return [nan]*VARIABLE_COUNT -def initialise_variables(voi, states, rates, variables, external_variable): +def initialise_variables(voi, states, rates, constants, external_variable): variables[4] = 1.0 variables[5] = 0.0 variables[7] = 0.3 diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.c index 8820f3fac2..0539e453ff 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.c @@ -70,7 +70,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double voi, double *states, double *rates, double *variables, ExternalVariable externalVariable) +void initialiseVariables(double voi, double *states, double *rates, double *constants, ExternalVariable externalVariable) { variables[4] = 1.0; variables[7] = 0.3; diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.h index e1fb1b494c..b6719b8af9 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.h +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.h @@ -38,7 +38,7 @@ void deleteArray(double *array); typedef double (* ExternalVariable)(double voi, double *states, double *rates, double *variables, size_t index); -void initialiseVariables(double voi, double *states, double *rates, double *variables, ExternalVariable externalVariable); +void initialiseVariables(double voi, double *states, double *rates, double *constants, ExternalVariable externalVariable); void computeComputedConstants(double *computedConstants); void computeRates(double voi, double *states, double *rates, double *variables, ExternalVariable externalVariable); void computeVariables(double voi, double *states, double *rates, double *variables, ExternalVariable externalVariable); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.py index 1906e26f00..18c3c32264 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.py @@ -73,7 +73,7 @@ def create_variables_array(): return [nan]*VARIABLE_COUNT -def initialise_variables(voi, states, rates, variables, external_variable): +def initialise_variables(voi, states, rates, constants, external_variable): variables[4] = 1.0 variables[7] = 0.3 variables[9] = 120.0 diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.c index ec4314811c..eaaa5a341b 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.c @@ -70,7 +70,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double voi, double *states, double *rates, double *variables, ExternalVariable externalVariable) +void initialiseVariables(double voi, double *states, double *rates, double *constants, ExternalVariable externalVariable) { variables[5] = 0.0; variables[7] = 0.3; diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.h index e1fb1b494c..b6719b8af9 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.h +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.h @@ -38,7 +38,7 @@ void deleteArray(double *array); typedef double (* ExternalVariable)(double voi, double *states, double *rates, double *variables, size_t index); -void initialiseVariables(double voi, double *states, double *rates, double *variables, ExternalVariable externalVariable); +void initialiseVariables(double voi, double *states, double *rates, double *constants, ExternalVariable externalVariable); void computeComputedConstants(double *computedConstants); void computeRates(double voi, double *states, double *rates, double *variables, ExternalVariable externalVariable); void computeVariables(double voi, double *states, double *rates, double *variables, ExternalVariable externalVariable); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.py index eb9c6b8d0a..aacb683200 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.py @@ -73,7 +73,7 @@ def create_variables_array(): return [nan]*VARIABLE_COUNT -def initialise_variables(voi, states, rates, variables, external_variable): +def initialise_variables(voi, states, rates, constants, external_variable): variables[5] = 0.0 variables[7] = 0.3 variables[15] = 36.0 diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.c index 8157734aa5..612c48a656 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.c @@ -70,7 +70,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double voi, double *states, double *rates, double *variables, ExternalVariable externalVariable) +void initialiseVariables(double voi, double *states, double *rates, double *constants, ExternalVariable externalVariable) { variables[5] = 1.0; variables[6] = 0.0; diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.h index e1fb1b494c..b6719b8af9 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.h +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.h @@ -38,7 +38,7 @@ void deleteArray(double *array); typedef double (* ExternalVariable)(double voi, double *states, double *rates, double *variables, size_t index); -void initialiseVariables(double voi, double *states, double *rates, double *variables, ExternalVariable externalVariable); +void initialiseVariables(double voi, double *states, double *rates, double *constants, ExternalVariable externalVariable); void computeComputedConstants(double *computedConstants); void computeRates(double voi, double *states, double *rates, double *variables, ExternalVariable externalVariable); void computeVariables(double voi, double *states, double *rates, double *variables, ExternalVariable externalVariable); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.py index 1140741296..f49e72de76 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.py @@ -73,7 +73,7 @@ def create_variables_array(): return [nan]*VARIABLE_COUNT -def initialise_variables(voi, states, rates, variables, external_variable): +def initialise_variables(voi, states, rates, constants, external_variable): variables[5] = 1.0 variables[6] = 0.0 variables[8] = 0.3 diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.c index d824807857..77a77fa86a 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.c @@ -70,7 +70,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double voi, double *states, double *rates, double *variables, ExternalVariable externalVariable) +void initialiseVariables(double voi, double *states, double *rates, double *constants, ExternalVariable externalVariable) { variables[5] = 1.0; variables[6] = 0.0; diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.h index e1fb1b494c..b6719b8af9 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.h +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.h @@ -38,7 +38,7 @@ void deleteArray(double *array); typedef double (* ExternalVariable)(double voi, double *states, double *rates, double *variables, size_t index); -void initialiseVariables(double voi, double *states, double *rates, double *variables, ExternalVariable externalVariable); +void initialiseVariables(double voi, double *states, double *rates, double *constants, ExternalVariable externalVariable); void computeComputedConstants(double *computedConstants); void computeRates(double voi, double *states, double *rates, double *variables, ExternalVariable externalVariable); void computeVariables(double voi, double *states, double *rates, double *variables, ExternalVariable externalVariable); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.py index cc74a6a438..a1d9455d88 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.py @@ -73,7 +73,7 @@ def create_variables_array(): return [nan]*VARIABLE_COUNT -def initialise_variables(voi, states, rates, variables, external_variable): +def initialise_variables(voi, states, rates, constants, external_variable): variables[5] = 1.0 variables[6] = 0.0 variables[8] = 0.3 diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.h index 18f278fee6..44cab4bacd 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.h +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.h @@ -35,7 +35,7 @@ double * createStatesArray(); double * createVariablesArray(); void deleteArray(double *array); -void initialiseVariables(double *states, double *rates, double *variables); +void initialiseVariables(double *states, double *rates, double *constants); void computeComputedConstants(double *computedConstants); void computeRates(double voi, double *states, double *rates, double *variables); void computeVariables(double voi, double *states, double *rates, double *variables); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.py index cdbfc277a1..2b363c20bb 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.py @@ -72,7 +72,7 @@ def create_variables_array(): return [nan]*VARIABLE_COUNT -def initialise_variables(states, rates, variables): +def initialise_variables(states, rates, constants): variables[4] = 1.0 variables[5] = 0.0 variables[7] = 0.3 diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.c index 4689c74e68..d3bc351822 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.c @@ -70,7 +70,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double voi, double *states, double *rates, double *variables, ExternalVariable externalVariable) +void initialiseVariables(double voi, double *states, double *rates, double *constants, ExternalVariable externalVariable) { variables[4] = 1.0; variables[5] = 0.0; diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.h index e1fb1b494c..b6719b8af9 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.h +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.h @@ -38,7 +38,7 @@ void deleteArray(double *array); typedef double (* ExternalVariable)(double voi, double *states, double *rates, double *variables, size_t index); -void initialiseVariables(double voi, double *states, double *rates, double *variables, ExternalVariable externalVariable); +void initialiseVariables(double voi, double *states, double *rates, double *constants, ExternalVariable externalVariable); void computeComputedConstants(double *computedConstants); void computeRates(double voi, double *states, double *rates, double *variables, ExternalVariable externalVariable); void computeVariables(double voi, double *states, double *rates, double *variables, ExternalVariable externalVariable); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.py index 771fbc441c..877a3c3c14 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.py @@ -73,7 +73,7 @@ def create_variables_array(): return [nan]*VARIABLE_COUNT -def initialise_variables(voi, states, rates, variables, external_variable): +def initialise_variables(voi, states, rates, constants, external_variable): variables[4] = 1.0 variables[5] = 0.0 variables[7] = 0.3 diff --git a/tests/resources/generator/noble_model_1962/model.c b/tests/resources/generator/noble_model_1962/model.c index af60ee489b..bed1c02e31 100644 --- a/tests/resources/generator/noble_model_1962/model.c +++ b/tests/resources/generator/noble_model_1962/model.c @@ -69,7 +69,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double *states, double *rates, double *variables) +void initialiseVariables(double *states, double *rates, double *constants) { variables[3] = 12.0; variables[4] = 0.075; diff --git a/tests/resources/generator/noble_model_1962/model.h b/tests/resources/generator/noble_model_1962/model.h index 6988d2d31c..41269862ea 100644 --- a/tests/resources/generator/noble_model_1962/model.h +++ b/tests/resources/generator/noble_model_1962/model.h @@ -35,7 +35,7 @@ double * createStatesArray(); double * createVariablesArray(); void deleteArray(double *array); -void initialiseVariables(double *states, double *rates, double *variables); +void initialiseVariables(double *states, double *rates, double *constants); void computeComputedConstants(double *computedConstants); void computeRates(double voi, double *states, double *rates, double *variables); void computeVariables(double voi, double *states, double *rates, double *variables); diff --git a/tests/resources/generator/noble_model_1962/model.py b/tests/resources/generator/noble_model_1962/model.py index 52a828364b..433f53e118 100644 --- a/tests/resources/generator/noble_model_1962/model.py +++ b/tests/resources/generator/noble_model_1962/model.py @@ -59,7 +59,7 @@ def create_variables_array(): return [nan]*VARIABLE_COUNT -def initialise_variables(states, rates, variables): +def initialise_variables(states, rates, constants): variables[3] = 12.0 variables[4] = 0.075 variables[5] = -60.0 diff --git a/tests/resources/generator/ode_computed_var_on_rhs/model.c b/tests/resources/generator/ode_computed_var_on_rhs/model.c index 529cf18048..347ca221ae 100644 --- a/tests/resources/generator/ode_computed_var_on_rhs/model.c +++ b/tests/resources/generator/ode_computed_var_on_rhs/model.c @@ -50,7 +50,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double *states, double *rates, double *variables) +void initialiseVariables(double *states, double *rates, double *constants) { variables[0] = 1.0; states[0] = 1.0; diff --git a/tests/resources/generator/ode_computed_var_on_rhs/model.h b/tests/resources/generator/ode_computed_var_on_rhs/model.h index 614cdc5ec6..2279ebcc10 100644 --- a/tests/resources/generator/ode_computed_var_on_rhs/model.h +++ b/tests/resources/generator/ode_computed_var_on_rhs/model.h @@ -35,7 +35,7 @@ double * createStatesArray(); double * createVariablesArray(); void deleteArray(double *array); -void initialiseVariables(double *states, double *rates, double *variables); +void initialiseVariables(double *states, double *rates, double *constants); void computeComputedConstants(double *computedConstants); void computeRates(double voi, double *states, double *rates, double *variables); void computeVariables(double voi, double *states, double *rates, double *variables); diff --git a/tests/resources/generator/ode_computed_var_on_rhs/model.py b/tests/resources/generator/ode_computed_var_on_rhs/model.py index ec7afe8e0e..23fe7ca717 100644 --- a/tests/resources/generator/ode_computed_var_on_rhs/model.py +++ b/tests/resources/generator/ode_computed_var_on_rhs/model.py @@ -40,7 +40,7 @@ def create_variables_array(): return [nan]*VARIABLE_COUNT -def initialise_variables(states, rates, variables): +def initialise_variables(states, rates, constants): variables[0] = 1.0 states[0] = 1.0 diff --git a/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.c b/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.c index 5d8747a404..70697999bc 100644 --- a/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.c +++ b/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.c @@ -50,7 +50,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double *states, double *rates, double *variables) +void initialiseVariables(double *states, double *rates, double *constants) { variables[0] = 1.0; states[0] = 1.0; diff --git a/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.h b/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.h index d1084de7ab..be002fd715 100644 --- a/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.h +++ b/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.h @@ -35,7 +35,7 @@ double * createStatesArray(); double * createVariablesArray(); void deleteArray(double *array); -void initialiseVariables(double *states, double *rates, double *variables); +void initialiseVariables(double *states, double *rates, double *constants); void computeComputedConstants(double *computedConstants); void computeRates(double voi, double *states, double *rates, double *variables); void computeVariables(double voi, double *states, double *rates, double *variables); diff --git a/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.py b/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.py index e15d14089f..7cf75939a9 100644 --- a/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.py +++ b/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.py @@ -40,7 +40,7 @@ def create_variables_array(): return [nan]*VARIABLE_COUNT -def initialise_variables(states, rates, variables): +def initialise_variables(states, rates, constants): variables[0] = 1.0 states[0] = 1.0 diff --git a/tests/resources/generator/ode_const_var_on_rhs/model.c b/tests/resources/generator/ode_const_var_on_rhs/model.c index 59be2f295d..242e528d07 100644 --- a/tests/resources/generator/ode_const_var_on_rhs/model.c +++ b/tests/resources/generator/ode_const_var_on_rhs/model.c @@ -50,7 +50,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double *states, double *rates, double *variables) +void initialiseVariables(double *states, double *rates, double *constants) { variables[0] = 1.0; states[0] = 1.0; diff --git a/tests/resources/generator/ode_const_var_on_rhs/model.h b/tests/resources/generator/ode_const_var_on_rhs/model.h index 614cdc5ec6..2279ebcc10 100644 --- a/tests/resources/generator/ode_const_var_on_rhs/model.h +++ b/tests/resources/generator/ode_const_var_on_rhs/model.h @@ -35,7 +35,7 @@ double * createStatesArray(); double * createVariablesArray(); void deleteArray(double *array); -void initialiseVariables(double *states, double *rates, double *variables); +void initialiseVariables(double *states, double *rates, double *constants); void computeComputedConstants(double *computedConstants); void computeRates(double voi, double *states, double *rates, double *variables); void computeVariables(double voi, double *states, double *rates, double *variables); diff --git a/tests/resources/generator/ode_const_var_on_rhs/model.py b/tests/resources/generator/ode_const_var_on_rhs/model.py index 5d5b92520c..8c2d64ebea 100644 --- a/tests/resources/generator/ode_const_var_on_rhs/model.py +++ b/tests/resources/generator/ode_const_var_on_rhs/model.py @@ -40,7 +40,7 @@ def create_variables_array(): return [nan]*VARIABLE_COUNT -def initialise_variables(states, rates, variables): +def initialise_variables(states, rates, constants): variables[0] = 1.0 states[0] = 1.0 diff --git a/tests/resources/generator/ode_const_var_on_rhs_one_component/model.c b/tests/resources/generator/ode_const_var_on_rhs_one_component/model.c index a5074645db..c2cfa30a05 100644 --- a/tests/resources/generator/ode_const_var_on_rhs_one_component/model.c +++ b/tests/resources/generator/ode_const_var_on_rhs_one_component/model.c @@ -50,7 +50,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double *states, double *rates, double *variables) +void initialiseVariables(double *states, double *rates, double *constants) { variables[0] = 1.0; states[0] = 1.0; diff --git a/tests/resources/generator/ode_const_var_on_rhs_one_component/model.h b/tests/resources/generator/ode_const_var_on_rhs_one_component/model.h index d1084de7ab..be002fd715 100644 --- a/tests/resources/generator/ode_const_var_on_rhs_one_component/model.h +++ b/tests/resources/generator/ode_const_var_on_rhs_one_component/model.h @@ -35,7 +35,7 @@ double * createStatesArray(); double * createVariablesArray(); void deleteArray(double *array); -void initialiseVariables(double *states, double *rates, double *variables); +void initialiseVariables(double *states, double *rates, double *constants); void computeComputedConstants(double *computedConstants); void computeRates(double voi, double *states, double *rates, double *variables); void computeVariables(double voi, double *states, double *rates, double *variables); diff --git a/tests/resources/generator/ode_const_var_on_rhs_one_component/model.py b/tests/resources/generator/ode_const_var_on_rhs_one_component/model.py index 801a2997d3..40fec51739 100644 --- a/tests/resources/generator/ode_const_var_on_rhs_one_component/model.py +++ b/tests/resources/generator/ode_const_var_on_rhs_one_component/model.py @@ -40,7 +40,7 @@ def create_variables_array(): return [nan]*VARIABLE_COUNT -def initialise_variables(states, rates, variables): +def initialise_variables(states, rates, constants): variables[0] = 1.0 states[0] = 1.0 diff --git a/tests/resources/generator/ode_constant_on_rhs/model.c b/tests/resources/generator/ode_constant_on_rhs/model.c index c026c74041..8c25b8b32d 100644 --- a/tests/resources/generator/ode_constant_on_rhs/model.c +++ b/tests/resources/generator/ode_constant_on_rhs/model.c @@ -49,7 +49,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double *states, double *rates, double *variables) +void initialiseVariables(double *states, double *rates, double *constants) { states[0] = 1.0; } diff --git a/tests/resources/generator/ode_constant_on_rhs/model.h b/tests/resources/generator/ode_constant_on_rhs/model.h index 614cdc5ec6..2279ebcc10 100644 --- a/tests/resources/generator/ode_constant_on_rhs/model.h +++ b/tests/resources/generator/ode_constant_on_rhs/model.h @@ -35,7 +35,7 @@ double * createStatesArray(); double * createVariablesArray(); void deleteArray(double *array); -void initialiseVariables(double *states, double *rates, double *variables); +void initialiseVariables(double *states, double *rates, double *constants); void computeComputedConstants(double *computedConstants); void computeRates(double voi, double *states, double *rates, double *variables); void computeVariables(double voi, double *states, double *rates, double *variables); diff --git a/tests/resources/generator/ode_constant_on_rhs/model.py b/tests/resources/generator/ode_constant_on_rhs/model.py index 20c1034b04..fb01dd88d1 100644 --- a/tests/resources/generator/ode_constant_on_rhs/model.py +++ b/tests/resources/generator/ode_constant_on_rhs/model.py @@ -39,7 +39,7 @@ def create_variables_array(): return [nan]*VARIABLE_COUNT -def initialise_variables(states, rates, variables): +def initialise_variables(states, rates, constants): states[0] = 1.0 diff --git a/tests/resources/generator/ode_constant_on_rhs_one_component/model.c b/tests/resources/generator/ode_constant_on_rhs_one_component/model.c index 07897e662d..48f4705faf 100644 --- a/tests/resources/generator/ode_constant_on_rhs_one_component/model.c +++ b/tests/resources/generator/ode_constant_on_rhs_one_component/model.c @@ -49,7 +49,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double *states, double *rates, double *variables) +void initialiseVariables(double *states, double *rates, double *constants) { states[0] = 1.0; } diff --git a/tests/resources/generator/ode_constant_on_rhs_one_component/model.h b/tests/resources/generator/ode_constant_on_rhs_one_component/model.h index d1084de7ab..be002fd715 100644 --- a/tests/resources/generator/ode_constant_on_rhs_one_component/model.h +++ b/tests/resources/generator/ode_constant_on_rhs_one_component/model.h @@ -35,7 +35,7 @@ double * createStatesArray(); double * createVariablesArray(); void deleteArray(double *array); -void initialiseVariables(double *states, double *rates, double *variables); +void initialiseVariables(double *states, double *rates, double *constants); void computeComputedConstants(double *computedConstants); void computeRates(double voi, double *states, double *rates, double *variables); void computeVariables(double voi, double *states, double *rates, double *variables); diff --git a/tests/resources/generator/ode_constant_on_rhs_one_component/model.py b/tests/resources/generator/ode_constant_on_rhs_one_component/model.py index 096a989a79..4655c2f755 100644 --- a/tests/resources/generator/ode_constant_on_rhs_one_component/model.py +++ b/tests/resources/generator/ode_constant_on_rhs_one_component/model.py @@ -39,7 +39,7 @@ def create_variables_array(): return [nan]*VARIABLE_COUNT -def initialise_variables(states, rates, variables): +def initialise_variables(states, rates, constants): states[0] = 1.0 diff --git a/tests/resources/generator/ode_multiple_dependent_odes/model.c b/tests/resources/generator/ode_multiple_dependent_odes/model.c index d0ae434332..94db2285bf 100644 --- a/tests/resources/generator/ode_multiple_dependent_odes/model.c +++ b/tests/resources/generator/ode_multiple_dependent_odes/model.c @@ -51,7 +51,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double *states, double *rates, double *variables) +void initialiseVariables(double *states, double *rates, double *constants) { variables[0] = 1.0; states[0] = -2.0; diff --git a/tests/resources/generator/ode_multiple_dependent_odes/model.h b/tests/resources/generator/ode_multiple_dependent_odes/model.h index b5625ea2db..e3079caa53 100644 --- a/tests/resources/generator/ode_multiple_dependent_odes/model.h +++ b/tests/resources/generator/ode_multiple_dependent_odes/model.h @@ -35,7 +35,7 @@ double * createStatesArray(); double * createVariablesArray(); void deleteArray(double *array); -void initialiseVariables(double *states, double *rates, double *variables); +void initialiseVariables(double *states, double *rates, double *constants); void computeComputedConstants(double *computedConstants); void computeRates(double voi, double *states, double *rates, double *variables); void computeVariables(double voi, double *states, double *rates, double *variables); diff --git a/tests/resources/generator/ode_multiple_dependent_odes/model.py b/tests/resources/generator/ode_multiple_dependent_odes/model.py index 37a213fb21..07ee839b45 100644 --- a/tests/resources/generator/ode_multiple_dependent_odes/model.py +++ b/tests/resources/generator/ode_multiple_dependent_odes/model.py @@ -41,7 +41,7 @@ def create_variables_array(): return [nan]*VARIABLE_COUNT -def initialise_variables(states, rates, variables): +def initialise_variables(states, rates, constants): variables[0] = 1.0 states[0] = -2.0 states[1] = 0.0 diff --git a/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.c b/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.c index 627806b477..addbc42504 100644 --- a/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.c +++ b/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.c @@ -51,7 +51,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double *states, double *rates, double *variables) +void initialiseVariables(double *states, double *rates, double *constants) { variables[0] = 1.0; states[0] = -2.0; diff --git a/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.h b/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.h index a559621fea..f75d27774e 100644 --- a/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.h +++ b/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.h @@ -35,7 +35,7 @@ double * createStatesArray(); double * createVariablesArray(); void deleteArray(double *array); -void initialiseVariables(double *states, double *rates, double *variables); +void initialiseVariables(double *states, double *rates, double *constants); void computeComputedConstants(double *computedConstants); void computeRates(double voi, double *states, double *rates, double *variables); void computeVariables(double voi, double *states, double *rates, double *variables); diff --git a/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.py b/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.py index a020f51011..320add7444 100644 --- a/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.py +++ b/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.py @@ -41,7 +41,7 @@ def create_variables_array(): return [nan]*VARIABLE_COUNT -def initialise_variables(states, rates, variables): +def initialise_variables(states, rates, constants): variables[0] = 1.0 states[0] = -2.0 states[1] = 0.0 diff --git a/tests/resources/generator/ode_multiple_odes_with_same_name/model.c b/tests/resources/generator/ode_multiple_odes_with_same_name/model.c index 40cc955aba..bd59a1786a 100644 --- a/tests/resources/generator/ode_multiple_odes_with_same_name/model.c +++ b/tests/resources/generator/ode_multiple_odes_with_same_name/model.c @@ -51,7 +51,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double *states, double *rates, double *variables) +void initialiseVariables(double *states, double *rates, double *constants) { variables[0] = 1.0; states[0] = 1.0; diff --git a/tests/resources/generator/ode_multiple_odes_with_same_name/model.h b/tests/resources/generator/ode_multiple_odes_with_same_name/model.h index 2b904e6bcb..c1830c26fd 100644 --- a/tests/resources/generator/ode_multiple_odes_with_same_name/model.h +++ b/tests/resources/generator/ode_multiple_odes_with_same_name/model.h @@ -35,7 +35,7 @@ double * createStatesArray(); double * createVariablesArray(); void deleteArray(double *array); -void initialiseVariables(double *states, double *rates, double *variables); +void initialiseVariables(double *states, double *rates, double *constants); void computeComputedConstants(double *computedConstants); void computeRates(double voi, double *states, double *rates, double *variables); void computeVariables(double voi, double *states, double *rates, double *variables); diff --git a/tests/resources/generator/ode_multiple_odes_with_same_name/model.py b/tests/resources/generator/ode_multiple_odes_with_same_name/model.py index 06b202ef8f..0c442c1820 100644 --- a/tests/resources/generator/ode_multiple_odes_with_same_name/model.py +++ b/tests/resources/generator/ode_multiple_odes_with_same_name/model.py @@ -41,7 +41,7 @@ def create_variables_array(): return [nan]*VARIABLE_COUNT -def initialise_variables(states, rates, variables): +def initialise_variables(states, rates, constants): variables[0] = 1.0 states[0] = 1.0 states[1] = 1.0 diff --git a/tests/resources/generator/ode_unknown_var_on_rhs/model.c b/tests/resources/generator/ode_unknown_var_on_rhs/model.c index 0f39593a52..8d5a4124a9 100644 --- a/tests/resources/generator/ode_unknown_var_on_rhs/model.c +++ b/tests/resources/generator/ode_unknown_var_on_rhs/model.c @@ -50,7 +50,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double *states, double *rates, double *variables) +void initialiseVariables(double *states, double *rates, double *constants) { states[0] = 1.0; states[1] = 1.0; diff --git a/tests/resources/generator/ode_unknown_var_on_rhs/model.h b/tests/resources/generator/ode_unknown_var_on_rhs/model.h index 614cdc5ec6..2279ebcc10 100644 --- a/tests/resources/generator/ode_unknown_var_on_rhs/model.h +++ b/tests/resources/generator/ode_unknown_var_on_rhs/model.h @@ -35,7 +35,7 @@ double * createStatesArray(); double * createVariablesArray(); void deleteArray(double *array); -void initialiseVariables(double *states, double *rates, double *variables); +void initialiseVariables(double *states, double *rates, double *constants); void computeComputedConstants(double *computedConstants); void computeRates(double voi, double *states, double *rates, double *variables); void computeVariables(double voi, double *states, double *rates, double *variables); diff --git a/tests/resources/generator/ode_unknown_var_on_rhs/model.py b/tests/resources/generator/ode_unknown_var_on_rhs/model.py index eb04fc9df5..70d8d2ad02 100644 --- a/tests/resources/generator/ode_unknown_var_on_rhs/model.py +++ b/tests/resources/generator/ode_unknown_var_on_rhs/model.py @@ -40,7 +40,7 @@ def create_variables_array(): return [nan]*VARIABLE_COUNT -def initialise_variables(states, rates, variables): +def initialise_variables(states, rates, constants): states[0] = 1.0 states[1] = 1.0 diff --git a/tests/resources/generator/robertson_model_1966/model.dae.c b/tests/resources/generator/robertson_model_1966/model.dae.c index 36df485fd7..b083983e4b 100644 --- a/tests/resources/generator/robertson_model_1966/model.dae.c +++ b/tests/resources/generator/robertson_model_1966/model.dae.c @@ -89,7 +89,7 @@ void findRoot0(double voi, double *states, double *rates, double *variables) variables[2] = u[0]; } -void initialiseVariables(double *states, double *rates, double *variables) +void initialiseVariables(double *states, double *rates, double *constants) { variables[0] = 0.04; variables[1] = 1.0e4; diff --git a/tests/resources/generator/robertson_model_1966/model.dae.h b/tests/resources/generator/robertson_model_1966/model.dae.h index e5229113ea..fe620e70fd 100644 --- a/tests/resources/generator/robertson_model_1966/model.dae.h +++ b/tests/resources/generator/robertson_model_1966/model.dae.h @@ -35,7 +35,7 @@ double * createStatesArray(); double * createVariablesArray(); void deleteArray(double *array); -void initialiseVariables(double *states, double *rates, double *variables); +void initialiseVariables(double *states, double *rates, double *constants); void computeComputedConstants(double *computedConstants); void computeRates(double voi, double *states, double *rates, double *variables); void computeVariables(double voi, double *states, double *rates, double *variables); diff --git a/tests/resources/generator/robertson_model_1966/model.dae.py b/tests/resources/generator/robertson_model_1966/model.dae.py index 9e6f0c27e1..43ed6059b1 100644 --- a/tests/resources/generator/robertson_model_1966/model.dae.py +++ b/tests/resources/generator/robertson_model_1966/model.dae.py @@ -69,7 +69,7 @@ def find_root_0(voi, states, rates, variables): variables[2] = u[0] -def initialise_variables(states, rates, variables): +def initialise_variables(states, rates, constants): variables[0] = 0.04 variables[1] = 1.0e4 variables[2] = 0.0 diff --git a/tests/resources/generator/robertson_model_1966/model.ode.c b/tests/resources/generator/robertson_model_1966/model.ode.c index 56108226b9..40304d9a62 100644 --- a/tests/resources/generator/robertson_model_1966/model.ode.c +++ b/tests/resources/generator/robertson_model_1966/model.ode.c @@ -55,7 +55,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double *states, double *rates, double *variables) +void initialiseVariables(double *states, double *rates, double *constants) { variables[0] = 0.04; variables[1] = 1.0e4; diff --git a/tests/resources/generator/robertson_model_1966/model.ode.h b/tests/resources/generator/robertson_model_1966/model.ode.h index e5229113ea..fe620e70fd 100644 --- a/tests/resources/generator/robertson_model_1966/model.ode.h +++ b/tests/resources/generator/robertson_model_1966/model.ode.h @@ -35,7 +35,7 @@ double * createStatesArray(); double * createVariablesArray(); void deleteArray(double *array); -void initialiseVariables(double *states, double *rates, double *variables); +void initialiseVariables(double *states, double *rates, double *constants); void computeComputedConstants(double *computedConstants); void computeRates(double voi, double *states, double *rates, double *variables); void computeVariables(double voi, double *states, double *rates, double *variables); diff --git a/tests/resources/generator/robertson_model_1966/model.ode.py b/tests/resources/generator/robertson_model_1966/model.ode.py index 0f7a9c0391..d80b59dfca 100644 --- a/tests/resources/generator/robertson_model_1966/model.ode.py +++ b/tests/resources/generator/robertson_model_1966/model.ode.py @@ -45,7 +45,7 @@ def create_variables_array(): return [nan]*VARIABLE_COUNT -def initialise_variables(states, rates, variables): +def initialise_variables(states, rates, constants): variables[0] = 0.04 variables[1] = 1.0e4 variables[2] = 3.0e7 diff --git a/tests/resources/generator/sine_model_imports/model.c b/tests/resources/generator/sine_model_imports/model.c index 5dbedca639..aa2e6b1ceb 100644 --- a/tests/resources/generator/sine_model_imports/model.c +++ b/tests/resources/generator/sine_model_imports/model.c @@ -59,7 +59,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double *states, double *rates, double *variables) +void initialiseVariables(double *states, double *rates, double *constants) { variables[1] = 0.0; variables[3] = 0.75; diff --git a/tests/resources/generator/sine_model_imports/model.h b/tests/resources/generator/sine_model_imports/model.h index 442d67f1cf..613e4f9aa9 100644 --- a/tests/resources/generator/sine_model_imports/model.h +++ b/tests/resources/generator/sine_model_imports/model.h @@ -35,7 +35,7 @@ double * createStatesArray(); double * createVariablesArray(); void deleteArray(double *array); -void initialiseVariables(double *states, double *rates, double *variables); +void initialiseVariables(double *states, double *rates, double *constants); void computeComputedConstants(double *computedConstants); void computeRates(double voi, double *states, double *rates, double *variables); void computeVariables(double voi, double *states, double *rates, double *variables); diff --git a/tests/resources/generator/sine_model_imports/model.py b/tests/resources/generator/sine_model_imports/model.py index 0feacef131..191913e4ae 100644 --- a/tests/resources/generator/sine_model_imports/model.py +++ b/tests/resources/generator/sine_model_imports/model.py @@ -53,7 +53,7 @@ def create_variables_array(): return [nan]*VARIABLE_COUNT -def initialise_variables(states, rates, variables): +def initialise_variables(states, rates, constants): variables[1] = 0.0 variables[3] = 0.75 variables[4] = 2.0/3.14159265358979 diff --git a/tests/resources/generator/unknown_variable_as_external_variable/model.c b/tests/resources/generator/unknown_variable_as_external_variable/model.c index ccabbc6bb8..f8e4ac81c2 100644 --- a/tests/resources/generator/unknown_variable_as_external_variable/model.c +++ b/tests/resources/generator/unknown_variable_as_external_variable/model.c @@ -41,7 +41,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double *variables, ExternalVariable externalVariable) +void initialiseVariables(double *constants, ExternalVariable externalVariable) { variables[1] = 1.1; variables[2] = 21262500.0; diff --git a/tests/resources/generator/unknown_variable_as_external_variable/model.h b/tests/resources/generator/unknown_variable_as_external_variable/model.h index 0673bd2f68..d8442ae9e1 100644 --- a/tests/resources/generator/unknown_variable_as_external_variable/model.h +++ b/tests/resources/generator/unknown_variable_as_external_variable/model.h @@ -32,6 +32,6 @@ void deleteArray(double *array); typedef double (* ExternalVariable)(double *variables, size_t index); -void initialiseVariables(double *variables, ExternalVariable externalVariable); +void initialiseVariables(double *constants, ExternalVariable externalVariable); void computeComputedConstants(double *computedConstants); void computeVariables(double *variables, ExternalVariable externalVariable); diff --git a/tests/resources/generator/unknown_variable_as_external_variable/model.py b/tests/resources/generator/unknown_variable_as_external_variable/model.py index 90ace85bd2..7c13d97e39 100644 --- a/tests/resources/generator/unknown_variable_as_external_variable/model.py +++ b/tests/resources/generator/unknown_variable_as_external_variable/model.py @@ -37,7 +37,7 @@ def create_variables_array(): return [nan]*VARIABLE_COUNT -def initialise_variables(variables, external_variable): +def initialise_variables(constants, external_variable): variables[1] = 1.1 variables[2] = 21262500.0 variables[3] = 150.0 diff --git a/tests/resources/generator/variable_initialised_using_a_constant/model.c b/tests/resources/generator/variable_initialised_using_a_constant/model.c index 4f6983da4b..469b04c720 100644 --- a/tests/resources/generator/variable_initialised_using_a_constant/model.c +++ b/tests/resources/generator/variable_initialised_using_a_constant/model.c @@ -50,7 +50,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double *states, double *rates, double *variables) +void initialiseVariables(double *states, double *rates, double *constants) { variables[0] = 7.0; states[0] = variables[0]; diff --git a/tests/resources/generator/variable_initialised_using_a_constant/model.h b/tests/resources/generator/variable_initialised_using_a_constant/model.h index 4db60c5e23..a92fc36f89 100644 --- a/tests/resources/generator/variable_initialised_using_a_constant/model.h +++ b/tests/resources/generator/variable_initialised_using_a_constant/model.h @@ -35,7 +35,7 @@ double * createStatesArray(); double * createVariablesArray(); void deleteArray(double *array); -void initialiseVariables(double *states, double *rates, double *variables); +void initialiseVariables(double *states, double *rates, double *constants); void computeComputedConstants(double *computedConstants); void computeRates(double voi, double *states, double *rates, double *variables); void computeVariables(double voi, double *states, double *rates, double *variables); diff --git a/tests/resources/generator/variable_initialised_using_a_constant/model.py b/tests/resources/generator/variable_initialised_using_a_constant/model.py index 929ca69ecf..ff57a76839 100644 --- a/tests/resources/generator/variable_initialised_using_a_constant/model.py +++ b/tests/resources/generator/variable_initialised_using_a_constant/model.py @@ -40,7 +40,7 @@ def create_variables_array(): return [nan]*VARIABLE_COUNT -def initialise_variables(states, rates, variables): +def initialise_variables(states, rates, constants): variables[0] = 7.0 states[0] = variables[0] From 56a86583d4ed7f759f514aa75e1006ba42faf1f2 Mon Sep 17 00:00:00 2001 From: Alan Garny Date: Wed, 7 Aug 2024 16:20:27 +0200 Subject: [PATCH 04/85] Generator: use different arrays for constants, computed constants, and algebraic variables for computeRates(). --- src/generatorprofile.cpp | 12 ++++++------ src/generatorprofilesha1values.h | 4 ++-- tests/bindings/python/test_generator_profile.py | 8 ++++---- tests/generator/generatorprofile.cpp | 8 ++++---- tests/resources/coverage/generator/model.c | 2 +- tests/resources/coverage/generator/model.h | 2 +- .../coverage/generator/model.implementation.out | 2 +- .../resources/coverage/generator/model.interface.out | 2 +- .../coverage/generator/model.modified.profile.c | 2 +- .../coverage/generator/model.modified.profile.h | 2 +- .../coverage/generator/model.modified.profile.py | 2 +- tests/resources/coverage/generator/model.out | 2 +- tests/resources/coverage/generator/model.py | 2 +- .../algebraic_eqn_derivative_on_rhs/model.c | 2 +- .../algebraic_eqn_derivative_on_rhs/model.h | 2 +- .../algebraic_eqn_derivative_on_rhs/model.py | 2 +- .../model.c | 2 +- .../model.h | 2 +- .../model.py | 2 +- .../generator/algebraic_eqn_state_var_on_rhs/model.c | 2 +- .../generator/algebraic_eqn_state_var_on_rhs/model.h | 2 +- .../algebraic_eqn_state_var_on_rhs/model.py | 2 +- .../model.c | 2 +- .../model.h | 2 +- .../model.py | 2 +- .../cellml_mappings_and_encapsulations/model.c | 2 +- .../cellml_mappings_and_encapsulations/model.h | 2 +- .../cellml_mappings_and_encapsulations/model.py | 2 +- .../cellml_state_initialised_using_variable/model.c | 2 +- .../cellml_state_initialised_using_variable/model.h | 2 +- .../cellml_state_initialised_using_variable/model.py | 2 +- .../generator/cellml_unit_scaling_rate/model.c | 2 +- .../generator/cellml_unit_scaling_rate/model.h | 2 +- .../generator/cellml_unit_scaling_rate/model.py | 2 +- .../generator/cellml_unit_scaling_state/model.c | 2 +- .../generator/cellml_unit_scaling_state/model.h | 2 +- .../generator/cellml_unit_scaling_state/model.py | 2 +- .../model.c | 2 +- .../model.h | 2 +- .../model.py | 2 +- .../model.c | 2 +- .../model.h | 2 +- .../model.py | 2 +- .../generator/cellml_unit_scaling_voi_direct/model.c | 2 +- .../generator/cellml_unit_scaling_voi_direct/model.h | 2 +- .../cellml_unit_scaling_voi_direct/model.py | 2 +- .../cellml_unit_scaling_voi_indirect/model.c | 2 +- .../cellml_unit_scaling_voi_indirect/model.h | 2 +- .../cellml_unit_scaling_voi_indirect/model.py | 2 +- .../resources/generator/dae_cellml_1_1_model/model.c | 2 +- .../resources/generator/dae_cellml_1_1_model/model.h | 2 +- .../generator/dae_cellml_1_1_model/model.py | 2 +- tests/resources/generator/dependent_eqns/model.c | 2 +- tests/resources/generator/dependent_eqns/model.h | 2 +- tests/resources/generator/dependent_eqns/model.py | 2 +- .../model.c | 2 +- .../model.h | 2 +- .../model.py | 2 +- .../model.c | 2 +- .../model.h | 2 +- .../model.py | 2 +- .../model.algebraic.c | 2 +- .../model.algebraic.h | 2 +- .../model.algebraic.py | 2 +- .../hodgkin_huxley_squid_axon_model_1952/model.c | 2 +- .../model.computed.constant.c | 2 +- .../model.computed.constant.h | 2 +- .../model.computed.constant.py | 2 +- .../model.constant.c | 2 +- .../model.constant.h | 2 +- .../model.constant.py | 2 +- .../hodgkin_huxley_squid_axon_model_1952/model.dae.c | 2 +- .../hodgkin_huxley_squid_axon_model_1952/model.dae.h | 2 +- .../model.dae.py | 2 +- .../model.dependent.algebraic.c | 2 +- .../model.dependent.algebraic.h | 2 +- .../model.dependent.algebraic.py | 2 +- .../model.dependent.computed.constant.c | 2 +- .../model.dependent.computed.constant.h | 2 +- .../model.dependent.computed.constant.py | 2 +- .../model.dependent.constant.c | 2 +- .../model.dependent.constant.h | 2 +- .../model.dependent.constant.py | 2 +- .../model.dependent.state.c | 2 +- .../model.dependent.state.h | 2 +- .../model.dependent.state.py | 2 +- .../model.external.c | 2 +- .../model.external.h | 2 +- .../model.external.py | 2 +- .../hodgkin_huxley_squid_axon_model_1952/model.h | 2 +- .../hodgkin_huxley_squid_axon_model_1952/model.py | 2 +- .../model.state.c | 2 +- .../model.state.h | 2 +- .../model.state.py | 2 +- tests/resources/generator/noble_model_1962/model.c | 2 +- tests/resources/generator/noble_model_1962/model.h | 2 +- tests/resources/generator/noble_model_1962/model.py | 2 +- .../generator/ode_computed_var_on_rhs/model.c | 2 +- .../generator/ode_computed_var_on_rhs/model.h | 2 +- .../generator/ode_computed_var_on_rhs/model.py | 2 +- .../ode_computed_var_on_rhs_one_component/model.c | 2 +- .../ode_computed_var_on_rhs_one_component/model.h | 2 +- .../ode_computed_var_on_rhs_one_component/model.py | 2 +- .../resources/generator/ode_const_var_on_rhs/model.c | 2 +- .../resources/generator/ode_const_var_on_rhs/model.h | 2 +- .../generator/ode_const_var_on_rhs/model.py | 2 +- .../ode_const_var_on_rhs_one_component/model.c | 2 +- .../ode_const_var_on_rhs_one_component/model.h | 2 +- .../ode_const_var_on_rhs_one_component/model.py | 2 +- .../resources/generator/ode_constant_on_rhs/model.c | 2 +- .../resources/generator/ode_constant_on_rhs/model.h | 2 +- .../resources/generator/ode_constant_on_rhs/model.py | 2 +- .../ode_constant_on_rhs_one_component/model.c | 2 +- .../ode_constant_on_rhs_one_component/model.h | 2 +- .../ode_constant_on_rhs_one_component/model.py | 2 +- .../generator/ode_multiple_dependent_odes/model.c | 2 +- .../generator/ode_multiple_dependent_odes/model.h | 2 +- .../generator/ode_multiple_dependent_odes/model.py | 2 +- .../model.c | 2 +- .../model.h | 2 +- .../model.py | 2 +- .../ode_multiple_odes_with_same_name/model.c | 2 +- .../ode_multiple_odes_with_same_name/model.h | 2 +- .../ode_multiple_odes_with_same_name/model.py | 2 +- .../generator/ode_unknown_var_on_rhs/model.c | 2 +- .../generator/ode_unknown_var_on_rhs/model.h | 2 +- .../generator/ode_unknown_var_on_rhs/model.py | 2 +- .../generator/robertson_model_1966/model.dae.c | 2 +- .../generator/robertson_model_1966/model.dae.h | 2 +- .../generator/robertson_model_1966/model.dae.py | 2 +- .../generator/robertson_model_1966/model.ode.c | 2 +- .../generator/robertson_model_1966/model.ode.h | 2 +- .../generator/robertson_model_1966/model.ode.py | 2 +- tests/resources/generator/sine_model_imports/model.c | 2 +- tests/resources/generator/sine_model_imports/model.h | 2 +- .../resources/generator/sine_model_imports/model.py | 2 +- .../variable_initialised_using_a_constant/model.c | 2 +- .../variable_initialised_using_a_constant/model.h | 2 +- .../variable_initialised_using_a_constant/model.py | 2 +- 139 files changed, 151 insertions(+), 151 deletions(-) diff --git a/src/generatorprofile.cpp b/src/generatorprofile.cpp index f69e51b920..97861c3c32 100644 --- a/src/generatorprofile.cpp +++ b/src/generatorprofile.cpp @@ -695,13 +695,13 @@ void GeneratorProfile::GeneratorProfileImpl::loadProfile(GeneratorProfile::Profi "[CODE]" "}\n"; - mInterfaceComputeRatesMethodWoevString = "void computeRates(double voi, double *states, double *rates, double *variables);\n"; - mImplementationComputeRatesMethodWoevString = "void computeRates(double voi, double *states, double *rates, double *variables)\n{\n" + mInterfaceComputeRatesMethodWoevString = "void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic);\n"; + mImplementationComputeRatesMethodWoevString = "void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic)\n{\n" "[CODE]" "}\n"; - mInterfaceComputeRatesMethodWevString = "void computeRates(double voi, double *states, double *rates, double *variables, ExternalVariable externalVariable);\n"; - mImplementationComputeRatesMethodWevString = "void computeRates(double voi, double *states, double *rates, double *variables, ExternalVariable externalVariable)\n{\n" + mInterfaceComputeRatesMethodWevString = "void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable);\n"; + mImplementationComputeRatesMethodWevString = "void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable)\n{\n" "[CODE]" "}\n"; @@ -1097,12 +1097,12 @@ void GeneratorProfile::GeneratorProfileImpl::loadProfile(GeneratorProfile::Profi mInterfaceComputeRatesMethodWoevString = ""; mImplementationComputeRatesMethodWoevString = "\n" - "def compute_rates(voi, states, rates, variables):\n" + "def compute_rates(voi, states, rates, constants, computedConstants, algebraic):\n" "[CODE]"; mInterfaceComputeRatesMethodWevString = ""; mImplementationComputeRatesMethodWevString = "\n" - "def compute_rates(voi, states, rates, variables, external_variable):\n" + "def compute_rates(voi, states, rates, constants, computedConstants, algebraic, external_variable):\n" "[CODE]"; mInterfaceComputeVariablesMethodFamWoevString = ""; diff --git a/src/generatorprofilesha1values.h b/src/generatorprofilesha1values.h index 8661315d27..9d8261e554 100644 --- a/src/generatorprofilesha1values.h +++ b/src/generatorprofilesha1values.h @@ -24,7 +24,7 @@ namespace libcellml { * The content of this file is generated, do not edit this file directly. * See docs/dev_utilities.rst for further information. */ -static const char C_GENERATOR_PROFILE_SHA1[] = "12b8069d68c8c5ebe36b14a90c0bfb880d61b73d"; -static const char PYTHON_GENERATOR_PROFILE_SHA1[] = "ed70973a0cf394f386857d43bb4497b9b7f99e03"; +static const char C_GENERATOR_PROFILE_SHA1[] = "47a9b5b8e33ce2fa29c0385e0debe1d295a7e313"; +static const char PYTHON_GENERATOR_PROFILE_SHA1[] = "f171d1553ad485ad286b4a1152bc7d89631750a6"; } // namespace libcellml diff --git a/tests/bindings/python/test_generator_profile.py b/tests/bindings/python/test_generator_profile.py index 0d48a9a24d..200b1fc250 100644 --- a/tests/bindings/python/test_generator_profile.py +++ b/tests/bindings/python/test_generator_profile.py @@ -772,13 +772,13 @@ def test_implementation_compute_rates_method_string(self): g = GeneratorProfile() self.assertEqual( - 'void computeRates(double voi, double *states, double *rates, double *variables)\n{\n[CODE]}\n', + 'void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic)\n{\n[CODE]}\n', g.implementationComputeRatesMethodString(False)) g.setImplementationComputeRatesMethodString(False, GeneratorProfileTestCase.VALUE) self.assertEqual(GeneratorProfileTestCase.VALUE, g.implementationComputeRatesMethodString(False)) self.assertEqual( - 'void computeRates(double voi, double *states, double *rates, double *variables, ExternalVariable externalVariable)\n{\n[CODE]}\n', + 'void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable)\n{\n[CODE]}\n', g.implementationComputeRatesMethodString(True)) g.setImplementationComputeRatesMethodString(True, GeneratorProfileTestCase.VALUE) self.assertEqual(GeneratorProfileTestCase.VALUE, g.implementationComputeRatesMethodString(True)) @@ -996,13 +996,13 @@ def test_interface_compute_rates_method_string(self): g = GeneratorProfile() self.assertEqual( - 'void computeRates(double voi, double *states, double *rates, double *variables);\n', + 'void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic);\n', g.interfaceComputeRatesMethodString(False)) g.setInterfaceComputeRatesMethodString(False, GeneratorProfileTestCase.VALUE) self.assertEqual(GeneratorProfileTestCase.VALUE, g.interfaceComputeRatesMethodString(False)) self.assertEqual( - 'void computeRates(double voi, double *states, double *rates, double *variables, ExternalVariable externalVariable);\n', + 'void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable);\n', g.interfaceComputeRatesMethodString(True)) g.setInterfaceComputeRatesMethodString(True, GeneratorProfileTestCase.VALUE) self.assertEqual(GeneratorProfileTestCase.VALUE, g.interfaceComputeRatesMethodString(True)) diff --git a/tests/generator/generatorprofile.cpp b/tests/generator/generatorprofile.cpp index 401b6ddddc..739baf7354 100644 --- a/tests/generator/generatorprofile.cpp +++ b/tests/generator/generatorprofile.cpp @@ -499,17 +499,17 @@ TEST(GeneratorProfile, defaultMiscellaneousValues) "}\n", generatorProfile->implementationComputeComputedConstantsMethodString()); - EXPECT_EQ("void computeRates(double voi, double *states, double *rates, double *variables);\n", + EXPECT_EQ("void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic);\n", generatorProfile->interfaceComputeRatesMethodString(false)); - EXPECT_EQ("void computeRates(double voi, double *states, double *rates, double *variables)\n" + EXPECT_EQ("void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic)\n" "{\n" "[CODE]" "}\n", generatorProfile->implementationComputeRatesMethodString(false)); - EXPECT_EQ("void computeRates(double voi, double *states, double *rates, double *variables, ExternalVariable externalVariable);\n", + EXPECT_EQ("void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable);\n", generatorProfile->interfaceComputeRatesMethodString(true)); - EXPECT_EQ("void computeRates(double voi, double *states, double *rates, double *variables, ExternalVariable externalVariable)\n" + EXPECT_EQ("void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable)\n" "{\n" "[CODE]" "}\n", diff --git a/tests/resources/coverage/generator/model.c b/tests/resources/coverage/generator/model.c index f42a715695..9de8751535 100644 --- a/tests/resources/coverage/generator/model.c +++ b/tests/resources/coverage/generator/model.c @@ -595,7 +595,7 @@ void computeComputedConstants(double *computedConstants) variables[204] = -(variables[1] && variables[2])+-((variables[6] > variables[18])?variables[2]:NAN); } -void computeRates(double voi, double *states, double *rates, double *variables) +void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { rates[0] = 1.0; } diff --git a/tests/resources/coverage/generator/model.h b/tests/resources/coverage/generator/model.h index 33bedee9ef..7730315fcc 100644 --- a/tests/resources/coverage/generator/model.h +++ b/tests/resources/coverage/generator/model.h @@ -37,5 +37,5 @@ void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *constants); void computeComputedConstants(double *computedConstants); -void computeRates(double voi, double *states, double *rates, double *variables); +void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *variables); diff --git a/tests/resources/coverage/generator/model.implementation.out b/tests/resources/coverage/generator/model.implementation.out index 64b0e5915f..9ffecca32b 100644 --- a/tests/resources/coverage/generator/model.implementation.out +++ b/tests/resources/coverage/generator/model.implementation.out @@ -364,7 +364,7 @@ void computeComputedConstants(double *computedConstants) variables[204] = -and(variables[1], variables[2])+-((gt(variables[6], variables[18]))?variables[2]:NAN); } -void computeRates(double voi, double *states, double *rates, double *variables) +void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { rates[0] = 1.0; } diff --git a/tests/resources/coverage/generator/model.interface.out b/tests/resources/coverage/generator/model.interface.out index 4efd4f2dff..efdce8c67b 100644 --- a/tests/resources/coverage/generator/model.interface.out +++ b/tests/resources/coverage/generator/model.interface.out @@ -10,5 +10,5 @@ void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *constants); void computeComputedConstants(double *computedConstants); -void computeRates(double voi, double *states, double *rates, double *variables); +void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *variables); diff --git a/tests/resources/coverage/generator/model.modified.profile.c b/tests/resources/coverage/generator/model.modified.profile.c index 105e8415b9..c35f5846f5 100644 --- a/tests/resources/coverage/generator/model.modified.profile.c +++ b/tests/resources/coverage/generator/model.modified.profile.c @@ -595,7 +595,7 @@ void computeComputedConstants(double *computedConstants) variables[204] = -(variables[1] && variables[2])+-((variables[6] > variables[18])?variables[2]:NAN); } -void computeRates(double voi, double *states, double *rates, double *variables) +void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { rates[0] = 1.0; } diff --git a/tests/resources/coverage/generator/model.modified.profile.h b/tests/resources/coverage/generator/model.modified.profile.h index 15b44e7e6d..64ce0aa87f 100644 --- a/tests/resources/coverage/generator/model.modified.profile.h +++ b/tests/resources/coverage/generator/model.modified.profile.h @@ -37,5 +37,5 @@ void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *constants); void computeComputedConstants(double *computedConstants); -void computeRates(double voi, double *states, double *rates, double *variables); +void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *variables); diff --git a/tests/resources/coverage/generator/model.modified.profile.py b/tests/resources/coverage/generator/model.modified.profile.py index 178219f7e3..f2c561dfd2 100644 --- a/tests/resources/coverage/generator/model.modified.profile.py +++ b/tests/resources/coverage/generator/model.modified.profile.py @@ -594,7 +594,7 @@ def compute_computed_constants(computed_constants): variables[204] = -and_func(variables[1], variables[2])+-(variables[2] if gt_func(variables[6], variables[18]) else nan) -def compute_rates(voi, states, rates, variables): +def compute_rates(voi, states, rates, constants, computedConstants, algebraic): rates[0] = 1.0 diff --git a/tests/resources/coverage/generator/model.out b/tests/resources/coverage/generator/model.out index a8b63dc145..18d0685f79 100644 --- a/tests/resources/coverage/generator/model.out +++ b/tests/resources/coverage/generator/model.out @@ -334,7 +334,7 @@ void computeComputedConstants(double *computedConstants) variables[204] = -(variables[1] && variables[2])+-piecewise(variables[6] > variables[18], variables[2], NAN); } -void computeRates(double voi, double *states, double *rates, double *variables) +void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { rates[0] = 1.0; } diff --git a/tests/resources/coverage/generator/model.py b/tests/resources/coverage/generator/model.py index ef25765870..14f9649a82 100644 --- a/tests/resources/coverage/generator/model.py +++ b/tests/resources/coverage/generator/model.py @@ -594,7 +594,7 @@ def compute_computed_constants(computed_constants): variables[204] = -and_func(variables[1], variables[2])+-(variables[2] if gt_func(variables[6], variables[18]) else nan) -def compute_rates(voi, states, rates, variables): +def compute_rates(voi, states, rates, constants, computedConstants, algebraic): rates[0] = 1.0 diff --git a/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.c b/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.c index 72996b13ea..9b3bafb898 100644 --- a/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.c +++ b/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.c @@ -61,7 +61,7 @@ void computeComputedConstants(double *computedConstants) { } -void computeRates(double voi, double *states, double *rates, double *variables) +void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { rates[0] = variables[0]; } diff --git a/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.h b/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.h index b7c0c64e35..d05526b0f9 100644 --- a/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.h +++ b/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.h @@ -37,5 +37,5 @@ void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *constants); void computeComputedConstants(double *computedConstants); -void computeRates(double voi, double *states, double *rates, double *variables); +void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *variables); diff --git a/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.py b/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.py index a7ae59d7c6..fab4c53eb9 100644 --- a/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.py +++ b/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.py @@ -50,7 +50,7 @@ def compute_computed_constants(computed_constants): pass -def compute_rates(voi, states, rates, variables): +def compute_rates(voi, states, rates, constants, computedConstants, algebraic): rates[0] = variables[0] diff --git a/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.c b/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.c index 600e336508..1c98887b52 100644 --- a/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.c +++ b/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.c @@ -61,7 +61,7 @@ void computeComputedConstants(double *computedConstants) { } -void computeRates(double voi, double *states, double *rates, double *variables) +void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { rates[0] = variables[0]; } diff --git a/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.h b/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.h index be002fd715..7f86bfafdd 100644 --- a/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.h +++ b/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.h @@ -37,5 +37,5 @@ void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *constants); void computeComputedConstants(double *computedConstants); -void computeRates(double voi, double *states, double *rates, double *variables); +void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *variables); diff --git a/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.py b/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.py index 546587aa93..5a1db9e80a 100644 --- a/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.py +++ b/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.py @@ -50,7 +50,7 @@ def compute_computed_constants(computed_constants): pass -def compute_rates(voi, states, rates, variables): +def compute_rates(voi, states, rates, constants, computedConstants, algebraic): rates[0] = variables[0] diff --git a/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.c b/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.c index 55b34a5167..4539a94e66 100644 --- a/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.c +++ b/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.c @@ -61,7 +61,7 @@ void computeComputedConstants(double *computedConstants) { } -void computeRates(double voi, double *states, double *rates, double *variables) +void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { rates[0] = variables[0]; } diff --git a/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.h b/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.h index e1313e3957..687e4f315a 100644 --- a/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.h +++ b/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.h @@ -37,5 +37,5 @@ void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *constants); void computeComputedConstants(double *computedConstants); -void computeRates(double voi, double *states, double *rates, double *variables); +void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *variables); diff --git a/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.py b/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.py index 6ea7c7cd78..59f13819af 100644 --- a/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.py +++ b/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.py @@ -50,7 +50,7 @@ def compute_computed_constants(computed_constants): pass -def compute_rates(voi, states, rates, variables): +def compute_rates(voi, states, rates, constants, computedConstants, algebraic): rates[0] = variables[0] diff --git a/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.c b/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.c index 03905f2818..3a124f662f 100644 --- a/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.c +++ b/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.c @@ -61,7 +61,7 @@ void computeComputedConstants(double *computedConstants) { } -void computeRates(double voi, double *states, double *rates, double *variables) +void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { rates[0] = variables[0]; } diff --git a/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.h b/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.h index 90ebf612d7..b30eab519f 100644 --- a/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.h +++ b/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.h @@ -37,5 +37,5 @@ void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *constants); void computeComputedConstants(double *computedConstants); -void computeRates(double voi, double *states, double *rates, double *variables); +void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *variables); diff --git a/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.py b/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.py index 866f33265e..1ed616c4fa 100644 --- a/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.py +++ b/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.py @@ -50,7 +50,7 @@ def compute_computed_constants(computed_constants): pass -def compute_rates(voi, states, rates, variables): +def compute_rates(voi, states, rates, constants, computedConstants, algebraic): rates[0] = variables[0] diff --git a/tests/resources/generator/cellml_mappings_and_encapsulations/model.c b/tests/resources/generator/cellml_mappings_and_encapsulations/model.c index cf7fe6f05b..c4d18d612e 100644 --- a/tests/resources/generator/cellml_mappings_and_encapsulations/model.c +++ b/tests/resources/generator/cellml_mappings_and_encapsulations/model.c @@ -62,7 +62,7 @@ void computeComputedConstants(double *computedConstants) { } -void computeRates(double voi, double *states, double *rates, double *variables) +void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { rates[1] = -states[0]*1.0; rates[0] = states[1]*1.0; diff --git a/tests/resources/generator/cellml_mappings_and_encapsulations/model.h b/tests/resources/generator/cellml_mappings_and_encapsulations/model.h index 714fa4d81f..edaae29a0c 100644 --- a/tests/resources/generator/cellml_mappings_and_encapsulations/model.h +++ b/tests/resources/generator/cellml_mappings_and_encapsulations/model.h @@ -37,5 +37,5 @@ void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *constants); void computeComputedConstants(double *computedConstants); -void computeRates(double voi, double *states, double *rates, double *variables); +void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *variables); diff --git a/tests/resources/generator/cellml_mappings_and_encapsulations/model.py b/tests/resources/generator/cellml_mappings_and_encapsulations/model.py index c45ea5a1c1..dc65de94a6 100644 --- a/tests/resources/generator/cellml_mappings_and_encapsulations/model.py +++ b/tests/resources/generator/cellml_mappings_and_encapsulations/model.py @@ -51,7 +51,7 @@ def compute_computed_constants(computed_constants): pass -def compute_rates(voi, states, rates, variables): +def compute_rates(voi, states, rates, constants, computedConstants, algebraic): rates[1] = -states[0]*1.0 rates[0] = states[1]*1.0 diff --git a/tests/resources/generator/cellml_state_initialised_using_variable/model.c b/tests/resources/generator/cellml_state_initialised_using_variable/model.c index ba79edb18d..3475b85d51 100644 --- a/tests/resources/generator/cellml_state_initialised_using_variable/model.c +++ b/tests/resources/generator/cellml_state_initialised_using_variable/model.c @@ -60,7 +60,7 @@ void computeComputedConstants(double *computedConstants) { } -void computeRates(double voi, double *states, double *rates, double *variables) +void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { rates[0] = 1.23; } diff --git a/tests/resources/generator/cellml_state_initialised_using_variable/model.h b/tests/resources/generator/cellml_state_initialised_using_variable/model.h index 3140db530e..3c03deb824 100644 --- a/tests/resources/generator/cellml_state_initialised_using_variable/model.h +++ b/tests/resources/generator/cellml_state_initialised_using_variable/model.h @@ -37,5 +37,5 @@ void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *constants); void computeComputedConstants(double *computedConstants); -void computeRates(double voi, double *states, double *rates, double *variables); +void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *variables); diff --git a/tests/resources/generator/cellml_state_initialised_using_variable/model.py b/tests/resources/generator/cellml_state_initialised_using_variable/model.py index 690365c51a..d0b35c9394 100644 --- a/tests/resources/generator/cellml_state_initialised_using_variable/model.py +++ b/tests/resources/generator/cellml_state_initialised_using_variable/model.py @@ -49,7 +49,7 @@ def compute_computed_constants(computed_constants): pass -def compute_rates(voi, states, rates, variables): +def compute_rates(voi, states, rates, constants, computedConstants, algebraic): rates[0] = 1.23 diff --git a/tests/resources/generator/cellml_unit_scaling_rate/model.c b/tests/resources/generator/cellml_unit_scaling_rate/model.c index 78c1c72529..9af4c26b6f 100644 --- a/tests/resources/generator/cellml_unit_scaling_rate/model.c +++ b/tests/resources/generator/cellml_unit_scaling_rate/model.c @@ -60,7 +60,7 @@ void computeComputedConstants(double *computedConstants) { } -void computeRates(double voi, double *states, double *rates, double *variables) +void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { rates[0] = 1.23; } diff --git a/tests/resources/generator/cellml_unit_scaling_rate/model.h b/tests/resources/generator/cellml_unit_scaling_rate/model.h index 3140db530e..3c03deb824 100644 --- a/tests/resources/generator/cellml_unit_scaling_rate/model.h +++ b/tests/resources/generator/cellml_unit_scaling_rate/model.h @@ -37,5 +37,5 @@ void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *constants); void computeComputedConstants(double *computedConstants); -void computeRates(double voi, double *states, double *rates, double *variables); +void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *variables); diff --git a/tests/resources/generator/cellml_unit_scaling_rate/model.py b/tests/resources/generator/cellml_unit_scaling_rate/model.py index ed0b68c4d9..81b99ccccd 100644 --- a/tests/resources/generator/cellml_unit_scaling_rate/model.py +++ b/tests/resources/generator/cellml_unit_scaling_rate/model.py @@ -49,7 +49,7 @@ def compute_computed_constants(computed_constants): pass -def compute_rates(voi, states, rates, variables): +def compute_rates(voi, states, rates, constants, computedConstants, algebraic): rates[0] = 1.23 diff --git a/tests/resources/generator/cellml_unit_scaling_state/model.c b/tests/resources/generator/cellml_unit_scaling_state/model.c index 633c056f53..d89ec5205a 100644 --- a/tests/resources/generator/cellml_unit_scaling_state/model.c +++ b/tests/resources/generator/cellml_unit_scaling_state/model.c @@ -60,7 +60,7 @@ void computeComputedConstants(double *computedConstants) { } -void computeRates(double voi, double *states, double *rates, double *variables) +void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { rates[0] = 1.23; } diff --git a/tests/resources/generator/cellml_unit_scaling_state/model.h b/tests/resources/generator/cellml_unit_scaling_state/model.h index 3140db530e..3c03deb824 100644 --- a/tests/resources/generator/cellml_unit_scaling_state/model.h +++ b/tests/resources/generator/cellml_unit_scaling_state/model.h @@ -37,5 +37,5 @@ void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *constants); void computeComputedConstants(double *computedConstants); -void computeRates(double voi, double *states, double *rates, double *variables); +void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *variables); diff --git a/tests/resources/generator/cellml_unit_scaling_state/model.py b/tests/resources/generator/cellml_unit_scaling_state/model.py index f29570cd38..8ea99efc5e 100644 --- a/tests/resources/generator/cellml_unit_scaling_state/model.py +++ b/tests/resources/generator/cellml_unit_scaling_state/model.py @@ -49,7 +49,7 @@ def compute_computed_constants(computed_constants): pass -def compute_rates(voi, states, rates, variables): +def compute_rates(voi, states, rates, constants, computedConstants, algebraic): rates[0] = 1.23 diff --git a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.c b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.c index 31ae730d05..a369dea891 100644 --- a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.c +++ b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.c @@ -60,7 +60,7 @@ void computeComputedConstants(double *computedConstants) { } -void computeRates(double voi, double *states, double *rates, double *variables) +void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { rates[0] = 1.23; rates[1] = 7.89; diff --git a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.h b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.h index 75763d81b3..6a04a2fbc6 100644 --- a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.h +++ b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.h @@ -37,5 +37,5 @@ void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *constants); void computeComputedConstants(double *computedConstants); -void computeRates(double voi, double *states, double *rates, double *variables); +void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *variables); diff --git a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.py b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.py index 8adebd9681..1217a8d8a7 100644 --- a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.py +++ b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.py @@ -49,7 +49,7 @@ def compute_computed_constants(computed_constants): pass -def compute_rates(voi, states, rates, variables): +def compute_rates(voi, states, rates, constants, computedConstants, algebraic): rates[0] = 1.23 rates[1] = 7.89 diff --git a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.c b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.c index c8b1b99cd6..3300a15074 100644 --- a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.c +++ b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.c @@ -64,7 +64,7 @@ void computeComputedConstants(double *computedConstants) { } -void computeRates(double voi, double *states, double *rates, double *variables) +void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { rates[0] = 1.23; rates[1] = 7.89; diff --git a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.h b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.h index 267e6b8b3a..4c3949f2a3 100644 --- a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.h +++ b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.h @@ -37,5 +37,5 @@ void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *constants); void computeComputedConstants(double *computedConstants); -void computeRates(double voi, double *states, double *rates, double *variables); +void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *variables); diff --git a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.py b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.py index b3b95e4e87..9db1db1206 100644 --- a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.py +++ b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.py @@ -53,7 +53,7 @@ def compute_computed_constants(computed_constants): pass -def compute_rates(voi, states, rates, variables): +def compute_rates(voi, states, rates, constants, computedConstants, algebraic): rates[0] = 1.23 rates[1] = 7.89 diff --git a/tests/resources/generator/cellml_unit_scaling_voi_direct/model.c b/tests/resources/generator/cellml_unit_scaling_voi_direct/model.c index 33e574ae52..01ebcf4265 100644 --- a/tests/resources/generator/cellml_unit_scaling_voi_direct/model.c +++ b/tests/resources/generator/cellml_unit_scaling_voi_direct/model.c @@ -60,7 +60,7 @@ void computeComputedConstants(double *computedConstants) { } -void computeRates(double voi, double *states, double *rates, double *variables) +void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { rates[0] = voi/1.0; rates[1] = 0.001*voi/1.0; diff --git a/tests/resources/generator/cellml_unit_scaling_voi_direct/model.h b/tests/resources/generator/cellml_unit_scaling_voi_direct/model.h index 2279ebcc10..0bccaf5c81 100644 --- a/tests/resources/generator/cellml_unit_scaling_voi_direct/model.h +++ b/tests/resources/generator/cellml_unit_scaling_voi_direct/model.h @@ -37,5 +37,5 @@ void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *constants); void computeComputedConstants(double *computedConstants); -void computeRates(double voi, double *states, double *rates, double *variables); +void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *variables); diff --git a/tests/resources/generator/cellml_unit_scaling_voi_direct/model.py b/tests/resources/generator/cellml_unit_scaling_voi_direct/model.py index 7e51296b60..98608474d3 100644 --- a/tests/resources/generator/cellml_unit_scaling_voi_direct/model.py +++ b/tests/resources/generator/cellml_unit_scaling_voi_direct/model.py @@ -49,7 +49,7 @@ def compute_computed_constants(computed_constants): pass -def compute_rates(voi, states, rates, variables): +def compute_rates(voi, states, rates, constants, computedConstants, algebraic): rates[0] = voi/1.0 rates[1] = 0.001*voi/1.0 diff --git a/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.c b/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.c index aac78a605c..3001a87e82 100644 --- a/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.c +++ b/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.c @@ -62,7 +62,7 @@ void computeComputedConstants(double *computedConstants) { } -void computeRates(double voi, double *states, double *rates, double *variables) +void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { rates[0] = 5.0; rates[1] = 1000.0*9.0; diff --git a/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.h b/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.h index 176d863193..e39db828a1 100644 --- a/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.h +++ b/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.h @@ -37,5 +37,5 @@ void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *constants); void computeComputedConstants(double *computedConstants); -void computeRates(double voi, double *states, double *rates, double *variables); +void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *variables); diff --git a/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.py b/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.py index c14ff09f07..3571fc7894 100644 --- a/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.py +++ b/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.py @@ -51,7 +51,7 @@ def compute_computed_constants(computed_constants): pass -def compute_rates(voi, states, rates, variables): +def compute_rates(voi, states, rates, constants, computedConstants, algebraic): rates[0] = 5.0 rates[1] = 1000.0*9.0 rates[2] = 0.001*13.0 diff --git a/tests/resources/generator/dae_cellml_1_1_model/model.c b/tests/resources/generator/dae_cellml_1_1_model/model.c index 21cfacf835..30a8c5729c 100644 --- a/tests/resources/generator/dae_cellml_1_1_model/model.c +++ b/tests/resources/generator/dae_cellml_1_1_model/model.c @@ -135,7 +135,7 @@ void computeComputedConstants(double *computedConstants) { } -void computeRates(double voi, double *states, double *rates, double *variables) +void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { variables[2] = states[1]+variables[3]; findRoot0(voi, states, rates, variables); diff --git a/tests/resources/generator/dae_cellml_1_1_model/model.h b/tests/resources/generator/dae_cellml_1_1_model/model.h index e11fde1f1d..23a61c61e6 100644 --- a/tests/resources/generator/dae_cellml_1_1_model/model.h +++ b/tests/resources/generator/dae_cellml_1_1_model/model.h @@ -37,5 +37,5 @@ void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *constants); void computeComputedConstants(double *computedConstants); -void computeRates(double voi, double *states, double *rates, double *variables); +void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *variables); diff --git a/tests/resources/generator/dae_cellml_1_1_model/model.py b/tests/resources/generator/dae_cellml_1_1_model/model.py index 931f4c83c5..f0c69dd15e 100644 --- a/tests/resources/generator/dae_cellml_1_1_model/model.py +++ b/tests/resources/generator/dae_cellml_1_1_model/model.py @@ -111,7 +111,7 @@ def compute_computed_constants(computed_constants): pass -def compute_rates(voi, states, rates, variables): +def compute_rates(voi, states, rates, constants, computedConstants, algebraic): variables[2] = states[1]+variables[3] find_root_0(voi, states, rates, variables) rates[0] = variables[0] diff --git a/tests/resources/generator/dependent_eqns/model.c b/tests/resources/generator/dependent_eqns/model.c index 76910519b1..670fcf6202 100644 --- a/tests/resources/generator/dependent_eqns/model.c +++ b/tests/resources/generator/dependent_eqns/model.c @@ -60,7 +60,7 @@ void computeComputedConstants(double *computedConstants) { } -void computeRates(double voi, double *states, double *rates, double *variables) +void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { rates[0] = 1.0; } diff --git a/tests/resources/generator/dependent_eqns/model.h b/tests/resources/generator/dependent_eqns/model.h index 7485defac7..529dbd03f9 100644 --- a/tests/resources/generator/dependent_eqns/model.h +++ b/tests/resources/generator/dependent_eqns/model.h @@ -37,5 +37,5 @@ void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *constants); void computeComputedConstants(double *computedConstants); -void computeRates(double voi, double *states, double *rates, double *variables); +void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *variables); diff --git a/tests/resources/generator/dependent_eqns/model.py b/tests/resources/generator/dependent_eqns/model.py index c9ee52382e..a48ff4587f 100644 --- a/tests/resources/generator/dependent_eqns/model.py +++ b/tests/resources/generator/dependent_eqns/model.py @@ -49,7 +49,7 @@ def compute_computed_constants(computed_constants): pass -def compute_rates(voi, states, rates, variables): +def compute_rates(voi, states, rates, constants, computedConstants, algebraic): rates[0] = 1.0 diff --git a/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.c b/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.c index 8ddf41a6ec..488858b664 100644 --- a/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.c +++ b/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.c @@ -455,7 +455,7 @@ void computeComputedConstants(double *computedConstants) variables[213] = (3.5988-0.025641)/(1.0+0.0000012155/pow(1.0*variables[0], 1.6951))+0.025641; } -void computeRates(double voi, double *states, double *rates, double *variables) +void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { variables[5] = states[1]; variables[142] = variables[3]*log((variables[4]+0.12*variables[7])/(variables[5]+0.12*variables[8])); diff --git a/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.h b/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.h index 64a364e175..c0a9edbfff 100644 --- a/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.h +++ b/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.h @@ -37,5 +37,5 @@ void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *constants); void computeComputedConstants(double *computedConstants); -void computeRates(double voi, double *states, double *rates, double *variables); +void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *variables); diff --git a/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.py b/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.py index a5cc60a71c..9306dbef62 100644 --- a/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.py +++ b/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.py @@ -463,7 +463,7 @@ def compute_computed_constants(computed_constants): variables[213] = (3.5988-0.025641)/(1.0+0.0000012155/pow(1.0*variables[0], 1.6951))+0.025641 -def compute_rates(voi, states, rates, variables): +def compute_rates(voi, states, rates, constants, computedConstants, algebraic): variables[5] = states[1] variables[142] = variables[3]*log((variables[4]+0.12*variables[7])/(variables[5]+0.12*variables[8])) variables[121] = variables[123] if and_func(gt_func(voi, variables[124]), lt_func(voi, variables[124]+variables[125])) else variables[126] diff --git a/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.c b/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.c index 81355e42cb..67fc7303c3 100644 --- a/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.c +++ b/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.c @@ -404,7 +404,7 @@ void computeComputedConstants(double *computedConstants) variables[176] = (variables[2] == 0.0)?variables[177]+variables[0]*(variables[178]-variables[177]):(variables[2] == 1.0)?variables[181]+variables[0]*(variables[182]-variables[181]):variables[179]+variables[0]*(variables[180]-variables[179]); } -void computeRates(double voi, double *states, double *rates, double *variables) +void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { variables[9] = variables[62]*pow(variables[56]/(variables[71]+variables[56]), 3.0)*pow(variables[69]/(variables[70]+variables[69]), 2.0)*1.6/(1.5+exp(-(states[0]+60.0)/40.0)); variables[10] = (variables[2] == 0.0)?variables[49]*(pow(variables[56], 3.0)*variables[58]*exp(0.03743*states[0]*variables[57])-pow(variables[59], 3.0)*variables[60]*exp(0.0374*states[0]*(variables[57]-1.0)))/(1.0+variables[61]*(variables[60]*pow(variables[59], 3.0)+variables[58]*pow(variables[56], 3.0))):variables[49]*(pow(variables[56], 3.0)*variables[58]*exp(0.03743*states[0]*variables[57])-pow(variables[59], 3.0)*variables[60]*exp(0.03743*states[0]*(variables[57]-1.0)))/(1.0+variables[61]*(variables[60]*pow(variables[59], 3.0)+variables[58]*pow(variables[56], 3.0))); diff --git a/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.h b/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.h index 09c8efc8c7..c574f5af09 100644 --- a/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.h +++ b/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.h @@ -37,5 +37,5 @@ void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *constants); void computeComputedConstants(double *computedConstants); -void computeRates(double voi, double *states, double *rates, double *variables); +void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *variables); diff --git a/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.py b/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.py index 86fa99ce99..73447539dd 100644 --- a/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.py +++ b/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.py @@ -400,7 +400,7 @@ def compute_computed_constants(computed_constants): variables[176] = variables[177]+variables[0]*(variables[178]-variables[177]) if eq_func(variables[2], 0.0) else variables[181]+variables[0]*(variables[182]-variables[181]) if eq_func(variables[2], 1.0) else variables[179]+variables[0]*(variables[180]-variables[179]) -def compute_rates(voi, states, rates, variables): +def compute_rates(voi, states, rates, constants, computedConstants, algebraic): variables[9] = variables[62]*pow(variables[56]/(variables[71]+variables[56]), 3.0)*pow(variables[69]/(variables[70]+variables[69]), 2.0)*1.6/(1.5+exp(-(states[0]+60.0)/40.0)) variables[10] = variables[49]*(pow(variables[56], 3.0)*variables[58]*exp(0.03743*states[0]*variables[57])-pow(variables[59], 3.0)*variables[60]*exp(0.0374*states[0]*(variables[57]-1.0)))/(1.0+variables[61]*(variables[60]*pow(variables[59], 3.0)+variables[58]*pow(variables[56], 3.0))) if eq_func(variables[2], 0.0) else variables[49]*(pow(variables[56], 3.0)*variables[58]*exp(0.03743*states[0]*variables[57])-pow(variables[59], 3.0)*variables[60]*exp(0.03743*states[0]*(variables[57]-1.0)))/(1.0+variables[61]*(variables[60]*pow(variables[59], 3.0)+variables[58]*pow(variables[56], 3.0))) variables[14] = variables[176]*states[14]*(states[0]-variables[40]) if neq_func(variables[2], 2.0) else variables[176]*states[14]*(states[0]+102.0) diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.c index 7e75a99826..76221f43ec 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.c @@ -91,7 +91,7 @@ void computeComputedConstants(double *computedConstants) variables[14] = variables[5]+12.0; } -void computeRates(double voi, double *states, double *rates, double *variables, ExternalVariable externalVariable) +void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) { variables[0] = externalVariable(voi, states, rates, variables, 0); variables[1] = variables[7]*(states[0]-variables[6]); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.h index b6719b8af9..b85f55026a 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.h +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.h @@ -40,5 +40,5 @@ typedef double (* ExternalVariable)(double voi, double *states, double *rates, d void initialiseVariables(double voi, double *states, double *rates, double *constants, ExternalVariable externalVariable); void computeComputedConstants(double *computedConstants); -void computeRates(double voi, double *states, double *rates, double *variables, ExternalVariable externalVariable); +void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); void computeVariables(double voi, double *states, double *rates, double *variables, ExternalVariable externalVariable); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.py index 5c9aa53b78..ec1244d2ff 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.py @@ -92,7 +92,7 @@ def compute_computed_constants(computed_constants): variables[14] = variables[5]+12.0 -def compute_rates(voi, states, rates, variables, external_variable): +def compute_rates(voi, states, rates, constants, computedConstants, algebraic, external_variable): variables[0] = external_variable(voi, states, rates, variables, 0) variables[1] = variables[7]*(states[0]-variables[6]) variables[2] = variables[15]*pow(states[3], 4.0)*(states[0]-variables[14]) diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.c index b423facc66..bfc76d2c87 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.c @@ -90,7 +90,7 @@ void computeComputedConstants(double *computedConstants) variables[14] = variables[5]+12.0; } -void computeRates(double voi, double *states, double *rates, double *variables) +void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { variables[0] = ((voi >= 10.0) && (voi <= 10.5))?-20.0:0.0; variables[1] = variables[7]*(states[0]-variables[6]); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.c index 6c97d8386c..22550c76d5 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.c @@ -90,7 +90,7 @@ void computeComputedConstants(double *computedConstants) variables[14] = variables[5]+12.0; } -void computeRates(double voi, double *states, double *rates, double *variables, ExternalVariable externalVariable) +void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) { variables[0] = ((voi >= 10.0) && (voi <= 10.5))?-20.0:0.0; variables[6] = externalVariable(voi, states, rates, variables, 6); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.h index b6719b8af9..b85f55026a 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.h +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.h @@ -40,5 +40,5 @@ typedef double (* ExternalVariable)(double voi, double *states, double *rates, d void initialiseVariables(double voi, double *states, double *rates, double *constants, ExternalVariable externalVariable); void computeComputedConstants(double *computedConstants); -void computeRates(double voi, double *states, double *rates, double *variables, ExternalVariable externalVariable); +void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); void computeVariables(double voi, double *states, double *rates, double *variables, ExternalVariable externalVariable); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.py index 46fd133305..31eb6b9db1 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.py @@ -91,7 +91,7 @@ def compute_computed_constants(computed_constants): variables[14] = variables[5]+12.0 -def compute_rates(voi, states, rates, variables, external_variable): +def compute_rates(voi, states, rates, constants, computedConstants, algebraic, external_variable): variables[0] = -20.0 if and_func(geq_func(voi, 10.0), leq_func(voi, 10.5)) else 0.0 variables[6] = external_variable(voi, states, rates, variables, 6) variables[1] = variables[7]*(states[0]-variables[6]) diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.c index 92007545fb..2ec875f7c5 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.c @@ -90,7 +90,7 @@ void computeComputedConstants(double *computedConstants) variables[14] = variables[5]+12.0; } -void computeRates(double voi, double *states, double *rates, double *variables, ExternalVariable externalVariable) +void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) { variables[0] = ((voi >= 10.0) && (voi <= 10.5))?-20.0:0.0; variables[4] = externalVariable(voi, states, rates, variables, 4); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.h index b6719b8af9..b85f55026a 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.h +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.h @@ -40,5 +40,5 @@ typedef double (* ExternalVariable)(double voi, double *states, double *rates, d void initialiseVariables(double voi, double *states, double *rates, double *constants, ExternalVariable externalVariable); void computeComputedConstants(double *computedConstants); -void computeRates(double voi, double *states, double *rates, double *variables, ExternalVariable externalVariable); +void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); void computeVariables(double voi, double *states, double *rates, double *variables, ExternalVariable externalVariable); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.py index c171a09b76..6db074dda9 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.py @@ -91,7 +91,7 @@ def compute_computed_constants(computed_constants): variables[14] = variables[5]+12.0 -def compute_rates(voi, states, rates, variables, external_variable): +def compute_rates(voi, states, rates, constants, computedConstants, algebraic, external_variable): variables[0] = -20.0 if and_func(geq_func(voi, 10.0), leq_func(voi, 10.5)) else 0.0 variables[4] = external_variable(voi, states, rates, variables, 4) variables[1] = variables[7]*(states[0]-variables[6]) diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.c index 38f83ab657..8b8dee0b34 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.c @@ -522,7 +522,7 @@ void computeComputedConstants(double *computedConstants) { } -void computeRates(double voi, double *states, double *rates, double *variables) +void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { findRoot0(voi, states, rates, variables); findRoot2(voi, states, rates, variables); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.h index 44cab4bacd..ef02301bd4 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.h +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.h @@ -37,5 +37,5 @@ void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *constants); void computeComputedConstants(double *computedConstants); -void computeRates(double voi, double *states, double *rates, double *variables); +void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *variables); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.py index a31fb836bd..0f940110ae 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.py @@ -465,7 +465,7 @@ def compute_computed_constants(computed_constants): pass -def compute_rates(voi, states, rates, variables): +def compute_rates(voi, states, rates, constants, computedConstants, algebraic): find_root_0(voi, states, rates, variables) find_root_2(voi, states, rates, variables) find_root_3(voi, states, rates, variables) diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.c index 89e69a335e..b50aa4b598 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.c @@ -92,7 +92,7 @@ void computeComputedConstants(double *computedConstants) variables[14] = variables[5]+12.0; } -void computeRates(double voi, double *states, double *rates, double *variables, ExternalVariable externalVariable) +void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) { variables[17] = externalVariable(voi, states, rates, variables, 17); variables[0] = externalVariable(voi, states, rates, variables, 0); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.h index b6719b8af9..b85f55026a 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.h +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.h @@ -40,5 +40,5 @@ typedef double (* ExternalVariable)(double voi, double *states, double *rates, d void initialiseVariables(double voi, double *states, double *rates, double *constants, ExternalVariable externalVariable); void computeComputedConstants(double *computedConstants); -void computeRates(double voi, double *states, double *rates, double *variables, ExternalVariable externalVariable); +void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); void computeVariables(double voi, double *states, double *rates, double *variables, ExternalVariable externalVariable); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.py index 7970569a12..53d4e89f83 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.py @@ -93,7 +93,7 @@ def compute_computed_constants(computed_constants): variables[14] = variables[5]+12.0 -def compute_rates(voi, states, rates, variables, external_variable): +def compute_rates(voi, states, rates, constants, computedConstants, algebraic, external_variable): variables[17] = external_variable(voi, states, rates, variables, 17) variables[0] = external_variable(voi, states, rates, variables, 0) variables[1] = variables[7]*(states[0]-variables[6]) diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.c index 0539e453ff..89553d7e39 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.c @@ -88,7 +88,7 @@ void computeComputedConstants(double *computedConstants) { } -void computeRates(double voi, double *states, double *rates, double *variables, ExternalVariable externalVariable) +void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) { variables[0] = ((voi >= 10.0) && (voi <= 10.5))?-20.0:0.0; variables[14] = externalVariable(voi, states, rates, variables, 14); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.h index b6719b8af9..b85f55026a 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.h +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.h @@ -40,5 +40,5 @@ typedef double (* ExternalVariable)(double voi, double *states, double *rates, d void initialiseVariables(double voi, double *states, double *rates, double *constants, ExternalVariable externalVariable); void computeComputedConstants(double *computedConstants); -void computeRates(double voi, double *states, double *rates, double *variables, ExternalVariable externalVariable); +void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); void computeVariables(double voi, double *states, double *rates, double *variables, ExternalVariable externalVariable); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.py index 18c3c32264..6b5f48f3a2 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.py @@ -90,7 +90,7 @@ def compute_computed_constants(computed_constants): pass -def compute_rates(voi, states, rates, variables, external_variable): +def compute_rates(voi, states, rates, constants, computedConstants, algebraic, external_variable): variables[0] = -20.0 if and_func(geq_func(voi, 10.0), leq_func(voi, 10.5)) else 0.0 variables[14] = external_variable(voi, states, rates, variables, 14) variables[5] = external_variable(voi, states, rates, variables, 5) diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.c index eaaa5a341b..9577016c10 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.c @@ -90,7 +90,7 @@ void computeComputedConstants(double *computedConstants) variables[14] = variables[5]+12.0; } -void computeRates(double voi, double *states, double *rates, double *variables, ExternalVariable externalVariable) +void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) { variables[0] = ((voi >= 10.0) && (voi <= 10.5))?-20.0:0.0; variables[9] = externalVariable(voi, states, rates, variables, 9); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.h index b6719b8af9..b85f55026a 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.h +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.h @@ -40,5 +40,5 @@ typedef double (* ExternalVariable)(double voi, double *states, double *rates, d void initialiseVariables(double voi, double *states, double *rates, double *constants, ExternalVariable externalVariable); void computeComputedConstants(double *computedConstants); -void computeRates(double voi, double *states, double *rates, double *variables, ExternalVariable externalVariable); +void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); void computeVariables(double voi, double *states, double *rates, double *variables, ExternalVariable externalVariable); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.py index aacb683200..316463d2bd 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.py @@ -91,7 +91,7 @@ def compute_computed_constants(computed_constants): variables[14] = variables[5]+12.0 -def compute_rates(voi, states, rates, variables, external_variable): +def compute_rates(voi, states, rates, constants, computedConstants, algebraic, external_variable): variables[0] = -20.0 if and_func(geq_func(voi, 10.0), leq_func(voi, 10.5)) else 0.0 variables[9] = external_variable(voi, states, rates, variables, 9) variables[4] = external_variable(voi, states, rates, variables, 4) diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.c index 612c48a656..84f5c32d23 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.c @@ -90,7 +90,7 @@ void computeComputedConstants(double *computedConstants) variables[16] = variables[6]+12.0; } -void computeRates(double voi, double *states, double *rates, double *variables, ExternalVariable externalVariable) +void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) { variables[1] = externalVariable(voi, states, rates, variables, 1); variables[14] = 0.07*exp(variables[1]/20.0); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.h index b6719b8af9..b85f55026a 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.h +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.h @@ -40,5 +40,5 @@ typedef double (* ExternalVariable)(double voi, double *states, double *rates, d void initialiseVariables(double voi, double *states, double *rates, double *constants, ExternalVariable externalVariable); void computeComputedConstants(double *computedConstants); -void computeRates(double voi, double *states, double *rates, double *variables, ExternalVariable externalVariable); +void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); void computeVariables(double voi, double *states, double *rates, double *variables, ExternalVariable externalVariable); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.py index f49e72de76..0b81796406 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.py @@ -91,7 +91,7 @@ def compute_computed_constants(computed_constants): variables[16] = variables[6]+12.0 -def compute_rates(voi, states, rates, variables, external_variable): +def compute_rates(voi, states, rates, constants, computedConstants, algebraic, external_variable): variables[1] = external_variable(voi, states, rates, variables, 1) variables[14] = 0.07*exp(variables[1]/20.0) variables[15] = 1.0/(exp((variables[1]+30.0)/10.0)+1.0) diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.c index 77a77fa86a..e5a954f659 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.c @@ -92,7 +92,7 @@ void computeComputedConstants(double *computedConstants) variables[15] = variables[6]+12.0; } -void computeRates(double voi, double *states, double *rates, double *variables, ExternalVariable externalVariable) +void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) { variables[1] = externalVariable(voi, states, rates, variables, 1); variables[11] = 0.1*(variables[1]+25.0)/(exp((variables[1]+25.0)/10.0)-1.0); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.h index b6719b8af9..b85f55026a 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.h +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.h @@ -40,5 +40,5 @@ typedef double (* ExternalVariable)(double voi, double *states, double *rates, d void initialiseVariables(double voi, double *states, double *rates, double *constants, ExternalVariable externalVariable); void computeComputedConstants(double *computedConstants); -void computeRates(double voi, double *states, double *rates, double *variables, ExternalVariable externalVariable); +void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); void computeVariables(double voi, double *states, double *rates, double *variables, ExternalVariable externalVariable); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.py index a1d9455d88..80610b753b 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.py @@ -93,7 +93,7 @@ def compute_computed_constants(computed_constants): variables[15] = variables[6]+12.0 -def compute_rates(voi, states, rates, variables, external_variable): +def compute_rates(voi, states, rates, constants, computedConstants, algebraic, external_variable): variables[1] = external_variable(voi, states, rates, variables, 1) variables[11] = 0.1*(variables[1]+25.0)/(exp((variables[1]+25.0)/10.0)-1.0) variables[12] = 4.0*exp(variables[1]/18.0) diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.h index 44cab4bacd..ef02301bd4 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.h +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.h @@ -37,5 +37,5 @@ void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *constants); void computeComputedConstants(double *computedConstants); -void computeRates(double voi, double *states, double *rates, double *variables); +void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *variables); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.py index 2b363c20bb..ef8e528bf8 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.py @@ -90,7 +90,7 @@ def compute_computed_constants(computed_constants): variables[14] = variables[5]+12.0 -def compute_rates(voi, states, rates, variables): +def compute_rates(voi, states, rates, constants, computedConstants, algebraic): variables[0] = -20.0 if and_func(geq_func(voi, 10.0), leq_func(voi, 10.5)) else 0.0 variables[1] = variables[7]*(states[0]-variables[6]) variables[2] = variables[15]*pow(states[3], 4.0)*(states[0]-variables[14]) diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.c index d3bc351822..27a4df3133 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.c @@ -90,7 +90,7 @@ void computeComputedConstants(double *computedConstants) variables[15] = variables[5]+12.0; } -void computeRates(double voi, double *states, double *rates, double *variables, ExternalVariable externalVariable) +void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) { variables[0] = ((voi >= 10.0) && (voi <= 10.5))?-20.0:0.0; variables[1] = variables[7]*(states[0]-variables[6]); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.h index b6719b8af9..b85f55026a 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.h +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.h @@ -40,5 +40,5 @@ typedef double (* ExternalVariable)(double voi, double *states, double *rates, d void initialiseVariables(double voi, double *states, double *rates, double *constants, ExternalVariable externalVariable); void computeComputedConstants(double *computedConstants); -void computeRates(double voi, double *states, double *rates, double *variables, ExternalVariable externalVariable); +void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); void computeVariables(double voi, double *states, double *rates, double *variables, ExternalVariable externalVariable); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.py index 877a3c3c14..fbbf624262 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.py @@ -91,7 +91,7 @@ def compute_computed_constants(computed_constants): variables[15] = variables[5]+12.0 -def compute_rates(voi, states, rates, variables, external_variable): +def compute_rates(voi, states, rates, constants, computedConstants, algebraic, external_variable): variables[0] = -20.0 if and_func(geq_func(voi, 10.0), leq_func(voi, 10.5)) else 0.0 variables[1] = variables[7]*(states[0]-variables[6]) variables[2] = variables[16]*pow(states[2], 4.0)*(states[0]-variables[15]) diff --git a/tests/resources/generator/noble_model_1962/model.c b/tests/resources/generator/noble_model_1962/model.c index bed1c02e31..2811d042ff 100644 --- a/tests/resources/generator/noble_model_1962/model.c +++ b/tests/resources/generator/noble_model_1962/model.c @@ -86,7 +86,7 @@ void computeComputedConstants(double *computedConstants) { } -void computeRates(double voi, double *states, double *rates, double *variables) +void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { variables[6] = pow(states[1], 3.0)*states[2]*variables[7]; variables[0] = (variables[6]+0.14)*(states[0]-variables[8]); diff --git a/tests/resources/generator/noble_model_1962/model.h b/tests/resources/generator/noble_model_1962/model.h index 41269862ea..d6958fd5dc 100644 --- a/tests/resources/generator/noble_model_1962/model.h +++ b/tests/resources/generator/noble_model_1962/model.h @@ -37,5 +37,5 @@ void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *constants); void computeComputedConstants(double *computedConstants); -void computeRates(double voi, double *states, double *rates, double *variables); +void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *variables); diff --git a/tests/resources/generator/noble_model_1962/model.py b/tests/resources/generator/noble_model_1962/model.py index 433f53e118..36858282f8 100644 --- a/tests/resources/generator/noble_model_1962/model.py +++ b/tests/resources/generator/noble_model_1962/model.py @@ -75,7 +75,7 @@ def compute_computed_constants(computed_constants): pass -def compute_rates(voi, states, rates, variables): +def compute_rates(voi, states, rates, constants, computedConstants, algebraic): variables[6] = pow(states[1], 3.0)*states[2]*variables[7] variables[0] = (variables[6]+0.14)*(states[0]-variables[8]) variables[1] = variables[4]*(states[0]-variables[5]) diff --git a/tests/resources/generator/ode_computed_var_on_rhs/model.c b/tests/resources/generator/ode_computed_var_on_rhs/model.c index 347ca221ae..f6c4d954c2 100644 --- a/tests/resources/generator/ode_computed_var_on_rhs/model.c +++ b/tests/resources/generator/ode_computed_var_on_rhs/model.c @@ -60,7 +60,7 @@ void computeComputedConstants(double *computedConstants) { } -void computeRates(double voi, double *states, double *rates, double *variables) +void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { rates[0] = variables[0]; } diff --git a/tests/resources/generator/ode_computed_var_on_rhs/model.h b/tests/resources/generator/ode_computed_var_on_rhs/model.h index 2279ebcc10..0bccaf5c81 100644 --- a/tests/resources/generator/ode_computed_var_on_rhs/model.h +++ b/tests/resources/generator/ode_computed_var_on_rhs/model.h @@ -37,5 +37,5 @@ void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *constants); void computeComputedConstants(double *computedConstants); -void computeRates(double voi, double *states, double *rates, double *variables); +void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *variables); diff --git a/tests/resources/generator/ode_computed_var_on_rhs/model.py b/tests/resources/generator/ode_computed_var_on_rhs/model.py index 23fe7ca717..b3ac9c62f7 100644 --- a/tests/resources/generator/ode_computed_var_on_rhs/model.py +++ b/tests/resources/generator/ode_computed_var_on_rhs/model.py @@ -49,7 +49,7 @@ def compute_computed_constants(computed_constants): pass -def compute_rates(voi, states, rates, variables): +def compute_rates(voi, states, rates, constants, computedConstants, algebraic): rates[0] = variables[0] diff --git a/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.c b/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.c index 70697999bc..7f30100d5f 100644 --- a/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.c +++ b/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.c @@ -60,7 +60,7 @@ void computeComputedConstants(double *computedConstants) { } -void computeRates(double voi, double *states, double *rates, double *variables) +void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { rates[0] = variables[0]; } diff --git a/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.h b/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.h index be002fd715..7f86bfafdd 100644 --- a/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.h +++ b/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.h @@ -37,5 +37,5 @@ void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *constants); void computeComputedConstants(double *computedConstants); -void computeRates(double voi, double *states, double *rates, double *variables); +void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *variables); diff --git a/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.py b/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.py index 7cf75939a9..2dc19f3935 100644 --- a/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.py +++ b/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.py @@ -49,7 +49,7 @@ def compute_computed_constants(computed_constants): pass -def compute_rates(voi, states, rates, variables): +def compute_rates(voi, states, rates, constants, computedConstants, algebraic): rates[0] = variables[0] diff --git a/tests/resources/generator/ode_const_var_on_rhs/model.c b/tests/resources/generator/ode_const_var_on_rhs/model.c index 242e528d07..d630e604ab 100644 --- a/tests/resources/generator/ode_const_var_on_rhs/model.c +++ b/tests/resources/generator/ode_const_var_on_rhs/model.c @@ -60,7 +60,7 @@ void computeComputedConstants(double *computedConstants) { } -void computeRates(double voi, double *states, double *rates, double *variables) +void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { rates[0] = variables[0]; } diff --git a/tests/resources/generator/ode_const_var_on_rhs/model.h b/tests/resources/generator/ode_const_var_on_rhs/model.h index 2279ebcc10..0bccaf5c81 100644 --- a/tests/resources/generator/ode_const_var_on_rhs/model.h +++ b/tests/resources/generator/ode_const_var_on_rhs/model.h @@ -37,5 +37,5 @@ void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *constants); void computeComputedConstants(double *computedConstants); -void computeRates(double voi, double *states, double *rates, double *variables); +void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *variables); diff --git a/tests/resources/generator/ode_const_var_on_rhs/model.py b/tests/resources/generator/ode_const_var_on_rhs/model.py index 8c2d64ebea..ae0d7b060e 100644 --- a/tests/resources/generator/ode_const_var_on_rhs/model.py +++ b/tests/resources/generator/ode_const_var_on_rhs/model.py @@ -49,7 +49,7 @@ def compute_computed_constants(computed_constants): pass -def compute_rates(voi, states, rates, variables): +def compute_rates(voi, states, rates, constants, computedConstants, algebraic): rates[0] = variables[0] diff --git a/tests/resources/generator/ode_const_var_on_rhs_one_component/model.c b/tests/resources/generator/ode_const_var_on_rhs_one_component/model.c index c2cfa30a05..ddb0e28f9a 100644 --- a/tests/resources/generator/ode_const_var_on_rhs_one_component/model.c +++ b/tests/resources/generator/ode_const_var_on_rhs_one_component/model.c @@ -60,7 +60,7 @@ void computeComputedConstants(double *computedConstants) { } -void computeRates(double voi, double *states, double *rates, double *variables) +void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { rates[0] = variables[0]; } diff --git a/tests/resources/generator/ode_const_var_on_rhs_one_component/model.h b/tests/resources/generator/ode_const_var_on_rhs_one_component/model.h index be002fd715..7f86bfafdd 100644 --- a/tests/resources/generator/ode_const_var_on_rhs_one_component/model.h +++ b/tests/resources/generator/ode_const_var_on_rhs_one_component/model.h @@ -37,5 +37,5 @@ void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *constants); void computeComputedConstants(double *computedConstants); -void computeRates(double voi, double *states, double *rates, double *variables); +void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *variables); diff --git a/tests/resources/generator/ode_const_var_on_rhs_one_component/model.py b/tests/resources/generator/ode_const_var_on_rhs_one_component/model.py index 40fec51739..ad34a0c19e 100644 --- a/tests/resources/generator/ode_const_var_on_rhs_one_component/model.py +++ b/tests/resources/generator/ode_const_var_on_rhs_one_component/model.py @@ -49,7 +49,7 @@ def compute_computed_constants(computed_constants): pass -def compute_rates(voi, states, rates, variables): +def compute_rates(voi, states, rates, constants, computedConstants, algebraic): rates[0] = variables[0] diff --git a/tests/resources/generator/ode_constant_on_rhs/model.c b/tests/resources/generator/ode_constant_on_rhs/model.c index 8c25b8b32d..cc6439e9b2 100644 --- a/tests/resources/generator/ode_constant_on_rhs/model.c +++ b/tests/resources/generator/ode_constant_on_rhs/model.c @@ -58,7 +58,7 @@ void computeComputedConstants(double *computedConstants) { } -void computeRates(double voi, double *states, double *rates, double *variables) +void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { rates[0] = 1.0; } diff --git a/tests/resources/generator/ode_constant_on_rhs/model.h b/tests/resources/generator/ode_constant_on_rhs/model.h index 2279ebcc10..0bccaf5c81 100644 --- a/tests/resources/generator/ode_constant_on_rhs/model.h +++ b/tests/resources/generator/ode_constant_on_rhs/model.h @@ -37,5 +37,5 @@ void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *constants); void computeComputedConstants(double *computedConstants); -void computeRates(double voi, double *states, double *rates, double *variables); +void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *variables); diff --git a/tests/resources/generator/ode_constant_on_rhs/model.py b/tests/resources/generator/ode_constant_on_rhs/model.py index fb01dd88d1..58f3ce266a 100644 --- a/tests/resources/generator/ode_constant_on_rhs/model.py +++ b/tests/resources/generator/ode_constant_on_rhs/model.py @@ -47,7 +47,7 @@ def compute_computed_constants(computed_constants): pass -def compute_rates(voi, states, rates, variables): +def compute_rates(voi, states, rates, constants, computedConstants, algebraic): rates[0] = 1.0 diff --git a/tests/resources/generator/ode_constant_on_rhs_one_component/model.c b/tests/resources/generator/ode_constant_on_rhs_one_component/model.c index 48f4705faf..3cfebdce48 100644 --- a/tests/resources/generator/ode_constant_on_rhs_one_component/model.c +++ b/tests/resources/generator/ode_constant_on_rhs_one_component/model.c @@ -58,7 +58,7 @@ void computeComputedConstants(double *computedConstants) { } -void computeRates(double voi, double *states, double *rates, double *variables) +void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { rates[0] = 1.0; } diff --git a/tests/resources/generator/ode_constant_on_rhs_one_component/model.h b/tests/resources/generator/ode_constant_on_rhs_one_component/model.h index be002fd715..7f86bfafdd 100644 --- a/tests/resources/generator/ode_constant_on_rhs_one_component/model.h +++ b/tests/resources/generator/ode_constant_on_rhs_one_component/model.h @@ -37,5 +37,5 @@ void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *constants); void computeComputedConstants(double *computedConstants); -void computeRates(double voi, double *states, double *rates, double *variables); +void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *variables); diff --git a/tests/resources/generator/ode_constant_on_rhs_one_component/model.py b/tests/resources/generator/ode_constant_on_rhs_one_component/model.py index 4655c2f755..0a9a86dba8 100644 --- a/tests/resources/generator/ode_constant_on_rhs_one_component/model.py +++ b/tests/resources/generator/ode_constant_on_rhs_one_component/model.py @@ -47,7 +47,7 @@ def compute_computed_constants(computed_constants): pass -def compute_rates(voi, states, rates, variables): +def compute_rates(voi, states, rates, constants, computedConstants, algebraic): rates[0] = 1.0 diff --git a/tests/resources/generator/ode_multiple_dependent_odes/model.c b/tests/resources/generator/ode_multiple_dependent_odes/model.c index 94db2285bf..eb5bd6f89d 100644 --- a/tests/resources/generator/ode_multiple_dependent_odes/model.c +++ b/tests/resources/generator/ode_multiple_dependent_odes/model.c @@ -62,7 +62,7 @@ void computeComputedConstants(double *computedConstants) { } -void computeRates(double voi, double *states, double *rates, double *variables) +void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { rates[0] = states[1]*1.0; rates[1] = (variables[0]*(1.0-pow(states[0], 2.0))*states[1]-states[0])*1.0; diff --git a/tests/resources/generator/ode_multiple_dependent_odes/model.h b/tests/resources/generator/ode_multiple_dependent_odes/model.h index e3079caa53..72fe9729b1 100644 --- a/tests/resources/generator/ode_multiple_dependent_odes/model.h +++ b/tests/resources/generator/ode_multiple_dependent_odes/model.h @@ -37,5 +37,5 @@ void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *constants); void computeComputedConstants(double *computedConstants); -void computeRates(double voi, double *states, double *rates, double *variables); +void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *variables); diff --git a/tests/resources/generator/ode_multiple_dependent_odes/model.py b/tests/resources/generator/ode_multiple_dependent_odes/model.py index 07ee839b45..9b6c3efa33 100644 --- a/tests/resources/generator/ode_multiple_dependent_odes/model.py +++ b/tests/resources/generator/ode_multiple_dependent_odes/model.py @@ -51,7 +51,7 @@ def compute_computed_constants(computed_constants): pass -def compute_rates(voi, states, rates, variables): +def compute_rates(voi, states, rates, constants, computedConstants, algebraic): rates[0] = states[1]*1.0 rates[1] = (variables[0]*(1.0-pow(states[0], 2.0))*states[1]-states[0])*1.0 diff --git a/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.c b/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.c index addbc42504..aab636ab1f 100644 --- a/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.c +++ b/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.c @@ -62,7 +62,7 @@ void computeComputedConstants(double *computedConstants) { } -void computeRates(double voi, double *states, double *rates, double *variables) +void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { rates[0] = states[1]*1.0; rates[1] = (variables[0]*(1.0-pow(states[0], 2.0))*states[1]-states[0])*1.0; diff --git a/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.h b/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.h index f75d27774e..2751faf2a6 100644 --- a/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.h +++ b/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.h @@ -37,5 +37,5 @@ void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *constants); void computeComputedConstants(double *computedConstants); -void computeRates(double voi, double *states, double *rates, double *variables); +void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *variables); diff --git a/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.py b/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.py index 320add7444..566c040fff 100644 --- a/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.py +++ b/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.py @@ -51,7 +51,7 @@ def compute_computed_constants(computed_constants): pass -def compute_rates(voi, states, rates, variables): +def compute_rates(voi, states, rates, constants, computedConstants, algebraic): rates[0] = states[1]*1.0 rates[1] = (variables[0]*(1.0-pow(states[0], 2.0))*states[1]-states[0])*1.0 diff --git a/tests/resources/generator/ode_multiple_odes_with_same_name/model.c b/tests/resources/generator/ode_multiple_odes_with_same_name/model.c index bd59a1786a..a372b5ab9b 100644 --- a/tests/resources/generator/ode_multiple_odes_with_same_name/model.c +++ b/tests/resources/generator/ode_multiple_odes_with_same_name/model.c @@ -62,7 +62,7 @@ void computeComputedConstants(double *computedConstants) { } -void computeRates(double voi, double *states, double *rates, double *variables) +void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { rates[0] = 1.0; rates[1] = variables[0]; diff --git a/tests/resources/generator/ode_multiple_odes_with_same_name/model.h b/tests/resources/generator/ode_multiple_odes_with_same_name/model.h index c1830c26fd..d0b018b6f7 100644 --- a/tests/resources/generator/ode_multiple_odes_with_same_name/model.h +++ b/tests/resources/generator/ode_multiple_odes_with_same_name/model.h @@ -37,5 +37,5 @@ void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *constants); void computeComputedConstants(double *computedConstants); -void computeRates(double voi, double *states, double *rates, double *variables); +void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *variables); diff --git a/tests/resources/generator/ode_multiple_odes_with_same_name/model.py b/tests/resources/generator/ode_multiple_odes_with_same_name/model.py index 0c442c1820..c57a7c0204 100644 --- a/tests/resources/generator/ode_multiple_odes_with_same_name/model.py +++ b/tests/resources/generator/ode_multiple_odes_with_same_name/model.py @@ -51,7 +51,7 @@ def compute_computed_constants(computed_constants): pass -def compute_rates(voi, states, rates, variables): +def compute_rates(voi, states, rates, constants, computedConstants, algebraic): rates[0] = 1.0 rates[1] = variables[0] diff --git a/tests/resources/generator/ode_unknown_var_on_rhs/model.c b/tests/resources/generator/ode_unknown_var_on_rhs/model.c index 8d5a4124a9..dc292a96cf 100644 --- a/tests/resources/generator/ode_unknown_var_on_rhs/model.c +++ b/tests/resources/generator/ode_unknown_var_on_rhs/model.c @@ -60,7 +60,7 @@ void computeComputedConstants(double *computedConstants) { } -void computeRates(double voi, double *states, double *rates, double *variables) +void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { rates[0] = 1.0; rates[1] = states[0]; diff --git a/tests/resources/generator/ode_unknown_var_on_rhs/model.h b/tests/resources/generator/ode_unknown_var_on_rhs/model.h index 2279ebcc10..0bccaf5c81 100644 --- a/tests/resources/generator/ode_unknown_var_on_rhs/model.h +++ b/tests/resources/generator/ode_unknown_var_on_rhs/model.h @@ -37,5 +37,5 @@ void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *constants); void computeComputedConstants(double *computedConstants); -void computeRates(double voi, double *states, double *rates, double *variables); +void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *variables); diff --git a/tests/resources/generator/ode_unknown_var_on_rhs/model.py b/tests/resources/generator/ode_unknown_var_on_rhs/model.py index 70d8d2ad02..24271e0b3c 100644 --- a/tests/resources/generator/ode_unknown_var_on_rhs/model.py +++ b/tests/resources/generator/ode_unknown_var_on_rhs/model.py @@ -49,7 +49,7 @@ def compute_computed_constants(computed_constants): pass -def compute_rates(voi, states, rates, variables): +def compute_rates(voi, states, rates, constants, computedConstants, algebraic): rates[0] = 1.0 rates[1] = states[0] diff --git a/tests/resources/generator/robertson_model_1966/model.dae.c b/tests/resources/generator/robertson_model_1966/model.dae.c index b083983e4b..ff9bd2d422 100644 --- a/tests/resources/generator/robertson_model_1966/model.dae.c +++ b/tests/resources/generator/robertson_model_1966/model.dae.c @@ -103,7 +103,7 @@ void computeComputedConstants(double *computedConstants) { } -void computeRates(double voi, double *states, double *rates, double *variables) +void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { findRoot0(voi, states, rates, variables); rates[0] = -variables[0]*states[0]+variables[1]*states[1]*variables[2]; diff --git a/tests/resources/generator/robertson_model_1966/model.dae.h b/tests/resources/generator/robertson_model_1966/model.dae.h index fe620e70fd..4b40d5fc50 100644 --- a/tests/resources/generator/robertson_model_1966/model.dae.h +++ b/tests/resources/generator/robertson_model_1966/model.dae.h @@ -37,5 +37,5 @@ void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *constants); void computeComputedConstants(double *computedConstants); -void computeRates(double voi, double *states, double *rates, double *variables); +void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *variables); diff --git a/tests/resources/generator/robertson_model_1966/model.dae.py b/tests/resources/generator/robertson_model_1966/model.dae.py index 43ed6059b1..d325fee609 100644 --- a/tests/resources/generator/robertson_model_1966/model.dae.py +++ b/tests/resources/generator/robertson_model_1966/model.dae.py @@ -82,7 +82,7 @@ def compute_computed_constants(computed_constants): pass -def compute_rates(voi, states, rates, variables): +def compute_rates(voi, states, rates, constants, computedConstants, algebraic): find_root_0(voi, states, rates, variables) rates[0] = -variables[0]*states[0]+variables[1]*states[1]*variables[2] rates[1] = variables[0]*states[0]-variables[3]*pow(states[1], 2.0)-variables[1]*states[1]*variables[2] diff --git a/tests/resources/generator/robertson_model_1966/model.ode.c b/tests/resources/generator/robertson_model_1966/model.ode.c index 40304d9a62..cdea395370 100644 --- a/tests/resources/generator/robertson_model_1966/model.ode.c +++ b/tests/resources/generator/robertson_model_1966/model.ode.c @@ -69,7 +69,7 @@ void computeComputedConstants(double *computedConstants) { } -void computeRates(double voi, double *states, double *rates, double *variables) +void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { rates[0] = -variables[0]*states[0]+variables[1]*states[2]*states[1]; rates[2] = variables[0]*states[0]-variables[2]*pow(states[2], 2.0)-variables[1]*states[2]*states[1]; diff --git a/tests/resources/generator/robertson_model_1966/model.ode.h b/tests/resources/generator/robertson_model_1966/model.ode.h index fe620e70fd..4b40d5fc50 100644 --- a/tests/resources/generator/robertson_model_1966/model.ode.h +++ b/tests/resources/generator/robertson_model_1966/model.ode.h @@ -37,5 +37,5 @@ void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *constants); void computeComputedConstants(double *computedConstants); -void computeRates(double voi, double *states, double *rates, double *variables); +void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *variables); diff --git a/tests/resources/generator/robertson_model_1966/model.ode.py b/tests/resources/generator/robertson_model_1966/model.ode.py index d80b59dfca..653a16bd6a 100644 --- a/tests/resources/generator/robertson_model_1966/model.ode.py +++ b/tests/resources/generator/robertson_model_1966/model.ode.py @@ -58,7 +58,7 @@ def compute_computed_constants(computed_constants): pass -def compute_rates(voi, states, rates, variables): +def compute_rates(voi, states, rates, constants, computedConstants, algebraic): rates[0] = -variables[0]*states[0]+variables[1]*states[2]*states[1] rates[2] = variables[0]*states[0]-variables[2]*pow(states[2], 2.0)-variables[1]*states[2]*states[1] rates[1] = variables[2]*pow(states[2], 2.0) diff --git a/tests/resources/generator/sine_model_imports/model.c b/tests/resources/generator/sine_model_imports/model.c index aa2e6b1ceb..cc9ad39390 100644 --- a/tests/resources/generator/sine_model_imports/model.c +++ b/tests/resources/generator/sine_model_imports/model.c @@ -75,7 +75,7 @@ void computeComputedConstants(double *computedConstants) { } -void computeRates(double voi, double *states, double *rates, double *variables) +void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { rates[0] = cos(voi); } diff --git a/tests/resources/generator/sine_model_imports/model.h b/tests/resources/generator/sine_model_imports/model.h index 613e4f9aa9..175f6e2a06 100644 --- a/tests/resources/generator/sine_model_imports/model.h +++ b/tests/resources/generator/sine_model_imports/model.h @@ -37,5 +37,5 @@ void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *constants); void computeComputedConstants(double *computedConstants); -void computeRates(double voi, double *states, double *rates, double *variables); +void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *variables); diff --git a/tests/resources/generator/sine_model_imports/model.py b/tests/resources/generator/sine_model_imports/model.py index 191913e4ae..75e2a697fd 100644 --- a/tests/resources/generator/sine_model_imports/model.py +++ b/tests/resources/generator/sine_model_imports/model.py @@ -68,7 +68,7 @@ def compute_computed_constants(computed_constants): pass -def compute_rates(voi, states, rates, variables): +def compute_rates(voi, states, rates, constants, computedConstants, algebraic): rates[0] = cos(voi) diff --git a/tests/resources/generator/variable_initialised_using_a_constant/model.c b/tests/resources/generator/variable_initialised_using_a_constant/model.c index 469b04c720..0d7a8cae4f 100644 --- a/tests/resources/generator/variable_initialised_using_a_constant/model.c +++ b/tests/resources/generator/variable_initialised_using_a_constant/model.c @@ -60,7 +60,7 @@ void computeComputedConstants(double *computedConstants) { } -void computeRates(double voi, double *states, double *rates, double *variables) +void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { rates[0] = 3.0; } diff --git a/tests/resources/generator/variable_initialised_using_a_constant/model.h b/tests/resources/generator/variable_initialised_using_a_constant/model.h index a92fc36f89..8e703e9d25 100644 --- a/tests/resources/generator/variable_initialised_using_a_constant/model.h +++ b/tests/resources/generator/variable_initialised_using_a_constant/model.h @@ -37,5 +37,5 @@ void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *constants); void computeComputedConstants(double *computedConstants); -void computeRates(double voi, double *states, double *rates, double *variables); +void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *variables); diff --git a/tests/resources/generator/variable_initialised_using_a_constant/model.py b/tests/resources/generator/variable_initialised_using_a_constant/model.py index ff57a76839..bbaccf6f6a 100644 --- a/tests/resources/generator/variable_initialised_using_a_constant/model.py +++ b/tests/resources/generator/variable_initialised_using_a_constant/model.py @@ -49,7 +49,7 @@ def compute_computed_constants(computed_constants): pass -def compute_rates(voi, states, rates, variables): +def compute_rates(voi, states, rates, constants, computedConstants, algebraic): rates[0] = 3.0 From 94515cc9e0db6db029dbdc2625aef51d449e127e Mon Sep 17 00:00:00 2001 From: Alan Garny Date: Wed, 7 Aug 2024 16:41:40 +0200 Subject: [PATCH 05/85] Generator: use different arrays for constants, computed constants, and algebraic variables for computeVariables(). --- src/generatorprofile.cpp | 24 +++++++++---------- src/generatorprofilesha1values.h | 4 ++-- .../bindings/python/test_generator_profile.py | 16 ++++++------- tests/generator/generatorprofile.cpp | 16 ++++++------- tests/resources/coverage/generator/model.c | 2 +- tests/resources/coverage/generator/model.h | 2 +- .../generator/model.implementation.out | 2 +- .../coverage/generator/model.interface.out | 2 +- .../generator/model.modified.profile.c | 2 +- .../generator/model.modified.profile.h | 2 +- .../generator/model.modified.profile.py | 2 +- tests/resources/coverage/generator/model.py | 2 +- .../algebraic_eqn_computed_var_on_rhs/model.c | 2 +- .../model.external.c | 2 +- .../model.external.h | 2 +- .../model.external.py | 2 +- .../algebraic_eqn_computed_var_on_rhs/model.h | 2 +- .../model.py | 2 +- .../algebraic_eqn_const_var_on_rhs/model.c | 2 +- .../algebraic_eqn_const_var_on_rhs/model.h | 2 +- .../algebraic_eqn_const_var_on_rhs/model.py | 2 +- .../algebraic_eqn_constant_on_rhs/model.c | 2 +- .../algebraic_eqn_constant_on_rhs/model.h | 2 +- .../algebraic_eqn_constant_on_rhs/model.py | 2 +- .../algebraic_eqn_derivative_on_rhs/model.c | 2 +- .../algebraic_eqn_derivative_on_rhs/model.h | 2 +- .../algebraic_eqn_derivative_on_rhs/model.py | 2 +- .../model.c | 2 +- .../model.h | 2 +- .../model.py | 2 +- .../algebraic_eqn_state_var_on_rhs/model.c | 2 +- .../algebraic_eqn_state_var_on_rhs/model.h | 2 +- .../algebraic_eqn_state_var_on_rhs/model.py | 2 +- .../model.c | 2 +- .../model.h | 2 +- .../model.py | 2 +- .../model.c | 2 +- .../model.external.c | 2 +- .../model.external.h | 2 +- .../model.external.py | 2 +- .../model.h | 2 +- .../model.py | 2 +- .../model.c | 2 +- .../model.h | 2 +- .../model.one.external.c | 2 +- .../model.one.external.h | 2 +- .../model.one.external.py | 2 +- .../model.py | 2 +- .../model.three.externals.c | 2 +- .../model.three.externals.h | 2 +- .../model.three.externals.py | 2 +- .../model.two.externals.c | 2 +- .../model.two.externals.h | 2 +- .../model.two.externals.py | 2 +- .../model.not.ordered.c | 2 +- .../model.not.ordered.h | 2 +- .../model.not.ordered.py | 2 +- .../model.ordered.c | 2 +- .../model.ordered.h | 2 +- .../model.ordered.py | 2 +- .../algebraic_unknown_var_on_rhs/model.c | 2 +- .../algebraic_unknown_var_on_rhs/model.h | 2 +- .../algebraic_unknown_var_on_rhs/model.py | 2 +- .../generator/cell_geometry_model/model.c | 2 +- .../cell_geometry_model/model.external.c | 2 +- .../cell_geometry_model/model.external.h | 2 +- .../cell_geometry_model/model.external.py | 2 +- .../generator/cell_geometry_model/model.h | 2 +- .../generator/cell_geometry_model/model.py | 2 +- .../model.c | 2 +- .../model.h | 2 +- .../model.py | 2 +- .../generator/cellml_slc_example/model.py | 2 +- .../model.c | 2 +- .../model.h | 2 +- .../model.py | 2 +- .../cellml_unit_scaling_constant/model.c | 2 +- .../cellml_unit_scaling_constant/model.h | 2 +- .../cellml_unit_scaling_constant/model.py | 2 +- .../cellml_unit_scaling_rate/model.c | 2 +- .../cellml_unit_scaling_rate/model.h | 2 +- .../cellml_unit_scaling_rate/model.py | 2 +- .../cellml_unit_scaling_state/model.c | 2 +- .../cellml_unit_scaling_state/model.h | 2 +- .../cellml_unit_scaling_state/model.py | 2 +- .../model.c | 2 +- .../model.h | 2 +- .../model.py | 2 +- .../model.c | 2 +- .../model.h | 2 +- .../model.py | 2 +- .../cellml_unit_scaling_voi_direct/model.c | 2 +- .../cellml_unit_scaling_voi_direct/model.h | 2 +- .../cellml_unit_scaling_voi_direct/model.py | 2 +- .../cellml_unit_scaling_voi_indirect/model.c | 2 +- .../cellml_unit_scaling_voi_indirect/model.h | 2 +- .../cellml_unit_scaling_voi_indirect/model.py | 2 +- .../generator/dae_cellml_1_1_model/model.c | 2 +- .../generator/dae_cellml_1_1_model/model.h | 2 +- .../generator/dae_cellml_1_1_model/model.py | 2 +- .../generator/dependent_eqns/model.c | 2 +- .../generator/dependent_eqns/model.h | 2 +- .../generator/dependent_eqns/model.py | 2 +- .../model.c | 2 +- .../model.h | 2 +- .../model.py | 2 +- .../model.c | 2 +- .../model.h | 2 +- .../model.py | 2 +- .../model.algebraic.c | 2 +- .../model.algebraic.h | 2 +- .../model.algebraic.py | 2 +- .../model.c | 2 +- .../model.computed.constant.c | 2 +- .../model.computed.constant.h | 2 +- .../model.computed.constant.py | 2 +- .../model.constant.c | 2 +- .../model.constant.h | 2 +- .../model.constant.py | 2 +- .../model.dae.c | 2 +- .../model.dae.h | 2 +- .../model.dae.py | 2 +- .../model.dependent.algebraic.c | 2 +- .../model.dependent.algebraic.h | 2 +- .../model.dependent.algebraic.py | 2 +- .../model.dependent.computed.constant.c | 2 +- .../model.dependent.computed.constant.h | 2 +- .../model.dependent.computed.constant.py | 2 +- .../model.dependent.constant.c | 2 +- .../model.dependent.constant.h | 2 +- .../model.dependent.constant.py | 2 +- .../model.dependent.state.c | 2 +- .../model.dependent.state.h | 2 +- .../model.dependent.state.py | 2 +- .../model.external.c | 2 +- .../model.external.h | 2 +- .../model.external.py | 2 +- .../model.h | 2 +- .../model.py | 2 +- .../model.state.c | 2 +- .../model.state.h | 2 +- .../model.state.py | 2 +- .../generator/noble_model_1962/model.c | 2 +- .../generator/noble_model_1962/model.h | 2 +- .../generator/noble_model_1962/model.py | 2 +- .../generator/ode_computed_var_on_rhs/model.c | 2 +- .../generator/ode_computed_var_on_rhs/model.h | 2 +- .../ode_computed_var_on_rhs/model.py | 2 +- .../model.c | 2 +- .../model.h | 2 +- .../model.py | 2 +- .../generator/ode_const_var_on_rhs/model.c | 2 +- .../generator/ode_const_var_on_rhs/model.h | 2 +- .../generator/ode_const_var_on_rhs/model.py | 2 +- .../model.c | 2 +- .../model.h | 2 +- .../model.py | 2 +- .../generator/ode_constant_on_rhs/model.c | 2 +- .../generator/ode_constant_on_rhs/model.h | 2 +- .../generator/ode_constant_on_rhs/model.py | 2 +- .../ode_constant_on_rhs_one_component/model.c | 2 +- .../ode_constant_on_rhs_one_component/model.h | 2 +- .../model.py | 2 +- .../ode_multiple_dependent_odes/model.c | 2 +- .../ode_multiple_dependent_odes/model.h | 2 +- .../ode_multiple_dependent_odes/model.py | 2 +- .../model.c | 2 +- .../model.h | 2 +- .../model.py | 2 +- .../ode_multiple_odes_with_same_name/model.c | 2 +- .../ode_multiple_odes_with_same_name/model.h | 2 +- .../ode_multiple_odes_with_same_name/model.py | 2 +- .../generator/ode_unknown_var_on_rhs/model.c | 2 +- .../generator/ode_unknown_var_on_rhs/model.h | 2 +- .../generator/ode_unknown_var_on_rhs/model.py | 2 +- .../robertson_model_1966/model.dae.c | 2 +- .../robertson_model_1966/model.dae.h | 2 +- .../robertson_model_1966/model.dae.py | 2 +- .../robertson_model_1966/model.ode.c | 2 +- .../robertson_model_1966/model.ode.h | 2 +- .../robertson_model_1966/model.ode.py | 2 +- .../generator/sine_model_imports/model.c | 2 +- .../generator/sine_model_imports/model.h | 2 +- .../generator/sine_model_imports/model.py | 2 +- .../model.c | 2 +- .../model.h | 2 +- .../model.py | 2 +- .../model.c | 2 +- .../model.h | 2 +- .../model.py | 2 +- 190 files changed, 216 insertions(+), 216 deletions(-) diff --git a/src/generatorprofile.cpp b/src/generatorprofile.cpp index 97861c3c32..7adcd24c6e 100644 --- a/src/generatorprofile.cpp +++ b/src/generatorprofile.cpp @@ -705,26 +705,26 @@ void GeneratorProfile::GeneratorProfileImpl::loadProfile(GeneratorProfile::Profi "[CODE]" "}\n"; - mInterfaceComputeVariablesMethodFamWoevString = "void computeVariables(double *variables);\n"; - mImplementationComputeVariablesMethodFamWoevString = "void computeVariables(double *variables)\n" + mInterfaceComputeVariablesMethodFamWoevString = "void computeVariables(double *constants, double *computedConstants, double *algebraic);\n"; + mImplementationComputeVariablesMethodFamWoevString = "void computeVariables(double *constants, double *computedConstants, double *algebraic)\n" "{\n" "[CODE]" "}\n"; - mInterfaceComputeVariablesMethodFamWevString = "void computeVariables(double *variables, ExternalVariable externalVariable);\n"; - mImplementationComputeVariablesMethodFamWevString = "void computeVariables(double *variables, ExternalVariable externalVariable)\n" + mInterfaceComputeVariablesMethodFamWevString = "void computeVariables(double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable);\n"; + mImplementationComputeVariablesMethodFamWevString = "void computeVariables(double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable)\n" "{\n" "[CODE]" "}\n"; - mInterfaceComputeVariablesMethodFdmWoevString = "void computeVariables(double voi, double *states, double *rates, double *variables);\n"; - mImplementationComputeVariablesMethodFdmWoevString = "void computeVariables(double voi, double *states, double *rates, double *variables)\n" + mInterfaceComputeVariablesMethodFdmWoevString = "void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic);\n"; + mImplementationComputeVariablesMethodFdmWoevString = "void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic)\n" "{\n" "[CODE]" "}\n"; - mInterfaceComputeVariablesMethodFdmWevString = "void computeVariables(double voi, double *states, double *rates, double *variables, ExternalVariable externalVariable);\n"; - mImplementationComputeVariablesMethodFdmWevString = "void computeVariables(double voi, double *states, double *rates, double *variables, ExternalVariable externalVariable)\n" + mInterfaceComputeVariablesMethodFdmWevString = "void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable);\n"; + mImplementationComputeVariablesMethodFdmWevString = "void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable)\n" "{\n" "[CODE]" "}\n"; @@ -1107,22 +1107,22 @@ void GeneratorProfile::GeneratorProfileImpl::loadProfile(GeneratorProfile::Profi mInterfaceComputeVariablesMethodFamWoevString = ""; mImplementationComputeVariablesMethodFamWoevString = "\n" - "def compute_variables(variables):\n" + "def compute_variables(constants, computedConstants, algebraic):\n" "[CODE]"; mInterfaceComputeVariablesMethodFamWevString = ""; mImplementationComputeVariablesMethodFamWevString = "\n" - "def compute_variables(variables, external_variable):\n" + "def compute_variables(constants, computedConstants, algebraic, external_variable):\n" "[CODE]"; mInterfaceComputeVariablesMethodFdmWoevString = ""; mImplementationComputeVariablesMethodFdmWoevString = "\n" - "def compute_variables(voi, states, rates, variables):\n" + "def compute_variables(voi, states, rates, constants, computedConstants, algebraic):\n" "[CODE]"; mInterfaceComputeVariablesMethodFdmWevString = ""; mImplementationComputeVariablesMethodFdmWevString = "\n" - "def compute_variables(voi, states, rates, variables, external_variable):\n" + "def compute_variables(voi, states, rates, constants, computedConstants, algebraic, external_variable):\n" "[CODE]"; mEmptyMethodString = "pass\n"; diff --git a/src/generatorprofilesha1values.h b/src/generatorprofilesha1values.h index 9d8261e554..ab046ca59f 100644 --- a/src/generatorprofilesha1values.h +++ b/src/generatorprofilesha1values.h @@ -24,7 +24,7 @@ namespace libcellml { * The content of this file is generated, do not edit this file directly. * See docs/dev_utilities.rst for further information. */ -static const char C_GENERATOR_PROFILE_SHA1[] = "47a9b5b8e33ce2fa29c0385e0debe1d295a7e313"; -static const char PYTHON_GENERATOR_PROFILE_SHA1[] = "f171d1553ad485ad286b4a1152bc7d89631750a6"; +static const char C_GENERATOR_PROFILE_SHA1[] = "33b9e23501b734d3e570f1c7252a6fc6c114c126"; +static const char PYTHON_GENERATOR_PROFILE_SHA1[] = "c7620ae1e094506619cae6023f65d4e9f0bd118d"; } // namespace libcellml diff --git a/tests/bindings/python/test_generator_profile.py b/tests/bindings/python/test_generator_profile.py index 200b1fc250..2a95c3cbca 100644 --- a/tests/bindings/python/test_generator_profile.py +++ b/tests/bindings/python/test_generator_profile.py @@ -789,25 +789,25 @@ def test_implementation_compute_variables_method_string(self): g = GeneratorProfile() self.assertEqual( - 'void computeVariables(double *variables)\n{\n[CODE]}\n', + 'void computeVariables(double *constants, double *computedConstants, double *algebraic)\n{\n[CODE]}\n', g.implementationComputeVariablesMethodString(False, False)) g.setImplementationComputeVariablesMethodString(False, False, GeneratorProfileTestCase.VALUE) self.assertEqual(GeneratorProfileTestCase.VALUE, g.implementationComputeVariablesMethodString(False, False)) self.assertEqual( - 'void computeVariables(double *variables, ExternalVariable externalVariable)\n{\n[CODE]}\n', + 'void computeVariables(double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable)\n{\n[CODE]}\n', g.implementationComputeVariablesMethodString(False, True)) g.setImplementationComputeVariablesMethodString(False, True, GeneratorProfileTestCase.VALUE) self.assertEqual(GeneratorProfileTestCase.VALUE, g.implementationComputeVariablesMethodString(False, True)) self.assertEqual( - 'void computeVariables(double voi, double *states, double *rates, double *variables)\n{\n[CODE]}\n', + 'void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic)\n{\n[CODE]}\n', g.implementationComputeVariablesMethodString(True, False)) g.setImplementationComputeVariablesMethodString(True, False, GeneratorProfileTestCase.VALUE) self.assertEqual(GeneratorProfileTestCase.VALUE, g.implementationComputeVariablesMethodString(True, False)) self.assertEqual( - 'void computeVariables(double voi, double *states, double *rates, double *variables, ExternalVariable externalVariable)\n{\n[CODE]}\n', + 'void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable)\n{\n[CODE]}\n', g.implementationComputeVariablesMethodString(True, True)) g.setImplementationComputeVariablesMethodString(True, True, GeneratorProfileTestCase.VALUE) self.assertEqual(GeneratorProfileTestCase.VALUE, g.implementationComputeVariablesMethodString(True, True)) @@ -1013,25 +1013,25 @@ def test_interface_compute_variables_method_string(self): g = GeneratorProfile() self.assertEqual( - 'void computeVariables(double *variables);\n', + 'void computeVariables(double *constants, double *computedConstants, double *algebraic);\n', g.interfaceComputeVariablesMethodString(False, False)) g.setInterfaceComputeVariablesMethodString(False, False, GeneratorProfileTestCase.VALUE) self.assertEqual(GeneratorProfileTestCase.VALUE, g.interfaceComputeVariablesMethodString(False, False)) self.assertEqual( - 'void computeVariables(double *variables, ExternalVariable externalVariable);\n', + 'void computeVariables(double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable);\n', g.interfaceComputeVariablesMethodString(False, True)) g.setInterfaceComputeVariablesMethodString(False, True, GeneratorProfileTestCase.VALUE) self.assertEqual(GeneratorProfileTestCase.VALUE, g.interfaceComputeVariablesMethodString(False, True)) self.assertEqual( - 'void computeVariables(double voi, double *states, double *rates, double *variables);\n', + 'void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic);\n', g.interfaceComputeVariablesMethodString(True, False)) g.setInterfaceComputeVariablesMethodString(True, False, GeneratorProfileTestCase.VALUE) self.assertEqual(GeneratorProfileTestCase.VALUE, g.interfaceComputeVariablesMethodString(True, False)) self.assertEqual( - 'void computeVariables(double voi, double *states, double *rates, double *variables, ExternalVariable externalVariable);\n', + 'void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable);\n', g.interfaceComputeVariablesMethodString(True, True)) g.setInterfaceComputeVariablesMethodString(True, True, GeneratorProfileTestCase.VALUE) self.assertEqual(GeneratorProfileTestCase.VALUE, g.interfaceComputeVariablesMethodString(True, True)) diff --git a/tests/generator/generatorprofile.cpp b/tests/generator/generatorprofile.cpp index 739baf7354..6fea7d2dc6 100644 --- a/tests/generator/generatorprofile.cpp +++ b/tests/generator/generatorprofile.cpp @@ -515,33 +515,33 @@ TEST(GeneratorProfile, defaultMiscellaneousValues) "}\n", generatorProfile->implementationComputeRatesMethodString(true)); - EXPECT_EQ("void computeVariables(double *variables);\n", + EXPECT_EQ("void computeVariables(double *constants, double *computedConstants, double *algebraic);\n", generatorProfile->interfaceComputeVariablesMethodString(false, false)); - EXPECT_EQ("void computeVariables(double *variables)\n" + EXPECT_EQ("void computeVariables(double *constants, double *computedConstants, double *algebraic)\n" "{\n" "[CODE]" "}\n", generatorProfile->implementationComputeVariablesMethodString(false, false)); - EXPECT_EQ("void computeVariables(double *variables, ExternalVariable externalVariable);\n", + EXPECT_EQ("void computeVariables(double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable);\n", generatorProfile->interfaceComputeVariablesMethodString(false, true)); - EXPECT_EQ("void computeVariables(double *variables, ExternalVariable externalVariable)\n" + EXPECT_EQ("void computeVariables(double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable)\n" "{\n" "[CODE]" "}\n", generatorProfile->implementationComputeVariablesMethodString(false, true)); - EXPECT_EQ("void computeVariables(double voi, double *states, double *rates, double *variables);\n", + EXPECT_EQ("void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic);\n", generatorProfile->interfaceComputeVariablesMethodString(true, false)); - EXPECT_EQ("void computeVariables(double voi, double *states, double *rates, double *variables)\n" + EXPECT_EQ("void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic)\n" "{\n" "[CODE]" "}\n", generatorProfile->implementationComputeVariablesMethodString(true, false)); - EXPECT_EQ("void computeVariables(double voi, double *states, double *rates, double *variables, ExternalVariable externalVariable);\n", + EXPECT_EQ("void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable);\n", generatorProfile->interfaceComputeVariablesMethodString(true, true)); - EXPECT_EQ("void computeVariables(double voi, double *states, double *rates, double *variables, ExternalVariable externalVariable)\n" + EXPECT_EQ("void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable)\n" "{\n" "[CODE]" "}\n", diff --git a/tests/resources/coverage/generator/model.c b/tests/resources/coverage/generator/model.c index 9de8751535..da7e34f989 100644 --- a/tests/resources/coverage/generator/model.c +++ b/tests/resources/coverage/generator/model.c @@ -600,7 +600,7 @@ void computeRates(double voi, double *states, double *rates, double *constants, rates[0] = 1.0; } -void computeVariables(double voi, double *states, double *rates, double *variables) +void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { findRoot0(voi, states, rates, variables); } diff --git a/tests/resources/coverage/generator/model.h b/tests/resources/coverage/generator/model.h index 7730315fcc..50370dca50 100644 --- a/tests/resources/coverage/generator/model.h +++ b/tests/resources/coverage/generator/model.h @@ -38,4 +38,4 @@ void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *constants); void computeComputedConstants(double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); -void computeVariables(double voi, double *states, double *rates, double *variables); +void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/coverage/generator/model.implementation.out b/tests/resources/coverage/generator/model.implementation.out index 9ffecca32b..11491a7789 100644 --- a/tests/resources/coverage/generator/model.implementation.out +++ b/tests/resources/coverage/generator/model.implementation.out @@ -369,7 +369,7 @@ void computeRates(double voi, double *states, double *rates, double *constants, rates[0] = 1.0; } -void computeVariables(double voi, double *states, double *rates, double *variables) +void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { findRoot0(voi, states, rates, variables); } diff --git a/tests/resources/coverage/generator/model.interface.out b/tests/resources/coverage/generator/model.interface.out index efdce8c67b..77cb429b15 100644 --- a/tests/resources/coverage/generator/model.interface.out +++ b/tests/resources/coverage/generator/model.interface.out @@ -11,4 +11,4 @@ void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *constants); void computeComputedConstants(double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); -void computeVariables(double voi, double *states, double *rates, double *variables); +void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/coverage/generator/model.modified.profile.c b/tests/resources/coverage/generator/model.modified.profile.c index c35f5846f5..d4a72bf603 100644 --- a/tests/resources/coverage/generator/model.modified.profile.c +++ b/tests/resources/coverage/generator/model.modified.profile.c @@ -600,7 +600,7 @@ void computeRates(double voi, double *states, double *rates, double *constants, rates[0] = 1.0; } -void computeVariables(double voi, double *states, double *rates, double *variables) +void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { findRoot0(voi, states, rates, variables); } diff --git a/tests/resources/coverage/generator/model.modified.profile.h b/tests/resources/coverage/generator/model.modified.profile.h index 64ce0aa87f..0f769b4cb5 100644 --- a/tests/resources/coverage/generator/model.modified.profile.h +++ b/tests/resources/coverage/generator/model.modified.profile.h @@ -38,4 +38,4 @@ void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *constants); void computeComputedConstants(double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); -void computeVariables(double voi, double *states, double *rates, double *variables); +void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/coverage/generator/model.modified.profile.py b/tests/resources/coverage/generator/model.modified.profile.py index f2c561dfd2..19e8c128f3 100644 --- a/tests/resources/coverage/generator/model.modified.profile.py +++ b/tests/resources/coverage/generator/model.modified.profile.py @@ -598,5 +598,5 @@ def compute_rates(voi, states, rates, constants, computedConstants, algebraic): rates[0] = 1.0 -def compute_variables(voi, states, rates, variables): +def compute_variables(voi, states, rates, constants, computedConstants, algebraic): find_root_0(voi, states, rates, variables) diff --git a/tests/resources/coverage/generator/model.py b/tests/resources/coverage/generator/model.py index 14f9649a82..7afb5ad309 100644 --- a/tests/resources/coverage/generator/model.py +++ b/tests/resources/coverage/generator/model.py @@ -598,5 +598,5 @@ def compute_rates(voi, states, rates, constants, computedConstants, algebraic): rates[0] = 1.0 -def compute_variables(voi, states, rates, variables): +def compute_variables(voi, states, rates, constants, computedConstants, algebraic): find_root_0(voi, states, rates, variables) diff --git a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.c b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.c index 54cf101ec0..e7a8391fe0 100644 --- a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.c +++ b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.c @@ -43,6 +43,6 @@ void computeComputedConstants(double *computedConstants) variables[0] = variables[1]; } -void computeVariables(double *variables) +void computeVariables(double *constants, double *computedConstants, double *algebraic) { } diff --git a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.c b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.c index 7cc4b66ed4..fc41e333b1 100644 --- a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.c +++ b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.c @@ -42,7 +42,7 @@ void computeComputedConstants(double *computedConstants) { } -void computeVariables(double *variables, ExternalVariable externalVariable) +void computeVariables(double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) { variables[1] = externalVariable(variables, 1); variables[0] = variables[1]; diff --git a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.h b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.h index 4e430ed5cf..9ac640aef7 100644 --- a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.h +++ b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.h @@ -34,4 +34,4 @@ typedef double (* ExternalVariable)(double *variables, size_t index); void initialiseVariables(double *constants, ExternalVariable externalVariable); void computeComputedConstants(double *computedConstants); -void computeVariables(double *variables, ExternalVariable externalVariable); +void computeVariables(double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); diff --git a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.py b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.py index db4e1a2732..781aad5787 100644 --- a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.py +++ b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.py @@ -37,6 +37,6 @@ def compute_computed_constants(computed_constants): pass -def compute_variables(variables, external_variable): +def compute_variables(constants, computedConstants, algebraic, external_variable): variables[1] = external_variable(variables, 1) variables[0] = variables[1] diff --git a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.h b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.h index 7be31b5901..efdd8c3c9f 100644 --- a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.h +++ b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.h @@ -31,4 +31,4 @@ void deleteArray(double *array); void initialiseVariables(double *constants); void computeComputedConstants(double *computedConstants); -void computeVariables(double *variables); +void computeVariables(double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.py b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.py index f5a2420788..850fd76c94 100644 --- a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.py +++ b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.py @@ -36,5 +36,5 @@ def compute_computed_constants(computed_constants): variables[0] = variables[1] -def compute_variables(variables): +def compute_variables(constants, computedConstants, algebraic): pass diff --git a/tests/resources/generator/algebraic_eqn_const_var_on_rhs/model.c b/tests/resources/generator/algebraic_eqn_const_var_on_rhs/model.c index b3bebf874e..67d0929811 100644 --- a/tests/resources/generator/algebraic_eqn_const_var_on_rhs/model.c +++ b/tests/resources/generator/algebraic_eqn_const_var_on_rhs/model.c @@ -43,6 +43,6 @@ void computeComputedConstants(double *computedConstants) variables[0] = variables[1]; } -void computeVariables(double *variables) +void computeVariables(double *constants, double *computedConstants, double *algebraic) { } diff --git a/tests/resources/generator/algebraic_eqn_const_var_on_rhs/model.h b/tests/resources/generator/algebraic_eqn_const_var_on_rhs/model.h index 7be31b5901..efdd8c3c9f 100644 --- a/tests/resources/generator/algebraic_eqn_const_var_on_rhs/model.h +++ b/tests/resources/generator/algebraic_eqn_const_var_on_rhs/model.h @@ -31,4 +31,4 @@ void deleteArray(double *array); void initialiseVariables(double *constants); void computeComputedConstants(double *computedConstants); -void computeVariables(double *variables); +void computeVariables(double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/algebraic_eqn_const_var_on_rhs/model.py b/tests/resources/generator/algebraic_eqn_const_var_on_rhs/model.py index d9e835d39f..94f2dd4a95 100644 --- a/tests/resources/generator/algebraic_eqn_const_var_on_rhs/model.py +++ b/tests/resources/generator/algebraic_eqn_const_var_on_rhs/model.py @@ -36,5 +36,5 @@ def compute_computed_constants(computed_constants): variables[0] = variables[1] -def compute_variables(variables): +def compute_variables(constants, computedConstants, algebraic): pass diff --git a/tests/resources/generator/algebraic_eqn_constant_on_rhs/model.c b/tests/resources/generator/algebraic_eqn_constant_on_rhs/model.c index 218da97664..14e40ccee7 100644 --- a/tests/resources/generator/algebraic_eqn_constant_on_rhs/model.c +++ b/tests/resources/generator/algebraic_eqn_constant_on_rhs/model.c @@ -41,6 +41,6 @@ void computeComputedConstants(double *computedConstants) { } -void computeVariables(double *variables) +void computeVariables(double *constants, double *computedConstants, double *algebraic) { } diff --git a/tests/resources/generator/algebraic_eqn_constant_on_rhs/model.h b/tests/resources/generator/algebraic_eqn_constant_on_rhs/model.h index 230086c604..1f4d1dcf94 100644 --- a/tests/resources/generator/algebraic_eqn_constant_on_rhs/model.h +++ b/tests/resources/generator/algebraic_eqn_constant_on_rhs/model.h @@ -31,4 +31,4 @@ void deleteArray(double *array); void initialiseVariables(double *constants); void computeComputedConstants(double *computedConstants); -void computeVariables(double *variables); +void computeVariables(double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/algebraic_eqn_constant_on_rhs/model.py b/tests/resources/generator/algebraic_eqn_constant_on_rhs/model.py index a0f2837908..f51bc9ecb3 100644 --- a/tests/resources/generator/algebraic_eqn_constant_on_rhs/model.py +++ b/tests/resources/generator/algebraic_eqn_constant_on_rhs/model.py @@ -35,5 +35,5 @@ def compute_computed_constants(computed_constants): pass -def compute_variables(variables): +def compute_variables(constants, computedConstants, algebraic): pass diff --git a/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.c b/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.c index 9b3bafb898..dd75465497 100644 --- a/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.c +++ b/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.c @@ -66,7 +66,7 @@ void computeRates(double voi, double *states, double *rates, double *constants, rates[0] = variables[0]; } -void computeVariables(double voi, double *states, double *rates, double *variables) +void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { variables[1] = rates[0]; } diff --git a/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.h b/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.h index d05526b0f9..7b9fab8b61 100644 --- a/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.h +++ b/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.h @@ -38,4 +38,4 @@ void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *constants); void computeComputedConstants(double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); -void computeVariables(double voi, double *states, double *rates, double *variables); +void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.py b/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.py index fab4c53eb9..7cff7aaaad 100644 --- a/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.py +++ b/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.py @@ -54,5 +54,5 @@ def compute_rates(voi, states, rates, constants, computedConstants, algebraic): rates[0] = variables[0] -def compute_variables(voi, states, rates, variables): +def compute_variables(voi, states, rates, constants, computedConstants, algebraic): variables[1] = rates[0] diff --git a/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.c b/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.c index 1c98887b52..999d76aa5a 100644 --- a/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.c +++ b/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.c @@ -66,7 +66,7 @@ void computeRates(double voi, double *states, double *rates, double *constants, rates[0] = variables[0]; } -void computeVariables(double voi, double *states, double *rates, double *variables) +void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { variables[1] = rates[0]; } diff --git a/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.h b/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.h index 7f86bfafdd..94a64dfa85 100644 --- a/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.h +++ b/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.h @@ -38,4 +38,4 @@ void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *constants); void computeComputedConstants(double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); -void computeVariables(double voi, double *states, double *rates, double *variables); +void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.py b/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.py index 5a1db9e80a..0e55e6b5b6 100644 --- a/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.py +++ b/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.py @@ -54,5 +54,5 @@ def compute_rates(voi, states, rates, constants, computedConstants, algebraic): rates[0] = variables[0] -def compute_variables(voi, states, rates, variables): +def compute_variables(voi, states, rates, constants, computedConstants, algebraic): variables[1] = rates[0] diff --git a/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.c b/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.c index 4539a94e66..3074a08bb7 100644 --- a/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.c +++ b/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.c @@ -66,7 +66,7 @@ void computeRates(double voi, double *states, double *rates, double *constants, rates[0] = variables[0]; } -void computeVariables(double voi, double *states, double *rates, double *variables) +void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { variables[1] = 2.0*states[0]; } diff --git a/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.h b/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.h index 687e4f315a..9c395a3d44 100644 --- a/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.h +++ b/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.h @@ -38,4 +38,4 @@ void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *constants); void computeComputedConstants(double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); -void computeVariables(double voi, double *states, double *rates, double *variables); +void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.py b/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.py index 59f13819af..50cfc4e9fd 100644 --- a/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.py +++ b/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.py @@ -54,5 +54,5 @@ def compute_rates(voi, states, rates, constants, computedConstants, algebraic): rates[0] = variables[0] -def compute_variables(voi, states, rates, variables): +def compute_variables(voi, states, rates, constants, computedConstants, algebraic): variables[1] = 2.0*states[0] diff --git a/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.c b/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.c index 3a124f662f..6a004da952 100644 --- a/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.c +++ b/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.c @@ -66,7 +66,7 @@ void computeRates(double voi, double *states, double *rates, double *constants, rates[0] = variables[0]; } -void computeVariables(double voi, double *states, double *rates, double *variables) +void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { variables[1] = 2.0*states[0]; } diff --git a/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.h b/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.h index b30eab519f..50c681f144 100644 --- a/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.h +++ b/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.h @@ -38,4 +38,4 @@ void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *constants); void computeComputedConstants(double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); -void computeVariables(double voi, double *states, double *rates, double *variables); +void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.py b/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.py index 1ed616c4fa..353cea9ff5 100644 --- a/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.py +++ b/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.py @@ -54,5 +54,5 @@ def compute_rates(voi, states, rates, constants, computedConstants, algebraic): rates[0] = variables[0] -def compute_variables(voi, states, rates, variables): +def compute_variables(voi, states, rates, constants, computedConstants, algebraic): variables[1] = 2.0*states[0] diff --git a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.c b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.c index fdf043a001..7b9e360fcc 100644 --- a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.c +++ b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.c @@ -75,7 +75,7 @@ void computeComputedConstants(double *computedConstants) { } -void computeVariables(double *variables) +void computeVariables(double *constants, double *computedConstants, double *algebraic) { findRoot0(variables); } diff --git a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.c b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.c index 300066fb2f..eda59a04ad 100644 --- a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.c +++ b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.c @@ -47,7 +47,7 @@ void computeComputedConstants(double *computedConstants) { } -void computeVariables(double *variables, ExternalVariable externalVariable) +void computeVariables(double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) { variables[3] = externalVariable(variables, 3); } diff --git a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.h b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.h index 4e430ed5cf..9ac640aef7 100644 --- a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.h +++ b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.h @@ -34,4 +34,4 @@ typedef double (* ExternalVariable)(double *variables, size_t index); void initialiseVariables(double *constants, ExternalVariable externalVariable); void computeComputedConstants(double *computedConstants); -void computeVariables(double *variables, ExternalVariable externalVariable); +void computeVariables(double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); diff --git a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.py b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.py index 2f516f834c..44d1589f05 100644 --- a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.py +++ b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.py @@ -42,5 +42,5 @@ def compute_computed_constants(computed_constants): pass -def compute_variables(variables, external_variable): +def compute_variables(constants, computedConstants, algebraic, external_variable): variables[3] = external_variable(variables, 3) diff --git a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.h b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.h index 7be31b5901..efdd8c3c9f 100644 --- a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.h +++ b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.h @@ -31,4 +31,4 @@ void deleteArray(double *array); void initialiseVariables(double *constants); void computeComputedConstants(double *computedConstants); -void computeVariables(double *variables); +void computeVariables(double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.py b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.py index 3f07e38d57..98a491a2c4 100644 --- a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.py +++ b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.py @@ -62,5 +62,5 @@ def compute_computed_constants(computed_constants): pass -def compute_variables(variables): +def compute_variables(constants, computedConstants, algebraic): find_root_0(variables) diff --git a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.c b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.c index 3f08eb3638..c2c0ceb69c 100644 --- a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.c +++ b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.c @@ -81,7 +81,7 @@ void computeComputedConstants(double *computedConstants) { } -void computeVariables(double *variables) +void computeVariables(double *constants, double *computedConstants, double *algebraic) { findRoot0(variables); } diff --git a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.h b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.h index 95cddbeb4b..7850afa8d9 100644 --- a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.h +++ b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.h @@ -31,4 +31,4 @@ void deleteArray(double *array); void initialiseVariables(double *constants); void computeComputedConstants(double *computedConstants); -void computeVariables(double *variables); +void computeVariables(double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.one.external.c b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.one.external.c index 379ddae4ea..83641270b5 100644 --- a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.one.external.c +++ b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.one.external.c @@ -78,7 +78,7 @@ void computeComputedConstants(double *computedConstants) { } -void computeVariables(double *variables, ExternalVariable externalVariable) +void computeVariables(double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) { variables[0] = externalVariable(variables, 0); findRoot0(variables); diff --git a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.one.external.h b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.one.external.h index df0655d6fb..ffc06e13b9 100644 --- a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.one.external.h +++ b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.one.external.h @@ -34,4 +34,4 @@ typedef double (* ExternalVariable)(double *variables, size_t index); void initialiseVariables(double *constants, ExternalVariable externalVariable); void computeComputedConstants(double *computedConstants); -void computeVariables(double *variables, ExternalVariable externalVariable); +void computeVariables(double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); diff --git a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.one.external.py b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.one.external.py index d51f24510e..c0ea0719e8 100644 --- a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.one.external.py +++ b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.one.external.py @@ -66,6 +66,6 @@ def compute_computed_constants(computed_constants): pass -def compute_variables(variables, external_variable): +def compute_variables(constants, computedConstants, algebraic, external_variable): variables[0] = external_variable(variables, 0) find_root_0(variables) diff --git a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.py b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.py index ad98c51d75..0444e0091f 100644 --- a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.py +++ b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.py @@ -68,5 +68,5 @@ def compute_computed_constants(computed_constants): pass -def compute_variables(variables): +def compute_variables(constants, computedConstants, algebraic): find_root_0(variables) diff --git a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.c b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.c index 7cbf8256ae..38b9632cd6 100644 --- a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.c +++ b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.c @@ -45,7 +45,7 @@ void computeComputedConstants(double *computedConstants) { } -void computeVariables(double *variables, ExternalVariable externalVariable) +void computeVariables(double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) { variables[0] = externalVariable(variables, 0); variables[1] = externalVariable(variables, 1); diff --git a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.h b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.h index df0655d6fb..ffc06e13b9 100644 --- a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.h +++ b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.h @@ -34,4 +34,4 @@ typedef double (* ExternalVariable)(double *variables, size_t index); void initialiseVariables(double *constants, ExternalVariable externalVariable); void computeComputedConstants(double *computedConstants); -void computeVariables(double *variables, ExternalVariable externalVariable); +void computeVariables(double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); diff --git a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.py b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.py index bf285d55d8..c9f380a65c 100644 --- a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.py +++ b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.py @@ -40,7 +40,7 @@ def compute_computed_constants(computed_constants): pass -def compute_variables(variables, external_variable): +def compute_variables(constants, computedConstants, algebraic, external_variable): variables[0] = external_variable(variables, 0) variables[1] = external_variable(variables, 1) variables[2] = external_variable(variables, 2) diff --git a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.two.externals.c b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.two.externals.c index 9be838cc48..93170385b2 100644 --- a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.two.externals.c +++ b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.two.externals.c @@ -115,7 +115,7 @@ void computeComputedConstants(double *computedConstants) { } -void computeVariables(double *variables, ExternalVariable externalVariable) +void computeVariables(double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) { variables[0] = externalVariable(variables, 0); variables[2] = externalVariable(variables, 2); diff --git a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.two.externals.h b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.two.externals.h index df0655d6fb..ffc06e13b9 100644 --- a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.two.externals.h +++ b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.two.externals.h @@ -34,4 +34,4 @@ typedef double (* ExternalVariable)(double *variables, size_t index); void initialiseVariables(double *constants, ExternalVariable externalVariable); void computeComputedConstants(double *computedConstants); -void computeVariables(double *variables, ExternalVariable externalVariable); +void computeVariables(double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); diff --git a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.two.externals.py b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.two.externals.py index 2001d60800..0c5fbd0d15 100644 --- a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.two.externals.py +++ b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.two.externals.py @@ -97,7 +97,7 @@ def compute_computed_constants(computed_constants): pass -def compute_variables(variables, external_variable): +def compute_variables(constants, computedConstants, algebraic, external_variable): variables[0] = external_variable(variables, 0) variables[2] = external_variable(variables, 2) find_root_0(variables) diff --git a/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.c b/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.c index fc31362799..7988fd4d9d 100644 --- a/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.c +++ b/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.c @@ -82,7 +82,7 @@ void computeComputedConstants(double *computedConstants) variables[3] = 3.0*variables[4]+variables[5]; } -void computeVariables(double *variables) +void computeVariables(double *constants, double *computedConstants, double *algebraic) { findRoot0(variables); variables[0] = variables[1]+variables[2]; diff --git a/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.h b/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.h index 95cddbeb4b..7850afa8d9 100644 --- a/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.h +++ b/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.h @@ -31,4 +31,4 @@ void deleteArray(double *array); void initialiseVariables(double *constants); void computeComputedConstants(double *computedConstants); -void computeVariables(double *variables); +void computeVariables(double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.py b/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.py index 389dbfc4db..732e694829 100644 --- a/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.py +++ b/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.py @@ -68,6 +68,6 @@ def compute_computed_constants(computed_constants): variables[3] = 3.0*variables[4]+variables[5] -def compute_variables(variables): +def compute_variables(constants, computedConstants, algebraic): find_root_0(variables) variables[0] = variables[1]+variables[2] diff --git a/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.c b/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.c index 35fe86e31b..1f97af5bdc 100644 --- a/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.c +++ b/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.c @@ -82,7 +82,7 @@ void computeComputedConstants(double *computedConstants) variables[0] = 3.0*variables[1]+variables[2]; } -void computeVariables(double *variables) +void computeVariables(double *constants, double *computedConstants, double *algebraic) { findRoot0(variables); variables[5] = variables[4]+variables[3]; diff --git a/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.h b/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.h index 95cddbeb4b..7850afa8d9 100644 --- a/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.h +++ b/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.h @@ -31,4 +31,4 @@ void deleteArray(double *array); void initialiseVariables(double *constants); void computeComputedConstants(double *computedConstants); -void computeVariables(double *variables); +void computeVariables(double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.py b/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.py index ec5c0bbf2a..eb228d40bc 100644 --- a/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.py +++ b/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.py @@ -68,6 +68,6 @@ def compute_computed_constants(computed_constants): variables[0] = 3.0*variables[1]+variables[2] -def compute_variables(variables): +def compute_variables(constants, computedConstants, algebraic): find_root_0(variables) variables[5] = variables[4]+variables[3] diff --git a/tests/resources/generator/algebraic_unknown_var_on_rhs/model.c b/tests/resources/generator/algebraic_unknown_var_on_rhs/model.c index e02a8b1421..b587e3aaa6 100644 --- a/tests/resources/generator/algebraic_unknown_var_on_rhs/model.c +++ b/tests/resources/generator/algebraic_unknown_var_on_rhs/model.c @@ -43,6 +43,6 @@ void computeComputedConstants(double *computedConstants) variables[1] = variables[0]; } -void computeVariables(double *variables) +void computeVariables(double *constants, double *computedConstants, double *algebraic) { } diff --git a/tests/resources/generator/algebraic_unknown_var_on_rhs/model.h b/tests/resources/generator/algebraic_unknown_var_on_rhs/model.h index 230086c604..1f4d1dcf94 100644 --- a/tests/resources/generator/algebraic_unknown_var_on_rhs/model.h +++ b/tests/resources/generator/algebraic_unknown_var_on_rhs/model.h @@ -31,4 +31,4 @@ void deleteArray(double *array); void initialiseVariables(double *constants); void computeComputedConstants(double *computedConstants); -void computeVariables(double *variables); +void computeVariables(double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/algebraic_unknown_var_on_rhs/model.py b/tests/resources/generator/algebraic_unknown_var_on_rhs/model.py index a273db38c4..40a75154ac 100644 --- a/tests/resources/generator/algebraic_unknown_var_on_rhs/model.py +++ b/tests/resources/generator/algebraic_unknown_var_on_rhs/model.py @@ -36,5 +36,5 @@ def compute_computed_constants(computed_constants): variables[1] = variables[0] -def compute_variables(variables): +def compute_variables(constants, computedConstants, algebraic): pass diff --git a/tests/resources/generator/cell_geometry_model/model.c b/tests/resources/generator/cell_geometry_model/model.c index b69bd0e05c..eb98bbb190 100644 --- a/tests/resources/generator/cell_geometry_model/model.c +++ b/tests/resources/generator/cell_geometry_model/model.c @@ -47,6 +47,6 @@ void computeComputedConstants(double *computedConstants) variables[3] = 0.02*variables[0]; } -void computeVariables(double *variables) +void computeVariables(double *constants, double *computedConstants, double *algebraic) { } diff --git a/tests/resources/generator/cell_geometry_model/model.external.c b/tests/resources/generator/cell_geometry_model/model.external.c index 3ceea7e7a7..c9196c88c0 100644 --- a/tests/resources/generator/cell_geometry_model/model.external.c +++ b/tests/resources/generator/cell_geometry_model/model.external.c @@ -45,7 +45,7 @@ void computeComputedConstants(double *computedConstants) { } -void computeVariables(double *variables, ExternalVariable externalVariable) +void computeVariables(double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) { variables[1] = externalVariable(variables, 1); variables[2] = externalVariable(variables, 2); diff --git a/tests/resources/generator/cell_geometry_model/model.external.h b/tests/resources/generator/cell_geometry_model/model.external.h index 86e769ee4e..4ff6fcadf4 100644 --- a/tests/resources/generator/cell_geometry_model/model.external.h +++ b/tests/resources/generator/cell_geometry_model/model.external.h @@ -34,4 +34,4 @@ typedef double (* ExternalVariable)(double *variables, size_t index); void initialiseVariables(double *constants, ExternalVariable externalVariable); void computeComputedConstants(double *computedConstants); -void computeVariables(double *variables, ExternalVariable externalVariable); +void computeVariables(double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); diff --git a/tests/resources/generator/cell_geometry_model/model.external.py b/tests/resources/generator/cell_geometry_model/model.external.py index 3d69c78eda..a186a0405d 100644 --- a/tests/resources/generator/cell_geometry_model/model.external.py +++ b/tests/resources/generator/cell_geometry_model/model.external.py @@ -40,7 +40,7 @@ def compute_computed_constants(computed_constants): pass -def compute_variables(variables, external_variable): +def compute_variables(constants, computedConstants, algebraic, external_variable): variables[1] = external_variable(variables, 1) variables[2] = external_variable(variables, 2) variables[0] = 1000.0*3.14*variables[2]*variables[2]*variables[1] diff --git a/tests/resources/generator/cell_geometry_model/model.h b/tests/resources/generator/cell_geometry_model/model.h index 882e0d6ab7..2a61e0d910 100644 --- a/tests/resources/generator/cell_geometry_model/model.h +++ b/tests/resources/generator/cell_geometry_model/model.h @@ -31,4 +31,4 @@ void deleteArray(double *array); void initialiseVariables(double *constants); void computeComputedConstants(double *computedConstants); -void computeVariables(double *variables); +void computeVariables(double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/cell_geometry_model/model.py b/tests/resources/generator/cell_geometry_model/model.py index 48ad53c10f..eeb43ec56b 100644 --- a/tests/resources/generator/cell_geometry_model/model.py +++ b/tests/resources/generator/cell_geometry_model/model.py @@ -40,5 +40,5 @@ def compute_computed_constants(computed_constants): variables[3] = 0.02*variables[0] -def compute_variables(variables): +def compute_variables(constants, computedConstants, algebraic): pass diff --git a/tests/resources/generator/cellml_mappings_and_encapsulations/model.c b/tests/resources/generator/cellml_mappings_and_encapsulations/model.c index c4d18d612e..95661b3c66 100644 --- a/tests/resources/generator/cellml_mappings_and_encapsulations/model.c +++ b/tests/resources/generator/cellml_mappings_and_encapsulations/model.c @@ -68,7 +68,7 @@ void computeRates(double voi, double *states, double *rates, double *constants, rates[0] = states[1]*1.0; } -void computeVariables(double voi, double *states, double *rates, double *variables) +void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { variables[0] = states[0]+5.0*states[0]/3.0+1.0*exp(states[0]/2.0); variables[1] = 2.0*states[1]; diff --git a/tests/resources/generator/cellml_mappings_and_encapsulations/model.h b/tests/resources/generator/cellml_mappings_and_encapsulations/model.h index edaae29a0c..00bb5bd451 100644 --- a/tests/resources/generator/cellml_mappings_and_encapsulations/model.h +++ b/tests/resources/generator/cellml_mappings_and_encapsulations/model.h @@ -38,4 +38,4 @@ void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *constants); void computeComputedConstants(double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); -void computeVariables(double voi, double *states, double *rates, double *variables); +void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/cellml_mappings_and_encapsulations/model.py b/tests/resources/generator/cellml_mappings_and_encapsulations/model.py index dc65de94a6..70c4e2d233 100644 --- a/tests/resources/generator/cellml_mappings_and_encapsulations/model.py +++ b/tests/resources/generator/cellml_mappings_and_encapsulations/model.py @@ -56,6 +56,6 @@ def compute_rates(voi, states, rates, constants, computedConstants, algebraic): rates[0] = states[1]*1.0 -def compute_variables(voi, states, rates, variables): +def compute_variables(voi, states, rates, constants, computedConstants, algebraic): variables[0] = states[0]+5.0*states[0]/3.0+1.0*exp(states[0]/2.0) variables[1] = 2.0*states[1] diff --git a/tests/resources/generator/cellml_slc_example/model.py b/tests/resources/generator/cellml_slc_example/model.py index 4afceca0c5..671757fccc 100644 --- a/tests/resources/generator/cellml_slc_example/model.py +++ b/tests/resources/generator/cellml_slc_example/model.py @@ -52,5 +52,5 @@ def compute_computed_constants(computed_constants): variables[0] = variables[1]*(variables[2]*variables[3]-variables[4]*variables[5])/(variables[6]*variables[5]+variables[9]*variables[3]+variables[8]*variables[5]*variables[3]+variables[7]) -def compute_variables(variables): +def compute_variables(constants, computedConstants, algebraic): pass diff --git a/tests/resources/generator/cellml_state_initialised_using_variable/model.c b/tests/resources/generator/cellml_state_initialised_using_variable/model.c index 3475b85d51..7b504d866e 100644 --- a/tests/resources/generator/cellml_state_initialised_using_variable/model.c +++ b/tests/resources/generator/cellml_state_initialised_using_variable/model.c @@ -65,6 +65,6 @@ void computeRates(double voi, double *states, double *rates, double *constants, rates[0] = 1.23; } -void computeVariables(double voi, double *states, double *rates, double *variables) +void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { } diff --git a/tests/resources/generator/cellml_state_initialised_using_variable/model.h b/tests/resources/generator/cellml_state_initialised_using_variable/model.h index 3c03deb824..8c3626ccd4 100644 --- a/tests/resources/generator/cellml_state_initialised_using_variable/model.h +++ b/tests/resources/generator/cellml_state_initialised_using_variable/model.h @@ -38,4 +38,4 @@ void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *constants); void computeComputedConstants(double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); -void computeVariables(double voi, double *states, double *rates, double *variables); +void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/cellml_state_initialised_using_variable/model.py b/tests/resources/generator/cellml_state_initialised_using_variable/model.py index d0b35c9394..3e187a3303 100644 --- a/tests/resources/generator/cellml_state_initialised_using_variable/model.py +++ b/tests/resources/generator/cellml_state_initialised_using_variable/model.py @@ -53,5 +53,5 @@ def compute_rates(voi, states, rates, constants, computedConstants, algebraic): rates[0] = 1.23 -def compute_variables(voi, states, rates, variables): +def compute_variables(voi, states, rates, constants, computedConstants, algebraic): pass diff --git a/tests/resources/generator/cellml_unit_scaling_constant/model.c b/tests/resources/generator/cellml_unit_scaling_constant/model.c index 790526d9ca..263e235ef0 100644 --- a/tests/resources/generator/cellml_unit_scaling_constant/model.c +++ b/tests/resources/generator/cellml_unit_scaling_constant/model.c @@ -45,6 +45,6 @@ void computeComputedConstants(double *computedConstants) variables[2] = 0.001*variables[0]+0.001*variables[0]; } -void computeVariables(double *variables) +void computeVariables(double *constants, double *computedConstants, double *algebraic) { } diff --git a/tests/resources/generator/cellml_unit_scaling_constant/model.h b/tests/resources/generator/cellml_unit_scaling_constant/model.h index 5499853e34..c00e1f9991 100644 --- a/tests/resources/generator/cellml_unit_scaling_constant/model.h +++ b/tests/resources/generator/cellml_unit_scaling_constant/model.h @@ -31,4 +31,4 @@ void deleteArray(double *array); void initialiseVariables(double *constants); void computeComputedConstants(double *computedConstants); -void computeVariables(double *variables); +void computeVariables(double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/cellml_unit_scaling_constant/model.py b/tests/resources/generator/cellml_unit_scaling_constant/model.py index 7a674f9014..0225aaf9a3 100644 --- a/tests/resources/generator/cellml_unit_scaling_constant/model.py +++ b/tests/resources/generator/cellml_unit_scaling_constant/model.py @@ -38,5 +38,5 @@ def compute_computed_constants(computed_constants): variables[2] = 0.001*variables[0]+0.001*variables[0] -def compute_variables(variables): +def compute_variables(constants, computedConstants, algebraic): pass diff --git a/tests/resources/generator/cellml_unit_scaling_rate/model.c b/tests/resources/generator/cellml_unit_scaling_rate/model.c index 9af4c26b6f..34036c90a5 100644 --- a/tests/resources/generator/cellml_unit_scaling_rate/model.c +++ b/tests/resources/generator/cellml_unit_scaling_rate/model.c @@ -65,7 +65,7 @@ void computeRates(double voi, double *states, double *rates, double *constants, rates[0] = 1.23; } -void computeVariables(double voi, double *states, double *rates, double *variables) +void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { variables[0] = 1000.0*rates[0]+1000.0*rates[0]; variables[1] = 1000.0*0.001*rates[0]+1000.0*0.001*rates[0]; diff --git a/tests/resources/generator/cellml_unit_scaling_rate/model.h b/tests/resources/generator/cellml_unit_scaling_rate/model.h index 3c03deb824..8c3626ccd4 100644 --- a/tests/resources/generator/cellml_unit_scaling_rate/model.h +++ b/tests/resources/generator/cellml_unit_scaling_rate/model.h @@ -38,4 +38,4 @@ void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *constants); void computeComputedConstants(double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); -void computeVariables(double voi, double *states, double *rates, double *variables); +void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/cellml_unit_scaling_rate/model.py b/tests/resources/generator/cellml_unit_scaling_rate/model.py index 81b99ccccd..758d11eb06 100644 --- a/tests/resources/generator/cellml_unit_scaling_rate/model.py +++ b/tests/resources/generator/cellml_unit_scaling_rate/model.py @@ -53,6 +53,6 @@ def compute_rates(voi, states, rates, constants, computedConstants, algebraic): rates[0] = 1.23 -def compute_variables(voi, states, rates, variables): +def compute_variables(voi, states, rates, constants, computedConstants, algebraic): variables[0] = 1000.0*rates[0]+1000.0*rates[0] variables[1] = 1000.0*0.001*rates[0]+1000.0*0.001*rates[0] diff --git a/tests/resources/generator/cellml_unit_scaling_state/model.c b/tests/resources/generator/cellml_unit_scaling_state/model.c index d89ec5205a..1237bfea4c 100644 --- a/tests/resources/generator/cellml_unit_scaling_state/model.c +++ b/tests/resources/generator/cellml_unit_scaling_state/model.c @@ -65,7 +65,7 @@ void computeRates(double voi, double *states, double *rates, double *constants, rates[0] = 1.23; } -void computeVariables(double voi, double *states, double *rates, double *variables) +void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { variables[0] = states[0]+states[0]; variables[1] = 0.001*states[0]+0.001*states[0]; diff --git a/tests/resources/generator/cellml_unit_scaling_state/model.h b/tests/resources/generator/cellml_unit_scaling_state/model.h index 3c03deb824..8c3626ccd4 100644 --- a/tests/resources/generator/cellml_unit_scaling_state/model.h +++ b/tests/resources/generator/cellml_unit_scaling_state/model.h @@ -38,4 +38,4 @@ void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *constants); void computeComputedConstants(double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); -void computeVariables(double voi, double *states, double *rates, double *variables); +void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/cellml_unit_scaling_state/model.py b/tests/resources/generator/cellml_unit_scaling_state/model.py index 8ea99efc5e..5587cbfc4b 100644 --- a/tests/resources/generator/cellml_unit_scaling_state/model.py +++ b/tests/resources/generator/cellml_unit_scaling_state/model.py @@ -53,6 +53,6 @@ def compute_rates(voi, states, rates, constants, computedConstants, algebraic): rates[0] = 1.23 -def compute_variables(voi, states, rates, variables): +def compute_variables(voi, states, rates, constants, computedConstants, algebraic): variables[0] = states[0]+states[0] variables[1] = 0.001*states[0]+0.001*states[0] diff --git a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.c b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.c index a369dea891..9a27a9d836 100644 --- a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.c +++ b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.c @@ -66,6 +66,6 @@ void computeRates(double voi, double *states, double *rates, double *constants, rates[1] = 7.89; } -void computeVariables(double voi, double *states, double *rates, double *variables) +void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { } diff --git a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.h b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.h index 6a04a2fbc6..dd033a99a5 100644 --- a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.h +++ b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.h @@ -38,4 +38,4 @@ void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *constants); void computeComputedConstants(double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); -void computeVariables(double voi, double *states, double *rates, double *variables); +void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.py b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.py index 1217a8d8a7..1f6f1d4ba7 100644 --- a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.py +++ b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.py @@ -54,5 +54,5 @@ def compute_rates(voi, states, rates, constants, computedConstants, algebraic): rates[1] = 7.89 -def compute_variables(voi, states, rates, variables): +def compute_variables(voi, states, rates, constants, computedConstants, algebraic): pass diff --git a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.c b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.c index 3300a15074..7b0c4b31fb 100644 --- a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.c +++ b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.c @@ -70,6 +70,6 @@ void computeRates(double voi, double *states, double *rates, double *constants, rates[1] = 7.89; } -void computeVariables(double voi, double *states, double *rates, double *variables) +void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { } diff --git a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.h b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.h index 4c3949f2a3..973e179a41 100644 --- a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.h +++ b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.h @@ -38,4 +38,4 @@ void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *constants); void computeComputedConstants(double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); -void computeVariables(double voi, double *states, double *rates, double *variables); +void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.py b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.py index 9db1db1206..f036cd72f5 100644 --- a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.py +++ b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.py @@ -58,5 +58,5 @@ def compute_rates(voi, states, rates, constants, computedConstants, algebraic): rates[1] = 7.89 -def compute_variables(voi, states, rates, variables): +def compute_variables(voi, states, rates, constants, computedConstants, algebraic): pass diff --git a/tests/resources/generator/cellml_unit_scaling_voi_direct/model.c b/tests/resources/generator/cellml_unit_scaling_voi_direct/model.c index 01ebcf4265..f283bf9e3d 100644 --- a/tests/resources/generator/cellml_unit_scaling_voi_direct/model.c +++ b/tests/resources/generator/cellml_unit_scaling_voi_direct/model.c @@ -66,6 +66,6 @@ void computeRates(double voi, double *states, double *rates, double *constants, rates[1] = 0.001*voi/1.0; } -void computeVariables(double voi, double *states, double *rates, double *variables) +void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { } diff --git a/tests/resources/generator/cellml_unit_scaling_voi_direct/model.h b/tests/resources/generator/cellml_unit_scaling_voi_direct/model.h index 0bccaf5c81..a4444473cb 100644 --- a/tests/resources/generator/cellml_unit_scaling_voi_direct/model.h +++ b/tests/resources/generator/cellml_unit_scaling_voi_direct/model.h @@ -38,4 +38,4 @@ void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *constants); void computeComputedConstants(double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); -void computeVariables(double voi, double *states, double *rates, double *variables); +void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/cellml_unit_scaling_voi_direct/model.py b/tests/resources/generator/cellml_unit_scaling_voi_direct/model.py index 98608474d3..01562a7bf6 100644 --- a/tests/resources/generator/cellml_unit_scaling_voi_direct/model.py +++ b/tests/resources/generator/cellml_unit_scaling_voi_direct/model.py @@ -54,5 +54,5 @@ def compute_rates(voi, states, rates, constants, computedConstants, algebraic): rates[1] = 0.001*voi/1.0 -def compute_variables(voi, states, rates, variables): +def compute_variables(voi, states, rates, constants, computedConstants, algebraic): pass diff --git a/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.c b/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.c index 3001a87e82..5235183501 100644 --- a/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.c +++ b/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.c @@ -69,6 +69,6 @@ void computeRates(double voi, double *states, double *rates, double *constants, rates[2] = 0.001*13.0; } -void computeVariables(double voi, double *states, double *rates, double *variables) +void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { } diff --git a/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.h b/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.h index e39db828a1..b79936bf98 100644 --- a/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.h +++ b/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.h @@ -38,4 +38,4 @@ void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *constants); void computeComputedConstants(double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); -void computeVariables(double voi, double *states, double *rates, double *variables); +void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.py b/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.py index 3571fc7894..cdc67162d7 100644 --- a/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.py +++ b/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.py @@ -57,5 +57,5 @@ def compute_rates(voi, states, rates, constants, computedConstants, algebraic): rates[2] = 0.001*13.0 -def compute_variables(voi, states, rates, variables): +def compute_variables(voi, states, rates, constants, computedConstants, algebraic): pass diff --git a/tests/resources/generator/dae_cellml_1_1_model/model.c b/tests/resources/generator/dae_cellml_1_1_model/model.c index 30a8c5729c..35ff65347a 100644 --- a/tests/resources/generator/dae_cellml_1_1_model/model.c +++ b/tests/resources/generator/dae_cellml_1_1_model/model.c @@ -146,7 +146,7 @@ void computeRates(double voi, double *states, double *rates, double *constants, rates[1] = variables[6]/variables[9]; } -void computeVariables(double voi, double *states, double *rates, double *variables) +void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { variables[2] = states[1]+variables[3]; findRoot0(voi, states, rates, variables); diff --git a/tests/resources/generator/dae_cellml_1_1_model/model.h b/tests/resources/generator/dae_cellml_1_1_model/model.h index 23a61c61e6..3b1c8ced6f 100644 --- a/tests/resources/generator/dae_cellml_1_1_model/model.h +++ b/tests/resources/generator/dae_cellml_1_1_model/model.h @@ -38,4 +38,4 @@ void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *constants); void computeComputedConstants(double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); -void computeVariables(double voi, double *states, double *rates, double *variables); +void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/dae_cellml_1_1_model/model.py b/tests/resources/generator/dae_cellml_1_1_model/model.py index f0c69dd15e..463eee85fb 100644 --- a/tests/resources/generator/dae_cellml_1_1_model/model.py +++ b/tests/resources/generator/dae_cellml_1_1_model/model.py @@ -121,7 +121,7 @@ def compute_rates(voi, states, rates, constants, computedConstants, algebraic): rates[1] = variables[6]/variables[9] -def compute_variables(voi, states, rates, variables): +def compute_variables(voi, states, rates, constants, computedConstants, algebraic): variables[2] = states[1]+variables[3] find_root_0(voi, states, rates, variables) variables[4] = states[0]/variables[7] diff --git a/tests/resources/generator/dependent_eqns/model.c b/tests/resources/generator/dependent_eqns/model.c index 670fcf6202..c9fc847af5 100644 --- a/tests/resources/generator/dependent_eqns/model.c +++ b/tests/resources/generator/dependent_eqns/model.c @@ -65,7 +65,7 @@ void computeRates(double voi, double *states, double *rates, double *constants, rates[0] = 1.0; } -void computeVariables(double voi, double *states, double *rates, double *variables) +void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { variables[1] = 2.0*voi; variables[0] = 3.0*variables[1]; diff --git a/tests/resources/generator/dependent_eqns/model.h b/tests/resources/generator/dependent_eqns/model.h index 529dbd03f9..ebcf19ae6b 100644 --- a/tests/resources/generator/dependent_eqns/model.h +++ b/tests/resources/generator/dependent_eqns/model.h @@ -38,4 +38,4 @@ void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *constants); void computeComputedConstants(double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); -void computeVariables(double voi, double *states, double *rates, double *variables); +void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/dependent_eqns/model.py b/tests/resources/generator/dependent_eqns/model.py index a48ff4587f..f8022992a5 100644 --- a/tests/resources/generator/dependent_eqns/model.py +++ b/tests/resources/generator/dependent_eqns/model.py @@ -53,6 +53,6 @@ def compute_rates(voi, states, rates, constants, computedConstants, algebraic): rates[0] = 1.0 -def compute_variables(voi, states, rates, variables): +def compute_variables(voi, states, rates, constants, computedConstants, algebraic): variables[1] = 2.0*voi variables[0] = 3.0*variables[1] diff --git a/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.c b/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.c index 488858b664..b9184e3929 100644 --- a/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.c +++ b/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.c @@ -588,7 +588,7 @@ void computeRates(double voi, double *states, double *rates, double *constants, rates[32] = (variables[215]-states[32])/variables[216]; } -void computeVariables(double voi, double *states, double *rates, double *variables) +void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { variables[5] = states[1]; variables[2] = variables[3]*log(variables[4]/variables[5]); diff --git a/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.h b/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.h index c0a9edbfff..812d0c653d 100644 --- a/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.h +++ b/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.h @@ -38,4 +38,4 @@ void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *constants); void computeComputedConstants(double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); -void computeVariables(double voi, double *states, double *rates, double *variables); +void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.py b/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.py index 9306dbef62..6544494254 100644 --- a/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.py +++ b/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.py @@ -595,7 +595,7 @@ def compute_rates(voi, states, rates, constants, computedConstants, algebraic): rates[32] = (variables[215]-states[32])/variables[216] -def compute_variables(voi, states, rates, variables): +def compute_variables(voi, states, rates, constants, computedConstants, algebraic): variables[5] = states[1] variables[2] = variables[3]*log(variables[4]/variables[5]) variables[9] = 0.5*variables[3]*log(variables[10]/states[0]) diff --git a/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.c b/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.c index 67fc7303c3..27fc1673af 100644 --- a/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.c +++ b/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.c @@ -475,7 +475,7 @@ void computeRates(double voi, double *states, double *rates, double *constants, rates[14] = variables[183]*(1.0-states[14])-variables[184]*states[14]; } -void computeVariables(double voi, double *states, double *rates, double *variables) +void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { variables[13] = variables[25]*(states[0]-variables[32]); variables[11] = variables[33]*(states[0]-variables[40]); diff --git a/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.h b/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.h index c574f5af09..d709dca8d5 100644 --- a/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.h +++ b/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.h @@ -38,4 +38,4 @@ void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *constants); void computeComputedConstants(double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); -void computeVariables(double voi, double *states, double *rates, double *variables); +void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.py b/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.py index 73447539dd..180b55d8bb 100644 --- a/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.py +++ b/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.py @@ -470,7 +470,7 @@ def compute_rates(voi, states, rates, constants, computedConstants, algebraic): rates[14] = variables[183]*(1.0-states[14])-variables[184]*states[14] -def compute_variables(voi, states, rates, variables): +def compute_variables(voi, states, rates, constants, computedConstants, algebraic): variables[13] = variables[25]*(states[0]-variables[32]) variables[11] = variables[33]*(states[0]-variables[40]) variables[12] = variables[41]*(states[0]-variables[48]) diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.c index 76221f43ec..c6af41ab99 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.c @@ -109,7 +109,7 @@ void computeRates(double voi, double *states, double *rates, double *constants, rates[3] = variables[16]*(1.0-states[3])-variables[17]*states[3]; } -void computeVariables(double voi, double *states, double *rates, double *variables, ExternalVariable externalVariable) +void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) { variables[0] = externalVariable(voi, states, rates, variables, 0); variables[1] = variables[7]*(states[0]-variables[6]); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.h index b85f55026a..d621ba0e69 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.h +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.h @@ -41,4 +41,4 @@ typedef double (* ExternalVariable)(double voi, double *states, double *rates, d void initialiseVariables(double voi, double *states, double *rates, double *constants, ExternalVariable externalVariable); void computeComputedConstants(double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); -void computeVariables(double voi, double *states, double *rates, double *variables, ExternalVariable externalVariable); +void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.py index ec1244d2ff..f8a6f44c99 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.py @@ -109,7 +109,7 @@ def compute_rates(voi, states, rates, constants, computedConstants, algebraic, e rates[3] = variables[16]*(1.0-states[3])-variables[17]*states[3] -def compute_variables(voi, states, rates, variables, external_variable): +def compute_variables(voi, states, rates, constants, computedConstants, algebraic, external_variable): variables[0] = external_variable(voi, states, rates, variables, 0) variables[1] = variables[7]*(states[0]-variables[6]) variables[3] = variables[9]*pow(states[2], 3.0)*states[1]*(states[0]-variables[8]) diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.c index bfc76d2c87..df2a57cad8 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.c @@ -108,7 +108,7 @@ void computeRates(double voi, double *states, double *rates, double *constants, rates[3] = variables[16]*(1.0-states[3])-variables[17]*states[3]; } -void computeVariables(double voi, double *states, double *rates, double *variables) +void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { variables[1] = variables[7]*(states[0]-variables[6]); variables[3] = variables[9]*pow(states[2], 3.0)*states[1]*(states[0]-variables[8]); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.c index 22550c76d5..cb64823725 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.c @@ -109,7 +109,7 @@ void computeRates(double voi, double *states, double *rates, double *constants, rates[3] = variables[16]*(1.0-states[3])-variables[17]*states[3]; } -void computeVariables(double voi, double *states, double *rates, double *variables, ExternalVariable externalVariable) +void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) { variables[6] = externalVariable(voi, states, rates, variables, 6); variables[1] = variables[7]*(states[0]-variables[6]); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.h index b85f55026a..d621ba0e69 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.h +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.h @@ -41,4 +41,4 @@ typedef double (* ExternalVariable)(double voi, double *states, double *rates, d void initialiseVariables(double voi, double *states, double *rates, double *constants, ExternalVariable externalVariable); void computeComputedConstants(double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); -void computeVariables(double voi, double *states, double *rates, double *variables, ExternalVariable externalVariable); +void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.py index 31eb6b9db1..03186b1653 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.py @@ -109,7 +109,7 @@ def compute_rates(voi, states, rates, constants, computedConstants, algebraic, e rates[3] = variables[16]*(1.0-states[3])-variables[17]*states[3] -def compute_variables(voi, states, rates, variables, external_variable): +def compute_variables(voi, states, rates, constants, computedConstants, algebraic, external_variable): variables[6] = external_variable(voi, states, rates, variables, 6) variables[1] = variables[7]*(states[0]-variables[6]) variables[3] = variables[9]*pow(states[2], 3.0)*states[1]*(states[0]-variables[8]) diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.c index 2ec875f7c5..b87f3589f1 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.c @@ -109,7 +109,7 @@ void computeRates(double voi, double *states, double *rates, double *constants, rates[3] = variables[16]*(1.0-states[3])-variables[17]*states[3]; } -void computeVariables(double voi, double *states, double *rates, double *variables, ExternalVariable externalVariable) +void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) { variables[1] = variables[7]*(states[0]-variables[6]); variables[3] = variables[9]*pow(states[2], 3.0)*states[1]*(states[0]-variables[8]); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.h index b85f55026a..d621ba0e69 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.h +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.h @@ -41,4 +41,4 @@ typedef double (* ExternalVariable)(double voi, double *states, double *rates, d void initialiseVariables(double voi, double *states, double *rates, double *constants, ExternalVariable externalVariable); void computeComputedConstants(double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); -void computeVariables(double voi, double *states, double *rates, double *variables, ExternalVariable externalVariable); +void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.py index 6db074dda9..47b39189c8 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.py @@ -109,7 +109,7 @@ def compute_rates(voi, states, rates, constants, computedConstants, algebraic, e rates[3] = variables[16]*(1.0-states[3])-variables[17]*states[3] -def compute_variables(voi, states, rates, variables, external_variable): +def compute_variables(voi, states, rates, constants, computedConstants, algebraic, external_variable): variables[1] = variables[7]*(states[0]-variables[6]) variables[3] = variables[9]*pow(states[2], 3.0)*states[1]*(states[0]-variables[8]) variables[10] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0) diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.c index 8b8dee0b34..eec3389de2 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.c @@ -543,7 +543,7 @@ void computeRates(double voi, double *states, double *rates, double *constants, findRoot1(voi, states, rates, variables); } -void computeVariables(double voi, double *states, double *rates, double *variables) +void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { findRoot0(voi, states, rates, variables); findRoot2(voi, states, rates, variables); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.h index ef02301bd4..1090a6d03a 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.h +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.h @@ -38,4 +38,4 @@ void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *constants); void computeComputedConstants(double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); -void computeVariables(double voi, double *states, double *rates, double *variables); +void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.py index 0f940110ae..110c926fb0 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.py @@ -485,7 +485,7 @@ def compute_rates(voi, states, rates, constants, computedConstants, algebraic): find_root_1(voi, states, rates, variables) -def compute_variables(voi, states, rates, variables): +def compute_variables(voi, states, rates, constants, computedConstants, algebraic): find_root_0(voi, states, rates, variables) find_root_2(voi, states, rates, variables) find_root_3(voi, states, rates, variables) diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.c index b50aa4b598..3abf7d45a3 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.c @@ -110,7 +110,7 @@ void computeRates(double voi, double *states, double *rates, double *constants, rates[3] = variables[16]*(1.0-states[3])-variables[17]*states[3]; } -void computeVariables(double voi, double *states, double *rates, double *variables, ExternalVariable externalVariable) +void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) { variables[17] = externalVariable(voi, states, rates, variables, 17); variables[0] = externalVariable(voi, states, rates, variables, 0); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.h index b85f55026a..d621ba0e69 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.h +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.h @@ -41,4 +41,4 @@ typedef double (* ExternalVariable)(double voi, double *states, double *rates, d void initialiseVariables(double voi, double *states, double *rates, double *constants, ExternalVariable externalVariable); void computeComputedConstants(double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); -void computeVariables(double voi, double *states, double *rates, double *variables, ExternalVariable externalVariable); +void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.py index 53d4e89f83..2ca6db1899 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.py @@ -110,7 +110,7 @@ def compute_rates(voi, states, rates, constants, computedConstants, algebraic, e rates[3] = variables[16]*(1.0-states[3])-variables[17]*states[3] -def compute_variables(voi, states, rates, variables, external_variable): +def compute_variables(voi, states, rates, constants, computedConstants, algebraic, external_variable): variables[17] = external_variable(voi, states, rates, variables, 17) variables[0] = external_variable(voi, states, rates, variables, 0) variables[1] = variables[7]*(states[0]-variables[6]) diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.c index 89553d7e39..13087c293d 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.c @@ -110,7 +110,7 @@ void computeRates(double voi, double *states, double *rates, double *constants, rates[3] = variables[16]*(1.0-states[3])-variables[17]*states[3]; } -void computeVariables(double voi, double *states, double *rates, double *variables, ExternalVariable externalVariable) +void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) { variables[14] = externalVariable(voi, states, rates, variables, 14); variables[5] = externalVariable(voi, states, rates, variables, 5); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.h index b85f55026a..d621ba0e69 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.h +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.h @@ -41,4 +41,4 @@ typedef double (* ExternalVariable)(double voi, double *states, double *rates, d void initialiseVariables(double voi, double *states, double *rates, double *constants, ExternalVariable externalVariable); void computeComputedConstants(double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); -void computeVariables(double voi, double *states, double *rates, double *variables, ExternalVariable externalVariable); +void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.py index 6b5f48f3a2..2b2d655ac8 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.py @@ -111,7 +111,7 @@ def compute_rates(voi, states, rates, constants, computedConstants, algebraic, e rates[3] = variables[16]*(1.0-states[3])-variables[17]*states[3] -def compute_variables(voi, states, rates, variables, external_variable): +def compute_variables(voi, states, rates, constants, computedConstants, algebraic, external_variable): variables[14] = external_variable(voi, states, rates, variables, 14) variables[5] = external_variable(voi, states, rates, variables, 5) variables[6] = variables[5]-10.613 diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.c index 9577016c10..93afb3d88e 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.c @@ -110,7 +110,7 @@ void computeRates(double voi, double *states, double *rates, double *constants, rates[3] = variables[16]*(1.0-states[3])-variables[17]*states[3]; } -void computeVariables(double voi, double *states, double *rates, double *variables, ExternalVariable externalVariable) +void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) { variables[1] = variables[7]*(states[0]-variables[6]); variables[9] = externalVariable(voi, states, rates, variables, 9); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.h index b85f55026a..d621ba0e69 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.h +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.h @@ -41,4 +41,4 @@ typedef double (* ExternalVariable)(double voi, double *states, double *rates, d void initialiseVariables(double voi, double *states, double *rates, double *constants, ExternalVariable externalVariable); void computeComputedConstants(double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); -void computeVariables(double voi, double *states, double *rates, double *variables, ExternalVariable externalVariable); +void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.py index 316463d2bd..c47a5f3ed0 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.py @@ -110,7 +110,7 @@ def compute_rates(voi, states, rates, constants, computedConstants, algebraic, e rates[3] = variables[16]*(1.0-states[3])-variables[17]*states[3] -def compute_variables(voi, states, rates, variables, external_variable): +def compute_variables(voi, states, rates, constants, computedConstants, algebraic, external_variable): variables[1] = variables[7]*(states[0]-variables[6]) variables[9] = external_variable(voi, states, rates, variables, 9) variables[3] = variables[9]*pow(states[2], 3.0)*states[1]*(states[0]-variables[8]) diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.c index 84f5c32d23..47ff51ec85 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.c @@ -101,7 +101,7 @@ void computeRates(double voi, double *states, double *rates, double *constants, rates[1] = variables[18]*(1.0-states[1])-variables[19]*states[1]; } -void computeVariables(double voi, double *states, double *rates, double *variables, ExternalVariable externalVariable) +void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) { variables[0] = ((voi >= 10.0) && (voi <= 10.5))?-20.0:0.0; variables[1] = externalVariable(voi, states, rates, variables, 1); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.h index b85f55026a..d621ba0e69 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.h +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.h @@ -41,4 +41,4 @@ typedef double (* ExternalVariable)(double voi, double *states, double *rates, d void initialiseVariables(double voi, double *states, double *rates, double *constants, ExternalVariable externalVariable); void computeComputedConstants(double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); -void computeVariables(double voi, double *states, double *rates, double *variables, ExternalVariable externalVariable); +void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.py index 0b81796406..72b212b898 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.py @@ -101,7 +101,7 @@ def compute_rates(voi, states, rates, constants, computedConstants, algebraic, e rates[1] = variables[18]*(1.0-states[1])-variables[19]*states[1] -def compute_variables(voi, states, rates, variables, external_variable): +def compute_variables(voi, states, rates, constants, computedConstants, algebraic, external_variable): variables[0] = -20.0 if and_func(geq_func(voi, 10.0), leq_func(voi, 10.5)) else 0.0 variables[1] = external_variable(voi, states, rates, variables, 1) variables[2] = variables[8]*(variables[1]-variables[7]) diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.c index e5a954f659..f936897d54 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.c @@ -106,7 +106,7 @@ void computeRates(double voi, double *states, double *rates, double *constants, rates[2] = variables[17]*(1.0-states[2])-variables[18]*states[2]; } -void computeVariables(double voi, double *states, double *rates, double *variables, ExternalVariable externalVariable) +void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) { variables[0] = ((voi >= 10.0) && (voi <= 10.5))?-20.0:0.0; variables[1] = externalVariable(voi, states, rates, variables, 1); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.h index b85f55026a..d621ba0e69 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.h +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.h @@ -41,4 +41,4 @@ typedef double (* ExternalVariable)(double voi, double *states, double *rates, d void initialiseVariables(double voi, double *states, double *rates, double *constants, ExternalVariable externalVariable); void computeComputedConstants(double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); -void computeVariables(double voi, double *states, double *rates, double *variables, ExternalVariable externalVariable); +void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.py index 80610b753b..6b77efdbc9 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.py @@ -106,7 +106,7 @@ def compute_rates(voi, states, rates, constants, computedConstants, algebraic, e rates[2] = variables[17]*(1.0-states[2])-variables[18]*states[2] -def compute_variables(voi, states, rates, variables, external_variable): +def compute_variables(voi, states, rates, constants, computedConstants, algebraic, external_variable): variables[0] = -20.0 if and_func(geq_func(voi, 10.0), leq_func(voi, 10.5)) else 0.0 variables[1] = external_variable(voi, states, rates, variables, 1) variables[2] = variables[8]*(variables[1]-variables[7]) diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.h index ef02301bd4..1090a6d03a 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.h +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.h @@ -38,4 +38,4 @@ void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *constants); void computeComputedConstants(double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); -void computeVariables(double voi, double *states, double *rates, double *variables); +void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.py index ef8e528bf8..6c0ce45df5 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.py @@ -107,7 +107,7 @@ def compute_rates(voi, states, rates, constants, computedConstants, algebraic): rates[3] = variables[16]*(1.0-states[3])-variables[17]*states[3] -def compute_variables(voi, states, rates, variables): +def compute_variables(voi, states, rates, constants, computedConstants, algebraic): variables[1] = variables[7]*(states[0]-variables[6]) variables[3] = variables[9]*pow(states[2], 3.0)*states[1]*(states[0]-variables[8]) variables[10] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0) diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.c index 27a4df3133..ed301760a5 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.c @@ -106,7 +106,7 @@ void computeRates(double voi, double *states, double *rates, double *constants, rates[2] = variables[17]*(1.0-states[2])-variables[18]*states[2]; } -void computeVariables(double voi, double *states, double *rates, double *variables, ExternalVariable externalVariable) +void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) { variables[1] = variables[7]*(states[0]-variables[6]); variables[10] = externalVariable(voi, states, rates, variables, 10); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.h index b85f55026a..d621ba0e69 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.h +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.h @@ -41,4 +41,4 @@ typedef double (* ExternalVariable)(double voi, double *states, double *rates, d void initialiseVariables(double voi, double *states, double *rates, double *constants, ExternalVariable externalVariable); void computeComputedConstants(double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); -void computeVariables(double voi, double *states, double *rates, double *variables, ExternalVariable externalVariable); +void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.py index fbbf624262..e110f1e761 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.py @@ -106,7 +106,7 @@ def compute_rates(voi, states, rates, constants, computedConstants, algebraic, e rates[2] = variables[17]*(1.0-states[2])-variables[18]*states[2] -def compute_variables(voi, states, rates, variables, external_variable): +def compute_variables(voi, states, rates, constants, computedConstants, algebraic, external_variable): variables[1] = variables[7]*(states[0]-variables[6]) variables[10] = external_variable(voi, states, rates, variables, 10) variables[3] = variables[9]*pow(variables[10], 3.0)*states[1]*(states[0]-variables[8]) diff --git a/tests/resources/generator/noble_model_1962/model.c b/tests/resources/generator/noble_model_1962/model.c index 2811d042ff..1029459d28 100644 --- a/tests/resources/generator/noble_model_1962/model.c +++ b/tests/resources/generator/noble_model_1962/model.c @@ -106,7 +106,7 @@ void computeRates(double voi, double *states, double *rates, double *constants, rates[3] = variables[15]*(1.0-states[3])-variables[16]*states[3]; } -void computeVariables(double voi, double *states, double *rates, double *variables) +void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { variables[1] = variables[4]*(states[0]-variables[5]); variables[6] = pow(states[1], 3.0)*states[2]*variables[7]; diff --git a/tests/resources/generator/noble_model_1962/model.h b/tests/resources/generator/noble_model_1962/model.h index d6958fd5dc..10555c8038 100644 --- a/tests/resources/generator/noble_model_1962/model.h +++ b/tests/resources/generator/noble_model_1962/model.h @@ -38,4 +38,4 @@ void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *constants); void computeComputedConstants(double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); -void computeVariables(double voi, double *states, double *rates, double *variables); +void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/noble_model_1962/model.py b/tests/resources/generator/noble_model_1962/model.py index 36858282f8..1d18b097ac 100644 --- a/tests/resources/generator/noble_model_1962/model.py +++ b/tests/resources/generator/noble_model_1962/model.py @@ -94,7 +94,7 @@ def compute_rates(voi, states, rates, constants, computedConstants, algebraic): rates[3] = variables[15]*(1.0-states[3])-variables[16]*states[3] -def compute_variables(voi, states, rates, variables): +def compute_variables(voi, states, rates, constants, computedConstants, algebraic): variables[1] = variables[4]*(states[0]-variables[5]) variables[6] = pow(states[1], 3.0)*states[2]*variables[7] variables[0] = (variables[6]+0.14)*(states[0]-variables[8]) diff --git a/tests/resources/generator/ode_computed_var_on_rhs/model.c b/tests/resources/generator/ode_computed_var_on_rhs/model.c index f6c4d954c2..621132fc1e 100644 --- a/tests/resources/generator/ode_computed_var_on_rhs/model.c +++ b/tests/resources/generator/ode_computed_var_on_rhs/model.c @@ -65,6 +65,6 @@ void computeRates(double voi, double *states, double *rates, double *constants, rates[0] = variables[0]; } -void computeVariables(double voi, double *states, double *rates, double *variables) +void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { } diff --git a/tests/resources/generator/ode_computed_var_on_rhs/model.h b/tests/resources/generator/ode_computed_var_on_rhs/model.h index 0bccaf5c81..a4444473cb 100644 --- a/tests/resources/generator/ode_computed_var_on_rhs/model.h +++ b/tests/resources/generator/ode_computed_var_on_rhs/model.h @@ -38,4 +38,4 @@ void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *constants); void computeComputedConstants(double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); -void computeVariables(double voi, double *states, double *rates, double *variables); +void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/ode_computed_var_on_rhs/model.py b/tests/resources/generator/ode_computed_var_on_rhs/model.py index b3ac9c62f7..906bdb3f80 100644 --- a/tests/resources/generator/ode_computed_var_on_rhs/model.py +++ b/tests/resources/generator/ode_computed_var_on_rhs/model.py @@ -53,5 +53,5 @@ def compute_rates(voi, states, rates, constants, computedConstants, algebraic): rates[0] = variables[0] -def compute_variables(voi, states, rates, variables): +def compute_variables(voi, states, rates, constants, computedConstants, algebraic): pass diff --git a/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.c b/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.c index 7f30100d5f..48b06bdb45 100644 --- a/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.c +++ b/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.c @@ -65,6 +65,6 @@ void computeRates(double voi, double *states, double *rates, double *constants, rates[0] = variables[0]; } -void computeVariables(double voi, double *states, double *rates, double *variables) +void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { } diff --git a/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.h b/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.h index 7f86bfafdd..94a64dfa85 100644 --- a/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.h +++ b/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.h @@ -38,4 +38,4 @@ void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *constants); void computeComputedConstants(double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); -void computeVariables(double voi, double *states, double *rates, double *variables); +void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.py b/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.py index 2dc19f3935..1ddea11e38 100644 --- a/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.py +++ b/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.py @@ -53,5 +53,5 @@ def compute_rates(voi, states, rates, constants, computedConstants, algebraic): rates[0] = variables[0] -def compute_variables(voi, states, rates, variables): +def compute_variables(voi, states, rates, constants, computedConstants, algebraic): pass diff --git a/tests/resources/generator/ode_const_var_on_rhs/model.c b/tests/resources/generator/ode_const_var_on_rhs/model.c index d630e604ab..8f42444b87 100644 --- a/tests/resources/generator/ode_const_var_on_rhs/model.c +++ b/tests/resources/generator/ode_const_var_on_rhs/model.c @@ -65,6 +65,6 @@ void computeRates(double voi, double *states, double *rates, double *constants, rates[0] = variables[0]; } -void computeVariables(double voi, double *states, double *rates, double *variables) +void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { } diff --git a/tests/resources/generator/ode_const_var_on_rhs/model.h b/tests/resources/generator/ode_const_var_on_rhs/model.h index 0bccaf5c81..a4444473cb 100644 --- a/tests/resources/generator/ode_const_var_on_rhs/model.h +++ b/tests/resources/generator/ode_const_var_on_rhs/model.h @@ -38,4 +38,4 @@ void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *constants); void computeComputedConstants(double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); -void computeVariables(double voi, double *states, double *rates, double *variables); +void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/ode_const_var_on_rhs/model.py b/tests/resources/generator/ode_const_var_on_rhs/model.py index ae0d7b060e..2d88bb4b27 100644 --- a/tests/resources/generator/ode_const_var_on_rhs/model.py +++ b/tests/resources/generator/ode_const_var_on_rhs/model.py @@ -53,5 +53,5 @@ def compute_rates(voi, states, rates, constants, computedConstants, algebraic): rates[0] = variables[0] -def compute_variables(voi, states, rates, variables): +def compute_variables(voi, states, rates, constants, computedConstants, algebraic): pass diff --git a/tests/resources/generator/ode_const_var_on_rhs_one_component/model.c b/tests/resources/generator/ode_const_var_on_rhs_one_component/model.c index ddb0e28f9a..7a5d402071 100644 --- a/tests/resources/generator/ode_const_var_on_rhs_one_component/model.c +++ b/tests/resources/generator/ode_const_var_on_rhs_one_component/model.c @@ -65,6 +65,6 @@ void computeRates(double voi, double *states, double *rates, double *constants, rates[0] = variables[0]; } -void computeVariables(double voi, double *states, double *rates, double *variables) +void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { } diff --git a/tests/resources/generator/ode_const_var_on_rhs_one_component/model.h b/tests/resources/generator/ode_const_var_on_rhs_one_component/model.h index 7f86bfafdd..94a64dfa85 100644 --- a/tests/resources/generator/ode_const_var_on_rhs_one_component/model.h +++ b/tests/resources/generator/ode_const_var_on_rhs_one_component/model.h @@ -38,4 +38,4 @@ void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *constants); void computeComputedConstants(double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); -void computeVariables(double voi, double *states, double *rates, double *variables); +void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/ode_const_var_on_rhs_one_component/model.py b/tests/resources/generator/ode_const_var_on_rhs_one_component/model.py index ad34a0c19e..78fbcf40b9 100644 --- a/tests/resources/generator/ode_const_var_on_rhs_one_component/model.py +++ b/tests/resources/generator/ode_const_var_on_rhs_one_component/model.py @@ -53,5 +53,5 @@ def compute_rates(voi, states, rates, constants, computedConstants, algebraic): rates[0] = variables[0] -def compute_variables(voi, states, rates, variables): +def compute_variables(voi, states, rates, constants, computedConstants, algebraic): pass diff --git a/tests/resources/generator/ode_constant_on_rhs/model.c b/tests/resources/generator/ode_constant_on_rhs/model.c index cc6439e9b2..a6d0ec5dc6 100644 --- a/tests/resources/generator/ode_constant_on_rhs/model.c +++ b/tests/resources/generator/ode_constant_on_rhs/model.c @@ -63,6 +63,6 @@ void computeRates(double voi, double *states, double *rates, double *constants, rates[0] = 1.0; } -void computeVariables(double voi, double *states, double *rates, double *variables) +void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { } diff --git a/tests/resources/generator/ode_constant_on_rhs/model.h b/tests/resources/generator/ode_constant_on_rhs/model.h index 0bccaf5c81..a4444473cb 100644 --- a/tests/resources/generator/ode_constant_on_rhs/model.h +++ b/tests/resources/generator/ode_constant_on_rhs/model.h @@ -38,4 +38,4 @@ void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *constants); void computeComputedConstants(double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); -void computeVariables(double voi, double *states, double *rates, double *variables); +void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/ode_constant_on_rhs/model.py b/tests/resources/generator/ode_constant_on_rhs/model.py index 58f3ce266a..206392ff3a 100644 --- a/tests/resources/generator/ode_constant_on_rhs/model.py +++ b/tests/resources/generator/ode_constant_on_rhs/model.py @@ -51,5 +51,5 @@ def compute_rates(voi, states, rates, constants, computedConstants, algebraic): rates[0] = 1.0 -def compute_variables(voi, states, rates, variables): +def compute_variables(voi, states, rates, constants, computedConstants, algebraic): pass diff --git a/tests/resources/generator/ode_constant_on_rhs_one_component/model.c b/tests/resources/generator/ode_constant_on_rhs_one_component/model.c index 3cfebdce48..2c479d28d8 100644 --- a/tests/resources/generator/ode_constant_on_rhs_one_component/model.c +++ b/tests/resources/generator/ode_constant_on_rhs_one_component/model.c @@ -63,6 +63,6 @@ void computeRates(double voi, double *states, double *rates, double *constants, rates[0] = 1.0; } -void computeVariables(double voi, double *states, double *rates, double *variables) +void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { } diff --git a/tests/resources/generator/ode_constant_on_rhs_one_component/model.h b/tests/resources/generator/ode_constant_on_rhs_one_component/model.h index 7f86bfafdd..94a64dfa85 100644 --- a/tests/resources/generator/ode_constant_on_rhs_one_component/model.h +++ b/tests/resources/generator/ode_constant_on_rhs_one_component/model.h @@ -38,4 +38,4 @@ void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *constants); void computeComputedConstants(double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); -void computeVariables(double voi, double *states, double *rates, double *variables); +void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/ode_constant_on_rhs_one_component/model.py b/tests/resources/generator/ode_constant_on_rhs_one_component/model.py index 0a9a86dba8..ee87c9c26d 100644 --- a/tests/resources/generator/ode_constant_on_rhs_one_component/model.py +++ b/tests/resources/generator/ode_constant_on_rhs_one_component/model.py @@ -51,5 +51,5 @@ def compute_rates(voi, states, rates, constants, computedConstants, algebraic): rates[0] = 1.0 -def compute_variables(voi, states, rates, variables): +def compute_variables(voi, states, rates, constants, computedConstants, algebraic): pass diff --git a/tests/resources/generator/ode_multiple_dependent_odes/model.c b/tests/resources/generator/ode_multiple_dependent_odes/model.c index eb5bd6f89d..5a14fd1ca8 100644 --- a/tests/resources/generator/ode_multiple_dependent_odes/model.c +++ b/tests/resources/generator/ode_multiple_dependent_odes/model.c @@ -68,6 +68,6 @@ void computeRates(double voi, double *states, double *rates, double *constants, rates[1] = (variables[0]*(1.0-pow(states[0], 2.0))*states[1]-states[0])*1.0; } -void computeVariables(double voi, double *states, double *rates, double *variables) +void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { } diff --git a/tests/resources/generator/ode_multiple_dependent_odes/model.h b/tests/resources/generator/ode_multiple_dependent_odes/model.h index 72fe9729b1..1653e2e605 100644 --- a/tests/resources/generator/ode_multiple_dependent_odes/model.h +++ b/tests/resources/generator/ode_multiple_dependent_odes/model.h @@ -38,4 +38,4 @@ void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *constants); void computeComputedConstants(double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); -void computeVariables(double voi, double *states, double *rates, double *variables); +void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/ode_multiple_dependent_odes/model.py b/tests/resources/generator/ode_multiple_dependent_odes/model.py index 9b6c3efa33..6e3ba6e67a 100644 --- a/tests/resources/generator/ode_multiple_dependent_odes/model.py +++ b/tests/resources/generator/ode_multiple_dependent_odes/model.py @@ -56,5 +56,5 @@ def compute_rates(voi, states, rates, constants, computedConstants, algebraic): rates[1] = (variables[0]*(1.0-pow(states[0], 2.0))*states[1]-states[0])*1.0 -def compute_variables(voi, states, rates, variables): +def compute_variables(voi, states, rates, constants, computedConstants, algebraic): pass diff --git a/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.c b/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.c index aab636ab1f..1aedd5274d 100644 --- a/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.c +++ b/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.c @@ -68,6 +68,6 @@ void computeRates(double voi, double *states, double *rates, double *constants, rates[1] = (variables[0]*(1.0-pow(states[0], 2.0))*states[1]-states[0])*1.0; } -void computeVariables(double voi, double *states, double *rates, double *variables) +void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { } diff --git a/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.h b/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.h index 2751faf2a6..b26a181c2e 100644 --- a/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.h +++ b/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.h @@ -38,4 +38,4 @@ void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *constants); void computeComputedConstants(double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); -void computeVariables(double voi, double *states, double *rates, double *variables); +void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.py b/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.py index 566c040fff..9f48dedb90 100644 --- a/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.py +++ b/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.py @@ -56,5 +56,5 @@ def compute_rates(voi, states, rates, constants, computedConstants, algebraic): rates[1] = (variables[0]*(1.0-pow(states[0], 2.0))*states[1]-states[0])*1.0 -def compute_variables(voi, states, rates, variables): +def compute_variables(voi, states, rates, constants, computedConstants, algebraic): pass diff --git a/tests/resources/generator/ode_multiple_odes_with_same_name/model.c b/tests/resources/generator/ode_multiple_odes_with_same_name/model.c index a372b5ab9b..0ecc275fcc 100644 --- a/tests/resources/generator/ode_multiple_odes_with_same_name/model.c +++ b/tests/resources/generator/ode_multiple_odes_with_same_name/model.c @@ -68,6 +68,6 @@ void computeRates(double voi, double *states, double *rates, double *constants, rates[1] = variables[0]; } -void computeVariables(double voi, double *states, double *rates, double *variables) +void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { } diff --git a/tests/resources/generator/ode_multiple_odes_with_same_name/model.h b/tests/resources/generator/ode_multiple_odes_with_same_name/model.h index d0b018b6f7..9ef0b6b75e 100644 --- a/tests/resources/generator/ode_multiple_odes_with_same_name/model.h +++ b/tests/resources/generator/ode_multiple_odes_with_same_name/model.h @@ -38,4 +38,4 @@ void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *constants); void computeComputedConstants(double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); -void computeVariables(double voi, double *states, double *rates, double *variables); +void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/ode_multiple_odes_with_same_name/model.py b/tests/resources/generator/ode_multiple_odes_with_same_name/model.py index c57a7c0204..3b68bcdfda 100644 --- a/tests/resources/generator/ode_multiple_odes_with_same_name/model.py +++ b/tests/resources/generator/ode_multiple_odes_with_same_name/model.py @@ -56,5 +56,5 @@ def compute_rates(voi, states, rates, constants, computedConstants, algebraic): rates[1] = variables[0] -def compute_variables(voi, states, rates, variables): +def compute_variables(voi, states, rates, constants, computedConstants, algebraic): pass diff --git a/tests/resources/generator/ode_unknown_var_on_rhs/model.c b/tests/resources/generator/ode_unknown_var_on_rhs/model.c index dc292a96cf..90dde15f73 100644 --- a/tests/resources/generator/ode_unknown_var_on_rhs/model.c +++ b/tests/resources/generator/ode_unknown_var_on_rhs/model.c @@ -66,6 +66,6 @@ void computeRates(double voi, double *states, double *rates, double *constants, rates[1] = states[0]; } -void computeVariables(double voi, double *states, double *rates, double *variables) +void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { } diff --git a/tests/resources/generator/ode_unknown_var_on_rhs/model.h b/tests/resources/generator/ode_unknown_var_on_rhs/model.h index 0bccaf5c81..a4444473cb 100644 --- a/tests/resources/generator/ode_unknown_var_on_rhs/model.h +++ b/tests/resources/generator/ode_unknown_var_on_rhs/model.h @@ -38,4 +38,4 @@ void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *constants); void computeComputedConstants(double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); -void computeVariables(double voi, double *states, double *rates, double *variables); +void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/ode_unknown_var_on_rhs/model.py b/tests/resources/generator/ode_unknown_var_on_rhs/model.py index 24271e0b3c..aaaa0e9474 100644 --- a/tests/resources/generator/ode_unknown_var_on_rhs/model.py +++ b/tests/resources/generator/ode_unknown_var_on_rhs/model.py @@ -54,5 +54,5 @@ def compute_rates(voi, states, rates, constants, computedConstants, algebraic): rates[1] = states[0] -def compute_variables(voi, states, rates, variables): +def compute_variables(voi, states, rates, constants, computedConstants, algebraic): pass diff --git a/tests/resources/generator/robertson_model_1966/model.dae.c b/tests/resources/generator/robertson_model_1966/model.dae.c index ff9bd2d422..d0edf14b0f 100644 --- a/tests/resources/generator/robertson_model_1966/model.dae.c +++ b/tests/resources/generator/robertson_model_1966/model.dae.c @@ -110,7 +110,7 @@ void computeRates(double voi, double *states, double *rates, double *constants, rates[1] = variables[0]*states[0]-variables[3]*pow(states[1], 2.0)-variables[1]*states[1]*variables[2]; } -void computeVariables(double voi, double *states, double *rates, double *variables) +void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { findRoot0(voi, states, rates, variables); variables[4] = 10000.0*states[1]; diff --git a/tests/resources/generator/robertson_model_1966/model.dae.h b/tests/resources/generator/robertson_model_1966/model.dae.h index 4b40d5fc50..9e43acde31 100644 --- a/tests/resources/generator/robertson_model_1966/model.dae.h +++ b/tests/resources/generator/robertson_model_1966/model.dae.h @@ -38,4 +38,4 @@ void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *constants); void computeComputedConstants(double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); -void computeVariables(double voi, double *states, double *rates, double *variables); +void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/robertson_model_1966/model.dae.py b/tests/resources/generator/robertson_model_1966/model.dae.py index d325fee609..147a5f9f15 100644 --- a/tests/resources/generator/robertson_model_1966/model.dae.py +++ b/tests/resources/generator/robertson_model_1966/model.dae.py @@ -88,6 +88,6 @@ def compute_rates(voi, states, rates, constants, computedConstants, algebraic): rates[1] = variables[0]*states[0]-variables[3]*pow(states[1], 2.0)-variables[1]*states[1]*variables[2] -def compute_variables(voi, states, rates, variables): +def compute_variables(voi, states, rates, constants, computedConstants, algebraic): find_root_0(voi, states, rates, variables) variables[4] = 10000.0*states[1] diff --git a/tests/resources/generator/robertson_model_1966/model.ode.c b/tests/resources/generator/robertson_model_1966/model.ode.c index cdea395370..8ef049b2ab 100644 --- a/tests/resources/generator/robertson_model_1966/model.ode.c +++ b/tests/resources/generator/robertson_model_1966/model.ode.c @@ -76,7 +76,7 @@ void computeRates(double voi, double *states, double *rates, double *constants, rates[1] = variables[2]*pow(states[2], 2.0); } -void computeVariables(double voi, double *states, double *rates, double *variables) +void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { variables[3] = 10000.0*states[2]; } diff --git a/tests/resources/generator/robertson_model_1966/model.ode.h b/tests/resources/generator/robertson_model_1966/model.ode.h index 4b40d5fc50..9e43acde31 100644 --- a/tests/resources/generator/robertson_model_1966/model.ode.h +++ b/tests/resources/generator/robertson_model_1966/model.ode.h @@ -38,4 +38,4 @@ void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *constants); void computeComputedConstants(double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); -void computeVariables(double voi, double *states, double *rates, double *variables); +void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/robertson_model_1966/model.ode.py b/tests/resources/generator/robertson_model_1966/model.ode.py index 653a16bd6a..16be8a4e3f 100644 --- a/tests/resources/generator/robertson_model_1966/model.ode.py +++ b/tests/resources/generator/robertson_model_1966/model.ode.py @@ -64,5 +64,5 @@ def compute_rates(voi, states, rates, constants, computedConstants, algebraic): rates[1] = variables[2]*pow(states[2], 2.0) -def compute_variables(voi, states, rates, variables): +def compute_variables(voi, states, rates, constants, computedConstants, algebraic): variables[3] = 10000.0*states[2] diff --git a/tests/resources/generator/sine_model_imports/model.c b/tests/resources/generator/sine_model_imports/model.c index cc9ad39390..e81c50d4de 100644 --- a/tests/resources/generator/sine_model_imports/model.c +++ b/tests/resources/generator/sine_model_imports/model.c @@ -80,7 +80,7 @@ void computeRates(double voi, double *states, double *rates, double *constants, rates[0] = cos(voi); } -void computeVariables(double voi, double *states, double *rates, double *variables) +void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { variables[0] = sin(voi); variables[9] = (voi < variables[6])?voi*variables[4]-0.5:(voi < variables[7])?(3.14159265358979-voi)*variables[4]-0.5:(voi < variables[8])?(voi-3.14159265358979)*variables[4]-0.5:(variables[5]-voi)*variables[4]-0.5; diff --git a/tests/resources/generator/sine_model_imports/model.h b/tests/resources/generator/sine_model_imports/model.h index 175f6e2a06..d1e57debea 100644 --- a/tests/resources/generator/sine_model_imports/model.h +++ b/tests/resources/generator/sine_model_imports/model.h @@ -38,4 +38,4 @@ void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *constants); void computeComputedConstants(double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); -void computeVariables(double voi, double *states, double *rates, double *variables); +void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/sine_model_imports/model.py b/tests/resources/generator/sine_model_imports/model.py index 75e2a697fd..d4551dbb90 100644 --- a/tests/resources/generator/sine_model_imports/model.py +++ b/tests/resources/generator/sine_model_imports/model.py @@ -72,7 +72,7 @@ def compute_rates(voi, states, rates, constants, computedConstants, algebraic): rates[0] = cos(voi) -def compute_variables(voi, states, rates, variables): +def compute_variables(voi, states, rates, constants, computedConstants, algebraic): variables[0] = sin(voi) variables[9] = voi*variables[4]-0.5 if lt_func(voi, variables[6]) else (3.14159265358979-voi)*variables[4]-0.5 if lt_func(voi, variables[7]) else (voi-3.14159265358979)*variables[4]-0.5 if lt_func(voi, variables[8]) else (variables[5]-voi)*variables[4]-0.5 variables[2] = -variables[9]*variables[9]+variables[3]+variables[9] if lt_func(voi, variables[6]) else -variables[9]*variables[9]+variables[3]+variables[9] if lt_func(voi, variables[7]) else variables[9]*variables[9]-variables[3]-variables[9] if lt_func(voi, variables[8]) else variables[9]*variables[9]-variables[3]-variables[9] diff --git a/tests/resources/generator/unknown_variable_as_external_variable/model.c b/tests/resources/generator/unknown_variable_as_external_variable/model.c index f8e4ac81c2..b31c101680 100644 --- a/tests/resources/generator/unknown_variable_as_external_variable/model.c +++ b/tests/resources/generator/unknown_variable_as_external_variable/model.c @@ -58,7 +58,7 @@ void computeComputedConstants(double *computedConstants) { } -void computeVariables(double *variables, ExternalVariable externalVariable) +void computeVariables(double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) { variables[9] = externalVariable(variables, 9); variables[0] = variables[1]*(variables[2]*variables[3]-variables[4]*variables[5])/(variables[6]*variables[5]+variables[9]*variables[3]+variables[8]*variables[5]*variables[3]+variables[7]); diff --git a/tests/resources/generator/unknown_variable_as_external_variable/model.h b/tests/resources/generator/unknown_variable_as_external_variable/model.h index d8442ae9e1..34f0b08747 100644 --- a/tests/resources/generator/unknown_variable_as_external_variable/model.h +++ b/tests/resources/generator/unknown_variable_as_external_variable/model.h @@ -34,4 +34,4 @@ typedef double (* ExternalVariable)(double *variables, size_t index); void initialiseVariables(double *constants, ExternalVariable externalVariable); void computeComputedConstants(double *computedConstants); -void computeVariables(double *variables, ExternalVariable externalVariable); +void computeVariables(double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); diff --git a/tests/resources/generator/unknown_variable_as_external_variable/model.py b/tests/resources/generator/unknown_variable_as_external_variable/model.py index 7c13d97e39..b945a76426 100644 --- a/tests/resources/generator/unknown_variable_as_external_variable/model.py +++ b/tests/resources/generator/unknown_variable_as_external_variable/model.py @@ -53,6 +53,6 @@ def compute_computed_constants(computed_constants): pass -def compute_variables(variables, external_variable): +def compute_variables(constants, computedConstants, algebraic, external_variable): variables[9] = external_variable(variables, 9) variables[0] = variables[1]*(variables[2]*variables[3]-variables[4]*variables[5])/(variables[6]*variables[5]+variables[9]*variables[3]+variables[8]*variables[5]*variables[3]+variables[7]) diff --git a/tests/resources/generator/variable_initialised_using_a_constant/model.c b/tests/resources/generator/variable_initialised_using_a_constant/model.c index 0d7a8cae4f..1dc483fffb 100644 --- a/tests/resources/generator/variable_initialised_using_a_constant/model.c +++ b/tests/resources/generator/variable_initialised_using_a_constant/model.c @@ -65,6 +65,6 @@ void computeRates(double voi, double *states, double *rates, double *constants, rates[0] = 3.0; } -void computeVariables(double voi, double *states, double *rates, double *variables) +void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { } diff --git a/tests/resources/generator/variable_initialised_using_a_constant/model.h b/tests/resources/generator/variable_initialised_using_a_constant/model.h index 8e703e9d25..c138b0f363 100644 --- a/tests/resources/generator/variable_initialised_using_a_constant/model.h +++ b/tests/resources/generator/variable_initialised_using_a_constant/model.h @@ -38,4 +38,4 @@ void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *constants); void computeComputedConstants(double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); -void computeVariables(double voi, double *states, double *rates, double *variables); +void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/variable_initialised_using_a_constant/model.py b/tests/resources/generator/variable_initialised_using_a_constant/model.py index bbaccf6f6a..3982c84aad 100644 --- a/tests/resources/generator/variable_initialised_using_a_constant/model.py +++ b/tests/resources/generator/variable_initialised_using_a_constant/model.py @@ -53,5 +53,5 @@ def compute_rates(voi, states, rates, constants, computedConstants, algebraic): rates[0] = 3.0 -def compute_variables(voi, states, rates, variables): +def compute_variables(voi, states, rates, constants, computedConstants, algebraic): pass From 8488c494627fafaaf67e94f3c450741f0b932d5a Mon Sep 17 00:00:00 2001 From: Alan Garny Date: Wed, 7 Aug 2024 17:04:21 +0200 Subject: [PATCH 06/85] Generator: use different arrays for constants, computed constants, and algebraic variables for computeComputedConstants(). --- src/generatorprofile.cpp | 6 +++--- src/generatorprofilesha1values.h | 4 ++-- tests/bindings/python/test_generator_profile.py | 4 ++-- tests/generator/generatorprofile.cpp | 4 ++-- tests/resources/coverage/generator/model.c | 2 +- tests/resources/coverage/generator/model.h | 2 +- tests/resources/coverage/generator/model.implementation.out | 2 +- tests/resources/coverage/generator/model.interface.out | 2 +- tests/resources/coverage/generator/model.modified.profile.c | 2 +- tests/resources/coverage/generator/model.modified.profile.h | 2 +- .../resources/coverage/generator/model.modified.profile.py | 2 +- tests/resources/coverage/generator/model.out | 2 +- tests/resources/coverage/generator/model.py | 2 +- .../generator/algebraic_eqn_computed_var_on_rhs/model.c | 2 +- .../algebraic_eqn_computed_var_on_rhs/model.external.c | 2 +- .../algebraic_eqn_computed_var_on_rhs/model.external.h | 2 +- .../algebraic_eqn_computed_var_on_rhs/model.external.py | 2 +- .../generator/algebraic_eqn_computed_var_on_rhs/model.h | 2 +- .../generator/algebraic_eqn_computed_var_on_rhs/model.py | 2 +- .../generator/algebraic_eqn_const_var_on_rhs/model.c | 2 +- .../generator/algebraic_eqn_const_var_on_rhs/model.h | 2 +- .../generator/algebraic_eqn_const_var_on_rhs/model.py | 2 +- .../generator/algebraic_eqn_constant_on_rhs/model.c | 2 +- .../generator/algebraic_eqn_constant_on_rhs/model.h | 2 +- .../generator/algebraic_eqn_constant_on_rhs/model.py | 2 +- .../generator/algebraic_eqn_derivative_on_rhs/model.c | 2 +- .../generator/algebraic_eqn_derivative_on_rhs/model.h | 2 +- .../generator/algebraic_eqn_derivative_on_rhs/model.py | 2 +- .../algebraic_eqn_derivative_on_rhs_one_component/model.c | 2 +- .../algebraic_eqn_derivative_on_rhs_one_component/model.h | 2 +- .../algebraic_eqn_derivative_on_rhs_one_component/model.py | 2 +- .../generator/algebraic_eqn_state_var_on_rhs/model.c | 2 +- .../generator/algebraic_eqn_state_var_on_rhs/model.h | 2 +- .../generator/algebraic_eqn_state_var_on_rhs/model.py | 2 +- .../algebraic_eqn_state_var_on_rhs_one_component/model.c | 2 +- .../algebraic_eqn_state_var_on_rhs_one_component/model.h | 2 +- .../algebraic_eqn_state_var_on_rhs_one_component/model.py | 2 +- .../algebraic_eqn_with_one_non_isolated_unknown/model.c | 2 +- .../model.external.c | 2 +- .../model.external.h | 2 +- .../model.external.py | 2 +- .../algebraic_eqn_with_one_non_isolated_unknown/model.h | 2 +- .../algebraic_eqn_with_one_non_isolated_unknown/model.py | 2 +- .../algebraic_system_with_three_linked_unknowns/model.c | 2 +- .../algebraic_system_with_three_linked_unknowns/model.h | 2 +- .../model.one.external.c | 2 +- .../model.one.external.h | 2 +- .../model.one.external.py | 2 +- .../algebraic_system_with_three_linked_unknowns/model.py | 2 +- .../model.three.externals.c | 2 +- .../model.three.externals.h | 2 +- .../model.three.externals.py | 2 +- .../model.two.externals.c | 2 +- .../model.two.externals.h | 2 +- .../model.two.externals.py | 2 +- .../model.not.ordered.c | 2 +- .../model.not.ordered.h | 2 +- .../model.not.ordered.py | 2 +- .../model.ordered.c | 2 +- .../model.ordered.h | 2 +- .../model.ordered.py | 2 +- .../generator/algebraic_unknown_var_on_rhs/model.c | 2 +- .../generator/algebraic_unknown_var_on_rhs/model.h | 2 +- .../generator/algebraic_unknown_var_on_rhs/model.py | 2 +- tests/resources/generator/cell_geometry_model/model.c | 2 +- .../generator/cell_geometry_model/model.external.c | 2 +- .../generator/cell_geometry_model/model.external.h | 2 +- .../generator/cell_geometry_model/model.external.py | 2 +- tests/resources/generator/cell_geometry_model/model.h | 2 +- tests/resources/generator/cell_geometry_model/model.py | 2 +- .../generator/cellml_mappings_and_encapsulations/model.c | 2 +- .../generator/cellml_mappings_and_encapsulations/model.h | 2 +- .../generator/cellml_mappings_and_encapsulations/model.py | 2 +- tests/resources/generator/cellml_slc_example/model.py | 2 +- .../cellml_state_initialised_using_variable/model.c | 2 +- .../cellml_state_initialised_using_variable/model.h | 2 +- .../cellml_state_initialised_using_variable/model.py | 2 +- .../generator/cellml_unit_scaling_constant/model.c | 2 +- .../generator/cellml_unit_scaling_constant/model.h | 2 +- .../generator/cellml_unit_scaling_constant/model.py | 2 +- tests/resources/generator/cellml_unit_scaling_rate/model.c | 2 +- tests/resources/generator/cellml_unit_scaling_rate/model.h | 2 +- tests/resources/generator/cellml_unit_scaling_rate/model.py | 2 +- tests/resources/generator/cellml_unit_scaling_state/model.c | 2 +- tests/resources/generator/cellml_unit_scaling_state/model.h | 2 +- .../resources/generator/cellml_unit_scaling_state/model.py | 2 +- .../model.c | 2 +- .../model.h | 2 +- .../model.py | 2 +- .../model.c | 2 +- .../model.h | 2 +- .../model.py | 2 +- .../generator/cellml_unit_scaling_voi_direct/model.c | 2 +- .../generator/cellml_unit_scaling_voi_direct/model.h | 2 +- .../generator/cellml_unit_scaling_voi_direct/model.py | 2 +- .../generator/cellml_unit_scaling_voi_indirect/model.c | 2 +- .../generator/cellml_unit_scaling_voi_indirect/model.h | 2 +- .../generator/cellml_unit_scaling_voi_indirect/model.py | 2 +- tests/resources/generator/dae_cellml_1_1_model/model.c | 2 +- tests/resources/generator/dae_cellml_1_1_model/model.h | 2 +- tests/resources/generator/dae_cellml_1_1_model/model.py | 2 +- tests/resources/generator/dependent_eqns/model.c | 2 +- tests/resources/generator/dependent_eqns/model.h | 2 +- tests/resources/generator/dependent_eqns/model.py | 2 +- .../model.c | 2 +- .../model.h | 2 +- .../model.py | 2 +- .../model.c | 2 +- .../model.h | 2 +- .../model.py | 2 +- .../hodgkin_huxley_squid_axon_model_1952/model.algebraic.c | 2 +- .../hodgkin_huxley_squid_axon_model_1952/model.algebraic.h | 2 +- .../hodgkin_huxley_squid_axon_model_1952/model.algebraic.py | 2 +- .../generator/hodgkin_huxley_squid_axon_model_1952/model.c | 2 +- .../model.computed.constant.c | 2 +- .../model.computed.constant.h | 2 +- .../model.computed.constant.py | 2 +- .../hodgkin_huxley_squid_axon_model_1952/model.constant.c | 2 +- .../hodgkin_huxley_squid_axon_model_1952/model.constant.h | 2 +- .../hodgkin_huxley_squid_axon_model_1952/model.constant.py | 2 +- .../hodgkin_huxley_squid_axon_model_1952/model.dae.c | 2 +- .../hodgkin_huxley_squid_axon_model_1952/model.dae.h | 2 +- .../hodgkin_huxley_squid_axon_model_1952/model.dae.py | 2 +- .../model.dependent.algebraic.c | 2 +- .../model.dependent.algebraic.h | 2 +- .../model.dependent.algebraic.py | 2 +- .../model.dependent.computed.constant.c | 2 +- .../model.dependent.computed.constant.h | 2 +- .../model.dependent.computed.constant.py | 2 +- .../model.dependent.constant.c | 2 +- .../model.dependent.constant.h | 2 +- .../model.dependent.constant.py | 2 +- .../model.dependent.state.c | 2 +- .../model.dependent.state.h | 2 +- .../model.dependent.state.py | 2 +- .../hodgkin_huxley_squid_axon_model_1952/model.external.c | 2 +- .../hodgkin_huxley_squid_axon_model_1952/model.external.h | 2 +- .../hodgkin_huxley_squid_axon_model_1952/model.external.py | 2 +- .../generator/hodgkin_huxley_squid_axon_model_1952/model.h | 2 +- .../generator/hodgkin_huxley_squid_axon_model_1952/model.py | 2 +- .../hodgkin_huxley_squid_axon_model_1952/model.state.c | 2 +- .../hodgkin_huxley_squid_axon_model_1952/model.state.h | 2 +- .../hodgkin_huxley_squid_axon_model_1952/model.state.py | 2 +- tests/resources/generator/noble_model_1962/model.c | 2 +- tests/resources/generator/noble_model_1962/model.h | 2 +- tests/resources/generator/noble_model_1962/model.py | 2 +- tests/resources/generator/ode_computed_var_on_rhs/model.c | 2 +- tests/resources/generator/ode_computed_var_on_rhs/model.h | 2 +- tests/resources/generator/ode_computed_var_on_rhs/model.py | 2 +- .../generator/ode_computed_var_on_rhs_one_component/model.c | 2 +- .../generator/ode_computed_var_on_rhs_one_component/model.h | 2 +- .../ode_computed_var_on_rhs_one_component/model.py | 2 +- tests/resources/generator/ode_const_var_on_rhs/model.c | 2 +- tests/resources/generator/ode_const_var_on_rhs/model.h | 2 +- tests/resources/generator/ode_const_var_on_rhs/model.py | 2 +- .../generator/ode_const_var_on_rhs_one_component/model.c | 2 +- .../generator/ode_const_var_on_rhs_one_component/model.h | 2 +- .../generator/ode_const_var_on_rhs_one_component/model.py | 2 +- tests/resources/generator/ode_constant_on_rhs/model.c | 2 +- tests/resources/generator/ode_constant_on_rhs/model.h | 2 +- tests/resources/generator/ode_constant_on_rhs/model.py | 2 +- .../generator/ode_constant_on_rhs_one_component/model.c | 2 +- .../generator/ode_constant_on_rhs_one_component/model.h | 2 +- .../generator/ode_constant_on_rhs_one_component/model.py | 2 +- .../resources/generator/ode_multiple_dependent_odes/model.c | 2 +- .../resources/generator/ode_multiple_dependent_odes/model.h | 2 +- .../generator/ode_multiple_dependent_odes/model.py | 2 +- .../ode_multiple_dependent_odes_one_component/model.c | 2 +- .../ode_multiple_dependent_odes_one_component/model.h | 2 +- .../ode_multiple_dependent_odes_one_component/model.py | 2 +- .../generator/ode_multiple_odes_with_same_name/model.c | 2 +- .../generator/ode_multiple_odes_with_same_name/model.h | 2 +- .../generator/ode_multiple_odes_with_same_name/model.py | 2 +- tests/resources/generator/ode_unknown_var_on_rhs/model.c | 2 +- tests/resources/generator/ode_unknown_var_on_rhs/model.h | 2 +- tests/resources/generator/ode_unknown_var_on_rhs/model.py | 2 +- tests/resources/generator/robertson_model_1966/model.dae.c | 2 +- tests/resources/generator/robertson_model_1966/model.dae.h | 2 +- tests/resources/generator/robertson_model_1966/model.dae.py | 2 +- tests/resources/generator/robertson_model_1966/model.ode.c | 2 +- tests/resources/generator/robertson_model_1966/model.ode.h | 2 +- tests/resources/generator/robertson_model_1966/model.ode.py | 2 +- tests/resources/generator/sine_model_imports/model.c | 2 +- tests/resources/generator/sine_model_imports/model.h | 2 +- tests/resources/generator/sine_model_imports/model.py | 2 +- .../generator/unknown_variable_as_external_variable/model.c | 2 +- .../generator/unknown_variable_as_external_variable/model.h | 2 +- .../unknown_variable_as_external_variable/model.py | 2 +- .../generator/variable_initialised_using_a_constant/model.c | 2 +- .../generator/variable_initialised_using_a_constant/model.h | 2 +- .../variable_initialised_using_a_constant/model.py | 2 +- 191 files changed, 196 insertions(+), 196 deletions(-) diff --git a/src/generatorprofile.cpp b/src/generatorprofile.cpp index 7adcd24c6e..0c17c44b8d 100644 --- a/src/generatorprofile.cpp +++ b/src/generatorprofile.cpp @@ -689,8 +689,8 @@ void GeneratorProfile::GeneratorProfileImpl::loadProfile(GeneratorProfile::Profi "[CODE]" "}\n"; - mInterfaceComputeComputedConstantsMethodString = "void computeComputedConstants(double *computedConstants);\n"; - mImplementationComputeComputedConstantsMethodString = "void computeComputedConstants(double *computedConstants)\n" + mInterfaceComputeComputedConstantsMethodString = "void computeComputedConstants(double *constants, double *computedConstants);\n"; + mImplementationComputeComputedConstantsMethodString = "void computeComputedConstants(double *constants, double *computedConstants)\n" "{\n" "[CODE]" "}\n"; @@ -1092,7 +1092,7 @@ void GeneratorProfile::GeneratorProfileImpl::loadProfile(GeneratorProfile::Profi mInterfaceComputeComputedConstantsMethodString = ""; mImplementationComputeComputedConstantsMethodString = "\n" - "def compute_computed_constants(computed_constants):\n" + "def compute_computed_constants(constants, computed_constants):\n" "[CODE]"; mInterfaceComputeRatesMethodWoevString = ""; diff --git a/src/generatorprofilesha1values.h b/src/generatorprofilesha1values.h index ab046ca59f..ba936cc964 100644 --- a/src/generatorprofilesha1values.h +++ b/src/generatorprofilesha1values.h @@ -24,7 +24,7 @@ namespace libcellml { * The content of this file is generated, do not edit this file directly. * See docs/dev_utilities.rst for further information. */ -static const char C_GENERATOR_PROFILE_SHA1[] = "33b9e23501b734d3e570f1c7252a6fc6c114c126"; -static const char PYTHON_GENERATOR_PROFILE_SHA1[] = "c7620ae1e094506619cae6023f65d4e9f0bd118d"; +static const char C_GENERATOR_PROFILE_SHA1[] = "2e1a7d8b5995845aceceeb06e8f084f9e11fa13d"; +static const char PYTHON_GENERATOR_PROFILE_SHA1[] = "c7d3866a8238ce15df79bf48d83b95c0650de2b4"; } // namespace libcellml diff --git a/tests/bindings/python/test_generator_profile.py b/tests/bindings/python/test_generator_profile.py index 2a95c3cbca..8749ef922a 100644 --- a/tests/bindings/python/test_generator_profile.py +++ b/tests/bindings/python/test_generator_profile.py @@ -761,7 +761,7 @@ def test_implementation_compute_computed_constants_method_string(self): g = GeneratorProfile() - self.assertEqual('void computeComputedConstants(double *computedConstants)\n{\n[CODE]}\n', + self.assertEqual('void computeComputedConstants(double *constants, double *computedConstants)\n{\n[CODE]}\n', g.implementationComputeComputedConstantsMethodString()) g.setImplementationComputeComputedConstantsMethodString(GeneratorProfileTestCase.VALUE) self.assertEqual(GeneratorProfileTestCase.VALUE, g.implementationComputeComputedConstantsMethodString()) @@ -985,7 +985,7 @@ def test_interface_compute_computed_constants_method_string(self): g = GeneratorProfile() - self.assertEqual('void computeComputedConstants(double *computedConstants);\n', + self.assertEqual('void computeComputedConstants(double *constants, double *computedConstants);\n', g.interfaceComputeComputedConstantsMethodString()) g.setInterfaceComputeComputedConstantsMethodString(GeneratorProfileTestCase.VALUE) self.assertEqual(GeneratorProfileTestCase.VALUE, g.interfaceComputeComputedConstantsMethodString()) diff --git a/tests/generator/generatorprofile.cpp b/tests/generator/generatorprofile.cpp index 6fea7d2dc6..bde173bdc8 100644 --- a/tests/generator/generatorprofile.cpp +++ b/tests/generator/generatorprofile.cpp @@ -491,9 +491,9 @@ TEST(GeneratorProfile, defaultMiscellaneousValues) "}\n", generatorProfile->implementationInitialiseVariablesMethodString(true, true)); - EXPECT_EQ("void computeComputedConstants(double *computedConstants);\n", + EXPECT_EQ("void computeComputedConstants(double *constants, double *computedConstants);\n", generatorProfile->interfaceComputeComputedConstantsMethodString()); - EXPECT_EQ("void computeComputedConstants(double *computedConstants)\n" + EXPECT_EQ("void computeComputedConstants(double *constants, double *computedConstants)\n" "{\n" "[CODE]" "}\n", diff --git a/tests/resources/coverage/generator/model.c b/tests/resources/coverage/generator/model.c index da7e34f989..9d74d76711 100644 --- a/tests/resources/coverage/generator/model.c +++ b/tests/resources/coverage/generator/model.c @@ -403,7 +403,7 @@ void initialiseVariables(double *states, double *rates, double *constants) states[0] = 0.0; } -void computeComputedConstants(double *computedConstants) +void computeComputedConstants(double *constants, double *computedConstants) { variables[0] = variables[1] == variables[2]; variables[3] = variables[1]/(variables[2] == variables[2]); diff --git a/tests/resources/coverage/generator/model.h b/tests/resources/coverage/generator/model.h index 50370dca50..e05872689b 100644 --- a/tests/resources/coverage/generator/model.h +++ b/tests/resources/coverage/generator/model.h @@ -36,6 +36,6 @@ double * createVariablesArray(); void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *constants); -void computeComputedConstants(double *computedConstants); +void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/coverage/generator/model.implementation.out b/tests/resources/coverage/generator/model.implementation.out index 11491a7789..35809a2b2e 100644 --- a/tests/resources/coverage/generator/model.implementation.out +++ b/tests/resources/coverage/generator/model.implementation.out @@ -172,7 +172,7 @@ void initialiseVariables(double *states, double *rates, double *constants) states[0] = 0.0; } -void computeComputedConstants(double *computedConstants) +void computeComputedConstants(double *constants, double *computedConstants) { variables[0] = eq(variables[1], variables[2]); variables[3] = variables[1]/eq(variables[2], variables[2]); diff --git a/tests/resources/coverage/generator/model.interface.out b/tests/resources/coverage/generator/model.interface.out index 77cb429b15..ecc8522e29 100644 --- a/tests/resources/coverage/generator/model.interface.out +++ b/tests/resources/coverage/generator/model.interface.out @@ -9,6 +9,6 @@ double * createVariablesArray(); void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *constants); -void computeComputedConstants(double *computedConstants); +void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/coverage/generator/model.modified.profile.c b/tests/resources/coverage/generator/model.modified.profile.c index d4a72bf603..c05a4023dc 100644 --- a/tests/resources/coverage/generator/model.modified.profile.c +++ b/tests/resources/coverage/generator/model.modified.profile.c @@ -403,7 +403,7 @@ void initialiseVariables(double *states, double *rates, double *constants) states[0] = 0.0; } -void computeComputedConstants(double *computedConstants) +void computeComputedConstants(double *constants, double *computedConstants) { variables[0] = variables[1] == variables[2]; variables[3] = variables[1]/(variables[2] == variables[2]); diff --git a/tests/resources/coverage/generator/model.modified.profile.h b/tests/resources/coverage/generator/model.modified.profile.h index 0f769b4cb5..ef3a093e68 100644 --- a/tests/resources/coverage/generator/model.modified.profile.h +++ b/tests/resources/coverage/generator/model.modified.profile.h @@ -36,6 +36,6 @@ double * createVariablesArray(); void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *constants); -void computeComputedConstants(double *computedConstants); +void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/coverage/generator/model.modified.profile.py b/tests/resources/coverage/generator/model.modified.profile.py index 19e8c128f3..f6b71d3102 100644 --- a/tests/resources/coverage/generator/model.modified.profile.py +++ b/tests/resources/coverage/generator/model.modified.profile.py @@ -403,7 +403,7 @@ def initialise_variables(states, rates, constants): states[0] = 0.0 -def compute_computed_constants(computed_constants): +def compute_computed_constants(constants, computed_constants): variables[0] = eq_func(variables[1], variables[2]) variables[3] = variables[1]/eq_func(variables[2], variables[2]) variables[4] = neq_func(variables[1], variables[2]) diff --git a/tests/resources/coverage/generator/model.out b/tests/resources/coverage/generator/model.out index 18d0685f79..b4c4b8088d 100644 --- a/tests/resources/coverage/generator/model.out +++ b/tests/resources/coverage/generator/model.out @@ -142,7 +142,7 @@ void initialiseVariables(double *states, double *rates, double *constants) states[0] = 0.0; } -void computeComputedConstants(double *computedConstants) +void computeComputedConstants(double *constants, double *computedConstants) { variables[0] = variables[1] == variables[2]; variables[3] = variables[1]/(variables[2] == variables[2]); diff --git a/tests/resources/coverage/generator/model.py b/tests/resources/coverage/generator/model.py index 7afb5ad309..8b75532bdf 100644 --- a/tests/resources/coverage/generator/model.py +++ b/tests/resources/coverage/generator/model.py @@ -403,7 +403,7 @@ def initialise_variables(states, rates, constants): states[0] = 0.0 -def compute_computed_constants(computed_constants): +def compute_computed_constants(constants, computed_constants): variables[0] = eq_func(variables[1], variables[2]) variables[3] = variables[1]/eq_func(variables[2], variables[2]) variables[4] = neq_func(variables[1], variables[2]) diff --git a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.c b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.c index e7a8391fe0..26a2df478e 100644 --- a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.c +++ b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.c @@ -38,7 +38,7 @@ void initialiseVariables(double *constants) variables[1] = 1.0; } -void computeComputedConstants(double *computedConstants) +void computeComputedConstants(double *constants, double *computedConstants) { variables[0] = variables[1]; } diff --git a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.c b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.c index fc41e333b1..668e81b0b3 100644 --- a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.c +++ b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.c @@ -38,7 +38,7 @@ void initialiseVariables(double *constants, ExternalVariable externalVariable) variables[1] = externalVariable(variables, 1); } -void computeComputedConstants(double *computedConstants) +void computeComputedConstants(double *constants, double *computedConstants) { } diff --git a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.h b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.h index 9ac640aef7..8b56d9b9f6 100644 --- a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.h +++ b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.h @@ -33,5 +33,5 @@ void deleteArray(double *array); typedef double (* ExternalVariable)(double *variables, size_t index); void initialiseVariables(double *constants, ExternalVariable externalVariable); -void computeComputedConstants(double *computedConstants); +void computeComputedConstants(double *constants, double *computedConstants); void computeVariables(double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); diff --git a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.py b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.py index 781aad5787..84b4b2389f 100644 --- a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.py +++ b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.py @@ -33,7 +33,7 @@ def initialise_variables(constants, external_variable): variables[1] = external_variable(variables, 1) -def compute_computed_constants(computed_constants): +def compute_computed_constants(constants, computed_constants): pass diff --git a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.h b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.h index efdd8c3c9f..8b9a1fb666 100644 --- a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.h +++ b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.h @@ -30,5 +30,5 @@ double * createVariablesArray(); void deleteArray(double *array); void initialiseVariables(double *constants); -void computeComputedConstants(double *computedConstants); +void computeComputedConstants(double *constants, double *computedConstants); void computeVariables(double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.py b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.py index 850fd76c94..fdff9ef0f6 100644 --- a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.py +++ b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.py @@ -32,7 +32,7 @@ def initialise_variables(constants): variables[1] = 1.0 -def compute_computed_constants(computed_constants): +def compute_computed_constants(constants, computed_constants): variables[0] = variables[1] diff --git a/tests/resources/generator/algebraic_eqn_const_var_on_rhs/model.c b/tests/resources/generator/algebraic_eqn_const_var_on_rhs/model.c index 67d0929811..47f5f52480 100644 --- a/tests/resources/generator/algebraic_eqn_const_var_on_rhs/model.c +++ b/tests/resources/generator/algebraic_eqn_const_var_on_rhs/model.c @@ -38,7 +38,7 @@ void initialiseVariables(double *constants) variables[1] = 1.0; } -void computeComputedConstants(double *computedConstants) +void computeComputedConstants(double *constants, double *computedConstants) { variables[0] = variables[1]; } diff --git a/tests/resources/generator/algebraic_eqn_const_var_on_rhs/model.h b/tests/resources/generator/algebraic_eqn_const_var_on_rhs/model.h index efdd8c3c9f..8b9a1fb666 100644 --- a/tests/resources/generator/algebraic_eqn_const_var_on_rhs/model.h +++ b/tests/resources/generator/algebraic_eqn_const_var_on_rhs/model.h @@ -30,5 +30,5 @@ double * createVariablesArray(); void deleteArray(double *array); void initialiseVariables(double *constants); -void computeComputedConstants(double *computedConstants); +void computeComputedConstants(double *constants, double *computedConstants); void computeVariables(double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/algebraic_eqn_const_var_on_rhs/model.py b/tests/resources/generator/algebraic_eqn_const_var_on_rhs/model.py index 94f2dd4a95..ce0f5b10fc 100644 --- a/tests/resources/generator/algebraic_eqn_const_var_on_rhs/model.py +++ b/tests/resources/generator/algebraic_eqn_const_var_on_rhs/model.py @@ -32,7 +32,7 @@ def initialise_variables(constants): variables[1] = 1.0 -def compute_computed_constants(computed_constants): +def compute_computed_constants(constants, computed_constants): variables[0] = variables[1] diff --git a/tests/resources/generator/algebraic_eqn_constant_on_rhs/model.c b/tests/resources/generator/algebraic_eqn_constant_on_rhs/model.c index 14e40ccee7..7c468c0fcd 100644 --- a/tests/resources/generator/algebraic_eqn_constant_on_rhs/model.c +++ b/tests/resources/generator/algebraic_eqn_constant_on_rhs/model.c @@ -37,7 +37,7 @@ void initialiseVariables(double *constants) variables[0] = 1.0; } -void computeComputedConstants(double *computedConstants) +void computeComputedConstants(double *constants, double *computedConstants) { } diff --git a/tests/resources/generator/algebraic_eqn_constant_on_rhs/model.h b/tests/resources/generator/algebraic_eqn_constant_on_rhs/model.h index 1f4d1dcf94..d26413c671 100644 --- a/tests/resources/generator/algebraic_eqn_constant_on_rhs/model.h +++ b/tests/resources/generator/algebraic_eqn_constant_on_rhs/model.h @@ -30,5 +30,5 @@ double * createVariablesArray(); void deleteArray(double *array); void initialiseVariables(double *constants); -void computeComputedConstants(double *computedConstants); +void computeComputedConstants(double *constants, double *computedConstants); void computeVariables(double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/algebraic_eqn_constant_on_rhs/model.py b/tests/resources/generator/algebraic_eqn_constant_on_rhs/model.py index f51bc9ecb3..2a902ccf91 100644 --- a/tests/resources/generator/algebraic_eqn_constant_on_rhs/model.py +++ b/tests/resources/generator/algebraic_eqn_constant_on_rhs/model.py @@ -31,7 +31,7 @@ def initialise_variables(constants): variables[0] = 1.0 -def compute_computed_constants(computed_constants): +def compute_computed_constants(constants, computed_constants): pass diff --git a/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.c b/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.c index dd75465497..29028861f2 100644 --- a/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.c +++ b/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.c @@ -57,7 +57,7 @@ void initialiseVariables(double *states, double *rates, double *constants) states[0] = 1.0; } -void computeComputedConstants(double *computedConstants) +void computeComputedConstants(double *constants, double *computedConstants) { } diff --git a/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.h b/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.h index 7b9fab8b61..1eeee2f1e3 100644 --- a/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.h +++ b/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.h @@ -36,6 +36,6 @@ double * createVariablesArray(); void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *constants); -void computeComputedConstants(double *computedConstants); +void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.py b/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.py index 7cff7aaaad..686f0c5378 100644 --- a/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.py +++ b/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.py @@ -46,7 +46,7 @@ def initialise_variables(states, rates, constants): states[0] = 1.0 -def compute_computed_constants(computed_constants): +def compute_computed_constants(constants, computed_constants): pass diff --git a/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.c b/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.c index 999d76aa5a..7e62bf29a7 100644 --- a/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.c +++ b/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.c @@ -57,7 +57,7 @@ void initialiseVariables(double *states, double *rates, double *constants) states[0] = 1.0; } -void computeComputedConstants(double *computedConstants) +void computeComputedConstants(double *constants, double *computedConstants) { } diff --git a/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.h b/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.h index 94a64dfa85..ca79cc5f25 100644 --- a/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.h +++ b/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.h @@ -36,6 +36,6 @@ double * createVariablesArray(); void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *constants); -void computeComputedConstants(double *computedConstants); +void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.py b/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.py index 0e55e6b5b6..46f658054f 100644 --- a/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.py +++ b/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.py @@ -46,7 +46,7 @@ def initialise_variables(states, rates, constants): states[0] = 1.0 -def compute_computed_constants(computed_constants): +def compute_computed_constants(constants, computed_constants): pass diff --git a/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.c b/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.c index 3074a08bb7..9e4c71ae59 100644 --- a/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.c +++ b/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.c @@ -57,7 +57,7 @@ void initialiseVariables(double *states, double *rates, double *constants) states[0] = 1.0; } -void computeComputedConstants(double *computedConstants) +void computeComputedConstants(double *constants, double *computedConstants) { } diff --git a/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.h b/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.h index 9c395a3d44..d2a3025e39 100644 --- a/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.h +++ b/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.h @@ -36,6 +36,6 @@ double * createVariablesArray(); void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *constants); -void computeComputedConstants(double *computedConstants); +void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.py b/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.py index 50cfc4e9fd..fb9970426c 100644 --- a/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.py +++ b/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.py @@ -46,7 +46,7 @@ def initialise_variables(states, rates, constants): states[0] = 1.0 -def compute_computed_constants(computed_constants): +def compute_computed_constants(constants, computed_constants): pass diff --git a/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.c b/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.c index 6a004da952..5f011b73d1 100644 --- a/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.c +++ b/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.c @@ -57,7 +57,7 @@ void initialiseVariables(double *states, double *rates, double *constants) states[0] = 1.0; } -void computeComputedConstants(double *computedConstants) +void computeComputedConstants(double *constants, double *computedConstants) { } diff --git a/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.h b/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.h index 50c681f144..cfae2b1d2f 100644 --- a/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.h +++ b/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.h @@ -36,6 +36,6 @@ double * createVariablesArray(); void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *constants); -void computeComputedConstants(double *computedConstants); +void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.py b/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.py index 353cea9ff5..ac01ae32cc 100644 --- a/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.py +++ b/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.py @@ -46,7 +46,7 @@ def initialise_variables(states, rates, constants): states[0] = 1.0 -def compute_computed_constants(computed_constants): +def compute_computed_constants(constants, computed_constants): pass diff --git a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.c b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.c index 7b9e360fcc..9913feba29 100644 --- a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.c +++ b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.c @@ -71,7 +71,7 @@ void initialiseVariables(double *constants) variables[2] = 7.0; } -void computeComputedConstants(double *computedConstants) +void computeComputedConstants(double *constants, double *computedConstants) { } diff --git a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.c b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.c index eda59a04ad..f23b5c4734 100644 --- a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.c +++ b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.c @@ -43,7 +43,7 @@ void initialiseVariables(double *constants, ExternalVariable externalVariable) variables[3] = externalVariable(variables, 3); } -void computeComputedConstants(double *computedConstants) +void computeComputedConstants(double *constants, double *computedConstants) { } diff --git a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.h b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.h index 9ac640aef7..8b56d9b9f6 100644 --- a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.h +++ b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.h @@ -33,5 +33,5 @@ void deleteArray(double *array); typedef double (* ExternalVariable)(double *variables, size_t index); void initialiseVariables(double *constants, ExternalVariable externalVariable); -void computeComputedConstants(double *computedConstants); +void computeComputedConstants(double *constants, double *computedConstants); void computeVariables(double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); diff --git a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.py b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.py index 44d1589f05..5b08621774 100644 --- a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.py +++ b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.py @@ -38,7 +38,7 @@ def initialise_variables(constants, external_variable): variables[3] = external_variable(variables, 3) -def compute_computed_constants(computed_constants): +def compute_computed_constants(constants, computed_constants): pass diff --git a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.h b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.h index efdd8c3c9f..8b9a1fb666 100644 --- a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.h +++ b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.h @@ -30,5 +30,5 @@ double * createVariablesArray(); void deleteArray(double *array); void initialiseVariables(double *constants); -void computeComputedConstants(double *computedConstants); +void computeComputedConstants(double *constants, double *computedConstants); void computeVariables(double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.py b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.py index 98a491a2c4..6260fef2e3 100644 --- a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.py +++ b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.py @@ -58,7 +58,7 @@ def initialise_variables(constants): variables[2] = 7.0 -def compute_computed_constants(computed_constants): +def compute_computed_constants(constants, computed_constants): pass diff --git a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.c b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.c index c2c0ceb69c..bf5e76015f 100644 --- a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.c +++ b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.c @@ -77,7 +77,7 @@ void initialiseVariables(double *constants) variables[2] = 1.0; } -void computeComputedConstants(double *computedConstants) +void computeComputedConstants(double *constants, double *computedConstants) { } diff --git a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.h b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.h index 7850afa8d9..69ce3f6763 100644 --- a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.h +++ b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.h @@ -30,5 +30,5 @@ double * createVariablesArray(); void deleteArray(double *array); void initialiseVariables(double *constants); -void computeComputedConstants(double *computedConstants); +void computeComputedConstants(double *constants, double *computedConstants); void computeVariables(double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.one.external.c b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.one.external.c index 83641270b5..de17ebdf88 100644 --- a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.one.external.c +++ b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.one.external.c @@ -74,7 +74,7 @@ void initialiseVariables(double *constants, ExternalVariable externalVariable) variables[0] = externalVariable(variables, 0); } -void computeComputedConstants(double *computedConstants) +void computeComputedConstants(double *constants, double *computedConstants) { } diff --git a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.one.external.h b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.one.external.h index ffc06e13b9..f8cc4af0bb 100644 --- a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.one.external.h +++ b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.one.external.h @@ -33,5 +33,5 @@ void deleteArray(double *array); typedef double (* ExternalVariable)(double *variables, size_t index); void initialiseVariables(double *constants, ExternalVariable externalVariable); -void computeComputedConstants(double *computedConstants); +void computeComputedConstants(double *constants, double *computedConstants); void computeVariables(double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); diff --git a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.one.external.py b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.one.external.py index c0ea0719e8..e1ab39418f 100644 --- a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.one.external.py +++ b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.one.external.py @@ -62,7 +62,7 @@ def initialise_variables(constants, external_variable): variables[0] = external_variable(variables, 0) -def compute_computed_constants(computed_constants): +def compute_computed_constants(constants, computed_constants): pass diff --git a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.py b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.py index 0444e0091f..07cdcee4a2 100644 --- a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.py +++ b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.py @@ -64,7 +64,7 @@ def initialise_variables(constants): variables[2] = 1.0 -def compute_computed_constants(computed_constants): +def compute_computed_constants(constants, computed_constants): pass diff --git a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.c b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.c index 38b9632cd6..d21c2ed3ce 100644 --- a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.c +++ b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.c @@ -41,7 +41,7 @@ void initialiseVariables(double *constants, ExternalVariable externalVariable) variables[2] = externalVariable(variables, 2); } -void computeComputedConstants(double *computedConstants) +void computeComputedConstants(double *constants, double *computedConstants) { } diff --git a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.h b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.h index ffc06e13b9..f8cc4af0bb 100644 --- a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.h +++ b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.h @@ -33,5 +33,5 @@ void deleteArray(double *array); typedef double (* ExternalVariable)(double *variables, size_t index); void initialiseVariables(double *constants, ExternalVariable externalVariable); -void computeComputedConstants(double *computedConstants); +void computeComputedConstants(double *constants, double *computedConstants); void computeVariables(double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); diff --git a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.py b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.py index c9f380a65c..25bd38c60c 100644 --- a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.py +++ b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.py @@ -36,7 +36,7 @@ def initialise_variables(constants, external_variable): variables[2] = external_variable(variables, 2) -def compute_computed_constants(computed_constants): +def compute_computed_constants(constants, computed_constants): pass diff --git a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.two.externals.c b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.two.externals.c index 93170385b2..06059cabca 100644 --- a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.two.externals.c +++ b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.two.externals.c @@ -111,7 +111,7 @@ void initialiseVariables(double *constants, ExternalVariable externalVariable) variables[2] = externalVariable(variables, 2); } -void computeComputedConstants(double *computedConstants) +void computeComputedConstants(double *constants, double *computedConstants) { } diff --git a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.two.externals.h b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.two.externals.h index ffc06e13b9..f8cc4af0bb 100644 --- a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.two.externals.h +++ b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.two.externals.h @@ -33,5 +33,5 @@ void deleteArray(double *array); typedef double (* ExternalVariable)(double *variables, size_t index); void initialiseVariables(double *constants, ExternalVariable externalVariable); -void computeComputedConstants(double *computedConstants); +void computeComputedConstants(double *constants, double *computedConstants); void computeVariables(double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); diff --git a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.two.externals.py b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.two.externals.py index 0c5fbd0d15..ecaa9b6971 100644 --- a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.two.externals.py +++ b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.two.externals.py @@ -93,7 +93,7 @@ def initialise_variables(constants, external_variable): variables[2] = external_variable(variables, 2) -def compute_computed_constants(computed_constants): +def compute_computed_constants(constants, computed_constants): pass diff --git a/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.c b/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.c index 7988fd4d9d..06fecfbf60 100644 --- a/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.c +++ b/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.c @@ -77,7 +77,7 @@ void initialiseVariables(double *constants) variables[5] = 5.0; } -void computeComputedConstants(double *computedConstants) +void computeComputedConstants(double *constants, double *computedConstants) { variables[3] = 3.0*variables[4]+variables[5]; } diff --git a/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.h b/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.h index 7850afa8d9..69ce3f6763 100644 --- a/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.h +++ b/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.h @@ -30,5 +30,5 @@ double * createVariablesArray(); void deleteArray(double *array); void initialiseVariables(double *constants); -void computeComputedConstants(double *computedConstants); +void computeComputedConstants(double *constants, double *computedConstants); void computeVariables(double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.py b/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.py index 732e694829..41286d7158 100644 --- a/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.py +++ b/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.py @@ -64,7 +64,7 @@ def initialise_variables(constants): variables[5] = 5.0 -def compute_computed_constants(computed_constants): +def compute_computed_constants(constants, computed_constants): variables[3] = 3.0*variables[4]+variables[5] diff --git a/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.c b/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.c index 1f97af5bdc..c964d754d5 100644 --- a/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.c +++ b/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.c @@ -77,7 +77,7 @@ void initialiseVariables(double *constants) variables[4] = 1.0; } -void computeComputedConstants(double *computedConstants) +void computeComputedConstants(double *constants, double *computedConstants) { variables[0] = 3.0*variables[1]+variables[2]; } diff --git a/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.h b/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.h index 7850afa8d9..69ce3f6763 100644 --- a/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.h +++ b/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.h @@ -30,5 +30,5 @@ double * createVariablesArray(); void deleteArray(double *array); void initialiseVariables(double *constants); -void computeComputedConstants(double *computedConstants); +void computeComputedConstants(double *constants, double *computedConstants); void computeVariables(double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.py b/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.py index eb228d40bc..e89d43847d 100644 --- a/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.py +++ b/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.py @@ -64,7 +64,7 @@ def initialise_variables(constants): variables[4] = 1.0 -def compute_computed_constants(computed_constants): +def compute_computed_constants(constants, computed_constants): variables[0] = 3.0*variables[1]+variables[2] diff --git a/tests/resources/generator/algebraic_unknown_var_on_rhs/model.c b/tests/resources/generator/algebraic_unknown_var_on_rhs/model.c index b587e3aaa6..8a47521561 100644 --- a/tests/resources/generator/algebraic_unknown_var_on_rhs/model.c +++ b/tests/resources/generator/algebraic_unknown_var_on_rhs/model.c @@ -38,7 +38,7 @@ void initialiseVariables(double *constants) variables[0] = 1.0; } -void computeComputedConstants(double *computedConstants) +void computeComputedConstants(double *constants, double *computedConstants) { variables[1] = variables[0]; } diff --git a/tests/resources/generator/algebraic_unknown_var_on_rhs/model.h b/tests/resources/generator/algebraic_unknown_var_on_rhs/model.h index 1f4d1dcf94..d26413c671 100644 --- a/tests/resources/generator/algebraic_unknown_var_on_rhs/model.h +++ b/tests/resources/generator/algebraic_unknown_var_on_rhs/model.h @@ -30,5 +30,5 @@ double * createVariablesArray(); void deleteArray(double *array); void initialiseVariables(double *constants); -void computeComputedConstants(double *computedConstants); +void computeComputedConstants(double *constants, double *computedConstants); void computeVariables(double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/algebraic_unknown_var_on_rhs/model.py b/tests/resources/generator/algebraic_unknown_var_on_rhs/model.py index 40a75154ac..7586911e1d 100644 --- a/tests/resources/generator/algebraic_unknown_var_on_rhs/model.py +++ b/tests/resources/generator/algebraic_unknown_var_on_rhs/model.py @@ -32,7 +32,7 @@ def initialise_variables(constants): variables[0] = 1.0 -def compute_computed_constants(computed_constants): +def compute_computed_constants(constants, computed_constants): variables[1] = variables[0] diff --git a/tests/resources/generator/cell_geometry_model/model.c b/tests/resources/generator/cell_geometry_model/model.c index eb98bbb190..39360db84f 100644 --- a/tests/resources/generator/cell_geometry_model/model.c +++ b/tests/resources/generator/cell_geometry_model/model.c @@ -41,7 +41,7 @@ void initialiseVariables(double *constants) variables[2] = 0.0011; } -void computeComputedConstants(double *computedConstants) +void computeComputedConstants(double *constants, double *computedConstants) { variables[0] = 1000.0*3.14*variables[2]*variables[2]*variables[1]; variables[3] = 0.02*variables[0]; diff --git a/tests/resources/generator/cell_geometry_model/model.external.c b/tests/resources/generator/cell_geometry_model/model.external.c index c9196c88c0..4342b4cbec 100644 --- a/tests/resources/generator/cell_geometry_model/model.external.c +++ b/tests/resources/generator/cell_geometry_model/model.external.c @@ -41,7 +41,7 @@ void initialiseVariables(double *constants, ExternalVariable externalVariable) variables[2] = externalVariable(variables, 2); } -void computeComputedConstants(double *computedConstants) +void computeComputedConstants(double *constants, double *computedConstants) { } diff --git a/tests/resources/generator/cell_geometry_model/model.external.h b/tests/resources/generator/cell_geometry_model/model.external.h index 4ff6fcadf4..6974bd6469 100644 --- a/tests/resources/generator/cell_geometry_model/model.external.h +++ b/tests/resources/generator/cell_geometry_model/model.external.h @@ -33,5 +33,5 @@ void deleteArray(double *array); typedef double (* ExternalVariable)(double *variables, size_t index); void initialiseVariables(double *constants, ExternalVariable externalVariable); -void computeComputedConstants(double *computedConstants); +void computeComputedConstants(double *constants, double *computedConstants); void computeVariables(double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); diff --git a/tests/resources/generator/cell_geometry_model/model.external.py b/tests/resources/generator/cell_geometry_model/model.external.py index a186a0405d..3cd1ff5b13 100644 --- a/tests/resources/generator/cell_geometry_model/model.external.py +++ b/tests/resources/generator/cell_geometry_model/model.external.py @@ -36,7 +36,7 @@ def initialise_variables(constants, external_variable): variables[2] = external_variable(variables, 2) -def compute_computed_constants(computed_constants): +def compute_computed_constants(constants, computed_constants): pass diff --git a/tests/resources/generator/cell_geometry_model/model.h b/tests/resources/generator/cell_geometry_model/model.h index 2a61e0d910..d291cbc391 100644 --- a/tests/resources/generator/cell_geometry_model/model.h +++ b/tests/resources/generator/cell_geometry_model/model.h @@ -30,5 +30,5 @@ double * createVariablesArray(); void deleteArray(double *array); void initialiseVariables(double *constants); -void computeComputedConstants(double *computedConstants); +void computeComputedConstants(double *constants, double *computedConstants); void computeVariables(double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/cell_geometry_model/model.py b/tests/resources/generator/cell_geometry_model/model.py index eeb43ec56b..0db8de32e3 100644 --- a/tests/resources/generator/cell_geometry_model/model.py +++ b/tests/resources/generator/cell_geometry_model/model.py @@ -35,7 +35,7 @@ def initialise_variables(constants): variables[2] = 0.0011 -def compute_computed_constants(computed_constants): +def compute_computed_constants(constants, computed_constants): variables[0] = 1000.0*3.14*variables[2]*variables[2]*variables[1] variables[3] = 0.02*variables[0] diff --git a/tests/resources/generator/cellml_mappings_and_encapsulations/model.c b/tests/resources/generator/cellml_mappings_and_encapsulations/model.c index 95661b3c66..19a0356dc2 100644 --- a/tests/resources/generator/cellml_mappings_and_encapsulations/model.c +++ b/tests/resources/generator/cellml_mappings_and_encapsulations/model.c @@ -58,7 +58,7 @@ void initialiseVariables(double *states, double *rates, double *constants) states[1] = 0.0; } -void computeComputedConstants(double *computedConstants) +void computeComputedConstants(double *constants, double *computedConstants) { } diff --git a/tests/resources/generator/cellml_mappings_and_encapsulations/model.h b/tests/resources/generator/cellml_mappings_and_encapsulations/model.h index 00bb5bd451..91a2bbdb90 100644 --- a/tests/resources/generator/cellml_mappings_and_encapsulations/model.h +++ b/tests/resources/generator/cellml_mappings_and_encapsulations/model.h @@ -36,6 +36,6 @@ double * createVariablesArray(); void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *constants); -void computeComputedConstants(double *computedConstants); +void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/cellml_mappings_and_encapsulations/model.py b/tests/resources/generator/cellml_mappings_and_encapsulations/model.py index 70c4e2d233..068ed49c69 100644 --- a/tests/resources/generator/cellml_mappings_and_encapsulations/model.py +++ b/tests/resources/generator/cellml_mappings_and_encapsulations/model.py @@ -47,7 +47,7 @@ def initialise_variables(states, rates, constants): states[1] = 0.0 -def compute_computed_constants(computed_constants): +def compute_computed_constants(constants, computed_constants): pass diff --git a/tests/resources/generator/cellml_slc_example/model.py b/tests/resources/generator/cellml_slc_example/model.py index 671757fccc..23470a883a 100644 --- a/tests/resources/generator/cellml_slc_example/model.py +++ b/tests/resources/generator/cellml_slc_example/model.py @@ -48,7 +48,7 @@ def initialise_variables(constants): variables[9] = 2902500.0 -def compute_computed_constants(computed_constants): +def compute_computed_constants(constants, computed_constants): variables[0] = variables[1]*(variables[2]*variables[3]-variables[4]*variables[5])/(variables[6]*variables[5]+variables[9]*variables[3]+variables[8]*variables[5]*variables[3]+variables[7]) diff --git a/tests/resources/generator/cellml_state_initialised_using_variable/model.c b/tests/resources/generator/cellml_state_initialised_using_variable/model.c index 7b504d866e..1dcda0f17c 100644 --- a/tests/resources/generator/cellml_state_initialised_using_variable/model.c +++ b/tests/resources/generator/cellml_state_initialised_using_variable/model.c @@ -56,7 +56,7 @@ void initialiseVariables(double *states, double *rates, double *constants) states[0] = variables[0]; } -void computeComputedConstants(double *computedConstants) +void computeComputedConstants(double *constants, double *computedConstants) { } diff --git a/tests/resources/generator/cellml_state_initialised_using_variable/model.h b/tests/resources/generator/cellml_state_initialised_using_variable/model.h index 8c3626ccd4..e95d12eb15 100644 --- a/tests/resources/generator/cellml_state_initialised_using_variable/model.h +++ b/tests/resources/generator/cellml_state_initialised_using_variable/model.h @@ -36,6 +36,6 @@ double * createVariablesArray(); void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *constants); -void computeComputedConstants(double *computedConstants); +void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/cellml_state_initialised_using_variable/model.py b/tests/resources/generator/cellml_state_initialised_using_variable/model.py index 3e187a3303..3a44c0f6a2 100644 --- a/tests/resources/generator/cellml_state_initialised_using_variable/model.py +++ b/tests/resources/generator/cellml_state_initialised_using_variable/model.py @@ -45,7 +45,7 @@ def initialise_variables(states, rates, constants): states[0] = variables[0] -def compute_computed_constants(computed_constants): +def compute_computed_constants(constants, computed_constants): pass diff --git a/tests/resources/generator/cellml_unit_scaling_constant/model.c b/tests/resources/generator/cellml_unit_scaling_constant/model.c index 263e235ef0..6f1761c466 100644 --- a/tests/resources/generator/cellml_unit_scaling_constant/model.c +++ b/tests/resources/generator/cellml_unit_scaling_constant/model.c @@ -39,7 +39,7 @@ void initialiseVariables(double *constants) variables[0] = 123.0; } -void computeComputedConstants(double *computedConstants) +void computeComputedConstants(double *constants, double *computedConstants) { variables[1] = variables[0]+variables[0]; variables[2] = 0.001*variables[0]+0.001*variables[0]; diff --git a/tests/resources/generator/cellml_unit_scaling_constant/model.h b/tests/resources/generator/cellml_unit_scaling_constant/model.h index c00e1f9991..435deb74f0 100644 --- a/tests/resources/generator/cellml_unit_scaling_constant/model.h +++ b/tests/resources/generator/cellml_unit_scaling_constant/model.h @@ -30,5 +30,5 @@ double * createVariablesArray(); void deleteArray(double *array); void initialiseVariables(double *constants); -void computeComputedConstants(double *computedConstants); +void computeComputedConstants(double *constants, double *computedConstants); void computeVariables(double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/cellml_unit_scaling_constant/model.py b/tests/resources/generator/cellml_unit_scaling_constant/model.py index 0225aaf9a3..fb52075278 100644 --- a/tests/resources/generator/cellml_unit_scaling_constant/model.py +++ b/tests/resources/generator/cellml_unit_scaling_constant/model.py @@ -33,7 +33,7 @@ def initialise_variables(constants): variables[0] = 123.0 -def compute_computed_constants(computed_constants): +def compute_computed_constants(constants, computed_constants): variables[1] = variables[0]+variables[0] variables[2] = 0.001*variables[0]+0.001*variables[0] diff --git a/tests/resources/generator/cellml_unit_scaling_rate/model.c b/tests/resources/generator/cellml_unit_scaling_rate/model.c index 34036c90a5..a9c2fae822 100644 --- a/tests/resources/generator/cellml_unit_scaling_rate/model.c +++ b/tests/resources/generator/cellml_unit_scaling_rate/model.c @@ -56,7 +56,7 @@ void initialiseVariables(double *states, double *rates, double *constants) states[0] = 123.0; } -void computeComputedConstants(double *computedConstants) +void computeComputedConstants(double *constants, double *computedConstants) { } diff --git a/tests/resources/generator/cellml_unit_scaling_rate/model.h b/tests/resources/generator/cellml_unit_scaling_rate/model.h index 8c3626ccd4..e95d12eb15 100644 --- a/tests/resources/generator/cellml_unit_scaling_rate/model.h +++ b/tests/resources/generator/cellml_unit_scaling_rate/model.h @@ -36,6 +36,6 @@ double * createVariablesArray(); void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *constants); -void computeComputedConstants(double *computedConstants); +void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/cellml_unit_scaling_rate/model.py b/tests/resources/generator/cellml_unit_scaling_rate/model.py index 758d11eb06..c709d5635e 100644 --- a/tests/resources/generator/cellml_unit_scaling_rate/model.py +++ b/tests/resources/generator/cellml_unit_scaling_rate/model.py @@ -45,7 +45,7 @@ def initialise_variables(states, rates, constants): states[0] = 123.0 -def compute_computed_constants(computed_constants): +def compute_computed_constants(constants, computed_constants): pass diff --git a/tests/resources/generator/cellml_unit_scaling_state/model.c b/tests/resources/generator/cellml_unit_scaling_state/model.c index 1237bfea4c..047b6b6b0c 100644 --- a/tests/resources/generator/cellml_unit_scaling_state/model.c +++ b/tests/resources/generator/cellml_unit_scaling_state/model.c @@ -56,7 +56,7 @@ void initialiseVariables(double *states, double *rates, double *constants) states[0] = 123.0; } -void computeComputedConstants(double *computedConstants) +void computeComputedConstants(double *constants, double *computedConstants) { } diff --git a/tests/resources/generator/cellml_unit_scaling_state/model.h b/tests/resources/generator/cellml_unit_scaling_state/model.h index 8c3626ccd4..e95d12eb15 100644 --- a/tests/resources/generator/cellml_unit_scaling_state/model.h +++ b/tests/resources/generator/cellml_unit_scaling_state/model.h @@ -36,6 +36,6 @@ double * createVariablesArray(); void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *constants); -void computeComputedConstants(double *computedConstants); +void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/cellml_unit_scaling_state/model.py b/tests/resources/generator/cellml_unit_scaling_state/model.py index 5587cbfc4b..429d096f15 100644 --- a/tests/resources/generator/cellml_unit_scaling_state/model.py +++ b/tests/resources/generator/cellml_unit_scaling_state/model.py @@ -45,7 +45,7 @@ def initialise_variables(states, rates, constants): states[0] = 123.0 -def compute_computed_constants(computed_constants): +def compute_computed_constants(constants, computed_constants): pass diff --git a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.c b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.c index 9a27a9d836..07c05c52ba 100644 --- a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.c +++ b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.c @@ -56,7 +56,7 @@ void initialiseVariables(double *states, double *rates, double *constants) states[1] = 0.001*789.0; } -void computeComputedConstants(double *computedConstants) +void computeComputedConstants(double *constants, double *computedConstants) { } diff --git a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.h b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.h index dd033a99a5..bd4dd923ef 100644 --- a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.h +++ b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.h @@ -36,6 +36,6 @@ double * createVariablesArray(); void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *constants); -void computeComputedConstants(double *computedConstants); +void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.py b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.py index 1f6f1d4ba7..e9a042ad14 100644 --- a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.py +++ b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.py @@ -45,7 +45,7 @@ def initialise_variables(states, rates, constants): states[1] = 0.001*789.0 -def compute_computed_constants(computed_constants): +def compute_computed_constants(constants, computed_constants): pass diff --git a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.c b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.c index 7b0c4b31fb..c3fadb3708 100644 --- a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.c +++ b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.c @@ -60,7 +60,7 @@ void initialiseVariables(double *states, double *rates, double *constants) states[1] = 0.001*variables[1]; } -void computeComputedConstants(double *computedConstants) +void computeComputedConstants(double *constants, double *computedConstants) { } diff --git a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.h b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.h index 973e179a41..fc9911e7e4 100644 --- a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.h +++ b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.h @@ -36,6 +36,6 @@ double * createVariablesArray(); void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *constants); -void computeComputedConstants(double *computedConstants); +void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.py b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.py index f036cd72f5..8b55cd0998 100644 --- a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.py +++ b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.py @@ -49,7 +49,7 @@ def initialise_variables(states, rates, constants): states[1] = 0.001*variables[1] -def compute_computed_constants(computed_constants): +def compute_computed_constants(constants, computed_constants): pass diff --git a/tests/resources/generator/cellml_unit_scaling_voi_direct/model.c b/tests/resources/generator/cellml_unit_scaling_voi_direct/model.c index f283bf9e3d..b2c6f6c846 100644 --- a/tests/resources/generator/cellml_unit_scaling_voi_direct/model.c +++ b/tests/resources/generator/cellml_unit_scaling_voi_direct/model.c @@ -56,7 +56,7 @@ void initialiseVariables(double *states, double *rates, double *constants) states[1] = 5.0; } -void computeComputedConstants(double *computedConstants) +void computeComputedConstants(double *constants, double *computedConstants) { } diff --git a/tests/resources/generator/cellml_unit_scaling_voi_direct/model.h b/tests/resources/generator/cellml_unit_scaling_voi_direct/model.h index a4444473cb..3f1fb63fd2 100644 --- a/tests/resources/generator/cellml_unit_scaling_voi_direct/model.h +++ b/tests/resources/generator/cellml_unit_scaling_voi_direct/model.h @@ -36,6 +36,6 @@ double * createVariablesArray(); void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *constants); -void computeComputedConstants(double *computedConstants); +void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/cellml_unit_scaling_voi_direct/model.py b/tests/resources/generator/cellml_unit_scaling_voi_direct/model.py index 01562a7bf6..e731c20634 100644 --- a/tests/resources/generator/cellml_unit_scaling_voi_direct/model.py +++ b/tests/resources/generator/cellml_unit_scaling_voi_direct/model.py @@ -45,7 +45,7 @@ def initialise_variables(states, rates, constants): states[1] = 5.0 -def compute_computed_constants(computed_constants): +def compute_computed_constants(constants, computed_constants): pass diff --git a/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.c b/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.c index 5235183501..7a603b2d4f 100644 --- a/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.c +++ b/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.c @@ -58,7 +58,7 @@ void initialiseVariables(double *states, double *rates, double *constants) states[2] = 11.0; } -void computeComputedConstants(double *computedConstants) +void computeComputedConstants(double *constants, double *computedConstants) { } diff --git a/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.h b/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.h index b79936bf98..123e68564c 100644 --- a/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.h +++ b/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.h @@ -36,6 +36,6 @@ double * createVariablesArray(); void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *constants); -void computeComputedConstants(double *computedConstants); +void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.py b/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.py index cdc67162d7..d0234d704c 100644 --- a/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.py +++ b/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.py @@ -47,7 +47,7 @@ def initialise_variables(states, rates, constants): states[2] = 11.0 -def compute_computed_constants(computed_constants): +def compute_computed_constants(constants, computed_constants): pass diff --git a/tests/resources/generator/dae_cellml_1_1_model/model.c b/tests/resources/generator/dae_cellml_1_1_model/model.c index 35ff65347a..b740b21726 100644 --- a/tests/resources/generator/dae_cellml_1_1_model/model.c +++ b/tests/resources/generator/dae_cellml_1_1_model/model.c @@ -131,7 +131,7 @@ void initialiseVariables(double *states, double *rates, double *constants) states[1] = 0.0; } -void computeComputedConstants(double *computedConstants) +void computeComputedConstants(double *constants, double *computedConstants) { } diff --git a/tests/resources/generator/dae_cellml_1_1_model/model.h b/tests/resources/generator/dae_cellml_1_1_model/model.h index 3b1c8ced6f..2bcb43579c 100644 --- a/tests/resources/generator/dae_cellml_1_1_model/model.h +++ b/tests/resources/generator/dae_cellml_1_1_model/model.h @@ -36,6 +36,6 @@ double * createVariablesArray(); void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *constants); -void computeComputedConstants(double *computedConstants); +void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/dae_cellml_1_1_model/model.py b/tests/resources/generator/dae_cellml_1_1_model/model.py index 463eee85fb..625f4fc243 100644 --- a/tests/resources/generator/dae_cellml_1_1_model/model.py +++ b/tests/resources/generator/dae_cellml_1_1_model/model.py @@ -107,7 +107,7 @@ def initialise_variables(states, rates, constants): states[1] = 0.0 -def compute_computed_constants(computed_constants): +def compute_computed_constants(constants, computed_constants): pass diff --git a/tests/resources/generator/dependent_eqns/model.c b/tests/resources/generator/dependent_eqns/model.c index c9fc847af5..438e961387 100644 --- a/tests/resources/generator/dependent_eqns/model.c +++ b/tests/resources/generator/dependent_eqns/model.c @@ -56,7 +56,7 @@ void initialiseVariables(double *states, double *rates, double *constants) states[0] = 0.0; } -void computeComputedConstants(double *computedConstants) +void computeComputedConstants(double *constants, double *computedConstants) { } diff --git a/tests/resources/generator/dependent_eqns/model.h b/tests/resources/generator/dependent_eqns/model.h index ebcf19ae6b..676c75fecd 100644 --- a/tests/resources/generator/dependent_eqns/model.h +++ b/tests/resources/generator/dependent_eqns/model.h @@ -36,6 +36,6 @@ double * createVariablesArray(); void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *constants); -void computeComputedConstants(double *computedConstants); +void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/dependent_eqns/model.py b/tests/resources/generator/dependent_eqns/model.py index f8022992a5..93fe0440b5 100644 --- a/tests/resources/generator/dependent_eqns/model.py +++ b/tests/resources/generator/dependent_eqns/model.py @@ -45,7 +45,7 @@ def initialise_variables(states, rates, constants): states[0] = 0.0 -def compute_computed_constants(computed_constants): +def compute_computed_constants(constants, computed_constants): pass diff --git a/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.c b/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.c index b9184e3929..041796f933 100644 --- a/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.c +++ b/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.c @@ -426,7 +426,7 @@ void initialiseVariables(double *states, double *rates, double *constants) states[32] = 0.00277; } -void computeComputedConstants(double *computedConstants) +void computeComputedConstants(double *constants, double *computedConstants) { variables[3] = variables[119]*variables[120]/variables[17]; variables[6] = variables[3]*log(variables[7]/variables[8]); diff --git a/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.h b/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.h index 812d0c653d..e94e9dec00 100644 --- a/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.h +++ b/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.h @@ -36,6 +36,6 @@ double * createVariablesArray(); void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *constants); -void computeComputedConstants(double *computedConstants); +void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.py b/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.py index 6544494254..c325595498 100644 --- a/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.py +++ b/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.py @@ -435,7 +435,7 @@ def initialise_variables(states, rates, constants): states[32] = 0.00277 -def compute_computed_constants(computed_constants): +def compute_computed_constants(constants, computed_constants): variables[3] = variables[119]*variables[120]/variables[17] variables[6] = variables[3]*log(variables[7]/variables[8]) variables[20] = 1.2 if gt_func(variables[1], 0.0) else 1.0 diff --git a/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.c b/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.c index 27fc1673af..19eb9ce0b7 100644 --- a/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.c +++ b/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.c @@ -377,7 +377,7 @@ void initialiseVariables(double *states, double *rates, double *constants) states[14] = 0.03889291759; } -void computeComputedConstants(double *computedConstants) +void computeComputedConstants(double *constants, double *computedConstants) { variables[0] = (variables[2] == 0.0)?1.07*(3.0*variables[1]-0.1)/(3.0*(1.0+0.7745*exp(-(3.0*variables[1]-2.05)/0.295))):(variables[2] == 1.0)?variables[3]*variables[1]/(1.0+0.7745*exp(-(3.0*variables[1]-2.05)/0.295)):1.07*29.0*variables[1]/(30.0*(1.0+0.7745*exp(-(29.0*variables[1]-24.5)/1.95))); variables[4] = variables[5]+variables[0]*(variables[6]-variables[5]); diff --git a/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.h b/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.h index d709dca8d5..2715ae2d90 100644 --- a/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.h +++ b/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.h @@ -36,6 +36,6 @@ double * createVariablesArray(); void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *constants); -void computeComputedConstants(double *computedConstants); +void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.py b/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.py index 180b55d8bb..2244f1dc91 100644 --- a/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.py +++ b/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.py @@ -374,7 +374,7 @@ def initialise_variables(states, rates, constants): states[14] = 0.03889291759 -def compute_computed_constants(computed_constants): +def compute_computed_constants(constants, computed_constants): variables[0] = 1.07*(3.0*variables[1]-0.1)/(3.0*(1.0+0.7745*exp(-(3.0*variables[1]-2.05)/0.295))) if eq_func(variables[2], 0.0) else variables[3]*variables[1]/(1.0+0.7745*exp(-(3.0*variables[1]-2.05)/0.295)) if eq_func(variables[2], 1.0) else 1.07*29.0*variables[1]/(30.0*(1.0+0.7745*exp(-(29.0*variables[1]-24.5)/1.95))) variables[4] = variables[5]+variables[0]*(variables[6]-variables[5]) variables[25] = variables[26]+variables[0]*(variables[27]-variables[26]) if eq_func(variables[2], 0.0) else variables[30]+variables[0]*(variables[31]-variables[30]) if eq_func(variables[2], 1.0) else variables[28]+variables[0]*(variables[29]-variables[28]) diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.c index c6af41ab99..fcdfb29719 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.c @@ -84,7 +84,7 @@ void initialiseVariables(double voi, double *states, double *rates, double *cons variables[0] = externalVariable(voi, states, rates, variables, 0); } -void computeComputedConstants(double *computedConstants) +void computeComputedConstants(double *constants, double *computedConstants) { variables[6] = variables[5]-10.613; variables[8] = variables[5]-115.0; diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.h index d621ba0e69..3435c028a3 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.h +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.h @@ -39,6 +39,6 @@ void deleteArray(double *array); typedef double (* ExternalVariable)(double voi, double *states, double *rates, double *variables, size_t index); void initialiseVariables(double voi, double *states, double *rates, double *constants, ExternalVariable externalVariable); -void computeComputedConstants(double *computedConstants); +void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.py index f8a6f44c99..c067ca185e 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.py @@ -86,7 +86,7 @@ def initialise_variables(voi, states, rates, constants, external_variable): variables[0] = external_variable(voi, states, rates, variables, 0) -def compute_computed_constants(computed_constants): +def compute_computed_constants(constants, computed_constants): variables[6] = variables[5]-10.613 variables[8] = variables[5]-115.0 variables[14] = variables[5]+12.0 diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.c index df2a57cad8..4b94c1415a 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.c @@ -83,7 +83,7 @@ void initialiseVariables(double *states, double *rates, double *constants) states[3] = 0.325; } -void computeComputedConstants(double *computedConstants) +void computeComputedConstants(double *constants, double *computedConstants) { variables[6] = variables[5]-10.613; variables[8] = variables[5]-115.0; diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.c index cb64823725..68d2fa006a 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.c @@ -84,7 +84,7 @@ void initialiseVariables(double voi, double *states, double *rates, double *cons variables[6] = externalVariable(voi, states, rates, variables, 6); } -void computeComputedConstants(double *computedConstants) +void computeComputedConstants(double *constants, double *computedConstants) { variables[8] = variables[5]-115.0; variables[14] = variables[5]+12.0; diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.h index d621ba0e69..3435c028a3 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.h +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.h @@ -39,6 +39,6 @@ void deleteArray(double *array); typedef double (* ExternalVariable)(double voi, double *states, double *rates, double *variables, size_t index); void initialiseVariables(double voi, double *states, double *rates, double *constants, ExternalVariable externalVariable); -void computeComputedConstants(double *computedConstants); +void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.py index 03186b1653..f903b7fc62 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.py @@ -86,7 +86,7 @@ def initialise_variables(voi, states, rates, constants, external_variable): variables[6] = external_variable(voi, states, rates, variables, 6) -def compute_computed_constants(computed_constants): +def compute_computed_constants(constants, computed_constants): variables[8] = variables[5]-115.0 variables[14] = variables[5]+12.0 diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.c index b87f3589f1..14a7b75c4e 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.c @@ -83,7 +83,7 @@ void initialiseVariables(double voi, double *states, double *rates, double *cons variables[4] = externalVariable(voi, states, rates, variables, 4); } -void computeComputedConstants(double *computedConstants) +void computeComputedConstants(double *constants, double *computedConstants) { variables[6] = variables[5]-10.613; variables[8] = variables[5]-115.0; diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.h index d621ba0e69..3435c028a3 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.h +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.h @@ -39,6 +39,6 @@ void deleteArray(double *array); typedef double (* ExternalVariable)(double voi, double *states, double *rates, double *variables, size_t index); void initialiseVariables(double voi, double *states, double *rates, double *constants, ExternalVariable externalVariable); -void computeComputedConstants(double *computedConstants); +void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.py index 47b39189c8..5286f429de 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.py @@ -85,7 +85,7 @@ def initialise_variables(voi, states, rates, constants, external_variable): variables[4] = external_variable(voi, states, rates, variables, 4) -def compute_computed_constants(computed_constants): +def compute_computed_constants(constants, computed_constants): variables[6] = variables[5]-10.613 variables[8] = variables[5]-115.0 variables[14] = variables[5]+12.0 diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.c index eec3389de2..ed19fae664 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.c @@ -518,7 +518,7 @@ void initialiseVariables(double *states, double *rates, double *constants) rates[3] = 0.0; } -void computeComputedConstants(double *computedConstants) +void computeComputedConstants(double *constants, double *computedConstants) { } diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.h index 1090a6d03a..2379ada7dc 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.h +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.h @@ -36,6 +36,6 @@ double * createVariablesArray(); void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *constants); -void computeComputedConstants(double *computedConstants); +void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.py index 110c926fb0..a0fd9eb41c 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.py @@ -461,7 +461,7 @@ def initialise_variables(states, rates, constants): rates[3] = 0.0 -def compute_computed_constants(computed_constants): +def compute_computed_constants(constants, computed_constants): pass diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.c index 3abf7d45a3..dd14ced271 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.c @@ -85,7 +85,7 @@ void initialiseVariables(double voi, double *states, double *rates, double *cons variables[0] = externalVariable(voi, states, rates, variables, 0); } -void computeComputedConstants(double *computedConstants) +void computeComputedConstants(double *constants, double *computedConstants) { variables[6] = variables[5]-10.613; variables[8] = variables[5]-115.0; diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.h index d621ba0e69..3435c028a3 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.h +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.h @@ -39,6 +39,6 @@ void deleteArray(double *array); typedef double (* ExternalVariable)(double voi, double *states, double *rates, double *variables, size_t index); void initialiseVariables(double voi, double *states, double *rates, double *constants, ExternalVariable externalVariable); -void computeComputedConstants(double *computedConstants); +void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.py index 2ca6db1899..8de578a33e 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.py @@ -87,7 +87,7 @@ def initialise_variables(voi, states, rates, constants, external_variable): variables[0] = external_variable(voi, states, rates, variables, 0) -def compute_computed_constants(computed_constants): +def compute_computed_constants(constants, computed_constants): variables[6] = variables[5]-10.613 variables[8] = variables[5]-115.0 variables[14] = variables[5]+12.0 diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.c index 13087c293d..a28677e4a2 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.c @@ -84,7 +84,7 @@ void initialiseVariables(double voi, double *states, double *rates, double *cons variables[5] = externalVariable(voi, states, rates, variables, 5); } -void computeComputedConstants(double *computedConstants) +void computeComputedConstants(double *constants, double *computedConstants) { } diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.h index d621ba0e69..3435c028a3 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.h +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.h @@ -39,6 +39,6 @@ void deleteArray(double *array); typedef double (* ExternalVariable)(double voi, double *states, double *rates, double *variables, size_t index); void initialiseVariables(double voi, double *states, double *rates, double *constants, ExternalVariable externalVariable); -void computeComputedConstants(double *computedConstants); +void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.py index 2b2d655ac8..bf9243f141 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.py @@ -86,7 +86,7 @@ def initialise_variables(voi, states, rates, constants, external_variable): variables[5] = external_variable(voi, states, rates, variables, 5) -def compute_computed_constants(computed_constants): +def compute_computed_constants(constants, computed_constants): pass diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.c index 93afb3d88e..ab3a49ebbf 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.c @@ -83,7 +83,7 @@ void initialiseVariables(double voi, double *states, double *rates, double *cons variables[4] = externalVariable(voi, states, rates, variables, 4); } -void computeComputedConstants(double *computedConstants) +void computeComputedConstants(double *constants, double *computedConstants) { variables[6] = variables[5]-10.613; variables[8] = variables[5]-115.0; diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.h index d621ba0e69..3435c028a3 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.h +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.h @@ -39,6 +39,6 @@ void deleteArray(double *array); typedef double (* ExternalVariable)(double voi, double *states, double *rates, double *variables, size_t index); void initialiseVariables(double voi, double *states, double *rates, double *constants, ExternalVariable externalVariable); -void computeComputedConstants(double *computedConstants); +void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.py index c47a5f3ed0..bab665d5c1 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.py @@ -85,7 +85,7 @@ def initialise_variables(voi, states, rates, constants, external_variable): variables[4] = external_variable(voi, states, rates, variables, 4) -def compute_computed_constants(computed_constants): +def compute_computed_constants(constants, computed_constants): variables[6] = variables[5]-10.613 variables[8] = variables[5]-115.0 variables[14] = variables[5]+12.0 diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.c index 47ff51ec85..e23e1ca94e 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.c @@ -83,7 +83,7 @@ void initialiseVariables(double voi, double *states, double *rates, double *cons variables[11] = externalVariable(voi, states, rates, variables, 11); } -void computeComputedConstants(double *computedConstants) +void computeComputedConstants(double *constants, double *computedConstants) { variables[7] = variables[6]-10.613; variables[9] = variables[6]-115.0; diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.h index d621ba0e69..3435c028a3 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.h +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.h @@ -39,6 +39,6 @@ void deleteArray(double *array); typedef double (* ExternalVariable)(double voi, double *states, double *rates, double *variables, size_t index); void initialiseVariables(double voi, double *states, double *rates, double *constants, ExternalVariable externalVariable); -void computeComputedConstants(double *computedConstants); +void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.py index 72b212b898..630415b7ff 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.py @@ -85,7 +85,7 @@ def initialise_variables(voi, states, rates, constants, external_variable): variables[11] = external_variable(voi, states, rates, variables, 11) -def compute_computed_constants(computed_constants): +def compute_computed_constants(constants, computed_constants): variables[7] = variables[6]-10.613 variables[9] = variables[6]-115.0 variables[16] = variables[6]+12.0 diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.c index f936897d54..25cd348f14 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.c @@ -85,7 +85,7 @@ void initialiseVariables(double voi, double *states, double *rates, double *cons variables[4] = externalVariable(voi, states, rates, variables, 4); } -void computeComputedConstants(double *computedConstants) +void computeComputedConstants(double *constants, double *computedConstants) { variables[7] = variables[6]-10.613; variables[9] = variables[6]-115.0; diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.h index d621ba0e69..3435c028a3 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.h +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.h @@ -39,6 +39,6 @@ void deleteArray(double *array); typedef double (* ExternalVariable)(double voi, double *states, double *rates, double *variables, size_t index); void initialiseVariables(double voi, double *states, double *rates, double *constants, ExternalVariable externalVariable); -void computeComputedConstants(double *computedConstants); +void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.py index 6b77efdbc9..c26899b7b7 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.py @@ -87,7 +87,7 @@ def initialise_variables(voi, states, rates, constants, external_variable): variables[4] = external_variable(voi, states, rates, variables, 4) -def compute_computed_constants(computed_constants): +def compute_computed_constants(constants, computed_constants): variables[7] = variables[6]-10.613 variables[9] = variables[6]-115.0 variables[15] = variables[6]+12.0 diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.h index 1090a6d03a..2379ada7dc 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.h +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.h @@ -36,6 +36,6 @@ double * createVariablesArray(); void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *constants); -void computeComputedConstants(double *computedConstants); +void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.py index 6c0ce45df5..b673cc0506 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.py @@ -84,7 +84,7 @@ def initialise_variables(states, rates, constants): states[3] = 0.325 -def compute_computed_constants(computed_constants): +def compute_computed_constants(constants, computed_constants): variables[6] = variables[5]-10.613 variables[8] = variables[5]-115.0 variables[14] = variables[5]+12.0 diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.c index ed301760a5..d9c4329a9b 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.c @@ -83,7 +83,7 @@ void initialiseVariables(double voi, double *states, double *rates, double *cons variables[10] = externalVariable(voi, states, rates, variables, 10); } -void computeComputedConstants(double *computedConstants) +void computeComputedConstants(double *constants, double *computedConstants) { variables[6] = variables[5]-10.613; variables[8] = variables[5]-115.0; diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.h index d621ba0e69..3435c028a3 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.h +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.h @@ -39,6 +39,6 @@ void deleteArray(double *array); typedef double (* ExternalVariable)(double voi, double *states, double *rates, double *variables, size_t index); void initialiseVariables(double voi, double *states, double *rates, double *constants, ExternalVariable externalVariable); -void computeComputedConstants(double *computedConstants); +void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.py index e110f1e761..12843733b8 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.py @@ -85,7 +85,7 @@ def initialise_variables(voi, states, rates, constants, external_variable): variables[10] = external_variable(voi, states, rates, variables, 10) -def compute_computed_constants(computed_constants): +def compute_computed_constants(constants, computed_constants): variables[6] = variables[5]-10.613 variables[8] = variables[5]-115.0 variables[15] = variables[5]+12.0 diff --git a/tests/resources/generator/noble_model_1962/model.c b/tests/resources/generator/noble_model_1962/model.c index 1029459d28..7f27f8e50c 100644 --- a/tests/resources/generator/noble_model_1962/model.c +++ b/tests/resources/generator/noble_model_1962/model.c @@ -82,7 +82,7 @@ void initialiseVariables(double *states, double *rates, double *constants) states[3] = 0.01; } -void computeComputedConstants(double *computedConstants) +void computeComputedConstants(double *constants, double *computedConstants) { } diff --git a/tests/resources/generator/noble_model_1962/model.h b/tests/resources/generator/noble_model_1962/model.h index 10555c8038..a4c365da25 100644 --- a/tests/resources/generator/noble_model_1962/model.h +++ b/tests/resources/generator/noble_model_1962/model.h @@ -36,6 +36,6 @@ double * createVariablesArray(); void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *constants); -void computeComputedConstants(double *computedConstants); +void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/noble_model_1962/model.py b/tests/resources/generator/noble_model_1962/model.py index 1d18b097ac..59f41a51e4 100644 --- a/tests/resources/generator/noble_model_1962/model.py +++ b/tests/resources/generator/noble_model_1962/model.py @@ -71,7 +71,7 @@ def initialise_variables(states, rates, constants): states[3] = 0.01 -def compute_computed_constants(computed_constants): +def compute_computed_constants(constants, computed_constants): pass diff --git a/tests/resources/generator/ode_computed_var_on_rhs/model.c b/tests/resources/generator/ode_computed_var_on_rhs/model.c index 621132fc1e..481cfdefb2 100644 --- a/tests/resources/generator/ode_computed_var_on_rhs/model.c +++ b/tests/resources/generator/ode_computed_var_on_rhs/model.c @@ -56,7 +56,7 @@ void initialiseVariables(double *states, double *rates, double *constants) states[0] = 1.0; } -void computeComputedConstants(double *computedConstants) +void computeComputedConstants(double *constants, double *computedConstants) { } diff --git a/tests/resources/generator/ode_computed_var_on_rhs/model.h b/tests/resources/generator/ode_computed_var_on_rhs/model.h index a4444473cb..3f1fb63fd2 100644 --- a/tests/resources/generator/ode_computed_var_on_rhs/model.h +++ b/tests/resources/generator/ode_computed_var_on_rhs/model.h @@ -36,6 +36,6 @@ double * createVariablesArray(); void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *constants); -void computeComputedConstants(double *computedConstants); +void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/ode_computed_var_on_rhs/model.py b/tests/resources/generator/ode_computed_var_on_rhs/model.py index 906bdb3f80..477fed9dc0 100644 --- a/tests/resources/generator/ode_computed_var_on_rhs/model.py +++ b/tests/resources/generator/ode_computed_var_on_rhs/model.py @@ -45,7 +45,7 @@ def initialise_variables(states, rates, constants): states[0] = 1.0 -def compute_computed_constants(computed_constants): +def compute_computed_constants(constants, computed_constants): pass diff --git a/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.c b/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.c index 48b06bdb45..8c739e6a78 100644 --- a/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.c +++ b/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.c @@ -56,7 +56,7 @@ void initialiseVariables(double *states, double *rates, double *constants) states[0] = 1.0; } -void computeComputedConstants(double *computedConstants) +void computeComputedConstants(double *constants, double *computedConstants) { } diff --git a/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.h b/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.h index 94a64dfa85..ca79cc5f25 100644 --- a/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.h +++ b/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.h @@ -36,6 +36,6 @@ double * createVariablesArray(); void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *constants); -void computeComputedConstants(double *computedConstants); +void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.py b/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.py index 1ddea11e38..89a6e82dc5 100644 --- a/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.py +++ b/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.py @@ -45,7 +45,7 @@ def initialise_variables(states, rates, constants): states[0] = 1.0 -def compute_computed_constants(computed_constants): +def compute_computed_constants(constants, computed_constants): pass diff --git a/tests/resources/generator/ode_const_var_on_rhs/model.c b/tests/resources/generator/ode_const_var_on_rhs/model.c index 8f42444b87..e6f4a2f112 100644 --- a/tests/resources/generator/ode_const_var_on_rhs/model.c +++ b/tests/resources/generator/ode_const_var_on_rhs/model.c @@ -56,7 +56,7 @@ void initialiseVariables(double *states, double *rates, double *constants) states[0] = 1.0; } -void computeComputedConstants(double *computedConstants) +void computeComputedConstants(double *constants, double *computedConstants) { } diff --git a/tests/resources/generator/ode_const_var_on_rhs/model.h b/tests/resources/generator/ode_const_var_on_rhs/model.h index a4444473cb..3f1fb63fd2 100644 --- a/tests/resources/generator/ode_const_var_on_rhs/model.h +++ b/tests/resources/generator/ode_const_var_on_rhs/model.h @@ -36,6 +36,6 @@ double * createVariablesArray(); void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *constants); -void computeComputedConstants(double *computedConstants); +void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/ode_const_var_on_rhs/model.py b/tests/resources/generator/ode_const_var_on_rhs/model.py index 2d88bb4b27..7b30f60790 100644 --- a/tests/resources/generator/ode_const_var_on_rhs/model.py +++ b/tests/resources/generator/ode_const_var_on_rhs/model.py @@ -45,7 +45,7 @@ def initialise_variables(states, rates, constants): states[0] = 1.0 -def compute_computed_constants(computed_constants): +def compute_computed_constants(constants, computed_constants): pass diff --git a/tests/resources/generator/ode_const_var_on_rhs_one_component/model.c b/tests/resources/generator/ode_const_var_on_rhs_one_component/model.c index 7a5d402071..0b197f7ece 100644 --- a/tests/resources/generator/ode_const_var_on_rhs_one_component/model.c +++ b/tests/resources/generator/ode_const_var_on_rhs_one_component/model.c @@ -56,7 +56,7 @@ void initialiseVariables(double *states, double *rates, double *constants) states[0] = 1.0; } -void computeComputedConstants(double *computedConstants) +void computeComputedConstants(double *constants, double *computedConstants) { } diff --git a/tests/resources/generator/ode_const_var_on_rhs_one_component/model.h b/tests/resources/generator/ode_const_var_on_rhs_one_component/model.h index 94a64dfa85..ca79cc5f25 100644 --- a/tests/resources/generator/ode_const_var_on_rhs_one_component/model.h +++ b/tests/resources/generator/ode_const_var_on_rhs_one_component/model.h @@ -36,6 +36,6 @@ double * createVariablesArray(); void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *constants); -void computeComputedConstants(double *computedConstants); +void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/ode_const_var_on_rhs_one_component/model.py b/tests/resources/generator/ode_const_var_on_rhs_one_component/model.py index 78fbcf40b9..ef811ed30c 100644 --- a/tests/resources/generator/ode_const_var_on_rhs_one_component/model.py +++ b/tests/resources/generator/ode_const_var_on_rhs_one_component/model.py @@ -45,7 +45,7 @@ def initialise_variables(states, rates, constants): states[0] = 1.0 -def compute_computed_constants(computed_constants): +def compute_computed_constants(constants, computed_constants): pass diff --git a/tests/resources/generator/ode_constant_on_rhs/model.c b/tests/resources/generator/ode_constant_on_rhs/model.c index a6d0ec5dc6..800b77cfa4 100644 --- a/tests/resources/generator/ode_constant_on_rhs/model.c +++ b/tests/resources/generator/ode_constant_on_rhs/model.c @@ -54,7 +54,7 @@ void initialiseVariables(double *states, double *rates, double *constants) states[0] = 1.0; } -void computeComputedConstants(double *computedConstants) +void computeComputedConstants(double *constants, double *computedConstants) { } diff --git a/tests/resources/generator/ode_constant_on_rhs/model.h b/tests/resources/generator/ode_constant_on_rhs/model.h index a4444473cb..3f1fb63fd2 100644 --- a/tests/resources/generator/ode_constant_on_rhs/model.h +++ b/tests/resources/generator/ode_constant_on_rhs/model.h @@ -36,6 +36,6 @@ double * createVariablesArray(); void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *constants); -void computeComputedConstants(double *computedConstants); +void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/ode_constant_on_rhs/model.py b/tests/resources/generator/ode_constant_on_rhs/model.py index 206392ff3a..d1a6f8b8d8 100644 --- a/tests/resources/generator/ode_constant_on_rhs/model.py +++ b/tests/resources/generator/ode_constant_on_rhs/model.py @@ -43,7 +43,7 @@ def initialise_variables(states, rates, constants): states[0] = 1.0 -def compute_computed_constants(computed_constants): +def compute_computed_constants(constants, computed_constants): pass diff --git a/tests/resources/generator/ode_constant_on_rhs_one_component/model.c b/tests/resources/generator/ode_constant_on_rhs_one_component/model.c index 2c479d28d8..206912326b 100644 --- a/tests/resources/generator/ode_constant_on_rhs_one_component/model.c +++ b/tests/resources/generator/ode_constant_on_rhs_one_component/model.c @@ -54,7 +54,7 @@ void initialiseVariables(double *states, double *rates, double *constants) states[0] = 1.0; } -void computeComputedConstants(double *computedConstants) +void computeComputedConstants(double *constants, double *computedConstants) { } diff --git a/tests/resources/generator/ode_constant_on_rhs_one_component/model.h b/tests/resources/generator/ode_constant_on_rhs_one_component/model.h index 94a64dfa85..ca79cc5f25 100644 --- a/tests/resources/generator/ode_constant_on_rhs_one_component/model.h +++ b/tests/resources/generator/ode_constant_on_rhs_one_component/model.h @@ -36,6 +36,6 @@ double * createVariablesArray(); void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *constants); -void computeComputedConstants(double *computedConstants); +void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/ode_constant_on_rhs_one_component/model.py b/tests/resources/generator/ode_constant_on_rhs_one_component/model.py index ee87c9c26d..6fe4f8a160 100644 --- a/tests/resources/generator/ode_constant_on_rhs_one_component/model.py +++ b/tests/resources/generator/ode_constant_on_rhs_one_component/model.py @@ -43,7 +43,7 @@ def initialise_variables(states, rates, constants): states[0] = 1.0 -def compute_computed_constants(computed_constants): +def compute_computed_constants(constants, computed_constants): pass diff --git a/tests/resources/generator/ode_multiple_dependent_odes/model.c b/tests/resources/generator/ode_multiple_dependent_odes/model.c index 5a14fd1ca8..9e73023fac 100644 --- a/tests/resources/generator/ode_multiple_dependent_odes/model.c +++ b/tests/resources/generator/ode_multiple_dependent_odes/model.c @@ -58,7 +58,7 @@ void initialiseVariables(double *states, double *rates, double *constants) states[1] = 0.0; } -void computeComputedConstants(double *computedConstants) +void computeComputedConstants(double *constants, double *computedConstants) { } diff --git a/tests/resources/generator/ode_multiple_dependent_odes/model.h b/tests/resources/generator/ode_multiple_dependent_odes/model.h index 1653e2e605..cc74aaa0bd 100644 --- a/tests/resources/generator/ode_multiple_dependent_odes/model.h +++ b/tests/resources/generator/ode_multiple_dependent_odes/model.h @@ -36,6 +36,6 @@ double * createVariablesArray(); void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *constants); -void computeComputedConstants(double *computedConstants); +void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/ode_multiple_dependent_odes/model.py b/tests/resources/generator/ode_multiple_dependent_odes/model.py index 6e3ba6e67a..4bac6fe0c9 100644 --- a/tests/resources/generator/ode_multiple_dependent_odes/model.py +++ b/tests/resources/generator/ode_multiple_dependent_odes/model.py @@ -47,7 +47,7 @@ def initialise_variables(states, rates, constants): states[1] = 0.0 -def compute_computed_constants(computed_constants): +def compute_computed_constants(constants, computed_constants): pass diff --git a/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.c b/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.c index 1aedd5274d..907009cd77 100644 --- a/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.c +++ b/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.c @@ -58,7 +58,7 @@ void initialiseVariables(double *states, double *rates, double *constants) states[1] = 0.0; } -void computeComputedConstants(double *computedConstants) +void computeComputedConstants(double *constants, double *computedConstants) { } diff --git a/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.h b/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.h index b26a181c2e..f0d48d38d5 100644 --- a/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.h +++ b/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.h @@ -36,6 +36,6 @@ double * createVariablesArray(); void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *constants); -void computeComputedConstants(double *computedConstants); +void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.py b/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.py index 9f48dedb90..68fce403bc 100644 --- a/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.py +++ b/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.py @@ -47,7 +47,7 @@ def initialise_variables(states, rates, constants): states[1] = 0.0 -def compute_computed_constants(computed_constants): +def compute_computed_constants(constants, computed_constants): pass diff --git a/tests/resources/generator/ode_multiple_odes_with_same_name/model.c b/tests/resources/generator/ode_multiple_odes_with_same_name/model.c index 0ecc275fcc..c53a5bce72 100644 --- a/tests/resources/generator/ode_multiple_odes_with_same_name/model.c +++ b/tests/resources/generator/ode_multiple_odes_with_same_name/model.c @@ -58,7 +58,7 @@ void initialiseVariables(double *states, double *rates, double *constants) states[1] = 1.0; } -void computeComputedConstants(double *computedConstants) +void computeComputedConstants(double *constants, double *computedConstants) { } diff --git a/tests/resources/generator/ode_multiple_odes_with_same_name/model.h b/tests/resources/generator/ode_multiple_odes_with_same_name/model.h index 9ef0b6b75e..0b0953abe2 100644 --- a/tests/resources/generator/ode_multiple_odes_with_same_name/model.h +++ b/tests/resources/generator/ode_multiple_odes_with_same_name/model.h @@ -36,6 +36,6 @@ double * createVariablesArray(); void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *constants); -void computeComputedConstants(double *computedConstants); +void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/ode_multiple_odes_with_same_name/model.py b/tests/resources/generator/ode_multiple_odes_with_same_name/model.py index 3b68bcdfda..0d631115b9 100644 --- a/tests/resources/generator/ode_multiple_odes_with_same_name/model.py +++ b/tests/resources/generator/ode_multiple_odes_with_same_name/model.py @@ -47,7 +47,7 @@ def initialise_variables(states, rates, constants): states[1] = 1.0 -def compute_computed_constants(computed_constants): +def compute_computed_constants(constants, computed_constants): pass diff --git a/tests/resources/generator/ode_unknown_var_on_rhs/model.c b/tests/resources/generator/ode_unknown_var_on_rhs/model.c index 90dde15f73..ed4e72be1f 100644 --- a/tests/resources/generator/ode_unknown_var_on_rhs/model.c +++ b/tests/resources/generator/ode_unknown_var_on_rhs/model.c @@ -56,7 +56,7 @@ void initialiseVariables(double *states, double *rates, double *constants) states[1] = 1.0; } -void computeComputedConstants(double *computedConstants) +void computeComputedConstants(double *constants, double *computedConstants) { } diff --git a/tests/resources/generator/ode_unknown_var_on_rhs/model.h b/tests/resources/generator/ode_unknown_var_on_rhs/model.h index a4444473cb..3f1fb63fd2 100644 --- a/tests/resources/generator/ode_unknown_var_on_rhs/model.h +++ b/tests/resources/generator/ode_unknown_var_on_rhs/model.h @@ -36,6 +36,6 @@ double * createVariablesArray(); void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *constants); -void computeComputedConstants(double *computedConstants); +void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/ode_unknown_var_on_rhs/model.py b/tests/resources/generator/ode_unknown_var_on_rhs/model.py index aaaa0e9474..29380da06b 100644 --- a/tests/resources/generator/ode_unknown_var_on_rhs/model.py +++ b/tests/resources/generator/ode_unknown_var_on_rhs/model.py @@ -45,7 +45,7 @@ def initialise_variables(states, rates, constants): states[1] = 1.0 -def compute_computed_constants(computed_constants): +def compute_computed_constants(constants, computed_constants): pass diff --git a/tests/resources/generator/robertson_model_1966/model.dae.c b/tests/resources/generator/robertson_model_1966/model.dae.c index d0edf14b0f..6e6df43ac4 100644 --- a/tests/resources/generator/robertson_model_1966/model.dae.c +++ b/tests/resources/generator/robertson_model_1966/model.dae.c @@ -99,7 +99,7 @@ void initialiseVariables(double *states, double *rates, double *constants) states[1] = 0.0; } -void computeComputedConstants(double *computedConstants) +void computeComputedConstants(double *constants, double *computedConstants) { } diff --git a/tests/resources/generator/robertson_model_1966/model.dae.h b/tests/resources/generator/robertson_model_1966/model.dae.h index 9e43acde31..bca2cef3a4 100644 --- a/tests/resources/generator/robertson_model_1966/model.dae.h +++ b/tests/resources/generator/robertson_model_1966/model.dae.h @@ -36,6 +36,6 @@ double * createVariablesArray(); void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *constants); -void computeComputedConstants(double *computedConstants); +void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/robertson_model_1966/model.dae.py b/tests/resources/generator/robertson_model_1966/model.dae.py index 147a5f9f15..5094b58a6e 100644 --- a/tests/resources/generator/robertson_model_1966/model.dae.py +++ b/tests/resources/generator/robertson_model_1966/model.dae.py @@ -78,7 +78,7 @@ def initialise_variables(states, rates, constants): states[1] = 0.0 -def compute_computed_constants(computed_constants): +def compute_computed_constants(constants, computed_constants): pass diff --git a/tests/resources/generator/robertson_model_1966/model.ode.c b/tests/resources/generator/robertson_model_1966/model.ode.c index 8ef049b2ab..7c916a7deb 100644 --- a/tests/resources/generator/robertson_model_1966/model.ode.c +++ b/tests/resources/generator/robertson_model_1966/model.ode.c @@ -65,7 +65,7 @@ void initialiseVariables(double *states, double *rates, double *constants) states[2] = 0.0; } -void computeComputedConstants(double *computedConstants) +void computeComputedConstants(double *constants, double *computedConstants) { } diff --git a/tests/resources/generator/robertson_model_1966/model.ode.h b/tests/resources/generator/robertson_model_1966/model.ode.h index 9e43acde31..bca2cef3a4 100644 --- a/tests/resources/generator/robertson_model_1966/model.ode.h +++ b/tests/resources/generator/robertson_model_1966/model.ode.h @@ -36,6 +36,6 @@ double * createVariablesArray(); void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *constants); -void computeComputedConstants(double *computedConstants); +void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/robertson_model_1966/model.ode.py b/tests/resources/generator/robertson_model_1966/model.ode.py index 16be8a4e3f..e5ed01a6c6 100644 --- a/tests/resources/generator/robertson_model_1966/model.ode.py +++ b/tests/resources/generator/robertson_model_1966/model.ode.py @@ -54,7 +54,7 @@ def initialise_variables(states, rates, constants): states[2] = 0.0 -def compute_computed_constants(computed_constants): +def compute_computed_constants(constants, computed_constants): pass diff --git a/tests/resources/generator/sine_model_imports/model.c b/tests/resources/generator/sine_model_imports/model.c index e81c50d4de..e2c69b5096 100644 --- a/tests/resources/generator/sine_model_imports/model.c +++ b/tests/resources/generator/sine_model_imports/model.c @@ -71,7 +71,7 @@ void initialiseVariables(double *states, double *rates, double *constants) states[0] = variables[1]; } -void computeComputedConstants(double *computedConstants) +void computeComputedConstants(double *constants, double *computedConstants) { } diff --git a/tests/resources/generator/sine_model_imports/model.h b/tests/resources/generator/sine_model_imports/model.h index d1e57debea..93c965f336 100644 --- a/tests/resources/generator/sine_model_imports/model.h +++ b/tests/resources/generator/sine_model_imports/model.h @@ -36,6 +36,6 @@ double * createVariablesArray(); void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *constants); -void computeComputedConstants(double *computedConstants); +void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/sine_model_imports/model.py b/tests/resources/generator/sine_model_imports/model.py index d4551dbb90..d39e9cfac3 100644 --- a/tests/resources/generator/sine_model_imports/model.py +++ b/tests/resources/generator/sine_model_imports/model.py @@ -64,7 +64,7 @@ def initialise_variables(states, rates, constants): states[0] = variables[1] -def compute_computed_constants(computed_constants): +def compute_computed_constants(constants, computed_constants): pass diff --git a/tests/resources/generator/unknown_variable_as_external_variable/model.c b/tests/resources/generator/unknown_variable_as_external_variable/model.c index b31c101680..70c1c87753 100644 --- a/tests/resources/generator/unknown_variable_as_external_variable/model.c +++ b/tests/resources/generator/unknown_variable_as_external_variable/model.c @@ -54,7 +54,7 @@ void initialiseVariables(double *constants, ExternalVariable externalVariable) variables[9] = externalVariable(variables, 9); } -void computeComputedConstants(double *computedConstants) +void computeComputedConstants(double *constants, double *computedConstants) { } diff --git a/tests/resources/generator/unknown_variable_as_external_variable/model.h b/tests/resources/generator/unknown_variable_as_external_variable/model.h index 34f0b08747..774d637533 100644 --- a/tests/resources/generator/unknown_variable_as_external_variable/model.h +++ b/tests/resources/generator/unknown_variable_as_external_variable/model.h @@ -33,5 +33,5 @@ void deleteArray(double *array); typedef double (* ExternalVariable)(double *variables, size_t index); void initialiseVariables(double *constants, ExternalVariable externalVariable); -void computeComputedConstants(double *computedConstants); +void computeComputedConstants(double *constants, double *computedConstants); void computeVariables(double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); diff --git a/tests/resources/generator/unknown_variable_as_external_variable/model.py b/tests/resources/generator/unknown_variable_as_external_variable/model.py index b945a76426..1440ec154c 100644 --- a/tests/resources/generator/unknown_variable_as_external_variable/model.py +++ b/tests/resources/generator/unknown_variable_as_external_variable/model.py @@ -49,7 +49,7 @@ def initialise_variables(constants, external_variable): variables[9] = external_variable(variables, 9) -def compute_computed_constants(computed_constants): +def compute_computed_constants(constants, computed_constants): pass diff --git a/tests/resources/generator/variable_initialised_using_a_constant/model.c b/tests/resources/generator/variable_initialised_using_a_constant/model.c index 1dc483fffb..c8282db08d 100644 --- a/tests/resources/generator/variable_initialised_using_a_constant/model.c +++ b/tests/resources/generator/variable_initialised_using_a_constant/model.c @@ -56,7 +56,7 @@ void initialiseVariables(double *states, double *rates, double *constants) states[0] = variables[0]; } -void computeComputedConstants(double *computedConstants) +void computeComputedConstants(double *constants, double *computedConstants) { } diff --git a/tests/resources/generator/variable_initialised_using_a_constant/model.h b/tests/resources/generator/variable_initialised_using_a_constant/model.h index c138b0f363..340f578dd8 100644 --- a/tests/resources/generator/variable_initialised_using_a_constant/model.h +++ b/tests/resources/generator/variable_initialised_using_a_constant/model.h @@ -36,6 +36,6 @@ double * createVariablesArray(); void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *constants); -void computeComputedConstants(double *computedConstants); +void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/variable_initialised_using_a_constant/model.py b/tests/resources/generator/variable_initialised_using_a_constant/model.py index 3982c84aad..73f1eba8c5 100644 --- a/tests/resources/generator/variable_initialised_using_a_constant/model.py +++ b/tests/resources/generator/variable_initialised_using_a_constant/model.py @@ -45,7 +45,7 @@ def initialise_variables(states, rates, constants): states[0] = variables[0] -def compute_computed_constants(computed_constants): +def compute_computed_constants(constants, computed_constants): pass From 5287d5b9221d7cb5ba82d806ba2c18e344800424 Mon Sep 17 00:00:00 2001 From: Alan Garny Date: Wed, 7 Aug 2024 17:15:38 +0200 Subject: [PATCH 07/85] Generator: use computed_constants and not computedConstants in Python. --- src/generatorprofile.cpp | 12 ++++++------ src/generatorprofilesha1values.h | 2 +- .../coverage/generator/model.modified.profile.py | 4 ++-- tests/resources/coverage/generator/model.py | 4 ++-- .../model.external.py | 2 +- .../algebraic_eqn_computed_var_on_rhs/model.py | 2 +- .../algebraic_eqn_const_var_on_rhs/model.py | 2 +- .../generator/algebraic_eqn_constant_on_rhs/model.py | 2 +- .../algebraic_eqn_derivative_on_rhs/model.py | 4 ++-- .../model.py | 4 ++-- .../algebraic_eqn_state_var_on_rhs/model.py | 4 ++-- .../model.py | 4 ++-- .../model.external.py | 2 +- .../model.py | 2 +- .../model.one.external.py | 2 +- .../model.py | 2 +- .../model.three.externals.py | 2 +- .../model.two.externals.py | 2 +- .../model.not.ordered.py | 2 +- .../model.ordered.py | 2 +- .../generator/algebraic_unknown_var_on_rhs/model.py | 2 +- .../generator/cell_geometry_model/model.external.py | 2 +- .../resources/generator/cell_geometry_model/model.py | 2 +- .../cellml_mappings_and_encapsulations/model.py | 4 ++-- .../resources/generator/cellml_slc_example/model.py | 2 +- .../cellml_state_initialised_using_variable/model.py | 4 ++-- .../generator/cellml_unit_scaling_constant/model.py | 2 +- .../generator/cellml_unit_scaling_rate/model.py | 4 ++-- .../generator/cellml_unit_scaling_state/model.py | 4 ++-- .../model.py | 4 ++-- .../model.py | 4 ++-- .../cellml_unit_scaling_voi_direct/model.py | 4 ++-- .../cellml_unit_scaling_voi_indirect/model.py | 4 ++-- .../generator/dae_cellml_1_1_model/model.py | 4 ++-- tests/resources/generator/dependent_eqns/model.py | 4 ++-- .../model.py | 4 ++-- .../model.py | 4 ++-- .../model.algebraic.py | 4 ++-- .../model.computed.constant.py | 4 ++-- .../model.constant.py | 4 ++-- .../model.dae.py | 4 ++-- .../model.dependent.algebraic.py | 4 ++-- .../model.dependent.computed.constant.py | 4 ++-- .../model.dependent.constant.py | 4 ++-- .../model.dependent.state.py | 4 ++-- .../model.external.py | 4 ++-- .../hodgkin_huxley_squid_axon_model_1952/model.py | 4 ++-- .../model.state.py | 4 ++-- tests/resources/generator/noble_model_1962/model.py | 4 ++-- .../generator/ode_computed_var_on_rhs/model.py | 4 ++-- .../ode_computed_var_on_rhs_one_component/model.py | 4 ++-- .../generator/ode_const_var_on_rhs/model.py | 4 ++-- .../ode_const_var_on_rhs_one_component/model.py | 4 ++-- .../resources/generator/ode_constant_on_rhs/model.py | 4 ++-- .../ode_constant_on_rhs_one_component/model.py | 4 ++-- .../generator/ode_multiple_dependent_odes/model.py | 4 ++-- .../model.py | 4 ++-- .../ode_multiple_odes_with_same_name/model.py | 4 ++-- .../generator/ode_unknown_var_on_rhs/model.py | 4 ++-- .../generator/robertson_model_1966/model.dae.py | 4 ++-- .../generator/robertson_model_1966/model.ode.py | 4 ++-- .../resources/generator/sine_model_imports/model.py | 4 ++-- .../unknown_variable_as_external_variable/model.py | 2 +- .../variable_initialised_using_a_constant/model.py | 4 ++-- 64 files changed, 113 insertions(+), 113 deletions(-) diff --git a/src/generatorprofile.cpp b/src/generatorprofile.cpp index 0c17c44b8d..f80ad4d120 100644 --- a/src/generatorprofile.cpp +++ b/src/generatorprofile.cpp @@ -1097,32 +1097,32 @@ void GeneratorProfile::GeneratorProfileImpl::loadProfile(GeneratorProfile::Profi mInterfaceComputeRatesMethodWoevString = ""; mImplementationComputeRatesMethodWoevString = "\n" - "def compute_rates(voi, states, rates, constants, computedConstants, algebraic):\n" + "def compute_rates(voi, states, rates, constants, computed_constants, algebraic):\n" "[CODE]"; mInterfaceComputeRatesMethodWevString = ""; mImplementationComputeRatesMethodWevString = "\n" - "def compute_rates(voi, states, rates, constants, computedConstants, algebraic, external_variable):\n" + "def compute_rates(voi, states, rates, constants, computed_constants, algebraic, external_variable):\n" "[CODE]"; mInterfaceComputeVariablesMethodFamWoevString = ""; mImplementationComputeVariablesMethodFamWoevString = "\n" - "def compute_variables(constants, computedConstants, algebraic):\n" + "def compute_variables(constants, computed_constants, algebraic):\n" "[CODE]"; mInterfaceComputeVariablesMethodFamWevString = ""; mImplementationComputeVariablesMethodFamWevString = "\n" - "def compute_variables(constants, computedConstants, algebraic, external_variable):\n" + "def compute_variables(constants, computed_constants, algebraic, external_variable):\n" "[CODE]"; mInterfaceComputeVariablesMethodFdmWoevString = ""; mImplementationComputeVariablesMethodFdmWoevString = "\n" - "def compute_variables(voi, states, rates, constants, computedConstants, algebraic):\n" + "def compute_variables(voi, states, rates, constants, computed_constants, algebraic):\n" "[CODE]"; mInterfaceComputeVariablesMethodFdmWevString = ""; mImplementationComputeVariablesMethodFdmWevString = "\n" - "def compute_variables(voi, states, rates, constants, computedConstants, algebraic, external_variable):\n" + "def compute_variables(voi, states, rates, constants, computed_constants, algebraic, external_variable):\n" "[CODE]"; mEmptyMethodString = "pass\n"; diff --git a/src/generatorprofilesha1values.h b/src/generatorprofilesha1values.h index ba936cc964..37baac8801 100644 --- a/src/generatorprofilesha1values.h +++ b/src/generatorprofilesha1values.h @@ -25,6 +25,6 @@ namespace libcellml { * See docs/dev_utilities.rst for further information. */ static const char C_GENERATOR_PROFILE_SHA1[] = "2e1a7d8b5995845aceceeb06e8f084f9e11fa13d"; -static const char PYTHON_GENERATOR_PROFILE_SHA1[] = "c7d3866a8238ce15df79bf48d83b95c0650de2b4"; +static const char PYTHON_GENERATOR_PROFILE_SHA1[] = "c9f2a238d3334dcca065f2f8f3e1bf3e875e52df"; } // namespace libcellml diff --git a/tests/resources/coverage/generator/model.modified.profile.py b/tests/resources/coverage/generator/model.modified.profile.py index f6b71d3102..8cfd548b6b 100644 --- a/tests/resources/coverage/generator/model.modified.profile.py +++ b/tests/resources/coverage/generator/model.modified.profile.py @@ -594,9 +594,9 @@ def compute_computed_constants(constants, computed_constants): variables[204] = -and_func(variables[1], variables[2])+-(variables[2] if gt_func(variables[6], variables[18]) else nan) -def compute_rates(voi, states, rates, constants, computedConstants, algebraic): +def compute_rates(voi, states, rates, constants, computed_constants, algebraic): rates[0] = 1.0 -def compute_variables(voi, states, rates, constants, computedConstants, algebraic): +def compute_variables(voi, states, rates, constants, computed_constants, algebraic): find_root_0(voi, states, rates, variables) diff --git a/tests/resources/coverage/generator/model.py b/tests/resources/coverage/generator/model.py index 8b75532bdf..6c180abe61 100644 --- a/tests/resources/coverage/generator/model.py +++ b/tests/resources/coverage/generator/model.py @@ -594,9 +594,9 @@ def compute_computed_constants(constants, computed_constants): variables[204] = -and_func(variables[1], variables[2])+-(variables[2] if gt_func(variables[6], variables[18]) else nan) -def compute_rates(voi, states, rates, constants, computedConstants, algebraic): +def compute_rates(voi, states, rates, constants, computed_constants, algebraic): rates[0] = 1.0 -def compute_variables(voi, states, rates, constants, computedConstants, algebraic): +def compute_variables(voi, states, rates, constants, computed_constants, algebraic): find_root_0(voi, states, rates, variables) diff --git a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.py b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.py index 84b4b2389f..2c84fc24d8 100644 --- a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.py +++ b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.py @@ -37,6 +37,6 @@ def compute_computed_constants(constants, computed_constants): pass -def compute_variables(constants, computedConstants, algebraic, external_variable): +def compute_variables(constants, computed_constants, algebraic, external_variable): variables[1] = external_variable(variables, 1) variables[0] = variables[1] diff --git a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.py b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.py index fdff9ef0f6..924cb661f7 100644 --- a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.py +++ b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.py @@ -36,5 +36,5 @@ def compute_computed_constants(constants, computed_constants): variables[0] = variables[1] -def compute_variables(constants, computedConstants, algebraic): +def compute_variables(constants, computed_constants, algebraic): pass diff --git a/tests/resources/generator/algebraic_eqn_const_var_on_rhs/model.py b/tests/resources/generator/algebraic_eqn_const_var_on_rhs/model.py index ce0f5b10fc..d0506c02ee 100644 --- a/tests/resources/generator/algebraic_eqn_const_var_on_rhs/model.py +++ b/tests/resources/generator/algebraic_eqn_const_var_on_rhs/model.py @@ -36,5 +36,5 @@ def compute_computed_constants(constants, computed_constants): variables[0] = variables[1] -def compute_variables(constants, computedConstants, algebraic): +def compute_variables(constants, computed_constants, algebraic): pass diff --git a/tests/resources/generator/algebraic_eqn_constant_on_rhs/model.py b/tests/resources/generator/algebraic_eqn_constant_on_rhs/model.py index 2a902ccf91..2dd09c5f72 100644 --- a/tests/resources/generator/algebraic_eqn_constant_on_rhs/model.py +++ b/tests/resources/generator/algebraic_eqn_constant_on_rhs/model.py @@ -35,5 +35,5 @@ def compute_computed_constants(constants, computed_constants): pass -def compute_variables(constants, computedConstants, algebraic): +def compute_variables(constants, computed_constants, algebraic): pass diff --git a/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.py b/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.py index 686f0c5378..e1f727c2e9 100644 --- a/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.py +++ b/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.py @@ -50,9 +50,9 @@ def compute_computed_constants(constants, computed_constants): pass -def compute_rates(voi, states, rates, constants, computedConstants, algebraic): +def compute_rates(voi, states, rates, constants, computed_constants, algebraic): rates[0] = variables[0] -def compute_variables(voi, states, rates, constants, computedConstants, algebraic): +def compute_variables(voi, states, rates, constants, computed_constants, algebraic): variables[1] = rates[0] diff --git a/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.py b/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.py index 46f658054f..ecf0e2c0ef 100644 --- a/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.py +++ b/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.py @@ -50,9 +50,9 @@ def compute_computed_constants(constants, computed_constants): pass -def compute_rates(voi, states, rates, constants, computedConstants, algebraic): +def compute_rates(voi, states, rates, constants, computed_constants, algebraic): rates[0] = variables[0] -def compute_variables(voi, states, rates, constants, computedConstants, algebraic): +def compute_variables(voi, states, rates, constants, computed_constants, algebraic): variables[1] = rates[0] diff --git a/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.py b/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.py index fb9970426c..5fbae38c76 100644 --- a/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.py +++ b/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.py @@ -50,9 +50,9 @@ def compute_computed_constants(constants, computed_constants): pass -def compute_rates(voi, states, rates, constants, computedConstants, algebraic): +def compute_rates(voi, states, rates, constants, computed_constants, algebraic): rates[0] = variables[0] -def compute_variables(voi, states, rates, constants, computedConstants, algebraic): +def compute_variables(voi, states, rates, constants, computed_constants, algebraic): variables[1] = 2.0*states[0] diff --git a/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.py b/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.py index ac01ae32cc..7476abdcb4 100644 --- a/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.py +++ b/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.py @@ -50,9 +50,9 @@ def compute_computed_constants(constants, computed_constants): pass -def compute_rates(voi, states, rates, constants, computedConstants, algebraic): +def compute_rates(voi, states, rates, constants, computed_constants, algebraic): rates[0] = variables[0] -def compute_variables(voi, states, rates, constants, computedConstants, algebraic): +def compute_variables(voi, states, rates, constants, computed_constants, algebraic): variables[1] = 2.0*states[0] diff --git a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.py b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.py index 5b08621774..3a560ffca1 100644 --- a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.py +++ b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.py @@ -42,5 +42,5 @@ def compute_computed_constants(constants, computed_constants): pass -def compute_variables(constants, computedConstants, algebraic, external_variable): +def compute_variables(constants, computed_constants, algebraic, external_variable): variables[3] = external_variable(variables, 3) diff --git a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.py b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.py index 6260fef2e3..3c1f6c1774 100644 --- a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.py +++ b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.py @@ -62,5 +62,5 @@ def compute_computed_constants(constants, computed_constants): pass -def compute_variables(constants, computedConstants, algebraic): +def compute_variables(constants, computed_constants, algebraic): find_root_0(variables) diff --git a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.one.external.py b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.one.external.py index e1ab39418f..e7930ae9dd 100644 --- a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.one.external.py +++ b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.one.external.py @@ -66,6 +66,6 @@ def compute_computed_constants(constants, computed_constants): pass -def compute_variables(constants, computedConstants, algebraic, external_variable): +def compute_variables(constants, computed_constants, algebraic, external_variable): variables[0] = external_variable(variables, 0) find_root_0(variables) diff --git a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.py b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.py index 07cdcee4a2..a5c2fd0848 100644 --- a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.py +++ b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.py @@ -68,5 +68,5 @@ def compute_computed_constants(constants, computed_constants): pass -def compute_variables(constants, computedConstants, algebraic): +def compute_variables(constants, computed_constants, algebraic): find_root_0(variables) diff --git a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.py b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.py index 25bd38c60c..dc4b5ea804 100644 --- a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.py +++ b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.py @@ -40,7 +40,7 @@ def compute_computed_constants(constants, computed_constants): pass -def compute_variables(constants, computedConstants, algebraic, external_variable): +def compute_variables(constants, computed_constants, algebraic, external_variable): variables[0] = external_variable(variables, 0) variables[1] = external_variable(variables, 1) variables[2] = external_variable(variables, 2) diff --git a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.two.externals.py b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.two.externals.py index ecaa9b6971..78b0c39b31 100644 --- a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.two.externals.py +++ b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.two.externals.py @@ -97,7 +97,7 @@ def compute_computed_constants(constants, computed_constants): pass -def compute_variables(constants, computedConstants, algebraic, external_variable): +def compute_variables(constants, computed_constants, algebraic, external_variable): variables[0] = external_variable(variables, 0) variables[2] = external_variable(variables, 2) find_root_0(variables) diff --git a/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.py b/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.py index 41286d7158..09d7f087b2 100644 --- a/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.py +++ b/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.py @@ -68,6 +68,6 @@ def compute_computed_constants(constants, computed_constants): variables[3] = 3.0*variables[4]+variables[5] -def compute_variables(constants, computedConstants, algebraic): +def compute_variables(constants, computed_constants, algebraic): find_root_0(variables) variables[0] = variables[1]+variables[2] diff --git a/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.py b/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.py index e89d43847d..79c59418ad 100644 --- a/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.py +++ b/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.py @@ -68,6 +68,6 @@ def compute_computed_constants(constants, computed_constants): variables[0] = 3.0*variables[1]+variables[2] -def compute_variables(constants, computedConstants, algebraic): +def compute_variables(constants, computed_constants, algebraic): find_root_0(variables) variables[5] = variables[4]+variables[3] diff --git a/tests/resources/generator/algebraic_unknown_var_on_rhs/model.py b/tests/resources/generator/algebraic_unknown_var_on_rhs/model.py index 7586911e1d..8dbebec15b 100644 --- a/tests/resources/generator/algebraic_unknown_var_on_rhs/model.py +++ b/tests/resources/generator/algebraic_unknown_var_on_rhs/model.py @@ -36,5 +36,5 @@ def compute_computed_constants(constants, computed_constants): variables[1] = variables[0] -def compute_variables(constants, computedConstants, algebraic): +def compute_variables(constants, computed_constants, algebraic): pass diff --git a/tests/resources/generator/cell_geometry_model/model.external.py b/tests/resources/generator/cell_geometry_model/model.external.py index 3cd1ff5b13..ddad520d3f 100644 --- a/tests/resources/generator/cell_geometry_model/model.external.py +++ b/tests/resources/generator/cell_geometry_model/model.external.py @@ -40,7 +40,7 @@ def compute_computed_constants(constants, computed_constants): pass -def compute_variables(constants, computedConstants, algebraic, external_variable): +def compute_variables(constants, computed_constants, algebraic, external_variable): variables[1] = external_variable(variables, 1) variables[2] = external_variable(variables, 2) variables[0] = 1000.0*3.14*variables[2]*variables[2]*variables[1] diff --git a/tests/resources/generator/cell_geometry_model/model.py b/tests/resources/generator/cell_geometry_model/model.py index 0db8de32e3..b4f3170972 100644 --- a/tests/resources/generator/cell_geometry_model/model.py +++ b/tests/resources/generator/cell_geometry_model/model.py @@ -40,5 +40,5 @@ def compute_computed_constants(constants, computed_constants): variables[3] = 0.02*variables[0] -def compute_variables(constants, computedConstants, algebraic): +def compute_variables(constants, computed_constants, algebraic): pass diff --git a/tests/resources/generator/cellml_mappings_and_encapsulations/model.py b/tests/resources/generator/cellml_mappings_and_encapsulations/model.py index 068ed49c69..b17226251e 100644 --- a/tests/resources/generator/cellml_mappings_and_encapsulations/model.py +++ b/tests/resources/generator/cellml_mappings_and_encapsulations/model.py @@ -51,11 +51,11 @@ def compute_computed_constants(constants, computed_constants): pass -def compute_rates(voi, states, rates, constants, computedConstants, algebraic): +def compute_rates(voi, states, rates, constants, computed_constants, algebraic): rates[1] = -states[0]*1.0 rates[0] = states[1]*1.0 -def compute_variables(voi, states, rates, constants, computedConstants, algebraic): +def compute_variables(voi, states, rates, constants, computed_constants, algebraic): variables[0] = states[0]+5.0*states[0]/3.0+1.0*exp(states[0]/2.0) variables[1] = 2.0*states[1] diff --git a/tests/resources/generator/cellml_slc_example/model.py b/tests/resources/generator/cellml_slc_example/model.py index 23470a883a..b97fb76d87 100644 --- a/tests/resources/generator/cellml_slc_example/model.py +++ b/tests/resources/generator/cellml_slc_example/model.py @@ -52,5 +52,5 @@ def compute_computed_constants(constants, computed_constants): variables[0] = variables[1]*(variables[2]*variables[3]-variables[4]*variables[5])/(variables[6]*variables[5]+variables[9]*variables[3]+variables[8]*variables[5]*variables[3]+variables[7]) -def compute_variables(constants, computedConstants, algebraic): +def compute_variables(constants, computed_constants, algebraic): pass diff --git a/tests/resources/generator/cellml_state_initialised_using_variable/model.py b/tests/resources/generator/cellml_state_initialised_using_variable/model.py index 3a44c0f6a2..2acb9513ef 100644 --- a/tests/resources/generator/cellml_state_initialised_using_variable/model.py +++ b/tests/resources/generator/cellml_state_initialised_using_variable/model.py @@ -49,9 +49,9 @@ def compute_computed_constants(constants, computed_constants): pass -def compute_rates(voi, states, rates, constants, computedConstants, algebraic): +def compute_rates(voi, states, rates, constants, computed_constants, algebraic): rates[0] = 1.23 -def compute_variables(voi, states, rates, constants, computedConstants, algebraic): +def compute_variables(voi, states, rates, constants, computed_constants, algebraic): pass diff --git a/tests/resources/generator/cellml_unit_scaling_constant/model.py b/tests/resources/generator/cellml_unit_scaling_constant/model.py index fb52075278..fe0dc254f1 100644 --- a/tests/resources/generator/cellml_unit_scaling_constant/model.py +++ b/tests/resources/generator/cellml_unit_scaling_constant/model.py @@ -38,5 +38,5 @@ def compute_computed_constants(constants, computed_constants): variables[2] = 0.001*variables[0]+0.001*variables[0] -def compute_variables(constants, computedConstants, algebraic): +def compute_variables(constants, computed_constants, algebraic): pass diff --git a/tests/resources/generator/cellml_unit_scaling_rate/model.py b/tests/resources/generator/cellml_unit_scaling_rate/model.py index c709d5635e..e3ba6287ba 100644 --- a/tests/resources/generator/cellml_unit_scaling_rate/model.py +++ b/tests/resources/generator/cellml_unit_scaling_rate/model.py @@ -49,10 +49,10 @@ def compute_computed_constants(constants, computed_constants): pass -def compute_rates(voi, states, rates, constants, computedConstants, algebraic): +def compute_rates(voi, states, rates, constants, computed_constants, algebraic): rates[0] = 1.23 -def compute_variables(voi, states, rates, constants, computedConstants, algebraic): +def compute_variables(voi, states, rates, constants, computed_constants, algebraic): variables[0] = 1000.0*rates[0]+1000.0*rates[0] variables[1] = 1000.0*0.001*rates[0]+1000.0*0.001*rates[0] diff --git a/tests/resources/generator/cellml_unit_scaling_state/model.py b/tests/resources/generator/cellml_unit_scaling_state/model.py index 429d096f15..b690773a88 100644 --- a/tests/resources/generator/cellml_unit_scaling_state/model.py +++ b/tests/resources/generator/cellml_unit_scaling_state/model.py @@ -49,10 +49,10 @@ def compute_computed_constants(constants, computed_constants): pass -def compute_rates(voi, states, rates, constants, computedConstants, algebraic): +def compute_rates(voi, states, rates, constants, computed_constants, algebraic): rates[0] = 1.23 -def compute_variables(voi, states, rates, constants, computedConstants, algebraic): +def compute_variables(voi, states, rates, constants, computed_constants, algebraic): variables[0] = states[0]+states[0] variables[1] = 0.001*states[0]+0.001*states[0] diff --git a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.py b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.py index e9a042ad14..2457852613 100644 --- a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.py +++ b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.py @@ -49,10 +49,10 @@ def compute_computed_constants(constants, computed_constants): pass -def compute_rates(voi, states, rates, constants, computedConstants, algebraic): +def compute_rates(voi, states, rates, constants, computed_constants, algebraic): rates[0] = 1.23 rates[1] = 7.89 -def compute_variables(voi, states, rates, constants, computedConstants, algebraic): +def compute_variables(voi, states, rates, constants, computed_constants, algebraic): pass diff --git a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.py b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.py index 8b55cd0998..bd5761c821 100644 --- a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.py +++ b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.py @@ -53,10 +53,10 @@ def compute_computed_constants(constants, computed_constants): pass -def compute_rates(voi, states, rates, constants, computedConstants, algebraic): +def compute_rates(voi, states, rates, constants, computed_constants, algebraic): rates[0] = 1.23 rates[1] = 7.89 -def compute_variables(voi, states, rates, constants, computedConstants, algebraic): +def compute_variables(voi, states, rates, constants, computed_constants, algebraic): pass diff --git a/tests/resources/generator/cellml_unit_scaling_voi_direct/model.py b/tests/resources/generator/cellml_unit_scaling_voi_direct/model.py index e731c20634..29f3f445e0 100644 --- a/tests/resources/generator/cellml_unit_scaling_voi_direct/model.py +++ b/tests/resources/generator/cellml_unit_scaling_voi_direct/model.py @@ -49,10 +49,10 @@ def compute_computed_constants(constants, computed_constants): pass -def compute_rates(voi, states, rates, constants, computedConstants, algebraic): +def compute_rates(voi, states, rates, constants, computed_constants, algebraic): rates[0] = voi/1.0 rates[1] = 0.001*voi/1.0 -def compute_variables(voi, states, rates, constants, computedConstants, algebraic): +def compute_variables(voi, states, rates, constants, computed_constants, algebraic): pass diff --git a/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.py b/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.py index d0234d704c..e9a8f3b731 100644 --- a/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.py +++ b/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.py @@ -51,11 +51,11 @@ def compute_computed_constants(constants, computed_constants): pass -def compute_rates(voi, states, rates, constants, computedConstants, algebraic): +def compute_rates(voi, states, rates, constants, computed_constants, algebraic): rates[0] = 5.0 rates[1] = 1000.0*9.0 rates[2] = 0.001*13.0 -def compute_variables(voi, states, rates, constants, computedConstants, algebraic): +def compute_variables(voi, states, rates, constants, computed_constants, algebraic): pass diff --git a/tests/resources/generator/dae_cellml_1_1_model/model.py b/tests/resources/generator/dae_cellml_1_1_model/model.py index 625f4fc243..fd231105c9 100644 --- a/tests/resources/generator/dae_cellml_1_1_model/model.py +++ b/tests/resources/generator/dae_cellml_1_1_model/model.py @@ -111,7 +111,7 @@ def compute_computed_constants(constants, computed_constants): pass -def compute_rates(voi, states, rates, constants, computedConstants, algebraic): +def compute_rates(voi, states, rates, constants, computed_constants, algebraic): variables[2] = states[1]+variables[3] find_root_0(voi, states, rates, variables) rates[0] = variables[0] @@ -121,7 +121,7 @@ def compute_rates(voi, states, rates, constants, computedConstants, algebraic): rates[1] = variables[6]/variables[9] -def compute_variables(voi, states, rates, constants, computedConstants, algebraic): +def compute_variables(voi, states, rates, constants, computed_constants, algebraic): variables[2] = states[1]+variables[3] find_root_0(voi, states, rates, variables) variables[4] = states[0]/variables[7] diff --git a/tests/resources/generator/dependent_eqns/model.py b/tests/resources/generator/dependent_eqns/model.py index 93fe0440b5..a42b874330 100644 --- a/tests/resources/generator/dependent_eqns/model.py +++ b/tests/resources/generator/dependent_eqns/model.py @@ -49,10 +49,10 @@ def compute_computed_constants(constants, computed_constants): pass -def compute_rates(voi, states, rates, constants, computedConstants, algebraic): +def compute_rates(voi, states, rates, constants, computed_constants, algebraic): rates[0] = 1.0 -def compute_variables(voi, states, rates, constants, computedConstants, algebraic): +def compute_variables(voi, states, rates, constants, computed_constants, algebraic): variables[1] = 2.0*voi variables[0] = 3.0*variables[1] diff --git a/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.py b/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.py index c325595498..9ef7459aa3 100644 --- a/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.py +++ b/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.py @@ -463,7 +463,7 @@ def compute_computed_constants(constants, computed_constants): variables[213] = (3.5988-0.025641)/(1.0+0.0000012155/pow(1.0*variables[0], 1.6951))+0.025641 -def compute_rates(voi, states, rates, constants, computedConstants, algebraic): +def compute_rates(voi, states, rates, constants, computed_constants, algebraic): variables[5] = states[1] variables[142] = variables[3]*log((variables[4]+0.12*variables[7])/(variables[5]+0.12*variables[8])) variables[121] = variables[123] if and_func(gt_func(voi, variables[124]), lt_func(voi, variables[124]+variables[125])) else variables[126] @@ -595,7 +595,7 @@ def compute_rates(voi, states, rates, constants, computedConstants, algebraic): rates[32] = (variables[215]-states[32])/variables[216] -def compute_variables(voi, states, rates, constants, computedConstants, algebraic): +def compute_variables(voi, states, rates, constants, computed_constants, algebraic): variables[5] = states[1] variables[2] = variables[3]*log(variables[4]/variables[5]) variables[9] = 0.5*variables[3]*log(variables[10]/states[0]) diff --git a/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.py b/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.py index 2244f1dc91..911753d70c 100644 --- a/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.py +++ b/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.py @@ -400,7 +400,7 @@ def compute_computed_constants(constants, computed_constants): variables[176] = variables[177]+variables[0]*(variables[178]-variables[177]) if eq_func(variables[2], 0.0) else variables[181]+variables[0]*(variables[182]-variables[181]) if eq_func(variables[2], 1.0) else variables[179]+variables[0]*(variables[180]-variables[179]) -def compute_rates(voi, states, rates, constants, computedConstants, algebraic): +def compute_rates(voi, states, rates, constants, computed_constants, algebraic): variables[9] = variables[62]*pow(variables[56]/(variables[71]+variables[56]), 3.0)*pow(variables[69]/(variables[70]+variables[69]), 2.0)*1.6/(1.5+exp(-(states[0]+60.0)/40.0)) variables[10] = variables[49]*(pow(variables[56], 3.0)*variables[58]*exp(0.03743*states[0]*variables[57])-pow(variables[59], 3.0)*variables[60]*exp(0.0374*states[0]*(variables[57]-1.0)))/(1.0+variables[61]*(variables[60]*pow(variables[59], 3.0)+variables[58]*pow(variables[56], 3.0))) if eq_func(variables[2], 0.0) else variables[49]*(pow(variables[56], 3.0)*variables[58]*exp(0.03743*states[0]*variables[57])-pow(variables[59], 3.0)*variables[60]*exp(0.03743*states[0]*(variables[57]-1.0)))/(1.0+variables[61]*(variables[60]*pow(variables[59], 3.0)+variables[58]*pow(variables[56], 3.0))) variables[14] = variables[176]*states[14]*(states[0]-variables[40]) if neq_func(variables[2], 2.0) else variables[176]*states[14]*(states[0]+102.0) @@ -470,7 +470,7 @@ def compute_rates(voi, states, rates, constants, computedConstants, algebraic): rates[14] = variables[183]*(1.0-states[14])-variables[184]*states[14] -def compute_variables(voi, states, rates, constants, computedConstants, algebraic): +def compute_variables(voi, states, rates, constants, computed_constants, algebraic): variables[13] = variables[25]*(states[0]-variables[32]) variables[11] = variables[33]*(states[0]-variables[40]) variables[12] = variables[41]*(states[0]-variables[48]) diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.py index c067ca185e..5e1461769e 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.py @@ -92,7 +92,7 @@ def compute_computed_constants(constants, computed_constants): variables[14] = variables[5]+12.0 -def compute_rates(voi, states, rates, constants, computedConstants, algebraic, external_variable): +def compute_rates(voi, states, rates, constants, computed_constants, algebraic, external_variable): variables[0] = external_variable(voi, states, rates, variables, 0) variables[1] = variables[7]*(states[0]-variables[6]) variables[2] = variables[15]*pow(states[3], 4.0)*(states[0]-variables[14]) @@ -109,7 +109,7 @@ def compute_rates(voi, states, rates, constants, computedConstants, algebraic, e rates[3] = variables[16]*(1.0-states[3])-variables[17]*states[3] -def compute_variables(voi, states, rates, constants, computedConstants, algebraic, external_variable): +def compute_variables(voi, states, rates, constants, computed_constants, algebraic, external_variable): variables[0] = external_variable(voi, states, rates, variables, 0) variables[1] = variables[7]*(states[0]-variables[6]) variables[3] = variables[9]*pow(states[2], 3.0)*states[1]*(states[0]-variables[8]) diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.py index f903b7fc62..e92d16dca6 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.py @@ -91,7 +91,7 @@ def compute_computed_constants(constants, computed_constants): variables[14] = variables[5]+12.0 -def compute_rates(voi, states, rates, constants, computedConstants, algebraic, external_variable): +def compute_rates(voi, states, rates, constants, computed_constants, algebraic, external_variable): variables[0] = -20.0 if and_func(geq_func(voi, 10.0), leq_func(voi, 10.5)) else 0.0 variables[6] = external_variable(voi, states, rates, variables, 6) variables[1] = variables[7]*(states[0]-variables[6]) @@ -109,7 +109,7 @@ def compute_rates(voi, states, rates, constants, computedConstants, algebraic, e rates[3] = variables[16]*(1.0-states[3])-variables[17]*states[3] -def compute_variables(voi, states, rates, constants, computedConstants, algebraic, external_variable): +def compute_variables(voi, states, rates, constants, computed_constants, algebraic, external_variable): variables[6] = external_variable(voi, states, rates, variables, 6) variables[1] = variables[7]*(states[0]-variables[6]) variables[3] = variables[9]*pow(states[2], 3.0)*states[1]*(states[0]-variables[8]) diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.py index 5286f429de..942441414f 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.py @@ -91,7 +91,7 @@ def compute_computed_constants(constants, computed_constants): variables[14] = variables[5]+12.0 -def compute_rates(voi, states, rates, constants, computedConstants, algebraic, external_variable): +def compute_rates(voi, states, rates, constants, computed_constants, algebraic, external_variable): variables[0] = -20.0 if and_func(geq_func(voi, 10.0), leq_func(voi, 10.5)) else 0.0 variables[4] = external_variable(voi, states, rates, variables, 4) variables[1] = variables[7]*(states[0]-variables[6]) @@ -109,7 +109,7 @@ def compute_rates(voi, states, rates, constants, computedConstants, algebraic, e rates[3] = variables[16]*(1.0-states[3])-variables[17]*states[3] -def compute_variables(voi, states, rates, constants, computedConstants, algebraic, external_variable): +def compute_variables(voi, states, rates, constants, computed_constants, algebraic, external_variable): variables[1] = variables[7]*(states[0]-variables[6]) variables[3] = variables[9]*pow(states[2], 3.0)*states[1]*(states[0]-variables[8]) variables[10] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0) diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.py index a0fd9eb41c..85b8315e50 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.py @@ -465,7 +465,7 @@ def compute_computed_constants(constants, computed_constants): pass -def compute_rates(voi, states, rates, constants, computedConstants, algebraic): +def compute_rates(voi, states, rates, constants, computed_constants, algebraic): find_root_0(voi, states, rates, variables) find_root_2(voi, states, rates, variables) find_root_3(voi, states, rates, variables) @@ -485,7 +485,7 @@ def compute_rates(voi, states, rates, constants, computedConstants, algebraic): find_root_1(voi, states, rates, variables) -def compute_variables(voi, states, rates, constants, computedConstants, algebraic): +def compute_variables(voi, states, rates, constants, computed_constants, algebraic): find_root_0(voi, states, rates, variables) find_root_2(voi, states, rates, variables) find_root_3(voi, states, rates, variables) diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.py index 8de578a33e..251ac76799 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.py @@ -93,7 +93,7 @@ def compute_computed_constants(constants, computed_constants): variables[14] = variables[5]+12.0 -def compute_rates(voi, states, rates, constants, computedConstants, algebraic, external_variable): +def compute_rates(voi, states, rates, constants, computed_constants, algebraic, external_variable): variables[17] = external_variable(voi, states, rates, variables, 17) variables[0] = external_variable(voi, states, rates, variables, 0) variables[1] = variables[7]*(states[0]-variables[6]) @@ -110,7 +110,7 @@ def compute_rates(voi, states, rates, constants, computedConstants, algebraic, e rates[3] = variables[16]*(1.0-states[3])-variables[17]*states[3] -def compute_variables(voi, states, rates, constants, computedConstants, algebraic, external_variable): +def compute_variables(voi, states, rates, constants, computed_constants, algebraic, external_variable): variables[17] = external_variable(voi, states, rates, variables, 17) variables[0] = external_variable(voi, states, rates, variables, 0) variables[1] = variables[7]*(states[0]-variables[6]) diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.py index bf9243f141..3c0aa7915d 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.py @@ -90,7 +90,7 @@ def compute_computed_constants(constants, computed_constants): pass -def compute_rates(voi, states, rates, constants, computedConstants, algebraic, external_variable): +def compute_rates(voi, states, rates, constants, computed_constants, algebraic, external_variable): variables[0] = -20.0 if and_func(geq_func(voi, 10.0), leq_func(voi, 10.5)) else 0.0 variables[14] = external_variable(voi, states, rates, variables, 14) variables[5] = external_variable(voi, states, rates, variables, 5) @@ -111,7 +111,7 @@ def compute_rates(voi, states, rates, constants, computedConstants, algebraic, e rates[3] = variables[16]*(1.0-states[3])-variables[17]*states[3] -def compute_variables(voi, states, rates, constants, computedConstants, algebraic, external_variable): +def compute_variables(voi, states, rates, constants, computed_constants, algebraic, external_variable): variables[14] = external_variable(voi, states, rates, variables, 14) variables[5] = external_variable(voi, states, rates, variables, 5) variables[6] = variables[5]-10.613 diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.py index bab665d5c1..248c82ab51 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.py @@ -91,7 +91,7 @@ def compute_computed_constants(constants, computed_constants): variables[14] = variables[5]+12.0 -def compute_rates(voi, states, rates, constants, computedConstants, algebraic, external_variable): +def compute_rates(voi, states, rates, constants, computed_constants, algebraic, external_variable): variables[0] = -20.0 if and_func(geq_func(voi, 10.0), leq_func(voi, 10.5)) else 0.0 variables[9] = external_variable(voi, states, rates, variables, 9) variables[4] = external_variable(voi, states, rates, variables, 4) @@ -110,7 +110,7 @@ def compute_rates(voi, states, rates, constants, computedConstants, algebraic, e rates[3] = variables[16]*(1.0-states[3])-variables[17]*states[3] -def compute_variables(voi, states, rates, constants, computedConstants, algebraic, external_variable): +def compute_variables(voi, states, rates, constants, computed_constants, algebraic, external_variable): variables[1] = variables[7]*(states[0]-variables[6]) variables[9] = external_variable(voi, states, rates, variables, 9) variables[3] = variables[9]*pow(states[2], 3.0)*states[1]*(states[0]-variables[8]) diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.py index 630415b7ff..adbb263b49 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.py @@ -91,7 +91,7 @@ def compute_computed_constants(constants, computed_constants): variables[16] = variables[6]+12.0 -def compute_rates(voi, states, rates, constants, computedConstants, algebraic, external_variable): +def compute_rates(voi, states, rates, constants, computed_constants, algebraic, external_variable): variables[1] = external_variable(voi, states, rates, variables, 1) variables[14] = 0.07*exp(variables[1]/20.0) variables[15] = 1.0/(exp((variables[1]+30.0)/10.0)+1.0) @@ -101,7 +101,7 @@ def compute_rates(voi, states, rates, constants, computedConstants, algebraic, e rates[1] = variables[18]*(1.0-states[1])-variables[19]*states[1] -def compute_variables(voi, states, rates, constants, computedConstants, algebraic, external_variable): +def compute_variables(voi, states, rates, constants, computed_constants, algebraic, external_variable): variables[0] = -20.0 if and_func(geq_func(voi, 10.0), leq_func(voi, 10.5)) else 0.0 variables[1] = external_variable(voi, states, rates, variables, 1) variables[2] = variables[8]*(variables[1]-variables[7]) diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.py index c26899b7b7..b280fc68e7 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.py @@ -93,7 +93,7 @@ def compute_computed_constants(constants, computed_constants): variables[15] = variables[6]+12.0 -def compute_rates(voi, states, rates, constants, computedConstants, algebraic, external_variable): +def compute_rates(voi, states, rates, constants, computed_constants, algebraic, external_variable): variables[1] = external_variable(voi, states, rates, variables, 1) variables[11] = 0.1*(variables[1]+25.0)/(exp((variables[1]+25.0)/10.0)-1.0) variables[12] = 4.0*exp(variables[1]/18.0) @@ -106,7 +106,7 @@ def compute_rates(voi, states, rates, constants, computedConstants, algebraic, e rates[2] = variables[17]*(1.0-states[2])-variables[18]*states[2] -def compute_variables(voi, states, rates, constants, computedConstants, algebraic, external_variable): +def compute_variables(voi, states, rates, constants, computed_constants, algebraic, external_variable): variables[0] = -20.0 if and_func(geq_func(voi, 10.0), leq_func(voi, 10.5)) else 0.0 variables[1] = external_variable(voi, states, rates, variables, 1) variables[2] = variables[8]*(variables[1]-variables[7]) diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.py index b673cc0506..621936ae12 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.py @@ -90,7 +90,7 @@ def compute_computed_constants(constants, computed_constants): variables[14] = variables[5]+12.0 -def compute_rates(voi, states, rates, constants, computedConstants, algebraic): +def compute_rates(voi, states, rates, constants, computed_constants, algebraic): variables[0] = -20.0 if and_func(geq_func(voi, 10.0), leq_func(voi, 10.5)) else 0.0 variables[1] = variables[7]*(states[0]-variables[6]) variables[2] = variables[15]*pow(states[3], 4.0)*(states[0]-variables[14]) @@ -107,7 +107,7 @@ def compute_rates(voi, states, rates, constants, computedConstants, algebraic): rates[3] = variables[16]*(1.0-states[3])-variables[17]*states[3] -def compute_variables(voi, states, rates, constants, computedConstants, algebraic): +def compute_variables(voi, states, rates, constants, computed_constants, algebraic): variables[1] = variables[7]*(states[0]-variables[6]) variables[3] = variables[9]*pow(states[2], 3.0)*states[1]*(states[0]-variables[8]) variables[10] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0) diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.py index 12843733b8..72491c454a 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.py @@ -91,7 +91,7 @@ def compute_computed_constants(constants, computed_constants): variables[15] = variables[5]+12.0 -def compute_rates(voi, states, rates, constants, computedConstants, algebraic, external_variable): +def compute_rates(voi, states, rates, constants, computed_constants, algebraic, external_variable): variables[0] = -20.0 if and_func(geq_func(voi, 10.0), leq_func(voi, 10.5)) else 0.0 variables[1] = variables[7]*(states[0]-variables[6]) variables[2] = variables[16]*pow(states[2], 4.0)*(states[0]-variables[15]) @@ -106,7 +106,7 @@ def compute_rates(voi, states, rates, constants, computedConstants, algebraic, e rates[2] = variables[17]*(1.0-states[2])-variables[18]*states[2] -def compute_variables(voi, states, rates, constants, computedConstants, algebraic, external_variable): +def compute_variables(voi, states, rates, constants, computed_constants, algebraic, external_variable): variables[1] = variables[7]*(states[0]-variables[6]) variables[10] = external_variable(voi, states, rates, variables, 10) variables[3] = variables[9]*pow(variables[10], 3.0)*states[1]*(states[0]-variables[8]) diff --git a/tests/resources/generator/noble_model_1962/model.py b/tests/resources/generator/noble_model_1962/model.py index 59f41a51e4..11aba05f56 100644 --- a/tests/resources/generator/noble_model_1962/model.py +++ b/tests/resources/generator/noble_model_1962/model.py @@ -75,7 +75,7 @@ def compute_computed_constants(constants, computed_constants): pass -def compute_rates(voi, states, rates, constants, computedConstants, algebraic): +def compute_rates(voi, states, rates, constants, computed_constants, algebraic): variables[6] = pow(states[1], 3.0)*states[2]*variables[7] variables[0] = (variables[6]+0.14)*(states[0]-variables[8]) variables[1] = variables[4]*(states[0]-variables[5]) @@ -94,7 +94,7 @@ def compute_rates(voi, states, rates, constants, computedConstants, algebraic): rates[3] = variables[15]*(1.0-states[3])-variables[16]*states[3] -def compute_variables(voi, states, rates, constants, computedConstants, algebraic): +def compute_variables(voi, states, rates, constants, computed_constants, algebraic): variables[1] = variables[4]*(states[0]-variables[5]) variables[6] = pow(states[1], 3.0)*states[2]*variables[7] variables[0] = (variables[6]+0.14)*(states[0]-variables[8]) diff --git a/tests/resources/generator/ode_computed_var_on_rhs/model.py b/tests/resources/generator/ode_computed_var_on_rhs/model.py index 477fed9dc0..a9b19e7625 100644 --- a/tests/resources/generator/ode_computed_var_on_rhs/model.py +++ b/tests/resources/generator/ode_computed_var_on_rhs/model.py @@ -49,9 +49,9 @@ def compute_computed_constants(constants, computed_constants): pass -def compute_rates(voi, states, rates, constants, computedConstants, algebraic): +def compute_rates(voi, states, rates, constants, computed_constants, algebraic): rates[0] = variables[0] -def compute_variables(voi, states, rates, constants, computedConstants, algebraic): +def compute_variables(voi, states, rates, constants, computed_constants, algebraic): pass diff --git a/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.py b/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.py index 89a6e82dc5..b733994759 100644 --- a/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.py +++ b/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.py @@ -49,9 +49,9 @@ def compute_computed_constants(constants, computed_constants): pass -def compute_rates(voi, states, rates, constants, computedConstants, algebraic): +def compute_rates(voi, states, rates, constants, computed_constants, algebraic): rates[0] = variables[0] -def compute_variables(voi, states, rates, constants, computedConstants, algebraic): +def compute_variables(voi, states, rates, constants, computed_constants, algebraic): pass diff --git a/tests/resources/generator/ode_const_var_on_rhs/model.py b/tests/resources/generator/ode_const_var_on_rhs/model.py index 7b30f60790..ba2af92b39 100644 --- a/tests/resources/generator/ode_const_var_on_rhs/model.py +++ b/tests/resources/generator/ode_const_var_on_rhs/model.py @@ -49,9 +49,9 @@ def compute_computed_constants(constants, computed_constants): pass -def compute_rates(voi, states, rates, constants, computedConstants, algebraic): +def compute_rates(voi, states, rates, constants, computed_constants, algebraic): rates[0] = variables[0] -def compute_variables(voi, states, rates, constants, computedConstants, algebraic): +def compute_variables(voi, states, rates, constants, computed_constants, algebraic): pass diff --git a/tests/resources/generator/ode_const_var_on_rhs_one_component/model.py b/tests/resources/generator/ode_const_var_on_rhs_one_component/model.py index ef811ed30c..d5a245651c 100644 --- a/tests/resources/generator/ode_const_var_on_rhs_one_component/model.py +++ b/tests/resources/generator/ode_const_var_on_rhs_one_component/model.py @@ -49,9 +49,9 @@ def compute_computed_constants(constants, computed_constants): pass -def compute_rates(voi, states, rates, constants, computedConstants, algebraic): +def compute_rates(voi, states, rates, constants, computed_constants, algebraic): rates[0] = variables[0] -def compute_variables(voi, states, rates, constants, computedConstants, algebraic): +def compute_variables(voi, states, rates, constants, computed_constants, algebraic): pass diff --git a/tests/resources/generator/ode_constant_on_rhs/model.py b/tests/resources/generator/ode_constant_on_rhs/model.py index d1a6f8b8d8..d747d32872 100644 --- a/tests/resources/generator/ode_constant_on_rhs/model.py +++ b/tests/resources/generator/ode_constant_on_rhs/model.py @@ -47,9 +47,9 @@ def compute_computed_constants(constants, computed_constants): pass -def compute_rates(voi, states, rates, constants, computedConstants, algebraic): +def compute_rates(voi, states, rates, constants, computed_constants, algebraic): rates[0] = 1.0 -def compute_variables(voi, states, rates, constants, computedConstants, algebraic): +def compute_variables(voi, states, rates, constants, computed_constants, algebraic): pass diff --git a/tests/resources/generator/ode_constant_on_rhs_one_component/model.py b/tests/resources/generator/ode_constant_on_rhs_one_component/model.py index 6fe4f8a160..beea768e95 100644 --- a/tests/resources/generator/ode_constant_on_rhs_one_component/model.py +++ b/tests/resources/generator/ode_constant_on_rhs_one_component/model.py @@ -47,9 +47,9 @@ def compute_computed_constants(constants, computed_constants): pass -def compute_rates(voi, states, rates, constants, computedConstants, algebraic): +def compute_rates(voi, states, rates, constants, computed_constants, algebraic): rates[0] = 1.0 -def compute_variables(voi, states, rates, constants, computedConstants, algebraic): +def compute_variables(voi, states, rates, constants, computed_constants, algebraic): pass diff --git a/tests/resources/generator/ode_multiple_dependent_odes/model.py b/tests/resources/generator/ode_multiple_dependent_odes/model.py index 4bac6fe0c9..70c8763818 100644 --- a/tests/resources/generator/ode_multiple_dependent_odes/model.py +++ b/tests/resources/generator/ode_multiple_dependent_odes/model.py @@ -51,10 +51,10 @@ def compute_computed_constants(constants, computed_constants): pass -def compute_rates(voi, states, rates, constants, computedConstants, algebraic): +def compute_rates(voi, states, rates, constants, computed_constants, algebraic): rates[0] = states[1]*1.0 rates[1] = (variables[0]*(1.0-pow(states[0], 2.0))*states[1]-states[0])*1.0 -def compute_variables(voi, states, rates, constants, computedConstants, algebraic): +def compute_variables(voi, states, rates, constants, computed_constants, algebraic): pass diff --git a/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.py b/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.py index 68fce403bc..a3a521ec24 100644 --- a/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.py +++ b/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.py @@ -51,10 +51,10 @@ def compute_computed_constants(constants, computed_constants): pass -def compute_rates(voi, states, rates, constants, computedConstants, algebraic): +def compute_rates(voi, states, rates, constants, computed_constants, algebraic): rates[0] = states[1]*1.0 rates[1] = (variables[0]*(1.0-pow(states[0], 2.0))*states[1]-states[0])*1.0 -def compute_variables(voi, states, rates, constants, computedConstants, algebraic): +def compute_variables(voi, states, rates, constants, computed_constants, algebraic): pass diff --git a/tests/resources/generator/ode_multiple_odes_with_same_name/model.py b/tests/resources/generator/ode_multiple_odes_with_same_name/model.py index 0d631115b9..446a164abd 100644 --- a/tests/resources/generator/ode_multiple_odes_with_same_name/model.py +++ b/tests/resources/generator/ode_multiple_odes_with_same_name/model.py @@ -51,10 +51,10 @@ def compute_computed_constants(constants, computed_constants): pass -def compute_rates(voi, states, rates, constants, computedConstants, algebraic): +def compute_rates(voi, states, rates, constants, computed_constants, algebraic): rates[0] = 1.0 rates[1] = variables[0] -def compute_variables(voi, states, rates, constants, computedConstants, algebraic): +def compute_variables(voi, states, rates, constants, computed_constants, algebraic): pass diff --git a/tests/resources/generator/ode_unknown_var_on_rhs/model.py b/tests/resources/generator/ode_unknown_var_on_rhs/model.py index 29380da06b..446d26780d 100644 --- a/tests/resources/generator/ode_unknown_var_on_rhs/model.py +++ b/tests/resources/generator/ode_unknown_var_on_rhs/model.py @@ -49,10 +49,10 @@ def compute_computed_constants(constants, computed_constants): pass -def compute_rates(voi, states, rates, constants, computedConstants, algebraic): +def compute_rates(voi, states, rates, constants, computed_constants, algebraic): rates[0] = 1.0 rates[1] = states[0] -def compute_variables(voi, states, rates, constants, computedConstants, algebraic): +def compute_variables(voi, states, rates, constants, computed_constants, algebraic): pass diff --git a/tests/resources/generator/robertson_model_1966/model.dae.py b/tests/resources/generator/robertson_model_1966/model.dae.py index 5094b58a6e..24530a58af 100644 --- a/tests/resources/generator/robertson_model_1966/model.dae.py +++ b/tests/resources/generator/robertson_model_1966/model.dae.py @@ -82,12 +82,12 @@ def compute_computed_constants(constants, computed_constants): pass -def compute_rates(voi, states, rates, constants, computedConstants, algebraic): +def compute_rates(voi, states, rates, constants, computed_constants, algebraic): find_root_0(voi, states, rates, variables) rates[0] = -variables[0]*states[0]+variables[1]*states[1]*variables[2] rates[1] = variables[0]*states[0]-variables[3]*pow(states[1], 2.0)-variables[1]*states[1]*variables[2] -def compute_variables(voi, states, rates, constants, computedConstants, algebraic): +def compute_variables(voi, states, rates, constants, computed_constants, algebraic): find_root_0(voi, states, rates, variables) variables[4] = 10000.0*states[1] diff --git a/tests/resources/generator/robertson_model_1966/model.ode.py b/tests/resources/generator/robertson_model_1966/model.ode.py index e5ed01a6c6..b3c35c945d 100644 --- a/tests/resources/generator/robertson_model_1966/model.ode.py +++ b/tests/resources/generator/robertson_model_1966/model.ode.py @@ -58,11 +58,11 @@ def compute_computed_constants(constants, computed_constants): pass -def compute_rates(voi, states, rates, constants, computedConstants, algebraic): +def compute_rates(voi, states, rates, constants, computed_constants, algebraic): rates[0] = -variables[0]*states[0]+variables[1]*states[2]*states[1] rates[2] = variables[0]*states[0]-variables[2]*pow(states[2], 2.0)-variables[1]*states[2]*states[1] rates[1] = variables[2]*pow(states[2], 2.0) -def compute_variables(voi, states, rates, constants, computedConstants, algebraic): +def compute_variables(voi, states, rates, constants, computed_constants, algebraic): variables[3] = 10000.0*states[2] diff --git a/tests/resources/generator/sine_model_imports/model.py b/tests/resources/generator/sine_model_imports/model.py index d39e9cfac3..563e472daf 100644 --- a/tests/resources/generator/sine_model_imports/model.py +++ b/tests/resources/generator/sine_model_imports/model.py @@ -68,11 +68,11 @@ def compute_computed_constants(constants, computed_constants): pass -def compute_rates(voi, states, rates, constants, computedConstants, algebraic): +def compute_rates(voi, states, rates, constants, computed_constants, algebraic): rates[0] = cos(voi) -def compute_variables(voi, states, rates, constants, computedConstants, algebraic): +def compute_variables(voi, states, rates, constants, computed_constants, algebraic): variables[0] = sin(voi) variables[9] = voi*variables[4]-0.5 if lt_func(voi, variables[6]) else (3.14159265358979-voi)*variables[4]-0.5 if lt_func(voi, variables[7]) else (voi-3.14159265358979)*variables[4]-0.5 if lt_func(voi, variables[8]) else (variables[5]-voi)*variables[4]-0.5 variables[2] = -variables[9]*variables[9]+variables[3]+variables[9] if lt_func(voi, variables[6]) else -variables[9]*variables[9]+variables[3]+variables[9] if lt_func(voi, variables[7]) else variables[9]*variables[9]-variables[3]-variables[9] if lt_func(voi, variables[8]) else variables[9]*variables[9]-variables[3]-variables[9] diff --git a/tests/resources/generator/unknown_variable_as_external_variable/model.py b/tests/resources/generator/unknown_variable_as_external_variable/model.py index 1440ec154c..de190cb846 100644 --- a/tests/resources/generator/unknown_variable_as_external_variable/model.py +++ b/tests/resources/generator/unknown_variable_as_external_variable/model.py @@ -53,6 +53,6 @@ def compute_computed_constants(constants, computed_constants): pass -def compute_variables(constants, computedConstants, algebraic, external_variable): +def compute_variables(constants, computed_constants, algebraic, external_variable): variables[9] = external_variable(variables, 9) variables[0] = variables[1]*(variables[2]*variables[3]-variables[4]*variables[5])/(variables[6]*variables[5]+variables[9]*variables[3]+variables[8]*variables[5]*variables[3]+variables[7]) diff --git a/tests/resources/generator/variable_initialised_using_a_constant/model.py b/tests/resources/generator/variable_initialised_using_a_constant/model.py index 73f1eba8c5..5bfdcb329d 100644 --- a/tests/resources/generator/variable_initialised_using_a_constant/model.py +++ b/tests/resources/generator/variable_initialised_using_a_constant/model.py @@ -49,9 +49,9 @@ def compute_computed_constants(constants, computed_constants): pass -def compute_rates(voi, states, rates, constants, computedConstants, algebraic): +def compute_rates(voi, states, rates, constants, computed_constants, algebraic): rates[0] = 3.0 -def compute_variables(voi, states, rates, constants, computedConstants, algebraic): +def compute_variables(voi, states, rates, constants, computed_constants, algebraic): pass From 82c104ebcf7b4efedaf5f53233261d3ac838f072 Mon Sep 17 00:00:00 2001 From: Alan Garny Date: Wed, 7 Aug 2024 17:20:51 +0200 Subject: [PATCH 08/85] Generator profile: bumped the C and Python versions. --- src/generatorprofile.cpp | 4 ++-- src/generatorprofilesha1values.h | 4 ++-- tests/bindings/python/test_generator_profile.py | 2 +- tests/generator/generatorprofile.cpp | 2 +- tests/resources/coverage/generator/model.c | 2 +- tests/resources/coverage/generator/model.modified.profile.c | 2 +- tests/resources/coverage/generator/model.modified.profile.py | 2 +- tests/resources/coverage/generator/model.py | 2 +- .../generator/algebraic_eqn_computed_var_on_rhs/model.c | 2 +- .../algebraic_eqn_computed_var_on_rhs/model.external.c | 2 +- .../algebraic_eqn_computed_var_on_rhs/model.external.py | 2 +- .../generator/algebraic_eqn_computed_var_on_rhs/model.py | 2 +- .../generator/algebraic_eqn_const_var_on_rhs/model.c | 2 +- .../generator/algebraic_eqn_const_var_on_rhs/model.py | 2 +- .../resources/generator/algebraic_eqn_constant_on_rhs/model.c | 2 +- .../generator/algebraic_eqn_constant_on_rhs/model.py | 2 +- .../generator/algebraic_eqn_derivative_on_rhs/model.c | 2 +- .../generator/algebraic_eqn_derivative_on_rhs/model.py | 2 +- .../algebraic_eqn_derivative_on_rhs_one_component/model.c | 2 +- .../algebraic_eqn_derivative_on_rhs_one_component/model.py | 2 +- .../generator/algebraic_eqn_state_var_on_rhs/model.c | 2 +- .../generator/algebraic_eqn_state_var_on_rhs/model.py | 2 +- .../algebraic_eqn_state_var_on_rhs_one_component/model.c | 2 +- .../algebraic_eqn_state_var_on_rhs_one_component/model.py | 2 +- .../algebraic_eqn_with_one_non_isolated_unknown/model.c | 2 +- .../model.external.c | 2 +- .../model.external.py | 2 +- .../algebraic_eqn_with_one_non_isolated_unknown/model.py | 2 +- .../algebraic_system_with_three_linked_unknowns/model.c | 2 +- .../model.one.external.c | 2 +- .../model.one.external.py | 2 +- .../algebraic_system_with_three_linked_unknowns/model.py | 2 +- .../model.three.externals.c | 2 +- .../model.three.externals.py | 2 +- .../model.two.externals.c | 2 +- .../model.two.externals.py | 2 +- .../model.not.ordered.c | 2 +- .../model.not.ordered.py | 2 +- .../model.ordered.c | 2 +- .../model.ordered.py | 2 +- .../resources/generator/algebraic_unknown_var_on_rhs/model.c | 2 +- .../resources/generator/algebraic_unknown_var_on_rhs/model.py | 2 +- tests/resources/generator/cell_geometry_model/model.c | 2 +- .../resources/generator/cell_geometry_model/model.external.c | 2 +- .../resources/generator/cell_geometry_model/model.external.py | 2 +- tests/resources/generator/cell_geometry_model/model.py | 2 +- .../generator/cellml_mappings_and_encapsulations/model.c | 2 +- .../generator/cellml_mappings_and_encapsulations/model.py | 2 +- tests/resources/generator/cellml_slc_example/model.py | 2 +- .../generator/cellml_state_initialised_using_variable/model.c | 2 +- .../cellml_state_initialised_using_variable/model.py | 2 +- .../resources/generator/cellml_unit_scaling_constant/model.c | 2 +- .../resources/generator/cellml_unit_scaling_constant/model.py | 2 +- tests/resources/generator/cellml_unit_scaling_rate/model.c | 2 +- tests/resources/generator/cellml_unit_scaling_rate/model.py | 2 +- tests/resources/generator/cellml_unit_scaling_state/model.c | 2 +- tests/resources/generator/cellml_unit_scaling_state/model.py | 2 +- .../model.c | 2 +- .../model.py | 2 +- .../model.c | 2 +- .../model.py | 2 +- .../generator/cellml_unit_scaling_voi_direct/model.c | 2 +- .../generator/cellml_unit_scaling_voi_direct/model.py | 2 +- .../generator/cellml_unit_scaling_voi_indirect/model.c | 2 +- .../generator/cellml_unit_scaling_voi_indirect/model.py | 2 +- tests/resources/generator/dae_cellml_1_1_model/model.c | 2 +- tests/resources/generator/dae_cellml_1_1_model/model.py | 2 +- tests/resources/generator/dependent_eqns/model.c | 2 +- tests/resources/generator/dependent_eqns/model.py | 2 +- .../model.c | 2 +- .../model.py | 2 +- .../model.c | 2 +- .../model.py | 2 +- .../hodgkin_huxley_squid_axon_model_1952/model.algebraic.c | 2 +- .../hodgkin_huxley_squid_axon_model_1952/model.algebraic.py | 2 +- .../generator/hodgkin_huxley_squid_axon_model_1952/model.c | 2 +- .../model.computed.constant.c | 2 +- .../model.computed.constant.py | 2 +- .../hodgkin_huxley_squid_axon_model_1952/model.constant.c | 2 +- .../hodgkin_huxley_squid_axon_model_1952/model.constant.py | 2 +- .../hodgkin_huxley_squid_axon_model_1952/model.dae.c | 2 +- .../hodgkin_huxley_squid_axon_model_1952/model.dae.py | 2 +- .../model.dependent.algebraic.c | 2 +- .../model.dependent.algebraic.py | 2 +- .../model.dependent.computed.constant.c | 2 +- .../model.dependent.computed.constant.py | 2 +- .../model.dependent.constant.c | 2 +- .../model.dependent.constant.py | 2 +- .../model.dependent.state.c | 2 +- .../model.dependent.state.py | 2 +- .../hodgkin_huxley_squid_axon_model_1952/model.external.c | 2 +- .../hodgkin_huxley_squid_axon_model_1952/model.external.py | 2 +- .../generator/hodgkin_huxley_squid_axon_model_1952/model.py | 2 +- .../hodgkin_huxley_squid_axon_model_1952/model.state.c | 2 +- .../hodgkin_huxley_squid_axon_model_1952/model.state.py | 2 +- tests/resources/generator/noble_model_1962/model.c | 2 +- tests/resources/generator/noble_model_1962/model.py | 2 +- tests/resources/generator/ode_computed_var_on_rhs/model.c | 2 +- tests/resources/generator/ode_computed_var_on_rhs/model.py | 2 +- .../generator/ode_computed_var_on_rhs_one_component/model.c | 2 +- .../generator/ode_computed_var_on_rhs_one_component/model.py | 2 +- tests/resources/generator/ode_const_var_on_rhs/model.c | 2 +- tests/resources/generator/ode_const_var_on_rhs/model.py | 2 +- .../generator/ode_const_var_on_rhs_one_component/model.c | 2 +- .../generator/ode_const_var_on_rhs_one_component/model.py | 2 +- tests/resources/generator/ode_constant_on_rhs/model.c | 2 +- tests/resources/generator/ode_constant_on_rhs/model.py | 2 +- .../generator/ode_constant_on_rhs_one_component/model.c | 2 +- .../generator/ode_constant_on_rhs_one_component/model.py | 2 +- tests/resources/generator/ode_multiple_dependent_odes/model.c | 2 +- .../resources/generator/ode_multiple_dependent_odes/model.py | 2 +- .../ode_multiple_dependent_odes_one_component/model.c | 2 +- .../ode_multiple_dependent_odes_one_component/model.py | 2 +- .../generator/ode_multiple_odes_with_same_name/model.c | 2 +- .../generator/ode_multiple_odes_with_same_name/model.py | 2 +- tests/resources/generator/ode_unknown_var_on_rhs/model.c | 2 +- tests/resources/generator/ode_unknown_var_on_rhs/model.py | 2 +- tests/resources/generator/robertson_model_1966/model.dae.c | 2 +- tests/resources/generator/robertson_model_1966/model.dae.py | 2 +- tests/resources/generator/robertson_model_1966/model.ode.c | 2 +- tests/resources/generator/robertson_model_1966/model.ode.py | 2 +- tests/resources/generator/sine_model_imports/model.c | 2 +- tests/resources/generator/sine_model_imports/model.py | 2 +- .../generator/unknown_variable_as_external_variable/model.c | 2 +- .../generator/unknown_variable_as_external_variable/model.py | 2 +- .../generator/variable_initialised_using_a_constant/model.c | 2 +- .../generator/variable_initialised_using_a_constant/model.py | 2 +- 127 files changed, 129 insertions(+), 129 deletions(-) diff --git a/src/generatorprofile.cpp b/src/generatorprofile.cpp index f80ad4d120..3dd23d9808 100644 --- a/src/generatorprofile.cpp +++ b/src/generatorprofile.cpp @@ -503,7 +503,7 @@ void GeneratorProfile::GeneratorProfileImpl::loadProfile(GeneratorProfile::Profi "#include \n"; mInterfaceVersionString = "extern const char VERSION[];\n"; - mImplementationVersionString = "const char VERSION[] = \"0.5.0\";\n"; + mImplementationVersionString = "const char VERSION[] = \"0.6.0\";\n"; mInterfaceLibcellmlVersionString = "extern const char LIBCELLML_VERSION[];\n"; mImplementationLibcellmlVersionString = "const char LIBCELLML_VERSION[] = \"[LIBCELLML_VERSION]\";\n"; @@ -938,7 +938,7 @@ void GeneratorProfile::GeneratorProfileImpl::loadProfile(GeneratorProfile::Profi "\n"; mInterfaceVersionString = ""; - mImplementationVersionString = "__version__ = \"0.4.0\"\n"; + mImplementationVersionString = "__version__ = \"0.5.0\"\n"; mInterfaceLibcellmlVersionString = ""; mImplementationLibcellmlVersionString = "LIBCELLML_VERSION = \"[LIBCELLML_VERSION]\"\n"; diff --git a/src/generatorprofilesha1values.h b/src/generatorprofilesha1values.h index 37baac8801..0bae464fbe 100644 --- a/src/generatorprofilesha1values.h +++ b/src/generatorprofilesha1values.h @@ -24,7 +24,7 @@ namespace libcellml { * The content of this file is generated, do not edit this file directly. * See docs/dev_utilities.rst for further information. */ -static const char C_GENERATOR_PROFILE_SHA1[] = "2e1a7d8b5995845aceceeb06e8f084f9e11fa13d"; -static const char PYTHON_GENERATOR_PROFILE_SHA1[] = "c9f2a238d3334dcca065f2f8f3e1bf3e875e52df"; +static const char C_GENERATOR_PROFILE_SHA1[] = "060945ab10d8ce4ce063e4b64199f684ec0150a5"; +static const char PYTHON_GENERATOR_PROFILE_SHA1[] = "859d7920e76c1a12345a2d642940163d41d27112"; } // namespace libcellml diff --git a/tests/bindings/python/test_generator_profile.py b/tests/bindings/python/test_generator_profile.py index 8749ef922a..4eb8a46fad 100644 --- a/tests/bindings/python/test_generator_profile.py +++ b/tests/bindings/python/test_generator_profile.py @@ -949,7 +949,7 @@ def test_implementation_version_string(self): g = GeneratorProfile() - self.assertEqual('const char VERSION[] = "0.5.0";\n', g.implementationVersionString()) + self.assertEqual('const char VERSION[] = "0.6.0";\n', g.implementationVersionString()) g.setImplementationVersionString(GeneratorProfileTestCase.VALUE) self.assertEqual(GeneratorProfileTestCase.VALUE, g.implementationVersionString()) diff --git a/tests/generator/generatorprofile.cpp b/tests/generator/generatorprofile.cpp index bde173bdc8..f690252bc9 100644 --- a/tests/generator/generatorprofile.cpp +++ b/tests/generator/generatorprofile.cpp @@ -271,7 +271,7 @@ TEST(GeneratorProfile, defaultMiscellaneousValues) generatorProfile->implementationHeaderString()); EXPECT_EQ("extern const char VERSION[];\n", generatorProfile->interfaceVersionString()); - EXPECT_EQ("const char VERSION[] = \"0.5.0\";\n", generatorProfile->implementationVersionString()); + EXPECT_EQ("const char VERSION[] = \"0.6.0\";\n", generatorProfile->implementationVersionString()); EXPECT_EQ("extern const char LIBCELLML_VERSION[];\n", generatorProfile->interfaceLibcellmlVersionString()); EXPECT_EQ("const char LIBCELLML_VERSION[] = \"[LIBCELLML_VERSION]\";\n", generatorProfile->implementationLibcellmlVersionString()); diff --git a/tests/resources/coverage/generator/model.c b/tests/resources/coverage/generator/model.c index 9d74d76711..e5bf4ccdf2 100644 --- a/tests/resources/coverage/generator/model.c +++ b/tests/resources/coverage/generator/model.c @@ -5,7 +5,7 @@ #include #include -const char VERSION[] = "0.5.0"; +const char VERSION[] = "0.6.0"; const char LIBCELLML_VERSION[] = "0.5.0"; const size_t STATE_COUNT = 1; diff --git a/tests/resources/coverage/generator/model.modified.profile.c b/tests/resources/coverage/generator/model.modified.profile.c index c05a4023dc..b86a172b9b 100644 --- a/tests/resources/coverage/generator/model.modified.profile.c +++ b/tests/resources/coverage/generator/model.modified.profile.c @@ -5,7 +5,7 @@ #include #include -const char VERSION[] = "0.5.0.post0"; +const char VERSION[] = "0.6.0.post0"; const char LIBCELLML_VERSION[] = "0.5.0"; const size_t STATE_COUNT = 1; diff --git a/tests/resources/coverage/generator/model.modified.profile.py b/tests/resources/coverage/generator/model.modified.profile.py index 8cfd548b6b..a6c7be6c6b 100644 --- a/tests/resources/coverage/generator/model.modified.profile.py +++ b/tests/resources/coverage/generator/model.modified.profile.py @@ -4,7 +4,7 @@ from math import * -__version__ = "0.4.0.post0" +__version__ = "0.5.0.post0" LIBCELLML_VERSION = "0.5.0" STATE_COUNT = 1 diff --git a/tests/resources/coverage/generator/model.py b/tests/resources/coverage/generator/model.py index 6c180abe61..1a6049e40a 100644 --- a/tests/resources/coverage/generator/model.py +++ b/tests/resources/coverage/generator/model.py @@ -4,7 +4,7 @@ from math import * -__version__ = "0.4.0" +__version__ = "0.5.0" LIBCELLML_VERSION = "0.5.0" STATE_COUNT = 1 diff --git a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.c b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.c index 26a2df478e..42f15c79b8 100644 --- a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.c +++ b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.c @@ -5,7 +5,7 @@ #include #include -const char VERSION[] = "0.5.0"; +const char VERSION[] = "0.6.0"; const char LIBCELLML_VERSION[] = "0.5.0"; const size_t CONSTANT_COUNT = 0; diff --git a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.c b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.c index 668e81b0b3..8cbf6bf057 100644 --- a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.c +++ b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.c @@ -5,7 +5,7 @@ #include #include -const char VERSION[] = "0.5.0"; +const char VERSION[] = "0.6.0"; const char LIBCELLML_VERSION[] = "0.5.0"; const size_t CONSTANT_COUNT = 0; diff --git a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.py b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.py index 2c84fc24d8..2670115d48 100644 --- a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.py +++ b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.py @@ -4,7 +4,7 @@ from math import * -__version__ = "0.4.0" +__version__ = "0.5.0" LIBCELLML_VERSION = "0.5.0" CONSTANT_COUNT = 0 diff --git a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.py b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.py index 924cb661f7..24d09dbb1c 100644 --- a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.py +++ b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.py @@ -4,7 +4,7 @@ from math import * -__version__ = "0.4.0" +__version__ = "0.5.0" LIBCELLML_VERSION = "0.5.0" CONSTANT_COUNT = 0 diff --git a/tests/resources/generator/algebraic_eqn_const_var_on_rhs/model.c b/tests/resources/generator/algebraic_eqn_const_var_on_rhs/model.c index 47f5f52480..dc50dc17e1 100644 --- a/tests/resources/generator/algebraic_eqn_const_var_on_rhs/model.c +++ b/tests/resources/generator/algebraic_eqn_const_var_on_rhs/model.c @@ -5,7 +5,7 @@ #include #include -const char VERSION[] = "0.5.0"; +const char VERSION[] = "0.6.0"; const char LIBCELLML_VERSION[] = "0.5.0"; const size_t CONSTANT_COUNT = 0; diff --git a/tests/resources/generator/algebraic_eqn_const_var_on_rhs/model.py b/tests/resources/generator/algebraic_eqn_const_var_on_rhs/model.py index d0506c02ee..305a6e7fd5 100644 --- a/tests/resources/generator/algebraic_eqn_const_var_on_rhs/model.py +++ b/tests/resources/generator/algebraic_eqn_const_var_on_rhs/model.py @@ -4,7 +4,7 @@ from math import * -__version__ = "0.4.0" +__version__ = "0.5.0" LIBCELLML_VERSION = "0.5.0" CONSTANT_COUNT = 0 diff --git a/tests/resources/generator/algebraic_eqn_constant_on_rhs/model.c b/tests/resources/generator/algebraic_eqn_constant_on_rhs/model.c index 7c468c0fcd..5e1791ae73 100644 --- a/tests/resources/generator/algebraic_eqn_constant_on_rhs/model.c +++ b/tests/resources/generator/algebraic_eqn_constant_on_rhs/model.c @@ -5,7 +5,7 @@ #include #include -const char VERSION[] = "0.5.0"; +const char VERSION[] = "0.6.0"; const char LIBCELLML_VERSION[] = "0.5.0"; const size_t CONSTANT_COUNT = 0; diff --git a/tests/resources/generator/algebraic_eqn_constant_on_rhs/model.py b/tests/resources/generator/algebraic_eqn_constant_on_rhs/model.py index 2dd09c5f72..461c246474 100644 --- a/tests/resources/generator/algebraic_eqn_constant_on_rhs/model.py +++ b/tests/resources/generator/algebraic_eqn_constant_on_rhs/model.py @@ -4,7 +4,7 @@ from math import * -__version__ = "0.4.0" +__version__ = "0.5.0" LIBCELLML_VERSION = "0.5.0" CONSTANT_COUNT = 0 diff --git a/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.c b/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.c index 29028861f2..c37ec41540 100644 --- a/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.c +++ b/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.c @@ -5,7 +5,7 @@ #include #include -const char VERSION[] = "0.5.0"; +const char VERSION[] = "0.6.0"; const char LIBCELLML_VERSION[] = "0.5.0"; const size_t STATE_COUNT = 1; diff --git a/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.py b/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.py index e1f727c2e9..dcdeee9d72 100644 --- a/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.py +++ b/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.py @@ -4,7 +4,7 @@ from math import * -__version__ = "0.4.0" +__version__ = "0.5.0" LIBCELLML_VERSION = "0.5.0" STATE_COUNT = 1 diff --git a/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.c b/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.c index 7e62bf29a7..360d5cdaf2 100644 --- a/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.c +++ b/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.c @@ -5,7 +5,7 @@ #include #include -const char VERSION[] = "0.5.0"; +const char VERSION[] = "0.6.0"; const char LIBCELLML_VERSION[] = "0.5.0"; const size_t STATE_COUNT = 1; diff --git a/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.py b/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.py index ecf0e2c0ef..b6ba332de9 100644 --- a/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.py +++ b/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.py @@ -4,7 +4,7 @@ from math import * -__version__ = "0.4.0" +__version__ = "0.5.0" LIBCELLML_VERSION = "0.5.0" STATE_COUNT = 1 diff --git a/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.c b/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.c index 9e4c71ae59..3ad5d87628 100644 --- a/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.c +++ b/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.c @@ -5,7 +5,7 @@ #include #include -const char VERSION[] = "0.5.0"; +const char VERSION[] = "0.6.0"; const char LIBCELLML_VERSION[] = "0.5.0"; const size_t STATE_COUNT = 1; diff --git a/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.py b/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.py index 5fbae38c76..b8d4bcc52e 100644 --- a/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.py +++ b/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.py @@ -4,7 +4,7 @@ from math import * -__version__ = "0.4.0" +__version__ = "0.5.0" LIBCELLML_VERSION = "0.5.0" STATE_COUNT = 1 diff --git a/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.c b/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.c index 5f011b73d1..18593d1313 100644 --- a/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.c +++ b/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.c @@ -5,7 +5,7 @@ #include #include -const char VERSION[] = "0.5.0"; +const char VERSION[] = "0.6.0"; const char LIBCELLML_VERSION[] = "0.5.0"; const size_t STATE_COUNT = 1; diff --git a/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.py b/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.py index 7476abdcb4..6bbd5c64cb 100644 --- a/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.py +++ b/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.py @@ -4,7 +4,7 @@ from math import * -__version__ = "0.4.0" +__version__ = "0.5.0" LIBCELLML_VERSION = "0.5.0" STATE_COUNT = 1 diff --git a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.c b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.c index 9913feba29..f8f2240c0a 100644 --- a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.c +++ b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.c @@ -5,7 +5,7 @@ #include #include -const char VERSION[] = "0.5.0"; +const char VERSION[] = "0.6.0"; const char LIBCELLML_VERSION[] = "0.5.0"; const size_t CONSTANT_COUNT = 0; diff --git a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.c b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.c index f23b5c4734..3117d0d815 100644 --- a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.c +++ b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.c @@ -5,7 +5,7 @@ #include #include -const char VERSION[] = "0.5.0"; +const char VERSION[] = "0.6.0"; const char LIBCELLML_VERSION[] = "0.5.0"; const size_t CONSTANT_COUNT = 0; diff --git a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.py b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.py index 3a560ffca1..a2b79b941c 100644 --- a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.py +++ b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.py @@ -4,7 +4,7 @@ from math import * -__version__ = "0.4.0" +__version__ = "0.5.0" LIBCELLML_VERSION = "0.5.0" CONSTANT_COUNT = 0 diff --git a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.py b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.py index 3c1f6c1774..f85863b933 100644 --- a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.py +++ b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.py @@ -4,7 +4,7 @@ from math import * -__version__ = "0.4.0" +__version__ = "0.5.0" LIBCELLML_VERSION = "0.5.0" CONSTANT_COUNT = 0 diff --git a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.c b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.c index bf5e76015f..535e4e8e68 100644 --- a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.c +++ b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.c @@ -5,7 +5,7 @@ #include #include -const char VERSION[] = "0.5.0"; +const char VERSION[] = "0.6.0"; const char LIBCELLML_VERSION[] = "0.5.0"; const size_t CONSTANT_COUNT = 0; diff --git a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.one.external.c b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.one.external.c index de17ebdf88..46aff4ae67 100644 --- a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.one.external.c +++ b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.one.external.c @@ -5,7 +5,7 @@ #include #include -const char VERSION[] = "0.5.0"; +const char VERSION[] = "0.6.0"; const char LIBCELLML_VERSION[] = "0.5.0"; const size_t CONSTANT_COUNT = 0; diff --git a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.one.external.py b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.one.external.py index e7930ae9dd..bd566aa08d 100644 --- a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.one.external.py +++ b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.one.external.py @@ -4,7 +4,7 @@ from math import * -__version__ = "0.4.0" +__version__ = "0.5.0" LIBCELLML_VERSION = "0.5.0" CONSTANT_COUNT = 0 diff --git a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.py b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.py index a5c2fd0848..cd3f4d26a8 100644 --- a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.py +++ b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.py @@ -4,7 +4,7 @@ from math import * -__version__ = "0.4.0" +__version__ = "0.5.0" LIBCELLML_VERSION = "0.5.0" CONSTANT_COUNT = 0 diff --git a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.c b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.c index d21c2ed3ce..4f5a987093 100644 --- a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.c +++ b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.c @@ -5,7 +5,7 @@ #include #include -const char VERSION[] = "0.5.0"; +const char VERSION[] = "0.6.0"; const char LIBCELLML_VERSION[] = "0.5.0"; const size_t CONSTANT_COUNT = 0; diff --git a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.py b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.py index dc4b5ea804..83aafcbbc1 100644 --- a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.py +++ b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.py @@ -4,7 +4,7 @@ from math import * -__version__ = "0.4.0" +__version__ = "0.5.0" LIBCELLML_VERSION = "0.5.0" CONSTANT_COUNT = 0 diff --git a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.two.externals.c b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.two.externals.c index 06059cabca..797c82c58b 100644 --- a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.two.externals.c +++ b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.two.externals.c @@ -5,7 +5,7 @@ #include #include -const char VERSION[] = "0.5.0"; +const char VERSION[] = "0.6.0"; const char LIBCELLML_VERSION[] = "0.5.0"; const size_t CONSTANT_COUNT = 0; diff --git a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.two.externals.py b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.two.externals.py index 78b0c39b31..3ce4e8ff07 100644 --- a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.two.externals.py +++ b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.two.externals.py @@ -4,7 +4,7 @@ from math import * -__version__ = "0.4.0" +__version__ = "0.5.0" LIBCELLML_VERSION = "0.5.0" CONSTANT_COUNT = 0 diff --git a/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.c b/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.c index 06fecfbf60..462c28f737 100644 --- a/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.c +++ b/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.c @@ -5,7 +5,7 @@ #include #include -const char VERSION[] = "0.5.0"; +const char VERSION[] = "0.6.0"; const char LIBCELLML_VERSION[] = "0.5.0"; const size_t CONSTANT_COUNT = 0; diff --git a/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.py b/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.py index 09d7f087b2..723234a885 100644 --- a/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.py +++ b/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.py @@ -4,7 +4,7 @@ from math import * -__version__ = "0.4.0" +__version__ = "0.5.0" LIBCELLML_VERSION = "0.5.0" CONSTANT_COUNT = 0 diff --git a/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.c b/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.c index c964d754d5..e8af03001a 100644 --- a/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.c +++ b/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.c @@ -5,7 +5,7 @@ #include #include -const char VERSION[] = "0.5.0"; +const char VERSION[] = "0.6.0"; const char LIBCELLML_VERSION[] = "0.5.0"; const size_t CONSTANT_COUNT = 0; diff --git a/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.py b/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.py index 79c59418ad..20c8f31559 100644 --- a/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.py +++ b/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.py @@ -4,7 +4,7 @@ from math import * -__version__ = "0.4.0" +__version__ = "0.5.0" LIBCELLML_VERSION = "0.5.0" CONSTANT_COUNT = 0 diff --git a/tests/resources/generator/algebraic_unknown_var_on_rhs/model.c b/tests/resources/generator/algebraic_unknown_var_on_rhs/model.c index 8a47521561..5224ee2147 100644 --- a/tests/resources/generator/algebraic_unknown_var_on_rhs/model.c +++ b/tests/resources/generator/algebraic_unknown_var_on_rhs/model.c @@ -5,7 +5,7 @@ #include #include -const char VERSION[] = "0.5.0"; +const char VERSION[] = "0.6.0"; const char LIBCELLML_VERSION[] = "0.5.0"; const size_t CONSTANT_COUNT = 0; diff --git a/tests/resources/generator/algebraic_unknown_var_on_rhs/model.py b/tests/resources/generator/algebraic_unknown_var_on_rhs/model.py index 8dbebec15b..c4bec2a5c4 100644 --- a/tests/resources/generator/algebraic_unknown_var_on_rhs/model.py +++ b/tests/resources/generator/algebraic_unknown_var_on_rhs/model.py @@ -4,7 +4,7 @@ from math import * -__version__ = "0.4.0" +__version__ = "0.5.0" LIBCELLML_VERSION = "0.5.0" CONSTANT_COUNT = 0 diff --git a/tests/resources/generator/cell_geometry_model/model.c b/tests/resources/generator/cell_geometry_model/model.c index 39360db84f..8087a0ebc1 100644 --- a/tests/resources/generator/cell_geometry_model/model.c +++ b/tests/resources/generator/cell_geometry_model/model.c @@ -5,7 +5,7 @@ #include #include -const char VERSION[] = "0.5.0"; +const char VERSION[] = "0.6.0"; const char LIBCELLML_VERSION[] = "0.5.0"; const size_t CONSTANT_COUNT = 0; diff --git a/tests/resources/generator/cell_geometry_model/model.external.c b/tests/resources/generator/cell_geometry_model/model.external.c index 4342b4cbec..c9c0f76f82 100644 --- a/tests/resources/generator/cell_geometry_model/model.external.c +++ b/tests/resources/generator/cell_geometry_model/model.external.c @@ -5,7 +5,7 @@ #include #include -const char VERSION[] = "0.5.0"; +const char VERSION[] = "0.6.0"; const char LIBCELLML_VERSION[] = "0.5.0"; const size_t CONSTANT_COUNT = 0; diff --git a/tests/resources/generator/cell_geometry_model/model.external.py b/tests/resources/generator/cell_geometry_model/model.external.py index ddad520d3f..2e565edd4d 100644 --- a/tests/resources/generator/cell_geometry_model/model.external.py +++ b/tests/resources/generator/cell_geometry_model/model.external.py @@ -4,7 +4,7 @@ from math import * -__version__ = "0.4.0" +__version__ = "0.5.0" LIBCELLML_VERSION = "0.5.0" CONSTANT_COUNT = 0 diff --git a/tests/resources/generator/cell_geometry_model/model.py b/tests/resources/generator/cell_geometry_model/model.py index b4f3170972..dd282fbf35 100644 --- a/tests/resources/generator/cell_geometry_model/model.py +++ b/tests/resources/generator/cell_geometry_model/model.py @@ -4,7 +4,7 @@ from math import * -__version__ = "0.4.0" +__version__ = "0.5.0" LIBCELLML_VERSION = "0.5.0" CONSTANT_COUNT = 0 diff --git a/tests/resources/generator/cellml_mappings_and_encapsulations/model.c b/tests/resources/generator/cellml_mappings_and_encapsulations/model.c index 19a0356dc2..af77c8adbe 100644 --- a/tests/resources/generator/cellml_mappings_and_encapsulations/model.c +++ b/tests/resources/generator/cellml_mappings_and_encapsulations/model.c @@ -5,7 +5,7 @@ #include #include -const char VERSION[] = "0.5.0"; +const char VERSION[] = "0.6.0"; const char LIBCELLML_VERSION[] = "0.5.0"; const size_t STATE_COUNT = 2; diff --git a/tests/resources/generator/cellml_mappings_and_encapsulations/model.py b/tests/resources/generator/cellml_mappings_and_encapsulations/model.py index b17226251e..48ead204d4 100644 --- a/tests/resources/generator/cellml_mappings_and_encapsulations/model.py +++ b/tests/resources/generator/cellml_mappings_and_encapsulations/model.py @@ -4,7 +4,7 @@ from math import * -__version__ = "0.4.0" +__version__ = "0.5.0" LIBCELLML_VERSION = "0.5.0" STATE_COUNT = 2 diff --git a/tests/resources/generator/cellml_slc_example/model.py b/tests/resources/generator/cellml_slc_example/model.py index b97fb76d87..e46136ff87 100644 --- a/tests/resources/generator/cellml_slc_example/model.py +++ b/tests/resources/generator/cellml_slc_example/model.py @@ -4,7 +4,7 @@ from math import * -__version__ = "0.4.0" +__version__ = "0.5.0" LIBCELLML_VERSION = "0.5.0" CONSTANT_COUNT = 0 diff --git a/tests/resources/generator/cellml_state_initialised_using_variable/model.c b/tests/resources/generator/cellml_state_initialised_using_variable/model.c index 1dcda0f17c..fd33a5b300 100644 --- a/tests/resources/generator/cellml_state_initialised_using_variable/model.c +++ b/tests/resources/generator/cellml_state_initialised_using_variable/model.c @@ -5,7 +5,7 @@ #include #include -const char VERSION[] = "0.5.0"; +const char VERSION[] = "0.6.0"; const char LIBCELLML_VERSION[] = "0.5.0"; const size_t STATE_COUNT = 1; diff --git a/tests/resources/generator/cellml_state_initialised_using_variable/model.py b/tests/resources/generator/cellml_state_initialised_using_variable/model.py index 2acb9513ef..246d135ba0 100644 --- a/tests/resources/generator/cellml_state_initialised_using_variable/model.py +++ b/tests/resources/generator/cellml_state_initialised_using_variable/model.py @@ -4,7 +4,7 @@ from math import * -__version__ = "0.4.0" +__version__ = "0.5.0" LIBCELLML_VERSION = "0.5.0" STATE_COUNT = 1 diff --git a/tests/resources/generator/cellml_unit_scaling_constant/model.c b/tests/resources/generator/cellml_unit_scaling_constant/model.c index 6f1761c466..5ec839f548 100644 --- a/tests/resources/generator/cellml_unit_scaling_constant/model.c +++ b/tests/resources/generator/cellml_unit_scaling_constant/model.c @@ -5,7 +5,7 @@ #include #include -const char VERSION[] = "0.5.0"; +const char VERSION[] = "0.6.0"; const char LIBCELLML_VERSION[] = "0.5.0"; const size_t CONSTANT_COUNT = 0; diff --git a/tests/resources/generator/cellml_unit_scaling_constant/model.py b/tests/resources/generator/cellml_unit_scaling_constant/model.py index fe0dc254f1..83f5af0c90 100644 --- a/tests/resources/generator/cellml_unit_scaling_constant/model.py +++ b/tests/resources/generator/cellml_unit_scaling_constant/model.py @@ -4,7 +4,7 @@ from math import * -__version__ = "0.4.0" +__version__ = "0.5.0" LIBCELLML_VERSION = "0.5.0" CONSTANT_COUNT = 0 diff --git a/tests/resources/generator/cellml_unit_scaling_rate/model.c b/tests/resources/generator/cellml_unit_scaling_rate/model.c index a9c2fae822..56547ca65a 100644 --- a/tests/resources/generator/cellml_unit_scaling_rate/model.c +++ b/tests/resources/generator/cellml_unit_scaling_rate/model.c @@ -5,7 +5,7 @@ #include #include -const char VERSION[] = "0.5.0"; +const char VERSION[] = "0.6.0"; const char LIBCELLML_VERSION[] = "0.5.0"; const size_t STATE_COUNT = 1; diff --git a/tests/resources/generator/cellml_unit_scaling_rate/model.py b/tests/resources/generator/cellml_unit_scaling_rate/model.py index e3ba6287ba..97589bc349 100644 --- a/tests/resources/generator/cellml_unit_scaling_rate/model.py +++ b/tests/resources/generator/cellml_unit_scaling_rate/model.py @@ -4,7 +4,7 @@ from math import * -__version__ = "0.4.0" +__version__ = "0.5.0" LIBCELLML_VERSION = "0.5.0" STATE_COUNT = 1 diff --git a/tests/resources/generator/cellml_unit_scaling_state/model.c b/tests/resources/generator/cellml_unit_scaling_state/model.c index 047b6b6b0c..fc1ab5e93c 100644 --- a/tests/resources/generator/cellml_unit_scaling_state/model.c +++ b/tests/resources/generator/cellml_unit_scaling_state/model.c @@ -5,7 +5,7 @@ #include #include -const char VERSION[] = "0.5.0"; +const char VERSION[] = "0.6.0"; const char LIBCELLML_VERSION[] = "0.5.0"; const size_t STATE_COUNT = 1; diff --git a/tests/resources/generator/cellml_unit_scaling_state/model.py b/tests/resources/generator/cellml_unit_scaling_state/model.py index b690773a88..1c964deb86 100644 --- a/tests/resources/generator/cellml_unit_scaling_state/model.py +++ b/tests/resources/generator/cellml_unit_scaling_state/model.py @@ -4,7 +4,7 @@ from math import * -__version__ = "0.4.0" +__version__ = "0.5.0" LIBCELLML_VERSION = "0.5.0" STATE_COUNT = 1 diff --git a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.c b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.c index 07c05c52ba..c0db3b3a33 100644 --- a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.c +++ b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.c @@ -5,7 +5,7 @@ #include #include -const char VERSION[] = "0.5.0"; +const char VERSION[] = "0.6.0"; const char LIBCELLML_VERSION[] = "0.5.0"; const size_t STATE_COUNT = 2; diff --git a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.py b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.py index 2457852613..86e48a995e 100644 --- a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.py +++ b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.py @@ -4,7 +4,7 @@ from math import * -__version__ = "0.4.0" +__version__ = "0.5.0" LIBCELLML_VERSION = "0.5.0" STATE_COUNT = 2 diff --git a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.c b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.c index c3fadb3708..bafc5259f8 100644 --- a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.c +++ b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.c @@ -5,7 +5,7 @@ #include #include -const char VERSION[] = "0.5.0"; +const char VERSION[] = "0.6.0"; const char LIBCELLML_VERSION[] = "0.5.0"; const size_t STATE_COUNT = 2; diff --git a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.py b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.py index bd5761c821..029b44f7a4 100644 --- a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.py +++ b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.py @@ -4,7 +4,7 @@ from math import * -__version__ = "0.4.0" +__version__ = "0.5.0" LIBCELLML_VERSION = "0.5.0" STATE_COUNT = 2 diff --git a/tests/resources/generator/cellml_unit_scaling_voi_direct/model.c b/tests/resources/generator/cellml_unit_scaling_voi_direct/model.c index b2c6f6c846..f0e1d42ba4 100644 --- a/tests/resources/generator/cellml_unit_scaling_voi_direct/model.c +++ b/tests/resources/generator/cellml_unit_scaling_voi_direct/model.c @@ -5,7 +5,7 @@ #include #include -const char VERSION[] = "0.5.0"; +const char VERSION[] = "0.6.0"; const char LIBCELLML_VERSION[] = "0.5.0"; const size_t STATE_COUNT = 2; diff --git a/tests/resources/generator/cellml_unit_scaling_voi_direct/model.py b/tests/resources/generator/cellml_unit_scaling_voi_direct/model.py index 29f3f445e0..e14df017f1 100644 --- a/tests/resources/generator/cellml_unit_scaling_voi_direct/model.py +++ b/tests/resources/generator/cellml_unit_scaling_voi_direct/model.py @@ -4,7 +4,7 @@ from math import * -__version__ = "0.4.0" +__version__ = "0.5.0" LIBCELLML_VERSION = "0.5.0" STATE_COUNT = 2 diff --git a/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.c b/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.c index 7a603b2d4f..cd6840c595 100644 --- a/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.c +++ b/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.c @@ -5,7 +5,7 @@ #include #include -const char VERSION[] = "0.5.0"; +const char VERSION[] = "0.6.0"; const char LIBCELLML_VERSION[] = "0.5.0"; const size_t STATE_COUNT = 3; diff --git a/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.py b/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.py index e9a8f3b731..ac4a5b3097 100644 --- a/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.py +++ b/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.py @@ -4,7 +4,7 @@ from math import * -__version__ = "0.4.0" +__version__ = "0.5.0" LIBCELLML_VERSION = "0.5.0" STATE_COUNT = 3 diff --git a/tests/resources/generator/dae_cellml_1_1_model/model.c b/tests/resources/generator/dae_cellml_1_1_model/model.c index b740b21726..c349b48caa 100644 --- a/tests/resources/generator/dae_cellml_1_1_model/model.c +++ b/tests/resources/generator/dae_cellml_1_1_model/model.c @@ -5,7 +5,7 @@ #include #include -const char VERSION[] = "0.5.0"; +const char VERSION[] = "0.6.0"; const char LIBCELLML_VERSION[] = "0.5.0"; const size_t STATE_COUNT = 2; diff --git a/tests/resources/generator/dae_cellml_1_1_model/model.py b/tests/resources/generator/dae_cellml_1_1_model/model.py index fd231105c9..793f148fac 100644 --- a/tests/resources/generator/dae_cellml_1_1_model/model.py +++ b/tests/resources/generator/dae_cellml_1_1_model/model.py @@ -4,7 +4,7 @@ from math import * -__version__ = "0.4.0" +__version__ = "0.5.0" LIBCELLML_VERSION = "0.5.0" STATE_COUNT = 2 diff --git a/tests/resources/generator/dependent_eqns/model.c b/tests/resources/generator/dependent_eqns/model.c index 438e961387..e85abef766 100644 --- a/tests/resources/generator/dependent_eqns/model.c +++ b/tests/resources/generator/dependent_eqns/model.c @@ -5,7 +5,7 @@ #include #include -const char VERSION[] = "0.5.0"; +const char VERSION[] = "0.6.0"; const char LIBCELLML_VERSION[] = "0.5.0"; const size_t STATE_COUNT = 1; diff --git a/tests/resources/generator/dependent_eqns/model.py b/tests/resources/generator/dependent_eqns/model.py index a42b874330..a5a26864cc 100644 --- a/tests/resources/generator/dependent_eqns/model.py +++ b/tests/resources/generator/dependent_eqns/model.py @@ -4,7 +4,7 @@ from math import * -__version__ = "0.4.0" +__version__ = "0.5.0" LIBCELLML_VERSION = "0.5.0" STATE_COUNT = 1 diff --git a/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.c b/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.c index 041796f933..ee620de9a6 100644 --- a/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.c +++ b/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.c @@ -5,7 +5,7 @@ #include #include -const char VERSION[] = "0.5.0"; +const char VERSION[] = "0.6.0"; const char LIBCELLML_VERSION[] = "0.5.0"; const size_t STATE_COUNT = 33; diff --git a/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.py b/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.py index 9ef7459aa3..9831f67e58 100644 --- a/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.py +++ b/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.py @@ -4,7 +4,7 @@ from math import * -__version__ = "0.4.0" +__version__ = "0.5.0" LIBCELLML_VERSION = "0.5.0" STATE_COUNT = 33 diff --git a/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.c b/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.c index 19eb9ce0b7..d2856f1c0d 100644 --- a/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.c +++ b/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.c @@ -5,7 +5,7 @@ #include #include -const char VERSION[] = "0.5.0"; +const char VERSION[] = "0.6.0"; const char LIBCELLML_VERSION[] = "0.5.0"; const size_t STATE_COUNT = 15; diff --git a/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.py b/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.py index 911753d70c..4a43aaffe1 100644 --- a/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.py +++ b/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.py @@ -4,7 +4,7 @@ from math import * -__version__ = "0.4.0" +__version__ = "0.5.0" LIBCELLML_VERSION = "0.5.0" STATE_COUNT = 15 diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.c index fcdfb29719..b7a5b4fd4e 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.c @@ -5,7 +5,7 @@ #include #include -const char VERSION[] = "0.5.0"; +const char VERSION[] = "0.6.0"; const char LIBCELLML_VERSION[] = "0.5.0"; const size_t STATE_COUNT = 4; diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.py index 5e1461769e..0b83a47b5b 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.py @@ -4,7 +4,7 @@ from math import * -__version__ = "0.4.0" +__version__ = "0.5.0" LIBCELLML_VERSION = "0.5.0" STATE_COUNT = 4 diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.c index 4b94c1415a..11925369a1 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.c @@ -5,7 +5,7 @@ #include #include -const char VERSION[] = "0.5.0"; +const char VERSION[] = "0.6.0"; const char LIBCELLML_VERSION[] = "0.5.0"; const size_t STATE_COUNT = 4; diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.c index 68d2fa006a..122e1223d2 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.c @@ -5,7 +5,7 @@ #include #include -const char VERSION[] = "0.5.0"; +const char VERSION[] = "0.6.0"; const char LIBCELLML_VERSION[] = "0.5.0"; const size_t STATE_COUNT = 4; diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.py index e92d16dca6..a68331edb9 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.py @@ -4,7 +4,7 @@ from math import * -__version__ = "0.4.0" +__version__ = "0.5.0" LIBCELLML_VERSION = "0.5.0" STATE_COUNT = 4 diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.c index 14a7b75c4e..074683762c 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.c @@ -5,7 +5,7 @@ #include #include -const char VERSION[] = "0.5.0"; +const char VERSION[] = "0.6.0"; const char LIBCELLML_VERSION[] = "0.5.0"; const size_t STATE_COUNT = 4; diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.py index 942441414f..ea8e627d86 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.py @@ -4,7 +4,7 @@ from math import * -__version__ = "0.4.0" +__version__ = "0.5.0" LIBCELLML_VERSION = "0.5.0" STATE_COUNT = 4 diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.c index ed19fae664..3dd59ed73c 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.c @@ -5,7 +5,7 @@ #include #include -const char VERSION[] = "0.5.0"; +const char VERSION[] = "0.6.0"; const char LIBCELLML_VERSION[] = "0.5.0"; const size_t STATE_COUNT = 4; diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.py index 85b8315e50..b74a9e03c2 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.py @@ -4,7 +4,7 @@ from math import * -__version__ = "0.4.0" +__version__ = "0.5.0" LIBCELLML_VERSION = "0.5.0" STATE_COUNT = 4 diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.c index dd14ced271..d71fcc4104 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.c @@ -5,7 +5,7 @@ #include #include -const char VERSION[] = "0.5.0"; +const char VERSION[] = "0.6.0"; const char LIBCELLML_VERSION[] = "0.5.0"; const size_t STATE_COUNT = 4; diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.py index 251ac76799..4f026e071d 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.py @@ -4,7 +4,7 @@ from math import * -__version__ = "0.4.0" +__version__ = "0.5.0" LIBCELLML_VERSION = "0.5.0" STATE_COUNT = 4 diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.c index a28677e4a2..35e65eb5b6 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.c @@ -5,7 +5,7 @@ #include #include -const char VERSION[] = "0.5.0"; +const char VERSION[] = "0.6.0"; const char LIBCELLML_VERSION[] = "0.5.0"; const size_t STATE_COUNT = 4; diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.py index 3c0aa7915d..fa91989064 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.py @@ -4,7 +4,7 @@ from math import * -__version__ = "0.4.0" +__version__ = "0.5.0" LIBCELLML_VERSION = "0.5.0" STATE_COUNT = 4 diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.c index ab3a49ebbf..a5180f9026 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.c @@ -5,7 +5,7 @@ #include #include -const char VERSION[] = "0.5.0"; +const char VERSION[] = "0.6.0"; const char LIBCELLML_VERSION[] = "0.5.0"; const size_t STATE_COUNT = 4; diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.py index 248c82ab51..71f9a4827e 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.py @@ -4,7 +4,7 @@ from math import * -__version__ = "0.4.0" +__version__ = "0.5.0" LIBCELLML_VERSION = "0.5.0" STATE_COUNT = 4 diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.c index e23e1ca94e..0f7cdf5056 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.c @@ -5,7 +5,7 @@ #include #include -const char VERSION[] = "0.5.0"; +const char VERSION[] = "0.6.0"; const char LIBCELLML_VERSION[] = "0.5.0"; const size_t STATE_COUNT = 2; diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.py index adbb263b49..16326c27d3 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.py @@ -4,7 +4,7 @@ from math import * -__version__ = "0.4.0" +__version__ = "0.5.0" LIBCELLML_VERSION = "0.5.0" STATE_COUNT = 2 diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.c index 25cd348f14..4deb76e688 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.c @@ -5,7 +5,7 @@ #include #include -const char VERSION[] = "0.5.0"; +const char VERSION[] = "0.6.0"; const char LIBCELLML_VERSION[] = "0.5.0"; const size_t STATE_COUNT = 3; diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.py index b280fc68e7..89c02e24c7 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.py @@ -4,7 +4,7 @@ from math import * -__version__ = "0.4.0" +__version__ = "0.5.0" LIBCELLML_VERSION = "0.5.0" STATE_COUNT = 3 diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.py index 621936ae12..a1d5201a66 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.py @@ -4,7 +4,7 @@ from math import * -__version__ = "0.4.0" +__version__ = "0.5.0" LIBCELLML_VERSION = "0.5.0" STATE_COUNT = 4 diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.c index d9c4329a9b..b042ee21e7 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.c @@ -5,7 +5,7 @@ #include #include -const char VERSION[] = "0.5.0"; +const char VERSION[] = "0.6.0"; const char LIBCELLML_VERSION[] = "0.5.0"; const size_t STATE_COUNT = 3; diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.py index 72491c454a..39debf9ca9 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.py @@ -4,7 +4,7 @@ from math import * -__version__ = "0.4.0" +__version__ = "0.5.0" LIBCELLML_VERSION = "0.5.0" STATE_COUNT = 3 diff --git a/tests/resources/generator/noble_model_1962/model.c b/tests/resources/generator/noble_model_1962/model.c index 7f27f8e50c..8edc882e14 100644 --- a/tests/resources/generator/noble_model_1962/model.c +++ b/tests/resources/generator/noble_model_1962/model.c @@ -5,7 +5,7 @@ #include #include -const char VERSION[] = "0.5.0"; +const char VERSION[] = "0.6.0"; const char LIBCELLML_VERSION[] = "0.5.0"; const size_t STATE_COUNT = 4; diff --git a/tests/resources/generator/noble_model_1962/model.py b/tests/resources/generator/noble_model_1962/model.py index 11aba05f56..878cc89603 100644 --- a/tests/resources/generator/noble_model_1962/model.py +++ b/tests/resources/generator/noble_model_1962/model.py @@ -4,7 +4,7 @@ from math import * -__version__ = "0.4.0" +__version__ = "0.5.0" LIBCELLML_VERSION = "0.5.0" STATE_COUNT = 4 diff --git a/tests/resources/generator/ode_computed_var_on_rhs/model.c b/tests/resources/generator/ode_computed_var_on_rhs/model.c index 481cfdefb2..741fc1a1ed 100644 --- a/tests/resources/generator/ode_computed_var_on_rhs/model.c +++ b/tests/resources/generator/ode_computed_var_on_rhs/model.c @@ -5,7 +5,7 @@ #include #include -const char VERSION[] = "0.5.0"; +const char VERSION[] = "0.6.0"; const char LIBCELLML_VERSION[] = "0.5.0"; const size_t STATE_COUNT = 1; diff --git a/tests/resources/generator/ode_computed_var_on_rhs/model.py b/tests/resources/generator/ode_computed_var_on_rhs/model.py index a9b19e7625..865bb0a917 100644 --- a/tests/resources/generator/ode_computed_var_on_rhs/model.py +++ b/tests/resources/generator/ode_computed_var_on_rhs/model.py @@ -4,7 +4,7 @@ from math import * -__version__ = "0.4.0" +__version__ = "0.5.0" LIBCELLML_VERSION = "0.5.0" STATE_COUNT = 1 diff --git a/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.c b/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.c index 8c739e6a78..2bc00c84fa 100644 --- a/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.c +++ b/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.c @@ -5,7 +5,7 @@ #include #include -const char VERSION[] = "0.5.0"; +const char VERSION[] = "0.6.0"; const char LIBCELLML_VERSION[] = "0.5.0"; const size_t STATE_COUNT = 1; diff --git a/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.py b/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.py index b733994759..34f7dfbc53 100644 --- a/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.py +++ b/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.py @@ -4,7 +4,7 @@ from math import * -__version__ = "0.4.0" +__version__ = "0.5.0" LIBCELLML_VERSION = "0.5.0" STATE_COUNT = 1 diff --git a/tests/resources/generator/ode_const_var_on_rhs/model.c b/tests/resources/generator/ode_const_var_on_rhs/model.c index e6f4a2f112..65d922d8b1 100644 --- a/tests/resources/generator/ode_const_var_on_rhs/model.c +++ b/tests/resources/generator/ode_const_var_on_rhs/model.c @@ -5,7 +5,7 @@ #include #include -const char VERSION[] = "0.5.0"; +const char VERSION[] = "0.6.0"; const char LIBCELLML_VERSION[] = "0.5.0"; const size_t STATE_COUNT = 1; diff --git a/tests/resources/generator/ode_const_var_on_rhs/model.py b/tests/resources/generator/ode_const_var_on_rhs/model.py index ba2af92b39..e2df2355f5 100644 --- a/tests/resources/generator/ode_const_var_on_rhs/model.py +++ b/tests/resources/generator/ode_const_var_on_rhs/model.py @@ -4,7 +4,7 @@ from math import * -__version__ = "0.4.0" +__version__ = "0.5.0" LIBCELLML_VERSION = "0.5.0" STATE_COUNT = 1 diff --git a/tests/resources/generator/ode_const_var_on_rhs_one_component/model.c b/tests/resources/generator/ode_const_var_on_rhs_one_component/model.c index 0b197f7ece..8ea505b7f0 100644 --- a/tests/resources/generator/ode_const_var_on_rhs_one_component/model.c +++ b/tests/resources/generator/ode_const_var_on_rhs_one_component/model.c @@ -5,7 +5,7 @@ #include #include -const char VERSION[] = "0.5.0"; +const char VERSION[] = "0.6.0"; const char LIBCELLML_VERSION[] = "0.5.0"; const size_t STATE_COUNT = 1; diff --git a/tests/resources/generator/ode_const_var_on_rhs_one_component/model.py b/tests/resources/generator/ode_const_var_on_rhs_one_component/model.py index d5a245651c..939cc09a0c 100644 --- a/tests/resources/generator/ode_const_var_on_rhs_one_component/model.py +++ b/tests/resources/generator/ode_const_var_on_rhs_one_component/model.py @@ -4,7 +4,7 @@ from math import * -__version__ = "0.4.0" +__version__ = "0.5.0" LIBCELLML_VERSION = "0.5.0" STATE_COUNT = 1 diff --git a/tests/resources/generator/ode_constant_on_rhs/model.c b/tests/resources/generator/ode_constant_on_rhs/model.c index 800b77cfa4..71e7ea5a8a 100644 --- a/tests/resources/generator/ode_constant_on_rhs/model.c +++ b/tests/resources/generator/ode_constant_on_rhs/model.c @@ -5,7 +5,7 @@ #include #include -const char VERSION[] = "0.5.0"; +const char VERSION[] = "0.6.0"; const char LIBCELLML_VERSION[] = "0.5.0"; const size_t STATE_COUNT = 1; diff --git a/tests/resources/generator/ode_constant_on_rhs/model.py b/tests/resources/generator/ode_constant_on_rhs/model.py index d747d32872..bc525feb58 100644 --- a/tests/resources/generator/ode_constant_on_rhs/model.py +++ b/tests/resources/generator/ode_constant_on_rhs/model.py @@ -4,7 +4,7 @@ from math import * -__version__ = "0.4.0" +__version__ = "0.5.0" LIBCELLML_VERSION = "0.5.0" STATE_COUNT = 1 diff --git a/tests/resources/generator/ode_constant_on_rhs_one_component/model.c b/tests/resources/generator/ode_constant_on_rhs_one_component/model.c index 206912326b..a37c8889b6 100644 --- a/tests/resources/generator/ode_constant_on_rhs_one_component/model.c +++ b/tests/resources/generator/ode_constant_on_rhs_one_component/model.c @@ -5,7 +5,7 @@ #include #include -const char VERSION[] = "0.5.0"; +const char VERSION[] = "0.6.0"; const char LIBCELLML_VERSION[] = "0.5.0"; const size_t STATE_COUNT = 1; diff --git a/tests/resources/generator/ode_constant_on_rhs_one_component/model.py b/tests/resources/generator/ode_constant_on_rhs_one_component/model.py index beea768e95..22311d1da6 100644 --- a/tests/resources/generator/ode_constant_on_rhs_one_component/model.py +++ b/tests/resources/generator/ode_constant_on_rhs_one_component/model.py @@ -4,7 +4,7 @@ from math import * -__version__ = "0.4.0" +__version__ = "0.5.0" LIBCELLML_VERSION = "0.5.0" STATE_COUNT = 1 diff --git a/tests/resources/generator/ode_multiple_dependent_odes/model.c b/tests/resources/generator/ode_multiple_dependent_odes/model.c index 9e73023fac..bab99e785c 100644 --- a/tests/resources/generator/ode_multiple_dependent_odes/model.c +++ b/tests/resources/generator/ode_multiple_dependent_odes/model.c @@ -5,7 +5,7 @@ #include #include -const char VERSION[] = "0.5.0"; +const char VERSION[] = "0.6.0"; const char LIBCELLML_VERSION[] = "0.5.0"; const size_t STATE_COUNT = 2; diff --git a/tests/resources/generator/ode_multiple_dependent_odes/model.py b/tests/resources/generator/ode_multiple_dependent_odes/model.py index 70c8763818..50498a2bad 100644 --- a/tests/resources/generator/ode_multiple_dependent_odes/model.py +++ b/tests/resources/generator/ode_multiple_dependent_odes/model.py @@ -4,7 +4,7 @@ from math import * -__version__ = "0.4.0" +__version__ = "0.5.0" LIBCELLML_VERSION = "0.5.0" STATE_COUNT = 2 diff --git a/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.c b/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.c index 907009cd77..c5e7e02a6a 100644 --- a/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.c +++ b/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.c @@ -5,7 +5,7 @@ #include #include -const char VERSION[] = "0.5.0"; +const char VERSION[] = "0.6.0"; const char LIBCELLML_VERSION[] = "0.5.0"; const size_t STATE_COUNT = 2; diff --git a/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.py b/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.py index a3a521ec24..d5b1bf1b9a 100644 --- a/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.py +++ b/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.py @@ -4,7 +4,7 @@ from math import * -__version__ = "0.4.0" +__version__ = "0.5.0" LIBCELLML_VERSION = "0.5.0" STATE_COUNT = 2 diff --git a/tests/resources/generator/ode_multiple_odes_with_same_name/model.c b/tests/resources/generator/ode_multiple_odes_with_same_name/model.c index c53a5bce72..967c844565 100644 --- a/tests/resources/generator/ode_multiple_odes_with_same_name/model.c +++ b/tests/resources/generator/ode_multiple_odes_with_same_name/model.c @@ -5,7 +5,7 @@ #include #include -const char VERSION[] = "0.5.0"; +const char VERSION[] = "0.6.0"; const char LIBCELLML_VERSION[] = "0.5.0"; const size_t STATE_COUNT = 2; diff --git a/tests/resources/generator/ode_multiple_odes_with_same_name/model.py b/tests/resources/generator/ode_multiple_odes_with_same_name/model.py index 446a164abd..8ac8235fc0 100644 --- a/tests/resources/generator/ode_multiple_odes_with_same_name/model.py +++ b/tests/resources/generator/ode_multiple_odes_with_same_name/model.py @@ -4,7 +4,7 @@ from math import * -__version__ = "0.4.0" +__version__ = "0.5.0" LIBCELLML_VERSION = "0.5.0" STATE_COUNT = 2 diff --git a/tests/resources/generator/ode_unknown_var_on_rhs/model.c b/tests/resources/generator/ode_unknown_var_on_rhs/model.c index ed4e72be1f..0b29e548b4 100644 --- a/tests/resources/generator/ode_unknown_var_on_rhs/model.c +++ b/tests/resources/generator/ode_unknown_var_on_rhs/model.c @@ -5,7 +5,7 @@ #include #include -const char VERSION[] = "0.5.0"; +const char VERSION[] = "0.6.0"; const char LIBCELLML_VERSION[] = "0.5.0"; const size_t STATE_COUNT = 2; diff --git a/tests/resources/generator/ode_unknown_var_on_rhs/model.py b/tests/resources/generator/ode_unknown_var_on_rhs/model.py index 446d26780d..2f19ddc26b 100644 --- a/tests/resources/generator/ode_unknown_var_on_rhs/model.py +++ b/tests/resources/generator/ode_unknown_var_on_rhs/model.py @@ -4,7 +4,7 @@ from math import * -__version__ = "0.4.0" +__version__ = "0.5.0" LIBCELLML_VERSION = "0.5.0" STATE_COUNT = 2 diff --git a/tests/resources/generator/robertson_model_1966/model.dae.c b/tests/resources/generator/robertson_model_1966/model.dae.c index 6e6df43ac4..1f99605fa1 100644 --- a/tests/resources/generator/robertson_model_1966/model.dae.c +++ b/tests/resources/generator/robertson_model_1966/model.dae.c @@ -5,7 +5,7 @@ #include #include -const char VERSION[] = "0.5.0"; +const char VERSION[] = "0.6.0"; const char LIBCELLML_VERSION[] = "0.5.0"; const size_t STATE_COUNT = 2; diff --git a/tests/resources/generator/robertson_model_1966/model.dae.py b/tests/resources/generator/robertson_model_1966/model.dae.py index 24530a58af..02d98e3c79 100644 --- a/tests/resources/generator/robertson_model_1966/model.dae.py +++ b/tests/resources/generator/robertson_model_1966/model.dae.py @@ -4,7 +4,7 @@ from math import * -__version__ = "0.4.0" +__version__ = "0.5.0" LIBCELLML_VERSION = "0.5.0" STATE_COUNT = 2 diff --git a/tests/resources/generator/robertson_model_1966/model.ode.c b/tests/resources/generator/robertson_model_1966/model.ode.c index 7c916a7deb..755412f68b 100644 --- a/tests/resources/generator/robertson_model_1966/model.ode.c +++ b/tests/resources/generator/robertson_model_1966/model.ode.c @@ -5,7 +5,7 @@ #include #include -const char VERSION[] = "0.5.0"; +const char VERSION[] = "0.6.0"; const char LIBCELLML_VERSION[] = "0.5.0"; const size_t STATE_COUNT = 3; diff --git a/tests/resources/generator/robertson_model_1966/model.ode.py b/tests/resources/generator/robertson_model_1966/model.ode.py index b3c35c945d..5fba7eba4d 100644 --- a/tests/resources/generator/robertson_model_1966/model.ode.py +++ b/tests/resources/generator/robertson_model_1966/model.ode.py @@ -4,7 +4,7 @@ from math import * -__version__ = "0.4.0" +__version__ = "0.5.0" LIBCELLML_VERSION = "0.5.0" STATE_COUNT = 3 diff --git a/tests/resources/generator/sine_model_imports/model.c b/tests/resources/generator/sine_model_imports/model.c index e2c69b5096..29f467ca1f 100644 --- a/tests/resources/generator/sine_model_imports/model.c +++ b/tests/resources/generator/sine_model_imports/model.c @@ -5,7 +5,7 @@ #include #include -const char VERSION[] = "0.5.0"; +const char VERSION[] = "0.6.0"; const char LIBCELLML_VERSION[] = "0.5.0"; const size_t STATE_COUNT = 1; diff --git a/tests/resources/generator/sine_model_imports/model.py b/tests/resources/generator/sine_model_imports/model.py index 563e472daf..3319297ff1 100644 --- a/tests/resources/generator/sine_model_imports/model.py +++ b/tests/resources/generator/sine_model_imports/model.py @@ -4,7 +4,7 @@ from math import * -__version__ = "0.4.0" +__version__ = "0.5.0" LIBCELLML_VERSION = "0.5.0" STATE_COUNT = 1 diff --git a/tests/resources/generator/unknown_variable_as_external_variable/model.c b/tests/resources/generator/unknown_variable_as_external_variable/model.c index 70c1c87753..1d5fac7e88 100644 --- a/tests/resources/generator/unknown_variable_as_external_variable/model.c +++ b/tests/resources/generator/unknown_variable_as_external_variable/model.c @@ -5,7 +5,7 @@ #include #include -const char VERSION[] = "0.5.0"; +const char VERSION[] = "0.6.0"; const char LIBCELLML_VERSION[] = "0.5.0"; const size_t CONSTANT_COUNT = 0; diff --git a/tests/resources/generator/unknown_variable_as_external_variable/model.py b/tests/resources/generator/unknown_variable_as_external_variable/model.py index de190cb846..8f2c23fba0 100644 --- a/tests/resources/generator/unknown_variable_as_external_variable/model.py +++ b/tests/resources/generator/unknown_variable_as_external_variable/model.py @@ -4,7 +4,7 @@ from math import * -__version__ = "0.4.0" +__version__ = "0.5.0" LIBCELLML_VERSION = "0.5.0" CONSTANT_COUNT = 0 diff --git a/tests/resources/generator/variable_initialised_using_a_constant/model.c b/tests/resources/generator/variable_initialised_using_a_constant/model.c index c8282db08d..bbd31e50ca 100644 --- a/tests/resources/generator/variable_initialised_using_a_constant/model.c +++ b/tests/resources/generator/variable_initialised_using_a_constant/model.c @@ -5,7 +5,7 @@ #include #include -const char VERSION[] = "0.5.0"; +const char VERSION[] = "0.6.0"; const char LIBCELLML_VERSION[] = "0.5.0"; const size_t STATE_COUNT = 1; diff --git a/tests/resources/generator/variable_initialised_using_a_constant/model.py b/tests/resources/generator/variable_initialised_using_a_constant/model.py index 5bfdcb329d..e6b607b12b 100644 --- a/tests/resources/generator/variable_initialised_using_a_constant/model.py +++ b/tests/resources/generator/variable_initialised_using_a_constant/model.py @@ -4,7 +4,7 @@ from math import * -__version__ = "0.4.0" +__version__ = "0.5.0" LIBCELLML_VERSION = "0.5.0" STATE_COUNT = 1 From 0f8fbf303c4ca35763130c8c9dc1bd40d4eba479 Mon Sep 17 00:00:00 2001 From: Alan Garny Date: Thu, 8 Aug 2024 10:52:29 +0200 Subject: [PATCH 09/85] Tests: automatically generate the expected file contents. To do it manually is very time consuming while here it gets done automatically. From there, we can quickly confirm, using git, whether the new expected file contents is correct. --- tests/clone/clone.cpp | 2 +- tests/coverage/coverage.cpp | 18 +- tests/generator/generator.cpp | 356 ++++++++++++++-------------- tests/importer/importer.cpp | 6 +- tests/importer/model_flattening.cpp | 6 +- tests/printer/printer.cpp | 2 +- tests/test_utils.cpp | 17 +- tests/test_utils.h | 5 + 8 files changed, 216 insertions(+), 196 deletions(-) diff --git a/tests/clone/clone.cpp b/tests/clone/clone.cpp index f92ecd62f1..1b0b7a47b0 100644 --- a/tests/clone/clone.cpp +++ b/tests/clone/clone.cpp @@ -503,7 +503,7 @@ TEST(Clone, generateFromClonedModel) generator->setModel(analyser->model()); - EXPECT_EQ(fileContents("generator/hodgkin_huxley_squid_axon_model_1952/model.c"), generator->implementationCode()); + EXPECT_EQ_FILE_CONTENTS("generator/hodgkin_huxley_squid_axon_model_1952/model.c", generator->implementationCode()); libcellml::PrinterPtr p = libcellml::Printer::create(); diff --git a/tests/coverage/coverage.cpp b/tests/coverage/coverage.cpp index 5805d78035..ab5aac84b9 100644 --- a/tests/coverage/coverage.cpp +++ b/tests/coverage/coverage.cpp @@ -666,8 +666,8 @@ TEST(Coverage, generator) generator->setModel(analyserModel); EXPECT_EQ(analyserModel, generator->model()); - EXPECT_EQ(fileContents("coverage/generator/model.h"), generator->interfaceCode()); - EXPECT_EQ(fileContents("coverage/generator/model.c"), generator->implementationCode()); + EXPECT_EQ_FILE_CONTENTS("coverage/generator/model.h", generator->interfaceCode()); + EXPECT_EQ_FILE_CONTENTS("coverage/generator/model.c", generator->implementationCode()); auto profile = generator->profile(); @@ -683,8 +683,8 @@ TEST(Coverage, generator) " return res;\n" "}\n"); - EXPECT_EQ(fileContents("coverage/generator/model.modified.profile.h"), generator->interfaceCode()); - EXPECT_EQ(fileContents("coverage/generator/model.modified.profile.c"), generator->implementationCode()); + EXPECT_EQ_FILE_CONTENTS("coverage/generator/model.modified.profile.h", generator->interfaceCode()); + EXPECT_EQ_FILE_CONTENTS("coverage/generator/model.modified.profile.c", generator->implementationCode()); profile = libcellml::GeneratorProfile::create(); @@ -751,7 +751,7 @@ TEST(Coverage, generator) profile->setImplementationComputeVariablesMethodString(true, true, ""); EXPECT_EQ(EMPTY_STRING, generator->interfaceCode()); - EXPECT_EQ(fileContents("coverage/generator/model.out"), generator->implementationCode()); + EXPECT_EQ_FILE_CONTENTS("coverage/generator/model.out", generator->implementationCode()); profile = libcellml::GeneratorProfile::create(); @@ -824,20 +824,20 @@ TEST(Coverage, generator) profile->setVariableInfoEntryString(""); - EXPECT_EQ(fileContents("coverage/generator/model.interface.out"), generator->interfaceCode()); - EXPECT_EQ(fileContents("coverage/generator/model.implementation.out"), generator->implementationCode()); + EXPECT_EQ_FILE_CONTENTS("coverage/generator/model.interface.out", generator->interfaceCode()); + EXPECT_EQ_FILE_CONTENTS("coverage/generator/model.implementation.out", generator->implementationCode()); profile->setProfile(libcellml::GeneratorProfile::Profile::PYTHON); EXPECT_EQ(EMPTY_STRING, generator->interfaceCode()); - EXPECT_EQ(fileContents("coverage/generator/model.py"), generator->implementationCode()); + EXPECT_EQ_FILE_CONTENTS("coverage/generator/model.py", generator->implementationCode()); profile->setImplementationCreateStatesArrayMethodString("\n" "def create_states_vector():\n" " return [nan]*STATE_COUNT\n"); EXPECT_EQ(EMPTY_STRING, generator->interfaceCode()); - EXPECT_EQ(fileContents("coverage/generator/model.modified.profile.py"), generator->implementationCode()); + EXPECT_EQ_FILE_CONTENTS("coverage/generator/model.modified.profile.py", generator->implementationCode()); // Coverage for the case where mProfile is equal to nullptr in Generator. diff --git a/tests/generator/generator.cpp b/tests/generator/generator.cpp index 2494fa8dcf..9bfab3e607 100644 --- a/tests/generator/generator.cpp +++ b/tests/generator/generator.cpp @@ -58,14 +58,14 @@ TEST(Generator, algebraicEqnComputedVarOnRhs) generator->setModel(analyserModel); - EXPECT_EQ(fileContents("generator/algebraic_eqn_computed_var_on_rhs/model.h"), generator->interfaceCode()); - EXPECT_EQ(fileContents("generator/algebraic_eqn_computed_var_on_rhs/model.c"), generator->implementationCode()); + EXPECT_EQ_FILE_CONTENTS("generator/algebraic_eqn_computed_var_on_rhs/model.h", generator->interfaceCode()); + EXPECT_EQ_FILE_CONTENTS("generator/algebraic_eqn_computed_var_on_rhs/model.c", generator->implementationCode()); auto profile = libcellml::GeneratorProfile::create(libcellml::GeneratorProfile::Profile::PYTHON); generator->setProfile(profile); - EXPECT_EQ(fileContents("generator/algebraic_eqn_computed_var_on_rhs/model.py"), generator->implementationCode()); + EXPECT_EQ_FILE_CONTENTS("generator/algebraic_eqn_computed_var_on_rhs/model.py", generator->implementationCode()); } TEST(Generator, algebraicEqnComputedVarOnRhsWithComputedConstantAsExternalVariable) @@ -92,14 +92,14 @@ TEST(Generator, algebraicEqnComputedVarOnRhsWithComputedConstantAsExternalVariab profile->setInterfaceFileNameString("model.external.h"); - EXPECT_EQ(fileContents("generator/algebraic_eqn_computed_var_on_rhs/model.external.h"), generator->interfaceCode()); - EXPECT_EQ(fileContents("generator/algebraic_eqn_computed_var_on_rhs/model.external.c"), generator->implementationCode()); + EXPECT_EQ_FILE_CONTENTS("generator/algebraic_eqn_computed_var_on_rhs/model.external.h", generator->interfaceCode()); + EXPECT_EQ_FILE_CONTENTS("generator/algebraic_eqn_computed_var_on_rhs/model.external.c", generator->implementationCode()); profile = libcellml::GeneratorProfile::create(libcellml::GeneratorProfile::Profile::PYTHON); generator->setProfile(profile); - EXPECT_EQ(fileContents("generator/algebraic_eqn_computed_var_on_rhs/model.external.py"), generator->implementationCode()); + EXPECT_EQ_FILE_CONTENTS("generator/algebraic_eqn_computed_var_on_rhs/model.external.py", generator->implementationCode()); } TEST(Generator, algebraicEqnConstVarOnRhs) @@ -120,14 +120,14 @@ TEST(Generator, algebraicEqnConstVarOnRhs) generator->setModel(analyserModel); - EXPECT_EQ(fileContents("generator/algebraic_eqn_const_var_on_rhs/model.h"), generator->interfaceCode()); - EXPECT_EQ(fileContents("generator/algebraic_eqn_const_var_on_rhs/model.c"), generator->implementationCode()); + EXPECT_EQ_FILE_CONTENTS("generator/algebraic_eqn_const_var_on_rhs/model.h", generator->interfaceCode()); + EXPECT_EQ_FILE_CONTENTS("generator/algebraic_eqn_const_var_on_rhs/model.c", generator->implementationCode()); auto profile = libcellml::GeneratorProfile::create(libcellml::GeneratorProfile::Profile::PYTHON); generator->setProfile(profile); - EXPECT_EQ(fileContents("generator/algebraic_eqn_const_var_on_rhs/model.py"), generator->implementationCode()); + EXPECT_EQ_FILE_CONTENTS("generator/algebraic_eqn_const_var_on_rhs/model.py", generator->implementationCode()); } TEST(Generator, algebraicEqnConstantOnRhs) @@ -148,14 +148,14 @@ TEST(Generator, algebraicEqnConstantOnRhs) generator->setModel(analyserModel); - EXPECT_EQ(fileContents("generator/algebraic_eqn_constant_on_rhs/model.h"), generator->interfaceCode()); - EXPECT_EQ(fileContents("generator/algebraic_eqn_constant_on_rhs/model.c"), generator->implementationCode()); + EXPECT_EQ_FILE_CONTENTS("generator/algebraic_eqn_constant_on_rhs/model.h", generator->interfaceCode()); + EXPECT_EQ_FILE_CONTENTS("generator/algebraic_eqn_constant_on_rhs/model.c", generator->implementationCode()); auto profile = libcellml::GeneratorProfile::create(libcellml::GeneratorProfile::Profile::PYTHON); generator->setProfile(profile); - EXPECT_EQ(fileContents("generator/algebraic_eqn_constant_on_rhs/model.py"), generator->implementationCode()); + EXPECT_EQ_FILE_CONTENTS("generator/algebraic_eqn_constant_on_rhs/model.py", generator->implementationCode()); } TEST(Generator, algebraicEqnDerivativeOnRhs) @@ -176,14 +176,14 @@ TEST(Generator, algebraicEqnDerivativeOnRhs) generator->setModel(analyserModel); - EXPECT_EQ(fileContents("generator/algebraic_eqn_derivative_on_rhs/model.h"), generator->interfaceCode()); - EXPECT_EQ(fileContents("generator/algebraic_eqn_derivative_on_rhs/model.c"), generator->implementationCode()); + EXPECT_EQ_FILE_CONTENTS("generator/algebraic_eqn_derivative_on_rhs/model.h", generator->interfaceCode()); + EXPECT_EQ_FILE_CONTENTS("generator/algebraic_eqn_derivative_on_rhs/model.c", generator->implementationCode()); auto profile = libcellml::GeneratorProfile::create(libcellml::GeneratorProfile::Profile::PYTHON); generator->setProfile(profile); - EXPECT_EQ(fileContents("generator/algebraic_eqn_derivative_on_rhs/model.py"), generator->implementationCode()); + EXPECT_EQ_FILE_CONTENTS("generator/algebraic_eqn_derivative_on_rhs/model.py", generator->implementationCode()); } TEST(Generator, algebraicEqnDerivativeOnRhsOneComponent) @@ -204,14 +204,14 @@ TEST(Generator, algebraicEqnDerivativeOnRhsOneComponent) generator->setModel(analyserModel); - EXPECT_EQ(fileContents("generator/algebraic_eqn_derivative_on_rhs_one_component/model.h"), generator->interfaceCode()); - EXPECT_EQ(fileContents("generator/algebraic_eqn_derivative_on_rhs_one_component/model.c"), generator->implementationCode()); + EXPECT_EQ_FILE_CONTENTS("generator/algebraic_eqn_derivative_on_rhs_one_component/model.h", generator->interfaceCode()); + EXPECT_EQ_FILE_CONTENTS("generator/algebraic_eqn_derivative_on_rhs_one_component/model.c", generator->implementationCode()); auto profile = libcellml::GeneratorProfile::create(libcellml::GeneratorProfile::Profile::PYTHON); generator->setProfile(profile); - EXPECT_EQ(fileContents("generator/algebraic_eqn_derivative_on_rhs_one_component/model.py"), generator->implementationCode()); + EXPECT_EQ_FILE_CONTENTS("generator/algebraic_eqn_derivative_on_rhs_one_component/model.py", generator->implementationCode()); } TEST(Generator, algebraicEqnStateVarOnRhs) @@ -232,14 +232,14 @@ TEST(Generator, algebraicEqnStateVarOnRhs) generator->setModel(analyserModel); - EXPECT_EQ(fileContents("generator/algebraic_eqn_state_var_on_rhs/model.h"), generator->interfaceCode()); - EXPECT_EQ(fileContents("generator/algebraic_eqn_state_var_on_rhs/model.c"), generator->implementationCode()); + EXPECT_EQ_FILE_CONTENTS("generator/algebraic_eqn_state_var_on_rhs/model.h", generator->interfaceCode()); + EXPECT_EQ_FILE_CONTENTS("generator/algebraic_eqn_state_var_on_rhs/model.c", generator->implementationCode()); auto profile = libcellml::GeneratorProfile::create(libcellml::GeneratorProfile::Profile::PYTHON); generator->setProfile(profile); - EXPECT_EQ(fileContents("generator/algebraic_eqn_state_var_on_rhs/model.py"), generator->implementationCode()); + EXPECT_EQ_FILE_CONTENTS("generator/algebraic_eqn_state_var_on_rhs/model.py", generator->implementationCode()); } TEST(Generator, algebraicEqnStateVarOnRhsOneComponent) @@ -260,14 +260,14 @@ TEST(Generator, algebraicEqnStateVarOnRhsOneComponent) generator->setModel(analyserModel); - EXPECT_EQ(fileContents("generator/algebraic_eqn_state_var_on_rhs_one_component/model.h"), generator->interfaceCode()); - EXPECT_EQ(fileContents("generator/algebraic_eqn_state_var_on_rhs_one_component/model.c"), generator->implementationCode()); + EXPECT_EQ_FILE_CONTENTS("generator/algebraic_eqn_state_var_on_rhs_one_component/model.h", generator->interfaceCode()); + EXPECT_EQ_FILE_CONTENTS("generator/algebraic_eqn_state_var_on_rhs_one_component/model.c", generator->implementationCode()); auto profile = libcellml::GeneratorProfile::create(libcellml::GeneratorProfile::Profile::PYTHON); generator->setProfile(profile); - EXPECT_EQ(fileContents("generator/algebraic_eqn_state_var_on_rhs_one_component/model.py"), generator->implementationCode()); + EXPECT_EQ_FILE_CONTENTS("generator/algebraic_eqn_state_var_on_rhs_one_component/model.py", generator->implementationCode()); } TEST(Generator, algebraicUnknownVarOnRhs) @@ -288,14 +288,14 @@ TEST(Generator, algebraicUnknownVarOnRhs) generator->setModel(analyserModel); - EXPECT_EQ(fileContents("generator/algebraic_unknown_var_on_rhs/model.h"), generator->interfaceCode()); - EXPECT_EQ(fileContents("generator/algebraic_unknown_var_on_rhs/model.c"), generator->implementationCode()); + EXPECT_EQ_FILE_CONTENTS("generator/algebraic_unknown_var_on_rhs/model.h", generator->interfaceCode()); + EXPECT_EQ_FILE_CONTENTS("generator/algebraic_unknown_var_on_rhs/model.c", generator->implementationCode()); auto profile = libcellml::GeneratorProfile::create(libcellml::GeneratorProfile::Profile::PYTHON); generator->setProfile(profile); - EXPECT_EQ(fileContents("generator/algebraic_unknown_var_on_rhs/model.py"), generator->implementationCode()); + EXPECT_EQ_FILE_CONTENTS("generator/algebraic_unknown_var_on_rhs/model.py", generator->implementationCode()); } TEST(Generator, algebraicEqnWithOneNonIsolatedUnknown) @@ -316,14 +316,14 @@ TEST(Generator, algebraicEqnWithOneNonIsolatedUnknown) generator->setModel(analyserModel); - EXPECT_EQ(fileContents("generator/algebraic_eqn_with_one_non_isolated_unknown/model.h"), generator->interfaceCode()); - EXPECT_EQ(fileContents("generator/algebraic_eqn_with_one_non_isolated_unknown/model.c"), generator->implementationCode()); + EXPECT_EQ_FILE_CONTENTS("generator/algebraic_eqn_with_one_non_isolated_unknown/model.h", generator->interfaceCode()); + EXPECT_EQ_FILE_CONTENTS("generator/algebraic_eqn_with_one_non_isolated_unknown/model.c", generator->implementationCode()); auto profile = libcellml::GeneratorProfile::create(libcellml::GeneratorProfile::Profile::PYTHON); generator->setProfile(profile); - EXPECT_EQ(fileContents("generator/algebraic_eqn_with_one_non_isolated_unknown/model.py"), generator->implementationCode()); + EXPECT_EQ_FILE_CONTENTS("generator/algebraic_eqn_with_one_non_isolated_unknown/model.py", generator->implementationCode()); } TEST(Generator, algebraicEqnWithOneNonIsolatedUnknownWithExternalVariable) @@ -350,14 +350,14 @@ TEST(Generator, algebraicEqnWithOneNonIsolatedUnknownWithExternalVariable) profile->setInterfaceFileNameString("model.external.h"); - EXPECT_EQ(fileContents("generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.h"), generator->interfaceCode()); - EXPECT_EQ(fileContents("generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.c"), generator->implementationCode()); + EXPECT_EQ_FILE_CONTENTS("generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.h", generator->interfaceCode()); + EXPECT_EQ_FILE_CONTENTS("generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.c", generator->implementationCode()); profile = libcellml::GeneratorProfile::create(libcellml::GeneratorProfile::Profile::PYTHON); generator->setProfile(profile); - EXPECT_EQ(fileContents("generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.py"), generator->implementationCode()); + EXPECT_EQ_FILE_CONTENTS("generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.py", generator->implementationCode()); } TEST(Generator, algebraicSystemWithThreeLinkedUnknowns) @@ -378,14 +378,14 @@ TEST(Generator, algebraicSystemWithThreeLinkedUnknowns) generator->setModel(analyserModel); - EXPECT_EQ(fileContents("generator/algebraic_system_with_three_linked_unknowns/model.h"), generator->interfaceCode()); - EXPECT_EQ(fileContents("generator/algebraic_system_with_three_linked_unknowns/model.c"), generator->implementationCode()); + EXPECT_EQ_FILE_CONTENTS("generator/algebraic_system_with_three_linked_unknowns/model.h", generator->interfaceCode()); + EXPECT_EQ_FILE_CONTENTS("generator/algebraic_system_with_three_linked_unknowns/model.c", generator->implementationCode()); auto profile = libcellml::GeneratorProfile::create(libcellml::GeneratorProfile::Profile::PYTHON); generator->setProfile(profile); - EXPECT_EQ(fileContents("generator/algebraic_system_with_three_linked_unknowns/model.py"), generator->implementationCode()); + EXPECT_EQ_FILE_CONTENTS("generator/algebraic_system_with_three_linked_unknowns/model.py", generator->implementationCode()); } TEST(Generator, algebraicSystemWithThreeLinkedUnknownsWithThreeExternalVariables) @@ -414,14 +414,14 @@ TEST(Generator, algebraicSystemWithThreeLinkedUnknownsWithThreeExternalVariables profile->setInterfaceFileNameString("model.three.externals.h"); - EXPECT_EQ(fileContents("generator/algebraic_system_with_three_linked_unknowns/model.three.externals.h"), generator->interfaceCode()); - EXPECT_EQ(fileContents("generator/algebraic_system_with_three_linked_unknowns/model.three.externals.c"), generator->implementationCode()); + EXPECT_EQ_FILE_CONTENTS("generator/algebraic_system_with_three_linked_unknowns/model.three.externals.h", generator->interfaceCode()); + EXPECT_EQ_FILE_CONTENTS("generator/algebraic_system_with_three_linked_unknowns/model.three.externals.c", generator->implementationCode()); profile = libcellml::GeneratorProfile::create(libcellml::GeneratorProfile::Profile::PYTHON); generator->setProfile(profile); - EXPECT_EQ(fileContents("generator/algebraic_system_with_three_linked_unknowns/model.three.externals.py"), generator->implementationCode()); + EXPECT_EQ_FILE_CONTENTS("generator/algebraic_system_with_three_linked_unknowns/model.three.externals.py", generator->implementationCode()); } TEST(Generator, algebraicSystemWithVariousDependenciesOrdered) @@ -446,14 +446,14 @@ TEST(Generator, algebraicSystemWithVariousDependenciesOrdered) profile->setInterfaceFileNameString("model.ordered.h"); - EXPECT_EQ(fileContents("generator/algebraic_system_with_various_dependencies/model.ordered.h"), generator->interfaceCode()); - EXPECT_EQ(fileContents("generator/algebraic_system_with_various_dependencies/model.ordered.c"), generator->implementationCode()); + EXPECT_EQ_FILE_CONTENTS("generator/algebraic_system_with_various_dependencies/model.ordered.h", generator->interfaceCode()); + EXPECT_EQ_FILE_CONTENTS("generator/algebraic_system_with_various_dependencies/model.ordered.c", generator->implementationCode()); profile = libcellml::GeneratorProfile::create(libcellml::GeneratorProfile::Profile::PYTHON); generator->setProfile(profile); - EXPECT_EQ(fileContents("generator/algebraic_system_with_various_dependencies/model.ordered.py"), generator->implementationCode()); + EXPECT_EQ_FILE_CONTENTS("generator/algebraic_system_with_various_dependencies/model.ordered.py", generator->implementationCode()); } TEST(Generator, algebraicSystemWithVariousDependenciesNotOrdered) @@ -478,14 +478,14 @@ TEST(Generator, algebraicSystemWithVariousDependenciesNotOrdered) profile->setInterfaceFileNameString("model.not.ordered.h"); - EXPECT_EQ(fileContents("generator/algebraic_system_with_various_dependencies/model.not.ordered.h"), generator->interfaceCode()); - EXPECT_EQ(fileContents("generator/algebraic_system_with_various_dependencies/model.not.ordered.c"), generator->implementationCode()); + EXPECT_EQ_FILE_CONTENTS("generator/algebraic_system_with_various_dependencies/model.not.ordered.h", generator->interfaceCode()); + EXPECT_EQ_FILE_CONTENTS("generator/algebraic_system_with_various_dependencies/model.not.ordered.c", generator->implementationCode()); profile = libcellml::GeneratorProfile::create(libcellml::GeneratorProfile::Profile::PYTHON); generator->setProfile(profile); - EXPECT_EQ(fileContents("generator/algebraic_system_with_various_dependencies/model.not.ordered.py"), generator->implementationCode()); + EXPECT_EQ_FILE_CONTENTS("generator/algebraic_system_with_various_dependencies/model.not.ordered.py", generator->implementationCode()); } TEST(Generator, odeComputedVarOnRhs) @@ -506,14 +506,14 @@ TEST(Generator, odeComputedVarOnRhs) generator->setModel(analyserModel); - EXPECT_EQ(fileContents("generator/ode_computed_var_on_rhs/model.h"), generator->interfaceCode()); - EXPECT_EQ(fileContents("generator/ode_computed_var_on_rhs/model.c"), generator->implementationCode()); + EXPECT_EQ_FILE_CONTENTS("generator/ode_computed_var_on_rhs/model.h", generator->interfaceCode()); + EXPECT_EQ_FILE_CONTENTS("generator/ode_computed_var_on_rhs/model.c", generator->implementationCode()); auto profile = libcellml::GeneratorProfile::create(libcellml::GeneratorProfile::Profile::PYTHON); generator->setProfile(profile); - EXPECT_EQ(fileContents("generator/ode_computed_var_on_rhs/model.py"), generator->implementationCode()); + EXPECT_EQ_FILE_CONTENTS("generator/ode_computed_var_on_rhs/model.py", generator->implementationCode()); } TEST(Generator, odeComputedVarOnRhsOneComponent) @@ -534,14 +534,14 @@ TEST(Generator, odeComputedVarOnRhsOneComponent) generator->setModel(analyserModel); - EXPECT_EQ(fileContents("generator/ode_computed_var_on_rhs_one_component/model.h"), generator->interfaceCode()); - EXPECT_EQ(fileContents("generator/ode_computed_var_on_rhs_one_component/model.c"), generator->implementationCode()); + EXPECT_EQ_FILE_CONTENTS("generator/ode_computed_var_on_rhs_one_component/model.h", generator->interfaceCode()); + EXPECT_EQ_FILE_CONTENTS("generator/ode_computed_var_on_rhs_one_component/model.c", generator->implementationCode()); auto profile = libcellml::GeneratorProfile::create(libcellml::GeneratorProfile::Profile::PYTHON); generator->setProfile(profile); - EXPECT_EQ(fileContents("generator/ode_computed_var_on_rhs_one_component/model.py"), generator->implementationCode()); + EXPECT_EQ_FILE_CONTENTS("generator/ode_computed_var_on_rhs_one_component/model.py", generator->implementationCode()); } TEST(Generator, odeConstVarOnRhs) @@ -562,14 +562,14 @@ TEST(Generator, odeConstVarOnRhs) generator->setModel(analyserModel); - EXPECT_EQ(fileContents("generator/ode_const_var_on_rhs/model.h"), generator->interfaceCode()); - EXPECT_EQ(fileContents("generator/ode_const_var_on_rhs/model.c"), generator->implementationCode()); + EXPECT_EQ_FILE_CONTENTS("generator/ode_const_var_on_rhs/model.h", generator->interfaceCode()); + EXPECT_EQ_FILE_CONTENTS("generator/ode_const_var_on_rhs/model.c", generator->implementationCode()); auto profile = libcellml::GeneratorProfile::create(libcellml::GeneratorProfile::Profile::PYTHON); generator->setProfile(profile); - EXPECT_EQ(fileContents("generator/ode_const_var_on_rhs/model.py"), generator->implementationCode()); + EXPECT_EQ_FILE_CONTENTS("generator/ode_const_var_on_rhs/model.py", generator->implementationCode()); } TEST(Generator, odeConstVarOnRhsOneComponent) @@ -590,14 +590,14 @@ TEST(Generator, odeConstVarOnRhsOneComponent) generator->setModel(analyserModel); - EXPECT_EQ(fileContents("generator/ode_const_var_on_rhs_one_component/model.h"), generator->interfaceCode()); - EXPECT_EQ(fileContents("generator/ode_const_var_on_rhs_one_component/model.c"), generator->implementationCode()); + EXPECT_EQ_FILE_CONTENTS("generator/ode_const_var_on_rhs_one_component/model.h", generator->interfaceCode()); + EXPECT_EQ_FILE_CONTENTS("generator/ode_const_var_on_rhs_one_component/model.c", generator->implementationCode()); auto profile = libcellml::GeneratorProfile::create(libcellml::GeneratorProfile::Profile::PYTHON); generator->setProfile(profile); - EXPECT_EQ(fileContents("generator/ode_const_var_on_rhs_one_component/model.py"), generator->implementationCode()); + EXPECT_EQ_FILE_CONTENTS("generator/ode_const_var_on_rhs_one_component/model.py", generator->implementationCode()); } TEST(Generator, odeConstantOnRhs) @@ -618,14 +618,14 @@ TEST(Generator, odeConstantOnRhs) generator->setModel(analyserModel); - EXPECT_EQ(fileContents("generator/ode_constant_on_rhs/model.h"), generator->interfaceCode()); - EXPECT_EQ(fileContents("generator/ode_constant_on_rhs/model.c"), generator->implementationCode()); + EXPECT_EQ_FILE_CONTENTS("generator/ode_constant_on_rhs/model.h", generator->interfaceCode()); + EXPECT_EQ_FILE_CONTENTS("generator/ode_constant_on_rhs/model.c", generator->implementationCode()); auto profile = libcellml::GeneratorProfile::create(libcellml::GeneratorProfile::Profile::PYTHON); generator->setProfile(profile); - EXPECT_EQ(fileContents("generator/ode_constant_on_rhs/model.py"), generator->implementationCode()); + EXPECT_EQ_FILE_CONTENTS("generator/ode_constant_on_rhs/model.py", generator->implementationCode()); } TEST(Generator, odeConstantOnRhsOneComponent) @@ -646,14 +646,14 @@ TEST(Generator, odeConstantOnRhsOneComponent) generator->setModel(analyserModel); - EXPECT_EQ(fileContents("generator/ode_constant_on_rhs_one_component/model.h"), generator->interfaceCode()); - EXPECT_EQ(fileContents("generator/ode_constant_on_rhs_one_component/model.c"), generator->implementationCode()); + EXPECT_EQ_FILE_CONTENTS("generator/ode_constant_on_rhs_one_component/model.h", generator->interfaceCode()); + EXPECT_EQ_FILE_CONTENTS("generator/ode_constant_on_rhs_one_component/model.c", generator->implementationCode()); auto profile = libcellml::GeneratorProfile::create(libcellml::GeneratorProfile::Profile::PYTHON); generator->setProfile(profile); - EXPECT_EQ(fileContents("generator/ode_constant_on_rhs_one_component/model.py"), generator->implementationCode()); + EXPECT_EQ_FILE_CONTENTS("generator/ode_constant_on_rhs_one_component/model.py", generator->implementationCode()); } TEST(Generator, odeMultipleDependentOdes) @@ -674,14 +674,14 @@ TEST(Generator, odeMultipleDependentOdes) generator->setModel(analyserModel); - EXPECT_EQ(fileContents("generator/ode_multiple_dependent_odes/model.h"), generator->interfaceCode()); - EXPECT_EQ(fileContents("generator/ode_multiple_dependent_odes/model.c"), generator->implementationCode()); + EXPECT_EQ_FILE_CONTENTS("generator/ode_multiple_dependent_odes/model.h", generator->interfaceCode()); + EXPECT_EQ_FILE_CONTENTS("generator/ode_multiple_dependent_odes/model.c", generator->implementationCode()); auto profile = libcellml::GeneratorProfile::create(libcellml::GeneratorProfile::Profile::PYTHON); generator->setProfile(profile); - EXPECT_EQ(fileContents("generator/ode_multiple_dependent_odes/model.py"), generator->implementationCode()); + EXPECT_EQ_FILE_CONTENTS("generator/ode_multiple_dependent_odes/model.py", generator->implementationCode()); } TEST(Generator, odeMultipleDependentOdesOneComponent) @@ -702,14 +702,14 @@ TEST(Generator, odeMultipleDependentOdesOneComponent) generator->setModel(analyserModel); - EXPECT_EQ(fileContents("generator/ode_multiple_dependent_odes_one_component/model.h"), generator->interfaceCode()); - EXPECT_EQ(fileContents("generator/ode_multiple_dependent_odes_one_component/model.c"), generator->implementationCode()); + EXPECT_EQ_FILE_CONTENTS("generator/ode_multiple_dependent_odes_one_component/model.h", generator->interfaceCode()); + EXPECT_EQ_FILE_CONTENTS("generator/ode_multiple_dependent_odes_one_component/model.c", generator->implementationCode()); auto profile = libcellml::GeneratorProfile::create(libcellml::GeneratorProfile::Profile::PYTHON); generator->setProfile(profile); - EXPECT_EQ(fileContents("generator/ode_multiple_dependent_odes_one_component/model.py"), generator->implementationCode()); + EXPECT_EQ_FILE_CONTENTS("generator/ode_multiple_dependent_odes_one_component/model.py", generator->implementationCode()); } TEST(Generator, odeMultipleOdesWithSameName) @@ -730,14 +730,14 @@ TEST(Generator, odeMultipleOdesWithSameName) generator->setModel(analyserModel); - EXPECT_EQ(fileContents("generator/ode_multiple_odes_with_same_name/model.h"), generator->interfaceCode()); - EXPECT_EQ(fileContents("generator/ode_multiple_odes_with_same_name/model.c"), generator->implementationCode()); + EXPECT_EQ_FILE_CONTENTS("generator/ode_multiple_odes_with_same_name/model.h", generator->interfaceCode()); + EXPECT_EQ_FILE_CONTENTS("generator/ode_multiple_odes_with_same_name/model.c", generator->implementationCode()); auto profile = libcellml::GeneratorProfile::create(libcellml::GeneratorProfile::Profile::PYTHON); generator->setProfile(profile); - EXPECT_EQ(fileContents("generator/ode_multiple_odes_with_same_name/model.py"), generator->implementationCode()); + EXPECT_EQ_FILE_CONTENTS("generator/ode_multiple_odes_with_same_name/model.py", generator->implementationCode()); } TEST(Generator, odeUnknownVarOnRhs) @@ -758,14 +758,14 @@ TEST(Generator, odeUnknownVarOnRhs) generator->setModel(analyserModel); - EXPECT_EQ(fileContents("generator/ode_unknown_var_on_rhs/model.h"), generator->interfaceCode()); - EXPECT_EQ(fileContents("generator/ode_unknown_var_on_rhs/model.c"), generator->implementationCode()); + EXPECT_EQ_FILE_CONTENTS("generator/ode_unknown_var_on_rhs/model.h", generator->interfaceCode()); + EXPECT_EQ_FILE_CONTENTS("generator/ode_unknown_var_on_rhs/model.c", generator->implementationCode()); auto profile = libcellml::GeneratorProfile::create(libcellml::GeneratorProfile::Profile::PYTHON); generator->setProfile(profile); - EXPECT_EQ(fileContents("generator/ode_unknown_var_on_rhs/model.py"), generator->implementationCode()); + EXPECT_EQ_FILE_CONTENTS("generator/ode_unknown_var_on_rhs/model.py", generator->implementationCode()); } TEST(Generator, cellmlMappingsAndEncapsulations) @@ -786,14 +786,14 @@ TEST(Generator, cellmlMappingsAndEncapsulations) generator->setModel(analyserModel); - EXPECT_EQ(fileContents("generator/cellml_mappings_and_encapsulations/model.h"), generator->interfaceCode()); - EXPECT_EQ(fileContents("generator/cellml_mappings_and_encapsulations/model.c"), generator->implementationCode()); + EXPECT_EQ_FILE_CONTENTS("generator/cellml_mappings_and_encapsulations/model.h", generator->interfaceCode()); + EXPECT_EQ_FILE_CONTENTS("generator/cellml_mappings_and_encapsulations/model.c", generator->implementationCode()); auto profile = libcellml::GeneratorProfile::create(libcellml::GeneratorProfile::Profile::PYTHON); generator->setProfile(profile); - EXPECT_EQ(fileContents("generator/cellml_mappings_and_encapsulations/model.py"), generator->implementationCode()); + EXPECT_EQ_FILE_CONTENTS("generator/cellml_mappings_and_encapsulations/model.py", generator->implementationCode()); } TEST(Generator, cellmlStateInitialisedUsingVariable) @@ -814,14 +814,14 @@ TEST(Generator, cellmlStateInitialisedUsingVariable) generator->setModel(analyserModel); - EXPECT_EQ(fileContents("generator/cellml_state_initialised_using_variable/model.h"), generator->interfaceCode()); - EXPECT_EQ(fileContents("generator/cellml_state_initialised_using_variable/model.c"), generator->implementationCode()); + EXPECT_EQ_FILE_CONTENTS("generator/cellml_state_initialised_using_variable/model.h", generator->interfaceCode()); + EXPECT_EQ_FILE_CONTENTS("generator/cellml_state_initialised_using_variable/model.c", generator->implementationCode()); auto profile = libcellml::GeneratorProfile::create(libcellml::GeneratorProfile::Profile::PYTHON); generator->setProfile(profile); - EXPECT_EQ(fileContents("generator/cellml_state_initialised_using_variable/model.py"), generator->implementationCode()); + EXPECT_EQ_FILE_CONTENTS("generator/cellml_state_initialised_using_variable/model.py", generator->implementationCode()); } TEST(Generator, cellmlUnitScalingVoiIndirect) @@ -842,14 +842,14 @@ TEST(Generator, cellmlUnitScalingVoiIndirect) generator->setModel(analyserModel); - EXPECT_EQ(fileContents("generator/cellml_unit_scaling_voi_indirect/model.h"), generator->interfaceCode()); - EXPECT_EQ(fileContents("generator/cellml_unit_scaling_voi_indirect/model.c"), generator->implementationCode()); + EXPECT_EQ_FILE_CONTENTS("generator/cellml_unit_scaling_voi_indirect/model.h", generator->interfaceCode()); + EXPECT_EQ_FILE_CONTENTS("generator/cellml_unit_scaling_voi_indirect/model.c", generator->implementationCode()); auto profile = libcellml::GeneratorProfile::create(libcellml::GeneratorProfile::Profile::PYTHON); generator->setProfile(profile); - EXPECT_EQ(fileContents("generator/cellml_unit_scaling_voi_indirect/model.py"), generator->implementationCode()); + EXPECT_EQ_FILE_CONTENTS("generator/cellml_unit_scaling_voi_indirect/model.py", generator->implementationCode()); } TEST(Generator, cellmlUnitScalingVoiDirect) @@ -870,14 +870,14 @@ TEST(Generator, cellmlUnitScalingVoiDirect) generator->setModel(analyserModel); - EXPECT_EQ(fileContents("generator/cellml_unit_scaling_voi_direct/model.h"), generator->interfaceCode()); - EXPECT_EQ(fileContents("generator/cellml_unit_scaling_voi_direct/model.c"), generator->implementationCode()); + EXPECT_EQ_FILE_CONTENTS("generator/cellml_unit_scaling_voi_direct/model.h", generator->interfaceCode()); + EXPECT_EQ_FILE_CONTENTS("generator/cellml_unit_scaling_voi_direct/model.c", generator->implementationCode()); auto profile = libcellml::GeneratorProfile::create(libcellml::GeneratorProfile::Profile::PYTHON); generator->setProfile(profile); - EXPECT_EQ(fileContents("generator/cellml_unit_scaling_voi_direct/model.py"), generator->implementationCode()); + EXPECT_EQ_FILE_CONTENTS("generator/cellml_unit_scaling_voi_direct/model.py", generator->implementationCode()); } TEST(Generator, cellmlUnitScalingConstant) @@ -898,14 +898,14 @@ TEST(Generator, cellmlUnitScalingConstant) generator->setModel(analyserModel); - EXPECT_EQ(fileContents("generator/cellml_unit_scaling_constant/model.h"), generator->interfaceCode()); - EXPECT_EQ(fileContents("generator/cellml_unit_scaling_constant/model.c"), generator->implementationCode()); + EXPECT_EQ_FILE_CONTENTS("generator/cellml_unit_scaling_constant/model.h", generator->interfaceCode()); + EXPECT_EQ_FILE_CONTENTS("generator/cellml_unit_scaling_constant/model.c", generator->implementationCode()); auto profile = libcellml::GeneratorProfile::create(libcellml::GeneratorProfile::Profile::PYTHON); generator->setProfile(profile); - EXPECT_EQ(fileContents("generator/cellml_unit_scaling_constant/model.py"), generator->implementationCode()); + EXPECT_EQ_FILE_CONTENTS("generator/cellml_unit_scaling_constant/model.py", generator->implementationCode()); } TEST(Generator, cellmlUnitScalingState) @@ -926,14 +926,14 @@ TEST(Generator, cellmlUnitScalingState) generator->setModel(analyserModel); - EXPECT_EQ(fileContents("generator/cellml_unit_scaling_state/model.h"), generator->interfaceCode()); - EXPECT_EQ(fileContents("generator/cellml_unit_scaling_state/model.c"), generator->implementationCode()); + EXPECT_EQ_FILE_CONTENTS("generator/cellml_unit_scaling_state/model.h", generator->interfaceCode()); + EXPECT_EQ_FILE_CONTENTS("generator/cellml_unit_scaling_state/model.c", generator->implementationCode()); auto profile = libcellml::GeneratorProfile::create(libcellml::GeneratorProfile::Profile::PYTHON); generator->setProfile(profile); - EXPECT_EQ(fileContents("generator/cellml_unit_scaling_state/model.py"), generator->implementationCode()); + EXPECT_EQ_FILE_CONTENTS("generator/cellml_unit_scaling_state/model.py", generator->implementationCode()); } TEST(Generator, cellmlUnitScalingStateInitialisedUsingConstant) @@ -954,14 +954,14 @@ TEST(Generator, cellmlUnitScalingStateInitialisedUsingConstant) generator->setModel(analyserModel); - EXPECT_EQ(fileContents("generator/cellml_unit_scaling_state_initialised_using_constant/model.h"), generator->interfaceCode()); - EXPECT_EQ(fileContents("generator/cellml_unit_scaling_state_initialised_using_constant/model.c"), generator->implementationCode()); + EXPECT_EQ_FILE_CONTENTS("generator/cellml_unit_scaling_state_initialised_using_constant/model.h", generator->interfaceCode()); + EXPECT_EQ_FILE_CONTENTS("generator/cellml_unit_scaling_state_initialised_using_constant/model.c", generator->implementationCode()); auto profile = libcellml::GeneratorProfile::create(libcellml::GeneratorProfile::Profile::PYTHON); generator->setProfile(profile); - EXPECT_EQ(fileContents("generator/cellml_unit_scaling_state_initialised_using_constant/model.py"), generator->implementationCode()); + EXPECT_EQ_FILE_CONTENTS("generator/cellml_unit_scaling_state_initialised_using_constant/model.py", generator->implementationCode()); } TEST(Generator, cellmlUnitScalingStateInitialisedUsingVariable) @@ -982,14 +982,14 @@ TEST(Generator, cellmlUnitScalingStateInitialisedUsingVariable) generator->setModel(analyserModel); - EXPECT_EQ(fileContents("generator/cellml_unit_scaling_state_initialised_using_variable/model.h"), generator->interfaceCode()); - EXPECT_EQ(fileContents("generator/cellml_unit_scaling_state_initialised_using_variable/model.c"), generator->implementationCode()); + EXPECT_EQ_FILE_CONTENTS("generator/cellml_unit_scaling_state_initialised_using_variable/model.h", generator->interfaceCode()); + EXPECT_EQ_FILE_CONTENTS("generator/cellml_unit_scaling_state_initialised_using_variable/model.c", generator->implementationCode()); auto profile = libcellml::GeneratorProfile::create(libcellml::GeneratorProfile::Profile::PYTHON); generator->setProfile(profile); - EXPECT_EQ(fileContents("generator/cellml_unit_scaling_state_initialised_using_variable/model.py"), generator->implementationCode()); + EXPECT_EQ_FILE_CONTENTS("generator/cellml_unit_scaling_state_initialised_using_variable/model.py", generator->implementationCode()); } TEST(Generator, cellmlUnitScalingRate) @@ -1010,14 +1010,14 @@ TEST(Generator, cellmlUnitScalingRate) generator->setModel(analyserModel); - EXPECT_EQ(fileContents("generator/cellml_unit_scaling_rate/model.h"), generator->interfaceCode()); - EXPECT_EQ(fileContents("generator/cellml_unit_scaling_rate/model.c"), generator->implementationCode()); + EXPECT_EQ_FILE_CONTENTS("generator/cellml_unit_scaling_rate/model.h", generator->interfaceCode()); + EXPECT_EQ_FILE_CONTENTS("generator/cellml_unit_scaling_rate/model.c", generator->implementationCode()); auto profile = libcellml::GeneratorProfile::create(libcellml::GeneratorProfile::Profile::PYTHON); generator->setProfile(profile); - EXPECT_EQ(fileContents("generator/cellml_unit_scaling_rate/model.py"), generator->implementationCode()); + EXPECT_EQ_FILE_CONTENTS("generator/cellml_unit_scaling_rate/model.py", generator->implementationCode()); } TEST(Generator, dependentEqns) @@ -1038,14 +1038,14 @@ TEST(Generator, dependentEqns) generator->setModel(analyserModel); - EXPECT_EQ(fileContents("generator/dependent_eqns/model.h"), generator->interfaceCode()); - EXPECT_EQ(fileContents("generator/dependent_eqns/model.c"), generator->implementationCode()); + EXPECT_EQ_FILE_CONTENTS("generator/dependent_eqns/model.h", generator->interfaceCode()); + EXPECT_EQ_FILE_CONTENTS("generator/dependent_eqns/model.c", generator->implementationCode()); auto profile = libcellml::GeneratorProfile::create(libcellml::GeneratorProfile::Profile::PYTHON); generator->setProfile(profile); - EXPECT_EQ(fileContents("generator/dependent_eqns/model.py"), generator->implementationCode()); + EXPECT_EQ_FILE_CONTENTS("generator/dependent_eqns/model.py", generator->implementationCode()); } TEST(Generator, cellGeometryModel) @@ -1066,14 +1066,14 @@ TEST(Generator, cellGeometryModel) generator->setModel(analyserModel); - EXPECT_EQ(fileContents("generator/cell_geometry_model/model.h"), generator->interfaceCode()); - EXPECT_EQ(fileContents("generator/cell_geometry_model/model.c"), generator->implementationCode()); + EXPECT_EQ_FILE_CONTENTS("generator/cell_geometry_model/model.h", generator->interfaceCode()); + EXPECT_EQ_FILE_CONTENTS("generator/cell_geometry_model/model.c", generator->implementationCode()); auto profile = libcellml::GeneratorProfile::create(libcellml::GeneratorProfile::Profile::PYTHON); generator->setProfile(profile); - EXPECT_EQ(fileContents("generator/cell_geometry_model/model.py"), generator->implementationCode()); + EXPECT_EQ_FILE_CONTENTS("generator/cell_geometry_model/model.py", generator->implementationCode()); } TEST(Generator, cellGeometryModelWithSomeConstantsAsExternalVariables) @@ -1101,14 +1101,14 @@ TEST(Generator, cellGeometryModelWithSomeConstantsAsExternalVariables) profile->setInterfaceFileNameString("model.external.h"); - EXPECT_EQ(fileContents("generator/cell_geometry_model/model.external.h"), generator->interfaceCode()); - EXPECT_EQ(fileContents("generator/cell_geometry_model/model.external.c"), generator->implementationCode()); + EXPECT_EQ_FILE_CONTENTS("generator/cell_geometry_model/model.external.h", generator->interfaceCode()); + EXPECT_EQ_FILE_CONTENTS("generator/cell_geometry_model/model.external.c", generator->implementationCode()); profile = libcellml::GeneratorProfile::create(libcellml::GeneratorProfile::Profile::PYTHON); generator->setProfile(profile); - EXPECT_EQ(fileContents("generator/cell_geometry_model/model.external.py"), generator->implementationCode()); + EXPECT_EQ_FILE_CONTENTS("generator/cell_geometry_model/model.external.py", generator->implementationCode()); } TEST(Generator, fabbriFantiniWildersSeveriHumanSanModel2017) @@ -1129,14 +1129,14 @@ TEST(Generator, fabbriFantiniWildersSeveriHumanSanModel2017) generator->setModel(analyserModel); - EXPECT_EQ(fileContents("generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.h"), generator->interfaceCode()); - EXPECT_EQ(fileContents("generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.c"), generator->implementationCode()); + EXPECT_EQ_FILE_CONTENTS("generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.h", generator->interfaceCode()); + EXPECT_EQ_FILE_CONTENTS("generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.c", generator->implementationCode()); auto profile = libcellml::GeneratorProfile::create(libcellml::GeneratorProfile::Profile::PYTHON); generator->setProfile(profile); - EXPECT_EQ(fileContents("generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.py"), generator->implementationCode()); + EXPECT_EQ_FILE_CONTENTS("generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.py", generator->implementationCode()); } TEST(Generator, garnyKohlHunterBoyettNobleRabbitSanModel2003) @@ -1157,14 +1157,14 @@ TEST(Generator, garnyKohlHunterBoyettNobleRabbitSanModel2003) generator->setModel(analyserModel); - EXPECT_EQ(fileContents("generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.h"), generator->interfaceCode()); - EXPECT_EQ(fileContents("generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.c"), generator->implementationCode()); + EXPECT_EQ_FILE_CONTENTS("generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.h", generator->interfaceCode()); + EXPECT_EQ_FILE_CONTENTS("generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.c", generator->implementationCode()); auto profile = libcellml::GeneratorProfile::create(libcellml::GeneratorProfile::Profile::PYTHON); generator->setProfile(profile); - EXPECT_EQ(fileContents("generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.py"), generator->implementationCode()); + EXPECT_EQ_FILE_CONTENTS("generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.py", generator->implementationCode()); } TEST(Generator, hodgkinHuxleySquidAxonModel1952) @@ -1185,14 +1185,14 @@ TEST(Generator, hodgkinHuxleySquidAxonModel1952) generator->setModel(analyserModel); - EXPECT_EQ(fileContents("generator/hodgkin_huxley_squid_axon_model_1952/model.h"), generator->interfaceCode()); - EXPECT_EQ(fileContents("generator/hodgkin_huxley_squid_axon_model_1952/model.c"), generator->implementationCode()); + EXPECT_EQ_FILE_CONTENTS("generator/hodgkin_huxley_squid_axon_model_1952/model.h", generator->interfaceCode()); + EXPECT_EQ_FILE_CONTENTS("generator/hodgkin_huxley_squid_axon_model_1952/model.c", generator->implementationCode()); auto profile = libcellml::GeneratorProfile::create(libcellml::GeneratorProfile::Profile::PYTHON); generator->setProfile(profile); - EXPECT_EQ(fileContents("generator/hodgkin_huxley_squid_axon_model_1952/model.py"), generator->implementationCode()); + EXPECT_EQ_FILE_CONTENTS("generator/hodgkin_huxley_squid_axon_model_1952/model.py", generator->implementationCode()); } TEST(Generator, hodgkinHuxleySquidAxonModel1952UnknownVarsOnRhs) @@ -1213,14 +1213,14 @@ TEST(Generator, hodgkinHuxleySquidAxonModel1952UnknownVarsOnRhs) generator->setModel(analyserModel); - EXPECT_EQ(fileContents("generator/hodgkin_huxley_squid_axon_model_1952/model.h"), generator->interfaceCode()); - EXPECT_EQ(fileContents("generator/hodgkin_huxley_squid_axon_model_1952/model.c"), generator->implementationCode()); + EXPECT_EQ_FILE_CONTENTS("generator/hodgkin_huxley_squid_axon_model_1952/model.h", generator->interfaceCode()); + EXPECT_EQ_FILE_CONTENTS("generator/hodgkin_huxley_squid_axon_model_1952/model.c", generator->implementationCode()); auto profile = libcellml::GeneratorProfile::create(libcellml::GeneratorProfile::Profile::PYTHON); generator->setProfile(profile); - EXPECT_EQ(fileContents("generator/hodgkin_huxley_squid_axon_model_1952/model.py"), generator->implementationCode()); + EXPECT_EQ_FILE_CONTENTS("generator/hodgkin_huxley_squid_axon_model_1952/model.py", generator->implementationCode()); } TEST(Generator, hodgkinHuxleySquidAxonModel1952WithStateVariableAsExternalVariable) @@ -1250,14 +1250,14 @@ TEST(Generator, hodgkinHuxleySquidAxonModel1952WithStateVariableAsExternalVariab profile->setInterfaceFileNameString("model.state.h"); - EXPECT_EQ(fileContents("generator/hodgkin_huxley_squid_axon_model_1952/model.state.h"), generator->interfaceCode()); - EXPECT_EQ(fileContents("generator/hodgkin_huxley_squid_axon_model_1952/model.state.c"), generator->implementationCode()); + EXPECT_EQ_FILE_CONTENTS("generator/hodgkin_huxley_squid_axon_model_1952/model.state.h", generator->interfaceCode()); + EXPECT_EQ_FILE_CONTENTS("generator/hodgkin_huxley_squid_axon_model_1952/model.state.c", generator->implementationCode()); profile = libcellml::GeneratorProfile::create(libcellml::GeneratorProfile::Profile::PYTHON); generator->setProfile(profile); - EXPECT_EQ(fileContents("generator/hodgkin_huxley_squid_axon_model_1952/model.state.py"), generator->implementationCode()); + EXPECT_EQ_FILE_CONTENTS("generator/hodgkin_huxley_squid_axon_model_1952/model.state.py", generator->implementationCode()); } TEST(Generator, hodgkinHuxleySquidAxonModel1952WithStateVariablesAsExternalVariablesIncludingOneDependingOnTheOther) @@ -1294,14 +1294,14 @@ TEST(Generator, hodgkinHuxleySquidAxonModel1952WithStateVariablesAsExternalVaria profile->setInterfaceFileNameString("model.dependent.state.h"); - EXPECT_EQ(fileContents("generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.h"), generator->interfaceCode()); - EXPECT_EQ(fileContents("generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.c"), generator->implementationCode()); + EXPECT_EQ_FILE_CONTENTS("generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.h", generator->interfaceCode()); + EXPECT_EQ_FILE_CONTENTS("generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.c", generator->implementationCode()); profile = libcellml::GeneratorProfile::create(libcellml::GeneratorProfile::Profile::PYTHON); generator->setProfile(profile); - EXPECT_EQ(fileContents("generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.py"), generator->implementationCode()); + EXPECT_EQ_FILE_CONTENTS("generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.py", generator->implementationCode()); } TEST(Generator, hodgkinHuxleySquidAxonModel1952WithConstantAsExternalVariable) @@ -1331,14 +1331,14 @@ TEST(Generator, hodgkinHuxleySquidAxonModel1952WithConstantAsExternalVariable) profile->setInterfaceFileNameString("model.constant.h"); - EXPECT_EQ(fileContents("generator/hodgkin_huxley_squid_axon_model_1952/model.constant.h"), generator->interfaceCode()); - EXPECT_EQ(fileContents("generator/hodgkin_huxley_squid_axon_model_1952/model.constant.c"), generator->implementationCode()); + EXPECT_EQ_FILE_CONTENTS("generator/hodgkin_huxley_squid_axon_model_1952/model.constant.h", generator->interfaceCode()); + EXPECT_EQ_FILE_CONTENTS("generator/hodgkin_huxley_squid_axon_model_1952/model.constant.c", generator->implementationCode()); profile = libcellml::GeneratorProfile::create(libcellml::GeneratorProfile::Profile::PYTHON); generator->setProfile(profile); - EXPECT_EQ(fileContents("generator/hodgkin_huxley_squid_axon_model_1952/model.constant.py"), generator->implementationCode()); + EXPECT_EQ_FILE_CONTENTS("generator/hodgkin_huxley_squid_axon_model_1952/model.constant.py", generator->implementationCode()); } TEST(Generator, hodgkinHuxleySquidAxonModel1952WithConstantsAsExternalVariablesIncludingOneDependingOnTheOther) @@ -1374,14 +1374,14 @@ TEST(Generator, hodgkinHuxleySquidAxonModel1952WithConstantsAsExternalVariablesI profile->setInterfaceFileNameString("model.dependent.constant.h"); - EXPECT_EQ(fileContents("generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.h"), generator->interfaceCode()); - EXPECT_EQ(fileContents("generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.c"), generator->implementationCode()); + EXPECT_EQ_FILE_CONTENTS("generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.h", generator->interfaceCode()); + EXPECT_EQ_FILE_CONTENTS("generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.c", generator->implementationCode()); profile = libcellml::GeneratorProfile::create(libcellml::GeneratorProfile::Profile::PYTHON); generator->setProfile(profile); - EXPECT_EQ(fileContents("generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.py"), generator->implementationCode()); + EXPECT_EQ_FILE_CONTENTS("generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.py", generator->implementationCode()); } TEST(Generator, hodgkinHuxleySquidAxonModel1952WithComputedConstantAsExternalVariable) @@ -1411,14 +1411,14 @@ TEST(Generator, hodgkinHuxleySquidAxonModel1952WithComputedConstantAsExternalVar profile->setInterfaceFileNameString("model.computed.constant.h"); - EXPECT_EQ(fileContents("generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.h"), generator->interfaceCode()); - EXPECT_EQ(fileContents("generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.c"), generator->implementationCode()); + EXPECT_EQ_FILE_CONTENTS("generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.h", generator->interfaceCode()); + EXPECT_EQ_FILE_CONTENTS("generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.c", generator->implementationCode()); profile = libcellml::GeneratorProfile::create(libcellml::GeneratorProfile::Profile::PYTHON); generator->setProfile(profile); - EXPECT_EQ(fileContents("generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.py"), generator->implementationCode()); + EXPECT_EQ_FILE_CONTENTS("generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.py", generator->implementationCode()); } TEST(Generator, hodgkinHuxleySquidAxonModel1952WithComputedConstantsAsExternalVariablesIncludingOneDependingOnTheOther) @@ -1454,14 +1454,14 @@ TEST(Generator, hodgkinHuxleySquidAxonModel1952WithComputedConstantsAsExternalVa profile->setInterfaceFileNameString("model.dependent.computed.constant.h"); - EXPECT_EQ(fileContents("generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.h"), generator->interfaceCode()); - EXPECT_EQ(fileContents("generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.c"), generator->implementationCode()); + EXPECT_EQ_FILE_CONTENTS("generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.h", generator->interfaceCode()); + EXPECT_EQ_FILE_CONTENTS("generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.c", generator->implementationCode()); profile = libcellml::GeneratorProfile::create(libcellml::GeneratorProfile::Profile::PYTHON); generator->setProfile(profile); - EXPECT_EQ(fileContents("generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.py"), generator->implementationCode()); + EXPECT_EQ_FILE_CONTENTS("generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.py", generator->implementationCode()); } TEST(Generator, hodgkinHuxleySquidAxonModel1952WithAlgebraicVariableAsExternalVariable) @@ -1491,14 +1491,14 @@ TEST(Generator, hodgkinHuxleySquidAxonModel1952WithAlgebraicVariableAsExternalVa profile->setInterfaceFileNameString("model.algebraic.h"); - EXPECT_EQ(fileContents("generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.h"), generator->interfaceCode()); - EXPECT_EQ(fileContents("generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.c"), generator->implementationCode()); + EXPECT_EQ_FILE_CONTENTS("generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.h", generator->interfaceCode()); + EXPECT_EQ_FILE_CONTENTS("generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.c", generator->implementationCode()); profile = libcellml::GeneratorProfile::create(libcellml::GeneratorProfile::Profile::PYTHON); generator->setProfile(profile); - EXPECT_EQ(fileContents("generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.py"), generator->implementationCode()); + EXPECT_EQ_FILE_CONTENTS("generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.py", generator->implementationCode()); } TEST(Generator, hodgkinHuxleySquidAxonModel1952WithAlgebraicVariablesAsExternalVariablesIncludingOneDependingOnTheOther) @@ -1534,14 +1534,14 @@ TEST(Generator, hodgkinHuxleySquidAxonModel1952WithAlgebraicVariablesAsExternalV profile->setInterfaceFileNameString("model.dependent.algebraic.h"); - EXPECT_EQ(fileContents("generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.h"), generator->interfaceCode()); - EXPECT_EQ(fileContents("generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.c"), generator->implementationCode()); + EXPECT_EQ_FILE_CONTENTS("generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.h", generator->interfaceCode()); + EXPECT_EQ_FILE_CONTENTS("generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.c", generator->implementationCode()); profile = libcellml::GeneratorProfile::create(libcellml::GeneratorProfile::Profile::PYTHON); generator->setProfile(profile); - EXPECT_EQ(fileContents("generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.py"), generator->implementationCode()); + EXPECT_EQ_FILE_CONTENTS("generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.py", generator->implementationCode()); } TEST(Generator, hodgkinHuxleySquidAxonModel1952WithVariousExternalVariables) @@ -1584,14 +1584,14 @@ TEST(Generator, hodgkinHuxleySquidAxonModel1952WithVariousExternalVariables) profile->setInterfaceFileNameString("model.external.h"); - EXPECT_EQ(fileContents("generator/hodgkin_huxley_squid_axon_model_1952/model.external.h"), generator->interfaceCode()); - EXPECT_EQ(fileContents("generator/hodgkin_huxley_squid_axon_model_1952/model.external.c"), generator->implementationCode()); + EXPECT_EQ_FILE_CONTENTS("generator/hodgkin_huxley_squid_axon_model_1952/model.external.h", generator->interfaceCode()); + EXPECT_EQ_FILE_CONTENTS("generator/hodgkin_huxley_squid_axon_model_1952/model.external.c", generator->implementationCode()); profile = libcellml::GeneratorProfile::create(libcellml::GeneratorProfile::Profile::PYTHON); generator->setProfile(profile); - EXPECT_EQ(fileContents("generator/hodgkin_huxley_squid_axon_model_1952/model.external.py"), generator->implementationCode()); + EXPECT_EQ_FILE_CONTENTS("generator/hodgkin_huxley_squid_axon_model_1952/model.external.py", generator->implementationCode()); } TEST(Generator, hodgkinHuxleySquidAxonModel1952Nla) @@ -1619,14 +1619,14 @@ TEST(Generator, hodgkinHuxleySquidAxonModel1952Nla) profile->setInterfaceFileNameString("model.dae.h"); - EXPECT_EQ(fileContents("generator/hodgkin_huxley_squid_axon_model_1952/model.dae.h"), generator->interfaceCode()); - EXPECT_EQ(fileContents("generator/hodgkin_huxley_squid_axon_model_1952/model.dae.c"), generator->implementationCode()); + EXPECT_EQ_FILE_CONTENTS("generator/hodgkin_huxley_squid_axon_model_1952/model.dae.h", generator->interfaceCode()); + EXPECT_EQ_FILE_CONTENTS("generator/hodgkin_huxley_squid_axon_model_1952/model.dae.c", generator->implementationCode()); profile = libcellml::GeneratorProfile::create(libcellml::GeneratorProfile::Profile::PYTHON); generator->setProfile(profile); - EXPECT_EQ(fileContents("generator/hodgkin_huxley_squid_axon_model_1952/model.dae.py"), generator->implementationCode()); + EXPECT_EQ_FILE_CONTENTS("generator/hodgkin_huxley_squid_axon_model_1952/model.dae.py", generator->implementationCode()); } TEST(Generator, nobleModel1962) @@ -1647,14 +1647,14 @@ TEST(Generator, nobleModel1962) generator->setModel(analyserModel); - EXPECT_EQ(fileContents("generator/noble_model_1962/model.h"), generator->interfaceCode()); - EXPECT_EQ(fileContents("generator/noble_model_1962/model.c"), generator->implementationCode()); + EXPECT_EQ_FILE_CONTENTS("generator/noble_model_1962/model.h", generator->interfaceCode()); + EXPECT_EQ_FILE_CONTENTS("generator/noble_model_1962/model.c", generator->implementationCode()); auto profile = libcellml::GeneratorProfile::create(libcellml::GeneratorProfile::Profile::PYTHON); generator->setProfile(profile); - EXPECT_EQ(fileContents("generator/noble_model_1962/model.py"), generator->implementationCode()); + EXPECT_EQ_FILE_CONTENTS("generator/noble_model_1962/model.py", generator->implementationCode()); } TEST(Generator, robertsonOdeModel1966) @@ -1679,14 +1679,14 @@ TEST(Generator, robertsonOdeModel1966) profile->setInterfaceFileNameString("model.ode.h"); - EXPECT_EQ(fileContents("generator/robertson_model_1966/model.ode.h"), generator->interfaceCode()); - EXPECT_EQ(fileContents("generator/robertson_model_1966/model.ode.c"), generator->implementationCode()); + EXPECT_EQ_FILE_CONTENTS("generator/robertson_model_1966/model.ode.h", generator->interfaceCode()); + EXPECT_EQ_FILE_CONTENTS("generator/robertson_model_1966/model.ode.c", generator->implementationCode()); profile = libcellml::GeneratorProfile::create(libcellml::GeneratorProfile::Profile::PYTHON); generator->setProfile(profile); - EXPECT_EQ(fileContents("generator/robertson_model_1966/model.ode.py"), generator->implementationCode()); + EXPECT_EQ_FILE_CONTENTS("generator/robertson_model_1966/model.ode.py", generator->implementationCode()); } TEST(Generator, robertsonDaeModel1966) @@ -1711,14 +1711,14 @@ TEST(Generator, robertsonDaeModel1966) profile->setInterfaceFileNameString("model.dae.h"); - EXPECT_EQ(fileContents("generator/robertson_model_1966/model.dae.h"), generator->interfaceCode()); - EXPECT_EQ(fileContents("generator/robertson_model_1966/model.dae.c"), generator->implementationCode()); + EXPECT_EQ_FILE_CONTENTS("generator/robertson_model_1966/model.dae.h", generator->interfaceCode()); + EXPECT_EQ_FILE_CONTENTS("generator/robertson_model_1966/model.dae.c", generator->implementationCode()); profile = libcellml::GeneratorProfile::create(libcellml::GeneratorProfile::Profile::PYTHON); generator->setProfile(profile); - EXPECT_EQ(fileContents("generator/robertson_model_1966/model.dae.py"), generator->implementationCode()); + EXPECT_EQ_FILE_CONTENTS("generator/robertson_model_1966/model.dae.py", generator->implementationCode()); } TEST(Generator, sineImports) @@ -1747,14 +1747,14 @@ TEST(Generator, sineImports) generator->setModel(analyserModel); - EXPECT_EQ(fileContents("generator/sine_model_imports/model.h"), generator->interfaceCode()); - EXPECT_EQ(fileContents("generator/sine_model_imports/model.c"), generator->implementationCode()); + EXPECT_EQ_FILE_CONTENTS("generator/sine_model_imports/model.h", generator->interfaceCode()); + EXPECT_EQ_FILE_CONTENTS("generator/sine_model_imports/model.c", generator->implementationCode()); auto profile = libcellml::GeneratorProfile::create(libcellml::GeneratorProfile::Profile::PYTHON); generator->setProfile(profile); - EXPECT_EQ(fileContents("generator/sine_model_imports/model.py"), generator->implementationCode()); + EXPECT_EQ_FILE_CONTENTS("generator/sine_model_imports/model.py", generator->implementationCode()); } TEST(Generator, analyserModelScopeTest) @@ -1778,8 +1778,8 @@ TEST(Generator, analyserModelScopeTest) generator->setModel(analyserModel); - EXPECT_EQ(fileContents("generator/hodgkin_huxley_squid_axon_model_1952/model.h"), generator->interfaceCode()); - EXPECT_EQ(fileContents("generator/hodgkin_huxley_squid_axon_model_1952/model.c"), generator->implementationCode()); + EXPECT_EQ_FILE_CONTENTS("generator/hodgkin_huxley_squid_axon_model_1952/model.h", generator->interfaceCode()); + EXPECT_EQ_FILE_CONTENTS("generator/hodgkin_huxley_squid_axon_model_1952/model.c", generator->implementationCode()); } TEST(Generator, daeModel) @@ -1800,14 +1800,14 @@ TEST(Generator, daeModel) generator->setModel(analyserModel); - EXPECT_EQ(fileContents("generator/dae_cellml_1_1_model/model.h"), generator->interfaceCode()); - EXPECT_EQ(fileContents("generator/dae_cellml_1_1_model/model.c"), generator->implementationCode()); + EXPECT_EQ_FILE_CONTENTS("generator/dae_cellml_1_1_model/model.h", generator->interfaceCode()); + EXPECT_EQ_FILE_CONTENTS("generator/dae_cellml_1_1_model/model.c", generator->implementationCode()); auto profile = libcellml::GeneratorProfile::create(libcellml::GeneratorProfile::Profile::PYTHON); generator->setProfile(profile); - EXPECT_EQ(fileContents("generator/dae_cellml_1_1_model/model.py"), generator->implementationCode()); + EXPECT_EQ_FILE_CONTENTS("generator/dae_cellml_1_1_model/model.py", generator->implementationCode()); } TEST(Generator, variableInitialisedUsingAConstant) @@ -1828,14 +1828,14 @@ TEST(Generator, variableInitialisedUsingAConstant) generator->setModel(analyserModel); - EXPECT_EQ(fileContents("generator/variable_initialised_using_a_constant/model.h"), generator->interfaceCode()); - EXPECT_EQ(fileContents("generator/variable_initialised_using_a_constant/model.c"), generator->implementationCode()); + EXPECT_EQ_FILE_CONTENTS("generator/variable_initialised_using_a_constant/model.h", generator->interfaceCode()); + EXPECT_EQ_FILE_CONTENTS("generator/variable_initialised_using_a_constant/model.c", generator->implementationCode()); auto profile = libcellml::GeneratorProfile::create(libcellml::GeneratorProfile::Profile::PYTHON); generator->setProfile(profile); - EXPECT_EQ(fileContents("generator/variable_initialised_using_a_constant/model.py"), generator->implementationCode()); + EXPECT_EQ_FILE_CONTENTS("generator/variable_initialised_using_a_constant/model.py", generator->implementationCode()); } TEST(Generator, modelOutOfScope) @@ -1864,7 +1864,7 @@ TEST(Generator, modelOutOfScope) generator->setProfile(profile); - EXPECT_EQ(fileContents("generator/ode_multiple_dependent_odes/model.py"), generator->implementationCode()); + EXPECT_EQ_FILE_CONTENTS("generator/ode_multiple_dependent_odes/model.py", generator->implementationCode()); } TEST(Generator, unknownVariableMarkedAsExternalVariable) @@ -1887,14 +1887,14 @@ TEST(Generator, unknownVariableMarkedAsExternalVariable) generator->setModel(analyserModel); - EXPECT_EQ(fileContents("generator/unknown_variable_as_external_variable/model.h"), generator->interfaceCode()); - EXPECT_EQ(fileContents("generator/unknown_variable_as_external_variable/model.c"), generator->implementationCode()); + EXPECT_EQ_FILE_CONTENTS("generator/unknown_variable_as_external_variable/model.h", generator->interfaceCode()); + EXPECT_EQ_FILE_CONTENTS("generator/unknown_variable_as_external_variable/model.c", generator->implementationCode()); auto profile = libcellml::GeneratorProfile::create(libcellml::GeneratorProfile::Profile::PYTHON); generator->setProfile(profile); - EXPECT_EQ(fileContents("generator/unknown_variable_as_external_variable/model.py"), generator->implementationCode()); + EXPECT_EQ_FILE_CONTENTS("generator/unknown_variable_as_external_variable/model.py", generator->implementationCode()); } TEST(Generator, modelWithComplexUnitsOutOfScope) @@ -1928,5 +1928,5 @@ TEST(Generator, modelWithComplexUnitsOutOfScope) generator->setProfile(profile); - EXPECT_EQ(fileContents("generator/cellml_slc_example/model.py"), generator->implementationCode()); + EXPECT_EQ_FILE_CONTENTS("generator/cellml_slc_example/model.py", generator->implementationCode()); } diff --git a/tests/importer/importer.cpp b/tests/importer/importer.cpp index 3f959e71af..3ebab5811e 100644 --- a/tests/importer/importer.cpp +++ b/tests/importer/importer.cpp @@ -334,9 +334,9 @@ TEST(Importer, accessImportedModelLibrary) auto point = importer->library(resourcePath("importer/diamond_point.cellml")); // Test that the library items are the same as those in the files. - EXPECT_EQ(fileContents("importer/diamond_left.cellml"), printer->printModel(left)); - EXPECT_EQ(fileContents("importer/diamond_right.cellml"), printer->printModel(right)); - EXPECT_EQ(fileContents("importer/diamond_point.cellml"), printer->printModel(point)); + EXPECT_EQ_FILE_CONTENTS("importer/diamond_left.cellml", printer->printModel(left)); + EXPECT_EQ_FILE_CONTENTS("importer/diamond_right.cellml", printer->printModel(right)); + EXPECT_EQ_FILE_CONTENTS("importer/diamond_point.cellml", printer->printModel(point)); } TEST(Importer, multipleModelResolution) diff --git a/tests/importer/model_flattening.cpp b/tests/importer/model_flattening.cpp index 80c218df3f..f28e84713f 100644 --- a/tests/importer/model_flattening.cpp +++ b/tests/importer/model_flattening.cpp @@ -734,15 +734,15 @@ TEST(ModelFlattening, hodgkinHuxleyDefinedUsingImports) generator->setModel(analyser->model()); - EXPECT_EQ(fileContents("generator/hodgkin_huxley_squid_axon_model_1952/model.h"), generator->interfaceCode()); - EXPECT_EQ(fileContents("generator/hodgkin_huxley_squid_axon_model_1952/model.c"), generator->implementationCode()); + EXPECT_EQ_FILE_CONTENTS("generator/hodgkin_huxley_squid_axon_model_1952/model.h", generator->interfaceCode()); + EXPECT_EQ_FILE_CONTENTS("generator/hodgkin_huxley_squid_axon_model_1952/model.c", generator->implementationCode()); libcellml::GeneratorProfilePtr profile = libcellml::GeneratorProfile::create(libcellml::GeneratorProfile::Profile::PYTHON); generator->setProfile(profile); EXPECT_EQ("", generator->interfaceCode()); - EXPECT_EQ(fileContents("generator/hodgkin_huxley_squid_axon_model_1952/model.py"), generator->implementationCode()); + EXPECT_EQ_FILE_CONTENTS("generator/hodgkin_huxley_squid_axon_model_1952/model.py", generator->implementationCode()); } TEST(ModelFlattening, importedComponentsWithConnectionsToChildren) diff --git a/tests/printer/printer.cpp b/tests/printer/printer.cpp index a55cf81ceb..74692e53d3 100644 --- a/tests/printer/printer.cpp +++ b/tests/printer/printer.cpp @@ -312,7 +312,7 @@ TEST(Printer, printModelWithTabs) libcellml::ModelPtr model = parser->parseModel(fileContents("printer/tabulated_model.cellml")); libcellml::PrinterPtr printer = libcellml::Printer::create(); - EXPECT_EQ(fileContents("printer/spaced_model.cellml"), printer->printModel(model)); + EXPECT_EQ_FILE_CONTENTS("printer/spaced_model.cellml", printer->printModel(model)); } TEST(Printer, printModelWithStandardUnitsAdded) diff --git a/tests/test_utils.cpp b/tests/test_utils.cpp index 8aafe6088e..0275c8483e 100644 --- a/tests/test_utils.cpp +++ b/tests/test_utils.cpp @@ -216,7 +216,6 @@ std::vector expectedUrls(size_t size, std::string url) } void expectEqualIssues(const std::vector &issues, const libcellml::LoggerPtr &logger) - { EXPECT_EQ(issues.size(), logger->issueCount()); for (size_t i = 0; i < logger->issueCount() && i < issues.size(); ++i) { @@ -417,3 +416,19 @@ void compareReset(const libcellml::ResetPtr &r1, const libcellml::ResetPtr &r2) EXPECT_EQ(r1->testValueId(), r2->testValueId()); EXPECT_EQ(r1->resetValueId(), r2->resetValueId()); } + +void expectEqualFileContents(const std::string &fileName, const std::string &fileContents) +{ + // Uncomment the below when you want to generate the expected file contents. + // #define NEW_GENERATOR + +#ifdef NEW_GENERATOR + std::ofstream file(resourcePath(fileName)); + + file << fileContents; + + file.close(); +#endif + + EXPECT_EQ(::fileContents(fileName), fileContents); +} diff --git a/tests/test_utils.h b/tests/test_utils.h index b446ac2384..c89198426a 100644 --- a/tests/test_utils.h +++ b/tests/test_utils.h @@ -104,6 +104,7 @@ void TEST_EXPORT expectEqualIssuesCellmlElementTypesLevelsReferenceRulesUrls(con const std::vector &referenceRules, const std::vector &urls, const libcellml::LoggerPtr &logger); +void TEST_EXPORT expectEqualFileContents(const std::string &fileName, const std::string &fileContents); libcellml::ModelPtr TEST_EXPORT createModel(const std::string &name = ""); libcellml::ModelPtr TEST_EXPORT createModelWithComponent(const std::string &modelName = "", @@ -128,3 +129,7 @@ void TEST_EXPORT compareModel(const libcellml::ModelPtr &m1, const libcellml::Mo #define EXPECT_EQ_ISSUES_CELLMLELEMENTTYPES_LEVELS_REFERENCERULES_URLS(issues, cellmlElementTypes, levels, referenceRules, urls, logger) \ SCOPED_TRACE("Issue occurred here."); \ expectEqualIssuesCellmlElementTypesLevelsReferenceRulesUrls(issues, cellmlElementTypes, levels, referenceRules, urls, logger) + +#define EXPECT_EQ_FILE_CONTENTS(fileName, fileContents) \ + SCOPED_TRACE("Issue occurred here."); \ + expectEqualFileContents(fileName, fileContents) From c2504d7d68eaef3945f7765ddd42c31e624a4829 Mon Sep 17 00:00:00 2001 From: Alan Garny Date: Wed, 7 Aug 2024 18:00:09 +0200 Subject: [PATCH 10/85] Generator profile: added setters/getters for constants, computed constants, and algebraic arrays. --- src/api/libcellml/generatorprofile.h | 56 +- src/bindings/interface/generatorprofile.i | 20 +- src/bindings/javascript/generatorprofile.cpp | 8 +- src/generator.cpp | 18 +- src/generatorprofile.cpp | 40 +- src/generatorprofilesha1values.h | 4 +- src/generatorprofiletools.cpp | 4 +- .../javascript/generatorprofile.test.js | 18 +- .../bindings/python/test_generator_profile.py | 26 +- tests/generator/generatorprofile.cpp | 12 +- tests/resources/coverage/generator/model.c | 434 +++++------ .../generator/model.implementation.out | 434 +++++------ .../generator/model.modified.profile.c | 434 +++++------ .../generator/model.modified.profile.py | 434 +++++------ tests/resources/coverage/generator/model.out | 434 +++++------ tests/resources/coverage/generator/model.py | 434 +++++------ .../algebraic_eqn_computed_var_on_rhs/model.c | 4 +- .../model.external.c | 6 +- .../model.external.py | 6 +- .../model.py | 4 +- .../algebraic_eqn_const_var_on_rhs/model.c | 4 +- .../algebraic_eqn_const_var_on_rhs/model.py | 4 +- .../algebraic_eqn_constant_on_rhs/model.c | 2 +- .../algebraic_eqn_constant_on_rhs/model.py | 2 +- .../algebraic_eqn_derivative_on_rhs/model.c | 6 +- .../algebraic_eqn_derivative_on_rhs/model.py | 6 +- .../model.c | 6 +- .../model.py | 6 +- .../algebraic_eqn_state_var_on_rhs/model.c | 6 +- .../algebraic_eqn_state_var_on_rhs/model.py | 6 +- .../model.c | 6 +- .../model.py | 6 +- .../model.c | 16 +- .../model.external.c | 10 +- .../model.external.py | 10 +- .../model.py | 16 +- .../model.c | 30 +- .../model.py | 30 +- .../model.three.externals.c | 12 +- .../model.three.externals.py | 12 +- .../model.not.ordered.c | 28 +- .../model.not.ordered.py | 28 +- .../model.ordered.c | 28 +- .../model.ordered.py | 28 +- .../algebraic_unknown_var_on_rhs/model.c | 4 +- .../algebraic_unknown_var_on_rhs/model.py | 4 +- .../generator/cell_geometry_model/model.c | 8 +- .../cell_geometry_model/model.external.c | 12 +- .../cell_geometry_model/model.external.py | 12 +- .../generator/cell_geometry_model/model.py | 8 +- .../model.c | 4 +- .../model.py | 4 +- .../generator/cellml_slc_example/model.py | 20 +- .../model.c | 4 +- .../model.py | 4 +- .../cellml_unit_scaling_constant/model.c | 6 +- .../cellml_unit_scaling_constant/model.py | 6 +- .../cellml_unit_scaling_rate/model.c | 4 +- .../cellml_unit_scaling_rate/model.py | 4 +- .../cellml_unit_scaling_state/model.c | 4 +- .../cellml_unit_scaling_state/model.py | 4 +- .../model.c | 8 +- .../model.py | 8 +- .../generator/dae_cellml_1_1_model/model.c | 46 +- .../generator/dae_cellml_1_1_model/model.py | 46 +- .../generator/dependent_eqns/model.c | 4 +- .../generator/dependent_eqns/model.py | 4 +- .../model.c | 690 +++++++++--------- .../model.py | 690 +++++++++--------- .../model.c | 504 ++++++------- .../model.py | 504 ++++++------- .../model.algebraic.c | 66 +- .../model.algebraic.py | 66 +- .../model.c | 62 +- .../model.computed.constant.c | 66 +- .../model.computed.constant.py | 66 +- .../model.constant.c | 66 +- .../model.constant.py | 66 +- .../model.dae.c | 148 ++-- .../model.dae.py | 148 ++-- .../model.dependent.algebraic.c | 68 +- .../model.dependent.algebraic.py | 68 +- .../model.dependent.computed.constant.c | 74 +- .../model.dependent.computed.constant.py | 74 +- .../model.dependent.constant.c | 70 +- .../model.dependent.constant.py | 70 +- .../model.dependent.state.c | 50 +- .../model.dependent.state.py | 50 +- .../model.external.c | 54 +- .../model.external.py | 54 +- .../model.py | 62 +- .../model.state.c | 62 +- .../model.state.py | 62 +- .../generator/noble_model_1962/model.c | 66 +- .../generator/noble_model_1962/model.py | 66 +- .../generator/ode_computed_var_on_rhs/model.c | 4 +- .../ode_computed_var_on_rhs/model.py | 4 +- .../model.c | 4 +- .../model.py | 4 +- .../generator/ode_const_var_on_rhs/model.c | 4 +- .../generator/ode_const_var_on_rhs/model.py | 4 +- .../model.c | 4 +- .../model.py | 4 +- .../ode_multiple_dependent_odes/model.c | 4 +- .../ode_multiple_dependent_odes/model.py | 4 +- .../model.c | 4 +- .../model.py | 4 +- .../ode_multiple_odes_with_same_name/model.c | 4 +- .../ode_multiple_odes_with_same_name/model.py | 4 +- .../robertson_model_1966/model.dae.c | 22 +- .../robertson_model_1966/model.dae.py | 22 +- .../robertson_model_1966/model.ode.c | 14 +- .../robertson_model_1966/model.ode.py | 14 +- .../generator/sine_model_imports/model.c | 22 +- .../generator/sine_model_imports/model.py | 22 +- .../model.c | 22 +- .../model.py | 22 +- .../model.c | 4 +- .../model.py | 4 +- 119 files changed, 3904 insertions(+), 3778 deletions(-) diff --git a/src/api/libcellml/generatorprofile.h b/src/api/libcellml/generatorprofile.h index cb85018fbe..cbbb42f1a2 100644 --- a/src/api/libcellml/generatorprofile.h +++ b/src/api/libcellml/generatorprofile.h @@ -3034,23 +3034,61 @@ class LIBCELLML_EXPORT GeneratorProfile void setRatesArrayString(const std::string &ratesArrayString); /** - * @brief Get the @c std::string for the name of the variables array. + * @brief Get the @c std::string for the name of the constants array. * - * Return the @c std::string for the name of the variables array. + * Return the @c std::string for the name of the constants array. * - * @return The @c std::string for the name of the variables array. + * @return The @c std::string for the name of the constants array. */ - std::string variablesArrayString() const; + std::string constantsArrayString() const; /** - * @brief Set the @c std::string for the name of the variables array. + * @brief Set the @c std::string for the name of the constants array. * - * Set the @c std::string for the name of the variables array. + * Set the @c std::string for the name of the constants array. * - * @param variablesArrayString The @c std::string to use for the name of the - * variables array. + * @param constantsArrayString The @c std::string to use for the name of the + * constants array. + */ + void setConstantsArrayString(const std::string &constantsArrayString); + + /** + * @brief Get the @c std::string for the name of the computed constants array. + * + * Return the @c std::string for the name of the computed constants array. + * + * @return The @c std::string for the name of the computed constants array. + */ + std::string computedConstantsArrayString() const; + + /** + * @brief Set the @c std::string for the name of the computed constants array. + * + * Set the @c std::string for the name of the computed constants array. + * + * @param computedConstantsArrayString The @c std::string to use for the name of the + * computed constants array. + */ + void setComputedConstantsArrayString(const std::string &computedConstantsArrayString); + + /** + * @brief Get the @c std::string for the name of the algebraic array. + * + * Return the @c std::string for the name of the algebraic array. + * + * @return The @c std::string for the name of the algebraic array. + */ + std::string algebraicArrayString() const; + + /** + * @brief Set the @c std::string for the name of the algebraic array. + * + * Set the @c std::string for the name of the algebraic array. + * + * @param algebraicArrayString The @c std::string to use for the name of the + * algebraic array. */ - void setVariablesArrayString(const std::string &variablesArrayString); + void setAlgebraicArrayString(const std::string &algebraicArrayString); /** * @brief Get the @c std::string for the type definition of an external diff --git a/src/bindings/interface/generatorprofile.i b/src/bindings/interface/generatorprofile.i index e8da17ba39..8c694e9f5f 100644 --- a/src/bindings/interface/generatorprofile.i +++ b/src/bindings/interface/generatorprofile.i @@ -833,11 +833,23 @@ and units of a variable respectively."; %feature("docstring") libcellml::GeneratorProfile::setRatesArrayString "Sets the string for the name of the rates array."; -%feature("docstring") libcellml::GeneratorProfile::variablesArrayString -"Returns the string for the name of the variables array."; +%feature("docstring") libcellml::GeneratorProfile::constantsArrayString +"Returns the string for the name of the constants array."; -%feature("docstring") libcellml::GeneratorProfile::setVariablesArrayString -"Sets the string for the name of the variables array."; +%feature("docstring") libcellml::GeneratorProfile::setConstantsArrayString +"Sets the string for the name of the constants array."; + +%feature("docstring") libcellml::GeneratorProfile::computedConstantsArrayString +"Returns the string for the name of the computed constants array."; + +%feature("docstring") libcellml::GeneratorProfile::setComputedConstantsArrayString +"Sets the string for the name of the computed constants array."; + +%feature("docstring") libcellml::GeneratorProfile::algebraicArrayString +"Returns the string for the name of the algebraic array."; + +%feature("docstring") libcellml::GeneratorProfile::setAlgebraicArrayString +"Sets the string for the name of the algebraic array."; %feature("docstring") libcellml::GeneratorProfile::externalVariableMethodTypeDefinitionString "Returns the string for the type definition of an external variable method."; diff --git a/src/bindings/javascript/generatorprofile.cpp b/src/bindings/javascript/generatorprofile.cpp index 97a6ee651d..e9fc6b420b 100644 --- a/src/bindings/javascript/generatorprofile.cpp +++ b/src/bindings/javascript/generatorprofile.cpp @@ -299,8 +299,12 @@ EMSCRIPTEN_BINDINGS(libcellml_generatorprofile) .function("setStatesArrayString", &libcellml::GeneratorProfile::setStatesArrayString) .function("ratesArrayString", &libcellml::GeneratorProfile::ratesArrayString) .function("setRatesArrayString", &libcellml::GeneratorProfile::setRatesArrayString) - .function("variablesArrayString", &libcellml::GeneratorProfile::variablesArrayString) - .function("setVariablesArrayString", &libcellml::GeneratorProfile::setVariablesArrayString) + .function("constantsArrayString", &libcellml::GeneratorProfile::constantsArrayString) + .function("setConstantsArrayString", &libcellml::GeneratorProfile::setConstantsArrayString) + .function("computedConstantsArrayString", &libcellml::GeneratorProfile::computedConstantsArrayString) + .function("setComputedConstantsArrayString", &libcellml::GeneratorProfile::setComputedConstantsArrayString) + .function("algebraicArrayString", &libcellml::GeneratorProfile::algebraicArrayString) + .function("setAlgebraicArrayString", &libcellml::GeneratorProfile::setAlgebraicArrayString) .function("externalVariableMethodTypeDefinitionString", &libcellml::GeneratorProfile::externalVariableMethodTypeDefinitionString) .function("setExternalVariableMethodTypeDefinitionString", &libcellml::GeneratorProfile::setExternalVariableMethodTypeDefinitionString) .function("externalVariableMethodCallString", &libcellml::GeneratorProfile::externalVariableMethodCallString) diff --git a/src/generator.cpp b/src/generator.cpp index 51a4e51b4b..5532344305 100644 --- a/src/generator.cpp +++ b/src/generator.cpp @@ -810,7 +810,11 @@ void Generator::GeneratorImpl::addNlaSystemsCode() for (i = 0; i < variablesCount; ++i) { auto arrayString = (variables[i]->type() == AnalyserVariable::Type::STATE) ? mProfile->ratesArrayString() : - mProfile->variablesArrayString(); + (variables[i]->type() == AnalyserVariable::Type::CONSTANT) ? + mProfile->constantsArrayString() : + (variables[i]->type() == AnalyserVariable::Type::COMPUTED_CONSTANT) ? + mProfile->computedConstantsArrayString() : + mProfile->algebraicArrayString(); methodBody += mProfile->indentString() + arrayString + mProfile->openArrayString() + convertToString(variables[i]->index()) + mProfile->closeArrayString() @@ -851,7 +855,7 @@ void Generator::GeneratorImpl::addNlaSystemsCode() for (i = 0; i < variablesCount; ++i) { auto arrayString = (variables[i]->type() == AnalyserVariable::Type::STATE) ? mProfile->ratesArrayString() : - mProfile->variablesArrayString(); + mProfile->algebraicArrayString(); methodBody += mProfile->indentString() + mProfile->uArrayString() + mProfile->openArrayString() + convertToString(i) + mProfile->closeArrayString() @@ -871,7 +875,7 @@ void Generator::GeneratorImpl::addNlaSystemsCode() for (i = 0; i < variablesCount; ++i) { auto arrayString = (variables[i]->type() == AnalyserVariable::Type::STATE) ? mProfile->ratesArrayString() : - mProfile->variablesArrayString(); + mProfile->algebraicArrayString(); methodBody += mProfile->indentString() + arrayString + mProfile->openArrayString() + convertToString(variables[i]->index()) + mProfile->closeArrayString() @@ -923,7 +927,7 @@ std::string Generator::GeneratorImpl::generateDoubleOrConstantVariableNameCode(c auto initValueVariable = owningComponent(variable)->variable(variable->initialValue()); auto analyserInitialValueVariable = analyserVariable(initValueVariable); - return mProfile->variablesArrayString() + mProfile->openArrayString() + convertToString(analyserInitialValueVariable->index()) + mProfile->closeArrayString(); + return mProfile->constantsArrayString() + mProfile->openArrayString() + convertToString(analyserInitialValueVariable->index()) + mProfile->closeArrayString(); } std::string Generator::GeneratorImpl::generateVariableNameCode(const VariablePtr &variable, @@ -950,8 +954,12 @@ std::string Generator::GeneratorImpl::generateVariableNameCode(const VariablePtr arrayName = state ? mProfile->statesArrayString() : mProfile->ratesArrayString(); + } else if (analyserVariable->type() == AnalyserVariable::Type::CONSTANT) { + arrayName = mProfile->constantsArrayString(); + } else if (analyserVariable->type() == AnalyserVariable::Type::COMPUTED_CONSTANT) { + arrayName = mProfile->computedConstantsArrayString(); } else { - arrayName = mProfile->variablesArrayString(); + arrayName = mProfile->algebraicArrayString(); } return arrayName + mProfile->openArrayString() + convertToString(analyserVariable->index()) + mProfile->closeArrayString(); diff --git a/src/generatorprofile.cpp b/src/generatorprofile.cpp index 3dd23d9808..67dd5160d9 100644 --- a/src/generatorprofile.cpp +++ b/src/generatorprofile.cpp @@ -222,7 +222,9 @@ struct GeneratorProfile::GeneratorProfileImpl std::string mStatesArrayString; std::string mRatesArrayString; - std::string mVariablesArrayString; + std::string mConstantsArrayString; + std::string mComputedConstantsArrayString; + std::string mAlgebraicArrayString; std::string mExternalVariableMethodTypeDefinitionFamString; std::string mExternalVariableMethodTypeDefinitionFdmString; @@ -580,7 +582,9 @@ void GeneratorProfile::GeneratorProfileImpl::loadProfile(GeneratorProfile::Profi mStatesArrayString = "states"; mRatesArrayString = "rates"; - mVariablesArrayString = "variables"; + mConstantsArrayString = "constants"; + mComputedConstantsArrayString = "computedConstants"; + mAlgebraicArrayString = "algebraic"; mExternalVariableMethodTypeDefinitionFamString = "typedef double (* ExternalVariable)(double *variables, size_t index);\n"; mExternalVariableMethodTypeDefinitionFdmString = "typedef double (* ExternalVariable)(double voi, double *states, double *rates, double *variables, size_t index);\n"; @@ -1014,7 +1018,9 @@ void GeneratorProfile::GeneratorProfileImpl::loadProfile(GeneratorProfile::Profi mStatesArrayString = "states"; mRatesArrayString = "rates"; - mVariablesArrayString = "variables"; + mConstantsArrayString = "constants"; + mComputedConstantsArrayString = "computed_constants"; + mAlgebraicArrayString = "algebraic"; mExternalVariableMethodTypeDefinitionFamString = ""; mExternalVariableMethodTypeDefinitionFdmString = ""; @@ -2535,14 +2541,34 @@ void GeneratorProfile::setRatesArrayString(const std::string &ratesArrayString) mPimpl->mRatesArrayString = ratesArrayString; } -std::string GeneratorProfile::variablesArrayString() const +std::string GeneratorProfile::constantsArrayString() const { - return mPimpl->mVariablesArrayString; + return mPimpl->mConstantsArrayString; } -void GeneratorProfile::setVariablesArrayString(const std::string &variablesArrayString) +void GeneratorProfile::setConstantsArrayString(const std::string &constantsArrayString) { - mPimpl->mVariablesArrayString = variablesArrayString; + mPimpl->mConstantsArrayString = constantsArrayString; +} + +std::string GeneratorProfile::computedConstantsArrayString() const +{ + return mPimpl->mComputedConstantsArrayString; +} + +void GeneratorProfile::setComputedConstantsArrayString(const std::string &computedConstantsArrayString) +{ + mPimpl->mComputedConstantsArrayString = computedConstantsArrayString; +} + +std::string GeneratorProfile::algebraicArrayString() const +{ + return mPimpl->mAlgebraicArrayString; +} + +void GeneratorProfile::setAlgebraicArrayString(const std::string &algebraicArrayString) +{ + mPimpl->mAlgebraicArrayString = algebraicArrayString; } std::string GeneratorProfile::externalVariableMethodTypeDefinitionString(bool forDifferentialModel) const diff --git a/src/generatorprofilesha1values.h b/src/generatorprofilesha1values.h index 0bae464fbe..69f2ae4d93 100644 --- a/src/generatorprofilesha1values.h +++ b/src/generatorprofilesha1values.h @@ -24,7 +24,7 @@ namespace libcellml { * The content of this file is generated, do not edit this file directly. * See docs/dev_utilities.rst for further information. */ -static const char C_GENERATOR_PROFILE_SHA1[] = "060945ab10d8ce4ce063e4b64199f684ec0150a5"; -static const char PYTHON_GENERATOR_PROFILE_SHA1[] = "859d7920e76c1a12345a2d642940163d41d27112"; +static const char C_GENERATOR_PROFILE_SHA1[] = "f36d3c679b030a09095376711d4dc9a638a5c7b3"; +static const char PYTHON_GENERATOR_PROFILE_SHA1[] = "bb03c147d17a9741667957068ef629058846d2e4"; } // namespace libcellml diff --git a/src/generatorprofiletools.cpp b/src/generatorprofiletools.cpp index 4a1613b8da..6293fd1201 100644 --- a/src/generatorprofiletools.cpp +++ b/src/generatorprofiletools.cpp @@ -480,7 +480,9 @@ std::string generatorProfileAsString(const GeneratorProfilePtr &generatorProfile profileContents += generatorProfile->statesArrayString() + generatorProfile->ratesArrayString() - + generatorProfile->variablesArrayString(); + + generatorProfile->constantsArrayString() + + generatorProfile->computedConstantsArrayString() + + generatorProfile->algebraicArrayString(); profileContents += generatorProfile->externalVariableMethodTypeDefinitionString(false) + generatorProfile->externalVariableMethodTypeDefinitionString(true); diff --git a/tests/bindings/javascript/generatorprofile.test.js b/tests/bindings/javascript/generatorprofile.test.js index 7c5bd368e6..92fe3b5868 100644 --- a/tests/bindings/javascript/generatorprofile.test.js +++ b/tests/bindings/javascript/generatorprofile.test.js @@ -897,11 +897,23 @@ describe("GeneratorProfile tests", () => { x.setRatesArrayString("something") expect(x.ratesArrayString()).toBe("something") }); - test("Checking GeneratorProfile.variablesArrayString.", () => { + test("Checking GeneratorProfile.constantsArrayString.", () => { const x = new libcellml.GeneratorProfile(libcellml.GeneratorProfile.Profile.C) - x.setVariablesArrayString("something") - expect(x.variablesArrayString()).toBe("something") + x.setConstantsArrayString("something") + expect(x.constantsArrayString()).toBe("something") + }); + test("Checking GeneratorProfile.computedConstantsArrayString.", () => { + const x = new libcellml.GeneratorProfile(libcellml.GeneratorProfile.Profile.C) + + x.setComputedConstantsArrayString("something") + expect(x.computedConstantsArrayString()).toBe("something") + }); + test("Checking GeneratorProfile.algebraicArrayString.", () => { + const x = new libcellml.GeneratorProfile(libcellml.GeneratorProfile.Profile.C) + + x.setAlgebraicArrayString("something") + expect(x.algebraicArrayString()).toBe("something") }); test("Checking GeneratorProfile.externalVariableMethodTypeDefinitionString.", () => { const x = new libcellml.GeneratorProfile(libcellml.GeneratorProfile.Profile.C) diff --git a/tests/bindings/python/test_generator_profile.py b/tests/bindings/python/test_generator_profile.py index 4eb8a46fad..aaa7e3271d 100644 --- a/tests/bindings/python/test_generator_profile.py +++ b/tests/bindings/python/test_generator_profile.py @@ -1607,14 +1607,32 @@ def test_variable_type_object_string(self): g.setVariableTypeObjectString(True, True, GeneratorProfileTestCase.VALUE) self.assertEqual(GeneratorProfileTestCase.VALUE, g.variableTypeObjectString(True, True)) - def test_variables_array_string(self): + def test_constants_array_string(self): from libcellml import GeneratorProfile g = GeneratorProfile() - self.assertEqual('variables', g.variablesArrayString()) - g.setVariablesArrayString(GeneratorProfileTestCase.VALUE) - self.assertEqual(GeneratorProfileTestCase.VALUE, g.variablesArrayString()) + self.assertEqual('constants', g.constantsArrayString()) + g.setConstantsArrayString(GeneratorProfileTestCase.VALUE) + self.assertEqual(GeneratorProfileTestCase.VALUE, g.constantsArrayString()) + + def test_computed_constants_array_string(self): + from libcellml import GeneratorProfile + + g = GeneratorProfile() + + self.assertEqual('computedConstants', g.computedConstantsArrayString()) + g.setComputedConstantsArrayString(GeneratorProfileTestCase.VALUE) + self.assertEqual(GeneratorProfileTestCase.VALUE, g.computedConstantsArrayString()) + + def test_algebraic_array_string(self): + from libcellml import GeneratorProfile + + g = GeneratorProfile() + + self.assertEqual('algebraic', g.algebraicArrayString()) + g.setAlgebraicArrayString(GeneratorProfileTestCase.VALUE) + self.assertEqual(GeneratorProfileTestCase.VALUE, g.algebraicArrayString()) def test_external_variable_method_type_definition_string(self): from libcellml import GeneratorProfile diff --git a/tests/generator/generatorprofile.cpp b/tests/generator/generatorprofile.cpp index f690252bc9..539e28a063 100644 --- a/tests/generator/generatorprofile.cpp +++ b/tests/generator/generatorprofile.cpp @@ -355,7 +355,9 @@ TEST(GeneratorProfile, defaultMiscellaneousValues) EXPECT_EQ("states", generatorProfile->statesArrayString()); EXPECT_EQ("rates", generatorProfile->ratesArrayString()); - EXPECT_EQ("variables", generatorProfile->variablesArrayString()); + EXPECT_EQ("constants", generatorProfile->constantsArrayString()); + EXPECT_EQ("computedConstants", generatorProfile->computedConstantsArrayString()); + EXPECT_EQ("algebraic", generatorProfile->algebraicArrayString()); EXPECT_EQ("typedef double (* ExternalVariable)(double *variables, size_t index);\n", generatorProfile->externalVariableMethodTypeDefinitionString(false)); EXPECT_EQ("typedef double (* ExternalVariable)(double voi, double *states, double *rates, double *variables, size_t index);\n", generatorProfile->externalVariableMethodTypeDefinitionString(true)); @@ -909,7 +911,9 @@ TEST(GeneratorProfile, miscellaneous) generatorProfile->setStatesArrayString(value); generatorProfile->setRatesArrayString(value); - generatorProfile->setVariablesArrayString(value); + generatorProfile->setConstantsArrayString(value); + generatorProfile->setComputedConstantsArrayString(value); + generatorProfile->setAlgebraicArrayString(value); generatorProfile->setExternalVariableMethodTypeDefinitionString(false, value); generatorProfile->setExternalVariableMethodTypeDefinitionString(true, value); @@ -1044,7 +1048,9 @@ TEST(GeneratorProfile, miscellaneous) EXPECT_EQ(value, generatorProfile->statesArrayString()); EXPECT_EQ(value, generatorProfile->ratesArrayString()); - EXPECT_EQ(value, generatorProfile->variablesArrayString()); + EXPECT_EQ(value, generatorProfile->constantsArrayString()); + EXPECT_EQ(value, generatorProfile->computedConstantsArrayString()); + EXPECT_EQ(value, generatorProfile->algebraicArrayString()); EXPECT_EQ(value, generatorProfile->externalVariableMethodTypeDefinitionString(false)); EXPECT_EQ(value, generatorProfile->externalVariableMethodTypeDefinitionString(true)); diff --git a/tests/resources/coverage/generator/model.c b/tests/resources/coverage/generator/model.c index e5bf4ccdf2..872419de42 100644 --- a/tests/resources/coverage/generator/model.c +++ b/tests/resources/coverage/generator/model.c @@ -356,11 +356,11 @@ void objectiveFunction0(double *u, double *f, void *data) double *rates = ((RootFindingInfo *) data)->rates; double *variables = ((RootFindingInfo *) data)->variables; - variables[205] = u[0]; - variables[206] = u[1]; + algebraic[205] = u[0]; + algebraic[206] = u[1]; - f[0] = variables[205]+variables[206]+states[0]-0.0; - f[1] = variables[205]-variables[206]-(variables[207]+variables[208]); + f[0] = algebraic[205]+algebraic[206]+states[0]-0.0; + f[1] = algebraic[205]-algebraic[206]-(computedConstants[207]+computedConstants[208]); } void findRoot0(double voi, double *states, double *rates, double *variables) @@ -368,231 +368,231 @@ void findRoot0(double voi, double *states, double *rates, double *variables) RootFindingInfo rfi = { voi, states, rates, variables }; double u[2]; - u[0] = variables[205]; - u[1] = variables[206]; + u[0] = algebraic[205]; + u[1] = algebraic[206]; nlaSolve(objectiveFunction0, u, 2, &rfi); - variables[205] = u[0]; - variables[206] = u[1]; + algebraic[205] = u[0]; + algebraic[206] = u[1]; } void initialiseVariables(double *states, double *rates, double *constants) { - variables[1] = 1.0; - variables[2] = 2.0; - variables[6] = 3.0; - variables[18] = 4.0; - variables[179] = 5.0; - variables[180] = 6.0; - variables[182] = 7.0; - variables[205] = 1.0; - variables[206] = 2.0; - variables[184] = 123.0; - variables[185] = 123.456789; - variables[186] = 123.0e99; - variables[187] = 123.456789e99; - variables[189] = 1.0; - variables[190] = 0.0; - variables[191] = 2.71828182845905; - variables[192] = 3.14159265358979; - variables[193] = INFINITY; - variables[194] = NAN; - variables[207] = 1.0; - variables[208] = 3.0; + constants[1] = 1.0; + constants[2] = 2.0; + constants[6] = 3.0; + constants[18] = 4.0; + constants[179] = 5.0; + constants[180] = 6.0; + constants[182] = 7.0; + algebraic[205] = 1.0; + algebraic[206] = 2.0; + computedConstants[184] = 123.0; + computedConstants[185] = 123.456789; + computedConstants[186] = 123.0e99; + computedConstants[187] = 123.456789e99; + computedConstants[189] = 1.0; + computedConstants[190] = 0.0; + computedConstants[191] = 2.71828182845905; + computedConstants[192] = 3.14159265358979; + computedConstants[193] = INFINITY; + computedConstants[194] = NAN; + computedConstants[207] = 1.0; + computedConstants[208] = 3.0; states[0] = 0.0; } void computeComputedConstants(double *constants, double *computedConstants) { - variables[0] = variables[1] == variables[2]; - variables[3] = variables[1]/(variables[2] == variables[2]); - variables[4] = variables[1] != variables[2]; - variables[5] = variables[1]/(variables[2] != variables[6]); - variables[7] = variables[1] < variables[2]; - variables[8] = variables[1]/(variables[2] < variables[6]); - variables[9] = variables[1] <= variables[2]; - variables[10] = variables[1]/(variables[2] <= variables[6]); - variables[11] = variables[1] > variables[2]; - variables[12] = variables[1]/(variables[2] > variables[6]); - variables[13] = variables[1] >= variables[2]; - variables[14] = variables[1]/(variables[2] >= variables[6]); - variables[15] = variables[1] && variables[2]; - variables[16] = variables[1] && variables[2] && variables[6]; - variables[17] = (variables[1] < variables[2]) && (variables[6] > variables[18]); - variables[19] = (variables[1]+variables[2]) && (variables[6] > variables[18]); - variables[20] = variables[1] && (variables[2] > variables[6]); - variables[21] = (variables[1]-variables[2]) && (variables[6] > variables[18]); - variables[22] = -variables[1] && (variables[2] > variables[6]); - variables[23] = pow(variables[1], variables[2]) && (variables[6] > variables[18]); - variables[24] = pow(variables[1], 1.0/variables[2]) && (variables[6] > variables[18]); - variables[25] = (variables[1] < variables[2]) && (variables[6]+variables[18]); - variables[26] = (variables[1] < variables[2]) && variables[6]; - variables[27] = (variables[1] < variables[2]) && (variables[6]-variables[18]); - variables[28] = (variables[1] < variables[2]) && -variables[6]; - variables[29] = (variables[1] < variables[2]) && pow(variables[6], variables[18]); - variables[30] = (variables[1] < variables[2]) && pow(variables[6], 1.0/variables[18]); - variables[31] = variables[1]/(variables[2] && variables[6]); - variables[32] = variables[1] || variables[2]; - variables[33] = variables[1] || variables[2] || variables[6]; - variables[34] = (variables[1] < variables[2]) || (variables[6] > variables[18]); - variables[35] = (variables[1]+variables[2]) || (variables[6] > variables[18]); - variables[36] = variables[1] || (variables[2] > variables[6]); - variables[37] = (variables[1]-variables[2]) || (variables[6] > variables[18]); - variables[38] = -variables[1] || (variables[2] > variables[6]); - variables[39] = pow(variables[1], variables[2]) || (variables[6] > variables[18]); - variables[40] = pow(variables[1], 1.0/variables[2]) || (variables[6] > variables[18]); - variables[41] = (variables[1] < variables[2]) || (variables[6]+variables[18]); - variables[42] = (variables[1] < variables[2]) || variables[6]; - variables[43] = (variables[1] < variables[2]) || (variables[6]-variables[18]); - variables[44] = (variables[1] < variables[2]) || -variables[6]; - variables[45] = (variables[1] < variables[2]) || pow(variables[6], variables[18]); - variables[46] = (variables[1] < variables[2]) || pow(variables[6], 1.0/variables[18]); - variables[47] = variables[1]/(variables[2] || variables[6]); - variables[48] = xor(variables[1], variables[2]); - variables[49] = xor(variables[1], xor(variables[2], variables[6])); - variables[50] = xor(variables[1] < variables[2], variables[6] > variables[18]); - variables[51] = xor(variables[1]+variables[2], variables[6] > variables[18]); - variables[52] = xor(variables[1], variables[2] > variables[6]); - variables[53] = xor(variables[1]-variables[2], variables[6] > variables[18]); - variables[54] = xor(-variables[1], variables[2] > variables[6]); - variables[55] = xor(pow(variables[1], variables[2]), variables[6] > variables[18]); - variables[56] = xor(pow(variables[1], 1.0/variables[2]), variables[6] > variables[18]); - variables[57] = xor(variables[1] < variables[2], variables[6]+variables[18]); - variables[58] = xor(variables[1] < variables[2], variables[6]); - variables[59] = xor(variables[1] < variables[2], variables[6]-variables[18]); - variables[60] = xor(variables[1] < variables[2], -variables[6]); - variables[61] = xor(variables[1] < variables[2], pow(variables[6], variables[18])); - variables[62] = xor(variables[1] < variables[2], pow(variables[6], 1.0/variables[18])); - variables[63] = variables[1]/xor(variables[2], variables[6]); - variables[64] = !variables[1]; - variables[65] = variables[1]+variables[2]; - variables[66] = variables[1]+variables[2]+variables[6]; - variables[67] = (variables[1] < variables[2])+(variables[6] > variables[18]); - variables[68] = variables[1]; - variables[69] = variables[1]-variables[2]; - variables[70] = (variables[1] < variables[2])-(variables[6] > variables[18]); - variables[71] = (variables[1] < variables[2])-(variables[6]+variables[18]); - variables[72] = (variables[1] < variables[2])-variables[6]; - variables[73] = variables[1]-(-variables[2]); - variables[74] = variables[1]-(-variables[2]*variables[6]); - variables[75] = -variables[1]; - variables[76] = -(variables[1] < variables[2]); - variables[77] = variables[1]*variables[2]; - variables[78] = variables[1]*variables[2]*variables[6]; - variables[79] = (variables[1] < variables[2])*(variables[6] > variables[18]); - variables[80] = (variables[1]+variables[2])*(variables[6] > variables[18]); - variables[81] = variables[1]*(variables[2] > variables[6]); - variables[82] = (variables[1]-variables[2])*(variables[6] > variables[18]); - variables[83] = -variables[1]*(variables[2] > variables[6]); - variables[84] = (variables[1] < variables[2])*(variables[6]+variables[18]); - variables[85] = (variables[1] < variables[2])*variables[6]; - variables[86] = (variables[1] < variables[2])*(variables[6]-variables[18]); - variables[87] = (variables[1] < variables[2])*-variables[6]; - variables[88] = variables[1]/variables[2]; - variables[89] = (variables[1] < variables[2])/(variables[18] > variables[6]); - variables[90] = (variables[1]+variables[2])/(variables[18] > variables[6]); - variables[91] = variables[1]/(variables[6] > variables[2]); - variables[92] = (variables[1]-variables[2])/(variables[18] > variables[6]); - variables[93] = -variables[1]/(variables[6] > variables[2]); - variables[94] = (variables[1] < variables[2])/(variables[6]+variables[18]); - variables[95] = (variables[1] < variables[2])/variables[6]; - variables[96] = (variables[1] < variables[2])/(variables[6]-variables[18]); - variables[97] = (variables[1] < variables[2])/-variables[6]; - variables[98] = (variables[1] < variables[2])/(variables[6]*variables[18]); - variables[99] = (variables[1] < variables[2])/(variables[6]/variables[18]); - variables[100] = sqrt(variables[1]); - variables[101] = pow(variables[1], 2.0); - variables[102] = pow(variables[1], 3.0); - variables[103] = pow(variables[1], variables[2]); - variables[104] = pow(variables[1] <= variables[2], variables[6] >= variables[18]); - variables[105] = pow(variables[1]+variables[2], variables[6] >= variables[18]); - variables[106] = pow(variables[1], variables[2] >= variables[6]); - variables[107] = pow(variables[1]-variables[2], variables[6] >= variables[18]); - variables[108] = pow(-variables[1], variables[2] >= variables[6]); - variables[109] = pow(variables[1]*variables[2], variables[6] >= variables[18]); - variables[110] = pow(variables[1]/variables[2], variables[6] >= variables[18]); - variables[111] = pow(variables[1] <= variables[2], variables[6]+variables[18]); - variables[112] = pow(variables[1] <= variables[2], variables[6]); - variables[113] = pow(variables[1] <= variables[2], variables[6]-variables[18]); - variables[114] = pow(variables[1] <= variables[2], -variables[6]); - variables[115] = pow(variables[1] <= variables[2], variables[6]*variables[18]); - variables[116] = pow(variables[1] <= variables[2], variables[6]/variables[18]); - variables[117] = pow(variables[1] <= variables[2], pow(variables[6], variables[18])); - variables[118] = pow(variables[1] <= variables[2], pow(variables[6], 1.0/variables[18])); - variables[119] = sqrt(variables[1]); - variables[120] = sqrt(variables[1]); - variables[121] = pow(variables[1], 1.0/3.0); - variables[122] = pow(variables[1], 1.0/variables[2]); - variables[123] = pow(variables[1] < variables[2], 1.0/(variables[18] > variables[6])); - variables[124] = pow(variables[1]+variables[2], 1.0/(variables[18] > variables[6])); - variables[125] = pow(variables[1], 1.0/(variables[6] > variables[2])); - variables[126] = pow(variables[1]-variables[2], 1.0/(variables[18] > variables[6])); - variables[127] = pow(-variables[1], 1.0/(variables[6] > variables[2])); - variables[128] = pow(variables[1]*variables[2], 1.0/(variables[18] > variables[6])); - variables[129] = pow(variables[1]/variables[2], 1.0/(variables[18] > variables[6])); - variables[130] = pow(variables[1] < variables[2], 1.0/(variables[6]+variables[18])); - variables[131] = pow(variables[1] < variables[2], 1.0/variables[6]); - variables[132] = pow(variables[1] < variables[2], 1.0/(variables[6]-variables[18])); - variables[133] = pow(variables[1] < variables[2], 1.0/-variables[6]); - variables[134] = pow(variables[1] < variables[2], 1.0/(variables[6]*variables[18])); - variables[135] = pow(variables[1] < variables[2], 1.0/(variables[6]/variables[18])); - variables[136] = pow(variables[1] < variables[2], 1.0/pow(variables[6], variables[18])); - variables[137] = pow(variables[1] < variables[2], 1.0/pow(variables[6], 1.0/variables[18])); - variables[138] = fabs(variables[1]); - variables[139] = exp(variables[1]); - variables[140] = log(variables[1]); - variables[141] = log10(variables[1]); - variables[142] = log(variables[1])/log(2.0); - variables[143] = log10(variables[1]); - variables[144] = log(variables[1])/log(variables[2]); - variables[145] = ceil(variables[1]); - variables[146] = floor(variables[1]); - variables[147] = min(variables[1], variables[2]); - variables[148] = min(variables[1], min(variables[2], variables[6])); - variables[149] = max(variables[1], variables[2]); - variables[150] = max(variables[1], max(variables[2], variables[6])); - variables[151] = fmod(variables[1], variables[2]); - variables[152] = sin(variables[1]); - variables[153] = cos(variables[1]); - variables[154] = tan(variables[1]); - variables[155] = sec(variables[1]); - variables[156] = csc(variables[1]); - variables[157] = cot(variables[1]); - variables[158] = sinh(variables[1]); - variables[159] = cosh(variables[1]); - variables[160] = tanh(variables[1]); - variables[161] = sech(variables[1]); - variables[162] = csch(variables[1]); - variables[163] = coth(variables[1]); - variables[164] = asin(variables[1]); - variables[165] = acos(variables[1]); - variables[166] = atan(variables[1]); - variables[167] = asec(variables[1]); - variables[168] = acsc(variables[1]); - variables[169] = acot(variables[1]); - variables[170] = asinh(variables[1]); - variables[171] = acosh(variables[1]); - variables[172] = atanh(variables[1]/2.0); - variables[173] = asech(variables[1]); - variables[174] = acsch(variables[1]); - variables[175] = acoth(2.0*variables[1]); - variables[176] = (variables[1] > variables[2])?variables[1]:NAN; - variables[177] = (variables[1] > variables[2])?variables[1]:variables[6]; - variables[178] = (variables[1] > variables[2])?variables[1]:(variables[6] > variables[18])?variables[6]:(variables[179] > variables[180])?variables[179]:NAN; - variables[181] = (variables[1] > variables[2])?variables[1]:(variables[6] > variables[18])?variables[6]:(variables[179] > variables[180])?variables[179]:variables[182]; - variables[183] = 123.0+((variables[1] > variables[2])?variables[1]:NAN); - variables[188] = variables[1]; - variables[195] = (variables[1] && variables[2])+((variables[6] > variables[18])?variables[2]:NAN)+variables[179]+(variables[180] && variables[182]); - variables[196] = (variables[1] && variables[2])-(((variables[6] > variables[18])?variables[2]:NAN)-(variables[179]-((variables[6] > variables[18])?variables[2]:NAN)))-(variables[180] && variables[182]); - variables[197] = (variables[1] && variables[2])*((variables[6] > variables[18])?variables[2]:NAN)*variables[179]*((variables[6] > variables[18])?variables[2]:NAN)*(variables[180] && variables[182]); - variables[198] = (variables[1] && variables[2])/(((variables[6] > variables[18])?variables[2]:NAN)/(variables[179]/((variables[6] > variables[18])?variables[2]:NAN))); - variables[199] = (variables[1] || variables[2]) && xor(variables[1], variables[2]) && ((variables[6] > variables[18])?variables[2]:NAN) && variables[179] && ((variables[6] > variables[18])?variables[2]:NAN) && xor(variables[1], variables[2]) && (variables[1] || variables[2]); - variables[200] = (variables[1] && variables[2]) || xor(variables[1], variables[2]) || ((variables[6] > variables[18])?variables[2]:NAN) || variables[179] || ((variables[6] > variables[18])?variables[2]:NAN) || xor(variables[1], variables[2]) || (variables[1] && variables[2]); - variables[201] = xor(variables[1] && variables[2], xor(variables[1] || variables[2], xor((variables[6] > variables[18])?variables[2]:NAN, xor(xor(xor(variables[179], (variables[6] > variables[18])?variables[2]:NAN), variables[1] || variables[2]), variables[1] && variables[2])))); - variables[202] = pow(variables[1] && variables[2], pow((variables[6] > variables[18])?variables[2]:NAN, pow(pow(variables[179], (variables[6] > variables[18])?variables[2]:NAN), variables[1] && variables[2]))); - variables[203] = pow(pow(pow(variables[1] && variables[2], 1.0/pow((variables[6] > variables[18])?variables[2]:NAN, 1.0/variables[179])), 1.0/((variables[6] > variables[18])?variables[2]:NAN)), 1.0/(variables[1] && variables[2])); - variables[204] = -(variables[1] && variables[2])+-((variables[6] > variables[18])?variables[2]:NAN); + computedConstants[0] = constants[1] == constants[2]; + computedConstants[3] = constants[1]/(constants[2] == constants[2]); + computedConstants[4] = constants[1] != constants[2]; + computedConstants[5] = constants[1]/(constants[2] != constants[6]); + computedConstants[7] = constants[1] < constants[2]; + computedConstants[8] = constants[1]/(constants[2] < constants[6]); + computedConstants[9] = constants[1] <= constants[2]; + computedConstants[10] = constants[1]/(constants[2] <= constants[6]); + computedConstants[11] = constants[1] > constants[2]; + computedConstants[12] = constants[1]/(constants[2] > constants[6]); + computedConstants[13] = constants[1] >= constants[2]; + computedConstants[14] = constants[1]/(constants[2] >= constants[6]); + computedConstants[15] = constants[1] && constants[2]; + computedConstants[16] = constants[1] && constants[2] && constants[6]; + computedConstants[17] = (constants[1] < constants[2]) && (constants[6] > constants[18]); + computedConstants[19] = (constants[1]+constants[2]) && (constants[6] > constants[18]); + computedConstants[20] = constants[1] && (constants[2] > constants[6]); + computedConstants[21] = (constants[1]-constants[2]) && (constants[6] > constants[18]); + computedConstants[22] = -constants[1] && (constants[2] > constants[6]); + computedConstants[23] = pow(constants[1], constants[2]) && (constants[6] > constants[18]); + computedConstants[24] = pow(constants[1], 1.0/constants[2]) && (constants[6] > constants[18]); + computedConstants[25] = (constants[1] < constants[2]) && (constants[6]+constants[18]); + computedConstants[26] = (constants[1] < constants[2]) && constants[6]; + computedConstants[27] = (constants[1] < constants[2]) && (constants[6]-constants[18]); + computedConstants[28] = (constants[1] < constants[2]) && -constants[6]; + computedConstants[29] = (constants[1] < constants[2]) && pow(constants[6], constants[18]); + computedConstants[30] = (constants[1] < constants[2]) && pow(constants[6], 1.0/constants[18]); + computedConstants[31] = constants[1]/(constants[2] && constants[6]); + computedConstants[32] = constants[1] || constants[2]; + computedConstants[33] = constants[1] || constants[2] || constants[6]; + computedConstants[34] = (constants[1] < constants[2]) || (constants[6] > constants[18]); + computedConstants[35] = (constants[1]+constants[2]) || (constants[6] > constants[18]); + computedConstants[36] = constants[1] || (constants[2] > constants[6]); + computedConstants[37] = (constants[1]-constants[2]) || (constants[6] > constants[18]); + computedConstants[38] = -constants[1] || (constants[2] > constants[6]); + computedConstants[39] = pow(constants[1], constants[2]) || (constants[6] > constants[18]); + computedConstants[40] = pow(constants[1], 1.0/constants[2]) || (constants[6] > constants[18]); + computedConstants[41] = (constants[1] < constants[2]) || (constants[6]+constants[18]); + computedConstants[42] = (constants[1] < constants[2]) || constants[6]; + computedConstants[43] = (constants[1] < constants[2]) || (constants[6]-constants[18]); + computedConstants[44] = (constants[1] < constants[2]) || -constants[6]; + computedConstants[45] = (constants[1] < constants[2]) || pow(constants[6], constants[18]); + computedConstants[46] = (constants[1] < constants[2]) || pow(constants[6], 1.0/constants[18]); + computedConstants[47] = constants[1]/(constants[2] || constants[6]); + computedConstants[48] = xor(constants[1], constants[2]); + computedConstants[49] = xor(constants[1], xor(constants[2], constants[6])); + computedConstants[50] = xor(constants[1] < constants[2], constants[6] > constants[18]); + computedConstants[51] = xor(constants[1]+constants[2], constants[6] > constants[18]); + computedConstants[52] = xor(constants[1], constants[2] > constants[6]); + computedConstants[53] = xor(constants[1]-constants[2], constants[6] > constants[18]); + computedConstants[54] = xor(-constants[1], constants[2] > constants[6]); + computedConstants[55] = xor(pow(constants[1], constants[2]), constants[6] > constants[18]); + computedConstants[56] = xor(pow(constants[1], 1.0/constants[2]), constants[6] > constants[18]); + computedConstants[57] = xor(constants[1] < constants[2], constants[6]+constants[18]); + computedConstants[58] = xor(constants[1] < constants[2], constants[6]); + computedConstants[59] = xor(constants[1] < constants[2], constants[6]-constants[18]); + computedConstants[60] = xor(constants[1] < constants[2], -constants[6]); + computedConstants[61] = xor(constants[1] < constants[2], pow(constants[6], constants[18])); + computedConstants[62] = xor(constants[1] < constants[2], pow(constants[6], 1.0/constants[18])); + computedConstants[63] = constants[1]/xor(constants[2], constants[6]); + computedConstants[64] = !constants[1]; + computedConstants[65] = constants[1]+constants[2]; + computedConstants[66] = constants[1]+constants[2]+constants[6]; + computedConstants[67] = (constants[1] < constants[2])+(constants[6] > constants[18]); + computedConstants[68] = constants[1]; + computedConstants[69] = constants[1]-constants[2]; + computedConstants[70] = (constants[1] < constants[2])-(constants[6] > constants[18]); + computedConstants[71] = (constants[1] < constants[2])-(constants[6]+constants[18]); + computedConstants[72] = (constants[1] < constants[2])-constants[6]; + computedConstants[73] = constants[1]-(-constants[2]); + computedConstants[74] = constants[1]-(-constants[2]*constants[6]); + computedConstants[75] = -constants[1]; + computedConstants[76] = -(constants[1] < constants[2]); + computedConstants[77] = constants[1]*constants[2]; + computedConstants[78] = constants[1]*constants[2]*constants[6]; + computedConstants[79] = (constants[1] < constants[2])*(constants[6] > constants[18]); + computedConstants[80] = (constants[1]+constants[2])*(constants[6] > constants[18]); + computedConstants[81] = constants[1]*(constants[2] > constants[6]); + computedConstants[82] = (constants[1]-constants[2])*(constants[6] > constants[18]); + computedConstants[83] = -constants[1]*(constants[2] > constants[6]); + computedConstants[84] = (constants[1] < constants[2])*(constants[6]+constants[18]); + computedConstants[85] = (constants[1] < constants[2])*constants[6]; + computedConstants[86] = (constants[1] < constants[2])*(constants[6]-constants[18]); + computedConstants[87] = (constants[1] < constants[2])*-constants[6]; + computedConstants[88] = constants[1]/constants[2]; + computedConstants[89] = (constants[1] < constants[2])/(constants[18] > constants[6]); + computedConstants[90] = (constants[1]+constants[2])/(constants[18] > constants[6]); + computedConstants[91] = constants[1]/(constants[6] > constants[2]); + computedConstants[92] = (constants[1]-constants[2])/(constants[18] > constants[6]); + computedConstants[93] = -constants[1]/(constants[6] > constants[2]); + computedConstants[94] = (constants[1] < constants[2])/(constants[6]+constants[18]); + computedConstants[95] = (constants[1] < constants[2])/constants[6]; + computedConstants[96] = (constants[1] < constants[2])/(constants[6]-constants[18]); + computedConstants[97] = (constants[1] < constants[2])/-constants[6]; + computedConstants[98] = (constants[1] < constants[2])/(constants[6]*constants[18]); + computedConstants[99] = (constants[1] < constants[2])/(constants[6]/constants[18]); + computedConstants[100] = sqrt(constants[1]); + computedConstants[101] = pow(constants[1], 2.0); + computedConstants[102] = pow(constants[1], 3.0); + computedConstants[103] = pow(constants[1], constants[2]); + computedConstants[104] = pow(constants[1] <= constants[2], constants[6] >= constants[18]); + computedConstants[105] = pow(constants[1]+constants[2], constants[6] >= constants[18]); + computedConstants[106] = pow(constants[1], constants[2] >= constants[6]); + computedConstants[107] = pow(constants[1]-constants[2], constants[6] >= constants[18]); + computedConstants[108] = pow(-constants[1], constants[2] >= constants[6]); + computedConstants[109] = pow(constants[1]*constants[2], constants[6] >= constants[18]); + computedConstants[110] = pow(constants[1]/constants[2], constants[6] >= constants[18]); + computedConstants[111] = pow(constants[1] <= constants[2], constants[6]+constants[18]); + computedConstants[112] = pow(constants[1] <= constants[2], constants[6]); + computedConstants[113] = pow(constants[1] <= constants[2], constants[6]-constants[18]); + computedConstants[114] = pow(constants[1] <= constants[2], -constants[6]); + computedConstants[115] = pow(constants[1] <= constants[2], constants[6]*constants[18]); + computedConstants[116] = pow(constants[1] <= constants[2], constants[6]/constants[18]); + computedConstants[117] = pow(constants[1] <= constants[2], pow(constants[6], constants[18])); + computedConstants[118] = pow(constants[1] <= constants[2], pow(constants[6], 1.0/constants[18])); + computedConstants[119] = sqrt(constants[1]); + computedConstants[120] = sqrt(constants[1]); + computedConstants[121] = pow(constants[1], 1.0/3.0); + computedConstants[122] = pow(constants[1], 1.0/constants[2]); + computedConstants[123] = pow(constants[1] < constants[2], 1.0/(constants[18] > constants[6])); + computedConstants[124] = pow(constants[1]+constants[2], 1.0/(constants[18] > constants[6])); + computedConstants[125] = pow(constants[1], 1.0/(constants[6] > constants[2])); + computedConstants[126] = pow(constants[1]-constants[2], 1.0/(constants[18] > constants[6])); + computedConstants[127] = pow(-constants[1], 1.0/(constants[6] > constants[2])); + computedConstants[128] = pow(constants[1]*constants[2], 1.0/(constants[18] > constants[6])); + computedConstants[129] = pow(constants[1]/constants[2], 1.0/(constants[18] > constants[6])); + computedConstants[130] = pow(constants[1] < constants[2], 1.0/(constants[6]+constants[18])); + computedConstants[131] = pow(constants[1] < constants[2], 1.0/constants[6]); + computedConstants[132] = pow(constants[1] < constants[2], 1.0/(constants[6]-constants[18])); + computedConstants[133] = pow(constants[1] < constants[2], 1.0/-constants[6]); + computedConstants[134] = pow(constants[1] < constants[2], 1.0/(constants[6]*constants[18])); + computedConstants[135] = pow(constants[1] < constants[2], 1.0/(constants[6]/constants[18])); + computedConstants[136] = pow(constants[1] < constants[2], 1.0/pow(constants[6], constants[18])); + computedConstants[137] = pow(constants[1] < constants[2], 1.0/pow(constants[6], 1.0/constants[18])); + computedConstants[138] = fabs(constants[1]); + computedConstants[139] = exp(constants[1]); + computedConstants[140] = log(constants[1]); + computedConstants[141] = log10(constants[1]); + computedConstants[142] = log(constants[1])/log(2.0); + computedConstants[143] = log10(constants[1]); + computedConstants[144] = log(constants[1])/log(constants[2]); + computedConstants[145] = ceil(constants[1]); + computedConstants[146] = floor(constants[1]); + computedConstants[147] = min(constants[1], constants[2]); + computedConstants[148] = min(constants[1], min(constants[2], constants[6])); + computedConstants[149] = max(constants[1], constants[2]); + computedConstants[150] = max(constants[1], max(constants[2], constants[6])); + computedConstants[151] = fmod(constants[1], constants[2]); + computedConstants[152] = sin(constants[1]); + computedConstants[153] = cos(constants[1]); + computedConstants[154] = tan(constants[1]); + computedConstants[155] = sec(constants[1]); + computedConstants[156] = csc(constants[1]); + computedConstants[157] = cot(constants[1]); + computedConstants[158] = sinh(constants[1]); + computedConstants[159] = cosh(constants[1]); + computedConstants[160] = tanh(constants[1]); + computedConstants[161] = sech(constants[1]); + computedConstants[162] = csch(constants[1]); + computedConstants[163] = coth(constants[1]); + computedConstants[164] = asin(constants[1]); + computedConstants[165] = acos(constants[1]); + computedConstants[166] = atan(constants[1]); + computedConstants[167] = asec(constants[1]); + computedConstants[168] = acsc(constants[1]); + computedConstants[169] = acot(constants[1]); + computedConstants[170] = asinh(constants[1]); + computedConstants[171] = acosh(constants[1]); + computedConstants[172] = atanh(constants[1]/2.0); + computedConstants[173] = asech(constants[1]); + computedConstants[174] = acsch(constants[1]); + computedConstants[175] = acoth(2.0*constants[1]); + computedConstants[176] = (constants[1] > constants[2])?constants[1]:NAN; + computedConstants[177] = (constants[1] > constants[2])?constants[1]:constants[6]; + computedConstants[178] = (constants[1] > constants[2])?constants[1]:(constants[6] > constants[18])?constants[6]:(constants[179] > constants[180])?constants[179]:NAN; + computedConstants[181] = (constants[1] > constants[2])?constants[1]:(constants[6] > constants[18])?constants[6]:(constants[179] > constants[180])?constants[179]:constants[182]; + computedConstants[183] = 123.0+((constants[1] > constants[2])?constants[1]:NAN); + computedConstants[188] = constants[1]; + computedConstants[195] = (constants[1] && constants[2])+((constants[6] > constants[18])?constants[2]:NAN)+constants[179]+(constants[180] && constants[182]); + computedConstants[196] = (constants[1] && constants[2])-(((constants[6] > constants[18])?constants[2]:NAN)-(constants[179]-((constants[6] > constants[18])?constants[2]:NAN)))-(constants[180] && constants[182]); + computedConstants[197] = (constants[1] && constants[2])*((constants[6] > constants[18])?constants[2]:NAN)*constants[179]*((constants[6] > constants[18])?constants[2]:NAN)*(constants[180] && constants[182]); + computedConstants[198] = (constants[1] && constants[2])/(((constants[6] > constants[18])?constants[2]:NAN)/(constants[179]/((constants[6] > constants[18])?constants[2]:NAN))); + computedConstants[199] = (constants[1] || constants[2]) && xor(constants[1], constants[2]) && ((constants[6] > constants[18])?constants[2]:NAN) && constants[179] && ((constants[6] > constants[18])?constants[2]:NAN) && xor(constants[1], constants[2]) && (constants[1] || constants[2]); + computedConstants[200] = (constants[1] && constants[2]) || xor(constants[1], constants[2]) || ((constants[6] > constants[18])?constants[2]:NAN) || constants[179] || ((constants[6] > constants[18])?constants[2]:NAN) || xor(constants[1], constants[2]) || (constants[1] && constants[2]); + computedConstants[201] = xor(constants[1] && constants[2], xor(constants[1] || constants[2], xor((constants[6] > constants[18])?constants[2]:NAN, xor(xor(xor(constants[179], (constants[6] > constants[18])?constants[2]:NAN), constants[1] || constants[2]), constants[1] && constants[2])))); + computedConstants[202] = pow(constants[1] && constants[2], pow((constants[6] > constants[18])?constants[2]:NAN, pow(pow(constants[179], (constants[6] > constants[18])?constants[2]:NAN), constants[1] && constants[2]))); + computedConstants[203] = pow(pow(pow(constants[1] && constants[2], 1.0/pow((constants[6] > constants[18])?constants[2]:NAN, 1.0/constants[179])), 1.0/((constants[6] > constants[18])?constants[2]:NAN)), 1.0/(constants[1] && constants[2])); + computedConstants[204] = -(constants[1] && constants[2])+-((constants[6] > constants[18])?constants[2]:NAN); } void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) diff --git a/tests/resources/coverage/generator/model.implementation.out b/tests/resources/coverage/generator/model.implementation.out index 35809a2b2e..9656a17964 100644 --- a/tests/resources/coverage/generator/model.implementation.out +++ b/tests/resources/coverage/generator/model.implementation.out @@ -125,11 +125,11 @@ void objectiveFunction0(double *u, double *f, void *data) double *rates = ((RootFindingInfo *) data)->rates; double *variables = ((RootFindingInfo *) data)->variables; - variables[205] = u[0]; - variables[206] = u[1]; + algebraic[205] = u[0]; + algebraic[206] = u[1]; - f[0] = variables[205]+variables[206]+states[0]-0.0; - f[1] = variables[205]-variables[206]-(variables[207]+variables[208]); + f[0] = algebraic[205]+algebraic[206]+states[0]-0.0; + f[1] = algebraic[205]-algebraic[206]-(computedConstants[207]+computedConstants[208]); } void findRoot0(double voi, double *states, double *rates, double *variables) @@ -137,231 +137,231 @@ void findRoot0(double voi, double *states, double *rates, double *variables) RootFindingInfo rfi = { voi, states, rates, variables }; double u[2]; - u[0] = variables[205]; - u[1] = variables[206]; + u[0] = algebraic[205]; + u[1] = algebraic[206]; nlaSolve(objectiveFunction0, u, 2, &rfi); - variables[205] = u[0]; - variables[206] = u[1]; + algebraic[205] = u[0]; + algebraic[206] = u[1]; } void initialiseVariables(double *states, double *rates, double *constants) { - variables[1] = 1.0; - variables[2] = 2.0; - variables[6] = 3.0; - variables[18] = 4.0; - variables[179] = 5.0; - variables[180] = 6.0; - variables[182] = 7.0; - variables[205] = 1.0; - variables[206] = 2.0; - variables[184] = 123.0; - variables[185] = 123.456789; - variables[186] = 123.0e99; - variables[187] = 123.456789e99; - variables[189] = 1.0; - variables[190] = 0.0; - variables[191] = 2.71828182845905; - variables[192] = 3.14159265358979; - variables[193] = INFINITY; - variables[194] = NAN; - variables[207] = 1.0; - variables[208] = 3.0; + constants[1] = 1.0; + constants[2] = 2.0; + constants[6] = 3.0; + constants[18] = 4.0; + constants[179] = 5.0; + constants[180] = 6.0; + constants[182] = 7.0; + algebraic[205] = 1.0; + algebraic[206] = 2.0; + computedConstants[184] = 123.0; + computedConstants[185] = 123.456789; + computedConstants[186] = 123.0e99; + computedConstants[187] = 123.456789e99; + computedConstants[189] = 1.0; + computedConstants[190] = 0.0; + computedConstants[191] = 2.71828182845905; + computedConstants[192] = 3.14159265358979; + computedConstants[193] = INFINITY; + computedConstants[194] = NAN; + computedConstants[207] = 1.0; + computedConstants[208] = 3.0; states[0] = 0.0; } void computeComputedConstants(double *constants, double *computedConstants) { - variables[0] = eq(variables[1], variables[2]); - variables[3] = variables[1]/eq(variables[2], variables[2]); - variables[4] = neq(variables[1], variables[2]); - variables[5] = variables[1]/neq(variables[2], variables[6]); - variables[7] = lt(variables[1], variables[2]); - variables[8] = variables[1]/lt(variables[2], variables[6]); - variables[9] = leq(variables[1], variables[2]); - variables[10] = variables[1]/leq(variables[2], variables[6]); - variables[11] = gt(variables[1], variables[2]); - variables[12] = variables[1]/gt(variables[2], variables[6]); - variables[13] = geq(variables[1], variables[2]); - variables[14] = variables[1]/geq(variables[2], variables[6]); - variables[15] = and(variables[1], variables[2]); - variables[16] = and(variables[1], and(variables[2], variables[6])); - variables[17] = and(lt(variables[1], variables[2]), gt(variables[6], variables[18])); - variables[19] = and(variables[1]+variables[2], gt(variables[6], variables[18])); - variables[20] = and(variables[1], gt(variables[2], variables[6])); - variables[21] = and(variables[1]-variables[2], gt(variables[6], variables[18])); - variables[22] = and(-variables[1], gt(variables[2], variables[6])); - variables[23] = and(pow(variables[1], variables[2]), gt(variables[6], variables[18])); - variables[24] = and(pow(variables[1], 1.0/variables[2]), gt(variables[6], variables[18])); - variables[25] = and(lt(variables[1], variables[2]), variables[6]+variables[18]); - variables[26] = and(lt(variables[1], variables[2]), variables[6]); - variables[27] = and(lt(variables[1], variables[2]), variables[6]-variables[18]); - variables[28] = and(lt(variables[1], variables[2]), -variables[6]); - variables[29] = and(lt(variables[1], variables[2]), pow(variables[6], variables[18])); - variables[30] = and(lt(variables[1], variables[2]), pow(variables[6], 1.0/variables[18])); - variables[31] = variables[1]/and(variables[2], variables[6]); - variables[32] = or(variables[1], variables[2]); - variables[33] = or(variables[1], or(variables[2], variables[6])); - variables[34] = or(lt(variables[1], variables[2]), gt(variables[6], variables[18])); - variables[35] = or(variables[1]+variables[2], gt(variables[6], variables[18])); - variables[36] = or(variables[1], gt(variables[2], variables[6])); - variables[37] = or(variables[1]-variables[2], gt(variables[6], variables[18])); - variables[38] = or(-variables[1], gt(variables[2], variables[6])); - variables[39] = or(pow(variables[1], variables[2]), gt(variables[6], variables[18])); - variables[40] = or(pow(variables[1], 1.0/variables[2]), gt(variables[6], variables[18])); - variables[41] = or(lt(variables[1], variables[2]), variables[6]+variables[18]); - variables[42] = or(lt(variables[1], variables[2]), variables[6]); - variables[43] = or(lt(variables[1], variables[2]), variables[6]-variables[18]); - variables[44] = or(lt(variables[1], variables[2]), -variables[6]); - variables[45] = or(lt(variables[1], variables[2]), pow(variables[6], variables[18])); - variables[46] = or(lt(variables[1], variables[2]), pow(variables[6], 1.0/variables[18])); - variables[47] = variables[1]/or(variables[2], variables[6]); - variables[48] = xor(variables[1], variables[2]); - variables[49] = xor(variables[1], xor(variables[2], variables[6])); - variables[50] = xor(lt(variables[1], variables[2]), gt(variables[6], variables[18])); - variables[51] = xor(variables[1]+variables[2], gt(variables[6], variables[18])); - variables[52] = xor(variables[1], gt(variables[2], variables[6])); - variables[53] = xor(variables[1]-variables[2], gt(variables[6], variables[18])); - variables[54] = xor(-variables[1], gt(variables[2], variables[6])); - variables[55] = xor(pow(variables[1], variables[2]), gt(variables[6], variables[18])); - variables[56] = xor(pow(variables[1], 1.0/variables[2]), gt(variables[6], variables[18])); - variables[57] = xor(lt(variables[1], variables[2]), variables[6]+variables[18]); - variables[58] = xor(lt(variables[1], variables[2]), variables[6]); - variables[59] = xor(lt(variables[1], variables[2]), variables[6]-variables[18]); - variables[60] = xor(lt(variables[1], variables[2]), -variables[6]); - variables[61] = xor(lt(variables[1], variables[2]), pow(variables[6], variables[18])); - variables[62] = xor(lt(variables[1], variables[2]), pow(variables[6], 1.0/variables[18])); - variables[63] = variables[1]/xor(variables[2], variables[6]); - variables[64] = not(variables[1]); - variables[65] = variables[1]+variables[2]; - variables[66] = variables[1]+variables[2]+variables[6]; - variables[67] = lt(variables[1], variables[2])+gt(variables[6], variables[18]); - variables[68] = variables[1]; - variables[69] = variables[1]-variables[2]; - variables[70] = lt(variables[1], variables[2])-gt(variables[6], variables[18]); - variables[71] = lt(variables[1], variables[2])-(variables[6]+variables[18]); - variables[72] = lt(variables[1], variables[2])-variables[6]; - variables[73] = variables[1]-(-variables[2]); - variables[74] = variables[1]-(-variables[2]*variables[6]); - variables[75] = -variables[1]; - variables[76] = -lt(variables[1], variables[2]); - variables[77] = variables[1]*variables[2]; - variables[78] = variables[1]*variables[2]*variables[6]; - variables[79] = lt(variables[1], variables[2])*gt(variables[6], variables[18]); - variables[80] = (variables[1]+variables[2])*gt(variables[6], variables[18]); - variables[81] = variables[1]*gt(variables[2], variables[6]); - variables[82] = (variables[1]-variables[2])*gt(variables[6], variables[18]); - variables[83] = -variables[1]*gt(variables[2], variables[6]); - variables[84] = lt(variables[1], variables[2])*(variables[6]+variables[18]); - variables[85] = lt(variables[1], variables[2])*variables[6]; - variables[86] = lt(variables[1], variables[2])*(variables[6]-variables[18]); - variables[87] = lt(variables[1], variables[2])*-variables[6]; - variables[88] = variables[1]/variables[2]; - variables[89] = lt(variables[1], variables[2])/gt(variables[18], variables[6]); - variables[90] = (variables[1]+variables[2])/gt(variables[18], variables[6]); - variables[91] = variables[1]/gt(variables[6], variables[2]); - variables[92] = (variables[1]-variables[2])/gt(variables[18], variables[6]); - variables[93] = -variables[1]/gt(variables[6], variables[2]); - variables[94] = lt(variables[1], variables[2])/(variables[6]+variables[18]); - variables[95] = lt(variables[1], variables[2])/variables[6]; - variables[96] = lt(variables[1], variables[2])/(variables[6]-variables[18]); - variables[97] = lt(variables[1], variables[2])/-variables[6]; - variables[98] = lt(variables[1], variables[2])/(variables[6]*variables[18]); - variables[99] = lt(variables[1], variables[2])/(variables[6]/variables[18]); - variables[100] = sqrt(variables[1]); - variables[101] = pow(variables[1], 2.0); - variables[102] = pow(variables[1], 3.0); - variables[103] = pow(variables[1], variables[2]); - variables[104] = pow(leq(variables[1], variables[2]), geq(variables[6], variables[18])); - variables[105] = pow(variables[1]+variables[2], geq(variables[6], variables[18])); - variables[106] = pow(variables[1], geq(variables[2], variables[6])); - variables[107] = pow(variables[1]-variables[2], geq(variables[6], variables[18])); - variables[108] = pow(-variables[1], geq(variables[2], variables[6])); - variables[109] = pow(variables[1]*variables[2], geq(variables[6], variables[18])); - variables[110] = pow(variables[1]/variables[2], geq(variables[6], variables[18])); - variables[111] = pow(leq(variables[1], variables[2]), variables[6]+variables[18]); - variables[112] = pow(leq(variables[1], variables[2]), variables[6]); - variables[113] = pow(leq(variables[1], variables[2]), variables[6]-variables[18]); - variables[114] = pow(leq(variables[1], variables[2]), -variables[6]); - variables[115] = pow(leq(variables[1], variables[2]), variables[6]*variables[18]); - variables[116] = pow(leq(variables[1], variables[2]), variables[6]/variables[18]); - variables[117] = pow(leq(variables[1], variables[2]), pow(variables[6], variables[18])); - variables[118] = pow(leq(variables[1], variables[2]), pow(variables[6], 1.0/variables[18])); - variables[119] = sqrt(variables[1]); - variables[120] = sqrt(variables[1]); - variables[121] = pow(variables[1], 1.0/3.0); - variables[122] = pow(variables[1], 1.0/variables[2]); - variables[123] = pow(lt(variables[1], variables[2]), 1.0/gt(variables[18], variables[6])); - variables[124] = pow(variables[1]+variables[2], 1.0/gt(variables[18], variables[6])); - variables[125] = pow(variables[1], 1.0/gt(variables[6], variables[2])); - variables[126] = pow(variables[1]-variables[2], 1.0/gt(variables[18], variables[6])); - variables[127] = pow(-variables[1], 1.0/gt(variables[6], variables[2])); - variables[128] = pow(variables[1]*variables[2], 1.0/gt(variables[18], variables[6])); - variables[129] = pow(variables[1]/variables[2], 1.0/gt(variables[18], variables[6])); - variables[130] = pow(lt(variables[1], variables[2]), 1.0/(variables[6]+variables[18])); - variables[131] = pow(lt(variables[1], variables[2]), 1.0/variables[6]); - variables[132] = pow(lt(variables[1], variables[2]), 1.0/(variables[6]-variables[18])); - variables[133] = pow(lt(variables[1], variables[2]), 1.0/-variables[6]); - variables[134] = pow(lt(variables[1], variables[2]), 1.0/(variables[6]*variables[18])); - variables[135] = pow(lt(variables[1], variables[2]), 1.0/(variables[6]/variables[18])); - variables[136] = pow(lt(variables[1], variables[2]), 1.0/pow(variables[6], variables[18])); - variables[137] = pow(lt(variables[1], variables[2]), 1.0/pow(variables[6], 1.0/variables[18])); - variables[138] = fabs(variables[1]); - variables[139] = exp(variables[1]); - variables[140] = log(variables[1]); - variables[141] = log10(variables[1]); - variables[142] = log(variables[1])/log(2.0); - variables[143] = log10(variables[1]); - variables[144] = log(variables[1])/log(variables[2]); - variables[145] = ceil(variables[1]); - variables[146] = floor(variables[1]); - variables[147] = min(variables[1], variables[2]); - variables[148] = min(variables[1], min(variables[2], variables[6])); - variables[149] = max(variables[1], variables[2]); - variables[150] = max(variables[1], max(variables[2], variables[6])); - variables[151] = fmod(variables[1], variables[2]); - variables[152] = sin(variables[1]); - variables[153] = cos(variables[1]); - variables[154] = tan(variables[1]); - variables[155] = sec(variables[1]); - variables[156] = csc(variables[1]); - variables[157] = cot(variables[1]); - variables[158] = sinh(variables[1]); - variables[159] = cosh(variables[1]); - variables[160] = tanh(variables[1]); - variables[161] = sech(variables[1]); - variables[162] = csch(variables[1]); - variables[163] = coth(variables[1]); - variables[164] = asin(variables[1]); - variables[165] = acos(variables[1]); - variables[166] = atan(variables[1]); - variables[167] = asec(variables[1]); - variables[168] = acsc(variables[1]); - variables[169] = acot(variables[1]); - variables[170] = asinh(variables[1]); - variables[171] = acosh(variables[1]); - variables[172] = atanh(variables[1]/2.0); - variables[173] = asech(variables[1]); - variables[174] = acsch(variables[1]); - variables[175] = acoth(2.0*variables[1]); - variables[176] = (gt(variables[1], variables[2]))?variables[1]:NAN; - variables[177] = (gt(variables[1], variables[2]))?variables[1]:variables[6]; - variables[178] = (gt(variables[1], variables[2]))?variables[1]:(gt(variables[6], variables[18]))?variables[6]:(gt(variables[179], variables[180]))?variables[179]:NAN; - variables[181] = (gt(variables[1], variables[2]))?variables[1]:(gt(variables[6], variables[18]))?variables[6]:(gt(variables[179], variables[180]))?variables[179]:variables[182]; - variables[183] = 123.0+((gt(variables[1], variables[2]))?variables[1]:NAN); - variables[188] = variables[1]; - variables[195] = and(variables[1], variables[2])+((gt(variables[6], variables[18]))?variables[2]:NAN)+variables[179]+and(variables[180], variables[182]); - variables[196] = and(variables[1], variables[2])-(((gt(variables[6], variables[18]))?variables[2]:NAN)-(variables[179]-((gt(variables[6], variables[18]))?variables[2]:NAN)))-and(variables[180], variables[182]); - variables[197] = and(variables[1], variables[2])*((gt(variables[6], variables[18]))?variables[2]:NAN)*variables[179]*((gt(variables[6], variables[18]))?variables[2]:NAN)*and(variables[180], variables[182]); - variables[198] = and(variables[1], variables[2])/(((gt(variables[6], variables[18]))?variables[2]:NAN)/(variables[179]/((gt(variables[6], variables[18]))?variables[2]:NAN))); - variables[199] = and(or(variables[1], variables[2]), and(xor(variables[1], variables[2]), and((gt(variables[6], variables[18]))?variables[2]:NAN, and(and(and(variables[179], (gt(variables[6], variables[18]))?variables[2]:NAN), xor(variables[1], variables[2])), or(variables[1], variables[2]))))); - variables[200] = or(and(variables[1], variables[2]), or(xor(variables[1], variables[2]), or((gt(variables[6], variables[18]))?variables[2]:NAN, or(or(or(variables[179], (gt(variables[6], variables[18]))?variables[2]:NAN), xor(variables[1], variables[2])), and(variables[1], variables[2]))))); - variables[201] = xor(and(variables[1], variables[2]), xor(or(variables[1], variables[2]), xor((gt(variables[6], variables[18]))?variables[2]:NAN, xor(xor(xor(variables[179], (gt(variables[6], variables[18]))?variables[2]:NAN), or(variables[1], variables[2])), and(variables[1], variables[2]))))); - variables[202] = pow(and(variables[1], variables[2]), pow((gt(variables[6], variables[18]))?variables[2]:NAN, pow(pow(variables[179], (gt(variables[6], variables[18]))?variables[2]:NAN), and(variables[1], variables[2])))); - variables[203] = pow(pow(pow(and(variables[1], variables[2]), 1.0/pow((gt(variables[6], variables[18]))?variables[2]:NAN, 1.0/variables[179])), 1.0/((gt(variables[6], variables[18]))?variables[2]:NAN)), 1.0/and(variables[1], variables[2])); - variables[204] = -and(variables[1], variables[2])+-((gt(variables[6], variables[18]))?variables[2]:NAN); + computedConstants[0] = eq(constants[1], constants[2]); + computedConstants[3] = constants[1]/eq(constants[2], constants[2]); + computedConstants[4] = neq(constants[1], constants[2]); + computedConstants[5] = constants[1]/neq(constants[2], constants[6]); + computedConstants[7] = lt(constants[1], constants[2]); + computedConstants[8] = constants[1]/lt(constants[2], constants[6]); + computedConstants[9] = leq(constants[1], constants[2]); + computedConstants[10] = constants[1]/leq(constants[2], constants[6]); + computedConstants[11] = gt(constants[1], constants[2]); + computedConstants[12] = constants[1]/gt(constants[2], constants[6]); + computedConstants[13] = geq(constants[1], constants[2]); + computedConstants[14] = constants[1]/geq(constants[2], constants[6]); + computedConstants[15] = and(constants[1], constants[2]); + computedConstants[16] = and(constants[1], and(constants[2], constants[6])); + computedConstants[17] = and(lt(constants[1], constants[2]), gt(constants[6], constants[18])); + computedConstants[19] = and(constants[1]+constants[2], gt(constants[6], constants[18])); + computedConstants[20] = and(constants[1], gt(constants[2], constants[6])); + computedConstants[21] = and(constants[1]-constants[2], gt(constants[6], constants[18])); + computedConstants[22] = and(-constants[1], gt(constants[2], constants[6])); + computedConstants[23] = and(pow(constants[1], constants[2]), gt(constants[6], constants[18])); + computedConstants[24] = and(pow(constants[1], 1.0/constants[2]), gt(constants[6], constants[18])); + computedConstants[25] = and(lt(constants[1], constants[2]), constants[6]+constants[18]); + computedConstants[26] = and(lt(constants[1], constants[2]), constants[6]); + computedConstants[27] = and(lt(constants[1], constants[2]), constants[6]-constants[18]); + computedConstants[28] = and(lt(constants[1], constants[2]), -constants[6]); + computedConstants[29] = and(lt(constants[1], constants[2]), pow(constants[6], constants[18])); + computedConstants[30] = and(lt(constants[1], constants[2]), pow(constants[6], 1.0/constants[18])); + computedConstants[31] = constants[1]/and(constants[2], constants[6]); + computedConstants[32] = or(constants[1], constants[2]); + computedConstants[33] = or(constants[1], or(constants[2], constants[6])); + computedConstants[34] = or(lt(constants[1], constants[2]), gt(constants[6], constants[18])); + computedConstants[35] = or(constants[1]+constants[2], gt(constants[6], constants[18])); + computedConstants[36] = or(constants[1], gt(constants[2], constants[6])); + computedConstants[37] = or(constants[1]-constants[2], gt(constants[6], constants[18])); + computedConstants[38] = or(-constants[1], gt(constants[2], constants[6])); + computedConstants[39] = or(pow(constants[1], constants[2]), gt(constants[6], constants[18])); + computedConstants[40] = or(pow(constants[1], 1.0/constants[2]), gt(constants[6], constants[18])); + computedConstants[41] = or(lt(constants[1], constants[2]), constants[6]+constants[18]); + computedConstants[42] = or(lt(constants[1], constants[2]), constants[6]); + computedConstants[43] = or(lt(constants[1], constants[2]), constants[6]-constants[18]); + computedConstants[44] = or(lt(constants[1], constants[2]), -constants[6]); + computedConstants[45] = or(lt(constants[1], constants[2]), pow(constants[6], constants[18])); + computedConstants[46] = or(lt(constants[1], constants[2]), pow(constants[6], 1.0/constants[18])); + computedConstants[47] = constants[1]/or(constants[2], constants[6]); + computedConstants[48] = xor(constants[1], constants[2]); + computedConstants[49] = xor(constants[1], xor(constants[2], constants[6])); + computedConstants[50] = xor(lt(constants[1], constants[2]), gt(constants[6], constants[18])); + computedConstants[51] = xor(constants[1]+constants[2], gt(constants[6], constants[18])); + computedConstants[52] = xor(constants[1], gt(constants[2], constants[6])); + computedConstants[53] = xor(constants[1]-constants[2], gt(constants[6], constants[18])); + computedConstants[54] = xor(-constants[1], gt(constants[2], constants[6])); + computedConstants[55] = xor(pow(constants[1], constants[2]), gt(constants[6], constants[18])); + computedConstants[56] = xor(pow(constants[1], 1.0/constants[2]), gt(constants[6], constants[18])); + computedConstants[57] = xor(lt(constants[1], constants[2]), constants[6]+constants[18]); + computedConstants[58] = xor(lt(constants[1], constants[2]), constants[6]); + computedConstants[59] = xor(lt(constants[1], constants[2]), constants[6]-constants[18]); + computedConstants[60] = xor(lt(constants[1], constants[2]), -constants[6]); + computedConstants[61] = xor(lt(constants[1], constants[2]), pow(constants[6], constants[18])); + computedConstants[62] = xor(lt(constants[1], constants[2]), pow(constants[6], 1.0/constants[18])); + computedConstants[63] = constants[1]/xor(constants[2], constants[6]); + computedConstants[64] = not(constants[1]); + computedConstants[65] = constants[1]+constants[2]; + computedConstants[66] = constants[1]+constants[2]+constants[6]; + computedConstants[67] = lt(constants[1], constants[2])+gt(constants[6], constants[18]); + computedConstants[68] = constants[1]; + computedConstants[69] = constants[1]-constants[2]; + computedConstants[70] = lt(constants[1], constants[2])-gt(constants[6], constants[18]); + computedConstants[71] = lt(constants[1], constants[2])-(constants[6]+constants[18]); + computedConstants[72] = lt(constants[1], constants[2])-constants[6]; + computedConstants[73] = constants[1]-(-constants[2]); + computedConstants[74] = constants[1]-(-constants[2]*constants[6]); + computedConstants[75] = -constants[1]; + computedConstants[76] = -lt(constants[1], constants[2]); + computedConstants[77] = constants[1]*constants[2]; + computedConstants[78] = constants[1]*constants[2]*constants[6]; + computedConstants[79] = lt(constants[1], constants[2])*gt(constants[6], constants[18]); + computedConstants[80] = (constants[1]+constants[2])*gt(constants[6], constants[18]); + computedConstants[81] = constants[1]*gt(constants[2], constants[6]); + computedConstants[82] = (constants[1]-constants[2])*gt(constants[6], constants[18]); + computedConstants[83] = -constants[1]*gt(constants[2], constants[6]); + computedConstants[84] = lt(constants[1], constants[2])*(constants[6]+constants[18]); + computedConstants[85] = lt(constants[1], constants[2])*constants[6]; + computedConstants[86] = lt(constants[1], constants[2])*(constants[6]-constants[18]); + computedConstants[87] = lt(constants[1], constants[2])*-constants[6]; + computedConstants[88] = constants[1]/constants[2]; + computedConstants[89] = lt(constants[1], constants[2])/gt(constants[18], constants[6]); + computedConstants[90] = (constants[1]+constants[2])/gt(constants[18], constants[6]); + computedConstants[91] = constants[1]/gt(constants[6], constants[2]); + computedConstants[92] = (constants[1]-constants[2])/gt(constants[18], constants[6]); + computedConstants[93] = -constants[1]/gt(constants[6], constants[2]); + computedConstants[94] = lt(constants[1], constants[2])/(constants[6]+constants[18]); + computedConstants[95] = lt(constants[1], constants[2])/constants[6]; + computedConstants[96] = lt(constants[1], constants[2])/(constants[6]-constants[18]); + computedConstants[97] = lt(constants[1], constants[2])/-constants[6]; + computedConstants[98] = lt(constants[1], constants[2])/(constants[6]*constants[18]); + computedConstants[99] = lt(constants[1], constants[2])/(constants[6]/constants[18]); + computedConstants[100] = sqrt(constants[1]); + computedConstants[101] = pow(constants[1], 2.0); + computedConstants[102] = pow(constants[1], 3.0); + computedConstants[103] = pow(constants[1], constants[2]); + computedConstants[104] = pow(leq(constants[1], constants[2]), geq(constants[6], constants[18])); + computedConstants[105] = pow(constants[1]+constants[2], geq(constants[6], constants[18])); + computedConstants[106] = pow(constants[1], geq(constants[2], constants[6])); + computedConstants[107] = pow(constants[1]-constants[2], geq(constants[6], constants[18])); + computedConstants[108] = pow(-constants[1], geq(constants[2], constants[6])); + computedConstants[109] = pow(constants[1]*constants[2], geq(constants[6], constants[18])); + computedConstants[110] = pow(constants[1]/constants[2], geq(constants[6], constants[18])); + computedConstants[111] = pow(leq(constants[1], constants[2]), constants[6]+constants[18]); + computedConstants[112] = pow(leq(constants[1], constants[2]), constants[6]); + computedConstants[113] = pow(leq(constants[1], constants[2]), constants[6]-constants[18]); + computedConstants[114] = pow(leq(constants[1], constants[2]), -constants[6]); + computedConstants[115] = pow(leq(constants[1], constants[2]), constants[6]*constants[18]); + computedConstants[116] = pow(leq(constants[1], constants[2]), constants[6]/constants[18]); + computedConstants[117] = pow(leq(constants[1], constants[2]), pow(constants[6], constants[18])); + computedConstants[118] = pow(leq(constants[1], constants[2]), pow(constants[6], 1.0/constants[18])); + computedConstants[119] = sqrt(constants[1]); + computedConstants[120] = sqrt(constants[1]); + computedConstants[121] = pow(constants[1], 1.0/3.0); + computedConstants[122] = pow(constants[1], 1.0/constants[2]); + computedConstants[123] = pow(lt(constants[1], constants[2]), 1.0/gt(constants[18], constants[6])); + computedConstants[124] = pow(constants[1]+constants[2], 1.0/gt(constants[18], constants[6])); + computedConstants[125] = pow(constants[1], 1.0/gt(constants[6], constants[2])); + computedConstants[126] = pow(constants[1]-constants[2], 1.0/gt(constants[18], constants[6])); + computedConstants[127] = pow(-constants[1], 1.0/gt(constants[6], constants[2])); + computedConstants[128] = pow(constants[1]*constants[2], 1.0/gt(constants[18], constants[6])); + computedConstants[129] = pow(constants[1]/constants[2], 1.0/gt(constants[18], constants[6])); + computedConstants[130] = pow(lt(constants[1], constants[2]), 1.0/(constants[6]+constants[18])); + computedConstants[131] = pow(lt(constants[1], constants[2]), 1.0/constants[6]); + computedConstants[132] = pow(lt(constants[1], constants[2]), 1.0/(constants[6]-constants[18])); + computedConstants[133] = pow(lt(constants[1], constants[2]), 1.0/-constants[6]); + computedConstants[134] = pow(lt(constants[1], constants[2]), 1.0/(constants[6]*constants[18])); + computedConstants[135] = pow(lt(constants[1], constants[2]), 1.0/(constants[6]/constants[18])); + computedConstants[136] = pow(lt(constants[1], constants[2]), 1.0/pow(constants[6], constants[18])); + computedConstants[137] = pow(lt(constants[1], constants[2]), 1.0/pow(constants[6], 1.0/constants[18])); + computedConstants[138] = fabs(constants[1]); + computedConstants[139] = exp(constants[1]); + computedConstants[140] = log(constants[1]); + computedConstants[141] = log10(constants[1]); + computedConstants[142] = log(constants[1])/log(2.0); + computedConstants[143] = log10(constants[1]); + computedConstants[144] = log(constants[1])/log(constants[2]); + computedConstants[145] = ceil(constants[1]); + computedConstants[146] = floor(constants[1]); + computedConstants[147] = min(constants[1], constants[2]); + computedConstants[148] = min(constants[1], min(constants[2], constants[6])); + computedConstants[149] = max(constants[1], constants[2]); + computedConstants[150] = max(constants[1], max(constants[2], constants[6])); + computedConstants[151] = fmod(constants[1], constants[2]); + computedConstants[152] = sin(constants[1]); + computedConstants[153] = cos(constants[1]); + computedConstants[154] = tan(constants[1]); + computedConstants[155] = sec(constants[1]); + computedConstants[156] = csc(constants[1]); + computedConstants[157] = cot(constants[1]); + computedConstants[158] = sinh(constants[1]); + computedConstants[159] = cosh(constants[1]); + computedConstants[160] = tanh(constants[1]); + computedConstants[161] = sech(constants[1]); + computedConstants[162] = csch(constants[1]); + computedConstants[163] = coth(constants[1]); + computedConstants[164] = asin(constants[1]); + computedConstants[165] = acos(constants[1]); + computedConstants[166] = atan(constants[1]); + computedConstants[167] = asec(constants[1]); + computedConstants[168] = acsc(constants[1]); + computedConstants[169] = acot(constants[1]); + computedConstants[170] = asinh(constants[1]); + computedConstants[171] = acosh(constants[1]); + computedConstants[172] = atanh(constants[1]/2.0); + computedConstants[173] = asech(constants[1]); + computedConstants[174] = acsch(constants[1]); + computedConstants[175] = acoth(2.0*constants[1]); + computedConstants[176] = (gt(constants[1], constants[2]))?constants[1]:NAN; + computedConstants[177] = (gt(constants[1], constants[2]))?constants[1]:constants[6]; + computedConstants[178] = (gt(constants[1], constants[2]))?constants[1]:(gt(constants[6], constants[18]))?constants[6]:(gt(constants[179], constants[180]))?constants[179]:NAN; + computedConstants[181] = (gt(constants[1], constants[2]))?constants[1]:(gt(constants[6], constants[18]))?constants[6]:(gt(constants[179], constants[180]))?constants[179]:constants[182]; + computedConstants[183] = 123.0+((gt(constants[1], constants[2]))?constants[1]:NAN); + computedConstants[188] = constants[1]; + computedConstants[195] = and(constants[1], constants[2])+((gt(constants[6], constants[18]))?constants[2]:NAN)+constants[179]+and(constants[180], constants[182]); + computedConstants[196] = and(constants[1], constants[2])-(((gt(constants[6], constants[18]))?constants[2]:NAN)-(constants[179]-((gt(constants[6], constants[18]))?constants[2]:NAN)))-and(constants[180], constants[182]); + computedConstants[197] = and(constants[1], constants[2])*((gt(constants[6], constants[18]))?constants[2]:NAN)*constants[179]*((gt(constants[6], constants[18]))?constants[2]:NAN)*and(constants[180], constants[182]); + computedConstants[198] = and(constants[1], constants[2])/(((gt(constants[6], constants[18]))?constants[2]:NAN)/(constants[179]/((gt(constants[6], constants[18]))?constants[2]:NAN))); + computedConstants[199] = and(or(constants[1], constants[2]), and(xor(constants[1], constants[2]), and((gt(constants[6], constants[18]))?constants[2]:NAN, and(and(and(constants[179], (gt(constants[6], constants[18]))?constants[2]:NAN), xor(constants[1], constants[2])), or(constants[1], constants[2]))))); + computedConstants[200] = or(and(constants[1], constants[2]), or(xor(constants[1], constants[2]), or((gt(constants[6], constants[18]))?constants[2]:NAN, or(or(or(constants[179], (gt(constants[6], constants[18]))?constants[2]:NAN), xor(constants[1], constants[2])), and(constants[1], constants[2]))))); + computedConstants[201] = xor(and(constants[1], constants[2]), xor(or(constants[1], constants[2]), xor((gt(constants[6], constants[18]))?constants[2]:NAN, xor(xor(xor(constants[179], (gt(constants[6], constants[18]))?constants[2]:NAN), or(constants[1], constants[2])), and(constants[1], constants[2]))))); + computedConstants[202] = pow(and(constants[1], constants[2]), pow((gt(constants[6], constants[18]))?constants[2]:NAN, pow(pow(constants[179], (gt(constants[6], constants[18]))?constants[2]:NAN), and(constants[1], constants[2])))); + computedConstants[203] = pow(pow(pow(and(constants[1], constants[2]), 1.0/pow((gt(constants[6], constants[18]))?constants[2]:NAN, 1.0/constants[179])), 1.0/((gt(constants[6], constants[18]))?constants[2]:NAN)), 1.0/and(constants[1], constants[2])); + computedConstants[204] = -and(constants[1], constants[2])+-((gt(constants[6], constants[18]))?constants[2]:NAN); } void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) diff --git a/tests/resources/coverage/generator/model.modified.profile.c b/tests/resources/coverage/generator/model.modified.profile.c index b86a172b9b..b5bd907469 100644 --- a/tests/resources/coverage/generator/model.modified.profile.c +++ b/tests/resources/coverage/generator/model.modified.profile.c @@ -356,11 +356,11 @@ void objectiveFunction0(double *u, double *f, void *data) double *rates = ((RootFindingInfo *) data)->rates; double *variables = ((RootFindingInfo *) data)->variables; - variables[205] = u[0]; - variables[206] = u[1]; + algebraic[205] = u[0]; + algebraic[206] = u[1]; - f[0] = variables[205]+variables[206]+states[0]-0.0; - f[1] = variables[205]-variables[206]-(variables[207]+variables[208]); + f[0] = algebraic[205]+algebraic[206]+states[0]-0.0; + f[1] = algebraic[205]-algebraic[206]-(computedConstants[207]+computedConstants[208]); } void findRoot0(double voi, double *states, double *rates, double *variables) @@ -368,231 +368,231 @@ void findRoot0(double voi, double *states, double *rates, double *variables) RootFindingInfo rfi = { voi, states, rates, variables }; double u[2]; - u[0] = variables[205]; - u[1] = variables[206]; + u[0] = algebraic[205]; + u[1] = algebraic[206]; nlaSolve(objectiveFunction0, u, 2, &rfi); - variables[205] = u[0]; - variables[206] = u[1]; + algebraic[205] = u[0]; + algebraic[206] = u[1]; } void initialiseVariables(double *states, double *rates, double *constants) { - variables[1] = 1.0; - variables[2] = 2.0; - variables[6] = 3.0; - variables[18] = 4.0; - variables[179] = 5.0; - variables[180] = 6.0; - variables[182] = 7.0; - variables[205] = 1.0; - variables[206] = 2.0; - variables[184] = 123.0; - variables[185] = 123.456789; - variables[186] = 123.0e99; - variables[187] = 123.456789e99; - variables[189] = 1.0; - variables[190] = 0.0; - variables[191] = 2.71828182845905; - variables[192] = 3.14159265358979; - variables[193] = INFINITY; - variables[194] = NAN; - variables[207] = 1.0; - variables[208] = 3.0; + constants[1] = 1.0; + constants[2] = 2.0; + constants[6] = 3.0; + constants[18] = 4.0; + constants[179] = 5.0; + constants[180] = 6.0; + constants[182] = 7.0; + algebraic[205] = 1.0; + algebraic[206] = 2.0; + computedConstants[184] = 123.0; + computedConstants[185] = 123.456789; + computedConstants[186] = 123.0e99; + computedConstants[187] = 123.456789e99; + computedConstants[189] = 1.0; + computedConstants[190] = 0.0; + computedConstants[191] = 2.71828182845905; + computedConstants[192] = 3.14159265358979; + computedConstants[193] = INFINITY; + computedConstants[194] = NAN; + computedConstants[207] = 1.0; + computedConstants[208] = 3.0; states[0] = 0.0; } void computeComputedConstants(double *constants, double *computedConstants) { - variables[0] = variables[1] == variables[2]; - variables[3] = variables[1]/(variables[2] == variables[2]); - variables[4] = variables[1] != variables[2]; - variables[5] = variables[1]/(variables[2] != variables[6]); - variables[7] = variables[1] < variables[2]; - variables[8] = variables[1]/(variables[2] < variables[6]); - variables[9] = variables[1] <= variables[2]; - variables[10] = variables[1]/(variables[2] <= variables[6]); - variables[11] = variables[1] > variables[2]; - variables[12] = variables[1]/(variables[2] > variables[6]); - variables[13] = variables[1] >= variables[2]; - variables[14] = variables[1]/(variables[2] >= variables[6]); - variables[15] = variables[1] && variables[2]; - variables[16] = variables[1] && variables[2] && variables[6]; - variables[17] = (variables[1] < variables[2]) && (variables[6] > variables[18]); - variables[19] = (variables[1]+variables[2]) && (variables[6] > variables[18]); - variables[20] = variables[1] && (variables[2] > variables[6]); - variables[21] = (variables[1]-variables[2]) && (variables[6] > variables[18]); - variables[22] = -variables[1] && (variables[2] > variables[6]); - variables[23] = pow(variables[1], variables[2]) && (variables[6] > variables[18]); - variables[24] = pow(variables[1], 1.0/variables[2]) && (variables[6] > variables[18]); - variables[25] = (variables[1] < variables[2]) && (variables[6]+variables[18]); - variables[26] = (variables[1] < variables[2]) && variables[6]; - variables[27] = (variables[1] < variables[2]) && (variables[6]-variables[18]); - variables[28] = (variables[1] < variables[2]) && -variables[6]; - variables[29] = (variables[1] < variables[2]) && pow(variables[6], variables[18]); - variables[30] = (variables[1] < variables[2]) && pow(variables[6], 1.0/variables[18]); - variables[31] = variables[1]/(variables[2] && variables[6]); - variables[32] = variables[1] || variables[2]; - variables[33] = variables[1] || variables[2] || variables[6]; - variables[34] = (variables[1] < variables[2]) || (variables[6] > variables[18]); - variables[35] = (variables[1]+variables[2]) || (variables[6] > variables[18]); - variables[36] = variables[1] || (variables[2] > variables[6]); - variables[37] = (variables[1]-variables[2]) || (variables[6] > variables[18]); - variables[38] = -variables[1] || (variables[2] > variables[6]); - variables[39] = pow(variables[1], variables[2]) || (variables[6] > variables[18]); - variables[40] = pow(variables[1], 1.0/variables[2]) || (variables[6] > variables[18]); - variables[41] = (variables[1] < variables[2]) || (variables[6]+variables[18]); - variables[42] = (variables[1] < variables[2]) || variables[6]; - variables[43] = (variables[1] < variables[2]) || (variables[6]-variables[18]); - variables[44] = (variables[1] < variables[2]) || -variables[6]; - variables[45] = (variables[1] < variables[2]) || pow(variables[6], variables[18]); - variables[46] = (variables[1] < variables[2]) || pow(variables[6], 1.0/variables[18]); - variables[47] = variables[1]/(variables[2] || variables[6]); - variables[48] = xor(variables[1], variables[2]); - variables[49] = xor(variables[1], xor(variables[2], variables[6])); - variables[50] = xor(variables[1] < variables[2], variables[6] > variables[18]); - variables[51] = xor(variables[1]+variables[2], variables[6] > variables[18]); - variables[52] = xor(variables[1], variables[2] > variables[6]); - variables[53] = xor(variables[1]-variables[2], variables[6] > variables[18]); - variables[54] = xor(-variables[1], variables[2] > variables[6]); - variables[55] = xor(pow(variables[1], variables[2]), variables[6] > variables[18]); - variables[56] = xor(pow(variables[1], 1.0/variables[2]), variables[6] > variables[18]); - variables[57] = xor(variables[1] < variables[2], variables[6]+variables[18]); - variables[58] = xor(variables[1] < variables[2], variables[6]); - variables[59] = xor(variables[1] < variables[2], variables[6]-variables[18]); - variables[60] = xor(variables[1] < variables[2], -variables[6]); - variables[61] = xor(variables[1] < variables[2], pow(variables[6], variables[18])); - variables[62] = xor(variables[1] < variables[2], pow(variables[6], 1.0/variables[18])); - variables[63] = variables[1]/xor(variables[2], variables[6]); - variables[64] = !variables[1]; - variables[65] = variables[1]+variables[2]; - variables[66] = variables[1]+variables[2]+variables[6]; - variables[67] = (variables[1] < variables[2])+(variables[6] > variables[18]); - variables[68] = variables[1]; - variables[69] = variables[1]-variables[2]; - variables[70] = (variables[1] < variables[2])-(variables[6] > variables[18]); - variables[71] = (variables[1] < variables[2])-(variables[6]+variables[18]); - variables[72] = (variables[1] < variables[2])-variables[6]; - variables[73] = variables[1]-(-variables[2]); - variables[74] = variables[1]-(-variables[2]*variables[6]); - variables[75] = -variables[1]; - variables[76] = -(variables[1] < variables[2]); - variables[77] = variables[1]*variables[2]; - variables[78] = variables[1]*variables[2]*variables[6]; - variables[79] = (variables[1] < variables[2])*(variables[6] > variables[18]); - variables[80] = (variables[1]+variables[2])*(variables[6] > variables[18]); - variables[81] = variables[1]*(variables[2] > variables[6]); - variables[82] = (variables[1]-variables[2])*(variables[6] > variables[18]); - variables[83] = -variables[1]*(variables[2] > variables[6]); - variables[84] = (variables[1] < variables[2])*(variables[6]+variables[18]); - variables[85] = (variables[1] < variables[2])*variables[6]; - variables[86] = (variables[1] < variables[2])*(variables[6]-variables[18]); - variables[87] = (variables[1] < variables[2])*-variables[6]; - variables[88] = variables[1]/variables[2]; - variables[89] = (variables[1] < variables[2])/(variables[18] > variables[6]); - variables[90] = (variables[1]+variables[2])/(variables[18] > variables[6]); - variables[91] = variables[1]/(variables[6] > variables[2]); - variables[92] = (variables[1]-variables[2])/(variables[18] > variables[6]); - variables[93] = -variables[1]/(variables[6] > variables[2]); - variables[94] = (variables[1] < variables[2])/(variables[6]+variables[18]); - variables[95] = (variables[1] < variables[2])/variables[6]; - variables[96] = (variables[1] < variables[2])/(variables[6]-variables[18]); - variables[97] = (variables[1] < variables[2])/-variables[6]; - variables[98] = (variables[1] < variables[2])/(variables[6]*variables[18]); - variables[99] = (variables[1] < variables[2])/(variables[6]/variables[18]); - variables[100] = sqrt(variables[1]); - variables[101] = pow(variables[1], 2.0); - variables[102] = pow(variables[1], 3.0); - variables[103] = pow(variables[1], variables[2]); - variables[104] = pow(variables[1] <= variables[2], variables[6] >= variables[18]); - variables[105] = pow(variables[1]+variables[2], variables[6] >= variables[18]); - variables[106] = pow(variables[1], variables[2] >= variables[6]); - variables[107] = pow(variables[1]-variables[2], variables[6] >= variables[18]); - variables[108] = pow(-variables[1], variables[2] >= variables[6]); - variables[109] = pow(variables[1]*variables[2], variables[6] >= variables[18]); - variables[110] = pow(variables[1]/variables[2], variables[6] >= variables[18]); - variables[111] = pow(variables[1] <= variables[2], variables[6]+variables[18]); - variables[112] = pow(variables[1] <= variables[2], variables[6]); - variables[113] = pow(variables[1] <= variables[2], variables[6]-variables[18]); - variables[114] = pow(variables[1] <= variables[2], -variables[6]); - variables[115] = pow(variables[1] <= variables[2], variables[6]*variables[18]); - variables[116] = pow(variables[1] <= variables[2], variables[6]/variables[18]); - variables[117] = pow(variables[1] <= variables[2], pow(variables[6], variables[18])); - variables[118] = pow(variables[1] <= variables[2], pow(variables[6], 1.0/variables[18])); - variables[119] = sqrt(variables[1]); - variables[120] = sqrt(variables[1]); - variables[121] = pow(variables[1], 1.0/3.0); - variables[122] = pow(variables[1], 1.0/variables[2]); - variables[123] = pow(variables[1] < variables[2], 1.0/(variables[18] > variables[6])); - variables[124] = pow(variables[1]+variables[2], 1.0/(variables[18] > variables[6])); - variables[125] = pow(variables[1], 1.0/(variables[6] > variables[2])); - variables[126] = pow(variables[1]-variables[2], 1.0/(variables[18] > variables[6])); - variables[127] = pow(-variables[1], 1.0/(variables[6] > variables[2])); - variables[128] = pow(variables[1]*variables[2], 1.0/(variables[18] > variables[6])); - variables[129] = pow(variables[1]/variables[2], 1.0/(variables[18] > variables[6])); - variables[130] = pow(variables[1] < variables[2], 1.0/(variables[6]+variables[18])); - variables[131] = pow(variables[1] < variables[2], 1.0/variables[6]); - variables[132] = pow(variables[1] < variables[2], 1.0/(variables[6]-variables[18])); - variables[133] = pow(variables[1] < variables[2], 1.0/-variables[6]); - variables[134] = pow(variables[1] < variables[2], 1.0/(variables[6]*variables[18])); - variables[135] = pow(variables[1] < variables[2], 1.0/(variables[6]/variables[18])); - variables[136] = pow(variables[1] < variables[2], 1.0/pow(variables[6], variables[18])); - variables[137] = pow(variables[1] < variables[2], 1.0/pow(variables[6], 1.0/variables[18])); - variables[138] = fabs(variables[1]); - variables[139] = exp(variables[1]); - variables[140] = log(variables[1]); - variables[141] = log10(variables[1]); - variables[142] = log(variables[1])/log(2.0); - variables[143] = log10(variables[1]); - variables[144] = log(variables[1])/log(variables[2]); - variables[145] = ceil(variables[1]); - variables[146] = floor(variables[1]); - variables[147] = min(variables[1], variables[2]); - variables[148] = min(variables[1], min(variables[2], variables[6])); - variables[149] = max(variables[1], variables[2]); - variables[150] = max(variables[1], max(variables[2], variables[6])); - variables[151] = fmod(variables[1], variables[2]); - variables[152] = sin(variables[1]); - variables[153] = cos(variables[1]); - variables[154] = tan(variables[1]); - variables[155] = sec(variables[1]); - variables[156] = csc(variables[1]); - variables[157] = cot(variables[1]); - variables[158] = sinh(variables[1]); - variables[159] = cosh(variables[1]); - variables[160] = tanh(variables[1]); - variables[161] = sech(variables[1]); - variables[162] = csch(variables[1]); - variables[163] = coth(variables[1]); - variables[164] = asin(variables[1]); - variables[165] = acos(variables[1]); - variables[166] = atan(variables[1]); - variables[167] = asec(variables[1]); - variables[168] = acsc(variables[1]); - variables[169] = acot(variables[1]); - variables[170] = asinh(variables[1]); - variables[171] = acosh(variables[1]); - variables[172] = atanh(variables[1]/2.0); - variables[173] = asech(variables[1]); - variables[174] = acsch(variables[1]); - variables[175] = acoth(2.0*variables[1]); - variables[176] = (variables[1] > variables[2])?variables[1]:NAN; - variables[177] = (variables[1] > variables[2])?variables[1]:variables[6]; - variables[178] = (variables[1] > variables[2])?variables[1]:(variables[6] > variables[18])?variables[6]:(variables[179] > variables[180])?variables[179]:NAN; - variables[181] = (variables[1] > variables[2])?variables[1]:(variables[6] > variables[18])?variables[6]:(variables[179] > variables[180])?variables[179]:variables[182]; - variables[183] = 123.0+((variables[1] > variables[2])?variables[1]:NAN); - variables[188] = variables[1]; - variables[195] = (variables[1] && variables[2])+((variables[6] > variables[18])?variables[2]:NAN)+variables[179]+(variables[180] && variables[182]); - variables[196] = (variables[1] && variables[2])-(((variables[6] > variables[18])?variables[2]:NAN)-(variables[179]-((variables[6] > variables[18])?variables[2]:NAN)))-(variables[180] && variables[182]); - variables[197] = (variables[1] && variables[2])*((variables[6] > variables[18])?variables[2]:NAN)*variables[179]*((variables[6] > variables[18])?variables[2]:NAN)*(variables[180] && variables[182]); - variables[198] = (variables[1] && variables[2])/(((variables[6] > variables[18])?variables[2]:NAN)/(variables[179]/((variables[6] > variables[18])?variables[2]:NAN))); - variables[199] = (variables[1] || variables[2]) && xor(variables[1], variables[2]) && ((variables[6] > variables[18])?variables[2]:NAN) && variables[179] && ((variables[6] > variables[18])?variables[2]:NAN) && xor(variables[1], variables[2]) && (variables[1] || variables[2]); - variables[200] = (variables[1] && variables[2]) || xor(variables[1], variables[2]) || ((variables[6] > variables[18])?variables[2]:NAN) || variables[179] || ((variables[6] > variables[18])?variables[2]:NAN) || xor(variables[1], variables[2]) || (variables[1] && variables[2]); - variables[201] = xor(variables[1] && variables[2], xor(variables[1] || variables[2], xor((variables[6] > variables[18])?variables[2]:NAN, xor(xor(xor(variables[179], (variables[6] > variables[18])?variables[2]:NAN), variables[1] || variables[2]), variables[1] && variables[2])))); - variables[202] = pow(variables[1] && variables[2], pow((variables[6] > variables[18])?variables[2]:NAN, pow(pow(variables[179], (variables[6] > variables[18])?variables[2]:NAN), variables[1] && variables[2]))); - variables[203] = pow(pow(pow(variables[1] && variables[2], 1.0/pow((variables[6] > variables[18])?variables[2]:NAN, 1.0/variables[179])), 1.0/((variables[6] > variables[18])?variables[2]:NAN)), 1.0/(variables[1] && variables[2])); - variables[204] = -(variables[1] && variables[2])+-((variables[6] > variables[18])?variables[2]:NAN); + computedConstants[0] = constants[1] == constants[2]; + computedConstants[3] = constants[1]/(constants[2] == constants[2]); + computedConstants[4] = constants[1] != constants[2]; + computedConstants[5] = constants[1]/(constants[2] != constants[6]); + computedConstants[7] = constants[1] < constants[2]; + computedConstants[8] = constants[1]/(constants[2] < constants[6]); + computedConstants[9] = constants[1] <= constants[2]; + computedConstants[10] = constants[1]/(constants[2] <= constants[6]); + computedConstants[11] = constants[1] > constants[2]; + computedConstants[12] = constants[1]/(constants[2] > constants[6]); + computedConstants[13] = constants[1] >= constants[2]; + computedConstants[14] = constants[1]/(constants[2] >= constants[6]); + computedConstants[15] = constants[1] && constants[2]; + computedConstants[16] = constants[1] && constants[2] && constants[6]; + computedConstants[17] = (constants[1] < constants[2]) && (constants[6] > constants[18]); + computedConstants[19] = (constants[1]+constants[2]) && (constants[6] > constants[18]); + computedConstants[20] = constants[1] && (constants[2] > constants[6]); + computedConstants[21] = (constants[1]-constants[2]) && (constants[6] > constants[18]); + computedConstants[22] = -constants[1] && (constants[2] > constants[6]); + computedConstants[23] = pow(constants[1], constants[2]) && (constants[6] > constants[18]); + computedConstants[24] = pow(constants[1], 1.0/constants[2]) && (constants[6] > constants[18]); + computedConstants[25] = (constants[1] < constants[2]) && (constants[6]+constants[18]); + computedConstants[26] = (constants[1] < constants[2]) && constants[6]; + computedConstants[27] = (constants[1] < constants[2]) && (constants[6]-constants[18]); + computedConstants[28] = (constants[1] < constants[2]) && -constants[6]; + computedConstants[29] = (constants[1] < constants[2]) && pow(constants[6], constants[18]); + computedConstants[30] = (constants[1] < constants[2]) && pow(constants[6], 1.0/constants[18]); + computedConstants[31] = constants[1]/(constants[2] && constants[6]); + computedConstants[32] = constants[1] || constants[2]; + computedConstants[33] = constants[1] || constants[2] || constants[6]; + computedConstants[34] = (constants[1] < constants[2]) || (constants[6] > constants[18]); + computedConstants[35] = (constants[1]+constants[2]) || (constants[6] > constants[18]); + computedConstants[36] = constants[1] || (constants[2] > constants[6]); + computedConstants[37] = (constants[1]-constants[2]) || (constants[6] > constants[18]); + computedConstants[38] = -constants[1] || (constants[2] > constants[6]); + computedConstants[39] = pow(constants[1], constants[2]) || (constants[6] > constants[18]); + computedConstants[40] = pow(constants[1], 1.0/constants[2]) || (constants[6] > constants[18]); + computedConstants[41] = (constants[1] < constants[2]) || (constants[6]+constants[18]); + computedConstants[42] = (constants[1] < constants[2]) || constants[6]; + computedConstants[43] = (constants[1] < constants[2]) || (constants[6]-constants[18]); + computedConstants[44] = (constants[1] < constants[2]) || -constants[6]; + computedConstants[45] = (constants[1] < constants[2]) || pow(constants[6], constants[18]); + computedConstants[46] = (constants[1] < constants[2]) || pow(constants[6], 1.0/constants[18]); + computedConstants[47] = constants[1]/(constants[2] || constants[6]); + computedConstants[48] = xor(constants[1], constants[2]); + computedConstants[49] = xor(constants[1], xor(constants[2], constants[6])); + computedConstants[50] = xor(constants[1] < constants[2], constants[6] > constants[18]); + computedConstants[51] = xor(constants[1]+constants[2], constants[6] > constants[18]); + computedConstants[52] = xor(constants[1], constants[2] > constants[6]); + computedConstants[53] = xor(constants[1]-constants[2], constants[6] > constants[18]); + computedConstants[54] = xor(-constants[1], constants[2] > constants[6]); + computedConstants[55] = xor(pow(constants[1], constants[2]), constants[6] > constants[18]); + computedConstants[56] = xor(pow(constants[1], 1.0/constants[2]), constants[6] > constants[18]); + computedConstants[57] = xor(constants[1] < constants[2], constants[6]+constants[18]); + computedConstants[58] = xor(constants[1] < constants[2], constants[6]); + computedConstants[59] = xor(constants[1] < constants[2], constants[6]-constants[18]); + computedConstants[60] = xor(constants[1] < constants[2], -constants[6]); + computedConstants[61] = xor(constants[1] < constants[2], pow(constants[6], constants[18])); + computedConstants[62] = xor(constants[1] < constants[2], pow(constants[6], 1.0/constants[18])); + computedConstants[63] = constants[1]/xor(constants[2], constants[6]); + computedConstants[64] = !constants[1]; + computedConstants[65] = constants[1]+constants[2]; + computedConstants[66] = constants[1]+constants[2]+constants[6]; + computedConstants[67] = (constants[1] < constants[2])+(constants[6] > constants[18]); + computedConstants[68] = constants[1]; + computedConstants[69] = constants[1]-constants[2]; + computedConstants[70] = (constants[1] < constants[2])-(constants[6] > constants[18]); + computedConstants[71] = (constants[1] < constants[2])-(constants[6]+constants[18]); + computedConstants[72] = (constants[1] < constants[2])-constants[6]; + computedConstants[73] = constants[1]-(-constants[2]); + computedConstants[74] = constants[1]-(-constants[2]*constants[6]); + computedConstants[75] = -constants[1]; + computedConstants[76] = -(constants[1] < constants[2]); + computedConstants[77] = constants[1]*constants[2]; + computedConstants[78] = constants[1]*constants[2]*constants[6]; + computedConstants[79] = (constants[1] < constants[2])*(constants[6] > constants[18]); + computedConstants[80] = (constants[1]+constants[2])*(constants[6] > constants[18]); + computedConstants[81] = constants[1]*(constants[2] > constants[6]); + computedConstants[82] = (constants[1]-constants[2])*(constants[6] > constants[18]); + computedConstants[83] = -constants[1]*(constants[2] > constants[6]); + computedConstants[84] = (constants[1] < constants[2])*(constants[6]+constants[18]); + computedConstants[85] = (constants[1] < constants[2])*constants[6]; + computedConstants[86] = (constants[1] < constants[2])*(constants[6]-constants[18]); + computedConstants[87] = (constants[1] < constants[2])*-constants[6]; + computedConstants[88] = constants[1]/constants[2]; + computedConstants[89] = (constants[1] < constants[2])/(constants[18] > constants[6]); + computedConstants[90] = (constants[1]+constants[2])/(constants[18] > constants[6]); + computedConstants[91] = constants[1]/(constants[6] > constants[2]); + computedConstants[92] = (constants[1]-constants[2])/(constants[18] > constants[6]); + computedConstants[93] = -constants[1]/(constants[6] > constants[2]); + computedConstants[94] = (constants[1] < constants[2])/(constants[6]+constants[18]); + computedConstants[95] = (constants[1] < constants[2])/constants[6]; + computedConstants[96] = (constants[1] < constants[2])/(constants[6]-constants[18]); + computedConstants[97] = (constants[1] < constants[2])/-constants[6]; + computedConstants[98] = (constants[1] < constants[2])/(constants[6]*constants[18]); + computedConstants[99] = (constants[1] < constants[2])/(constants[6]/constants[18]); + computedConstants[100] = sqrt(constants[1]); + computedConstants[101] = pow(constants[1], 2.0); + computedConstants[102] = pow(constants[1], 3.0); + computedConstants[103] = pow(constants[1], constants[2]); + computedConstants[104] = pow(constants[1] <= constants[2], constants[6] >= constants[18]); + computedConstants[105] = pow(constants[1]+constants[2], constants[6] >= constants[18]); + computedConstants[106] = pow(constants[1], constants[2] >= constants[6]); + computedConstants[107] = pow(constants[1]-constants[2], constants[6] >= constants[18]); + computedConstants[108] = pow(-constants[1], constants[2] >= constants[6]); + computedConstants[109] = pow(constants[1]*constants[2], constants[6] >= constants[18]); + computedConstants[110] = pow(constants[1]/constants[2], constants[6] >= constants[18]); + computedConstants[111] = pow(constants[1] <= constants[2], constants[6]+constants[18]); + computedConstants[112] = pow(constants[1] <= constants[2], constants[6]); + computedConstants[113] = pow(constants[1] <= constants[2], constants[6]-constants[18]); + computedConstants[114] = pow(constants[1] <= constants[2], -constants[6]); + computedConstants[115] = pow(constants[1] <= constants[2], constants[6]*constants[18]); + computedConstants[116] = pow(constants[1] <= constants[2], constants[6]/constants[18]); + computedConstants[117] = pow(constants[1] <= constants[2], pow(constants[6], constants[18])); + computedConstants[118] = pow(constants[1] <= constants[2], pow(constants[6], 1.0/constants[18])); + computedConstants[119] = sqrt(constants[1]); + computedConstants[120] = sqrt(constants[1]); + computedConstants[121] = pow(constants[1], 1.0/3.0); + computedConstants[122] = pow(constants[1], 1.0/constants[2]); + computedConstants[123] = pow(constants[1] < constants[2], 1.0/(constants[18] > constants[6])); + computedConstants[124] = pow(constants[1]+constants[2], 1.0/(constants[18] > constants[6])); + computedConstants[125] = pow(constants[1], 1.0/(constants[6] > constants[2])); + computedConstants[126] = pow(constants[1]-constants[2], 1.0/(constants[18] > constants[6])); + computedConstants[127] = pow(-constants[1], 1.0/(constants[6] > constants[2])); + computedConstants[128] = pow(constants[1]*constants[2], 1.0/(constants[18] > constants[6])); + computedConstants[129] = pow(constants[1]/constants[2], 1.0/(constants[18] > constants[6])); + computedConstants[130] = pow(constants[1] < constants[2], 1.0/(constants[6]+constants[18])); + computedConstants[131] = pow(constants[1] < constants[2], 1.0/constants[6]); + computedConstants[132] = pow(constants[1] < constants[2], 1.0/(constants[6]-constants[18])); + computedConstants[133] = pow(constants[1] < constants[2], 1.0/-constants[6]); + computedConstants[134] = pow(constants[1] < constants[2], 1.0/(constants[6]*constants[18])); + computedConstants[135] = pow(constants[1] < constants[2], 1.0/(constants[6]/constants[18])); + computedConstants[136] = pow(constants[1] < constants[2], 1.0/pow(constants[6], constants[18])); + computedConstants[137] = pow(constants[1] < constants[2], 1.0/pow(constants[6], 1.0/constants[18])); + computedConstants[138] = fabs(constants[1]); + computedConstants[139] = exp(constants[1]); + computedConstants[140] = log(constants[1]); + computedConstants[141] = log10(constants[1]); + computedConstants[142] = log(constants[1])/log(2.0); + computedConstants[143] = log10(constants[1]); + computedConstants[144] = log(constants[1])/log(constants[2]); + computedConstants[145] = ceil(constants[1]); + computedConstants[146] = floor(constants[1]); + computedConstants[147] = min(constants[1], constants[2]); + computedConstants[148] = min(constants[1], min(constants[2], constants[6])); + computedConstants[149] = max(constants[1], constants[2]); + computedConstants[150] = max(constants[1], max(constants[2], constants[6])); + computedConstants[151] = fmod(constants[1], constants[2]); + computedConstants[152] = sin(constants[1]); + computedConstants[153] = cos(constants[1]); + computedConstants[154] = tan(constants[1]); + computedConstants[155] = sec(constants[1]); + computedConstants[156] = csc(constants[1]); + computedConstants[157] = cot(constants[1]); + computedConstants[158] = sinh(constants[1]); + computedConstants[159] = cosh(constants[1]); + computedConstants[160] = tanh(constants[1]); + computedConstants[161] = sech(constants[1]); + computedConstants[162] = csch(constants[1]); + computedConstants[163] = coth(constants[1]); + computedConstants[164] = asin(constants[1]); + computedConstants[165] = acos(constants[1]); + computedConstants[166] = atan(constants[1]); + computedConstants[167] = asec(constants[1]); + computedConstants[168] = acsc(constants[1]); + computedConstants[169] = acot(constants[1]); + computedConstants[170] = asinh(constants[1]); + computedConstants[171] = acosh(constants[1]); + computedConstants[172] = atanh(constants[1]/2.0); + computedConstants[173] = asech(constants[1]); + computedConstants[174] = acsch(constants[1]); + computedConstants[175] = acoth(2.0*constants[1]); + computedConstants[176] = (constants[1] > constants[2])?constants[1]:NAN; + computedConstants[177] = (constants[1] > constants[2])?constants[1]:constants[6]; + computedConstants[178] = (constants[1] > constants[2])?constants[1]:(constants[6] > constants[18])?constants[6]:(constants[179] > constants[180])?constants[179]:NAN; + computedConstants[181] = (constants[1] > constants[2])?constants[1]:(constants[6] > constants[18])?constants[6]:(constants[179] > constants[180])?constants[179]:constants[182]; + computedConstants[183] = 123.0+((constants[1] > constants[2])?constants[1]:NAN); + computedConstants[188] = constants[1]; + computedConstants[195] = (constants[1] && constants[2])+((constants[6] > constants[18])?constants[2]:NAN)+constants[179]+(constants[180] && constants[182]); + computedConstants[196] = (constants[1] && constants[2])-(((constants[6] > constants[18])?constants[2]:NAN)-(constants[179]-((constants[6] > constants[18])?constants[2]:NAN)))-(constants[180] && constants[182]); + computedConstants[197] = (constants[1] && constants[2])*((constants[6] > constants[18])?constants[2]:NAN)*constants[179]*((constants[6] > constants[18])?constants[2]:NAN)*(constants[180] && constants[182]); + computedConstants[198] = (constants[1] && constants[2])/(((constants[6] > constants[18])?constants[2]:NAN)/(constants[179]/((constants[6] > constants[18])?constants[2]:NAN))); + computedConstants[199] = (constants[1] || constants[2]) && xor(constants[1], constants[2]) && ((constants[6] > constants[18])?constants[2]:NAN) && constants[179] && ((constants[6] > constants[18])?constants[2]:NAN) && xor(constants[1], constants[2]) && (constants[1] || constants[2]); + computedConstants[200] = (constants[1] && constants[2]) || xor(constants[1], constants[2]) || ((constants[6] > constants[18])?constants[2]:NAN) || constants[179] || ((constants[6] > constants[18])?constants[2]:NAN) || xor(constants[1], constants[2]) || (constants[1] && constants[2]); + computedConstants[201] = xor(constants[1] && constants[2], xor(constants[1] || constants[2], xor((constants[6] > constants[18])?constants[2]:NAN, xor(xor(xor(constants[179], (constants[6] > constants[18])?constants[2]:NAN), constants[1] || constants[2]), constants[1] && constants[2])))); + computedConstants[202] = pow(constants[1] && constants[2], pow((constants[6] > constants[18])?constants[2]:NAN, pow(pow(constants[179], (constants[6] > constants[18])?constants[2]:NAN), constants[1] && constants[2]))); + computedConstants[203] = pow(pow(pow(constants[1] && constants[2], 1.0/pow((constants[6] > constants[18])?constants[2]:NAN, 1.0/constants[179])), 1.0/((constants[6] > constants[18])?constants[2]:NAN)), 1.0/(constants[1] && constants[2])); + computedConstants[204] = -(constants[1] && constants[2])+-((constants[6] > constants[18])?constants[2]:NAN); } void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) diff --git a/tests/resources/coverage/generator/model.modified.profile.py b/tests/resources/coverage/generator/model.modified.profile.py index a6c7be6c6b..4eeb5c9faa 100644 --- a/tests/resources/coverage/generator/model.modified.profile.py +++ b/tests/resources/coverage/generator/model.modified.profile.py @@ -359,239 +359,239 @@ def objective_function_0(u, f, data): rates = data[2] variables = data[3] - variables[205] = u[0] - variables[206] = u[1] + algebraic[205] = u[0] + algebraic[206] = u[1] - f[0] = variables[205]+variables[206]+states[0]-0.0 - f[1] = variables[205]-variables[206]-(variables[207]+variables[208]) + f[0] = algebraic[205]+algebraic[206]+states[0]-0.0 + f[1] = algebraic[205]-algebraic[206]-(computed_constants[207]+computed_constants[208]) def find_root_0(voi, states, rates, variables): u = [nan]*2 - u[0] = variables[205] - u[1] = variables[206] + u[0] = algebraic[205] + u[1] = algebraic[206] u = nla_solve(objective_function_0, u, 2, [voi, states, rates, variables]) - variables[205] = u[0] - variables[206] = u[1] + algebraic[205] = u[0] + algebraic[206] = u[1] def initialise_variables(states, rates, constants): - variables[1] = 1.0 - variables[2] = 2.0 - variables[6] = 3.0 - variables[18] = 4.0 - variables[179] = 5.0 - variables[180] = 6.0 - variables[182] = 7.0 - variables[205] = 1.0 - variables[206] = 2.0 - variables[184] = 123.0 - variables[185] = 123.456789 - variables[186] = 123.0e99 - variables[187] = 123.456789e99 - variables[189] = 1.0 - variables[190] = 0.0 - variables[191] = 2.71828182845905 - variables[192] = 3.14159265358979 - variables[193] = inf - variables[194] = nan - variables[207] = 1.0 - variables[208] = 3.0 + constants[1] = 1.0 + constants[2] = 2.0 + constants[6] = 3.0 + constants[18] = 4.0 + constants[179] = 5.0 + constants[180] = 6.0 + constants[182] = 7.0 + algebraic[205] = 1.0 + algebraic[206] = 2.0 + computed_constants[184] = 123.0 + computed_constants[185] = 123.456789 + computed_constants[186] = 123.0e99 + computed_constants[187] = 123.456789e99 + computed_constants[189] = 1.0 + computed_constants[190] = 0.0 + computed_constants[191] = 2.71828182845905 + computed_constants[192] = 3.14159265358979 + computed_constants[193] = inf + computed_constants[194] = nan + computed_constants[207] = 1.0 + computed_constants[208] = 3.0 states[0] = 0.0 def compute_computed_constants(constants, computed_constants): - variables[0] = eq_func(variables[1], variables[2]) - variables[3] = variables[1]/eq_func(variables[2], variables[2]) - variables[4] = neq_func(variables[1], variables[2]) - variables[5] = variables[1]/neq_func(variables[2], variables[6]) - variables[7] = lt_func(variables[1], variables[2]) - variables[8] = variables[1]/lt_func(variables[2], variables[6]) - variables[9] = leq_func(variables[1], variables[2]) - variables[10] = variables[1]/leq_func(variables[2], variables[6]) - variables[11] = gt_func(variables[1], variables[2]) - variables[12] = variables[1]/gt_func(variables[2], variables[6]) - variables[13] = geq_func(variables[1], variables[2]) - variables[14] = variables[1]/geq_func(variables[2], variables[6]) - variables[15] = and_func(variables[1], variables[2]) - variables[16] = and_func(variables[1], and_func(variables[2], variables[6])) - variables[17] = and_func(lt_func(variables[1], variables[2]), gt_func(variables[6], variables[18])) - variables[19] = and_func(variables[1]+variables[2], gt_func(variables[6], variables[18])) - variables[20] = and_func(variables[1], gt_func(variables[2], variables[6])) - variables[21] = and_func(variables[1]-variables[2], gt_func(variables[6], variables[18])) - variables[22] = and_func(-variables[1], gt_func(variables[2], variables[6])) - variables[23] = and_func(pow(variables[1], variables[2]), gt_func(variables[6], variables[18])) - variables[24] = and_func(pow(variables[1], 1.0/variables[2]), gt_func(variables[6], variables[18])) - variables[25] = and_func(lt_func(variables[1], variables[2]), variables[6]+variables[18]) - variables[26] = and_func(lt_func(variables[1], variables[2]), variables[6]) - variables[27] = and_func(lt_func(variables[1], variables[2]), variables[6]-variables[18]) - variables[28] = and_func(lt_func(variables[1], variables[2]), -variables[6]) - variables[29] = and_func(lt_func(variables[1], variables[2]), pow(variables[6], variables[18])) - variables[30] = and_func(lt_func(variables[1], variables[2]), pow(variables[6], 1.0/variables[18])) - variables[31] = variables[1]/and_func(variables[2], variables[6]) - variables[32] = or_func(variables[1], variables[2]) - variables[33] = or_func(variables[1], or_func(variables[2], variables[6])) - variables[34] = or_func(lt_func(variables[1], variables[2]), gt_func(variables[6], variables[18])) - variables[35] = or_func(variables[1]+variables[2], gt_func(variables[6], variables[18])) - variables[36] = or_func(variables[1], gt_func(variables[2], variables[6])) - variables[37] = or_func(variables[1]-variables[2], gt_func(variables[6], variables[18])) - variables[38] = or_func(-variables[1], gt_func(variables[2], variables[6])) - variables[39] = or_func(pow(variables[1], variables[2]), gt_func(variables[6], variables[18])) - variables[40] = or_func(pow(variables[1], 1.0/variables[2]), gt_func(variables[6], variables[18])) - variables[41] = or_func(lt_func(variables[1], variables[2]), variables[6]+variables[18]) - variables[42] = or_func(lt_func(variables[1], variables[2]), variables[6]) - variables[43] = or_func(lt_func(variables[1], variables[2]), variables[6]-variables[18]) - variables[44] = or_func(lt_func(variables[1], variables[2]), -variables[6]) - variables[45] = or_func(lt_func(variables[1], variables[2]), pow(variables[6], variables[18])) - variables[46] = or_func(lt_func(variables[1], variables[2]), pow(variables[6], 1.0/variables[18])) - variables[47] = variables[1]/or_func(variables[2], variables[6]) - variables[48] = xor_func(variables[1], variables[2]) - variables[49] = xor_func(variables[1], xor_func(variables[2], variables[6])) - variables[50] = xor_func(lt_func(variables[1], variables[2]), gt_func(variables[6], variables[18])) - variables[51] = xor_func(variables[1]+variables[2], gt_func(variables[6], variables[18])) - variables[52] = xor_func(variables[1], gt_func(variables[2], variables[6])) - variables[53] = xor_func(variables[1]-variables[2], gt_func(variables[6], variables[18])) - variables[54] = xor_func(-variables[1], gt_func(variables[2], variables[6])) - variables[55] = xor_func(pow(variables[1], variables[2]), gt_func(variables[6], variables[18])) - variables[56] = xor_func(pow(variables[1], 1.0/variables[2]), gt_func(variables[6], variables[18])) - variables[57] = xor_func(lt_func(variables[1], variables[2]), variables[6]+variables[18]) - variables[58] = xor_func(lt_func(variables[1], variables[2]), variables[6]) - variables[59] = xor_func(lt_func(variables[1], variables[2]), variables[6]-variables[18]) - variables[60] = xor_func(lt_func(variables[1], variables[2]), -variables[6]) - variables[61] = xor_func(lt_func(variables[1], variables[2]), pow(variables[6], variables[18])) - variables[62] = xor_func(lt_func(variables[1], variables[2]), pow(variables[6], 1.0/variables[18])) - variables[63] = variables[1]/xor_func(variables[2], variables[6]) - variables[64] = not_func(variables[1]) - variables[65] = variables[1]+variables[2] - variables[66] = variables[1]+variables[2]+variables[6] - variables[67] = lt_func(variables[1], variables[2])+gt_func(variables[6], variables[18]) - variables[68] = variables[1] - variables[69] = variables[1]-variables[2] - variables[70] = lt_func(variables[1], variables[2])-gt_func(variables[6], variables[18]) - variables[71] = lt_func(variables[1], variables[2])-(variables[6]+variables[18]) - variables[72] = lt_func(variables[1], variables[2])-variables[6] - variables[73] = variables[1]-(-variables[2]) - variables[74] = variables[1]-(-variables[2]*variables[6]) - variables[75] = -variables[1] - variables[76] = -lt_func(variables[1], variables[2]) - variables[77] = variables[1]*variables[2] - variables[78] = variables[1]*variables[2]*variables[6] - variables[79] = lt_func(variables[1], variables[2])*gt_func(variables[6], variables[18]) - variables[80] = (variables[1]+variables[2])*gt_func(variables[6], variables[18]) - variables[81] = variables[1]*gt_func(variables[2], variables[6]) - variables[82] = (variables[1]-variables[2])*gt_func(variables[6], variables[18]) - variables[83] = -variables[1]*gt_func(variables[2], variables[6]) - variables[84] = lt_func(variables[1], variables[2])*(variables[6]+variables[18]) - variables[85] = lt_func(variables[1], variables[2])*variables[6] - variables[86] = lt_func(variables[1], variables[2])*(variables[6]-variables[18]) - variables[87] = lt_func(variables[1], variables[2])*-variables[6] - variables[88] = variables[1]/variables[2] - variables[89] = lt_func(variables[1], variables[2])/gt_func(variables[18], variables[6]) - variables[90] = (variables[1]+variables[2])/gt_func(variables[18], variables[6]) - variables[91] = variables[1]/gt_func(variables[6], variables[2]) - variables[92] = (variables[1]-variables[2])/gt_func(variables[18], variables[6]) - variables[93] = -variables[1]/gt_func(variables[6], variables[2]) - variables[94] = lt_func(variables[1], variables[2])/(variables[6]+variables[18]) - variables[95] = lt_func(variables[1], variables[2])/variables[6] - variables[96] = lt_func(variables[1], variables[2])/(variables[6]-variables[18]) - variables[97] = lt_func(variables[1], variables[2])/-variables[6] - variables[98] = lt_func(variables[1], variables[2])/(variables[6]*variables[18]) - variables[99] = lt_func(variables[1], variables[2])/(variables[6]/variables[18]) - variables[100] = sqrt(variables[1]) - variables[101] = pow(variables[1], 2.0) - variables[102] = pow(variables[1], 3.0) - variables[103] = pow(variables[1], variables[2]) - variables[104] = pow(leq_func(variables[1], variables[2]), geq_func(variables[6], variables[18])) - variables[105] = pow(variables[1]+variables[2], geq_func(variables[6], variables[18])) - variables[106] = pow(variables[1], geq_func(variables[2], variables[6])) - variables[107] = pow(variables[1]-variables[2], geq_func(variables[6], variables[18])) - variables[108] = pow(-variables[1], geq_func(variables[2], variables[6])) - variables[109] = pow(variables[1]*variables[2], geq_func(variables[6], variables[18])) - variables[110] = pow(variables[1]/variables[2], geq_func(variables[6], variables[18])) - variables[111] = pow(leq_func(variables[1], variables[2]), variables[6]+variables[18]) - variables[112] = pow(leq_func(variables[1], variables[2]), variables[6]) - variables[113] = pow(leq_func(variables[1], variables[2]), variables[6]-variables[18]) - variables[114] = pow(leq_func(variables[1], variables[2]), -variables[6]) - variables[115] = pow(leq_func(variables[1], variables[2]), variables[6]*variables[18]) - variables[116] = pow(leq_func(variables[1], variables[2]), variables[6]/variables[18]) - variables[117] = pow(leq_func(variables[1], variables[2]), pow(variables[6], variables[18])) - variables[118] = pow(leq_func(variables[1], variables[2]), pow(variables[6], 1.0/variables[18])) - variables[119] = sqrt(variables[1]) - variables[120] = sqrt(variables[1]) - variables[121] = pow(variables[1], 1.0/3.0) - variables[122] = pow(variables[1], 1.0/variables[2]) - variables[123] = pow(lt_func(variables[1], variables[2]), 1.0/gt_func(variables[18], variables[6])) - variables[124] = pow(variables[1]+variables[2], 1.0/gt_func(variables[18], variables[6])) - variables[125] = pow(variables[1], 1.0/gt_func(variables[6], variables[2])) - variables[126] = pow(variables[1]-variables[2], 1.0/gt_func(variables[18], variables[6])) - variables[127] = pow(-variables[1], 1.0/gt_func(variables[6], variables[2])) - variables[128] = pow(variables[1]*variables[2], 1.0/gt_func(variables[18], variables[6])) - variables[129] = pow(variables[1]/variables[2], 1.0/gt_func(variables[18], variables[6])) - variables[130] = pow(lt_func(variables[1], variables[2]), 1.0/(variables[6]+variables[18])) - variables[131] = pow(lt_func(variables[1], variables[2]), 1.0/variables[6]) - variables[132] = pow(lt_func(variables[1], variables[2]), 1.0/(variables[6]-variables[18])) - variables[133] = pow(lt_func(variables[1], variables[2]), 1.0/-variables[6]) - variables[134] = pow(lt_func(variables[1], variables[2]), 1.0/(variables[6]*variables[18])) - variables[135] = pow(lt_func(variables[1], variables[2]), 1.0/(variables[6]/variables[18])) - variables[136] = pow(lt_func(variables[1], variables[2]), 1.0/pow(variables[6], variables[18])) - variables[137] = pow(lt_func(variables[1], variables[2]), 1.0/pow(variables[6], 1.0/variables[18])) - variables[138] = fabs(variables[1]) - variables[139] = exp(variables[1]) - variables[140] = log(variables[1]) - variables[141] = log10(variables[1]) - variables[142] = log(variables[1])/log(2.0) - variables[143] = log10(variables[1]) - variables[144] = log(variables[1])/log(variables[2]) - variables[145] = ceil(variables[1]) - variables[146] = floor(variables[1]) - variables[147] = min(variables[1], variables[2]) - variables[148] = min(variables[1], min(variables[2], variables[6])) - variables[149] = max(variables[1], variables[2]) - variables[150] = max(variables[1], max(variables[2], variables[6])) - variables[151] = fmod(variables[1], variables[2]) - variables[152] = sin(variables[1]) - variables[153] = cos(variables[1]) - variables[154] = tan(variables[1]) - variables[155] = sec(variables[1]) - variables[156] = csc(variables[1]) - variables[157] = cot(variables[1]) - variables[158] = sinh(variables[1]) - variables[159] = cosh(variables[1]) - variables[160] = tanh(variables[1]) - variables[161] = sech(variables[1]) - variables[162] = csch(variables[1]) - variables[163] = coth(variables[1]) - variables[164] = asin(variables[1]) - variables[165] = acos(variables[1]) - variables[166] = atan(variables[1]) - variables[167] = asec(variables[1]) - variables[168] = acsc(variables[1]) - variables[169] = acot(variables[1]) - variables[170] = asinh(variables[1]) - variables[171] = acosh(variables[1]) - variables[172] = atanh(variables[1]/2.0) - variables[173] = asech(variables[1]) - variables[174] = acsch(variables[1]) - variables[175] = acoth(2.0*variables[1]) - variables[176] = variables[1] if gt_func(variables[1], variables[2]) else nan - variables[177] = variables[1] if gt_func(variables[1], variables[2]) else variables[6] - variables[178] = variables[1] if gt_func(variables[1], variables[2]) else variables[6] if gt_func(variables[6], variables[18]) else variables[179] if gt_func(variables[179], variables[180]) else nan - variables[181] = variables[1] if gt_func(variables[1], variables[2]) else variables[6] if gt_func(variables[6], variables[18]) else variables[179] if gt_func(variables[179], variables[180]) else variables[182] - variables[183] = 123.0+(variables[1] if gt_func(variables[1], variables[2]) else nan) - variables[188] = variables[1] - variables[195] = and_func(variables[1], variables[2])+(variables[2] if gt_func(variables[6], variables[18]) else nan)+variables[179]+and_func(variables[180], variables[182]) - variables[196] = and_func(variables[1], variables[2])-((variables[2] if gt_func(variables[6], variables[18]) else nan)-(variables[179]-(variables[2] if gt_func(variables[6], variables[18]) else nan)))-and_func(variables[180], variables[182]) - variables[197] = and_func(variables[1], variables[2])*(variables[2] if gt_func(variables[6], variables[18]) else nan)*variables[179]*(variables[2] if gt_func(variables[6], variables[18]) else nan)*and_func(variables[180], variables[182]) - variables[198] = and_func(variables[1], variables[2])/((variables[2] if gt_func(variables[6], variables[18]) else nan)/(variables[179]/(variables[2] if gt_func(variables[6], variables[18]) else nan))) - variables[199] = and_func(or_func(variables[1], variables[2]), and_func(xor_func(variables[1], variables[2]), and_func(variables[2] if gt_func(variables[6], variables[18]) else nan, and_func(and_func(and_func(variables[179], variables[2] if gt_func(variables[6], variables[18]) else nan), xor_func(variables[1], variables[2])), or_func(variables[1], variables[2]))))) - variables[200] = or_func(and_func(variables[1], variables[2]), or_func(xor_func(variables[1], variables[2]), or_func(variables[2] if gt_func(variables[6], variables[18]) else nan, or_func(or_func(or_func(variables[179], variables[2] if gt_func(variables[6], variables[18]) else nan), xor_func(variables[1], variables[2])), and_func(variables[1], variables[2]))))) - variables[201] = xor_func(and_func(variables[1], variables[2]), xor_func(or_func(variables[1], variables[2]), xor_func(variables[2] if gt_func(variables[6], variables[18]) else nan, xor_func(xor_func(xor_func(variables[179], variables[2] if gt_func(variables[6], variables[18]) else nan), or_func(variables[1], variables[2])), and_func(variables[1], variables[2]))))) - variables[202] = pow(and_func(variables[1], variables[2]), pow(variables[2] if gt_func(variables[6], variables[18]) else nan, pow(pow(variables[179], variables[2] if gt_func(variables[6], variables[18]) else nan), and_func(variables[1], variables[2])))) - variables[203] = pow(pow(pow(and_func(variables[1], variables[2]), 1.0/pow(variables[2] if gt_func(variables[6], variables[18]) else nan, 1.0/variables[179])), 1.0/(variables[2] if gt_func(variables[6], variables[18]) else nan)), 1.0/and_func(variables[1], variables[2])) - variables[204] = -and_func(variables[1], variables[2])+-(variables[2] if gt_func(variables[6], variables[18]) else nan) + computed_constants[0] = eq_func(constants[1], constants[2]) + computed_constants[3] = constants[1]/eq_func(constants[2], constants[2]) + computed_constants[4] = neq_func(constants[1], constants[2]) + computed_constants[5] = constants[1]/neq_func(constants[2], constants[6]) + computed_constants[7] = lt_func(constants[1], constants[2]) + computed_constants[8] = constants[1]/lt_func(constants[2], constants[6]) + computed_constants[9] = leq_func(constants[1], constants[2]) + computed_constants[10] = constants[1]/leq_func(constants[2], constants[6]) + computed_constants[11] = gt_func(constants[1], constants[2]) + computed_constants[12] = constants[1]/gt_func(constants[2], constants[6]) + computed_constants[13] = geq_func(constants[1], constants[2]) + computed_constants[14] = constants[1]/geq_func(constants[2], constants[6]) + computed_constants[15] = and_func(constants[1], constants[2]) + computed_constants[16] = and_func(constants[1], and_func(constants[2], constants[6])) + computed_constants[17] = and_func(lt_func(constants[1], constants[2]), gt_func(constants[6], constants[18])) + computed_constants[19] = and_func(constants[1]+constants[2], gt_func(constants[6], constants[18])) + computed_constants[20] = and_func(constants[1], gt_func(constants[2], constants[6])) + computed_constants[21] = and_func(constants[1]-constants[2], gt_func(constants[6], constants[18])) + computed_constants[22] = and_func(-constants[1], gt_func(constants[2], constants[6])) + computed_constants[23] = and_func(pow(constants[1], constants[2]), gt_func(constants[6], constants[18])) + computed_constants[24] = and_func(pow(constants[1], 1.0/constants[2]), gt_func(constants[6], constants[18])) + computed_constants[25] = and_func(lt_func(constants[1], constants[2]), constants[6]+constants[18]) + computed_constants[26] = and_func(lt_func(constants[1], constants[2]), constants[6]) + computed_constants[27] = and_func(lt_func(constants[1], constants[2]), constants[6]-constants[18]) + computed_constants[28] = and_func(lt_func(constants[1], constants[2]), -constants[6]) + computed_constants[29] = and_func(lt_func(constants[1], constants[2]), pow(constants[6], constants[18])) + computed_constants[30] = and_func(lt_func(constants[1], constants[2]), pow(constants[6], 1.0/constants[18])) + computed_constants[31] = constants[1]/and_func(constants[2], constants[6]) + computed_constants[32] = or_func(constants[1], constants[2]) + computed_constants[33] = or_func(constants[1], or_func(constants[2], constants[6])) + computed_constants[34] = or_func(lt_func(constants[1], constants[2]), gt_func(constants[6], constants[18])) + computed_constants[35] = or_func(constants[1]+constants[2], gt_func(constants[6], constants[18])) + computed_constants[36] = or_func(constants[1], gt_func(constants[2], constants[6])) + computed_constants[37] = or_func(constants[1]-constants[2], gt_func(constants[6], constants[18])) + computed_constants[38] = or_func(-constants[1], gt_func(constants[2], constants[6])) + computed_constants[39] = or_func(pow(constants[1], constants[2]), gt_func(constants[6], constants[18])) + computed_constants[40] = or_func(pow(constants[1], 1.0/constants[2]), gt_func(constants[6], constants[18])) + computed_constants[41] = or_func(lt_func(constants[1], constants[2]), constants[6]+constants[18]) + computed_constants[42] = or_func(lt_func(constants[1], constants[2]), constants[6]) + computed_constants[43] = or_func(lt_func(constants[1], constants[2]), constants[6]-constants[18]) + computed_constants[44] = or_func(lt_func(constants[1], constants[2]), -constants[6]) + computed_constants[45] = or_func(lt_func(constants[1], constants[2]), pow(constants[6], constants[18])) + computed_constants[46] = or_func(lt_func(constants[1], constants[2]), pow(constants[6], 1.0/constants[18])) + computed_constants[47] = constants[1]/or_func(constants[2], constants[6]) + computed_constants[48] = xor_func(constants[1], constants[2]) + computed_constants[49] = xor_func(constants[1], xor_func(constants[2], constants[6])) + computed_constants[50] = xor_func(lt_func(constants[1], constants[2]), gt_func(constants[6], constants[18])) + computed_constants[51] = xor_func(constants[1]+constants[2], gt_func(constants[6], constants[18])) + computed_constants[52] = xor_func(constants[1], gt_func(constants[2], constants[6])) + computed_constants[53] = xor_func(constants[1]-constants[2], gt_func(constants[6], constants[18])) + computed_constants[54] = xor_func(-constants[1], gt_func(constants[2], constants[6])) + computed_constants[55] = xor_func(pow(constants[1], constants[2]), gt_func(constants[6], constants[18])) + computed_constants[56] = xor_func(pow(constants[1], 1.0/constants[2]), gt_func(constants[6], constants[18])) + computed_constants[57] = xor_func(lt_func(constants[1], constants[2]), constants[6]+constants[18]) + computed_constants[58] = xor_func(lt_func(constants[1], constants[2]), constants[6]) + computed_constants[59] = xor_func(lt_func(constants[1], constants[2]), constants[6]-constants[18]) + computed_constants[60] = xor_func(lt_func(constants[1], constants[2]), -constants[6]) + computed_constants[61] = xor_func(lt_func(constants[1], constants[2]), pow(constants[6], constants[18])) + computed_constants[62] = xor_func(lt_func(constants[1], constants[2]), pow(constants[6], 1.0/constants[18])) + computed_constants[63] = constants[1]/xor_func(constants[2], constants[6]) + computed_constants[64] = not_func(constants[1]) + computed_constants[65] = constants[1]+constants[2] + computed_constants[66] = constants[1]+constants[2]+constants[6] + computed_constants[67] = lt_func(constants[1], constants[2])+gt_func(constants[6], constants[18]) + computed_constants[68] = constants[1] + computed_constants[69] = constants[1]-constants[2] + computed_constants[70] = lt_func(constants[1], constants[2])-gt_func(constants[6], constants[18]) + computed_constants[71] = lt_func(constants[1], constants[2])-(constants[6]+constants[18]) + computed_constants[72] = lt_func(constants[1], constants[2])-constants[6] + computed_constants[73] = constants[1]-(-constants[2]) + computed_constants[74] = constants[1]-(-constants[2]*constants[6]) + computed_constants[75] = -constants[1] + computed_constants[76] = -lt_func(constants[1], constants[2]) + computed_constants[77] = constants[1]*constants[2] + computed_constants[78] = constants[1]*constants[2]*constants[6] + computed_constants[79] = lt_func(constants[1], constants[2])*gt_func(constants[6], constants[18]) + computed_constants[80] = (constants[1]+constants[2])*gt_func(constants[6], constants[18]) + computed_constants[81] = constants[1]*gt_func(constants[2], constants[6]) + computed_constants[82] = (constants[1]-constants[2])*gt_func(constants[6], constants[18]) + computed_constants[83] = -constants[1]*gt_func(constants[2], constants[6]) + computed_constants[84] = lt_func(constants[1], constants[2])*(constants[6]+constants[18]) + computed_constants[85] = lt_func(constants[1], constants[2])*constants[6] + computed_constants[86] = lt_func(constants[1], constants[2])*(constants[6]-constants[18]) + computed_constants[87] = lt_func(constants[1], constants[2])*-constants[6] + computed_constants[88] = constants[1]/constants[2] + computed_constants[89] = lt_func(constants[1], constants[2])/gt_func(constants[18], constants[6]) + computed_constants[90] = (constants[1]+constants[2])/gt_func(constants[18], constants[6]) + computed_constants[91] = constants[1]/gt_func(constants[6], constants[2]) + computed_constants[92] = (constants[1]-constants[2])/gt_func(constants[18], constants[6]) + computed_constants[93] = -constants[1]/gt_func(constants[6], constants[2]) + computed_constants[94] = lt_func(constants[1], constants[2])/(constants[6]+constants[18]) + computed_constants[95] = lt_func(constants[1], constants[2])/constants[6] + computed_constants[96] = lt_func(constants[1], constants[2])/(constants[6]-constants[18]) + computed_constants[97] = lt_func(constants[1], constants[2])/-constants[6] + computed_constants[98] = lt_func(constants[1], constants[2])/(constants[6]*constants[18]) + computed_constants[99] = lt_func(constants[1], constants[2])/(constants[6]/constants[18]) + computed_constants[100] = sqrt(constants[1]) + computed_constants[101] = pow(constants[1], 2.0) + computed_constants[102] = pow(constants[1], 3.0) + computed_constants[103] = pow(constants[1], constants[2]) + computed_constants[104] = pow(leq_func(constants[1], constants[2]), geq_func(constants[6], constants[18])) + computed_constants[105] = pow(constants[1]+constants[2], geq_func(constants[6], constants[18])) + computed_constants[106] = pow(constants[1], geq_func(constants[2], constants[6])) + computed_constants[107] = pow(constants[1]-constants[2], geq_func(constants[6], constants[18])) + computed_constants[108] = pow(-constants[1], geq_func(constants[2], constants[6])) + computed_constants[109] = pow(constants[1]*constants[2], geq_func(constants[6], constants[18])) + computed_constants[110] = pow(constants[1]/constants[2], geq_func(constants[6], constants[18])) + computed_constants[111] = pow(leq_func(constants[1], constants[2]), constants[6]+constants[18]) + computed_constants[112] = pow(leq_func(constants[1], constants[2]), constants[6]) + computed_constants[113] = pow(leq_func(constants[1], constants[2]), constants[6]-constants[18]) + computed_constants[114] = pow(leq_func(constants[1], constants[2]), -constants[6]) + computed_constants[115] = pow(leq_func(constants[1], constants[2]), constants[6]*constants[18]) + computed_constants[116] = pow(leq_func(constants[1], constants[2]), constants[6]/constants[18]) + computed_constants[117] = pow(leq_func(constants[1], constants[2]), pow(constants[6], constants[18])) + computed_constants[118] = pow(leq_func(constants[1], constants[2]), pow(constants[6], 1.0/constants[18])) + computed_constants[119] = sqrt(constants[1]) + computed_constants[120] = sqrt(constants[1]) + computed_constants[121] = pow(constants[1], 1.0/3.0) + computed_constants[122] = pow(constants[1], 1.0/constants[2]) + computed_constants[123] = pow(lt_func(constants[1], constants[2]), 1.0/gt_func(constants[18], constants[6])) + computed_constants[124] = pow(constants[1]+constants[2], 1.0/gt_func(constants[18], constants[6])) + computed_constants[125] = pow(constants[1], 1.0/gt_func(constants[6], constants[2])) + computed_constants[126] = pow(constants[1]-constants[2], 1.0/gt_func(constants[18], constants[6])) + computed_constants[127] = pow(-constants[1], 1.0/gt_func(constants[6], constants[2])) + computed_constants[128] = pow(constants[1]*constants[2], 1.0/gt_func(constants[18], constants[6])) + computed_constants[129] = pow(constants[1]/constants[2], 1.0/gt_func(constants[18], constants[6])) + computed_constants[130] = pow(lt_func(constants[1], constants[2]), 1.0/(constants[6]+constants[18])) + computed_constants[131] = pow(lt_func(constants[1], constants[2]), 1.0/constants[6]) + computed_constants[132] = pow(lt_func(constants[1], constants[2]), 1.0/(constants[6]-constants[18])) + computed_constants[133] = pow(lt_func(constants[1], constants[2]), 1.0/-constants[6]) + computed_constants[134] = pow(lt_func(constants[1], constants[2]), 1.0/(constants[6]*constants[18])) + computed_constants[135] = pow(lt_func(constants[1], constants[2]), 1.0/(constants[6]/constants[18])) + computed_constants[136] = pow(lt_func(constants[1], constants[2]), 1.0/pow(constants[6], constants[18])) + computed_constants[137] = pow(lt_func(constants[1], constants[2]), 1.0/pow(constants[6], 1.0/constants[18])) + computed_constants[138] = fabs(constants[1]) + computed_constants[139] = exp(constants[1]) + computed_constants[140] = log(constants[1]) + computed_constants[141] = log10(constants[1]) + computed_constants[142] = log(constants[1])/log(2.0) + computed_constants[143] = log10(constants[1]) + computed_constants[144] = log(constants[1])/log(constants[2]) + computed_constants[145] = ceil(constants[1]) + computed_constants[146] = floor(constants[1]) + computed_constants[147] = min(constants[1], constants[2]) + computed_constants[148] = min(constants[1], min(constants[2], constants[6])) + computed_constants[149] = max(constants[1], constants[2]) + computed_constants[150] = max(constants[1], max(constants[2], constants[6])) + computed_constants[151] = fmod(constants[1], constants[2]) + computed_constants[152] = sin(constants[1]) + computed_constants[153] = cos(constants[1]) + computed_constants[154] = tan(constants[1]) + computed_constants[155] = sec(constants[1]) + computed_constants[156] = csc(constants[1]) + computed_constants[157] = cot(constants[1]) + computed_constants[158] = sinh(constants[1]) + computed_constants[159] = cosh(constants[1]) + computed_constants[160] = tanh(constants[1]) + computed_constants[161] = sech(constants[1]) + computed_constants[162] = csch(constants[1]) + computed_constants[163] = coth(constants[1]) + computed_constants[164] = asin(constants[1]) + computed_constants[165] = acos(constants[1]) + computed_constants[166] = atan(constants[1]) + computed_constants[167] = asec(constants[1]) + computed_constants[168] = acsc(constants[1]) + computed_constants[169] = acot(constants[1]) + computed_constants[170] = asinh(constants[1]) + computed_constants[171] = acosh(constants[1]) + computed_constants[172] = atanh(constants[1]/2.0) + computed_constants[173] = asech(constants[1]) + computed_constants[174] = acsch(constants[1]) + computed_constants[175] = acoth(2.0*constants[1]) + computed_constants[176] = constants[1] if gt_func(constants[1], constants[2]) else nan + computed_constants[177] = constants[1] if gt_func(constants[1], constants[2]) else constants[6] + computed_constants[178] = constants[1] if gt_func(constants[1], constants[2]) else constants[6] if gt_func(constants[6], constants[18]) else constants[179] if gt_func(constants[179], constants[180]) else nan + computed_constants[181] = constants[1] if gt_func(constants[1], constants[2]) else constants[6] if gt_func(constants[6], constants[18]) else constants[179] if gt_func(constants[179], constants[180]) else constants[182] + computed_constants[183] = 123.0+(constants[1] if gt_func(constants[1], constants[2]) else nan) + computed_constants[188] = constants[1] + computed_constants[195] = and_func(constants[1], constants[2])+(constants[2] if gt_func(constants[6], constants[18]) else nan)+constants[179]+and_func(constants[180], constants[182]) + computed_constants[196] = and_func(constants[1], constants[2])-((constants[2] if gt_func(constants[6], constants[18]) else nan)-(constants[179]-(constants[2] if gt_func(constants[6], constants[18]) else nan)))-and_func(constants[180], constants[182]) + computed_constants[197] = and_func(constants[1], constants[2])*(constants[2] if gt_func(constants[6], constants[18]) else nan)*constants[179]*(constants[2] if gt_func(constants[6], constants[18]) else nan)*and_func(constants[180], constants[182]) + computed_constants[198] = and_func(constants[1], constants[2])/((constants[2] if gt_func(constants[6], constants[18]) else nan)/(constants[179]/(constants[2] if gt_func(constants[6], constants[18]) else nan))) + computed_constants[199] = and_func(or_func(constants[1], constants[2]), and_func(xor_func(constants[1], constants[2]), and_func(constants[2] if gt_func(constants[6], constants[18]) else nan, and_func(and_func(and_func(constants[179], constants[2] if gt_func(constants[6], constants[18]) else nan), xor_func(constants[1], constants[2])), or_func(constants[1], constants[2]))))) + computed_constants[200] = or_func(and_func(constants[1], constants[2]), or_func(xor_func(constants[1], constants[2]), or_func(constants[2] if gt_func(constants[6], constants[18]) else nan, or_func(or_func(or_func(constants[179], constants[2] if gt_func(constants[6], constants[18]) else nan), xor_func(constants[1], constants[2])), and_func(constants[1], constants[2]))))) + computed_constants[201] = xor_func(and_func(constants[1], constants[2]), xor_func(or_func(constants[1], constants[2]), xor_func(constants[2] if gt_func(constants[6], constants[18]) else nan, xor_func(xor_func(xor_func(constants[179], constants[2] if gt_func(constants[6], constants[18]) else nan), or_func(constants[1], constants[2])), and_func(constants[1], constants[2]))))) + computed_constants[202] = pow(and_func(constants[1], constants[2]), pow(constants[2] if gt_func(constants[6], constants[18]) else nan, pow(pow(constants[179], constants[2] if gt_func(constants[6], constants[18]) else nan), and_func(constants[1], constants[2])))) + computed_constants[203] = pow(pow(pow(and_func(constants[1], constants[2]), 1.0/pow(constants[2] if gt_func(constants[6], constants[18]) else nan, 1.0/constants[179])), 1.0/(constants[2] if gt_func(constants[6], constants[18]) else nan)), 1.0/and_func(constants[1], constants[2])) + computed_constants[204] = -and_func(constants[1], constants[2])+-(constants[2] if gt_func(constants[6], constants[18]) else nan) def compute_rates(voi, states, rates, constants, computed_constants, algebraic): diff --git a/tests/resources/coverage/generator/model.out b/tests/resources/coverage/generator/model.out index b4c4b8088d..f35ae16224 100644 --- a/tests/resources/coverage/generator/model.out +++ b/tests/resources/coverage/generator/model.out @@ -95,11 +95,11 @@ void objectiveFunction0(double *u, double *f, void *data) double *rates = ((RootFindingInfo *) data)->rates; double *variables = ((RootFindingInfo *) data)->variables; - variables[205] = u[0]; - variables[206] = u[1]; + algebraic[205] = u[0]; + algebraic[206] = u[1]; - f[0] = variables[205]+variables[206]+states[0]-0.0; - f[1] = variables[205]-variables[206]-(variables[207]+variables[208]); + f[0] = algebraic[205]+algebraic[206]+states[0]-0.0; + f[1] = algebraic[205]-algebraic[206]-(computedConstants[207]+computedConstants[208]); } void findRoot0(double voi, double *states, double *rates, double *variables) @@ -107,231 +107,231 @@ void findRoot0(double voi, double *states, double *rates, double *variables) RootFindingInfo rfi = { voi, states, rates, variables }; double u[2]; - u[0] = variables[205]; - u[1] = variables[206]; + u[0] = algebraic[205]; + u[1] = algebraic[206]; nlaSolve(objectiveFunction0, u, 2, &rfi); - variables[205] = u[0]; - variables[206] = u[1]; + algebraic[205] = u[0]; + algebraic[206] = u[1]; } void initialiseVariables(double *states, double *rates, double *constants) { - variables[1] = 1.0; - variables[2] = 2.0; - variables[6] = 3.0; - variables[18] = 4.0; - variables[179] = 5.0; - variables[180] = 6.0; - variables[182] = 7.0; - variables[205] = 1.0; - variables[206] = 2.0; - variables[184] = 123.0; - variables[185] = 123.456789; - variables[186] = 123.0e99; - variables[187] = 123.456789e99; - variables[189] = 1.0; - variables[190] = 0.0; - variables[191] = 2.71828182845905; - variables[192] = 3.14159265358979; - variables[193] = INFINITY; - variables[194] = NAN; - variables[207] = 1.0; - variables[208] = 3.0; + constants[1] = 1.0; + constants[2] = 2.0; + constants[6] = 3.0; + constants[18] = 4.0; + constants[179] = 5.0; + constants[180] = 6.0; + constants[182] = 7.0; + algebraic[205] = 1.0; + algebraic[206] = 2.0; + computedConstants[184] = 123.0; + computedConstants[185] = 123.456789; + computedConstants[186] = 123.0e99; + computedConstants[187] = 123.456789e99; + computedConstants[189] = 1.0; + computedConstants[190] = 0.0; + computedConstants[191] = 2.71828182845905; + computedConstants[192] = 3.14159265358979; + computedConstants[193] = INFINITY; + computedConstants[194] = NAN; + computedConstants[207] = 1.0; + computedConstants[208] = 3.0; states[0] = 0.0; } void computeComputedConstants(double *constants, double *computedConstants) { - variables[0] = variables[1] == variables[2]; - variables[3] = variables[1]/(variables[2] == variables[2]); - variables[4] = variables[1] != variables[2]; - variables[5] = variables[1]/(variables[2] != variables[6]); - variables[7] = variables[1] < variables[2]; - variables[8] = variables[1]/(variables[2] < variables[6]); - variables[9] = variables[1] <= variables[2]; - variables[10] = variables[1]/(variables[2] <= variables[6]); - variables[11] = variables[1] > variables[2]; - variables[12] = variables[1]/(variables[2] > variables[6]); - variables[13] = variables[1] >= variables[2]; - variables[14] = variables[1]/(variables[2] >= variables[6]); - variables[15] = variables[1] && variables[2]; - variables[16] = variables[1] && variables[2] && variables[6]; - variables[17] = (variables[1] < variables[2]) && (variables[6] > variables[18]); - variables[19] = (variables[1]+variables[2]) && (variables[6] > variables[18]); - variables[20] = variables[1] && (variables[2] > variables[6]); - variables[21] = (variables[1]-variables[2]) && (variables[6] > variables[18]); - variables[22] = -variables[1] && (variables[2] > variables[6]); - variables[23] = (variables[1]^^variables[2]) && (variables[6] > variables[18]); - variables[24] = (variables[1]^^(1.0/variables[2])) && (variables[6] > variables[18]); - variables[25] = (variables[1] < variables[2]) && (variables[6]+variables[18]); - variables[26] = (variables[1] < variables[2]) && variables[6]; - variables[27] = (variables[1] < variables[2]) && (variables[6]-variables[18]); - variables[28] = (variables[1] < variables[2]) && -variables[6]; - variables[29] = (variables[1] < variables[2]) && (variables[6]^^variables[18]); - variables[30] = (variables[1] < variables[2]) && (variables[6]^^(1.0/variables[18])); - variables[31] = variables[1]/(variables[2] && variables[6]); - variables[32] = variables[1] || variables[2]; - variables[33] = variables[1] || variables[2] || variables[6]; - variables[34] = (variables[1] < variables[2]) || (variables[6] > variables[18]); - variables[35] = (variables[1]+variables[2]) || (variables[6] > variables[18]); - variables[36] = variables[1] || (variables[2] > variables[6]); - variables[37] = (variables[1]-variables[2]) || (variables[6] > variables[18]); - variables[38] = -variables[1] || (variables[2] > variables[6]); - variables[39] = (variables[1]^^variables[2]) || (variables[6] > variables[18]); - variables[40] = (variables[1]^^(1.0/variables[2])) || (variables[6] > variables[18]); - variables[41] = (variables[1] < variables[2]) || (variables[6]+variables[18]); - variables[42] = (variables[1] < variables[2]) || variables[6]; - variables[43] = (variables[1] < variables[2]) || (variables[6]-variables[18]); - variables[44] = (variables[1] < variables[2]) || -variables[6]; - variables[45] = (variables[1] < variables[2]) || (variables[6]^^variables[18]); - variables[46] = (variables[1] < variables[2]) || (variables[6]^^(1.0/variables[18])); - variables[47] = variables[1]/(variables[2] || variables[6]); - variables[48] = variables[1]^variables[2]; - variables[49] = variables[1]^variables[2]^variables[6]; - variables[50] = (variables[1] < variables[2])^(variables[6] > variables[18]); - variables[51] = (variables[1]+variables[2])^(variables[6] > variables[18]); - variables[52] = variables[1]^(variables[2] > variables[6]); - variables[53] = (variables[1]-variables[2])^(variables[6] > variables[18]); - variables[54] = -variables[1]^(variables[2] > variables[6]); - variables[55] = (variables[1]^^variables[2])^(variables[6] > variables[18]); - variables[56] = (variables[1]^^(1.0/variables[2]))^(variables[6] > variables[18]); - variables[57] = (variables[1] < variables[2])^(variables[6]+variables[18]); - variables[58] = (variables[1] < variables[2])^variables[6]; - variables[59] = (variables[1] < variables[2])^(variables[6]-variables[18]); - variables[60] = (variables[1] < variables[2])^-variables[6]; - variables[61] = (variables[1] < variables[2])^(variables[6]^^variables[18]); - variables[62] = (variables[1] < variables[2])^(variables[6]^^(1.0/variables[18])); - variables[63] = variables[1]/(variables[2]^variables[6]); - variables[64] = !variables[1]; - variables[65] = variables[1]+variables[2]; - variables[66] = variables[1]+variables[2]+variables[6]; - variables[67] = (variables[1] < variables[2])+(variables[6] > variables[18]); - variables[68] = variables[1]; - variables[69] = variables[1]-variables[2]; - variables[70] = (variables[1] < variables[2])-(variables[6] > variables[18]); - variables[71] = (variables[1] < variables[2])-(variables[6]+variables[18]); - variables[72] = (variables[1] < variables[2])-variables[6]; - variables[73] = variables[1]-(-variables[2]); - variables[74] = variables[1]-(-variables[2]*variables[6]); - variables[75] = -variables[1]; - variables[76] = -(variables[1] < variables[2]); - variables[77] = variables[1]*variables[2]; - variables[78] = variables[1]*variables[2]*variables[6]; - variables[79] = (variables[1] < variables[2])*(variables[6] > variables[18]); - variables[80] = (variables[1]+variables[2])*(variables[6] > variables[18]); - variables[81] = variables[1]*(variables[2] > variables[6]); - variables[82] = (variables[1]-variables[2])*(variables[6] > variables[18]); - variables[83] = -variables[1]*(variables[2] > variables[6]); - variables[84] = (variables[1] < variables[2])*(variables[6]+variables[18]); - variables[85] = (variables[1] < variables[2])*variables[6]; - variables[86] = (variables[1] < variables[2])*(variables[6]-variables[18]); - variables[87] = (variables[1] < variables[2])*-variables[6]; - variables[88] = variables[1]/variables[2]; - variables[89] = (variables[1] < variables[2])/(variables[18] > variables[6]); - variables[90] = (variables[1]+variables[2])/(variables[18] > variables[6]); - variables[91] = variables[1]/(variables[6] > variables[2]); - variables[92] = (variables[1]-variables[2])/(variables[18] > variables[6]); - variables[93] = -variables[1]/(variables[6] > variables[2]); - variables[94] = (variables[1] < variables[2])/(variables[6]+variables[18]); - variables[95] = (variables[1] < variables[2])/variables[6]; - variables[96] = (variables[1] < variables[2])/(variables[6]-variables[18]); - variables[97] = (variables[1] < variables[2])/-variables[6]; - variables[98] = (variables[1] < variables[2])/(variables[6]*variables[18]); - variables[99] = (variables[1] < variables[2])/(variables[6]/variables[18]); - variables[100] = sqrt(variables[1]); - variables[101] = sqr(variables[1]); - variables[102] = variables[1]^^3.0; - variables[103] = variables[1]^^variables[2]; - variables[104] = (variables[1] <= variables[2])^^(variables[6] >= variables[18]); - variables[105] = (variables[1]+variables[2])^^(variables[6] >= variables[18]); - variables[106] = variables[1]^^(variables[2] >= variables[6]); - variables[107] = (variables[1]-variables[2])^^(variables[6] >= variables[18]); - variables[108] = (-variables[1])^^(variables[2] >= variables[6]); - variables[109] = (variables[1]*variables[2])^^(variables[6] >= variables[18]); - variables[110] = (variables[1]/variables[2])^^(variables[6] >= variables[18]); - variables[111] = (variables[1] <= variables[2])^^(variables[6]+variables[18]); - variables[112] = (variables[1] <= variables[2])^^variables[6]; - variables[113] = (variables[1] <= variables[2])^^variables[6]-variables[18]; - variables[114] = (variables[1] <= variables[2])^^-variables[6]; - variables[115] = (variables[1] <= variables[2])^^(variables[6]*variables[18]); - variables[116] = (variables[1] <= variables[2])^^(variables[6]/variables[18]); - variables[117] = (variables[1] <= variables[2])^^(variables[6]^^variables[18]); - variables[118] = (variables[1] <= variables[2])^^(variables[6]^^(1.0/variables[18])); - variables[119] = sqrt(variables[1]); - variables[120] = sqrt(variables[1]); - variables[121] = variables[1]^^(1.0/3.0); - variables[122] = variables[1]^^(1.0/variables[2]); - variables[123] = (variables[1] < variables[2])^^(1.0/(variables[18] > variables[6])); - variables[124] = (variables[1]+variables[2])^^(1.0/(variables[18] > variables[6])); - variables[125] = variables[1]^^(1.0/(variables[6] > variables[2])); - variables[126] = (variables[1]-variables[2])^^(1.0/(variables[18] > variables[6])); - variables[127] = (-variables[1])^^(1.0/(variables[6] > variables[2])); - variables[128] = (variables[1]*variables[2])^^(1.0/(variables[18] > variables[6])); - variables[129] = (variables[1]/variables[2])^^(1.0/(variables[18] > variables[6])); - variables[130] = (variables[1] < variables[2])^^(1.0/(variables[6]+variables[18])); - variables[131] = (variables[1] < variables[2])^^(1.0/variables[6]); - variables[132] = (variables[1] < variables[2])^^(1.0/(variables[6]-variables[18])); - variables[133] = (variables[1] < variables[2])^^(1.0/(-variables[6])); - variables[134] = (variables[1] < variables[2])^^(1.0/(variables[6]*variables[18])); - variables[135] = (variables[1] < variables[2])^^(1.0/(variables[6]/variables[18])); - variables[136] = (variables[1] < variables[2])^^(1.0/(variables[6]^^variables[18])); - variables[137] = (variables[1] < variables[2])^^(1.0/(variables[6]^^(1.0/variables[18]))); - variables[138] = fabs(variables[1]); - variables[139] = exp(variables[1]); - variables[140] = log(variables[1]); - variables[141] = log10(variables[1]); - variables[142] = log(variables[1])/log(2.0); - variables[143] = log10(variables[1]); - variables[144] = log(variables[1])/log(variables[2]); - variables[145] = ceil(variables[1]); - variables[146] = floor(variables[1]); - variables[147] = min(variables[1], variables[2]); - variables[148] = min(variables[1], min(variables[2], variables[6])); - variables[149] = max(variables[1], variables[2]); - variables[150] = max(variables[1], max(variables[2], variables[6])); - variables[151] = fmod(variables[1], variables[2]); - variables[152] = sin(variables[1]); - variables[153] = cos(variables[1]); - variables[154] = tan(variables[1]); - variables[155] = sec(variables[1]); - variables[156] = csc(variables[1]); - variables[157] = cot(variables[1]); - variables[158] = sinh(variables[1]); - variables[159] = cosh(variables[1]); - variables[160] = tanh(variables[1]); - variables[161] = sech(variables[1]); - variables[162] = csch(variables[1]); - variables[163] = coth(variables[1]); - variables[164] = asin(variables[1]); - variables[165] = acos(variables[1]); - variables[166] = atan(variables[1]); - variables[167] = asec(variables[1]); - variables[168] = acsc(variables[1]); - variables[169] = acot(variables[1]); - variables[170] = asinh(variables[1]); - variables[171] = acosh(variables[1]); - variables[172] = atanh(variables[1]/2.0); - variables[173] = asech(variables[1]); - variables[174] = acsch(variables[1]); - variables[175] = acoth(2.0*variables[1]); - variables[176] = piecewise(variables[1] > variables[2], variables[1], NAN); - variables[177] = piecewise(variables[1] > variables[2], variables[1], variables[6]); - variables[178] = piecewise(variables[1] > variables[2], variables[1], piecewise(variables[6] > variables[18], variables[6], piecewise(variables[179] > variables[180], variables[179], NAN))); - variables[181] = piecewise(variables[1] > variables[2], variables[1], piecewise(variables[6] > variables[18], variables[6], piecewise(variables[179] > variables[180], variables[179], variables[182]))); - variables[183] = 123.0+piecewise(variables[1] > variables[2], variables[1], NAN); - variables[188] = variables[1]; - variables[195] = (variables[1] && variables[2])+piecewise(variables[6] > variables[18], variables[2], NAN)+variables[179]+(variables[180] && variables[182]); - variables[196] = (variables[1] && variables[2])-(piecewise(variables[6] > variables[18], variables[2], NAN)-(variables[179]-piecewise(variables[6] > variables[18], variables[2], NAN)))-(variables[180] && variables[182]); - variables[197] = (variables[1] && variables[2])*piecewise(variables[6] > variables[18], variables[2], NAN)*variables[179]*piecewise(variables[6] > variables[18], variables[2], NAN)*(variables[180] && variables[182]); - variables[198] = (variables[1] && variables[2])/(piecewise(variables[6] > variables[18], variables[2], NAN)/(variables[179]/piecewise(variables[6] > variables[18], variables[2], NAN))); - variables[199] = (variables[1] || variables[2]) && (variables[1]^variables[2]) && piecewise(variables[6] > variables[18], variables[2], NAN) && variables[179] && piecewise(variables[6] > variables[18], variables[2], NAN) && (variables[1]^variables[2]) && (variables[1] || variables[2]); - variables[200] = (variables[1] && variables[2]) || (variables[1]^variables[2]) || piecewise(variables[6] > variables[18], variables[2], NAN) || variables[179] || piecewise(variables[6] > variables[18], variables[2], NAN) || (variables[1]^variables[2]) || (variables[1] && variables[2]); - variables[201] = (variables[1] && variables[2])^(variables[1] || variables[2])^piecewise(variables[6] > variables[18], variables[2], NAN)^variables[179]^piecewise(variables[6] > variables[18], variables[2], NAN)^(variables[1] || variables[2])^(variables[1] && variables[2]); - variables[202] = (variables[1] && variables[2])^^(piecewise(variables[6] > variables[18], variables[2], NAN)^^(variables[179]^^piecewise(variables[6] > variables[18], variables[2], NAN)^^(variables[1] && variables[2]))); - variables[203] = (variables[1] && variables[2])^^(1.0/(piecewise(variables[6] > variables[18], variables[2], NAN)^^(1.0/variables[179])))^^(1.0/piecewise(variables[6] > variables[18], variables[2], NAN))^^(1.0/(variables[1] && variables[2])); - variables[204] = -(variables[1] && variables[2])+-piecewise(variables[6] > variables[18], variables[2], NAN); + computedConstants[0] = constants[1] == constants[2]; + computedConstants[3] = constants[1]/(constants[2] == constants[2]); + computedConstants[4] = constants[1] != constants[2]; + computedConstants[5] = constants[1]/(constants[2] != constants[6]); + computedConstants[7] = constants[1] < constants[2]; + computedConstants[8] = constants[1]/(constants[2] < constants[6]); + computedConstants[9] = constants[1] <= constants[2]; + computedConstants[10] = constants[1]/(constants[2] <= constants[6]); + computedConstants[11] = constants[1] > constants[2]; + computedConstants[12] = constants[1]/(constants[2] > constants[6]); + computedConstants[13] = constants[1] >= constants[2]; + computedConstants[14] = constants[1]/(constants[2] >= constants[6]); + computedConstants[15] = constants[1] && constants[2]; + computedConstants[16] = constants[1] && constants[2] && constants[6]; + computedConstants[17] = (constants[1] < constants[2]) && (constants[6] > constants[18]); + computedConstants[19] = (constants[1]+constants[2]) && (constants[6] > constants[18]); + computedConstants[20] = constants[1] && (constants[2] > constants[6]); + computedConstants[21] = (constants[1]-constants[2]) && (constants[6] > constants[18]); + computedConstants[22] = -constants[1] && (constants[2] > constants[6]); + computedConstants[23] = (constants[1]^^constants[2]) && (constants[6] > constants[18]); + computedConstants[24] = (constants[1]^^(1.0/constants[2])) && (constants[6] > constants[18]); + computedConstants[25] = (constants[1] < constants[2]) && (constants[6]+constants[18]); + computedConstants[26] = (constants[1] < constants[2]) && constants[6]; + computedConstants[27] = (constants[1] < constants[2]) && (constants[6]-constants[18]); + computedConstants[28] = (constants[1] < constants[2]) && -constants[6]; + computedConstants[29] = (constants[1] < constants[2]) && (constants[6]^^constants[18]); + computedConstants[30] = (constants[1] < constants[2]) && (constants[6]^^(1.0/constants[18])); + computedConstants[31] = constants[1]/(constants[2] && constants[6]); + computedConstants[32] = constants[1] || constants[2]; + computedConstants[33] = constants[1] || constants[2] || constants[6]; + computedConstants[34] = (constants[1] < constants[2]) || (constants[6] > constants[18]); + computedConstants[35] = (constants[1]+constants[2]) || (constants[6] > constants[18]); + computedConstants[36] = constants[1] || (constants[2] > constants[6]); + computedConstants[37] = (constants[1]-constants[2]) || (constants[6] > constants[18]); + computedConstants[38] = -constants[1] || (constants[2] > constants[6]); + computedConstants[39] = (constants[1]^^constants[2]) || (constants[6] > constants[18]); + computedConstants[40] = (constants[1]^^(1.0/constants[2])) || (constants[6] > constants[18]); + computedConstants[41] = (constants[1] < constants[2]) || (constants[6]+constants[18]); + computedConstants[42] = (constants[1] < constants[2]) || constants[6]; + computedConstants[43] = (constants[1] < constants[2]) || (constants[6]-constants[18]); + computedConstants[44] = (constants[1] < constants[2]) || -constants[6]; + computedConstants[45] = (constants[1] < constants[2]) || (constants[6]^^constants[18]); + computedConstants[46] = (constants[1] < constants[2]) || (constants[6]^^(1.0/constants[18])); + computedConstants[47] = constants[1]/(constants[2] || constants[6]); + computedConstants[48] = constants[1]^constants[2]; + computedConstants[49] = constants[1]^constants[2]^constants[6]; + computedConstants[50] = (constants[1] < constants[2])^(constants[6] > constants[18]); + computedConstants[51] = (constants[1]+constants[2])^(constants[6] > constants[18]); + computedConstants[52] = constants[1]^(constants[2] > constants[6]); + computedConstants[53] = (constants[1]-constants[2])^(constants[6] > constants[18]); + computedConstants[54] = -constants[1]^(constants[2] > constants[6]); + computedConstants[55] = (constants[1]^^constants[2])^(constants[6] > constants[18]); + computedConstants[56] = (constants[1]^^(1.0/constants[2]))^(constants[6] > constants[18]); + computedConstants[57] = (constants[1] < constants[2])^(constants[6]+constants[18]); + computedConstants[58] = (constants[1] < constants[2])^constants[6]; + computedConstants[59] = (constants[1] < constants[2])^(constants[6]-constants[18]); + computedConstants[60] = (constants[1] < constants[2])^-constants[6]; + computedConstants[61] = (constants[1] < constants[2])^(constants[6]^^constants[18]); + computedConstants[62] = (constants[1] < constants[2])^(constants[6]^^(1.0/constants[18])); + computedConstants[63] = constants[1]/(constants[2]^constants[6]); + computedConstants[64] = !constants[1]; + computedConstants[65] = constants[1]+constants[2]; + computedConstants[66] = constants[1]+constants[2]+constants[6]; + computedConstants[67] = (constants[1] < constants[2])+(constants[6] > constants[18]); + computedConstants[68] = constants[1]; + computedConstants[69] = constants[1]-constants[2]; + computedConstants[70] = (constants[1] < constants[2])-(constants[6] > constants[18]); + computedConstants[71] = (constants[1] < constants[2])-(constants[6]+constants[18]); + computedConstants[72] = (constants[1] < constants[2])-constants[6]; + computedConstants[73] = constants[1]-(-constants[2]); + computedConstants[74] = constants[1]-(-constants[2]*constants[6]); + computedConstants[75] = -constants[1]; + computedConstants[76] = -(constants[1] < constants[2]); + computedConstants[77] = constants[1]*constants[2]; + computedConstants[78] = constants[1]*constants[2]*constants[6]; + computedConstants[79] = (constants[1] < constants[2])*(constants[6] > constants[18]); + computedConstants[80] = (constants[1]+constants[2])*(constants[6] > constants[18]); + computedConstants[81] = constants[1]*(constants[2] > constants[6]); + computedConstants[82] = (constants[1]-constants[2])*(constants[6] > constants[18]); + computedConstants[83] = -constants[1]*(constants[2] > constants[6]); + computedConstants[84] = (constants[1] < constants[2])*(constants[6]+constants[18]); + computedConstants[85] = (constants[1] < constants[2])*constants[6]; + computedConstants[86] = (constants[1] < constants[2])*(constants[6]-constants[18]); + computedConstants[87] = (constants[1] < constants[2])*-constants[6]; + computedConstants[88] = constants[1]/constants[2]; + computedConstants[89] = (constants[1] < constants[2])/(constants[18] > constants[6]); + computedConstants[90] = (constants[1]+constants[2])/(constants[18] > constants[6]); + computedConstants[91] = constants[1]/(constants[6] > constants[2]); + computedConstants[92] = (constants[1]-constants[2])/(constants[18] > constants[6]); + computedConstants[93] = -constants[1]/(constants[6] > constants[2]); + computedConstants[94] = (constants[1] < constants[2])/(constants[6]+constants[18]); + computedConstants[95] = (constants[1] < constants[2])/constants[6]; + computedConstants[96] = (constants[1] < constants[2])/(constants[6]-constants[18]); + computedConstants[97] = (constants[1] < constants[2])/-constants[6]; + computedConstants[98] = (constants[1] < constants[2])/(constants[6]*constants[18]); + computedConstants[99] = (constants[1] < constants[2])/(constants[6]/constants[18]); + computedConstants[100] = sqrt(constants[1]); + computedConstants[101] = sqr(constants[1]); + computedConstants[102] = constants[1]^^3.0; + computedConstants[103] = constants[1]^^constants[2]; + computedConstants[104] = (constants[1] <= constants[2])^^(constants[6] >= constants[18]); + computedConstants[105] = (constants[1]+constants[2])^^(constants[6] >= constants[18]); + computedConstants[106] = constants[1]^^(constants[2] >= constants[6]); + computedConstants[107] = (constants[1]-constants[2])^^(constants[6] >= constants[18]); + computedConstants[108] = (-constants[1])^^(constants[2] >= constants[6]); + computedConstants[109] = (constants[1]*constants[2])^^(constants[6] >= constants[18]); + computedConstants[110] = (constants[1]/constants[2])^^(constants[6] >= constants[18]); + computedConstants[111] = (constants[1] <= constants[2])^^(constants[6]+constants[18]); + computedConstants[112] = (constants[1] <= constants[2])^^constants[6]; + computedConstants[113] = (constants[1] <= constants[2])^^constants[6]-constants[18]; + computedConstants[114] = (constants[1] <= constants[2])^^-constants[6]; + computedConstants[115] = (constants[1] <= constants[2])^^(constants[6]*constants[18]); + computedConstants[116] = (constants[1] <= constants[2])^^(constants[6]/constants[18]); + computedConstants[117] = (constants[1] <= constants[2])^^(constants[6]^^constants[18]); + computedConstants[118] = (constants[1] <= constants[2])^^(constants[6]^^(1.0/constants[18])); + computedConstants[119] = sqrt(constants[1]); + computedConstants[120] = sqrt(constants[1]); + computedConstants[121] = constants[1]^^(1.0/3.0); + computedConstants[122] = constants[1]^^(1.0/constants[2]); + computedConstants[123] = (constants[1] < constants[2])^^(1.0/(constants[18] > constants[6])); + computedConstants[124] = (constants[1]+constants[2])^^(1.0/(constants[18] > constants[6])); + computedConstants[125] = constants[1]^^(1.0/(constants[6] > constants[2])); + computedConstants[126] = (constants[1]-constants[2])^^(1.0/(constants[18] > constants[6])); + computedConstants[127] = (-constants[1])^^(1.0/(constants[6] > constants[2])); + computedConstants[128] = (constants[1]*constants[2])^^(1.0/(constants[18] > constants[6])); + computedConstants[129] = (constants[1]/constants[2])^^(1.0/(constants[18] > constants[6])); + computedConstants[130] = (constants[1] < constants[2])^^(1.0/(constants[6]+constants[18])); + computedConstants[131] = (constants[1] < constants[2])^^(1.0/constants[6]); + computedConstants[132] = (constants[1] < constants[2])^^(1.0/(constants[6]-constants[18])); + computedConstants[133] = (constants[1] < constants[2])^^(1.0/(-constants[6])); + computedConstants[134] = (constants[1] < constants[2])^^(1.0/(constants[6]*constants[18])); + computedConstants[135] = (constants[1] < constants[2])^^(1.0/(constants[6]/constants[18])); + computedConstants[136] = (constants[1] < constants[2])^^(1.0/(constants[6]^^constants[18])); + computedConstants[137] = (constants[1] < constants[2])^^(1.0/(constants[6]^^(1.0/constants[18]))); + computedConstants[138] = fabs(constants[1]); + computedConstants[139] = exp(constants[1]); + computedConstants[140] = log(constants[1]); + computedConstants[141] = log10(constants[1]); + computedConstants[142] = log(constants[1])/log(2.0); + computedConstants[143] = log10(constants[1]); + computedConstants[144] = log(constants[1])/log(constants[2]); + computedConstants[145] = ceil(constants[1]); + computedConstants[146] = floor(constants[1]); + computedConstants[147] = min(constants[1], constants[2]); + computedConstants[148] = min(constants[1], min(constants[2], constants[6])); + computedConstants[149] = max(constants[1], constants[2]); + computedConstants[150] = max(constants[1], max(constants[2], constants[6])); + computedConstants[151] = fmod(constants[1], constants[2]); + computedConstants[152] = sin(constants[1]); + computedConstants[153] = cos(constants[1]); + computedConstants[154] = tan(constants[1]); + computedConstants[155] = sec(constants[1]); + computedConstants[156] = csc(constants[1]); + computedConstants[157] = cot(constants[1]); + computedConstants[158] = sinh(constants[1]); + computedConstants[159] = cosh(constants[1]); + computedConstants[160] = tanh(constants[1]); + computedConstants[161] = sech(constants[1]); + computedConstants[162] = csch(constants[1]); + computedConstants[163] = coth(constants[1]); + computedConstants[164] = asin(constants[1]); + computedConstants[165] = acos(constants[1]); + computedConstants[166] = atan(constants[1]); + computedConstants[167] = asec(constants[1]); + computedConstants[168] = acsc(constants[1]); + computedConstants[169] = acot(constants[1]); + computedConstants[170] = asinh(constants[1]); + computedConstants[171] = acosh(constants[1]); + computedConstants[172] = atanh(constants[1]/2.0); + computedConstants[173] = asech(constants[1]); + computedConstants[174] = acsch(constants[1]); + computedConstants[175] = acoth(2.0*constants[1]); + computedConstants[176] = piecewise(constants[1] > constants[2], constants[1], NAN); + computedConstants[177] = piecewise(constants[1] > constants[2], constants[1], constants[6]); + computedConstants[178] = piecewise(constants[1] > constants[2], constants[1], piecewise(constants[6] > constants[18], constants[6], piecewise(constants[179] > constants[180], constants[179], NAN))); + computedConstants[181] = piecewise(constants[1] > constants[2], constants[1], piecewise(constants[6] > constants[18], constants[6], piecewise(constants[179] > constants[180], constants[179], constants[182]))); + computedConstants[183] = 123.0+piecewise(constants[1] > constants[2], constants[1], NAN); + computedConstants[188] = constants[1]; + computedConstants[195] = (constants[1] && constants[2])+piecewise(constants[6] > constants[18], constants[2], NAN)+constants[179]+(constants[180] && constants[182]); + computedConstants[196] = (constants[1] && constants[2])-(piecewise(constants[6] > constants[18], constants[2], NAN)-(constants[179]-piecewise(constants[6] > constants[18], constants[2], NAN)))-(constants[180] && constants[182]); + computedConstants[197] = (constants[1] && constants[2])*piecewise(constants[6] > constants[18], constants[2], NAN)*constants[179]*piecewise(constants[6] > constants[18], constants[2], NAN)*(constants[180] && constants[182]); + computedConstants[198] = (constants[1] && constants[2])/(piecewise(constants[6] > constants[18], constants[2], NAN)/(constants[179]/piecewise(constants[6] > constants[18], constants[2], NAN))); + computedConstants[199] = (constants[1] || constants[2]) && (constants[1]^constants[2]) && piecewise(constants[6] > constants[18], constants[2], NAN) && constants[179] && piecewise(constants[6] > constants[18], constants[2], NAN) && (constants[1]^constants[2]) && (constants[1] || constants[2]); + computedConstants[200] = (constants[1] && constants[2]) || (constants[1]^constants[2]) || piecewise(constants[6] > constants[18], constants[2], NAN) || constants[179] || piecewise(constants[6] > constants[18], constants[2], NAN) || (constants[1]^constants[2]) || (constants[1] && constants[2]); + computedConstants[201] = (constants[1] && constants[2])^(constants[1] || constants[2])^piecewise(constants[6] > constants[18], constants[2], NAN)^constants[179]^piecewise(constants[6] > constants[18], constants[2], NAN)^(constants[1] || constants[2])^(constants[1] && constants[2]); + computedConstants[202] = (constants[1] && constants[2])^^(piecewise(constants[6] > constants[18], constants[2], NAN)^^(constants[179]^^piecewise(constants[6] > constants[18], constants[2], NAN)^^(constants[1] && constants[2]))); + computedConstants[203] = (constants[1] && constants[2])^^(1.0/(piecewise(constants[6] > constants[18], constants[2], NAN)^^(1.0/constants[179])))^^(1.0/piecewise(constants[6] > constants[18], constants[2], NAN))^^(1.0/(constants[1] && constants[2])); + computedConstants[204] = -(constants[1] && constants[2])+-piecewise(constants[6] > constants[18], constants[2], NAN); } void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) diff --git a/tests/resources/coverage/generator/model.py b/tests/resources/coverage/generator/model.py index 1a6049e40a..acbe541a58 100644 --- a/tests/resources/coverage/generator/model.py +++ b/tests/resources/coverage/generator/model.py @@ -359,239 +359,239 @@ def objective_function_0(u, f, data): rates = data[2] variables = data[3] - variables[205] = u[0] - variables[206] = u[1] + algebraic[205] = u[0] + algebraic[206] = u[1] - f[0] = variables[205]+variables[206]+states[0]-0.0 - f[1] = variables[205]-variables[206]-(variables[207]+variables[208]) + f[0] = algebraic[205]+algebraic[206]+states[0]-0.0 + f[1] = algebraic[205]-algebraic[206]-(computed_constants[207]+computed_constants[208]) def find_root_0(voi, states, rates, variables): u = [nan]*2 - u[0] = variables[205] - u[1] = variables[206] + u[0] = algebraic[205] + u[1] = algebraic[206] u = nla_solve(objective_function_0, u, 2, [voi, states, rates, variables]) - variables[205] = u[0] - variables[206] = u[1] + algebraic[205] = u[0] + algebraic[206] = u[1] def initialise_variables(states, rates, constants): - variables[1] = 1.0 - variables[2] = 2.0 - variables[6] = 3.0 - variables[18] = 4.0 - variables[179] = 5.0 - variables[180] = 6.0 - variables[182] = 7.0 - variables[205] = 1.0 - variables[206] = 2.0 - variables[184] = 123.0 - variables[185] = 123.456789 - variables[186] = 123.0e99 - variables[187] = 123.456789e99 - variables[189] = 1.0 - variables[190] = 0.0 - variables[191] = 2.71828182845905 - variables[192] = 3.14159265358979 - variables[193] = inf - variables[194] = nan - variables[207] = 1.0 - variables[208] = 3.0 + constants[1] = 1.0 + constants[2] = 2.0 + constants[6] = 3.0 + constants[18] = 4.0 + constants[179] = 5.0 + constants[180] = 6.0 + constants[182] = 7.0 + algebraic[205] = 1.0 + algebraic[206] = 2.0 + computed_constants[184] = 123.0 + computed_constants[185] = 123.456789 + computed_constants[186] = 123.0e99 + computed_constants[187] = 123.456789e99 + computed_constants[189] = 1.0 + computed_constants[190] = 0.0 + computed_constants[191] = 2.71828182845905 + computed_constants[192] = 3.14159265358979 + computed_constants[193] = inf + computed_constants[194] = nan + computed_constants[207] = 1.0 + computed_constants[208] = 3.0 states[0] = 0.0 def compute_computed_constants(constants, computed_constants): - variables[0] = eq_func(variables[1], variables[2]) - variables[3] = variables[1]/eq_func(variables[2], variables[2]) - variables[4] = neq_func(variables[1], variables[2]) - variables[5] = variables[1]/neq_func(variables[2], variables[6]) - variables[7] = lt_func(variables[1], variables[2]) - variables[8] = variables[1]/lt_func(variables[2], variables[6]) - variables[9] = leq_func(variables[1], variables[2]) - variables[10] = variables[1]/leq_func(variables[2], variables[6]) - variables[11] = gt_func(variables[1], variables[2]) - variables[12] = variables[1]/gt_func(variables[2], variables[6]) - variables[13] = geq_func(variables[1], variables[2]) - variables[14] = variables[1]/geq_func(variables[2], variables[6]) - variables[15] = and_func(variables[1], variables[2]) - variables[16] = and_func(variables[1], and_func(variables[2], variables[6])) - variables[17] = and_func(lt_func(variables[1], variables[2]), gt_func(variables[6], variables[18])) - variables[19] = and_func(variables[1]+variables[2], gt_func(variables[6], variables[18])) - variables[20] = and_func(variables[1], gt_func(variables[2], variables[6])) - variables[21] = and_func(variables[1]-variables[2], gt_func(variables[6], variables[18])) - variables[22] = and_func(-variables[1], gt_func(variables[2], variables[6])) - variables[23] = and_func(pow(variables[1], variables[2]), gt_func(variables[6], variables[18])) - variables[24] = and_func(pow(variables[1], 1.0/variables[2]), gt_func(variables[6], variables[18])) - variables[25] = and_func(lt_func(variables[1], variables[2]), variables[6]+variables[18]) - variables[26] = and_func(lt_func(variables[1], variables[2]), variables[6]) - variables[27] = and_func(lt_func(variables[1], variables[2]), variables[6]-variables[18]) - variables[28] = and_func(lt_func(variables[1], variables[2]), -variables[6]) - variables[29] = and_func(lt_func(variables[1], variables[2]), pow(variables[6], variables[18])) - variables[30] = and_func(lt_func(variables[1], variables[2]), pow(variables[6], 1.0/variables[18])) - variables[31] = variables[1]/and_func(variables[2], variables[6]) - variables[32] = or_func(variables[1], variables[2]) - variables[33] = or_func(variables[1], or_func(variables[2], variables[6])) - variables[34] = or_func(lt_func(variables[1], variables[2]), gt_func(variables[6], variables[18])) - variables[35] = or_func(variables[1]+variables[2], gt_func(variables[6], variables[18])) - variables[36] = or_func(variables[1], gt_func(variables[2], variables[6])) - variables[37] = or_func(variables[1]-variables[2], gt_func(variables[6], variables[18])) - variables[38] = or_func(-variables[1], gt_func(variables[2], variables[6])) - variables[39] = or_func(pow(variables[1], variables[2]), gt_func(variables[6], variables[18])) - variables[40] = or_func(pow(variables[1], 1.0/variables[2]), gt_func(variables[6], variables[18])) - variables[41] = or_func(lt_func(variables[1], variables[2]), variables[6]+variables[18]) - variables[42] = or_func(lt_func(variables[1], variables[2]), variables[6]) - variables[43] = or_func(lt_func(variables[1], variables[2]), variables[6]-variables[18]) - variables[44] = or_func(lt_func(variables[1], variables[2]), -variables[6]) - variables[45] = or_func(lt_func(variables[1], variables[2]), pow(variables[6], variables[18])) - variables[46] = or_func(lt_func(variables[1], variables[2]), pow(variables[6], 1.0/variables[18])) - variables[47] = variables[1]/or_func(variables[2], variables[6]) - variables[48] = xor_func(variables[1], variables[2]) - variables[49] = xor_func(variables[1], xor_func(variables[2], variables[6])) - variables[50] = xor_func(lt_func(variables[1], variables[2]), gt_func(variables[6], variables[18])) - variables[51] = xor_func(variables[1]+variables[2], gt_func(variables[6], variables[18])) - variables[52] = xor_func(variables[1], gt_func(variables[2], variables[6])) - variables[53] = xor_func(variables[1]-variables[2], gt_func(variables[6], variables[18])) - variables[54] = xor_func(-variables[1], gt_func(variables[2], variables[6])) - variables[55] = xor_func(pow(variables[1], variables[2]), gt_func(variables[6], variables[18])) - variables[56] = xor_func(pow(variables[1], 1.0/variables[2]), gt_func(variables[6], variables[18])) - variables[57] = xor_func(lt_func(variables[1], variables[2]), variables[6]+variables[18]) - variables[58] = xor_func(lt_func(variables[1], variables[2]), variables[6]) - variables[59] = xor_func(lt_func(variables[1], variables[2]), variables[6]-variables[18]) - variables[60] = xor_func(lt_func(variables[1], variables[2]), -variables[6]) - variables[61] = xor_func(lt_func(variables[1], variables[2]), pow(variables[6], variables[18])) - variables[62] = xor_func(lt_func(variables[1], variables[2]), pow(variables[6], 1.0/variables[18])) - variables[63] = variables[1]/xor_func(variables[2], variables[6]) - variables[64] = not_func(variables[1]) - variables[65] = variables[1]+variables[2] - variables[66] = variables[1]+variables[2]+variables[6] - variables[67] = lt_func(variables[1], variables[2])+gt_func(variables[6], variables[18]) - variables[68] = variables[1] - variables[69] = variables[1]-variables[2] - variables[70] = lt_func(variables[1], variables[2])-gt_func(variables[6], variables[18]) - variables[71] = lt_func(variables[1], variables[2])-(variables[6]+variables[18]) - variables[72] = lt_func(variables[1], variables[2])-variables[6] - variables[73] = variables[1]-(-variables[2]) - variables[74] = variables[1]-(-variables[2]*variables[6]) - variables[75] = -variables[1] - variables[76] = -lt_func(variables[1], variables[2]) - variables[77] = variables[1]*variables[2] - variables[78] = variables[1]*variables[2]*variables[6] - variables[79] = lt_func(variables[1], variables[2])*gt_func(variables[6], variables[18]) - variables[80] = (variables[1]+variables[2])*gt_func(variables[6], variables[18]) - variables[81] = variables[1]*gt_func(variables[2], variables[6]) - variables[82] = (variables[1]-variables[2])*gt_func(variables[6], variables[18]) - variables[83] = -variables[1]*gt_func(variables[2], variables[6]) - variables[84] = lt_func(variables[1], variables[2])*(variables[6]+variables[18]) - variables[85] = lt_func(variables[1], variables[2])*variables[6] - variables[86] = lt_func(variables[1], variables[2])*(variables[6]-variables[18]) - variables[87] = lt_func(variables[1], variables[2])*-variables[6] - variables[88] = variables[1]/variables[2] - variables[89] = lt_func(variables[1], variables[2])/gt_func(variables[18], variables[6]) - variables[90] = (variables[1]+variables[2])/gt_func(variables[18], variables[6]) - variables[91] = variables[1]/gt_func(variables[6], variables[2]) - variables[92] = (variables[1]-variables[2])/gt_func(variables[18], variables[6]) - variables[93] = -variables[1]/gt_func(variables[6], variables[2]) - variables[94] = lt_func(variables[1], variables[2])/(variables[6]+variables[18]) - variables[95] = lt_func(variables[1], variables[2])/variables[6] - variables[96] = lt_func(variables[1], variables[2])/(variables[6]-variables[18]) - variables[97] = lt_func(variables[1], variables[2])/-variables[6] - variables[98] = lt_func(variables[1], variables[2])/(variables[6]*variables[18]) - variables[99] = lt_func(variables[1], variables[2])/(variables[6]/variables[18]) - variables[100] = sqrt(variables[1]) - variables[101] = pow(variables[1], 2.0) - variables[102] = pow(variables[1], 3.0) - variables[103] = pow(variables[1], variables[2]) - variables[104] = pow(leq_func(variables[1], variables[2]), geq_func(variables[6], variables[18])) - variables[105] = pow(variables[1]+variables[2], geq_func(variables[6], variables[18])) - variables[106] = pow(variables[1], geq_func(variables[2], variables[6])) - variables[107] = pow(variables[1]-variables[2], geq_func(variables[6], variables[18])) - variables[108] = pow(-variables[1], geq_func(variables[2], variables[6])) - variables[109] = pow(variables[1]*variables[2], geq_func(variables[6], variables[18])) - variables[110] = pow(variables[1]/variables[2], geq_func(variables[6], variables[18])) - variables[111] = pow(leq_func(variables[1], variables[2]), variables[6]+variables[18]) - variables[112] = pow(leq_func(variables[1], variables[2]), variables[6]) - variables[113] = pow(leq_func(variables[1], variables[2]), variables[6]-variables[18]) - variables[114] = pow(leq_func(variables[1], variables[2]), -variables[6]) - variables[115] = pow(leq_func(variables[1], variables[2]), variables[6]*variables[18]) - variables[116] = pow(leq_func(variables[1], variables[2]), variables[6]/variables[18]) - variables[117] = pow(leq_func(variables[1], variables[2]), pow(variables[6], variables[18])) - variables[118] = pow(leq_func(variables[1], variables[2]), pow(variables[6], 1.0/variables[18])) - variables[119] = sqrt(variables[1]) - variables[120] = sqrt(variables[1]) - variables[121] = pow(variables[1], 1.0/3.0) - variables[122] = pow(variables[1], 1.0/variables[2]) - variables[123] = pow(lt_func(variables[1], variables[2]), 1.0/gt_func(variables[18], variables[6])) - variables[124] = pow(variables[1]+variables[2], 1.0/gt_func(variables[18], variables[6])) - variables[125] = pow(variables[1], 1.0/gt_func(variables[6], variables[2])) - variables[126] = pow(variables[1]-variables[2], 1.0/gt_func(variables[18], variables[6])) - variables[127] = pow(-variables[1], 1.0/gt_func(variables[6], variables[2])) - variables[128] = pow(variables[1]*variables[2], 1.0/gt_func(variables[18], variables[6])) - variables[129] = pow(variables[1]/variables[2], 1.0/gt_func(variables[18], variables[6])) - variables[130] = pow(lt_func(variables[1], variables[2]), 1.0/(variables[6]+variables[18])) - variables[131] = pow(lt_func(variables[1], variables[2]), 1.0/variables[6]) - variables[132] = pow(lt_func(variables[1], variables[2]), 1.0/(variables[6]-variables[18])) - variables[133] = pow(lt_func(variables[1], variables[2]), 1.0/-variables[6]) - variables[134] = pow(lt_func(variables[1], variables[2]), 1.0/(variables[6]*variables[18])) - variables[135] = pow(lt_func(variables[1], variables[2]), 1.0/(variables[6]/variables[18])) - variables[136] = pow(lt_func(variables[1], variables[2]), 1.0/pow(variables[6], variables[18])) - variables[137] = pow(lt_func(variables[1], variables[2]), 1.0/pow(variables[6], 1.0/variables[18])) - variables[138] = fabs(variables[1]) - variables[139] = exp(variables[1]) - variables[140] = log(variables[1]) - variables[141] = log10(variables[1]) - variables[142] = log(variables[1])/log(2.0) - variables[143] = log10(variables[1]) - variables[144] = log(variables[1])/log(variables[2]) - variables[145] = ceil(variables[1]) - variables[146] = floor(variables[1]) - variables[147] = min(variables[1], variables[2]) - variables[148] = min(variables[1], min(variables[2], variables[6])) - variables[149] = max(variables[1], variables[2]) - variables[150] = max(variables[1], max(variables[2], variables[6])) - variables[151] = fmod(variables[1], variables[2]) - variables[152] = sin(variables[1]) - variables[153] = cos(variables[1]) - variables[154] = tan(variables[1]) - variables[155] = sec(variables[1]) - variables[156] = csc(variables[1]) - variables[157] = cot(variables[1]) - variables[158] = sinh(variables[1]) - variables[159] = cosh(variables[1]) - variables[160] = tanh(variables[1]) - variables[161] = sech(variables[1]) - variables[162] = csch(variables[1]) - variables[163] = coth(variables[1]) - variables[164] = asin(variables[1]) - variables[165] = acos(variables[1]) - variables[166] = atan(variables[1]) - variables[167] = asec(variables[1]) - variables[168] = acsc(variables[1]) - variables[169] = acot(variables[1]) - variables[170] = asinh(variables[1]) - variables[171] = acosh(variables[1]) - variables[172] = atanh(variables[1]/2.0) - variables[173] = asech(variables[1]) - variables[174] = acsch(variables[1]) - variables[175] = acoth(2.0*variables[1]) - variables[176] = variables[1] if gt_func(variables[1], variables[2]) else nan - variables[177] = variables[1] if gt_func(variables[1], variables[2]) else variables[6] - variables[178] = variables[1] if gt_func(variables[1], variables[2]) else variables[6] if gt_func(variables[6], variables[18]) else variables[179] if gt_func(variables[179], variables[180]) else nan - variables[181] = variables[1] if gt_func(variables[1], variables[2]) else variables[6] if gt_func(variables[6], variables[18]) else variables[179] if gt_func(variables[179], variables[180]) else variables[182] - variables[183] = 123.0+(variables[1] if gt_func(variables[1], variables[2]) else nan) - variables[188] = variables[1] - variables[195] = and_func(variables[1], variables[2])+(variables[2] if gt_func(variables[6], variables[18]) else nan)+variables[179]+and_func(variables[180], variables[182]) - variables[196] = and_func(variables[1], variables[2])-((variables[2] if gt_func(variables[6], variables[18]) else nan)-(variables[179]-(variables[2] if gt_func(variables[6], variables[18]) else nan)))-and_func(variables[180], variables[182]) - variables[197] = and_func(variables[1], variables[2])*(variables[2] if gt_func(variables[6], variables[18]) else nan)*variables[179]*(variables[2] if gt_func(variables[6], variables[18]) else nan)*and_func(variables[180], variables[182]) - variables[198] = and_func(variables[1], variables[2])/((variables[2] if gt_func(variables[6], variables[18]) else nan)/(variables[179]/(variables[2] if gt_func(variables[6], variables[18]) else nan))) - variables[199] = and_func(or_func(variables[1], variables[2]), and_func(xor_func(variables[1], variables[2]), and_func(variables[2] if gt_func(variables[6], variables[18]) else nan, and_func(and_func(and_func(variables[179], variables[2] if gt_func(variables[6], variables[18]) else nan), xor_func(variables[1], variables[2])), or_func(variables[1], variables[2]))))) - variables[200] = or_func(and_func(variables[1], variables[2]), or_func(xor_func(variables[1], variables[2]), or_func(variables[2] if gt_func(variables[6], variables[18]) else nan, or_func(or_func(or_func(variables[179], variables[2] if gt_func(variables[6], variables[18]) else nan), xor_func(variables[1], variables[2])), and_func(variables[1], variables[2]))))) - variables[201] = xor_func(and_func(variables[1], variables[2]), xor_func(or_func(variables[1], variables[2]), xor_func(variables[2] if gt_func(variables[6], variables[18]) else nan, xor_func(xor_func(xor_func(variables[179], variables[2] if gt_func(variables[6], variables[18]) else nan), or_func(variables[1], variables[2])), and_func(variables[1], variables[2]))))) - variables[202] = pow(and_func(variables[1], variables[2]), pow(variables[2] if gt_func(variables[6], variables[18]) else nan, pow(pow(variables[179], variables[2] if gt_func(variables[6], variables[18]) else nan), and_func(variables[1], variables[2])))) - variables[203] = pow(pow(pow(and_func(variables[1], variables[2]), 1.0/pow(variables[2] if gt_func(variables[6], variables[18]) else nan, 1.0/variables[179])), 1.0/(variables[2] if gt_func(variables[6], variables[18]) else nan)), 1.0/and_func(variables[1], variables[2])) - variables[204] = -and_func(variables[1], variables[2])+-(variables[2] if gt_func(variables[6], variables[18]) else nan) + computed_constants[0] = eq_func(constants[1], constants[2]) + computed_constants[3] = constants[1]/eq_func(constants[2], constants[2]) + computed_constants[4] = neq_func(constants[1], constants[2]) + computed_constants[5] = constants[1]/neq_func(constants[2], constants[6]) + computed_constants[7] = lt_func(constants[1], constants[2]) + computed_constants[8] = constants[1]/lt_func(constants[2], constants[6]) + computed_constants[9] = leq_func(constants[1], constants[2]) + computed_constants[10] = constants[1]/leq_func(constants[2], constants[6]) + computed_constants[11] = gt_func(constants[1], constants[2]) + computed_constants[12] = constants[1]/gt_func(constants[2], constants[6]) + computed_constants[13] = geq_func(constants[1], constants[2]) + computed_constants[14] = constants[1]/geq_func(constants[2], constants[6]) + computed_constants[15] = and_func(constants[1], constants[2]) + computed_constants[16] = and_func(constants[1], and_func(constants[2], constants[6])) + computed_constants[17] = and_func(lt_func(constants[1], constants[2]), gt_func(constants[6], constants[18])) + computed_constants[19] = and_func(constants[1]+constants[2], gt_func(constants[6], constants[18])) + computed_constants[20] = and_func(constants[1], gt_func(constants[2], constants[6])) + computed_constants[21] = and_func(constants[1]-constants[2], gt_func(constants[6], constants[18])) + computed_constants[22] = and_func(-constants[1], gt_func(constants[2], constants[6])) + computed_constants[23] = and_func(pow(constants[1], constants[2]), gt_func(constants[6], constants[18])) + computed_constants[24] = and_func(pow(constants[1], 1.0/constants[2]), gt_func(constants[6], constants[18])) + computed_constants[25] = and_func(lt_func(constants[1], constants[2]), constants[6]+constants[18]) + computed_constants[26] = and_func(lt_func(constants[1], constants[2]), constants[6]) + computed_constants[27] = and_func(lt_func(constants[1], constants[2]), constants[6]-constants[18]) + computed_constants[28] = and_func(lt_func(constants[1], constants[2]), -constants[6]) + computed_constants[29] = and_func(lt_func(constants[1], constants[2]), pow(constants[6], constants[18])) + computed_constants[30] = and_func(lt_func(constants[1], constants[2]), pow(constants[6], 1.0/constants[18])) + computed_constants[31] = constants[1]/and_func(constants[2], constants[6]) + computed_constants[32] = or_func(constants[1], constants[2]) + computed_constants[33] = or_func(constants[1], or_func(constants[2], constants[6])) + computed_constants[34] = or_func(lt_func(constants[1], constants[2]), gt_func(constants[6], constants[18])) + computed_constants[35] = or_func(constants[1]+constants[2], gt_func(constants[6], constants[18])) + computed_constants[36] = or_func(constants[1], gt_func(constants[2], constants[6])) + computed_constants[37] = or_func(constants[1]-constants[2], gt_func(constants[6], constants[18])) + computed_constants[38] = or_func(-constants[1], gt_func(constants[2], constants[6])) + computed_constants[39] = or_func(pow(constants[1], constants[2]), gt_func(constants[6], constants[18])) + computed_constants[40] = or_func(pow(constants[1], 1.0/constants[2]), gt_func(constants[6], constants[18])) + computed_constants[41] = or_func(lt_func(constants[1], constants[2]), constants[6]+constants[18]) + computed_constants[42] = or_func(lt_func(constants[1], constants[2]), constants[6]) + computed_constants[43] = or_func(lt_func(constants[1], constants[2]), constants[6]-constants[18]) + computed_constants[44] = or_func(lt_func(constants[1], constants[2]), -constants[6]) + computed_constants[45] = or_func(lt_func(constants[1], constants[2]), pow(constants[6], constants[18])) + computed_constants[46] = or_func(lt_func(constants[1], constants[2]), pow(constants[6], 1.0/constants[18])) + computed_constants[47] = constants[1]/or_func(constants[2], constants[6]) + computed_constants[48] = xor_func(constants[1], constants[2]) + computed_constants[49] = xor_func(constants[1], xor_func(constants[2], constants[6])) + computed_constants[50] = xor_func(lt_func(constants[1], constants[2]), gt_func(constants[6], constants[18])) + computed_constants[51] = xor_func(constants[1]+constants[2], gt_func(constants[6], constants[18])) + computed_constants[52] = xor_func(constants[1], gt_func(constants[2], constants[6])) + computed_constants[53] = xor_func(constants[1]-constants[2], gt_func(constants[6], constants[18])) + computed_constants[54] = xor_func(-constants[1], gt_func(constants[2], constants[6])) + computed_constants[55] = xor_func(pow(constants[1], constants[2]), gt_func(constants[6], constants[18])) + computed_constants[56] = xor_func(pow(constants[1], 1.0/constants[2]), gt_func(constants[6], constants[18])) + computed_constants[57] = xor_func(lt_func(constants[1], constants[2]), constants[6]+constants[18]) + computed_constants[58] = xor_func(lt_func(constants[1], constants[2]), constants[6]) + computed_constants[59] = xor_func(lt_func(constants[1], constants[2]), constants[6]-constants[18]) + computed_constants[60] = xor_func(lt_func(constants[1], constants[2]), -constants[6]) + computed_constants[61] = xor_func(lt_func(constants[1], constants[2]), pow(constants[6], constants[18])) + computed_constants[62] = xor_func(lt_func(constants[1], constants[2]), pow(constants[6], 1.0/constants[18])) + computed_constants[63] = constants[1]/xor_func(constants[2], constants[6]) + computed_constants[64] = not_func(constants[1]) + computed_constants[65] = constants[1]+constants[2] + computed_constants[66] = constants[1]+constants[2]+constants[6] + computed_constants[67] = lt_func(constants[1], constants[2])+gt_func(constants[6], constants[18]) + computed_constants[68] = constants[1] + computed_constants[69] = constants[1]-constants[2] + computed_constants[70] = lt_func(constants[1], constants[2])-gt_func(constants[6], constants[18]) + computed_constants[71] = lt_func(constants[1], constants[2])-(constants[6]+constants[18]) + computed_constants[72] = lt_func(constants[1], constants[2])-constants[6] + computed_constants[73] = constants[1]-(-constants[2]) + computed_constants[74] = constants[1]-(-constants[2]*constants[6]) + computed_constants[75] = -constants[1] + computed_constants[76] = -lt_func(constants[1], constants[2]) + computed_constants[77] = constants[1]*constants[2] + computed_constants[78] = constants[1]*constants[2]*constants[6] + computed_constants[79] = lt_func(constants[1], constants[2])*gt_func(constants[6], constants[18]) + computed_constants[80] = (constants[1]+constants[2])*gt_func(constants[6], constants[18]) + computed_constants[81] = constants[1]*gt_func(constants[2], constants[6]) + computed_constants[82] = (constants[1]-constants[2])*gt_func(constants[6], constants[18]) + computed_constants[83] = -constants[1]*gt_func(constants[2], constants[6]) + computed_constants[84] = lt_func(constants[1], constants[2])*(constants[6]+constants[18]) + computed_constants[85] = lt_func(constants[1], constants[2])*constants[6] + computed_constants[86] = lt_func(constants[1], constants[2])*(constants[6]-constants[18]) + computed_constants[87] = lt_func(constants[1], constants[2])*-constants[6] + computed_constants[88] = constants[1]/constants[2] + computed_constants[89] = lt_func(constants[1], constants[2])/gt_func(constants[18], constants[6]) + computed_constants[90] = (constants[1]+constants[2])/gt_func(constants[18], constants[6]) + computed_constants[91] = constants[1]/gt_func(constants[6], constants[2]) + computed_constants[92] = (constants[1]-constants[2])/gt_func(constants[18], constants[6]) + computed_constants[93] = -constants[1]/gt_func(constants[6], constants[2]) + computed_constants[94] = lt_func(constants[1], constants[2])/(constants[6]+constants[18]) + computed_constants[95] = lt_func(constants[1], constants[2])/constants[6] + computed_constants[96] = lt_func(constants[1], constants[2])/(constants[6]-constants[18]) + computed_constants[97] = lt_func(constants[1], constants[2])/-constants[6] + computed_constants[98] = lt_func(constants[1], constants[2])/(constants[6]*constants[18]) + computed_constants[99] = lt_func(constants[1], constants[2])/(constants[6]/constants[18]) + computed_constants[100] = sqrt(constants[1]) + computed_constants[101] = pow(constants[1], 2.0) + computed_constants[102] = pow(constants[1], 3.0) + computed_constants[103] = pow(constants[1], constants[2]) + computed_constants[104] = pow(leq_func(constants[1], constants[2]), geq_func(constants[6], constants[18])) + computed_constants[105] = pow(constants[1]+constants[2], geq_func(constants[6], constants[18])) + computed_constants[106] = pow(constants[1], geq_func(constants[2], constants[6])) + computed_constants[107] = pow(constants[1]-constants[2], geq_func(constants[6], constants[18])) + computed_constants[108] = pow(-constants[1], geq_func(constants[2], constants[6])) + computed_constants[109] = pow(constants[1]*constants[2], geq_func(constants[6], constants[18])) + computed_constants[110] = pow(constants[1]/constants[2], geq_func(constants[6], constants[18])) + computed_constants[111] = pow(leq_func(constants[1], constants[2]), constants[6]+constants[18]) + computed_constants[112] = pow(leq_func(constants[1], constants[2]), constants[6]) + computed_constants[113] = pow(leq_func(constants[1], constants[2]), constants[6]-constants[18]) + computed_constants[114] = pow(leq_func(constants[1], constants[2]), -constants[6]) + computed_constants[115] = pow(leq_func(constants[1], constants[2]), constants[6]*constants[18]) + computed_constants[116] = pow(leq_func(constants[1], constants[2]), constants[6]/constants[18]) + computed_constants[117] = pow(leq_func(constants[1], constants[2]), pow(constants[6], constants[18])) + computed_constants[118] = pow(leq_func(constants[1], constants[2]), pow(constants[6], 1.0/constants[18])) + computed_constants[119] = sqrt(constants[1]) + computed_constants[120] = sqrt(constants[1]) + computed_constants[121] = pow(constants[1], 1.0/3.0) + computed_constants[122] = pow(constants[1], 1.0/constants[2]) + computed_constants[123] = pow(lt_func(constants[1], constants[2]), 1.0/gt_func(constants[18], constants[6])) + computed_constants[124] = pow(constants[1]+constants[2], 1.0/gt_func(constants[18], constants[6])) + computed_constants[125] = pow(constants[1], 1.0/gt_func(constants[6], constants[2])) + computed_constants[126] = pow(constants[1]-constants[2], 1.0/gt_func(constants[18], constants[6])) + computed_constants[127] = pow(-constants[1], 1.0/gt_func(constants[6], constants[2])) + computed_constants[128] = pow(constants[1]*constants[2], 1.0/gt_func(constants[18], constants[6])) + computed_constants[129] = pow(constants[1]/constants[2], 1.0/gt_func(constants[18], constants[6])) + computed_constants[130] = pow(lt_func(constants[1], constants[2]), 1.0/(constants[6]+constants[18])) + computed_constants[131] = pow(lt_func(constants[1], constants[2]), 1.0/constants[6]) + computed_constants[132] = pow(lt_func(constants[1], constants[2]), 1.0/(constants[6]-constants[18])) + computed_constants[133] = pow(lt_func(constants[1], constants[2]), 1.0/-constants[6]) + computed_constants[134] = pow(lt_func(constants[1], constants[2]), 1.0/(constants[6]*constants[18])) + computed_constants[135] = pow(lt_func(constants[1], constants[2]), 1.0/(constants[6]/constants[18])) + computed_constants[136] = pow(lt_func(constants[1], constants[2]), 1.0/pow(constants[6], constants[18])) + computed_constants[137] = pow(lt_func(constants[1], constants[2]), 1.0/pow(constants[6], 1.0/constants[18])) + computed_constants[138] = fabs(constants[1]) + computed_constants[139] = exp(constants[1]) + computed_constants[140] = log(constants[1]) + computed_constants[141] = log10(constants[1]) + computed_constants[142] = log(constants[1])/log(2.0) + computed_constants[143] = log10(constants[1]) + computed_constants[144] = log(constants[1])/log(constants[2]) + computed_constants[145] = ceil(constants[1]) + computed_constants[146] = floor(constants[1]) + computed_constants[147] = min(constants[1], constants[2]) + computed_constants[148] = min(constants[1], min(constants[2], constants[6])) + computed_constants[149] = max(constants[1], constants[2]) + computed_constants[150] = max(constants[1], max(constants[2], constants[6])) + computed_constants[151] = fmod(constants[1], constants[2]) + computed_constants[152] = sin(constants[1]) + computed_constants[153] = cos(constants[1]) + computed_constants[154] = tan(constants[1]) + computed_constants[155] = sec(constants[1]) + computed_constants[156] = csc(constants[1]) + computed_constants[157] = cot(constants[1]) + computed_constants[158] = sinh(constants[1]) + computed_constants[159] = cosh(constants[1]) + computed_constants[160] = tanh(constants[1]) + computed_constants[161] = sech(constants[1]) + computed_constants[162] = csch(constants[1]) + computed_constants[163] = coth(constants[1]) + computed_constants[164] = asin(constants[1]) + computed_constants[165] = acos(constants[1]) + computed_constants[166] = atan(constants[1]) + computed_constants[167] = asec(constants[1]) + computed_constants[168] = acsc(constants[1]) + computed_constants[169] = acot(constants[1]) + computed_constants[170] = asinh(constants[1]) + computed_constants[171] = acosh(constants[1]) + computed_constants[172] = atanh(constants[1]/2.0) + computed_constants[173] = asech(constants[1]) + computed_constants[174] = acsch(constants[1]) + computed_constants[175] = acoth(2.0*constants[1]) + computed_constants[176] = constants[1] if gt_func(constants[1], constants[2]) else nan + computed_constants[177] = constants[1] if gt_func(constants[1], constants[2]) else constants[6] + computed_constants[178] = constants[1] if gt_func(constants[1], constants[2]) else constants[6] if gt_func(constants[6], constants[18]) else constants[179] if gt_func(constants[179], constants[180]) else nan + computed_constants[181] = constants[1] if gt_func(constants[1], constants[2]) else constants[6] if gt_func(constants[6], constants[18]) else constants[179] if gt_func(constants[179], constants[180]) else constants[182] + computed_constants[183] = 123.0+(constants[1] if gt_func(constants[1], constants[2]) else nan) + computed_constants[188] = constants[1] + computed_constants[195] = and_func(constants[1], constants[2])+(constants[2] if gt_func(constants[6], constants[18]) else nan)+constants[179]+and_func(constants[180], constants[182]) + computed_constants[196] = and_func(constants[1], constants[2])-((constants[2] if gt_func(constants[6], constants[18]) else nan)-(constants[179]-(constants[2] if gt_func(constants[6], constants[18]) else nan)))-and_func(constants[180], constants[182]) + computed_constants[197] = and_func(constants[1], constants[2])*(constants[2] if gt_func(constants[6], constants[18]) else nan)*constants[179]*(constants[2] if gt_func(constants[6], constants[18]) else nan)*and_func(constants[180], constants[182]) + computed_constants[198] = and_func(constants[1], constants[2])/((constants[2] if gt_func(constants[6], constants[18]) else nan)/(constants[179]/(constants[2] if gt_func(constants[6], constants[18]) else nan))) + computed_constants[199] = and_func(or_func(constants[1], constants[2]), and_func(xor_func(constants[1], constants[2]), and_func(constants[2] if gt_func(constants[6], constants[18]) else nan, and_func(and_func(and_func(constants[179], constants[2] if gt_func(constants[6], constants[18]) else nan), xor_func(constants[1], constants[2])), or_func(constants[1], constants[2]))))) + computed_constants[200] = or_func(and_func(constants[1], constants[2]), or_func(xor_func(constants[1], constants[2]), or_func(constants[2] if gt_func(constants[6], constants[18]) else nan, or_func(or_func(or_func(constants[179], constants[2] if gt_func(constants[6], constants[18]) else nan), xor_func(constants[1], constants[2])), and_func(constants[1], constants[2]))))) + computed_constants[201] = xor_func(and_func(constants[1], constants[2]), xor_func(or_func(constants[1], constants[2]), xor_func(constants[2] if gt_func(constants[6], constants[18]) else nan, xor_func(xor_func(xor_func(constants[179], constants[2] if gt_func(constants[6], constants[18]) else nan), or_func(constants[1], constants[2])), and_func(constants[1], constants[2]))))) + computed_constants[202] = pow(and_func(constants[1], constants[2]), pow(constants[2] if gt_func(constants[6], constants[18]) else nan, pow(pow(constants[179], constants[2] if gt_func(constants[6], constants[18]) else nan), and_func(constants[1], constants[2])))) + computed_constants[203] = pow(pow(pow(and_func(constants[1], constants[2]), 1.0/pow(constants[2] if gt_func(constants[6], constants[18]) else nan, 1.0/constants[179])), 1.0/(constants[2] if gt_func(constants[6], constants[18]) else nan)), 1.0/and_func(constants[1], constants[2])) + computed_constants[204] = -and_func(constants[1], constants[2])+-(constants[2] if gt_func(constants[6], constants[18]) else nan) def compute_rates(voi, states, rates, constants, computed_constants, algebraic): diff --git a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.c b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.c index 42f15c79b8..8eee3cf3ad 100644 --- a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.c +++ b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.c @@ -35,12 +35,12 @@ void deleteArray(double *array) void initialiseVariables(double *constants) { - variables[1] = 1.0; + computedConstants[1] = 1.0; } void computeComputedConstants(double *constants, double *computedConstants) { - variables[0] = variables[1]; + computedConstants[0] = computedConstants[1]; } void computeVariables(double *constants, double *computedConstants, double *algebraic) diff --git a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.c b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.c index 8cbf6bf057..e3f909a3fd 100644 --- a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.c +++ b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.c @@ -35,7 +35,7 @@ void deleteArray(double *array) void initialiseVariables(double *constants, ExternalVariable externalVariable) { - variables[1] = externalVariable(variables, 1); + algebraic[1] = externalVariable(variables, 1); } void computeComputedConstants(double *constants, double *computedConstants) @@ -44,6 +44,6 @@ void computeComputedConstants(double *constants, double *computedConstants) void computeVariables(double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) { - variables[1] = externalVariable(variables, 1); - variables[0] = variables[1]; + algebraic[1] = externalVariable(variables, 1); + algebraic[0] = algebraic[1]; } diff --git a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.py b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.py index 2670115d48..830a7dbcc4 100644 --- a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.py +++ b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.py @@ -30,7 +30,7 @@ def create_variables_array(): def initialise_variables(constants, external_variable): - variables[1] = external_variable(variables, 1) + algebraic[1] = external_variable(variables, 1) def compute_computed_constants(constants, computed_constants): @@ -38,5 +38,5 @@ def compute_computed_constants(constants, computed_constants): def compute_variables(constants, computed_constants, algebraic, external_variable): - variables[1] = external_variable(variables, 1) - variables[0] = variables[1] + algebraic[1] = external_variable(variables, 1) + algebraic[0] = algebraic[1] diff --git a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.py b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.py index 24d09dbb1c..abbf71111a 100644 --- a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.py +++ b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.py @@ -29,11 +29,11 @@ def create_variables_array(): def initialise_variables(constants): - variables[1] = 1.0 + computed_constants[1] = 1.0 def compute_computed_constants(constants, computed_constants): - variables[0] = variables[1] + computed_constants[0] = computed_constants[1] def compute_variables(constants, computed_constants, algebraic): diff --git a/tests/resources/generator/algebraic_eqn_const_var_on_rhs/model.c b/tests/resources/generator/algebraic_eqn_const_var_on_rhs/model.c index dc50dc17e1..6624303897 100644 --- a/tests/resources/generator/algebraic_eqn_const_var_on_rhs/model.c +++ b/tests/resources/generator/algebraic_eqn_const_var_on_rhs/model.c @@ -35,12 +35,12 @@ void deleteArray(double *array) void initialiseVariables(double *constants) { - variables[1] = 1.0; + constants[1] = 1.0; } void computeComputedConstants(double *constants, double *computedConstants) { - variables[0] = variables[1]; + computedConstants[0] = constants[1]; } void computeVariables(double *constants, double *computedConstants, double *algebraic) diff --git a/tests/resources/generator/algebraic_eqn_const_var_on_rhs/model.py b/tests/resources/generator/algebraic_eqn_const_var_on_rhs/model.py index 305a6e7fd5..9b07f95029 100644 --- a/tests/resources/generator/algebraic_eqn_const_var_on_rhs/model.py +++ b/tests/resources/generator/algebraic_eqn_const_var_on_rhs/model.py @@ -29,11 +29,11 @@ def create_variables_array(): def initialise_variables(constants): - variables[1] = 1.0 + constants[1] = 1.0 def compute_computed_constants(constants, computed_constants): - variables[0] = variables[1] + computed_constants[0] = constants[1] def compute_variables(constants, computed_constants, algebraic): diff --git a/tests/resources/generator/algebraic_eqn_constant_on_rhs/model.c b/tests/resources/generator/algebraic_eqn_constant_on_rhs/model.c index 5e1791ae73..89a7cc42a4 100644 --- a/tests/resources/generator/algebraic_eqn_constant_on_rhs/model.c +++ b/tests/resources/generator/algebraic_eqn_constant_on_rhs/model.c @@ -34,7 +34,7 @@ void deleteArray(double *array) void initialiseVariables(double *constants) { - variables[0] = 1.0; + computedConstants[0] = 1.0; } void computeComputedConstants(double *constants, double *computedConstants) diff --git a/tests/resources/generator/algebraic_eqn_constant_on_rhs/model.py b/tests/resources/generator/algebraic_eqn_constant_on_rhs/model.py index 461c246474..bbee078792 100644 --- a/tests/resources/generator/algebraic_eqn_constant_on_rhs/model.py +++ b/tests/resources/generator/algebraic_eqn_constant_on_rhs/model.py @@ -28,7 +28,7 @@ def create_variables_array(): def initialise_variables(constants): - variables[0] = 1.0 + computed_constants[0] = 1.0 def compute_computed_constants(constants, computed_constants): diff --git a/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.c b/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.c index c37ec41540..c08dde32e6 100644 --- a/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.c +++ b/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.c @@ -53,7 +53,7 @@ void deleteArray(double *array) void initialiseVariables(double *states, double *rates, double *constants) { - variables[0] = 1.0; + computedConstants[0] = 1.0; states[0] = 1.0; } @@ -63,10 +63,10 @@ void computeComputedConstants(double *constants, double *computedConstants) void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { - rates[0] = variables[0]; + rates[0] = computedConstants[0]; } void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { - variables[1] = rates[0]; + algebraic[1] = rates[0]; } diff --git a/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.py b/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.py index dcdeee9d72..5e2901ca36 100644 --- a/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.py +++ b/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.py @@ -42,7 +42,7 @@ def create_variables_array(): def initialise_variables(states, rates, constants): - variables[0] = 1.0 + computed_constants[0] = 1.0 states[0] = 1.0 @@ -51,8 +51,8 @@ def compute_computed_constants(constants, computed_constants): def compute_rates(voi, states, rates, constants, computed_constants, algebraic): - rates[0] = variables[0] + rates[0] = computed_constants[0] def compute_variables(voi, states, rates, constants, computed_constants, algebraic): - variables[1] = rates[0] + algebraic[1] = rates[0] diff --git a/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.c b/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.c index 360d5cdaf2..5d3967ab00 100644 --- a/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.c +++ b/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.c @@ -53,7 +53,7 @@ void deleteArray(double *array) void initialiseVariables(double *states, double *rates, double *constants) { - variables[0] = 1.0; + computedConstants[0] = 1.0; states[0] = 1.0; } @@ -63,10 +63,10 @@ void computeComputedConstants(double *constants, double *computedConstants) void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { - rates[0] = variables[0]; + rates[0] = computedConstants[0]; } void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { - variables[1] = rates[0]; + algebraic[1] = rates[0]; } diff --git a/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.py b/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.py index b6ba332de9..3390600530 100644 --- a/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.py +++ b/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.py @@ -42,7 +42,7 @@ def create_variables_array(): def initialise_variables(states, rates, constants): - variables[0] = 1.0 + computed_constants[0] = 1.0 states[0] = 1.0 @@ -51,8 +51,8 @@ def compute_computed_constants(constants, computed_constants): def compute_rates(voi, states, rates, constants, computed_constants, algebraic): - rates[0] = variables[0] + rates[0] = computed_constants[0] def compute_variables(voi, states, rates, constants, computed_constants, algebraic): - variables[1] = rates[0] + algebraic[1] = rates[0] diff --git a/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.c b/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.c index 3ad5d87628..cd735eda2b 100644 --- a/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.c +++ b/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.c @@ -53,7 +53,7 @@ void deleteArray(double *array) void initialiseVariables(double *states, double *rates, double *constants) { - variables[0] = 1.0; + computedConstants[0] = 1.0; states[0] = 1.0; } @@ -63,10 +63,10 @@ void computeComputedConstants(double *constants, double *computedConstants) void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { - rates[0] = variables[0]; + rates[0] = computedConstants[0]; } void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { - variables[1] = 2.0*states[0]; + algebraic[1] = 2.0*states[0]; } diff --git a/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.py b/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.py index b8d4bcc52e..bca3f1f415 100644 --- a/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.py +++ b/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.py @@ -42,7 +42,7 @@ def create_variables_array(): def initialise_variables(states, rates, constants): - variables[0] = 1.0 + computed_constants[0] = 1.0 states[0] = 1.0 @@ -51,8 +51,8 @@ def compute_computed_constants(constants, computed_constants): def compute_rates(voi, states, rates, constants, computed_constants, algebraic): - rates[0] = variables[0] + rates[0] = computed_constants[0] def compute_variables(voi, states, rates, constants, computed_constants, algebraic): - variables[1] = 2.0*states[0] + algebraic[1] = 2.0*states[0] diff --git a/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.c b/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.c index 18593d1313..8836720f31 100644 --- a/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.c +++ b/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.c @@ -53,7 +53,7 @@ void deleteArray(double *array) void initialiseVariables(double *states, double *rates, double *constants) { - variables[0] = 1.0; + computedConstants[0] = 1.0; states[0] = 1.0; } @@ -63,10 +63,10 @@ void computeComputedConstants(double *constants, double *computedConstants) void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { - rates[0] = variables[0]; + rates[0] = computedConstants[0]; } void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { - variables[1] = 2.0*states[0]; + algebraic[1] = 2.0*states[0]; } diff --git a/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.py b/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.py index 6bbd5c64cb..409f890e5e 100644 --- a/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.py +++ b/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.py @@ -42,7 +42,7 @@ def create_variables_array(): def initialise_variables(states, rates, constants): - variables[0] = 1.0 + computed_constants[0] = 1.0 states[0] = 1.0 @@ -51,8 +51,8 @@ def compute_computed_constants(constants, computed_constants): def compute_rates(voi, states, rates, constants, computed_constants, algebraic): - rates[0] = variables[0] + rates[0] = computed_constants[0] def compute_variables(voi, states, rates, constants, computed_constants, algebraic): - variables[1] = 2.0*states[0] + algebraic[1] = 2.0*states[0] diff --git a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.c b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.c index f8f2240c0a..8466d70b10 100644 --- a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.c +++ b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.c @@ -46,9 +46,9 @@ void objectiveFunction0(double *u, double *f, void *data) { double *variables = ((RootFindingInfo *) data)->variables; - variables[3] = u[0]; + algebraic[3] = u[0]; - f[0] = variables[3]+variables[0]-(variables[1]+variables[2]); + f[0] = algebraic[3]+computedConstants[0]-(computedConstants[1]+computedConstants[2]); } void findRoot0(double *variables) @@ -56,19 +56,19 @@ void findRoot0(double *variables) RootFindingInfo rfi = { variables }; double u[1]; - u[0] = variables[3]; + u[0] = algebraic[3]; nlaSolve(objectiveFunction0, u, 1, &rfi); - variables[3] = u[0]; + algebraic[3] = u[0]; } void initialiseVariables(double *constants) { - variables[3] = 1.0; - variables[0] = 3.0; - variables[1] = 5.0; - variables[2] = 7.0; + algebraic[3] = 1.0; + computedConstants[0] = 3.0; + computedConstants[1] = 5.0; + computedConstants[2] = 7.0; } void computeComputedConstants(double *constants, double *computedConstants) diff --git a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.c b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.c index 3117d0d815..57c92c1e13 100644 --- a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.c +++ b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.c @@ -37,10 +37,10 @@ void deleteArray(double *array) void initialiseVariables(double *constants, ExternalVariable externalVariable) { - variables[0] = 3.0; - variables[1] = 5.0; - variables[2] = 7.0; - variables[3] = externalVariable(variables, 3); + computedConstants[0] = 3.0; + computedConstants[1] = 5.0; + computedConstants[2] = 7.0; + algebraic[3] = externalVariable(variables, 3); } void computeComputedConstants(double *constants, double *computedConstants) @@ -49,5 +49,5 @@ void computeComputedConstants(double *constants, double *computedConstants) void computeVariables(double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) { - variables[3] = externalVariable(variables, 3); + algebraic[3] = externalVariable(variables, 3); } diff --git a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.py b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.py index a2b79b941c..de574c9043 100644 --- a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.py +++ b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.py @@ -32,10 +32,10 @@ def create_variables_array(): def initialise_variables(constants, external_variable): - variables[0] = 3.0 - variables[1] = 5.0 - variables[2] = 7.0 - variables[3] = external_variable(variables, 3) + computed_constants[0] = 3.0 + computed_constants[1] = 5.0 + computed_constants[2] = 7.0 + algebraic[3] = external_variable(variables, 3) def compute_computed_constants(constants, computed_constants): @@ -43,4 +43,4 @@ def compute_computed_constants(constants, computed_constants): def compute_variables(constants, computed_constants, algebraic, external_variable): - variables[3] = external_variable(variables, 3) + algebraic[3] = external_variable(variables, 3) diff --git a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.py b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.py index f85863b933..646d98b2af 100644 --- a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.py +++ b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.py @@ -36,26 +36,26 @@ def create_variables_array(): def objective_function_0(u, f, data): variables = data[0] - variables[3] = u[0] + algebraic[3] = u[0] - f[0] = variables[3]+variables[0]-(variables[1]+variables[2]) + f[0] = algebraic[3]+computed_constants[0]-(computed_constants[1]+computed_constants[2]) def find_root_0(variables): u = [nan]*1 - u[0] = variables[3] + u[0] = algebraic[3] u = nla_solve(objective_function_0, u, 1, [variables]) - variables[3] = u[0] + algebraic[3] = u[0] def initialise_variables(constants): - variables[3] = 1.0 - variables[0] = 3.0 - variables[1] = 5.0 - variables[2] = 7.0 + algebraic[3] = 1.0 + computed_constants[0] = 3.0 + computed_constants[1] = 5.0 + computed_constants[2] = 7.0 def compute_computed_constants(constants, computed_constants): diff --git a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.c b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.c index 535e4e8e68..eb6d409ade 100644 --- a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.c +++ b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.c @@ -45,13 +45,13 @@ void objectiveFunction0(double *u, double *f, void *data) { double *variables = ((RootFindingInfo *) data)->variables; - variables[0] = u[0]; - variables[1] = u[1]; - variables[2] = u[2]; + algebraic[0] = u[0]; + algebraic[1] = u[1]; + algebraic[2] = u[2]; - f[0] = 2.0*variables[0]+variables[1]-2.0*variables[2]-(-1.0); - f[1] = 3.0*variables[0]-3.0*variables[1]-variables[2]-5.0; - f[2] = variables[0]-2.0*variables[1]+3.0*variables[2]-6.0; + f[0] = 2.0*algebraic[0]+algebraic[1]-2.0*algebraic[2]-(-1.0); + f[1] = 3.0*algebraic[0]-3.0*algebraic[1]-algebraic[2]-5.0; + f[2] = algebraic[0]-2.0*algebraic[1]+3.0*algebraic[2]-6.0; } void findRoot0(double *variables) @@ -59,22 +59,22 @@ void findRoot0(double *variables) RootFindingInfo rfi = { variables }; double u[3]; - u[0] = variables[0]; - u[1] = variables[1]; - u[2] = variables[2]; + u[0] = algebraic[0]; + u[1] = algebraic[1]; + u[2] = algebraic[2]; nlaSolve(objectiveFunction0, u, 3, &rfi); - variables[0] = u[0]; - variables[1] = u[1]; - variables[2] = u[2]; + algebraic[0] = u[0]; + algebraic[1] = u[1]; + algebraic[2] = u[2]; } void initialiseVariables(double *constants) { - variables[0] = 1.0; - variables[1] = 1.0; - variables[2] = 1.0; + algebraic[0] = 1.0; + algebraic[1] = 1.0; + algebraic[2] = 1.0; } void computeComputedConstants(double *constants, double *computedConstants) diff --git a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.py b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.py index cd3f4d26a8..de50e042ec 100644 --- a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.py +++ b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.py @@ -35,33 +35,33 @@ def create_variables_array(): def objective_function_0(u, f, data): variables = data[0] - variables[0] = u[0] - variables[1] = u[1] - variables[2] = u[2] + algebraic[0] = u[0] + algebraic[1] = u[1] + algebraic[2] = u[2] - f[0] = 2.0*variables[0]+variables[1]-2.0*variables[2]-(-1.0) - f[1] = 3.0*variables[0]-3.0*variables[1]-variables[2]-5.0 - f[2] = variables[0]-2.0*variables[1]+3.0*variables[2]-6.0 + f[0] = 2.0*algebraic[0]+algebraic[1]-2.0*algebraic[2]-(-1.0) + f[1] = 3.0*algebraic[0]-3.0*algebraic[1]-algebraic[2]-5.0 + f[2] = algebraic[0]-2.0*algebraic[1]+3.0*algebraic[2]-6.0 def find_root_0(variables): u = [nan]*3 - u[0] = variables[0] - u[1] = variables[1] - u[2] = variables[2] + u[0] = algebraic[0] + u[1] = algebraic[1] + u[2] = algebraic[2] u = nla_solve(objective_function_0, u, 3, [variables]) - variables[0] = u[0] - variables[1] = u[1] - variables[2] = u[2] + algebraic[0] = u[0] + algebraic[1] = u[1] + algebraic[2] = u[2] def initialise_variables(constants): - variables[0] = 1.0 - variables[1] = 1.0 - variables[2] = 1.0 + algebraic[0] = 1.0 + algebraic[1] = 1.0 + algebraic[2] = 1.0 def compute_computed_constants(constants, computed_constants): diff --git a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.c b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.c index 4f5a987093..db8bace3dd 100644 --- a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.c +++ b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.c @@ -36,9 +36,9 @@ void deleteArray(double *array) void initialiseVariables(double *constants, ExternalVariable externalVariable) { - variables[0] = externalVariable(variables, 0); - variables[1] = externalVariable(variables, 1); - variables[2] = externalVariable(variables, 2); + algebraic[0] = externalVariable(variables, 0); + algebraic[1] = externalVariable(variables, 1); + algebraic[2] = externalVariable(variables, 2); } void computeComputedConstants(double *constants, double *computedConstants) @@ -47,7 +47,7 @@ void computeComputedConstants(double *constants, double *computedConstants) void computeVariables(double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) { - variables[0] = externalVariable(variables, 0); - variables[1] = externalVariable(variables, 1); - variables[2] = externalVariable(variables, 2); + algebraic[0] = externalVariable(variables, 0); + algebraic[1] = externalVariable(variables, 1); + algebraic[2] = externalVariable(variables, 2); } diff --git a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.py b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.py index 83aafcbbc1..0e99da2824 100644 --- a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.py +++ b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.py @@ -31,9 +31,9 @@ def create_variables_array(): def initialise_variables(constants, external_variable): - variables[0] = external_variable(variables, 0) - variables[1] = external_variable(variables, 1) - variables[2] = external_variable(variables, 2) + algebraic[0] = external_variable(variables, 0) + algebraic[1] = external_variable(variables, 1) + algebraic[2] = external_variable(variables, 2) def compute_computed_constants(constants, computed_constants): @@ -41,6 +41,6 @@ def compute_computed_constants(constants, computed_constants): def compute_variables(constants, computed_constants, algebraic, external_variable): - variables[0] = external_variable(variables, 0) - variables[1] = external_variable(variables, 1) - variables[2] = external_variable(variables, 2) + algebraic[0] = external_variable(variables, 0) + algebraic[1] = external_variable(variables, 1) + algebraic[2] = external_variable(variables, 2) diff --git a/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.c b/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.c index 462c28f737..209f9dc7b5 100644 --- a/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.c +++ b/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.c @@ -48,11 +48,11 @@ void objectiveFunction0(double *u, double *f, void *data) { double *variables = ((RootFindingInfo *) data)->variables; - variables[2] = u[0]; - variables[1] = u[1]; + algebraic[2] = u[0]; + algebraic[1] = u[1]; - f[0] = 3.0*variables[3]+2.0*variables[1]+variables[2]-57.0; - f[1] = variables[3]+3.0*variables[1]-variables[2]-19.0; + f[0] = 3.0*computedConstants[3]+2.0*algebraic[1]+algebraic[2]-57.0; + f[1] = computedConstants[3]+3.0*algebraic[1]-algebraic[2]-19.0; } void findRoot0(double *variables) @@ -60,30 +60,30 @@ void findRoot0(double *variables) RootFindingInfo rfi = { variables }; double u[2]; - u[0] = variables[2]; - u[1] = variables[1]; + u[0] = algebraic[2]; + u[1] = algebraic[1]; nlaSolve(objectiveFunction0, u, 2, &rfi); - variables[2] = u[0]; - variables[1] = u[1]; + algebraic[2] = u[0]; + algebraic[1] = u[1]; } void initialiseVariables(double *constants) { - variables[1] = 1.0; - variables[2] = 1.0; - variables[4] = 3.0; - variables[5] = 5.0; + algebraic[1] = 1.0; + algebraic[2] = 1.0; + constants[4] = 3.0; + constants[5] = 5.0; } void computeComputedConstants(double *constants, double *computedConstants) { - variables[3] = 3.0*variables[4]+variables[5]; + computedConstants[3] = 3.0*constants[4]+constants[5]; } void computeVariables(double *constants, double *computedConstants, double *algebraic) { findRoot0(variables); - variables[0] = variables[1]+variables[2]; + algebraic[0] = algebraic[1]+algebraic[2]; } diff --git a/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.py b/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.py index 723234a885..2c1c63ab8c 100644 --- a/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.py +++ b/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.py @@ -38,36 +38,36 @@ def create_variables_array(): def objective_function_0(u, f, data): variables = data[0] - variables[2] = u[0] - variables[1] = u[1] + algebraic[2] = u[0] + algebraic[1] = u[1] - f[0] = 3.0*variables[3]+2.0*variables[1]+variables[2]-57.0 - f[1] = variables[3]+3.0*variables[1]-variables[2]-19.0 + f[0] = 3.0*computed_constants[3]+2.0*algebraic[1]+algebraic[2]-57.0 + f[1] = computed_constants[3]+3.0*algebraic[1]-algebraic[2]-19.0 def find_root_0(variables): u = [nan]*2 - u[0] = variables[2] - u[1] = variables[1] + u[0] = algebraic[2] + u[1] = algebraic[1] u = nla_solve(objective_function_0, u, 2, [variables]) - variables[2] = u[0] - variables[1] = u[1] + algebraic[2] = u[0] + algebraic[1] = u[1] def initialise_variables(constants): - variables[1] = 1.0 - variables[2] = 1.0 - variables[4] = 3.0 - variables[5] = 5.0 + algebraic[1] = 1.0 + algebraic[2] = 1.0 + constants[4] = 3.0 + constants[5] = 5.0 def compute_computed_constants(constants, computed_constants): - variables[3] = 3.0*variables[4]+variables[5] + computed_constants[3] = 3.0*constants[4]+constants[5] def compute_variables(constants, computed_constants, algebraic): find_root_0(variables) - variables[0] = variables[1]+variables[2] + algebraic[0] = algebraic[1]+algebraic[2] diff --git a/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.c b/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.c index e8af03001a..2802b5299a 100644 --- a/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.c +++ b/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.c @@ -48,11 +48,11 @@ void objectiveFunction0(double *u, double *f, void *data) { double *variables = ((RootFindingInfo *) data)->variables; - variables[3] = u[0]; - variables[4] = u[1]; + algebraic[3] = u[0]; + algebraic[4] = u[1]; - f[0] = 3.0*variables[0]+2.0*variables[4]+variables[3]-57.0; - f[1] = variables[0]+3.0*variables[4]-variables[3]-19.0; + f[0] = 3.0*computedConstants[0]+2.0*algebraic[4]+algebraic[3]-57.0; + f[1] = computedConstants[0]+3.0*algebraic[4]-algebraic[3]-19.0; } void findRoot0(double *variables) @@ -60,30 +60,30 @@ void findRoot0(double *variables) RootFindingInfo rfi = { variables }; double u[2]; - u[0] = variables[3]; - u[1] = variables[4]; + u[0] = algebraic[3]; + u[1] = algebraic[4]; nlaSolve(objectiveFunction0, u, 2, &rfi); - variables[3] = u[0]; - variables[4] = u[1]; + algebraic[3] = u[0]; + algebraic[4] = u[1]; } void initialiseVariables(double *constants) { - variables[1] = 3.0; - variables[2] = 5.0; - variables[3] = 1.0; - variables[4] = 1.0; + constants[1] = 3.0; + constants[2] = 5.0; + algebraic[3] = 1.0; + algebraic[4] = 1.0; } void computeComputedConstants(double *constants, double *computedConstants) { - variables[0] = 3.0*variables[1]+variables[2]; + computedConstants[0] = 3.0*constants[1]+constants[2]; } void computeVariables(double *constants, double *computedConstants, double *algebraic) { findRoot0(variables); - variables[5] = variables[4]+variables[3]; + algebraic[5] = algebraic[4]+algebraic[3]; } diff --git a/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.py b/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.py index 20c8f31559..d6259b2b98 100644 --- a/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.py +++ b/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.py @@ -38,36 +38,36 @@ def create_variables_array(): def objective_function_0(u, f, data): variables = data[0] - variables[3] = u[0] - variables[4] = u[1] + algebraic[3] = u[0] + algebraic[4] = u[1] - f[0] = 3.0*variables[0]+2.0*variables[4]+variables[3]-57.0 - f[1] = variables[0]+3.0*variables[4]-variables[3]-19.0 + f[0] = 3.0*computed_constants[0]+2.0*algebraic[4]+algebraic[3]-57.0 + f[1] = computed_constants[0]+3.0*algebraic[4]-algebraic[3]-19.0 def find_root_0(variables): u = [nan]*2 - u[0] = variables[3] - u[1] = variables[4] + u[0] = algebraic[3] + u[1] = algebraic[4] u = nla_solve(objective_function_0, u, 2, [variables]) - variables[3] = u[0] - variables[4] = u[1] + algebraic[3] = u[0] + algebraic[4] = u[1] def initialise_variables(constants): - variables[1] = 3.0 - variables[2] = 5.0 - variables[3] = 1.0 - variables[4] = 1.0 + constants[1] = 3.0 + constants[2] = 5.0 + algebraic[3] = 1.0 + algebraic[4] = 1.0 def compute_computed_constants(constants, computed_constants): - variables[0] = 3.0*variables[1]+variables[2] + computed_constants[0] = 3.0*constants[1]+constants[2] def compute_variables(constants, computed_constants, algebraic): find_root_0(variables) - variables[5] = variables[4]+variables[3] + algebraic[5] = algebraic[4]+algebraic[3] diff --git a/tests/resources/generator/algebraic_unknown_var_on_rhs/model.c b/tests/resources/generator/algebraic_unknown_var_on_rhs/model.c index 5224ee2147..16b90c3882 100644 --- a/tests/resources/generator/algebraic_unknown_var_on_rhs/model.c +++ b/tests/resources/generator/algebraic_unknown_var_on_rhs/model.c @@ -35,12 +35,12 @@ void deleteArray(double *array) void initialiseVariables(double *constants) { - variables[0] = 1.0; + computedConstants[0] = 1.0; } void computeComputedConstants(double *constants, double *computedConstants) { - variables[1] = variables[0]; + computedConstants[1] = computedConstants[0]; } void computeVariables(double *constants, double *computedConstants, double *algebraic) diff --git a/tests/resources/generator/algebraic_unknown_var_on_rhs/model.py b/tests/resources/generator/algebraic_unknown_var_on_rhs/model.py index c4bec2a5c4..3edee3eadc 100644 --- a/tests/resources/generator/algebraic_unknown_var_on_rhs/model.py +++ b/tests/resources/generator/algebraic_unknown_var_on_rhs/model.py @@ -29,11 +29,11 @@ def create_variables_array(): def initialise_variables(constants): - variables[0] = 1.0 + computed_constants[0] = 1.0 def compute_computed_constants(constants, computed_constants): - variables[1] = variables[0] + computed_constants[1] = computed_constants[0] def compute_variables(constants, computed_constants, algebraic): diff --git a/tests/resources/generator/cell_geometry_model/model.c b/tests/resources/generator/cell_geometry_model/model.c index 8087a0ebc1..91884cff90 100644 --- a/tests/resources/generator/cell_geometry_model/model.c +++ b/tests/resources/generator/cell_geometry_model/model.c @@ -37,14 +37,14 @@ void deleteArray(double *array) void initialiseVariables(double *constants) { - variables[1] = 0.01; - variables[2] = 0.0011; + constants[1] = 0.01; + constants[2] = 0.0011; } void computeComputedConstants(double *constants, double *computedConstants) { - variables[0] = 1000.0*3.14*variables[2]*variables[2]*variables[1]; - variables[3] = 0.02*variables[0]; + computedConstants[0] = 1000.0*3.14*constants[2]*constants[2]*constants[1]; + computedConstants[3] = 0.02*computedConstants[0]; } void computeVariables(double *constants, double *computedConstants, double *algebraic) diff --git a/tests/resources/generator/cell_geometry_model/model.external.c b/tests/resources/generator/cell_geometry_model/model.external.c index c9c0f76f82..ed88fb63df 100644 --- a/tests/resources/generator/cell_geometry_model/model.external.c +++ b/tests/resources/generator/cell_geometry_model/model.external.c @@ -37,8 +37,8 @@ void deleteArray(double *array) void initialiseVariables(double *constants, ExternalVariable externalVariable) { - variables[1] = externalVariable(variables, 1); - variables[2] = externalVariable(variables, 2); + algebraic[1] = externalVariable(variables, 1); + algebraic[2] = externalVariable(variables, 2); } void computeComputedConstants(double *constants, double *computedConstants) @@ -47,8 +47,8 @@ void computeComputedConstants(double *constants, double *computedConstants) void computeVariables(double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) { - variables[1] = externalVariable(variables, 1); - variables[2] = externalVariable(variables, 2); - variables[0] = 1000.0*3.14*variables[2]*variables[2]*variables[1]; - variables[3] = 0.02*variables[0]; + algebraic[1] = externalVariable(variables, 1); + algebraic[2] = externalVariable(variables, 2); + algebraic[0] = 1000.0*3.14*algebraic[2]*algebraic[2]*algebraic[1]; + algebraic[3] = 0.02*algebraic[0]; } diff --git a/tests/resources/generator/cell_geometry_model/model.external.py b/tests/resources/generator/cell_geometry_model/model.external.py index 2e565edd4d..752da86d55 100644 --- a/tests/resources/generator/cell_geometry_model/model.external.py +++ b/tests/resources/generator/cell_geometry_model/model.external.py @@ -32,8 +32,8 @@ def create_variables_array(): def initialise_variables(constants, external_variable): - variables[1] = external_variable(variables, 1) - variables[2] = external_variable(variables, 2) + algebraic[1] = external_variable(variables, 1) + algebraic[2] = external_variable(variables, 2) def compute_computed_constants(constants, computed_constants): @@ -41,7 +41,7 @@ def compute_computed_constants(constants, computed_constants): def compute_variables(constants, computed_constants, algebraic, external_variable): - variables[1] = external_variable(variables, 1) - variables[2] = external_variable(variables, 2) - variables[0] = 1000.0*3.14*variables[2]*variables[2]*variables[1] - variables[3] = 0.02*variables[0] + algebraic[1] = external_variable(variables, 1) + algebraic[2] = external_variable(variables, 2) + algebraic[0] = 1000.0*3.14*algebraic[2]*algebraic[2]*algebraic[1] + algebraic[3] = 0.02*algebraic[0] diff --git a/tests/resources/generator/cell_geometry_model/model.py b/tests/resources/generator/cell_geometry_model/model.py index dd282fbf35..bcbef6f85a 100644 --- a/tests/resources/generator/cell_geometry_model/model.py +++ b/tests/resources/generator/cell_geometry_model/model.py @@ -31,13 +31,13 @@ def create_variables_array(): def initialise_variables(constants): - variables[1] = 0.01 - variables[2] = 0.0011 + constants[1] = 0.01 + constants[2] = 0.0011 def compute_computed_constants(constants, computed_constants): - variables[0] = 1000.0*3.14*variables[2]*variables[2]*variables[1] - variables[3] = 0.02*variables[0] + computed_constants[0] = 1000.0*3.14*constants[2]*constants[2]*constants[1] + computed_constants[3] = 0.02*computed_constants[0] def compute_variables(constants, computed_constants, algebraic): diff --git a/tests/resources/generator/cellml_mappings_and_encapsulations/model.c b/tests/resources/generator/cellml_mappings_and_encapsulations/model.c index af77c8adbe..3f59baaf87 100644 --- a/tests/resources/generator/cellml_mappings_and_encapsulations/model.c +++ b/tests/resources/generator/cellml_mappings_and_encapsulations/model.c @@ -70,6 +70,6 @@ void computeRates(double voi, double *states, double *rates, double *constants, void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { - variables[0] = states[0]+5.0*states[0]/3.0+1.0*exp(states[0]/2.0); - variables[1] = 2.0*states[1]; + algebraic[0] = states[0]+5.0*states[0]/3.0+1.0*exp(states[0]/2.0); + algebraic[1] = 2.0*states[1]; } diff --git a/tests/resources/generator/cellml_mappings_and_encapsulations/model.py b/tests/resources/generator/cellml_mappings_and_encapsulations/model.py index 48ead204d4..42799d8118 100644 --- a/tests/resources/generator/cellml_mappings_and_encapsulations/model.py +++ b/tests/resources/generator/cellml_mappings_and_encapsulations/model.py @@ -57,5 +57,5 @@ def compute_rates(voi, states, rates, constants, computed_constants, algebraic): def compute_variables(voi, states, rates, constants, computed_constants, algebraic): - variables[0] = states[0]+5.0*states[0]/3.0+1.0*exp(states[0]/2.0) - variables[1] = 2.0*states[1] + algebraic[0] = states[0]+5.0*states[0]/3.0+1.0*exp(states[0]/2.0) + algebraic[1] = 2.0*states[1] diff --git a/tests/resources/generator/cellml_slc_example/model.py b/tests/resources/generator/cellml_slc_example/model.py index e46136ff87..ea8cac8cf8 100644 --- a/tests/resources/generator/cellml_slc_example/model.py +++ b/tests/resources/generator/cellml_slc_example/model.py @@ -37,19 +37,19 @@ def create_variables_array(): def initialise_variables(constants): - variables[1] = 1.1 - variables[2] = 21262500.0 - variables[3] = 150.0 - variables[4] = 3402000.0 - variables[5] = 2.0 - variables[6] = 2902500.0 - variables[7] = 810000.0 - variables[8] = 247140.0 - variables[9] = 2902500.0 + constants[1] = 1.1 + constants[2] = 21262500.0 + constants[3] = 150.0 + constants[4] = 3402000.0 + constants[5] = 2.0 + constants[6] = 2902500.0 + constants[7] = 810000.0 + constants[8] = 247140.0 + constants[9] = 2902500.0 def compute_computed_constants(constants, computed_constants): - variables[0] = variables[1]*(variables[2]*variables[3]-variables[4]*variables[5])/(variables[6]*variables[5]+variables[9]*variables[3]+variables[8]*variables[5]*variables[3]+variables[7]) + computed_constants[0] = constants[1]*(constants[2]*constants[3]-constants[4]*constants[5])/(constants[6]*constants[5]+constants[9]*constants[3]+constants[8]*constants[5]*constants[3]+constants[7]) def compute_variables(constants, computed_constants, algebraic): diff --git a/tests/resources/generator/cellml_state_initialised_using_variable/model.c b/tests/resources/generator/cellml_state_initialised_using_variable/model.c index fd33a5b300..3bb1425bc5 100644 --- a/tests/resources/generator/cellml_state_initialised_using_variable/model.c +++ b/tests/resources/generator/cellml_state_initialised_using_variable/model.c @@ -52,8 +52,8 @@ void deleteArray(double *array) void initialiseVariables(double *states, double *rates, double *constants) { - variables[0] = 123.0; - states[0] = variables[0]; + constants[0] = 123.0; + states[0] = constants[0]; } void computeComputedConstants(double *constants, double *computedConstants) diff --git a/tests/resources/generator/cellml_state_initialised_using_variable/model.py b/tests/resources/generator/cellml_state_initialised_using_variable/model.py index 246d135ba0..2ae891fe37 100644 --- a/tests/resources/generator/cellml_state_initialised_using_variable/model.py +++ b/tests/resources/generator/cellml_state_initialised_using_variable/model.py @@ -41,8 +41,8 @@ def create_variables_array(): def initialise_variables(states, rates, constants): - variables[0] = 123.0 - states[0] = variables[0] + constants[0] = 123.0 + states[0] = constants[0] def compute_computed_constants(constants, computed_constants): diff --git a/tests/resources/generator/cellml_unit_scaling_constant/model.c b/tests/resources/generator/cellml_unit_scaling_constant/model.c index 5ec839f548..79847cd595 100644 --- a/tests/resources/generator/cellml_unit_scaling_constant/model.c +++ b/tests/resources/generator/cellml_unit_scaling_constant/model.c @@ -36,13 +36,13 @@ void deleteArray(double *array) void initialiseVariables(double *constants) { - variables[0] = 123.0; + constants[0] = 123.0; } void computeComputedConstants(double *constants, double *computedConstants) { - variables[1] = variables[0]+variables[0]; - variables[2] = 0.001*variables[0]+0.001*variables[0]; + computedConstants[1] = constants[0]+constants[0]; + computedConstants[2] = 0.001*constants[0]+0.001*constants[0]; } void computeVariables(double *constants, double *computedConstants, double *algebraic) diff --git a/tests/resources/generator/cellml_unit_scaling_constant/model.py b/tests/resources/generator/cellml_unit_scaling_constant/model.py index 83f5af0c90..8d1f0b000f 100644 --- a/tests/resources/generator/cellml_unit_scaling_constant/model.py +++ b/tests/resources/generator/cellml_unit_scaling_constant/model.py @@ -30,12 +30,12 @@ def create_variables_array(): def initialise_variables(constants): - variables[0] = 123.0 + constants[0] = 123.0 def compute_computed_constants(constants, computed_constants): - variables[1] = variables[0]+variables[0] - variables[2] = 0.001*variables[0]+0.001*variables[0] + computed_constants[1] = constants[0]+constants[0] + computed_constants[2] = 0.001*constants[0]+0.001*constants[0] def compute_variables(constants, computed_constants, algebraic): diff --git a/tests/resources/generator/cellml_unit_scaling_rate/model.c b/tests/resources/generator/cellml_unit_scaling_rate/model.c index 56547ca65a..603a1eab39 100644 --- a/tests/resources/generator/cellml_unit_scaling_rate/model.c +++ b/tests/resources/generator/cellml_unit_scaling_rate/model.c @@ -67,6 +67,6 @@ void computeRates(double voi, double *states, double *rates, double *constants, void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { - variables[0] = 1000.0*rates[0]+1000.0*rates[0]; - variables[1] = 1000.0*0.001*rates[0]+1000.0*0.001*rates[0]; + algebraic[0] = 1000.0*rates[0]+1000.0*rates[0]; + algebraic[1] = 1000.0*0.001*rates[0]+1000.0*0.001*rates[0]; } diff --git a/tests/resources/generator/cellml_unit_scaling_rate/model.py b/tests/resources/generator/cellml_unit_scaling_rate/model.py index 97589bc349..f74588e123 100644 --- a/tests/resources/generator/cellml_unit_scaling_rate/model.py +++ b/tests/resources/generator/cellml_unit_scaling_rate/model.py @@ -54,5 +54,5 @@ def compute_rates(voi, states, rates, constants, computed_constants, algebraic): def compute_variables(voi, states, rates, constants, computed_constants, algebraic): - variables[0] = 1000.0*rates[0]+1000.0*rates[0] - variables[1] = 1000.0*0.001*rates[0]+1000.0*0.001*rates[0] + algebraic[0] = 1000.0*rates[0]+1000.0*rates[0] + algebraic[1] = 1000.0*0.001*rates[0]+1000.0*0.001*rates[0] diff --git a/tests/resources/generator/cellml_unit_scaling_state/model.c b/tests/resources/generator/cellml_unit_scaling_state/model.c index fc1ab5e93c..34c1bca1f3 100644 --- a/tests/resources/generator/cellml_unit_scaling_state/model.c +++ b/tests/resources/generator/cellml_unit_scaling_state/model.c @@ -67,6 +67,6 @@ void computeRates(double voi, double *states, double *rates, double *constants, void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { - variables[0] = states[0]+states[0]; - variables[1] = 0.001*states[0]+0.001*states[0]; + algebraic[0] = states[0]+states[0]; + algebraic[1] = 0.001*states[0]+0.001*states[0]; } diff --git a/tests/resources/generator/cellml_unit_scaling_state/model.py b/tests/resources/generator/cellml_unit_scaling_state/model.py index 1c964deb86..ec43146e3c 100644 --- a/tests/resources/generator/cellml_unit_scaling_state/model.py +++ b/tests/resources/generator/cellml_unit_scaling_state/model.py @@ -54,5 +54,5 @@ def compute_rates(voi, states, rates, constants, computed_constants, algebraic): def compute_variables(voi, states, rates, constants, computed_constants, algebraic): - variables[0] = states[0]+states[0] - variables[1] = 0.001*states[0]+0.001*states[0] + algebraic[0] = states[0]+states[0] + algebraic[1] = 0.001*states[0]+0.001*states[0] diff --git a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.c b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.c index bafc5259f8..ba05a38f2c 100644 --- a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.c +++ b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.c @@ -54,10 +54,10 @@ void deleteArray(double *array) void initialiseVariables(double *states, double *rates, double *constants) { - variables[0] = 123.0; - variables[1] = 789.0; - states[0] = variables[0]; - states[1] = 0.001*variables[1]; + constants[0] = 123.0; + constants[1] = 789.0; + states[0] = constants[0]; + states[1] = 0.001*constants[1]; } void computeComputedConstants(double *constants, double *computedConstants) diff --git a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.py b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.py index 029b44f7a4..ce584f1b07 100644 --- a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.py +++ b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.py @@ -43,10 +43,10 @@ def create_variables_array(): def initialise_variables(states, rates, constants): - variables[0] = 123.0 - variables[1] = 789.0 - states[0] = variables[0] - states[1] = 0.001*variables[1] + constants[0] = 123.0 + constants[1] = 789.0 + states[0] = constants[0] + states[1] = 0.001*constants[1] def compute_computed_constants(constants, computed_constants): diff --git a/tests/resources/generator/dae_cellml_1_1_model/model.c b/tests/resources/generator/dae_cellml_1_1_model/model.c index c349b48caa..aff41afb7a 100644 --- a/tests/resources/generator/dae_cellml_1_1_model/model.c +++ b/tests/resources/generator/dae_cellml_1_1_model/model.c @@ -77,9 +77,9 @@ void objectiveFunction0(double *u, double *f, void *data) double *rates = ((RootFindingInfo *) data)->rates; double *variables = ((RootFindingInfo *) data)->variables; - variables[0] = u[0]; + algebraic[0] = u[0]; - f[0] = variables[1]-(variables[0]+variables[2]); + f[0] = constants[1]-(algebraic[0]+algebraic[2]); } void findRoot0(double voi, double *states, double *rates, double *variables) @@ -87,11 +87,11 @@ void findRoot0(double voi, double *states, double *rates, double *variables) RootFindingInfo rfi = { voi, states, rates, variables }; double u[1]; - u[0] = variables[0]; + u[0] = algebraic[0]; nlaSolve(objectiveFunction0, u, 1, &rfi); - variables[0] = u[0]; + algebraic[0] = u[0]; } void objectiveFunction1(double *u, double *f, void *data) @@ -101,9 +101,9 @@ void objectiveFunction1(double *u, double *f, void *data) double *rates = ((RootFindingInfo *) data)->rates; double *variables = ((RootFindingInfo *) data)->variables; - variables[6] = u[0]; + algebraic[6] = u[0]; - f[0] = variables[4]-(variables[5]+variables[6]); + f[0] = algebraic[4]-(algebraic[5]+algebraic[6]); } void findRoot1(double voi, double *states, double *rates, double *variables) @@ -111,22 +111,22 @@ void findRoot1(double voi, double *states, double *rates, double *variables) RootFindingInfo rfi = { voi, states, rates, variables }; double u[1]; - u[0] = variables[6]; + u[0] = algebraic[6]; nlaSolve(objectiveFunction1, u, 1, &rfi); - variables[6] = u[0]; + algebraic[6] = u[0]; } void initialiseVariables(double *states, double *rates, double *constants) { - variables[0] = 0.0; - variables[1] = 1.0; - variables[3] = 1.0; - variables[6] = 0.0; - variables[7] = 20.0; - variables[8] = 2.0; - variables[9] = 10.0; + algebraic[0] = 0.0; + constants[1] = 1.0; + constants[3] = 1.0; + algebraic[6] = 0.0; + constants[7] = 20.0; + constants[8] = 2.0; + constants[9] = 10.0; states[0] = 1.0; states[1] = 0.0; } @@ -137,20 +137,20 @@ void computeComputedConstants(double *constants, double *computedConstants) void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { - variables[2] = states[1]+variables[3]; + algebraic[2] = states[1]+constants[3]; findRoot0(voi, states, rates, variables); - rates[0] = variables[0]; - variables[4] = states[0]/variables[7]; - variables[5] = variables[8]*variables[2]; + rates[0] = algebraic[0]; + algebraic[4] = states[0]/constants[7]; + algebraic[5] = constants[8]*algebraic[2]; findRoot1(voi, states, rates, variables); - rates[1] = variables[6]/variables[9]; + rates[1] = algebraic[6]/constants[9]; } void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { - variables[2] = states[1]+variables[3]; + algebraic[2] = states[1]+constants[3]; findRoot0(voi, states, rates, variables); - variables[4] = states[0]/variables[7]; - variables[5] = variables[8]*variables[2]; + algebraic[4] = states[0]/constants[7]; + algebraic[5] = constants[8]*algebraic[2]; findRoot1(voi, states, rates, variables); } diff --git a/tests/resources/generator/dae_cellml_1_1_model/model.py b/tests/resources/generator/dae_cellml_1_1_model/model.py index 793f148fac..764fb8703d 100644 --- a/tests/resources/generator/dae_cellml_1_1_model/model.py +++ b/tests/resources/generator/dae_cellml_1_1_model/model.py @@ -59,19 +59,19 @@ def objective_function_0(u, f, data): rates = data[2] variables = data[3] - variables[0] = u[0] + algebraic[0] = u[0] - f[0] = variables[1]-(variables[0]+variables[2]) + f[0] = constants[1]-(algebraic[0]+algebraic[2]) def find_root_0(voi, states, rates, variables): u = [nan]*1 - u[0] = variables[0] + u[0] = algebraic[0] u = nla_solve(objective_function_0, u, 1, [voi, states, rates, variables]) - variables[0] = u[0] + algebraic[0] = u[0] def objective_function_1(u, f, data): @@ -80,29 +80,29 @@ def objective_function_1(u, f, data): rates = data[2] variables = data[3] - variables[6] = u[0] + algebraic[6] = u[0] - f[0] = variables[4]-(variables[5]+variables[6]) + f[0] = algebraic[4]-(algebraic[5]+algebraic[6]) def find_root_1(voi, states, rates, variables): u = [nan]*1 - u[0] = variables[6] + u[0] = algebraic[6] u = nla_solve(objective_function_1, u, 1, [voi, states, rates, variables]) - variables[6] = u[0] + algebraic[6] = u[0] def initialise_variables(states, rates, constants): - variables[0] = 0.0 - variables[1] = 1.0 - variables[3] = 1.0 - variables[6] = 0.0 - variables[7] = 20.0 - variables[8] = 2.0 - variables[9] = 10.0 + algebraic[0] = 0.0 + constants[1] = 1.0 + constants[3] = 1.0 + algebraic[6] = 0.0 + constants[7] = 20.0 + constants[8] = 2.0 + constants[9] = 10.0 states[0] = 1.0 states[1] = 0.0 @@ -112,18 +112,18 @@ def compute_computed_constants(constants, computed_constants): def compute_rates(voi, states, rates, constants, computed_constants, algebraic): - variables[2] = states[1]+variables[3] + algebraic[2] = states[1]+constants[3] find_root_0(voi, states, rates, variables) - rates[0] = variables[0] - variables[4] = states[0]/variables[7] - variables[5] = variables[8]*variables[2] + rates[0] = algebraic[0] + algebraic[4] = states[0]/constants[7] + algebraic[5] = constants[8]*algebraic[2] find_root_1(voi, states, rates, variables) - rates[1] = variables[6]/variables[9] + rates[1] = algebraic[6]/constants[9] def compute_variables(voi, states, rates, constants, computed_constants, algebraic): - variables[2] = states[1]+variables[3] + algebraic[2] = states[1]+constants[3] find_root_0(voi, states, rates, variables) - variables[4] = states[0]/variables[7] - variables[5] = variables[8]*variables[2] + algebraic[4] = states[0]/constants[7] + algebraic[5] = constants[8]*algebraic[2] find_root_1(voi, states, rates, variables) diff --git a/tests/resources/generator/dependent_eqns/model.c b/tests/resources/generator/dependent_eqns/model.c index e85abef766..7bbb981447 100644 --- a/tests/resources/generator/dependent_eqns/model.c +++ b/tests/resources/generator/dependent_eqns/model.c @@ -67,6 +67,6 @@ void computeRates(double voi, double *states, double *rates, double *constants, void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { - variables[1] = 2.0*voi; - variables[0] = 3.0*variables[1]; + algebraic[1] = 2.0*voi; + algebraic[0] = 3.0*algebraic[1]; } diff --git a/tests/resources/generator/dependent_eqns/model.py b/tests/resources/generator/dependent_eqns/model.py index a5a26864cc..5ed89e9102 100644 --- a/tests/resources/generator/dependent_eqns/model.py +++ b/tests/resources/generator/dependent_eqns/model.py @@ -54,5 +54,5 @@ def compute_rates(voi, states, rates, constants, computed_constants, algebraic): def compute_variables(voi, states, rates, constants, computed_constants, algebraic): - variables[1] = 2.0*voi - variables[0] = 3.0*variables[1] + algebraic[1] = 2.0*voi + algebraic[0] = 3.0*algebraic[1] diff --git a/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.c b/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.c index ee620de9a6..ccb8d7ddf3 100644 --- a/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.c +++ b/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.c @@ -300,97 +300,97 @@ void deleteArray(double *array) void initialiseVariables(double *states, double *rates, double *constants) { - variables[0] = 0.0; - variables[1] = 0.0; - variables[4] = 140.0; - variables[7] = 5.4; - variables[8] = 140.0; - variables[10] = 1.8; - variables[11] = 1.0; - variables[17] = 96485.3415; - variables[22] = 14.0; - variables[23] = 1.4; - variables[24] = 0.08105; - variables[25] = 0.0; - variables[30] = 3.343; - variables[39] = 26.44; - variables[40] = 0.0207; - variables[41] = 0.1369; - variables[43] = 395.3; - variables[44] = 2.289; - variables[45] = 0.4315; - variables[46] = 26.44; - variables[47] = 4.663; - variables[48] = 3.663; - variables[49] = 0.0; - variables[51] = 1628.0; - variables[52] = 561.4; - variables[54] = 148041085.1; - variables[57] = 15.0; - variables[58] = 1.0; - variables[59] = 0.45; - variables[60] = 2.5; - variables[62] = 10000.0; - variables[64] = 500.0; - variables[65] = 5.0; - variables[66] = 660.0; - variables[70] = 5.0; - variables[72] = 5.469e-5; - variables[74] = 0.000286113; - variables[75] = 5.0e-5; - variables[77] = 0.04; - variables[79] = 88800.0; - variables[80] = 446.0; - variables[82] = 227700.0; - variables[83] = 7.51; - variables[85] = 2277.0; - variables[86] = 2.5; - variables[87] = 751.0; - variables[89] = 1.642e6; - variables[90] = 542.0; - variables[93] = 175.4; - variables[94] = 445.0; - variables[95] = 0.031; - variables[96] = 0.062; - variables[97] = 0.045; - variables[98] = 10.0; - variables[104] = 67.0; - variables[105] = 3.9; - variables[106] = 0.02; - variables[107] = 0.0012; - variables[108] = 0.46; - variables[109] = 0.0116; - variables[118] = 5.7e-5; - variables[119] = 8314.472; - variables[120] = 310.0; - variables[122] = 0.0; - variables[123] = -35.0; - variables[124] = 0.5; - variables[125] = 0.5; - variables[126] = -45.0; - variables[128] = 0.00427; - variables[129] = 45.0; - variables[131] = 0.5927; - variables[135] = 0.0; - variables[141] = 0.0; - variables[144] = 0.0223; - variables[146] = 0.0; - variables[150] = 1.0e-5; - variables[157] = 0.1539e-3; - variables[163] = 0.4578; - variables[169] = -16.4508; - variables[170] = 4.3371; - variables[177] = 0.0; - variables[178] = 0.0; - variables[181] = 0.000338; - variables[183] = 0.0075; - variables[184] = 0.04132; - variables[189] = 0.0; - variables[190] = 3.5e-3; - variables[195] = 0.00424; - variables[204] = 0.00065; - variables[211] = 1.0; - variables[212] = 0.00345; + constants[0] = 0.0; + constants[1] = 0.0; + constants[4] = 140.0; + constants[7] = 5.4; + constants[8] = 140.0; + constants[10] = 1.8; + constants[11] = 1.0; + constants[17] = 96485.3415; + constants[22] = 14.0; + constants[23] = 1.4; + constants[24] = 0.08105; + constants[25] = 0.0; + constants[30] = 3.343; + constants[39] = 26.44; + constants[40] = 0.0207; + constants[41] = 0.1369; + constants[43] = 395.3; + constants[44] = 2.289; + constants[45] = 0.4315; + constants[46] = 26.44; + constants[47] = 4.663; + constants[48] = 3.663; + constants[49] = 0.0; + constants[51] = 1628.0; + constants[52] = 561.4; + constants[54] = 148041085.1; + constants[57] = 15.0; + constants[58] = 1.0; + constants[59] = 0.45; + constants[60] = 2.5; + constants[62] = 10000.0; + constants[64] = 500.0; + constants[65] = 5.0; + constants[66] = 660.0; + constants[70] = 5.0; + constants[72] = 5.469e-5; + constants[74] = 0.000286113; + constants[75] = 5.0e-5; + constants[77] = 0.04; + constants[79] = 88800.0; + constants[80] = 446.0; + constants[82] = 227700.0; + constants[83] = 7.51; + constants[85] = 2277.0; + constants[86] = 2.5; + constants[87] = 751.0; + constants[89] = 1.642e6; + constants[90] = 542.0; + constants[93] = 175.4; + constants[94] = 445.0; + constants[95] = 0.031; + constants[96] = 0.062; + constants[97] = 0.045; + constants[98] = 10.0; + constants[104] = 67.0; + constants[105] = 3.9; + constants[106] = 0.02; + constants[107] = 0.0012; + constants[108] = 0.46; + constants[109] = 0.0116; + constants[118] = 5.7e-5; + constants[119] = 8314.472; + constants[120] = 310.0; + constants[122] = 0.0; + constants[123] = -35.0; + constants[124] = 0.5; + constants[125] = 0.5; + constants[126] = -45.0; + constants[128] = 0.00427; + constants[129] = 45.0; + constants[131] = 0.5927; + constants[135] = 0.0; + constants[141] = 0.0; + constants[144] = 0.0223; + constants[146] = 0.0; + constants[150] = 1.0e-5; + constants[157] = 0.1539e-3; + constants[163] = 0.4578; + constants[169] = -16.4508; + constants[170] = 4.3371; + constants[177] = 0.0; + constants[178] = 0.0; + constants[181] = 0.000338; + constants[183] = 0.0075; + constants[184] = 0.04132; + constants[189] = 0.0; + constants[190] = 3.5e-3; + constants[195] = 0.00424; + constants[204] = 0.00065; + constants[211] = 1.0; + constants[212] = 0.00345; states[0] = 6.226104e-5; states[1] = 5.0; states[2] = 0.409551; @@ -428,266 +428,266 @@ void initialiseVariables(double *states, double *rates, double *constants) void computeComputedConstants(double *constants, double *computedConstants) { - variables[3] = variables[119]*variables[120]/variables[17]; - variables[6] = variables[3]*log(variables[7]/variables[8]); - variables[20] = (variables[1] > 0.0)?1.2:1.0; - variables[35] = variables[4]/(variables[47]+variables[4]); - variables[68] = (variables[1] > 0.0)?-0.25:(variables[0] > 0.0)?0.7*variables[0]/(0.00009+variables[0]):0.0; - variables[69] = variables[70]*(1.0-variables[68]); - variables[103] = 0.000000001*3.14159265358979*pow(variables[105], 2.0)*variables[104]; - variables[19] = 0.000000001*2.0*3.14159265358979*variables[106]*(variables[105]-variables[106]/2.0)*variables[104]; - variables[100] = variables[107]*variables[103]; - variables[18] = variables[108]*variables[103]-variables[19]; - variables[99] = variables[109]*variables[103]; - variables[127] = variables[128]/(variables[7]/(variables[7]+variables[129])); - variables[130] = variables[127]/(variables[131]+1.0); - variables[132] = variables[131]*variables[130]; - variables[133] = variables[132]*variables[7]/(variables[7]+variables[129]); - variables[134] = variables[130]*variables[7]/(variables[7]+variables[129]); - variables[137] = (variables[0] > 0.0)?-1.0-9.898*pow(1.0*variables[0], 0.618)/(pow(1.0*variables[0], 0.618)+0.00122423):0.0; - variables[138] = (variables[1] > 0.0)?7.5:0.0; - variables[162] = (variables[1] > 0.0)?1.23:1.0; - variables[165] = 0.31*variables[0]/(variables[0]+0.00009); - variables[166] = (variables[1] > 0.0)?-8.0:0.0; - variables[167] = (variables[1] > 0.0)?-27.0:0.0; - variables[203] = (variables[1] > 0.0)?1.2*variables[204]:variables[204]; - variables[206] = (variables[1] > 0.0)?-14.0:0.0; - variables[213] = (3.5988-0.025641)/(1.0+0.0000012155/pow(1.0*variables[0], 1.6951))+0.025641; + computedConstants[3] = constants[119]*constants[120]/constants[17]; + computedConstants[6] = computedConstants[3]*log(constants[7]/constants[8]); + computedConstants[20] = (constants[1] > 0.0)?1.2:1.0; + computedConstants[35] = constants[4]/(constants[47]+constants[4]); + computedConstants[68] = (constants[1] > 0.0)?-0.25:(constants[0] > 0.0)?0.7*constants[0]/(0.00009+constants[0]):0.0; + computedConstants[69] = constants[70]*(1.0-computedConstants[68]); + computedConstants[103] = 0.000000001*3.14159265358979*pow(constants[105], 2.0)*constants[104]; + computedConstants[19] = 0.000000001*2.0*3.14159265358979*constants[106]*(constants[105]-constants[106]/2.0)*constants[104]; + computedConstants[100] = constants[107]*computedConstants[103]; + computedConstants[18] = constants[108]*computedConstants[103]-computedConstants[19]; + computedConstants[99] = constants[109]*computedConstants[103]; + computedConstants[127] = constants[128]/(constants[7]/(constants[7]+constants[129])); + computedConstants[130] = computedConstants[127]/(constants[131]+1.0); + computedConstants[132] = constants[131]*computedConstants[130]; + computedConstants[133] = computedConstants[132]*constants[7]/(constants[7]+constants[129]); + computedConstants[134] = computedConstants[130]*constants[7]/(constants[7]+constants[129]); + computedConstants[137] = (constants[0] > 0.0)?-1.0-9.898*pow(1.0*constants[0], 0.618)/(pow(1.0*constants[0], 0.618)+0.00122423):0.0; + computedConstants[138] = (constants[1] > 0.0)?7.5:0.0; + computedConstants[162] = (constants[1] > 0.0)?1.23:1.0; + computedConstants[165] = 0.31*constants[0]/(constants[0]+0.00009); + computedConstants[166] = (constants[1] > 0.0)?-8.0:0.0; + computedConstants[167] = (constants[1] > 0.0)?-27.0:0.0; + computedConstants[203] = (constants[1] > 0.0)?1.2*constants[204]:constants[204]; + computedConstants[206] = (constants[1] > 0.0)?-14.0:0.0; + computedConstants[213] = (3.5988-0.025641)/(1.0+0.0000012155/pow(1.0*constants[0], 1.6951))+0.025641; } void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { - variables[5] = states[1]; - variables[142] = variables[3]*log((variables[4]+0.12*variables[7])/(variables[5]+0.12*variables[8])); - variables[121] = ((voi > variables[124]) && (voi < variables[124]+variables[125]))?variables[123]:variables[126]; - variables[21] = (variables[122] >= 1.0)?variables[121]:states[15]; - variables[143] = variables[144]*pow(states[18], 3.0)*states[17]*(variables[21]-variables[142]); - variables[145] = variables[146]*pow(states[18], 3.0)*(variables[21]-variables[142]); - variables[12] = variables[143]+variables[145]; - variables[15] = 0.0000185*variables[163]*(variables[21]-0.0)/(variables[3]*(1.0-exp(-1.0*(variables[21]-0.0)/variables[3])))*(variables[5]-variables[4]*exp(-1.0*(variables[21]-0.0)/variables[3]))*states[23]*states[22]*states[21]; - variables[2] = variables[3]*log(variables[4]/variables[5]); - variables[16] = states[16]*variables[133]*(variables[21]-variables[2])*(1.0-variables[135]); - variables[14] = variables[20]*variables[24]*pow(1.0+pow(variables[23]/variables[7], 1.2), -1.0)*pow(1.0+pow(variables[22]/variables[5], 1.3), -1.0)*pow(1.0+exp(-(variables[21]-variables[2]+110.0)/20.0), -1.0); - variables[50] = 1.0+variables[10]/variables[48]*(1.0+exp(variables[49]*variables[21]/variables[3]))+variables[4]/variables[51]*(1.0+variables[4]/variables[52]*(1.0+variables[4]/variables[47])); - variables[27] = variables[10]/variables[48]*exp(variables[49]*variables[21]/variables[3])/variables[50]; - variables[42] = 1.0+states[0]/variables[40]*(1.0+exp(-variables[41]*variables[21]/variables[3])+variables[5]/variables[46])+variables[5]/variables[43]*(1.0+variables[5]/variables[44]*(1.0+variables[5]/variables[39])); - variables[29] = states[0]/variables[40]*exp(-variables[41]*variables[21]/variables[3])/variables[42]; - variables[36] = variables[5]/(variables[39]+variables[5]); - variables[37] = exp(variables[45]*variables[21]/(2.0*variables[3])); - variables[33] = exp(-variables[45]*variables[21]/(2.0*variables[3])); - variables[38] = variables[5]/variables[43]*variables[5]/variables[44]*(1.0+variables[5]/variables[39])*exp(variables[45]*variables[21]/(2.0*variables[3]))/variables[42]; - variables[26] = variables[37]*variables[36]*(variables[38]+variables[29])+variables[33]*variables[29]*(variables[35]+variables[37]); - variables[34] = variables[4]/variables[51]*variables[4]/variables[52]*(1.0+variables[4]/variables[47])*exp(-variables[45]*variables[21]/(2.0*variables[3]))/variables[50]; - variables[28] = variables[33]*variables[35]*(variables[34]+variables[27])+variables[27]*variables[37]*(variables[36]+variables[33]); - variables[31] = variables[34]*variables[35]*(variables[38]+variables[29])+variables[38]*variables[27]*(variables[35]+variables[37]); - variables[32] = variables[38]*variables[36]*(variables[34]+variables[27])+variables[29]*variables[34]*(variables[36]+variables[33]); - variables[13] = (1.0-variables[25])*variables[30]*(variables[26]*variables[27]-variables[28]*variables[29])/(variables[28]+variables[26]+variables[32]+variables[31]); - rates[1] = (1.0-variables[11])*-1.0*(variables[12]+variables[16]+variables[15]+3.0*variables[14]+3.0*variables[13])/(1.0*(variables[18]+variables[19])*variables[17]); - variables[56] = variables[57]-(variables[57]-variables[58])/(1.0+pow(variables[59]/states[2], variables[60])); - variables[63] = variables[64]*variables[56]; - variables[61] = variables[62]/variables[56]; - rates[4] = variables[65]*states[5]-variables[63]*states[0]*states[4]-(variables[61]*pow(states[0], 2.0)*states[4]-variables[66]*states[3]); - rates[3] = variables[61]*pow(states[0], 2.0)*states[4]-variables[66]*states[3]-(variables[63]*states[0]*states[3]-variables[65]*states[6]); - rates[6] = variables[63]*states[0]*states[3]-variables[65]*states[6]-(variables[66]*states[6]-variables[61]*pow(states[0], 2.0)*states[5]); - rates[5] = variables[66]*states[6]-variables[61]*pow(states[0], 2.0)*states[5]-(variables[65]*states[5]-variables[63]*states[0]*states[4]); - variables[78] = variables[79]*states[7]*(1.0-states[9])-variables[80]*states[9]; - rates[9] = variables[78]; - variables[81] = variables[82]*states[7]*(1.0-(states[10]+states[11]))-variables[83]*states[10]; - rates[10] = variables[81]; - variables[84] = variables[85]*variables[86]*(1.0-(states[10]+states[11]))-variables[87]*states[11]; - rates[11] = variables[84]; - variables[88] = variables[89]*states[7]*(1.0-states[12])-variables[90]*states[12]; - rates[12] = variables[88]; - variables[91] = variables[89]*states[0]*(1.0-states[13])-variables[90]*states[13]; - rates[13] = variables[91]; - variables[92] = variables[93]*states[2]*(1.0-states[14])-variables[94]*states[14]; - rates[14] = variables[92]; - variables[71] = (states[0]-states[7])/variables[72]; - variables[73] = variables[69]/(1.0+exp((-states[7]+variables[74])/variables[75])); - rates[7] = 1.0*(variables[71]*variables[19]-variables[73]*variables[99])/variables[18]-(variables[97]*variables[88]+variables[95]*variables[78]+variables[96]*variables[81]); - variables[53] = variables[54]*states[3]*(states[2]-states[0]); - variables[101] = 2.0*variables[163]*(variables[21]-0.0)/(variables[3]*(1.0-exp(-1.0*(variables[21]-0.0)*2.0/variables[3])))*(states[0]-variables[10]*exp(-2.0*(variables[21]-0.0)/variables[3]))*states[23]*states[22]*states[21]; - variables[102] = 2.0*variables[184]*variables[21]/(variables[3]*(1.0-exp(-1.0*variables[21]*2.0/variables[3])))*(states[0]-variables[10]*exp(-2.0*variables[21]/variables[3]))*states[25]*states[24]; - rates[0] = variables[53]*variables[100]/variables[19]-((variables[101]+variables[102]-2.0*variables[13])/(2.0*variables[17]*variables[19])+variables[71]+variables[97]*variables[91]); - variables[76] = (states[8]-states[2])/variables[77]; - rates[8] = variables[73]-variables[76]*variables[100]/variables[99]; - rates[2] = variables[76]-(variables[53]+variables[98]*variables[92]); - variables[136] = states[16]*variables[134]*(variables[21]-variables[6])*(1.0-variables[135]); - variables[111] = variables[16]+variables[136]; - variables[112] = variables[157]*states[20]*states[19]*(variables[21]-variables[6]); - variables[113] = (variables[0] > 0.0)?variables[211]*variables[212]*(variables[21]-variables[6])*(1.0+exp((variables[21]+20.0)/20.0))*states[32]:0.0; - variables[164] = 0.000365*variables[163]*(variables[21]-0.0)/(variables[3]*(1.0-exp(-1.0*(variables[21]-0.0)/variables[3])))*(variables[8]-variables[7]*exp(-1.0*(variables[21]-0.0)/variables[3]))*states[23]*states[22]*states[21]; - variables[114] = (variables[101]+variables[164]+variables[15])*(1.0-variables[165])*1.0*variables[162]; - variables[115] = variables[190]*(variables[21]-variables[6])*states[27]*states[26]; - variables[205] = variables[3]*log((variables[7]+0.12*variables[4])/(variables[8]+0.12*variables[5])); - variables[116] = variables[203]*(variables[21]-variables[205])*pow(states[31], 2.0); - variables[117] = variables[195]*(variables[21]-variables[6])*(0.9*states[29]+0.1*states[30])*states[28]; - variables[110] = variables[111]+variables[117]+variables[116]+variables[115]+variables[14]+variables[13]+variables[12]+variables[114]+variables[102]+variables[113]+variables[112]; - rates[15] = -variables[110]/variables[118]; - variables[140] = (variables[21] < -(80.0-variables[137]-variables[138]-variables[141]))?0.01329+0.99921/(1.0+exp((variables[21]+97.134-variables[137]-variables[138]-variables[141])/8.1752)):0.0002501*exp(-(variables[21]-variables[137]-variables[138]-variables[141])/12.861); - variables[139] = 1.0/(0.36*(variables[21]+148.8-variables[137]-variables[138])/(exp(0.066*(variables[21]+148.8-variables[137]-variables[138]))-1.0)+0.1*(variables[21]+87.3-variables[137]-variables[138])/(1.0-exp(-0.2*(variables[21]+87.3-variables[137]-variables[138]))))-0.054; - rates[16] = (variables[140]-states[16])/variables[139]; - variables[147] = 1.0/(1.0+exp(-(variables[21]+42.0504)/8.3106)); - variables[148] = variables[21]+41.0; - variables[149] = (fabs(variables[148]) < variables[150])?2000.0:200.0*variables[148]/(1.0-exp(-0.1*variables[148])); - variables[151] = 8000.0*exp(-0.056*(variables[21]+66.0)); - variables[152] = 1.0/(variables[149]+variables[151]); - rates[18] = (variables[147]-states[18])/variables[152]; - variables[153] = 1.0/(1.0+exp((variables[21]+69.804)/4.4565)); - variables[154] = 20.0*exp(-0.125*(variables[21]+75.0)); - variables[155] = 2000.0/(320.0*exp(-0.1*(variables[21]+75.0))+1.0); - variables[156] = 1.0/(variables[154]+variables[155]); - rates[17] = (variables[153]-states[17])/variables[156]; - variables[158] = 1.0/(1.0+exp((variables[21]+6.0)/-8.6)); - variables[159] = 0.009/(1.0+exp((variables[21]+5.0)/12.0))+0.0005; - rates[20] = (variables[158]-states[20])/variables[159]; - variables[160] = 1.0/(1.0+exp((variables[21]+7.5)/10.0)); - variables[161] = 0.59/(1.0+exp((variables[21]+60.0)/10.0))+3.05; - rates[19] = (variables[160]-states[19])/variables[161]; - variables[168] = 1.0/(1.0+exp(-(variables[21]-variables[169]-variables[166])/(variables[170]*(1.0+variables[167]/100.0)))); - variables[174] = (variables[21] == -41.8)?-41.80001:(variables[21] == 0.0)?0.0:(variables[21] == -6.8)?-6.80001:variables[21]; - variables[172] = -0.02839*(variables[174]+41.8)/(exp(-(variables[174]+41.8)/2.5)-1.0)-0.0849*(variables[174]+6.8)/(exp(-(variables[174]+6.8)/4.8)-1.0); - variables[175] = (variables[21] == -1.8)?-1.80001:variables[21]; - variables[173] = 0.01143*(variables[175]+1.8)/(exp((variables[175]+1.8)/2.5)-1.0); - variables[171] = 0.001/(variables[172]+variables[173]); - rates[23] = (variables[168]-states[23])/variables[171]; - variables[176] = 1.0/(1.0+exp((variables[21]+37.4+variables[177])/(5.3+variables[178]))); - variables[179] = 0.001*(44.3+230.0*exp(-pow((variables[21]+36.0)/10.0, 2.0))); - rates[22] = (variables[176]-states[22])/variables[179]; - variables[180] = variables[181]/(variables[181]+states[0]); - variables[182] = 0.001*variables[180]/variables[183]; - rates[21] = (variables[180]-states[21])/variables[182]; - variables[185] = 1.0/(1.0+exp(-(variables[21]+38.3)/5.5)); - variables[186] = 0.001/(1.068*exp((variables[21]+38.3)/30.0)+1.068*exp(-(variables[21]+38.3)/30.0)); - rates[25] = (variables[185]-states[25])/variables[186]; - variables[187] = 1.0/(1.0+exp((variables[21]+58.7)/3.8)); - variables[188] = 1.0/(16.67*exp(-(variables[21]+75.0)/83.3)+16.67*exp((variables[21]+75.0)/15.38))+variables[189]; - rates[24] = (variables[187]-states[24])/variables[188]; - variables[191] = 1.0/(1.0+exp((variables[21]+49.0)/13.0)); - variables[192] = 0.001*0.6*(65.17/(0.57*exp(-0.08*(variables[21]+44.0))+0.065*exp(0.1*(variables[21]+45.93)))+10.1); - rates[27] = (variables[191]-states[27])/variables[192]; - variables[193] = 1.0/(1.0+exp(-(variables[21]-19.3)/15.0)); - variables[194] = 0.001*0.66*1.4*(15.59/(1.037*exp(0.09*(variables[21]+30.61))+0.369*exp(-0.12*(variables[21]+23.84)))+2.98); - rates[26] = (variables[193]-states[26])/variables[194]; - variables[198] = 1.0/(1.0+exp(-(variables[21]+10.0144)/7.6607)); - variables[199] = 0.84655354/(4.2*exp(variables[21]/17.0)+0.15*exp(-variables[21]/21.6)); - rates[30] = (variables[198]-states[30])/variables[199]; - variables[200] = 1.0/(30.0*exp(variables[21]/10.0)+exp(-variables[21]/12.0)); - rates[29] = (variables[198]-states[29])/variables[200]; - variables[202] = 1.0/(1.0+exp((variables[21]+28.6)/17.1)); - variables[201] = 1.0/(100.0*exp(-variables[21]/54.645)+656.0*exp(variables[21]/106.157)); - rates[28] = (variables[202]-states[28])/variables[201]; - variables[207] = sqrt(1.0/(1.0+exp(-(variables[21]+0.6383-variables[206])/10.7071))); - variables[209] = 28.0/(1.0+exp(-(variables[21]-40.0-variables[206])/3.0)); - variables[210] = 1.0*exp(-(variables[21]-variables[206]-5.0)/25.0); - variables[208] = 1.0/(variables[209]+variables[210]); - rates[31] = (variables[207]-states[31])/variables[208]; - variables[214] = 10.0*exp(0.0133*(variables[21]+40.0)); - variables[215] = variables[213]/(variables[213]+variables[214]); - variables[216] = 1.0/(variables[213]+variables[214]); - rates[32] = (variables[215]-states[32])/variables[216]; + algebraic[5] = states[1]; + algebraic[142] = computedConstants[3]*log((constants[4]+0.12*constants[7])/(algebraic[5]+0.12*constants[8])); + algebraic[121] = ((voi > constants[124]) && (voi < constants[124]+constants[125]))?constants[123]:constants[126]; + algebraic[21] = (constants[122] >= 1.0)?algebraic[121]:states[15]; + algebraic[143] = constants[144]*pow(states[18], 3.0)*states[17]*(algebraic[21]-algebraic[142]); + algebraic[145] = constants[146]*pow(states[18], 3.0)*(algebraic[21]-algebraic[142]); + algebraic[12] = algebraic[143]+algebraic[145]; + algebraic[15] = 0.0000185*constants[163]*(algebraic[21]-0.0)/(computedConstants[3]*(1.0-exp(-1.0*(algebraic[21]-0.0)/computedConstants[3])))*(algebraic[5]-constants[4]*exp(-1.0*(algebraic[21]-0.0)/computedConstants[3]))*states[23]*states[22]*states[21]; + algebraic[2] = computedConstants[3]*log(constants[4]/algebraic[5]); + algebraic[16] = states[16]*computedConstants[133]*(algebraic[21]-algebraic[2])*(1.0-constants[135]); + algebraic[14] = computedConstants[20]*constants[24]*pow(1.0+pow(constants[23]/constants[7], 1.2), -1.0)*pow(1.0+pow(constants[22]/algebraic[5], 1.3), -1.0)*pow(1.0+exp(-(algebraic[21]-algebraic[2]+110.0)/20.0), -1.0); + algebraic[50] = 1.0+constants[10]/constants[48]*(1.0+exp(constants[49]*algebraic[21]/computedConstants[3]))+constants[4]/constants[51]*(1.0+constants[4]/constants[52]*(1.0+constants[4]/constants[47])); + algebraic[27] = constants[10]/constants[48]*exp(constants[49]*algebraic[21]/computedConstants[3])/algebraic[50]; + algebraic[42] = 1.0+states[0]/constants[40]*(1.0+exp(-constants[41]*algebraic[21]/computedConstants[3])+algebraic[5]/constants[46])+algebraic[5]/constants[43]*(1.0+algebraic[5]/constants[44]*(1.0+algebraic[5]/constants[39])); + algebraic[29] = states[0]/constants[40]*exp(-constants[41]*algebraic[21]/computedConstants[3])/algebraic[42]; + algebraic[36] = algebraic[5]/(constants[39]+algebraic[5]); + algebraic[37] = exp(constants[45]*algebraic[21]/(2.0*computedConstants[3])); + algebraic[33] = exp(-constants[45]*algebraic[21]/(2.0*computedConstants[3])); + algebraic[38] = algebraic[5]/constants[43]*algebraic[5]/constants[44]*(1.0+algebraic[5]/constants[39])*exp(constants[45]*algebraic[21]/(2.0*computedConstants[3]))/algebraic[42]; + algebraic[26] = algebraic[37]*algebraic[36]*(algebraic[38]+algebraic[29])+algebraic[33]*algebraic[29]*(computedConstants[35]+algebraic[37]); + algebraic[34] = constants[4]/constants[51]*constants[4]/constants[52]*(1.0+constants[4]/constants[47])*exp(-constants[45]*algebraic[21]/(2.0*computedConstants[3]))/algebraic[50]; + algebraic[28] = algebraic[33]*computedConstants[35]*(algebraic[34]+algebraic[27])+algebraic[27]*algebraic[37]*(algebraic[36]+algebraic[33]); + algebraic[31] = algebraic[34]*computedConstants[35]*(algebraic[38]+algebraic[29])+algebraic[38]*algebraic[27]*(computedConstants[35]+algebraic[37]); + algebraic[32] = algebraic[38]*algebraic[36]*(algebraic[34]+algebraic[27])+algebraic[29]*algebraic[34]*(algebraic[36]+algebraic[33]); + algebraic[13] = (1.0-constants[25])*constants[30]*(algebraic[26]*algebraic[27]-algebraic[28]*algebraic[29])/(algebraic[28]+algebraic[26]+algebraic[32]+algebraic[31]); + rates[1] = (1.0-constants[11])*-1.0*(algebraic[12]+algebraic[16]+algebraic[15]+3.0*algebraic[14]+3.0*algebraic[13])/(1.0*(computedConstants[18]+computedConstants[19])*constants[17]); + algebraic[56] = constants[57]-(constants[57]-constants[58])/(1.0+pow(constants[59]/states[2], constants[60])); + algebraic[63] = constants[64]*algebraic[56]; + algebraic[61] = constants[62]/algebraic[56]; + rates[4] = constants[65]*states[5]-algebraic[63]*states[0]*states[4]-(algebraic[61]*pow(states[0], 2.0)*states[4]-constants[66]*states[3]); + rates[3] = algebraic[61]*pow(states[0], 2.0)*states[4]-constants[66]*states[3]-(algebraic[63]*states[0]*states[3]-constants[65]*states[6]); + rates[6] = algebraic[63]*states[0]*states[3]-constants[65]*states[6]-(constants[66]*states[6]-algebraic[61]*pow(states[0], 2.0)*states[5]); + rates[5] = constants[66]*states[6]-algebraic[61]*pow(states[0], 2.0)*states[5]-(constants[65]*states[5]-algebraic[63]*states[0]*states[4]); + algebraic[78] = constants[79]*states[7]*(1.0-states[9])-constants[80]*states[9]; + rates[9] = algebraic[78]; + algebraic[81] = constants[82]*states[7]*(1.0-(states[10]+states[11]))-constants[83]*states[10]; + rates[10] = algebraic[81]; + algebraic[84] = constants[85]*constants[86]*(1.0-(states[10]+states[11]))-constants[87]*states[11]; + rates[11] = algebraic[84]; + algebraic[88] = constants[89]*states[7]*(1.0-states[12])-constants[90]*states[12]; + rates[12] = algebraic[88]; + algebraic[91] = constants[89]*states[0]*(1.0-states[13])-constants[90]*states[13]; + rates[13] = algebraic[91]; + algebraic[92] = constants[93]*states[2]*(1.0-states[14])-constants[94]*states[14]; + rates[14] = algebraic[92]; + algebraic[71] = (states[0]-states[7])/constants[72]; + algebraic[73] = computedConstants[69]/(1.0+exp((-states[7]+constants[74])/constants[75])); + rates[7] = 1.0*(algebraic[71]*computedConstants[19]-algebraic[73]*computedConstants[99])/computedConstants[18]-(constants[97]*algebraic[88]+constants[95]*algebraic[78]+constants[96]*algebraic[81]); + algebraic[53] = constants[54]*states[3]*(states[2]-states[0]); + algebraic[101] = 2.0*constants[163]*(algebraic[21]-0.0)/(computedConstants[3]*(1.0-exp(-1.0*(algebraic[21]-0.0)*2.0/computedConstants[3])))*(states[0]-constants[10]*exp(-2.0*(algebraic[21]-0.0)/computedConstants[3]))*states[23]*states[22]*states[21]; + algebraic[102] = 2.0*constants[184]*algebraic[21]/(computedConstants[3]*(1.0-exp(-1.0*algebraic[21]*2.0/computedConstants[3])))*(states[0]-constants[10]*exp(-2.0*algebraic[21]/computedConstants[3]))*states[25]*states[24]; + rates[0] = algebraic[53]*computedConstants[100]/computedConstants[19]-((algebraic[101]+algebraic[102]-2.0*algebraic[13])/(2.0*constants[17]*computedConstants[19])+algebraic[71]+constants[97]*algebraic[91]); + algebraic[76] = (states[8]-states[2])/constants[77]; + rates[8] = algebraic[73]-algebraic[76]*computedConstants[100]/computedConstants[99]; + rates[2] = algebraic[76]-(algebraic[53]+constants[98]*algebraic[92]); + algebraic[136] = states[16]*computedConstants[134]*(algebraic[21]-computedConstants[6])*(1.0-constants[135]); + algebraic[111] = algebraic[16]+algebraic[136]; + algebraic[112] = constants[157]*states[20]*states[19]*(algebraic[21]-computedConstants[6]); + algebraic[113] = (constants[0] > 0.0)?constants[211]*constants[212]*(algebraic[21]-computedConstants[6])*(1.0+exp((algebraic[21]+20.0)/20.0))*states[32]:0.0; + algebraic[164] = 0.000365*constants[163]*(algebraic[21]-0.0)/(computedConstants[3]*(1.0-exp(-1.0*(algebraic[21]-0.0)/computedConstants[3])))*(constants[8]-constants[7]*exp(-1.0*(algebraic[21]-0.0)/computedConstants[3]))*states[23]*states[22]*states[21]; + algebraic[114] = (algebraic[101]+algebraic[164]+algebraic[15])*(1.0-computedConstants[165])*1.0*computedConstants[162]; + algebraic[115] = constants[190]*(algebraic[21]-computedConstants[6])*states[27]*states[26]; + algebraic[205] = computedConstants[3]*log((constants[7]+0.12*constants[4])/(constants[8]+0.12*algebraic[5])); + algebraic[116] = computedConstants[203]*(algebraic[21]-algebraic[205])*pow(states[31], 2.0); + algebraic[117] = constants[195]*(algebraic[21]-computedConstants[6])*(0.9*states[29]+0.1*states[30])*states[28]; + algebraic[110] = algebraic[111]+algebraic[117]+algebraic[116]+algebraic[115]+algebraic[14]+algebraic[13]+algebraic[12]+algebraic[114]+algebraic[102]+algebraic[113]+algebraic[112]; + rates[15] = -algebraic[110]/constants[118]; + algebraic[140] = (algebraic[21] < -(80.0-computedConstants[137]-computedConstants[138]-constants[141]))?0.01329+0.99921/(1.0+exp((algebraic[21]+97.134-computedConstants[137]-computedConstants[138]-constants[141])/8.1752)):0.0002501*exp(-(algebraic[21]-computedConstants[137]-computedConstants[138]-constants[141])/12.861); + algebraic[139] = 1.0/(0.36*(algebraic[21]+148.8-computedConstants[137]-computedConstants[138])/(exp(0.066*(algebraic[21]+148.8-computedConstants[137]-computedConstants[138]))-1.0)+0.1*(algebraic[21]+87.3-computedConstants[137]-computedConstants[138])/(1.0-exp(-0.2*(algebraic[21]+87.3-computedConstants[137]-computedConstants[138]))))-0.054; + rates[16] = (algebraic[140]-states[16])/algebraic[139]; + algebraic[147] = 1.0/(1.0+exp(-(algebraic[21]+42.0504)/8.3106)); + algebraic[148] = algebraic[21]+41.0; + algebraic[149] = (fabs(algebraic[148]) < constants[150])?2000.0:200.0*algebraic[148]/(1.0-exp(-0.1*algebraic[148])); + algebraic[151] = 8000.0*exp(-0.056*(algebraic[21]+66.0)); + algebraic[152] = 1.0/(algebraic[149]+algebraic[151]); + rates[18] = (algebraic[147]-states[18])/algebraic[152]; + algebraic[153] = 1.0/(1.0+exp((algebraic[21]+69.804)/4.4565)); + algebraic[154] = 20.0*exp(-0.125*(algebraic[21]+75.0)); + algebraic[155] = 2000.0/(320.0*exp(-0.1*(algebraic[21]+75.0))+1.0); + algebraic[156] = 1.0/(algebraic[154]+algebraic[155]); + rates[17] = (algebraic[153]-states[17])/algebraic[156]; + algebraic[158] = 1.0/(1.0+exp((algebraic[21]+6.0)/-8.6)); + algebraic[159] = 0.009/(1.0+exp((algebraic[21]+5.0)/12.0))+0.0005; + rates[20] = (algebraic[158]-states[20])/algebraic[159]; + algebraic[160] = 1.0/(1.0+exp((algebraic[21]+7.5)/10.0)); + algebraic[161] = 0.59/(1.0+exp((algebraic[21]+60.0)/10.0))+3.05; + rates[19] = (algebraic[160]-states[19])/algebraic[161]; + algebraic[168] = 1.0/(1.0+exp(-(algebraic[21]-constants[169]-computedConstants[166])/(constants[170]*(1.0+computedConstants[167]/100.0)))); + algebraic[174] = (algebraic[21] == -41.8)?-41.80001:(algebraic[21] == 0.0)?0.0:(algebraic[21] == -6.8)?-6.80001:algebraic[21]; + algebraic[172] = -0.02839*(algebraic[174]+41.8)/(exp(-(algebraic[174]+41.8)/2.5)-1.0)-0.0849*(algebraic[174]+6.8)/(exp(-(algebraic[174]+6.8)/4.8)-1.0); + algebraic[175] = (algebraic[21] == -1.8)?-1.80001:algebraic[21]; + algebraic[173] = 0.01143*(algebraic[175]+1.8)/(exp((algebraic[175]+1.8)/2.5)-1.0); + algebraic[171] = 0.001/(algebraic[172]+algebraic[173]); + rates[23] = (algebraic[168]-states[23])/algebraic[171]; + algebraic[176] = 1.0/(1.0+exp((algebraic[21]+37.4+constants[177])/(5.3+constants[178]))); + algebraic[179] = 0.001*(44.3+230.0*exp(-pow((algebraic[21]+36.0)/10.0, 2.0))); + rates[22] = (algebraic[176]-states[22])/algebraic[179]; + algebraic[180] = constants[181]/(constants[181]+states[0]); + algebraic[182] = 0.001*algebraic[180]/constants[183]; + rates[21] = (algebraic[180]-states[21])/algebraic[182]; + algebraic[185] = 1.0/(1.0+exp(-(algebraic[21]+38.3)/5.5)); + algebraic[186] = 0.001/(1.068*exp((algebraic[21]+38.3)/30.0)+1.068*exp(-(algebraic[21]+38.3)/30.0)); + rates[25] = (algebraic[185]-states[25])/algebraic[186]; + algebraic[187] = 1.0/(1.0+exp((algebraic[21]+58.7)/3.8)); + algebraic[188] = 1.0/(16.67*exp(-(algebraic[21]+75.0)/83.3)+16.67*exp((algebraic[21]+75.0)/15.38))+constants[189]; + rates[24] = (algebraic[187]-states[24])/algebraic[188]; + algebraic[191] = 1.0/(1.0+exp((algebraic[21]+49.0)/13.0)); + algebraic[192] = 0.001*0.6*(65.17/(0.57*exp(-0.08*(algebraic[21]+44.0))+0.065*exp(0.1*(algebraic[21]+45.93)))+10.1); + rates[27] = (algebraic[191]-states[27])/algebraic[192]; + algebraic[193] = 1.0/(1.0+exp(-(algebraic[21]-19.3)/15.0)); + algebraic[194] = 0.001*0.66*1.4*(15.59/(1.037*exp(0.09*(algebraic[21]+30.61))+0.369*exp(-0.12*(algebraic[21]+23.84)))+2.98); + rates[26] = (algebraic[193]-states[26])/algebraic[194]; + algebraic[198] = 1.0/(1.0+exp(-(algebraic[21]+10.0144)/7.6607)); + algebraic[199] = 0.84655354/(4.2*exp(algebraic[21]/17.0)+0.15*exp(-algebraic[21]/21.6)); + rates[30] = (algebraic[198]-states[30])/algebraic[199]; + algebraic[200] = 1.0/(30.0*exp(algebraic[21]/10.0)+exp(-algebraic[21]/12.0)); + rates[29] = (algebraic[198]-states[29])/algebraic[200]; + algebraic[202] = 1.0/(1.0+exp((algebraic[21]+28.6)/17.1)); + algebraic[201] = 1.0/(100.0*exp(-algebraic[21]/54.645)+656.0*exp(algebraic[21]/106.157)); + rates[28] = (algebraic[202]-states[28])/algebraic[201]; + algebraic[207] = sqrt(1.0/(1.0+exp(-(algebraic[21]+0.6383-computedConstants[206])/10.7071))); + algebraic[209] = 28.0/(1.0+exp(-(algebraic[21]-40.0-computedConstants[206])/3.0)); + algebraic[210] = 1.0*exp(-(algebraic[21]-computedConstants[206]-5.0)/25.0); + algebraic[208] = 1.0/(algebraic[209]+algebraic[210]); + rates[31] = (algebraic[207]-states[31])/algebraic[208]; + algebraic[214] = 10.0*exp(0.0133*(algebraic[21]+40.0)); + algebraic[215] = computedConstants[213]/(computedConstants[213]+algebraic[214]); + algebraic[216] = 1.0/(computedConstants[213]+algebraic[214]); + rates[32] = (algebraic[215]-states[32])/algebraic[216]; } void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { - variables[5] = states[1]; - variables[2] = variables[3]*log(variables[4]/variables[5]); - variables[9] = 0.5*variables[3]*log(variables[10]/states[0]); - variables[21] = (variables[122] >= 1.0)?variables[121]:states[15]; - variables[14] = variables[20]*variables[24]*pow(1.0+pow(variables[23]/variables[7], 1.2), -1.0)*pow(1.0+pow(variables[22]/variables[5], 1.3), -1.0)*pow(1.0+exp(-(variables[21]-variables[2]+110.0)/20.0), -1.0); - variables[50] = 1.0+variables[10]/variables[48]*(1.0+exp(variables[49]*variables[21]/variables[3]))+variables[4]/variables[51]*(1.0+variables[4]/variables[52]*(1.0+variables[4]/variables[47])); - variables[27] = variables[10]/variables[48]*exp(variables[49]*variables[21]/variables[3])/variables[50]; - variables[42] = 1.0+states[0]/variables[40]*(1.0+exp(-variables[41]*variables[21]/variables[3])+variables[5]/variables[46])+variables[5]/variables[43]*(1.0+variables[5]/variables[44]*(1.0+variables[5]/variables[39])); - variables[29] = states[0]/variables[40]*exp(-variables[41]*variables[21]/variables[3])/variables[42]; - variables[36] = variables[5]/(variables[39]+variables[5]); - variables[37] = exp(variables[45]*variables[21]/(2.0*variables[3])); - variables[33] = exp(-variables[45]*variables[21]/(2.0*variables[3])); - variables[38] = variables[5]/variables[43]*variables[5]/variables[44]*(1.0+variables[5]/variables[39])*exp(variables[45]*variables[21]/(2.0*variables[3]))/variables[42]; - variables[26] = variables[37]*variables[36]*(variables[38]+variables[29])+variables[33]*variables[29]*(variables[35]+variables[37]); - variables[34] = variables[4]/variables[51]*variables[4]/variables[52]*(1.0+variables[4]/variables[47])*exp(-variables[45]*variables[21]/(2.0*variables[3]))/variables[50]; - variables[28] = variables[33]*variables[35]*(variables[34]+variables[27])+variables[27]*variables[37]*(variables[36]+variables[33]); - variables[31] = variables[34]*variables[35]*(variables[38]+variables[29])+variables[38]*variables[27]*(variables[35]+variables[37]); - variables[32] = variables[38]*variables[36]*(variables[34]+variables[27])+variables[29]*variables[34]*(variables[36]+variables[33]); - variables[13] = (1.0-variables[25])*variables[30]*(variables[26]*variables[27]-variables[28]*variables[29])/(variables[28]+variables[26]+variables[32]+variables[31]); - variables[53] = variables[54]*states[3]*(states[2]-states[0]); - variables[55] = states[2]-states[0]; - variables[56] = variables[57]-(variables[57]-variables[58])/(1.0+pow(variables[59]/states[2], variables[60])); - variables[61] = variables[62]/variables[56]; - variables[63] = variables[64]*variables[56]; - variables[67] = states[4]+states[3]+states[6]+states[5]; - variables[71] = (states[0]-states[7])/variables[72]; - variables[73] = variables[69]/(1.0+exp((-states[7]+variables[74])/variables[75])); - variables[76] = (states[8]-states[2])/variables[77]; - variables[78] = variables[79]*states[7]*(1.0-states[9])-variables[80]*states[9]; - variables[81] = variables[82]*states[7]*(1.0-(states[10]+states[11]))-variables[83]*states[10]; - variables[84] = variables[85]*variables[86]*(1.0-(states[10]+states[11]))-variables[87]*states[11]; - variables[88] = variables[89]*states[7]*(1.0-states[12])-variables[90]*states[12]; - variables[91] = variables[89]*states[0]*(1.0-states[13])-variables[90]*states[13]; - variables[92] = variables[93]*states[2]*(1.0-states[14])-variables[94]*states[14]; - variables[16] = states[16]*variables[133]*(variables[21]-variables[2])*(1.0-variables[135]); - variables[136] = states[16]*variables[134]*(variables[21]-variables[6])*(1.0-variables[135]); - variables[111] = variables[16]+variables[136]; - variables[112] = variables[157]*states[20]*states[19]*(variables[21]-variables[6]); - variables[113] = (variables[0] > 0.0)?variables[211]*variables[212]*(variables[21]-variables[6])*(1.0+exp((variables[21]+20.0)/20.0))*states[32]:0.0; - variables[102] = 2.0*variables[184]*variables[21]/(variables[3]*(1.0-exp(-1.0*variables[21]*2.0/variables[3])))*(states[0]-variables[10]*exp(-2.0*variables[21]/variables[3]))*states[25]*states[24]; - variables[101] = 2.0*variables[163]*(variables[21]-0.0)/(variables[3]*(1.0-exp(-1.0*(variables[21]-0.0)*2.0/variables[3])))*(states[0]-variables[10]*exp(-2.0*(variables[21]-0.0)/variables[3]))*states[23]*states[22]*states[21]; - variables[15] = 0.0000185*variables[163]*(variables[21]-0.0)/(variables[3]*(1.0-exp(-1.0*(variables[21]-0.0)/variables[3])))*(variables[5]-variables[4]*exp(-1.0*(variables[21]-0.0)/variables[3]))*states[23]*states[22]*states[21]; - variables[164] = 0.000365*variables[163]*(variables[21]-0.0)/(variables[3]*(1.0-exp(-1.0*(variables[21]-0.0)/variables[3])))*(variables[8]-variables[7]*exp(-1.0*(variables[21]-0.0)/variables[3]))*states[23]*states[22]*states[21]; - variables[114] = (variables[101]+variables[164]+variables[15])*(1.0-variables[165])*1.0*variables[162]; - variables[142] = variables[3]*log((variables[4]+0.12*variables[7])/(variables[5]+0.12*variables[8])); - variables[143] = variables[144]*pow(states[18], 3.0)*states[17]*(variables[21]-variables[142]); - variables[145] = variables[146]*pow(states[18], 3.0)*(variables[21]-variables[142]); - variables[12] = variables[143]+variables[145]; - variables[115] = variables[190]*(variables[21]-variables[6])*states[27]*states[26]; - variables[205] = variables[3]*log((variables[7]+0.12*variables[4])/(variables[8]+0.12*variables[5])); - variables[116] = variables[203]*(variables[21]-variables[205])*pow(states[31], 2.0); - variables[117] = variables[195]*(variables[21]-variables[6])*(0.9*states[29]+0.1*states[30])*states[28]; - variables[110] = variables[111]+variables[117]+variables[116]+variables[115]+variables[14]+variables[13]+variables[12]+variables[114]+variables[102]+variables[113]+variables[112]; - variables[139] = 1.0/(0.36*(variables[21]+148.8-variables[137]-variables[138])/(exp(0.066*(variables[21]+148.8-variables[137]-variables[138]))-1.0)+0.1*(variables[21]+87.3-variables[137]-variables[138])/(1.0-exp(-0.2*(variables[21]+87.3-variables[137]-variables[138]))))-0.054; - variables[140] = (variables[21] < -(80.0-variables[137]-variables[138]-variables[141]))?0.01329+0.99921/(1.0+exp((variables[21]+97.134-variables[137]-variables[138]-variables[141])/8.1752)):0.0002501*exp(-(variables[21]-variables[137]-variables[138]-variables[141])/12.861); - variables[147] = 1.0/(1.0+exp(-(variables[21]+42.0504)/8.3106)); - variables[148] = variables[21]+41.0; - variables[149] = (fabs(variables[148]) < variables[150])?2000.0:200.0*variables[148]/(1.0-exp(-0.1*variables[148])); - variables[151] = 8000.0*exp(-0.056*(variables[21]+66.0)); - variables[152] = 1.0/(variables[149]+variables[151]); - variables[153] = 1.0/(1.0+exp((variables[21]+69.804)/4.4565)); - variables[154] = 20.0*exp(-0.125*(variables[21]+75.0)); - variables[155] = 2000.0/(320.0*exp(-0.1*(variables[21]+75.0))+1.0); - variables[156] = 1.0/(variables[154]+variables[155]); - variables[158] = 1.0/(1.0+exp((variables[21]+6.0)/-8.6)); - variables[159] = 0.009/(1.0+exp((variables[21]+5.0)/12.0))+0.0005; - variables[160] = 1.0/(1.0+exp((variables[21]+7.5)/10.0)); - variables[161] = 0.59/(1.0+exp((variables[21]+60.0)/10.0))+3.05; - variables[168] = 1.0/(1.0+exp(-(variables[21]-variables[169]-variables[166])/(variables[170]*(1.0+variables[167]/100.0)))); - variables[174] = (variables[21] == -41.8)?-41.80001:(variables[21] == 0.0)?0.0:(variables[21] == -6.8)?-6.80001:variables[21]; - variables[172] = -0.02839*(variables[174]+41.8)/(exp(-(variables[174]+41.8)/2.5)-1.0)-0.0849*(variables[174]+6.8)/(exp(-(variables[174]+6.8)/4.8)-1.0); - variables[175] = (variables[21] == -1.8)?-1.80001:variables[21]; - variables[173] = 0.01143*(variables[175]+1.8)/(exp((variables[175]+1.8)/2.5)-1.0); - variables[171] = 0.001/(variables[172]+variables[173]); - variables[176] = 1.0/(1.0+exp((variables[21]+37.4+variables[177])/(5.3+variables[178]))); - variables[179] = 0.001*(44.3+230.0*exp(-pow((variables[21]+36.0)/10.0, 2.0))); - variables[180] = variables[181]/(variables[181]+states[0]); - variables[182] = 0.001*variables[180]/variables[183]; - variables[185] = 1.0/(1.0+exp(-(variables[21]+38.3)/5.5)); - variables[186] = 0.001/(1.068*exp((variables[21]+38.3)/30.0)+1.068*exp(-(variables[21]+38.3)/30.0)); - variables[187] = 1.0/(1.0+exp((variables[21]+58.7)/3.8)); - variables[188] = 1.0/(16.67*exp(-(variables[21]+75.0)/83.3)+16.67*exp((variables[21]+75.0)/15.38))+variables[189]; - variables[191] = 1.0/(1.0+exp((variables[21]+49.0)/13.0)); - variables[192] = 0.001*0.6*(65.17/(0.57*exp(-0.08*(variables[21]+44.0))+0.065*exp(0.1*(variables[21]+45.93)))+10.1); - variables[193] = 1.0/(1.0+exp(-(variables[21]-19.3)/15.0)); - variables[194] = 0.001*0.66*1.4*(15.59/(1.037*exp(0.09*(variables[21]+30.61))+0.369*exp(-0.12*(variables[21]+23.84)))+2.98); - variables[196] = 1.0/(1.0+exp(-(variables[21]+23.2)/6.6))/(0.84655354/(37.2*exp(variables[21]/11.9)+0.96*exp(-variables[21]/18.5))); - variables[197] = 4.0*((37.2*exp(variables[21]/15.9)+0.96*exp(-variables[21]/22.5))/0.84655354-1.0/(1.0+exp(-(variables[21]+23.2)/10.6))/(0.84655354/(37.2*exp(variables[21]/15.9)+0.96*exp(-variables[21]/22.5)))); - variables[198] = 1.0/(1.0+exp(-(variables[21]+10.0144)/7.6607)); - variables[199] = 0.84655354/(4.2*exp(variables[21]/17.0)+0.15*exp(-variables[21]/21.6)); - variables[200] = 1.0/(30.0*exp(variables[21]/10.0)+exp(-variables[21]/12.0)); - variables[201] = 1.0/(100.0*exp(-variables[21]/54.645)+656.0*exp(variables[21]/106.157)); - variables[202] = 1.0/(1.0+exp((variables[21]+28.6)/17.1)); - variables[207] = sqrt(1.0/(1.0+exp(-(variables[21]+0.6383-variables[206])/10.7071))); - variables[209] = 28.0/(1.0+exp(-(variables[21]-40.0-variables[206])/3.0)); - variables[210] = 1.0*exp(-(variables[21]-variables[206]-5.0)/25.0); - variables[208] = 1.0/(variables[209]+variables[210]); - variables[214] = 10.0*exp(0.0133*(variables[21]+40.0)); - variables[215] = variables[213]/(variables[213]+variables[214]); - variables[216] = 1.0/(variables[213]+variables[214]); + algebraic[5] = states[1]; + algebraic[2] = computedConstants[3]*log(constants[4]/algebraic[5]); + algebraic[9] = 0.5*computedConstants[3]*log(constants[10]/states[0]); + algebraic[21] = (constants[122] >= 1.0)?algebraic[121]:states[15]; + algebraic[14] = computedConstants[20]*constants[24]*pow(1.0+pow(constants[23]/constants[7], 1.2), -1.0)*pow(1.0+pow(constants[22]/algebraic[5], 1.3), -1.0)*pow(1.0+exp(-(algebraic[21]-algebraic[2]+110.0)/20.0), -1.0); + algebraic[50] = 1.0+constants[10]/constants[48]*(1.0+exp(constants[49]*algebraic[21]/computedConstants[3]))+constants[4]/constants[51]*(1.0+constants[4]/constants[52]*(1.0+constants[4]/constants[47])); + algebraic[27] = constants[10]/constants[48]*exp(constants[49]*algebraic[21]/computedConstants[3])/algebraic[50]; + algebraic[42] = 1.0+states[0]/constants[40]*(1.0+exp(-constants[41]*algebraic[21]/computedConstants[3])+algebraic[5]/constants[46])+algebraic[5]/constants[43]*(1.0+algebraic[5]/constants[44]*(1.0+algebraic[5]/constants[39])); + algebraic[29] = states[0]/constants[40]*exp(-constants[41]*algebraic[21]/computedConstants[3])/algebraic[42]; + algebraic[36] = algebraic[5]/(constants[39]+algebraic[5]); + algebraic[37] = exp(constants[45]*algebraic[21]/(2.0*computedConstants[3])); + algebraic[33] = exp(-constants[45]*algebraic[21]/(2.0*computedConstants[3])); + algebraic[38] = algebraic[5]/constants[43]*algebraic[5]/constants[44]*(1.0+algebraic[5]/constants[39])*exp(constants[45]*algebraic[21]/(2.0*computedConstants[3]))/algebraic[42]; + algebraic[26] = algebraic[37]*algebraic[36]*(algebraic[38]+algebraic[29])+algebraic[33]*algebraic[29]*(computedConstants[35]+algebraic[37]); + algebraic[34] = constants[4]/constants[51]*constants[4]/constants[52]*(1.0+constants[4]/constants[47])*exp(-constants[45]*algebraic[21]/(2.0*computedConstants[3]))/algebraic[50]; + algebraic[28] = algebraic[33]*computedConstants[35]*(algebraic[34]+algebraic[27])+algebraic[27]*algebraic[37]*(algebraic[36]+algebraic[33]); + algebraic[31] = algebraic[34]*computedConstants[35]*(algebraic[38]+algebraic[29])+algebraic[38]*algebraic[27]*(computedConstants[35]+algebraic[37]); + algebraic[32] = algebraic[38]*algebraic[36]*(algebraic[34]+algebraic[27])+algebraic[29]*algebraic[34]*(algebraic[36]+algebraic[33]); + algebraic[13] = (1.0-constants[25])*constants[30]*(algebraic[26]*algebraic[27]-algebraic[28]*algebraic[29])/(algebraic[28]+algebraic[26]+algebraic[32]+algebraic[31]); + algebraic[53] = constants[54]*states[3]*(states[2]-states[0]); + algebraic[55] = states[2]-states[0]; + algebraic[56] = constants[57]-(constants[57]-constants[58])/(1.0+pow(constants[59]/states[2], constants[60])); + algebraic[61] = constants[62]/algebraic[56]; + algebraic[63] = constants[64]*algebraic[56]; + algebraic[67] = states[4]+states[3]+states[6]+states[5]; + algebraic[71] = (states[0]-states[7])/constants[72]; + algebraic[73] = computedConstants[69]/(1.0+exp((-states[7]+constants[74])/constants[75])); + algebraic[76] = (states[8]-states[2])/constants[77]; + algebraic[78] = constants[79]*states[7]*(1.0-states[9])-constants[80]*states[9]; + algebraic[81] = constants[82]*states[7]*(1.0-(states[10]+states[11]))-constants[83]*states[10]; + algebraic[84] = constants[85]*constants[86]*(1.0-(states[10]+states[11]))-constants[87]*states[11]; + algebraic[88] = constants[89]*states[7]*(1.0-states[12])-constants[90]*states[12]; + algebraic[91] = constants[89]*states[0]*(1.0-states[13])-constants[90]*states[13]; + algebraic[92] = constants[93]*states[2]*(1.0-states[14])-constants[94]*states[14]; + algebraic[16] = states[16]*computedConstants[133]*(algebraic[21]-algebraic[2])*(1.0-constants[135]); + algebraic[136] = states[16]*computedConstants[134]*(algebraic[21]-computedConstants[6])*(1.0-constants[135]); + algebraic[111] = algebraic[16]+algebraic[136]; + algebraic[112] = constants[157]*states[20]*states[19]*(algebraic[21]-computedConstants[6]); + algebraic[113] = (constants[0] > 0.0)?constants[211]*constants[212]*(algebraic[21]-computedConstants[6])*(1.0+exp((algebraic[21]+20.0)/20.0))*states[32]:0.0; + algebraic[102] = 2.0*constants[184]*algebraic[21]/(computedConstants[3]*(1.0-exp(-1.0*algebraic[21]*2.0/computedConstants[3])))*(states[0]-constants[10]*exp(-2.0*algebraic[21]/computedConstants[3]))*states[25]*states[24]; + algebraic[101] = 2.0*constants[163]*(algebraic[21]-0.0)/(computedConstants[3]*(1.0-exp(-1.0*(algebraic[21]-0.0)*2.0/computedConstants[3])))*(states[0]-constants[10]*exp(-2.0*(algebraic[21]-0.0)/computedConstants[3]))*states[23]*states[22]*states[21]; + algebraic[15] = 0.0000185*constants[163]*(algebraic[21]-0.0)/(computedConstants[3]*(1.0-exp(-1.0*(algebraic[21]-0.0)/computedConstants[3])))*(algebraic[5]-constants[4]*exp(-1.0*(algebraic[21]-0.0)/computedConstants[3]))*states[23]*states[22]*states[21]; + algebraic[164] = 0.000365*constants[163]*(algebraic[21]-0.0)/(computedConstants[3]*(1.0-exp(-1.0*(algebraic[21]-0.0)/computedConstants[3])))*(constants[8]-constants[7]*exp(-1.0*(algebraic[21]-0.0)/computedConstants[3]))*states[23]*states[22]*states[21]; + algebraic[114] = (algebraic[101]+algebraic[164]+algebraic[15])*(1.0-computedConstants[165])*1.0*computedConstants[162]; + algebraic[142] = computedConstants[3]*log((constants[4]+0.12*constants[7])/(algebraic[5]+0.12*constants[8])); + algebraic[143] = constants[144]*pow(states[18], 3.0)*states[17]*(algebraic[21]-algebraic[142]); + algebraic[145] = constants[146]*pow(states[18], 3.0)*(algebraic[21]-algebraic[142]); + algebraic[12] = algebraic[143]+algebraic[145]; + algebraic[115] = constants[190]*(algebraic[21]-computedConstants[6])*states[27]*states[26]; + algebraic[205] = computedConstants[3]*log((constants[7]+0.12*constants[4])/(constants[8]+0.12*algebraic[5])); + algebraic[116] = computedConstants[203]*(algebraic[21]-algebraic[205])*pow(states[31], 2.0); + algebraic[117] = constants[195]*(algebraic[21]-computedConstants[6])*(0.9*states[29]+0.1*states[30])*states[28]; + algebraic[110] = algebraic[111]+algebraic[117]+algebraic[116]+algebraic[115]+algebraic[14]+algebraic[13]+algebraic[12]+algebraic[114]+algebraic[102]+algebraic[113]+algebraic[112]; + algebraic[139] = 1.0/(0.36*(algebraic[21]+148.8-computedConstants[137]-computedConstants[138])/(exp(0.066*(algebraic[21]+148.8-computedConstants[137]-computedConstants[138]))-1.0)+0.1*(algebraic[21]+87.3-computedConstants[137]-computedConstants[138])/(1.0-exp(-0.2*(algebraic[21]+87.3-computedConstants[137]-computedConstants[138]))))-0.054; + algebraic[140] = (algebraic[21] < -(80.0-computedConstants[137]-computedConstants[138]-constants[141]))?0.01329+0.99921/(1.0+exp((algebraic[21]+97.134-computedConstants[137]-computedConstants[138]-constants[141])/8.1752)):0.0002501*exp(-(algebraic[21]-computedConstants[137]-computedConstants[138]-constants[141])/12.861); + algebraic[147] = 1.0/(1.0+exp(-(algebraic[21]+42.0504)/8.3106)); + algebraic[148] = algebraic[21]+41.0; + algebraic[149] = (fabs(algebraic[148]) < constants[150])?2000.0:200.0*algebraic[148]/(1.0-exp(-0.1*algebraic[148])); + algebraic[151] = 8000.0*exp(-0.056*(algebraic[21]+66.0)); + algebraic[152] = 1.0/(algebraic[149]+algebraic[151]); + algebraic[153] = 1.0/(1.0+exp((algebraic[21]+69.804)/4.4565)); + algebraic[154] = 20.0*exp(-0.125*(algebraic[21]+75.0)); + algebraic[155] = 2000.0/(320.0*exp(-0.1*(algebraic[21]+75.0))+1.0); + algebraic[156] = 1.0/(algebraic[154]+algebraic[155]); + algebraic[158] = 1.0/(1.0+exp((algebraic[21]+6.0)/-8.6)); + algebraic[159] = 0.009/(1.0+exp((algebraic[21]+5.0)/12.0))+0.0005; + algebraic[160] = 1.0/(1.0+exp((algebraic[21]+7.5)/10.0)); + algebraic[161] = 0.59/(1.0+exp((algebraic[21]+60.0)/10.0))+3.05; + algebraic[168] = 1.0/(1.0+exp(-(algebraic[21]-constants[169]-computedConstants[166])/(constants[170]*(1.0+computedConstants[167]/100.0)))); + algebraic[174] = (algebraic[21] == -41.8)?-41.80001:(algebraic[21] == 0.0)?0.0:(algebraic[21] == -6.8)?-6.80001:algebraic[21]; + algebraic[172] = -0.02839*(algebraic[174]+41.8)/(exp(-(algebraic[174]+41.8)/2.5)-1.0)-0.0849*(algebraic[174]+6.8)/(exp(-(algebraic[174]+6.8)/4.8)-1.0); + algebraic[175] = (algebraic[21] == -1.8)?-1.80001:algebraic[21]; + algebraic[173] = 0.01143*(algebraic[175]+1.8)/(exp((algebraic[175]+1.8)/2.5)-1.0); + algebraic[171] = 0.001/(algebraic[172]+algebraic[173]); + algebraic[176] = 1.0/(1.0+exp((algebraic[21]+37.4+constants[177])/(5.3+constants[178]))); + algebraic[179] = 0.001*(44.3+230.0*exp(-pow((algebraic[21]+36.0)/10.0, 2.0))); + algebraic[180] = constants[181]/(constants[181]+states[0]); + algebraic[182] = 0.001*algebraic[180]/constants[183]; + algebraic[185] = 1.0/(1.0+exp(-(algebraic[21]+38.3)/5.5)); + algebraic[186] = 0.001/(1.068*exp((algebraic[21]+38.3)/30.0)+1.068*exp(-(algebraic[21]+38.3)/30.0)); + algebraic[187] = 1.0/(1.0+exp((algebraic[21]+58.7)/3.8)); + algebraic[188] = 1.0/(16.67*exp(-(algebraic[21]+75.0)/83.3)+16.67*exp((algebraic[21]+75.0)/15.38))+constants[189]; + algebraic[191] = 1.0/(1.0+exp((algebraic[21]+49.0)/13.0)); + algebraic[192] = 0.001*0.6*(65.17/(0.57*exp(-0.08*(algebraic[21]+44.0))+0.065*exp(0.1*(algebraic[21]+45.93)))+10.1); + algebraic[193] = 1.0/(1.0+exp(-(algebraic[21]-19.3)/15.0)); + algebraic[194] = 0.001*0.66*1.4*(15.59/(1.037*exp(0.09*(algebraic[21]+30.61))+0.369*exp(-0.12*(algebraic[21]+23.84)))+2.98); + algebraic[196] = 1.0/(1.0+exp(-(algebraic[21]+23.2)/6.6))/(0.84655354/(37.2*exp(algebraic[21]/11.9)+0.96*exp(-algebraic[21]/18.5))); + algebraic[197] = 4.0*((37.2*exp(algebraic[21]/15.9)+0.96*exp(-algebraic[21]/22.5))/0.84655354-1.0/(1.0+exp(-(algebraic[21]+23.2)/10.6))/(0.84655354/(37.2*exp(algebraic[21]/15.9)+0.96*exp(-algebraic[21]/22.5)))); + algebraic[198] = 1.0/(1.0+exp(-(algebraic[21]+10.0144)/7.6607)); + algebraic[199] = 0.84655354/(4.2*exp(algebraic[21]/17.0)+0.15*exp(-algebraic[21]/21.6)); + algebraic[200] = 1.0/(30.0*exp(algebraic[21]/10.0)+exp(-algebraic[21]/12.0)); + algebraic[201] = 1.0/(100.0*exp(-algebraic[21]/54.645)+656.0*exp(algebraic[21]/106.157)); + algebraic[202] = 1.0/(1.0+exp((algebraic[21]+28.6)/17.1)); + algebraic[207] = sqrt(1.0/(1.0+exp(-(algebraic[21]+0.6383-computedConstants[206])/10.7071))); + algebraic[209] = 28.0/(1.0+exp(-(algebraic[21]-40.0-computedConstants[206])/3.0)); + algebraic[210] = 1.0*exp(-(algebraic[21]-computedConstants[206]-5.0)/25.0); + algebraic[208] = 1.0/(algebraic[209]+algebraic[210]); + algebraic[214] = 10.0*exp(0.0133*(algebraic[21]+40.0)); + algebraic[215] = computedConstants[213]/(computedConstants[213]+algebraic[214]); + algebraic[216] = 1.0/(computedConstants[213]+algebraic[214]); } diff --git a/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.py b/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.py index 9831f67e58..109e8280db 100644 --- a/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.py +++ b/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.py @@ -309,97 +309,97 @@ def create_variables_array(): def initialise_variables(states, rates, constants): - variables[0] = 0.0 - variables[1] = 0.0 - variables[4] = 140.0 - variables[7] = 5.4 - variables[8] = 140.0 - variables[10] = 1.8 - variables[11] = 1.0 - variables[17] = 96485.3415 - variables[22] = 14.0 - variables[23] = 1.4 - variables[24] = 0.08105 - variables[25] = 0.0 - variables[30] = 3.343 - variables[39] = 26.44 - variables[40] = 0.0207 - variables[41] = 0.1369 - variables[43] = 395.3 - variables[44] = 2.289 - variables[45] = 0.4315 - variables[46] = 26.44 - variables[47] = 4.663 - variables[48] = 3.663 - variables[49] = 0.0 - variables[51] = 1628.0 - variables[52] = 561.4 - variables[54] = 148041085.1 - variables[57] = 15.0 - variables[58] = 1.0 - variables[59] = 0.45 - variables[60] = 2.5 - variables[62] = 10000.0 - variables[64] = 500.0 - variables[65] = 5.0 - variables[66] = 660.0 - variables[70] = 5.0 - variables[72] = 5.469e-5 - variables[74] = 0.000286113 - variables[75] = 5.0e-5 - variables[77] = 0.04 - variables[79] = 88800.0 - variables[80] = 446.0 - variables[82] = 227700.0 - variables[83] = 7.51 - variables[85] = 2277.0 - variables[86] = 2.5 - variables[87] = 751.0 - variables[89] = 1.642e6 - variables[90] = 542.0 - variables[93] = 175.4 - variables[94] = 445.0 - variables[95] = 0.031 - variables[96] = 0.062 - variables[97] = 0.045 - variables[98] = 10.0 - variables[104] = 67.0 - variables[105] = 3.9 - variables[106] = 0.02 - variables[107] = 0.0012 - variables[108] = 0.46 - variables[109] = 0.0116 - variables[118] = 5.7e-5 - variables[119] = 8314.472 - variables[120] = 310.0 - variables[122] = 0.0 - variables[123] = -35.0 - variables[124] = 0.5 - variables[125] = 0.5 - variables[126] = -45.0 - variables[128] = 0.00427 - variables[129] = 45.0 - variables[131] = 0.5927 - variables[135] = 0.0 - variables[141] = 0.0 - variables[144] = 0.0223 - variables[146] = 0.0 - variables[150] = 1.0e-5 - variables[157] = 0.1539e-3 - variables[163] = 0.4578 - variables[169] = -16.4508 - variables[170] = 4.3371 - variables[177] = 0.0 - variables[178] = 0.0 - variables[181] = 0.000338 - variables[183] = 0.0075 - variables[184] = 0.04132 - variables[189] = 0.0 - variables[190] = 3.5e-3 - variables[195] = 0.00424 - variables[204] = 0.00065 - variables[211] = 1.0 - variables[212] = 0.00345 + constants[0] = 0.0 + constants[1] = 0.0 + constants[4] = 140.0 + constants[7] = 5.4 + constants[8] = 140.0 + constants[10] = 1.8 + constants[11] = 1.0 + constants[17] = 96485.3415 + constants[22] = 14.0 + constants[23] = 1.4 + constants[24] = 0.08105 + constants[25] = 0.0 + constants[30] = 3.343 + constants[39] = 26.44 + constants[40] = 0.0207 + constants[41] = 0.1369 + constants[43] = 395.3 + constants[44] = 2.289 + constants[45] = 0.4315 + constants[46] = 26.44 + constants[47] = 4.663 + constants[48] = 3.663 + constants[49] = 0.0 + constants[51] = 1628.0 + constants[52] = 561.4 + constants[54] = 148041085.1 + constants[57] = 15.0 + constants[58] = 1.0 + constants[59] = 0.45 + constants[60] = 2.5 + constants[62] = 10000.0 + constants[64] = 500.0 + constants[65] = 5.0 + constants[66] = 660.0 + constants[70] = 5.0 + constants[72] = 5.469e-5 + constants[74] = 0.000286113 + constants[75] = 5.0e-5 + constants[77] = 0.04 + constants[79] = 88800.0 + constants[80] = 446.0 + constants[82] = 227700.0 + constants[83] = 7.51 + constants[85] = 2277.0 + constants[86] = 2.5 + constants[87] = 751.0 + constants[89] = 1.642e6 + constants[90] = 542.0 + constants[93] = 175.4 + constants[94] = 445.0 + constants[95] = 0.031 + constants[96] = 0.062 + constants[97] = 0.045 + constants[98] = 10.0 + constants[104] = 67.0 + constants[105] = 3.9 + constants[106] = 0.02 + constants[107] = 0.0012 + constants[108] = 0.46 + constants[109] = 0.0116 + constants[118] = 5.7e-5 + constants[119] = 8314.472 + constants[120] = 310.0 + constants[122] = 0.0 + constants[123] = -35.0 + constants[124] = 0.5 + constants[125] = 0.5 + constants[126] = -45.0 + constants[128] = 0.00427 + constants[129] = 45.0 + constants[131] = 0.5927 + constants[135] = 0.0 + constants[141] = 0.0 + constants[144] = 0.0223 + constants[146] = 0.0 + constants[150] = 1.0e-5 + constants[157] = 0.1539e-3 + constants[163] = 0.4578 + constants[169] = -16.4508 + constants[170] = 4.3371 + constants[177] = 0.0 + constants[178] = 0.0 + constants[181] = 0.000338 + constants[183] = 0.0075 + constants[184] = 0.04132 + constants[189] = 0.0 + constants[190] = 3.5e-3 + constants[195] = 0.00424 + constants[204] = 0.00065 + constants[211] = 1.0 + constants[212] = 0.00345 states[0] = 6.226104e-5 states[1] = 5.0 states[2] = 0.409551 @@ -436,263 +436,263 @@ def initialise_variables(states, rates, constants): def compute_computed_constants(constants, computed_constants): - variables[3] = variables[119]*variables[120]/variables[17] - variables[6] = variables[3]*log(variables[7]/variables[8]) - variables[20] = 1.2 if gt_func(variables[1], 0.0) else 1.0 - variables[35] = variables[4]/(variables[47]+variables[4]) - variables[68] = -0.25 if gt_func(variables[1], 0.0) else 0.7*variables[0]/(0.00009+variables[0]) if gt_func(variables[0], 0.0) else 0.0 - variables[69] = variables[70]*(1.0-variables[68]) - variables[103] = 0.000000001*3.14159265358979*pow(variables[105], 2.0)*variables[104] - variables[19] = 0.000000001*2.0*3.14159265358979*variables[106]*(variables[105]-variables[106]/2.0)*variables[104] - variables[100] = variables[107]*variables[103] - variables[18] = variables[108]*variables[103]-variables[19] - variables[99] = variables[109]*variables[103] - variables[127] = variables[128]/(variables[7]/(variables[7]+variables[129])) - variables[130] = variables[127]/(variables[131]+1.0) - variables[132] = variables[131]*variables[130] - variables[133] = variables[132]*variables[7]/(variables[7]+variables[129]) - variables[134] = variables[130]*variables[7]/(variables[7]+variables[129]) - variables[137] = -1.0-9.898*pow(1.0*variables[0], 0.618)/(pow(1.0*variables[0], 0.618)+0.00122423) if gt_func(variables[0], 0.0) else 0.0 - variables[138] = 7.5 if gt_func(variables[1], 0.0) else 0.0 - variables[162] = 1.23 if gt_func(variables[1], 0.0) else 1.0 - variables[165] = 0.31*variables[0]/(variables[0]+0.00009) - variables[166] = -8.0 if gt_func(variables[1], 0.0) else 0.0 - variables[167] = -27.0 if gt_func(variables[1], 0.0) else 0.0 - variables[203] = 1.2*variables[204] if gt_func(variables[1], 0.0) else variables[204] - variables[206] = -14.0 if gt_func(variables[1], 0.0) else 0.0 - variables[213] = (3.5988-0.025641)/(1.0+0.0000012155/pow(1.0*variables[0], 1.6951))+0.025641 + computed_constants[3] = constants[119]*constants[120]/constants[17] + computed_constants[6] = computed_constants[3]*log(constants[7]/constants[8]) + computed_constants[20] = 1.2 if gt_func(constants[1], 0.0) else 1.0 + computed_constants[35] = constants[4]/(constants[47]+constants[4]) + computed_constants[68] = -0.25 if gt_func(constants[1], 0.0) else 0.7*constants[0]/(0.00009+constants[0]) if gt_func(constants[0], 0.0) else 0.0 + computed_constants[69] = constants[70]*(1.0-computed_constants[68]) + computed_constants[103] = 0.000000001*3.14159265358979*pow(constants[105], 2.0)*constants[104] + computed_constants[19] = 0.000000001*2.0*3.14159265358979*constants[106]*(constants[105]-constants[106]/2.0)*constants[104] + computed_constants[100] = constants[107]*computed_constants[103] + computed_constants[18] = constants[108]*computed_constants[103]-computed_constants[19] + computed_constants[99] = constants[109]*computed_constants[103] + computed_constants[127] = constants[128]/(constants[7]/(constants[7]+constants[129])) + computed_constants[130] = computed_constants[127]/(constants[131]+1.0) + computed_constants[132] = constants[131]*computed_constants[130] + computed_constants[133] = computed_constants[132]*constants[7]/(constants[7]+constants[129]) + computed_constants[134] = computed_constants[130]*constants[7]/(constants[7]+constants[129]) + computed_constants[137] = -1.0-9.898*pow(1.0*constants[0], 0.618)/(pow(1.0*constants[0], 0.618)+0.00122423) if gt_func(constants[0], 0.0) else 0.0 + computed_constants[138] = 7.5 if gt_func(constants[1], 0.0) else 0.0 + computed_constants[162] = 1.23 if gt_func(constants[1], 0.0) else 1.0 + computed_constants[165] = 0.31*constants[0]/(constants[0]+0.00009) + computed_constants[166] = -8.0 if gt_func(constants[1], 0.0) else 0.0 + computed_constants[167] = -27.0 if gt_func(constants[1], 0.0) else 0.0 + computed_constants[203] = 1.2*constants[204] if gt_func(constants[1], 0.0) else constants[204] + computed_constants[206] = -14.0 if gt_func(constants[1], 0.0) else 0.0 + computed_constants[213] = (3.5988-0.025641)/(1.0+0.0000012155/pow(1.0*constants[0], 1.6951))+0.025641 def compute_rates(voi, states, rates, constants, computed_constants, algebraic): - variables[5] = states[1] - variables[142] = variables[3]*log((variables[4]+0.12*variables[7])/(variables[5]+0.12*variables[8])) - variables[121] = variables[123] if and_func(gt_func(voi, variables[124]), lt_func(voi, variables[124]+variables[125])) else variables[126] - variables[21] = variables[121] if geq_func(variables[122], 1.0) else states[15] - variables[143] = variables[144]*pow(states[18], 3.0)*states[17]*(variables[21]-variables[142]) - variables[145] = variables[146]*pow(states[18], 3.0)*(variables[21]-variables[142]) - variables[12] = variables[143]+variables[145] - variables[15] = 0.0000185*variables[163]*(variables[21]-0.0)/(variables[3]*(1.0-exp(-1.0*(variables[21]-0.0)/variables[3])))*(variables[5]-variables[4]*exp(-1.0*(variables[21]-0.0)/variables[3]))*states[23]*states[22]*states[21] - variables[2] = variables[3]*log(variables[4]/variables[5]) - variables[16] = states[16]*variables[133]*(variables[21]-variables[2])*(1.0-variables[135]) - variables[14] = variables[20]*variables[24]*pow(1.0+pow(variables[23]/variables[7], 1.2), -1.0)*pow(1.0+pow(variables[22]/variables[5], 1.3), -1.0)*pow(1.0+exp(-(variables[21]-variables[2]+110.0)/20.0), -1.0) - variables[50] = 1.0+variables[10]/variables[48]*(1.0+exp(variables[49]*variables[21]/variables[3]))+variables[4]/variables[51]*(1.0+variables[4]/variables[52]*(1.0+variables[4]/variables[47])) - variables[27] = variables[10]/variables[48]*exp(variables[49]*variables[21]/variables[3])/variables[50] - variables[42] = 1.0+states[0]/variables[40]*(1.0+exp(-variables[41]*variables[21]/variables[3])+variables[5]/variables[46])+variables[5]/variables[43]*(1.0+variables[5]/variables[44]*(1.0+variables[5]/variables[39])) - variables[29] = states[0]/variables[40]*exp(-variables[41]*variables[21]/variables[3])/variables[42] - variables[36] = variables[5]/(variables[39]+variables[5]) - variables[37] = exp(variables[45]*variables[21]/(2.0*variables[3])) - variables[33] = exp(-variables[45]*variables[21]/(2.0*variables[3])) - variables[38] = variables[5]/variables[43]*variables[5]/variables[44]*(1.0+variables[5]/variables[39])*exp(variables[45]*variables[21]/(2.0*variables[3]))/variables[42] - variables[26] = variables[37]*variables[36]*(variables[38]+variables[29])+variables[33]*variables[29]*(variables[35]+variables[37]) - variables[34] = variables[4]/variables[51]*variables[4]/variables[52]*(1.0+variables[4]/variables[47])*exp(-variables[45]*variables[21]/(2.0*variables[3]))/variables[50] - variables[28] = variables[33]*variables[35]*(variables[34]+variables[27])+variables[27]*variables[37]*(variables[36]+variables[33]) - variables[31] = variables[34]*variables[35]*(variables[38]+variables[29])+variables[38]*variables[27]*(variables[35]+variables[37]) - variables[32] = variables[38]*variables[36]*(variables[34]+variables[27])+variables[29]*variables[34]*(variables[36]+variables[33]) - variables[13] = (1.0-variables[25])*variables[30]*(variables[26]*variables[27]-variables[28]*variables[29])/(variables[28]+variables[26]+variables[32]+variables[31]) - rates[1] = (1.0-variables[11])*-1.0*(variables[12]+variables[16]+variables[15]+3.0*variables[14]+3.0*variables[13])/(1.0*(variables[18]+variables[19])*variables[17]) - variables[56] = variables[57]-(variables[57]-variables[58])/(1.0+pow(variables[59]/states[2], variables[60])) - variables[63] = variables[64]*variables[56] - variables[61] = variables[62]/variables[56] - rates[4] = variables[65]*states[5]-variables[63]*states[0]*states[4]-(variables[61]*pow(states[0], 2.0)*states[4]-variables[66]*states[3]) - rates[3] = variables[61]*pow(states[0], 2.0)*states[4]-variables[66]*states[3]-(variables[63]*states[0]*states[3]-variables[65]*states[6]) - rates[6] = variables[63]*states[0]*states[3]-variables[65]*states[6]-(variables[66]*states[6]-variables[61]*pow(states[0], 2.0)*states[5]) - rates[5] = variables[66]*states[6]-variables[61]*pow(states[0], 2.0)*states[5]-(variables[65]*states[5]-variables[63]*states[0]*states[4]) - variables[78] = variables[79]*states[7]*(1.0-states[9])-variables[80]*states[9] - rates[9] = variables[78] - variables[81] = variables[82]*states[7]*(1.0-(states[10]+states[11]))-variables[83]*states[10] - rates[10] = variables[81] - variables[84] = variables[85]*variables[86]*(1.0-(states[10]+states[11]))-variables[87]*states[11] - rates[11] = variables[84] - variables[88] = variables[89]*states[7]*(1.0-states[12])-variables[90]*states[12] - rates[12] = variables[88] - variables[91] = variables[89]*states[0]*(1.0-states[13])-variables[90]*states[13] - rates[13] = variables[91] - variables[92] = variables[93]*states[2]*(1.0-states[14])-variables[94]*states[14] - rates[14] = variables[92] - variables[71] = (states[0]-states[7])/variables[72] - variables[73] = variables[69]/(1.0+exp((-states[7]+variables[74])/variables[75])) - rates[7] = 1.0*(variables[71]*variables[19]-variables[73]*variables[99])/variables[18]-(variables[97]*variables[88]+variables[95]*variables[78]+variables[96]*variables[81]) - variables[53] = variables[54]*states[3]*(states[2]-states[0]) - variables[101] = 2.0*variables[163]*(variables[21]-0.0)/(variables[3]*(1.0-exp(-1.0*(variables[21]-0.0)*2.0/variables[3])))*(states[0]-variables[10]*exp(-2.0*(variables[21]-0.0)/variables[3]))*states[23]*states[22]*states[21] - variables[102] = 2.0*variables[184]*variables[21]/(variables[3]*(1.0-exp(-1.0*variables[21]*2.0/variables[3])))*(states[0]-variables[10]*exp(-2.0*variables[21]/variables[3]))*states[25]*states[24] - rates[0] = variables[53]*variables[100]/variables[19]-((variables[101]+variables[102]-2.0*variables[13])/(2.0*variables[17]*variables[19])+variables[71]+variables[97]*variables[91]) - variables[76] = (states[8]-states[2])/variables[77] - rates[8] = variables[73]-variables[76]*variables[100]/variables[99] - rates[2] = variables[76]-(variables[53]+variables[98]*variables[92]) - variables[136] = states[16]*variables[134]*(variables[21]-variables[6])*(1.0-variables[135]) - variables[111] = variables[16]+variables[136] - variables[112] = variables[157]*states[20]*states[19]*(variables[21]-variables[6]) - variables[113] = variables[211]*variables[212]*(variables[21]-variables[6])*(1.0+exp((variables[21]+20.0)/20.0))*states[32] if gt_func(variables[0], 0.0) else 0.0 - variables[164] = 0.000365*variables[163]*(variables[21]-0.0)/(variables[3]*(1.0-exp(-1.0*(variables[21]-0.0)/variables[3])))*(variables[8]-variables[7]*exp(-1.0*(variables[21]-0.0)/variables[3]))*states[23]*states[22]*states[21] - variables[114] = (variables[101]+variables[164]+variables[15])*(1.0-variables[165])*1.0*variables[162] - variables[115] = variables[190]*(variables[21]-variables[6])*states[27]*states[26] - variables[205] = variables[3]*log((variables[7]+0.12*variables[4])/(variables[8]+0.12*variables[5])) - variables[116] = variables[203]*(variables[21]-variables[205])*pow(states[31], 2.0) - variables[117] = variables[195]*(variables[21]-variables[6])*(0.9*states[29]+0.1*states[30])*states[28] - variables[110] = variables[111]+variables[117]+variables[116]+variables[115]+variables[14]+variables[13]+variables[12]+variables[114]+variables[102]+variables[113]+variables[112] - rates[15] = -variables[110]/variables[118] - variables[140] = 0.01329+0.99921/(1.0+exp((variables[21]+97.134-variables[137]-variables[138]-variables[141])/8.1752)) if lt_func(variables[21], -(80.0-variables[137]-variables[138]-variables[141])) else 0.0002501*exp(-(variables[21]-variables[137]-variables[138]-variables[141])/12.861) - variables[139] = 1.0/(0.36*(variables[21]+148.8-variables[137]-variables[138])/(exp(0.066*(variables[21]+148.8-variables[137]-variables[138]))-1.0)+0.1*(variables[21]+87.3-variables[137]-variables[138])/(1.0-exp(-0.2*(variables[21]+87.3-variables[137]-variables[138]))))-0.054 - rates[16] = (variables[140]-states[16])/variables[139] - variables[147] = 1.0/(1.0+exp(-(variables[21]+42.0504)/8.3106)) - variables[148] = variables[21]+41.0 - variables[149] = 2000.0 if lt_func(fabs(variables[148]), variables[150]) else 200.0*variables[148]/(1.0-exp(-0.1*variables[148])) - variables[151] = 8000.0*exp(-0.056*(variables[21]+66.0)) - variables[152] = 1.0/(variables[149]+variables[151]) - rates[18] = (variables[147]-states[18])/variables[152] - variables[153] = 1.0/(1.0+exp((variables[21]+69.804)/4.4565)) - variables[154] = 20.0*exp(-0.125*(variables[21]+75.0)) - variables[155] = 2000.0/(320.0*exp(-0.1*(variables[21]+75.0))+1.0) - variables[156] = 1.0/(variables[154]+variables[155]) - rates[17] = (variables[153]-states[17])/variables[156] - variables[158] = 1.0/(1.0+exp((variables[21]+6.0)/-8.6)) - variables[159] = 0.009/(1.0+exp((variables[21]+5.0)/12.0))+0.0005 - rates[20] = (variables[158]-states[20])/variables[159] - variables[160] = 1.0/(1.0+exp((variables[21]+7.5)/10.0)) - variables[161] = 0.59/(1.0+exp((variables[21]+60.0)/10.0))+3.05 - rates[19] = (variables[160]-states[19])/variables[161] - variables[168] = 1.0/(1.0+exp(-(variables[21]-variables[169]-variables[166])/(variables[170]*(1.0+variables[167]/100.0)))) - variables[174] = -41.80001 if eq_func(variables[21], -41.8) else 0.0 if eq_func(variables[21], 0.0) else -6.80001 if eq_func(variables[21], -6.8) else variables[21] - variables[172] = -0.02839*(variables[174]+41.8)/(exp(-(variables[174]+41.8)/2.5)-1.0)-0.0849*(variables[174]+6.8)/(exp(-(variables[174]+6.8)/4.8)-1.0) - variables[175] = -1.80001 if eq_func(variables[21], -1.8) else variables[21] - variables[173] = 0.01143*(variables[175]+1.8)/(exp((variables[175]+1.8)/2.5)-1.0) - variables[171] = 0.001/(variables[172]+variables[173]) - rates[23] = (variables[168]-states[23])/variables[171] - variables[176] = 1.0/(1.0+exp((variables[21]+37.4+variables[177])/(5.3+variables[178]))) - variables[179] = 0.001*(44.3+230.0*exp(-pow((variables[21]+36.0)/10.0, 2.0))) - rates[22] = (variables[176]-states[22])/variables[179] - variables[180] = variables[181]/(variables[181]+states[0]) - variables[182] = 0.001*variables[180]/variables[183] - rates[21] = (variables[180]-states[21])/variables[182] - variables[185] = 1.0/(1.0+exp(-(variables[21]+38.3)/5.5)) - variables[186] = 0.001/(1.068*exp((variables[21]+38.3)/30.0)+1.068*exp(-(variables[21]+38.3)/30.0)) - rates[25] = (variables[185]-states[25])/variables[186] - variables[187] = 1.0/(1.0+exp((variables[21]+58.7)/3.8)) - variables[188] = 1.0/(16.67*exp(-(variables[21]+75.0)/83.3)+16.67*exp((variables[21]+75.0)/15.38))+variables[189] - rates[24] = (variables[187]-states[24])/variables[188] - variables[191] = 1.0/(1.0+exp((variables[21]+49.0)/13.0)) - variables[192] = 0.001*0.6*(65.17/(0.57*exp(-0.08*(variables[21]+44.0))+0.065*exp(0.1*(variables[21]+45.93)))+10.1) - rates[27] = (variables[191]-states[27])/variables[192] - variables[193] = 1.0/(1.0+exp(-(variables[21]-19.3)/15.0)) - variables[194] = 0.001*0.66*1.4*(15.59/(1.037*exp(0.09*(variables[21]+30.61))+0.369*exp(-0.12*(variables[21]+23.84)))+2.98) - rates[26] = (variables[193]-states[26])/variables[194] - variables[198] = 1.0/(1.0+exp(-(variables[21]+10.0144)/7.6607)) - variables[199] = 0.84655354/(4.2*exp(variables[21]/17.0)+0.15*exp(-variables[21]/21.6)) - rates[30] = (variables[198]-states[30])/variables[199] - variables[200] = 1.0/(30.0*exp(variables[21]/10.0)+exp(-variables[21]/12.0)) - rates[29] = (variables[198]-states[29])/variables[200] - variables[202] = 1.0/(1.0+exp((variables[21]+28.6)/17.1)) - variables[201] = 1.0/(100.0*exp(-variables[21]/54.645)+656.0*exp(variables[21]/106.157)) - rates[28] = (variables[202]-states[28])/variables[201] - variables[207] = sqrt(1.0/(1.0+exp(-(variables[21]+0.6383-variables[206])/10.7071))) - variables[209] = 28.0/(1.0+exp(-(variables[21]-40.0-variables[206])/3.0)) - variables[210] = 1.0*exp(-(variables[21]-variables[206]-5.0)/25.0) - variables[208] = 1.0/(variables[209]+variables[210]) - rates[31] = (variables[207]-states[31])/variables[208] - variables[214] = 10.0*exp(0.0133*(variables[21]+40.0)) - variables[215] = variables[213]/(variables[213]+variables[214]) - variables[216] = 1.0/(variables[213]+variables[214]) - rates[32] = (variables[215]-states[32])/variables[216] + algebraic[5] = states[1] + algebraic[142] = computed_constants[3]*log((constants[4]+0.12*constants[7])/(algebraic[5]+0.12*constants[8])) + algebraic[121] = constants[123] if and_func(gt_func(voi, constants[124]), lt_func(voi, constants[124]+constants[125])) else constants[126] + algebraic[21] = algebraic[121] if geq_func(constants[122], 1.0) else states[15] + algebraic[143] = constants[144]*pow(states[18], 3.0)*states[17]*(algebraic[21]-algebraic[142]) + algebraic[145] = constants[146]*pow(states[18], 3.0)*(algebraic[21]-algebraic[142]) + algebraic[12] = algebraic[143]+algebraic[145] + algebraic[15] = 0.0000185*constants[163]*(algebraic[21]-0.0)/(computed_constants[3]*(1.0-exp(-1.0*(algebraic[21]-0.0)/computed_constants[3])))*(algebraic[5]-constants[4]*exp(-1.0*(algebraic[21]-0.0)/computed_constants[3]))*states[23]*states[22]*states[21] + algebraic[2] = computed_constants[3]*log(constants[4]/algebraic[5]) + algebraic[16] = states[16]*computed_constants[133]*(algebraic[21]-algebraic[2])*(1.0-constants[135]) + algebraic[14] = computed_constants[20]*constants[24]*pow(1.0+pow(constants[23]/constants[7], 1.2), -1.0)*pow(1.0+pow(constants[22]/algebraic[5], 1.3), -1.0)*pow(1.0+exp(-(algebraic[21]-algebraic[2]+110.0)/20.0), -1.0) + algebraic[50] = 1.0+constants[10]/constants[48]*(1.0+exp(constants[49]*algebraic[21]/computed_constants[3]))+constants[4]/constants[51]*(1.0+constants[4]/constants[52]*(1.0+constants[4]/constants[47])) + algebraic[27] = constants[10]/constants[48]*exp(constants[49]*algebraic[21]/computed_constants[3])/algebraic[50] + algebraic[42] = 1.0+states[0]/constants[40]*(1.0+exp(-constants[41]*algebraic[21]/computed_constants[3])+algebraic[5]/constants[46])+algebraic[5]/constants[43]*(1.0+algebraic[5]/constants[44]*(1.0+algebraic[5]/constants[39])) + algebraic[29] = states[0]/constants[40]*exp(-constants[41]*algebraic[21]/computed_constants[3])/algebraic[42] + algebraic[36] = algebraic[5]/(constants[39]+algebraic[5]) + algebraic[37] = exp(constants[45]*algebraic[21]/(2.0*computed_constants[3])) + algebraic[33] = exp(-constants[45]*algebraic[21]/(2.0*computed_constants[3])) + algebraic[38] = algebraic[5]/constants[43]*algebraic[5]/constants[44]*(1.0+algebraic[5]/constants[39])*exp(constants[45]*algebraic[21]/(2.0*computed_constants[3]))/algebraic[42] + algebraic[26] = algebraic[37]*algebraic[36]*(algebraic[38]+algebraic[29])+algebraic[33]*algebraic[29]*(computed_constants[35]+algebraic[37]) + algebraic[34] = constants[4]/constants[51]*constants[4]/constants[52]*(1.0+constants[4]/constants[47])*exp(-constants[45]*algebraic[21]/(2.0*computed_constants[3]))/algebraic[50] + algebraic[28] = algebraic[33]*computed_constants[35]*(algebraic[34]+algebraic[27])+algebraic[27]*algebraic[37]*(algebraic[36]+algebraic[33]) + algebraic[31] = algebraic[34]*computed_constants[35]*(algebraic[38]+algebraic[29])+algebraic[38]*algebraic[27]*(computed_constants[35]+algebraic[37]) + algebraic[32] = algebraic[38]*algebraic[36]*(algebraic[34]+algebraic[27])+algebraic[29]*algebraic[34]*(algebraic[36]+algebraic[33]) + algebraic[13] = (1.0-constants[25])*constants[30]*(algebraic[26]*algebraic[27]-algebraic[28]*algebraic[29])/(algebraic[28]+algebraic[26]+algebraic[32]+algebraic[31]) + rates[1] = (1.0-constants[11])*-1.0*(algebraic[12]+algebraic[16]+algebraic[15]+3.0*algebraic[14]+3.0*algebraic[13])/(1.0*(computed_constants[18]+computed_constants[19])*constants[17]) + algebraic[56] = constants[57]-(constants[57]-constants[58])/(1.0+pow(constants[59]/states[2], constants[60])) + algebraic[63] = constants[64]*algebraic[56] + algebraic[61] = constants[62]/algebraic[56] + rates[4] = constants[65]*states[5]-algebraic[63]*states[0]*states[4]-(algebraic[61]*pow(states[0], 2.0)*states[4]-constants[66]*states[3]) + rates[3] = algebraic[61]*pow(states[0], 2.0)*states[4]-constants[66]*states[3]-(algebraic[63]*states[0]*states[3]-constants[65]*states[6]) + rates[6] = algebraic[63]*states[0]*states[3]-constants[65]*states[6]-(constants[66]*states[6]-algebraic[61]*pow(states[0], 2.0)*states[5]) + rates[5] = constants[66]*states[6]-algebraic[61]*pow(states[0], 2.0)*states[5]-(constants[65]*states[5]-algebraic[63]*states[0]*states[4]) + algebraic[78] = constants[79]*states[7]*(1.0-states[9])-constants[80]*states[9] + rates[9] = algebraic[78] + algebraic[81] = constants[82]*states[7]*(1.0-(states[10]+states[11]))-constants[83]*states[10] + rates[10] = algebraic[81] + algebraic[84] = constants[85]*constants[86]*(1.0-(states[10]+states[11]))-constants[87]*states[11] + rates[11] = algebraic[84] + algebraic[88] = constants[89]*states[7]*(1.0-states[12])-constants[90]*states[12] + rates[12] = algebraic[88] + algebraic[91] = constants[89]*states[0]*(1.0-states[13])-constants[90]*states[13] + rates[13] = algebraic[91] + algebraic[92] = constants[93]*states[2]*(1.0-states[14])-constants[94]*states[14] + rates[14] = algebraic[92] + algebraic[71] = (states[0]-states[7])/constants[72] + algebraic[73] = computed_constants[69]/(1.0+exp((-states[7]+constants[74])/constants[75])) + rates[7] = 1.0*(algebraic[71]*computed_constants[19]-algebraic[73]*computed_constants[99])/computed_constants[18]-(constants[97]*algebraic[88]+constants[95]*algebraic[78]+constants[96]*algebraic[81]) + algebraic[53] = constants[54]*states[3]*(states[2]-states[0]) + algebraic[101] = 2.0*constants[163]*(algebraic[21]-0.0)/(computed_constants[3]*(1.0-exp(-1.0*(algebraic[21]-0.0)*2.0/computed_constants[3])))*(states[0]-constants[10]*exp(-2.0*(algebraic[21]-0.0)/computed_constants[3]))*states[23]*states[22]*states[21] + algebraic[102] = 2.0*constants[184]*algebraic[21]/(computed_constants[3]*(1.0-exp(-1.0*algebraic[21]*2.0/computed_constants[3])))*(states[0]-constants[10]*exp(-2.0*algebraic[21]/computed_constants[3]))*states[25]*states[24] + rates[0] = algebraic[53]*computed_constants[100]/computed_constants[19]-((algebraic[101]+algebraic[102]-2.0*algebraic[13])/(2.0*constants[17]*computed_constants[19])+algebraic[71]+constants[97]*algebraic[91]) + algebraic[76] = (states[8]-states[2])/constants[77] + rates[8] = algebraic[73]-algebraic[76]*computed_constants[100]/computed_constants[99] + rates[2] = algebraic[76]-(algebraic[53]+constants[98]*algebraic[92]) + algebraic[136] = states[16]*computed_constants[134]*(algebraic[21]-computed_constants[6])*(1.0-constants[135]) + algebraic[111] = algebraic[16]+algebraic[136] + algebraic[112] = constants[157]*states[20]*states[19]*(algebraic[21]-computed_constants[6]) + algebraic[113] = constants[211]*constants[212]*(algebraic[21]-computed_constants[6])*(1.0+exp((algebraic[21]+20.0)/20.0))*states[32] if gt_func(constants[0], 0.0) else 0.0 + algebraic[164] = 0.000365*constants[163]*(algebraic[21]-0.0)/(computed_constants[3]*(1.0-exp(-1.0*(algebraic[21]-0.0)/computed_constants[3])))*(constants[8]-constants[7]*exp(-1.0*(algebraic[21]-0.0)/computed_constants[3]))*states[23]*states[22]*states[21] + algebraic[114] = (algebraic[101]+algebraic[164]+algebraic[15])*(1.0-computed_constants[165])*1.0*computed_constants[162] + algebraic[115] = constants[190]*(algebraic[21]-computed_constants[6])*states[27]*states[26] + algebraic[205] = computed_constants[3]*log((constants[7]+0.12*constants[4])/(constants[8]+0.12*algebraic[5])) + algebraic[116] = computed_constants[203]*(algebraic[21]-algebraic[205])*pow(states[31], 2.0) + algebraic[117] = constants[195]*(algebraic[21]-computed_constants[6])*(0.9*states[29]+0.1*states[30])*states[28] + algebraic[110] = algebraic[111]+algebraic[117]+algebraic[116]+algebraic[115]+algebraic[14]+algebraic[13]+algebraic[12]+algebraic[114]+algebraic[102]+algebraic[113]+algebraic[112] + rates[15] = -algebraic[110]/constants[118] + algebraic[140] = 0.01329+0.99921/(1.0+exp((algebraic[21]+97.134-computed_constants[137]-computed_constants[138]-constants[141])/8.1752)) if lt_func(algebraic[21], -(80.0-computed_constants[137]-computed_constants[138]-constants[141])) else 0.0002501*exp(-(algebraic[21]-computed_constants[137]-computed_constants[138]-constants[141])/12.861) + algebraic[139] = 1.0/(0.36*(algebraic[21]+148.8-computed_constants[137]-computed_constants[138])/(exp(0.066*(algebraic[21]+148.8-computed_constants[137]-computed_constants[138]))-1.0)+0.1*(algebraic[21]+87.3-computed_constants[137]-computed_constants[138])/(1.0-exp(-0.2*(algebraic[21]+87.3-computed_constants[137]-computed_constants[138]))))-0.054 + rates[16] = (algebraic[140]-states[16])/algebraic[139] + algebraic[147] = 1.0/(1.0+exp(-(algebraic[21]+42.0504)/8.3106)) + algebraic[148] = algebraic[21]+41.0 + algebraic[149] = 2000.0 if lt_func(fabs(algebraic[148]), constants[150]) else 200.0*algebraic[148]/(1.0-exp(-0.1*algebraic[148])) + algebraic[151] = 8000.0*exp(-0.056*(algebraic[21]+66.0)) + algebraic[152] = 1.0/(algebraic[149]+algebraic[151]) + rates[18] = (algebraic[147]-states[18])/algebraic[152] + algebraic[153] = 1.0/(1.0+exp((algebraic[21]+69.804)/4.4565)) + algebraic[154] = 20.0*exp(-0.125*(algebraic[21]+75.0)) + algebraic[155] = 2000.0/(320.0*exp(-0.1*(algebraic[21]+75.0))+1.0) + algebraic[156] = 1.0/(algebraic[154]+algebraic[155]) + rates[17] = (algebraic[153]-states[17])/algebraic[156] + algebraic[158] = 1.0/(1.0+exp((algebraic[21]+6.0)/-8.6)) + algebraic[159] = 0.009/(1.0+exp((algebraic[21]+5.0)/12.0))+0.0005 + rates[20] = (algebraic[158]-states[20])/algebraic[159] + algebraic[160] = 1.0/(1.0+exp((algebraic[21]+7.5)/10.0)) + algebraic[161] = 0.59/(1.0+exp((algebraic[21]+60.0)/10.0))+3.05 + rates[19] = (algebraic[160]-states[19])/algebraic[161] + algebraic[168] = 1.0/(1.0+exp(-(algebraic[21]-constants[169]-computed_constants[166])/(constants[170]*(1.0+computed_constants[167]/100.0)))) + algebraic[174] = -41.80001 if eq_func(algebraic[21], -41.8) else 0.0 if eq_func(algebraic[21], 0.0) else -6.80001 if eq_func(algebraic[21], -6.8) else algebraic[21] + algebraic[172] = -0.02839*(algebraic[174]+41.8)/(exp(-(algebraic[174]+41.8)/2.5)-1.0)-0.0849*(algebraic[174]+6.8)/(exp(-(algebraic[174]+6.8)/4.8)-1.0) + algebraic[175] = -1.80001 if eq_func(algebraic[21], -1.8) else algebraic[21] + algebraic[173] = 0.01143*(algebraic[175]+1.8)/(exp((algebraic[175]+1.8)/2.5)-1.0) + algebraic[171] = 0.001/(algebraic[172]+algebraic[173]) + rates[23] = (algebraic[168]-states[23])/algebraic[171] + algebraic[176] = 1.0/(1.0+exp((algebraic[21]+37.4+constants[177])/(5.3+constants[178]))) + algebraic[179] = 0.001*(44.3+230.0*exp(-pow((algebraic[21]+36.0)/10.0, 2.0))) + rates[22] = (algebraic[176]-states[22])/algebraic[179] + algebraic[180] = constants[181]/(constants[181]+states[0]) + algebraic[182] = 0.001*algebraic[180]/constants[183] + rates[21] = (algebraic[180]-states[21])/algebraic[182] + algebraic[185] = 1.0/(1.0+exp(-(algebraic[21]+38.3)/5.5)) + algebraic[186] = 0.001/(1.068*exp((algebraic[21]+38.3)/30.0)+1.068*exp(-(algebraic[21]+38.3)/30.0)) + rates[25] = (algebraic[185]-states[25])/algebraic[186] + algebraic[187] = 1.0/(1.0+exp((algebraic[21]+58.7)/3.8)) + algebraic[188] = 1.0/(16.67*exp(-(algebraic[21]+75.0)/83.3)+16.67*exp((algebraic[21]+75.0)/15.38))+constants[189] + rates[24] = (algebraic[187]-states[24])/algebraic[188] + algebraic[191] = 1.0/(1.0+exp((algebraic[21]+49.0)/13.0)) + algebraic[192] = 0.001*0.6*(65.17/(0.57*exp(-0.08*(algebraic[21]+44.0))+0.065*exp(0.1*(algebraic[21]+45.93)))+10.1) + rates[27] = (algebraic[191]-states[27])/algebraic[192] + algebraic[193] = 1.0/(1.0+exp(-(algebraic[21]-19.3)/15.0)) + algebraic[194] = 0.001*0.66*1.4*(15.59/(1.037*exp(0.09*(algebraic[21]+30.61))+0.369*exp(-0.12*(algebraic[21]+23.84)))+2.98) + rates[26] = (algebraic[193]-states[26])/algebraic[194] + algebraic[198] = 1.0/(1.0+exp(-(algebraic[21]+10.0144)/7.6607)) + algebraic[199] = 0.84655354/(4.2*exp(algebraic[21]/17.0)+0.15*exp(-algebraic[21]/21.6)) + rates[30] = (algebraic[198]-states[30])/algebraic[199] + algebraic[200] = 1.0/(30.0*exp(algebraic[21]/10.0)+exp(-algebraic[21]/12.0)) + rates[29] = (algebraic[198]-states[29])/algebraic[200] + algebraic[202] = 1.0/(1.0+exp((algebraic[21]+28.6)/17.1)) + algebraic[201] = 1.0/(100.0*exp(-algebraic[21]/54.645)+656.0*exp(algebraic[21]/106.157)) + rates[28] = (algebraic[202]-states[28])/algebraic[201] + algebraic[207] = sqrt(1.0/(1.0+exp(-(algebraic[21]+0.6383-computed_constants[206])/10.7071))) + algebraic[209] = 28.0/(1.0+exp(-(algebraic[21]-40.0-computed_constants[206])/3.0)) + algebraic[210] = 1.0*exp(-(algebraic[21]-computed_constants[206]-5.0)/25.0) + algebraic[208] = 1.0/(algebraic[209]+algebraic[210]) + rates[31] = (algebraic[207]-states[31])/algebraic[208] + algebraic[214] = 10.0*exp(0.0133*(algebraic[21]+40.0)) + algebraic[215] = computed_constants[213]/(computed_constants[213]+algebraic[214]) + algebraic[216] = 1.0/(computed_constants[213]+algebraic[214]) + rates[32] = (algebraic[215]-states[32])/algebraic[216] def compute_variables(voi, states, rates, constants, computed_constants, algebraic): - variables[5] = states[1] - variables[2] = variables[3]*log(variables[4]/variables[5]) - variables[9] = 0.5*variables[3]*log(variables[10]/states[0]) - variables[21] = variables[121] if geq_func(variables[122], 1.0) else states[15] - variables[14] = variables[20]*variables[24]*pow(1.0+pow(variables[23]/variables[7], 1.2), -1.0)*pow(1.0+pow(variables[22]/variables[5], 1.3), -1.0)*pow(1.0+exp(-(variables[21]-variables[2]+110.0)/20.0), -1.0) - variables[50] = 1.0+variables[10]/variables[48]*(1.0+exp(variables[49]*variables[21]/variables[3]))+variables[4]/variables[51]*(1.0+variables[4]/variables[52]*(1.0+variables[4]/variables[47])) - variables[27] = variables[10]/variables[48]*exp(variables[49]*variables[21]/variables[3])/variables[50] - variables[42] = 1.0+states[0]/variables[40]*(1.0+exp(-variables[41]*variables[21]/variables[3])+variables[5]/variables[46])+variables[5]/variables[43]*(1.0+variables[5]/variables[44]*(1.0+variables[5]/variables[39])) - variables[29] = states[0]/variables[40]*exp(-variables[41]*variables[21]/variables[3])/variables[42] - variables[36] = variables[5]/(variables[39]+variables[5]) - variables[37] = exp(variables[45]*variables[21]/(2.0*variables[3])) - variables[33] = exp(-variables[45]*variables[21]/(2.0*variables[3])) - variables[38] = variables[5]/variables[43]*variables[5]/variables[44]*(1.0+variables[5]/variables[39])*exp(variables[45]*variables[21]/(2.0*variables[3]))/variables[42] - variables[26] = variables[37]*variables[36]*(variables[38]+variables[29])+variables[33]*variables[29]*(variables[35]+variables[37]) - variables[34] = variables[4]/variables[51]*variables[4]/variables[52]*(1.0+variables[4]/variables[47])*exp(-variables[45]*variables[21]/(2.0*variables[3]))/variables[50] - variables[28] = variables[33]*variables[35]*(variables[34]+variables[27])+variables[27]*variables[37]*(variables[36]+variables[33]) - variables[31] = variables[34]*variables[35]*(variables[38]+variables[29])+variables[38]*variables[27]*(variables[35]+variables[37]) - variables[32] = variables[38]*variables[36]*(variables[34]+variables[27])+variables[29]*variables[34]*(variables[36]+variables[33]) - variables[13] = (1.0-variables[25])*variables[30]*(variables[26]*variables[27]-variables[28]*variables[29])/(variables[28]+variables[26]+variables[32]+variables[31]) - variables[53] = variables[54]*states[3]*(states[2]-states[0]) - variables[55] = states[2]-states[0] - variables[56] = variables[57]-(variables[57]-variables[58])/(1.0+pow(variables[59]/states[2], variables[60])) - variables[61] = variables[62]/variables[56] - variables[63] = variables[64]*variables[56] - variables[67] = states[4]+states[3]+states[6]+states[5] - variables[71] = (states[0]-states[7])/variables[72] - variables[73] = variables[69]/(1.0+exp((-states[7]+variables[74])/variables[75])) - variables[76] = (states[8]-states[2])/variables[77] - variables[78] = variables[79]*states[7]*(1.0-states[9])-variables[80]*states[9] - variables[81] = variables[82]*states[7]*(1.0-(states[10]+states[11]))-variables[83]*states[10] - variables[84] = variables[85]*variables[86]*(1.0-(states[10]+states[11]))-variables[87]*states[11] - variables[88] = variables[89]*states[7]*(1.0-states[12])-variables[90]*states[12] - variables[91] = variables[89]*states[0]*(1.0-states[13])-variables[90]*states[13] - variables[92] = variables[93]*states[2]*(1.0-states[14])-variables[94]*states[14] - variables[16] = states[16]*variables[133]*(variables[21]-variables[2])*(1.0-variables[135]) - variables[136] = states[16]*variables[134]*(variables[21]-variables[6])*(1.0-variables[135]) - variables[111] = variables[16]+variables[136] - variables[112] = variables[157]*states[20]*states[19]*(variables[21]-variables[6]) - variables[113] = variables[211]*variables[212]*(variables[21]-variables[6])*(1.0+exp((variables[21]+20.0)/20.0))*states[32] if gt_func(variables[0], 0.0) else 0.0 - variables[102] = 2.0*variables[184]*variables[21]/(variables[3]*(1.0-exp(-1.0*variables[21]*2.0/variables[3])))*(states[0]-variables[10]*exp(-2.0*variables[21]/variables[3]))*states[25]*states[24] - variables[101] = 2.0*variables[163]*(variables[21]-0.0)/(variables[3]*(1.0-exp(-1.0*(variables[21]-0.0)*2.0/variables[3])))*(states[0]-variables[10]*exp(-2.0*(variables[21]-0.0)/variables[3]))*states[23]*states[22]*states[21] - variables[15] = 0.0000185*variables[163]*(variables[21]-0.0)/(variables[3]*(1.0-exp(-1.0*(variables[21]-0.0)/variables[3])))*(variables[5]-variables[4]*exp(-1.0*(variables[21]-0.0)/variables[3]))*states[23]*states[22]*states[21] - variables[164] = 0.000365*variables[163]*(variables[21]-0.0)/(variables[3]*(1.0-exp(-1.0*(variables[21]-0.0)/variables[3])))*(variables[8]-variables[7]*exp(-1.0*(variables[21]-0.0)/variables[3]))*states[23]*states[22]*states[21] - variables[114] = (variables[101]+variables[164]+variables[15])*(1.0-variables[165])*1.0*variables[162] - variables[142] = variables[3]*log((variables[4]+0.12*variables[7])/(variables[5]+0.12*variables[8])) - variables[143] = variables[144]*pow(states[18], 3.0)*states[17]*(variables[21]-variables[142]) - variables[145] = variables[146]*pow(states[18], 3.0)*(variables[21]-variables[142]) - variables[12] = variables[143]+variables[145] - variables[115] = variables[190]*(variables[21]-variables[6])*states[27]*states[26] - variables[205] = variables[3]*log((variables[7]+0.12*variables[4])/(variables[8]+0.12*variables[5])) - variables[116] = variables[203]*(variables[21]-variables[205])*pow(states[31], 2.0) - variables[117] = variables[195]*(variables[21]-variables[6])*(0.9*states[29]+0.1*states[30])*states[28] - variables[110] = variables[111]+variables[117]+variables[116]+variables[115]+variables[14]+variables[13]+variables[12]+variables[114]+variables[102]+variables[113]+variables[112] - variables[139] = 1.0/(0.36*(variables[21]+148.8-variables[137]-variables[138])/(exp(0.066*(variables[21]+148.8-variables[137]-variables[138]))-1.0)+0.1*(variables[21]+87.3-variables[137]-variables[138])/(1.0-exp(-0.2*(variables[21]+87.3-variables[137]-variables[138]))))-0.054 - variables[140] = 0.01329+0.99921/(1.0+exp((variables[21]+97.134-variables[137]-variables[138]-variables[141])/8.1752)) if lt_func(variables[21], -(80.0-variables[137]-variables[138]-variables[141])) else 0.0002501*exp(-(variables[21]-variables[137]-variables[138]-variables[141])/12.861) - variables[147] = 1.0/(1.0+exp(-(variables[21]+42.0504)/8.3106)) - variables[148] = variables[21]+41.0 - variables[149] = 2000.0 if lt_func(fabs(variables[148]), variables[150]) else 200.0*variables[148]/(1.0-exp(-0.1*variables[148])) - variables[151] = 8000.0*exp(-0.056*(variables[21]+66.0)) - variables[152] = 1.0/(variables[149]+variables[151]) - variables[153] = 1.0/(1.0+exp((variables[21]+69.804)/4.4565)) - variables[154] = 20.0*exp(-0.125*(variables[21]+75.0)) - variables[155] = 2000.0/(320.0*exp(-0.1*(variables[21]+75.0))+1.0) - variables[156] = 1.0/(variables[154]+variables[155]) - variables[158] = 1.0/(1.0+exp((variables[21]+6.0)/-8.6)) - variables[159] = 0.009/(1.0+exp((variables[21]+5.0)/12.0))+0.0005 - variables[160] = 1.0/(1.0+exp((variables[21]+7.5)/10.0)) - variables[161] = 0.59/(1.0+exp((variables[21]+60.0)/10.0))+3.05 - variables[168] = 1.0/(1.0+exp(-(variables[21]-variables[169]-variables[166])/(variables[170]*(1.0+variables[167]/100.0)))) - variables[174] = -41.80001 if eq_func(variables[21], -41.8) else 0.0 if eq_func(variables[21], 0.0) else -6.80001 if eq_func(variables[21], -6.8) else variables[21] - variables[172] = -0.02839*(variables[174]+41.8)/(exp(-(variables[174]+41.8)/2.5)-1.0)-0.0849*(variables[174]+6.8)/(exp(-(variables[174]+6.8)/4.8)-1.0) - variables[175] = -1.80001 if eq_func(variables[21], -1.8) else variables[21] - variables[173] = 0.01143*(variables[175]+1.8)/(exp((variables[175]+1.8)/2.5)-1.0) - variables[171] = 0.001/(variables[172]+variables[173]) - variables[176] = 1.0/(1.0+exp((variables[21]+37.4+variables[177])/(5.3+variables[178]))) - variables[179] = 0.001*(44.3+230.0*exp(-pow((variables[21]+36.0)/10.0, 2.0))) - variables[180] = variables[181]/(variables[181]+states[0]) - variables[182] = 0.001*variables[180]/variables[183] - variables[185] = 1.0/(1.0+exp(-(variables[21]+38.3)/5.5)) - variables[186] = 0.001/(1.068*exp((variables[21]+38.3)/30.0)+1.068*exp(-(variables[21]+38.3)/30.0)) - variables[187] = 1.0/(1.0+exp((variables[21]+58.7)/3.8)) - variables[188] = 1.0/(16.67*exp(-(variables[21]+75.0)/83.3)+16.67*exp((variables[21]+75.0)/15.38))+variables[189] - variables[191] = 1.0/(1.0+exp((variables[21]+49.0)/13.0)) - variables[192] = 0.001*0.6*(65.17/(0.57*exp(-0.08*(variables[21]+44.0))+0.065*exp(0.1*(variables[21]+45.93)))+10.1) - variables[193] = 1.0/(1.0+exp(-(variables[21]-19.3)/15.0)) - variables[194] = 0.001*0.66*1.4*(15.59/(1.037*exp(0.09*(variables[21]+30.61))+0.369*exp(-0.12*(variables[21]+23.84)))+2.98) - variables[196] = 1.0/(1.0+exp(-(variables[21]+23.2)/6.6))/(0.84655354/(37.2*exp(variables[21]/11.9)+0.96*exp(-variables[21]/18.5))) - variables[197] = 4.0*((37.2*exp(variables[21]/15.9)+0.96*exp(-variables[21]/22.5))/0.84655354-1.0/(1.0+exp(-(variables[21]+23.2)/10.6))/(0.84655354/(37.2*exp(variables[21]/15.9)+0.96*exp(-variables[21]/22.5)))) - variables[198] = 1.0/(1.0+exp(-(variables[21]+10.0144)/7.6607)) - variables[199] = 0.84655354/(4.2*exp(variables[21]/17.0)+0.15*exp(-variables[21]/21.6)) - variables[200] = 1.0/(30.0*exp(variables[21]/10.0)+exp(-variables[21]/12.0)) - variables[201] = 1.0/(100.0*exp(-variables[21]/54.645)+656.0*exp(variables[21]/106.157)) - variables[202] = 1.0/(1.0+exp((variables[21]+28.6)/17.1)) - variables[207] = sqrt(1.0/(1.0+exp(-(variables[21]+0.6383-variables[206])/10.7071))) - variables[209] = 28.0/(1.0+exp(-(variables[21]-40.0-variables[206])/3.0)) - variables[210] = 1.0*exp(-(variables[21]-variables[206]-5.0)/25.0) - variables[208] = 1.0/(variables[209]+variables[210]) - variables[214] = 10.0*exp(0.0133*(variables[21]+40.0)) - variables[215] = variables[213]/(variables[213]+variables[214]) - variables[216] = 1.0/(variables[213]+variables[214]) + algebraic[5] = states[1] + algebraic[2] = computed_constants[3]*log(constants[4]/algebraic[5]) + algebraic[9] = 0.5*computed_constants[3]*log(constants[10]/states[0]) + algebraic[21] = algebraic[121] if geq_func(constants[122], 1.0) else states[15] + algebraic[14] = computed_constants[20]*constants[24]*pow(1.0+pow(constants[23]/constants[7], 1.2), -1.0)*pow(1.0+pow(constants[22]/algebraic[5], 1.3), -1.0)*pow(1.0+exp(-(algebraic[21]-algebraic[2]+110.0)/20.0), -1.0) + algebraic[50] = 1.0+constants[10]/constants[48]*(1.0+exp(constants[49]*algebraic[21]/computed_constants[3]))+constants[4]/constants[51]*(1.0+constants[4]/constants[52]*(1.0+constants[4]/constants[47])) + algebraic[27] = constants[10]/constants[48]*exp(constants[49]*algebraic[21]/computed_constants[3])/algebraic[50] + algebraic[42] = 1.0+states[0]/constants[40]*(1.0+exp(-constants[41]*algebraic[21]/computed_constants[3])+algebraic[5]/constants[46])+algebraic[5]/constants[43]*(1.0+algebraic[5]/constants[44]*(1.0+algebraic[5]/constants[39])) + algebraic[29] = states[0]/constants[40]*exp(-constants[41]*algebraic[21]/computed_constants[3])/algebraic[42] + algebraic[36] = algebraic[5]/(constants[39]+algebraic[5]) + algebraic[37] = exp(constants[45]*algebraic[21]/(2.0*computed_constants[3])) + algebraic[33] = exp(-constants[45]*algebraic[21]/(2.0*computed_constants[3])) + algebraic[38] = algebraic[5]/constants[43]*algebraic[5]/constants[44]*(1.0+algebraic[5]/constants[39])*exp(constants[45]*algebraic[21]/(2.0*computed_constants[3]))/algebraic[42] + algebraic[26] = algebraic[37]*algebraic[36]*(algebraic[38]+algebraic[29])+algebraic[33]*algebraic[29]*(computed_constants[35]+algebraic[37]) + algebraic[34] = constants[4]/constants[51]*constants[4]/constants[52]*(1.0+constants[4]/constants[47])*exp(-constants[45]*algebraic[21]/(2.0*computed_constants[3]))/algebraic[50] + algebraic[28] = algebraic[33]*computed_constants[35]*(algebraic[34]+algebraic[27])+algebraic[27]*algebraic[37]*(algebraic[36]+algebraic[33]) + algebraic[31] = algebraic[34]*computed_constants[35]*(algebraic[38]+algebraic[29])+algebraic[38]*algebraic[27]*(computed_constants[35]+algebraic[37]) + algebraic[32] = algebraic[38]*algebraic[36]*(algebraic[34]+algebraic[27])+algebraic[29]*algebraic[34]*(algebraic[36]+algebraic[33]) + algebraic[13] = (1.0-constants[25])*constants[30]*(algebraic[26]*algebraic[27]-algebraic[28]*algebraic[29])/(algebraic[28]+algebraic[26]+algebraic[32]+algebraic[31]) + algebraic[53] = constants[54]*states[3]*(states[2]-states[0]) + algebraic[55] = states[2]-states[0] + algebraic[56] = constants[57]-(constants[57]-constants[58])/(1.0+pow(constants[59]/states[2], constants[60])) + algebraic[61] = constants[62]/algebraic[56] + algebraic[63] = constants[64]*algebraic[56] + algebraic[67] = states[4]+states[3]+states[6]+states[5] + algebraic[71] = (states[0]-states[7])/constants[72] + algebraic[73] = computed_constants[69]/(1.0+exp((-states[7]+constants[74])/constants[75])) + algebraic[76] = (states[8]-states[2])/constants[77] + algebraic[78] = constants[79]*states[7]*(1.0-states[9])-constants[80]*states[9] + algebraic[81] = constants[82]*states[7]*(1.0-(states[10]+states[11]))-constants[83]*states[10] + algebraic[84] = constants[85]*constants[86]*(1.0-(states[10]+states[11]))-constants[87]*states[11] + algebraic[88] = constants[89]*states[7]*(1.0-states[12])-constants[90]*states[12] + algebraic[91] = constants[89]*states[0]*(1.0-states[13])-constants[90]*states[13] + algebraic[92] = constants[93]*states[2]*(1.0-states[14])-constants[94]*states[14] + algebraic[16] = states[16]*computed_constants[133]*(algebraic[21]-algebraic[2])*(1.0-constants[135]) + algebraic[136] = states[16]*computed_constants[134]*(algebraic[21]-computed_constants[6])*(1.0-constants[135]) + algebraic[111] = algebraic[16]+algebraic[136] + algebraic[112] = constants[157]*states[20]*states[19]*(algebraic[21]-computed_constants[6]) + algebraic[113] = constants[211]*constants[212]*(algebraic[21]-computed_constants[6])*(1.0+exp((algebraic[21]+20.0)/20.0))*states[32] if gt_func(constants[0], 0.0) else 0.0 + algebraic[102] = 2.0*constants[184]*algebraic[21]/(computed_constants[3]*(1.0-exp(-1.0*algebraic[21]*2.0/computed_constants[3])))*(states[0]-constants[10]*exp(-2.0*algebraic[21]/computed_constants[3]))*states[25]*states[24] + algebraic[101] = 2.0*constants[163]*(algebraic[21]-0.0)/(computed_constants[3]*(1.0-exp(-1.0*(algebraic[21]-0.0)*2.0/computed_constants[3])))*(states[0]-constants[10]*exp(-2.0*(algebraic[21]-0.0)/computed_constants[3]))*states[23]*states[22]*states[21] + algebraic[15] = 0.0000185*constants[163]*(algebraic[21]-0.0)/(computed_constants[3]*(1.0-exp(-1.0*(algebraic[21]-0.0)/computed_constants[3])))*(algebraic[5]-constants[4]*exp(-1.0*(algebraic[21]-0.0)/computed_constants[3]))*states[23]*states[22]*states[21] + algebraic[164] = 0.000365*constants[163]*(algebraic[21]-0.0)/(computed_constants[3]*(1.0-exp(-1.0*(algebraic[21]-0.0)/computed_constants[3])))*(constants[8]-constants[7]*exp(-1.0*(algebraic[21]-0.0)/computed_constants[3]))*states[23]*states[22]*states[21] + algebraic[114] = (algebraic[101]+algebraic[164]+algebraic[15])*(1.0-computed_constants[165])*1.0*computed_constants[162] + algebraic[142] = computed_constants[3]*log((constants[4]+0.12*constants[7])/(algebraic[5]+0.12*constants[8])) + algebraic[143] = constants[144]*pow(states[18], 3.0)*states[17]*(algebraic[21]-algebraic[142]) + algebraic[145] = constants[146]*pow(states[18], 3.0)*(algebraic[21]-algebraic[142]) + algebraic[12] = algebraic[143]+algebraic[145] + algebraic[115] = constants[190]*(algebraic[21]-computed_constants[6])*states[27]*states[26] + algebraic[205] = computed_constants[3]*log((constants[7]+0.12*constants[4])/(constants[8]+0.12*algebraic[5])) + algebraic[116] = computed_constants[203]*(algebraic[21]-algebraic[205])*pow(states[31], 2.0) + algebraic[117] = constants[195]*(algebraic[21]-computed_constants[6])*(0.9*states[29]+0.1*states[30])*states[28] + algebraic[110] = algebraic[111]+algebraic[117]+algebraic[116]+algebraic[115]+algebraic[14]+algebraic[13]+algebraic[12]+algebraic[114]+algebraic[102]+algebraic[113]+algebraic[112] + algebraic[139] = 1.0/(0.36*(algebraic[21]+148.8-computed_constants[137]-computed_constants[138])/(exp(0.066*(algebraic[21]+148.8-computed_constants[137]-computed_constants[138]))-1.0)+0.1*(algebraic[21]+87.3-computed_constants[137]-computed_constants[138])/(1.0-exp(-0.2*(algebraic[21]+87.3-computed_constants[137]-computed_constants[138]))))-0.054 + algebraic[140] = 0.01329+0.99921/(1.0+exp((algebraic[21]+97.134-computed_constants[137]-computed_constants[138]-constants[141])/8.1752)) if lt_func(algebraic[21], -(80.0-computed_constants[137]-computed_constants[138]-constants[141])) else 0.0002501*exp(-(algebraic[21]-computed_constants[137]-computed_constants[138]-constants[141])/12.861) + algebraic[147] = 1.0/(1.0+exp(-(algebraic[21]+42.0504)/8.3106)) + algebraic[148] = algebraic[21]+41.0 + algebraic[149] = 2000.0 if lt_func(fabs(algebraic[148]), constants[150]) else 200.0*algebraic[148]/(1.0-exp(-0.1*algebraic[148])) + algebraic[151] = 8000.0*exp(-0.056*(algebraic[21]+66.0)) + algebraic[152] = 1.0/(algebraic[149]+algebraic[151]) + algebraic[153] = 1.0/(1.0+exp((algebraic[21]+69.804)/4.4565)) + algebraic[154] = 20.0*exp(-0.125*(algebraic[21]+75.0)) + algebraic[155] = 2000.0/(320.0*exp(-0.1*(algebraic[21]+75.0))+1.0) + algebraic[156] = 1.0/(algebraic[154]+algebraic[155]) + algebraic[158] = 1.0/(1.0+exp((algebraic[21]+6.0)/-8.6)) + algebraic[159] = 0.009/(1.0+exp((algebraic[21]+5.0)/12.0))+0.0005 + algebraic[160] = 1.0/(1.0+exp((algebraic[21]+7.5)/10.0)) + algebraic[161] = 0.59/(1.0+exp((algebraic[21]+60.0)/10.0))+3.05 + algebraic[168] = 1.0/(1.0+exp(-(algebraic[21]-constants[169]-computed_constants[166])/(constants[170]*(1.0+computed_constants[167]/100.0)))) + algebraic[174] = -41.80001 if eq_func(algebraic[21], -41.8) else 0.0 if eq_func(algebraic[21], 0.0) else -6.80001 if eq_func(algebraic[21], -6.8) else algebraic[21] + algebraic[172] = -0.02839*(algebraic[174]+41.8)/(exp(-(algebraic[174]+41.8)/2.5)-1.0)-0.0849*(algebraic[174]+6.8)/(exp(-(algebraic[174]+6.8)/4.8)-1.0) + algebraic[175] = -1.80001 if eq_func(algebraic[21], -1.8) else algebraic[21] + algebraic[173] = 0.01143*(algebraic[175]+1.8)/(exp((algebraic[175]+1.8)/2.5)-1.0) + algebraic[171] = 0.001/(algebraic[172]+algebraic[173]) + algebraic[176] = 1.0/(1.0+exp((algebraic[21]+37.4+constants[177])/(5.3+constants[178]))) + algebraic[179] = 0.001*(44.3+230.0*exp(-pow((algebraic[21]+36.0)/10.0, 2.0))) + algebraic[180] = constants[181]/(constants[181]+states[0]) + algebraic[182] = 0.001*algebraic[180]/constants[183] + algebraic[185] = 1.0/(1.0+exp(-(algebraic[21]+38.3)/5.5)) + algebraic[186] = 0.001/(1.068*exp((algebraic[21]+38.3)/30.0)+1.068*exp(-(algebraic[21]+38.3)/30.0)) + algebraic[187] = 1.0/(1.0+exp((algebraic[21]+58.7)/3.8)) + algebraic[188] = 1.0/(16.67*exp(-(algebraic[21]+75.0)/83.3)+16.67*exp((algebraic[21]+75.0)/15.38))+constants[189] + algebraic[191] = 1.0/(1.0+exp((algebraic[21]+49.0)/13.0)) + algebraic[192] = 0.001*0.6*(65.17/(0.57*exp(-0.08*(algebraic[21]+44.0))+0.065*exp(0.1*(algebraic[21]+45.93)))+10.1) + algebraic[193] = 1.0/(1.0+exp(-(algebraic[21]-19.3)/15.0)) + algebraic[194] = 0.001*0.66*1.4*(15.59/(1.037*exp(0.09*(algebraic[21]+30.61))+0.369*exp(-0.12*(algebraic[21]+23.84)))+2.98) + algebraic[196] = 1.0/(1.0+exp(-(algebraic[21]+23.2)/6.6))/(0.84655354/(37.2*exp(algebraic[21]/11.9)+0.96*exp(-algebraic[21]/18.5))) + algebraic[197] = 4.0*((37.2*exp(algebraic[21]/15.9)+0.96*exp(-algebraic[21]/22.5))/0.84655354-1.0/(1.0+exp(-(algebraic[21]+23.2)/10.6))/(0.84655354/(37.2*exp(algebraic[21]/15.9)+0.96*exp(-algebraic[21]/22.5)))) + algebraic[198] = 1.0/(1.0+exp(-(algebraic[21]+10.0144)/7.6607)) + algebraic[199] = 0.84655354/(4.2*exp(algebraic[21]/17.0)+0.15*exp(-algebraic[21]/21.6)) + algebraic[200] = 1.0/(30.0*exp(algebraic[21]/10.0)+exp(-algebraic[21]/12.0)) + algebraic[201] = 1.0/(100.0*exp(-algebraic[21]/54.645)+656.0*exp(algebraic[21]/106.157)) + algebraic[202] = 1.0/(1.0+exp((algebraic[21]+28.6)/17.1)) + algebraic[207] = sqrt(1.0/(1.0+exp(-(algebraic[21]+0.6383-computed_constants[206])/10.7071))) + algebraic[209] = 28.0/(1.0+exp(-(algebraic[21]-40.0-computed_constants[206])/3.0)) + algebraic[210] = 1.0*exp(-(algebraic[21]-computed_constants[206]-5.0)/25.0) + algebraic[208] = 1.0/(algebraic[209]+algebraic[210]) + algebraic[214] = 10.0*exp(0.0133*(algebraic[21]+40.0)) + algebraic[215] = computed_constants[213]/(computed_constants[213]+algebraic[214]) + algebraic[216] = 1.0/(computed_constants[213]+algebraic[214]) diff --git a/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.c b/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.c index d2856f1c0d..2290241662 100644 --- a/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.c +++ b/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.c @@ -250,116 +250,116 @@ void deleteArray(double *array) void initialiseVariables(double *states, double *rates, double *constants) { - variables[1] = 0.0; - variables[2] = 1.0; - variables[3] = 1.0309347; - variables[5] = 2.0e-5; - variables[6] = 6.5e-5; - variables[22] = 8314.0; - variables[23] = 310.0; - variables[24] = 96845.0; - variables[26] = 5.8e-5; - variables[27] = 0.000189; - variables[28] = 5.8e-5; - variables[29] = 0.000189; - variables[30] = 5.81818e-5; - variables[31] = 0.0001888; - variables[34] = 2.52e-5; - variables[35] = 8.19e-5; - variables[36] = 2.52e-5; - variables[37] = 8.19e-5; - variables[38] = 2.523636e-5; - variables[39] = 8.1892e-5; - variables[42] = 1.32e-5; - variables[43] = 4.3e-5; - variables[44] = 1.323e-5; - variables[45] = 4.29e-5; - variables[46] = 1.3236e-5; - variables[47] = 4.2952e-5; - variables[50] = 2.7e-6; - variables[51] = 8.8e-6; - variables[52] = 2.8e-6; - variables[53] = 8.8e-6; - variables[54] = 2.7229e-6; - variables[55] = 8.83584e-6; - variables[56] = 8.0; - variables[57] = 0.5; - variables[58] = 2.0; - variables[59] = 140.0; - variables[60] = 0.0001; - variables[61] = 0.0001; - variables[63] = 0.0478; - variables[64] = 0.16; - variables[65] = 0.0478; - variables[66] = 0.16; - variables[67] = 0.04782545; - variables[68] = 0.1551936; - variables[69] = 5.4; - variables[70] = 0.621; - variables[71] = 5.64; - variables[73] = 0.0; - variables[74] = 0.0; - variables[75] = 0.0042; - variables[76] = 0.03339; - variables[77] = 0.0; - variables[78] = 0.0; - variables[79] = 140.0; - variables[82] = 0.0; - variables[83] = 1.2e-6; - variables[84] = 0.0; - variables[85] = 3.7e-7; - variables[86] = 0.0; - variables[87] = 1.204e-6; - variables[97] = 0.0058; - variables[98] = 0.0659; - variables[99] = 0.0082; - variables[100] = 0.0659; - variables[101] = 0.0057938; - variables[102] = 0.06588648; - variables[103] = 46.4; - variables[113] = 0.0043; - variables[114] = 0.0139; - variables[115] = 0.0021; - variables[116] = 0.00694; - variables[117] = 0.00427806; - variables[118] = 0.0138823; - variables[119] = 45.0; - variables[129] = 0.00491; - variables[130] = 0.03649; - variables[131] = 0.004905; - variables[132] = 0.0365; - variables[133] = 0.004905; - variables[134] = 0.036495; - variables[136] = 6.65e-5; - variables[137] = 0.0114; - variables[138] = 0.000266; - variables[139] = 0.0114; - variables[140] = 6.645504e-5; - variables[141] = 0.01138376; - variables[147] = 0.000797; - variables[148] = 0.016; - variables[149] = 0.000738; - variables[150] = 0.0208; - variables[151] = 0.00079704; - variables[152] = 0.016; - variables[161] = 0.000518; - variables[162] = 0.0104; - variables[163] = 0.000345; - variables[164] = 0.0104; - variables[165] = 0.0003445; - variables[166] = 0.0104; - variables[170] = 0.000548; - variables[171] = 0.0069; - variables[172] = 0.000437; - variables[173] = 0.0055; - variables[174] = 0.0005465; - variables[175] = 0.006875; - variables[177] = 0.000548; - variables[178] = 0.0069; - variables[179] = 0.000437; - variables[180] = 0.0055; - variables[181] = 0.0005465; - variables[182] = 0.006875; + constants[1] = 0.0; + constants[2] = 1.0; + constants[3] = 1.0309347; + constants[5] = 2.0e-5; + constants[6] = 6.5e-5; + constants[22] = 8314.0; + constants[23] = 310.0; + constants[24] = 96845.0; + constants[26] = 5.8e-5; + constants[27] = 0.000189; + constants[28] = 5.8e-5; + constants[29] = 0.000189; + constants[30] = 5.81818e-5; + constants[31] = 0.0001888; + constants[34] = 2.52e-5; + constants[35] = 8.19e-5; + constants[36] = 2.52e-5; + constants[37] = 8.19e-5; + constants[38] = 2.523636e-5; + constants[39] = 8.1892e-5; + constants[42] = 1.32e-5; + constants[43] = 4.3e-5; + constants[44] = 1.323e-5; + constants[45] = 4.29e-5; + constants[46] = 1.3236e-5; + constants[47] = 4.2952e-5; + constants[50] = 2.7e-6; + constants[51] = 8.8e-6; + constants[52] = 2.8e-6; + constants[53] = 8.8e-6; + constants[54] = 2.7229e-6; + constants[55] = 8.83584e-6; + constants[56] = 8.0; + constants[57] = 0.5; + constants[58] = 2.0; + constants[59] = 140.0; + constants[60] = 0.0001; + constants[61] = 0.0001; + constants[63] = 0.0478; + constants[64] = 0.16; + constants[65] = 0.0478; + constants[66] = 0.16; + constants[67] = 0.04782545; + constants[68] = 0.1551936; + constants[69] = 5.4; + constants[70] = 0.621; + constants[71] = 5.64; + constants[73] = 0.0; + constants[74] = 0.0; + constants[75] = 0.0042; + constants[76] = 0.03339; + constants[77] = 0.0; + constants[78] = 0.0; + constants[79] = 140.0; + constants[82] = 0.0; + constants[83] = 1.2e-6; + constants[84] = 0.0; + constants[85] = 3.7e-7; + constants[86] = 0.0; + constants[87] = 1.204e-6; + constants[97] = 0.0058; + constants[98] = 0.0659; + constants[99] = 0.0082; + constants[100] = 0.0659; + constants[101] = 0.0057938; + constants[102] = 0.06588648; + constants[103] = 46.4; + constants[113] = 0.0043; + constants[114] = 0.0139; + constants[115] = 0.0021; + constants[116] = 0.00694; + constants[117] = 0.00427806; + constants[118] = 0.0138823; + constants[119] = 45.0; + constants[129] = 0.00491; + constants[130] = 0.03649; + constants[131] = 0.004905; + constants[132] = 0.0365; + constants[133] = 0.004905; + constants[134] = 0.036495; + constants[136] = 6.65e-5; + constants[137] = 0.0114; + constants[138] = 0.000266; + constants[139] = 0.0114; + constants[140] = 6.645504e-5; + constants[141] = 0.01138376; + constants[147] = 0.000797; + constants[148] = 0.016; + constants[149] = 0.000738; + constants[150] = 0.0208; + constants[151] = 0.00079704; + constants[152] = 0.016; + constants[161] = 0.000518; + constants[162] = 0.0104; + constants[163] = 0.000345; + constants[164] = 0.0104; + constants[165] = 0.0003445; + constants[166] = 0.0104; + constants[170] = 0.000548; + constants[171] = 0.0069; + constants[172] = 0.000437; + constants[173] = 0.0055; + constants[174] = 0.0005465; + constants[175] = 0.006875; + constants[177] = 0.000548; + constants[178] = 0.0069; + constants[179] = 0.000437; + constants[180] = 0.0055; + constants[181] = 0.0005465; + constants[182] = 0.006875; states[0] = -39.013558536; states[1] = 0.092361701692; states[2] = 0.015905380261; @@ -379,154 +379,154 @@ void initialiseVariables(double *states, double *rates, double *constants) void computeComputedConstants(double *constants, double *computedConstants) { - variables[0] = (variables[2] == 0.0)?1.07*(3.0*variables[1]-0.1)/(3.0*(1.0+0.7745*exp(-(3.0*variables[1]-2.05)/0.295))):(variables[2] == 1.0)?variables[3]*variables[1]/(1.0+0.7745*exp(-(3.0*variables[1]-2.05)/0.295)):1.07*29.0*variables[1]/(30.0*(1.0+0.7745*exp(-(29.0*variables[1]-24.5)/1.95))); - variables[4] = variables[5]+variables[0]*(variables[6]-variables[5]); - variables[25] = (variables[2] == 0.0)?variables[26]+variables[0]*(variables[27]-variables[26]):(variables[2] == 1.0)?variables[30]+variables[0]*(variables[31]-variables[30]):variables[28]+variables[0]*(variables[29]-variables[28]); - variables[33] = (variables[2] == 0.0)?variables[34]+variables[0]*(variables[35]-variables[34]):(variables[2] == 1.0)?variables[38]+variables[0]*(variables[39]-variables[38]):variables[36]+variables[0]*(variables[37]-variables[36]); - variables[41] = (variables[2] == 0.0)?variables[42]+variables[0]*(variables[43]-variables[42]):(variables[2] == 1.0)?variables[46]+variables[0]*(variables[47]-variables[46]):variables[44]+variables[0]*(variables[45]-variables[44]); - variables[49] = (variables[2] == 0.0)?variables[50]+variables[0]*(variables[51]-variables[50]):(variables[2] == 1.0)?variables[54]+variables[0]*(variables[55]-variables[54]):variables[52]+variables[0]*(variables[53]-variables[52]); - variables[62] = (variables[2] == 0.0)?variables[63]+variables[0]*(variables[64]-variables[63]):(variables[2] == 1.0)?variables[67]+variables[0]*(variables[68]-variables[67]):variables[65]+variables[0]*(variables[66]-variables[65]); - variables[72] = (variables[2] == 0.0)?variables[73]+variables[0]*(variables[74]-variables[73]):(variables[2] == 1.0)?variables[77]+variables[0]*(variables[78]-variables[77]):variables[75]+variables[0]*(variables[76]-variables[75]); - variables[8] = variables[72]*variables[60]/(variables[60]+0.0004); - variables[32] = variables[22]*variables[23]/variables[24]*log(variables[59]/variables[56]); - variables[40] = variables[22]*variables[23]/variables[24]*log(variables[69]/variables[79]); - variables[48] = variables[22]*variables[23]/(2.0*variables[24])*log(variables[58]/variables[60]); - variables[80] = (variables[2] == 0.0)?variables[22]*variables[23]/variables[24]*log((variables[69]+0.12*variables[59])/(variables[79]+0.12*variables[56])):variables[22]*variables[23]/variables[24]*log((variables[69]+0.03*variables[59])/(variables[79]+0.03*variables[56])); - variables[81] = (variables[2] == 0.0)?variables[82]+variables[0]*(variables[83]-variables[82]):(variables[2] == 1.0)?variables[86]+variables[0]*(variables[87]-variables[86]):variables[84]+variables[0]*(variables[85]-variables[84]); - variables[96] = (variables[2] == 0.0)?variables[97]+variables[0]*(variables[98]-variables[97]):(variables[2] == 1.0)?variables[101]+variables[0]*(variables[102]-variables[101]):variables[99]+variables[0]*(variables[100]-variables[99]); - variables[112] = (variables[2] == 0.0)?variables[113]+variables[0]*(variables[114]-variables[113]):(variables[2] == 1.0)?variables[117]+variables[0]*(variables[118]-variables[117]):variables[115]+variables[0]*(variables[116]-variables[115]); - variables[128] = (variables[2] == 0.0)?variables[129]+variables[0]*(variables[130]-variables[129]):(variables[2] == 1.0)?variables[133]+variables[0]*(variables[134]-variables[133]):variables[131]+variables[0]*(variables[132]-variables[131]); - variables[135] = (variables[2] == 0.0)?variables[136]+variables[0]*(variables[137]-variables[136]):(variables[2] == 1.0)?variables[140]+variables[0]*(variables[141]-variables[140]):variables[138]+variables[0]*(variables[139]-variables[138]); - variables[146] = (variables[2] == 0.0)?variables[147]+variables[0]*(variables[148]-variables[147]):(variables[2] == 1.0)?variables[151]+variables[0]*(variables[152]-variables[151]):variables[149]+variables[0]*(variables[150]-variables[149]); - variables[158] = (variables[2] == 0.0)?0.002:(variables[2] == 1.0)?0.002:0.006; - variables[160] = (variables[2] == 0.0)?variables[161]+variables[0]*(variables[162]-variables[161]):(variables[2] == 1.0)?variables[165]+variables[0]*(variables[166]-variables[165]):variables[163]+variables[0]*(variables[164]-variables[163]); - variables[169] = (variables[2] == 0.0)?variables[170]+variables[0]*(variables[171]-variables[170]):(variables[2] == 1.0)?variables[174]+variables[0]*(variables[175]-variables[174]):variables[172]+variables[0]*(variables[173]-variables[172]); - variables[176] = (variables[2] == 0.0)?variables[177]+variables[0]*(variables[178]-variables[177]):(variables[2] == 1.0)?variables[181]+variables[0]*(variables[182]-variables[181]):variables[179]+variables[0]*(variables[180]-variables[179]); + computedConstants[0] = (constants[2] == 0.0)?1.07*(3.0*constants[1]-0.1)/(3.0*(1.0+0.7745*exp(-(3.0*constants[1]-2.05)/0.295))):(constants[2] == 1.0)?constants[3]*constants[1]/(1.0+0.7745*exp(-(3.0*constants[1]-2.05)/0.295)):1.07*29.0*constants[1]/(30.0*(1.0+0.7745*exp(-(29.0*constants[1]-24.5)/1.95))); + computedConstants[4] = constants[5]+computedConstants[0]*(constants[6]-constants[5]); + computedConstants[25] = (constants[2] == 0.0)?constants[26]+computedConstants[0]*(constants[27]-constants[26]):(constants[2] == 1.0)?constants[30]+computedConstants[0]*(constants[31]-constants[30]):constants[28]+computedConstants[0]*(constants[29]-constants[28]); + computedConstants[33] = (constants[2] == 0.0)?constants[34]+computedConstants[0]*(constants[35]-constants[34]):(constants[2] == 1.0)?constants[38]+computedConstants[0]*(constants[39]-constants[38]):constants[36]+computedConstants[0]*(constants[37]-constants[36]); + computedConstants[41] = (constants[2] == 0.0)?constants[42]+computedConstants[0]*(constants[43]-constants[42]):(constants[2] == 1.0)?constants[46]+computedConstants[0]*(constants[47]-constants[46]):constants[44]+computedConstants[0]*(constants[45]-constants[44]); + computedConstants[49] = (constants[2] == 0.0)?constants[50]+computedConstants[0]*(constants[51]-constants[50]):(constants[2] == 1.0)?constants[54]+computedConstants[0]*(constants[55]-constants[54]):constants[52]+computedConstants[0]*(constants[53]-constants[52]); + computedConstants[62] = (constants[2] == 0.0)?constants[63]+computedConstants[0]*(constants[64]-constants[63]):(constants[2] == 1.0)?constants[67]+computedConstants[0]*(constants[68]-constants[67]):constants[65]+computedConstants[0]*(constants[66]-constants[65]); + computedConstants[72] = (constants[2] == 0.0)?constants[73]+computedConstants[0]*(constants[74]-constants[73]):(constants[2] == 1.0)?constants[77]+computedConstants[0]*(constants[78]-constants[77]):constants[75]+computedConstants[0]*(constants[76]-constants[75]); + computedConstants[8] = computedConstants[72]*constants[60]/(constants[60]+0.0004); + computedConstants[32] = constants[22]*constants[23]/constants[24]*log(constants[59]/constants[56]); + computedConstants[40] = constants[22]*constants[23]/constants[24]*log(constants[69]/constants[79]); + computedConstants[48] = constants[22]*constants[23]/(2.0*constants[24])*log(constants[58]/constants[60]); + computedConstants[80] = (constants[2] == 0.0)?constants[22]*constants[23]/constants[24]*log((constants[69]+0.12*constants[59])/(constants[79]+0.12*constants[56])):constants[22]*constants[23]/constants[24]*log((constants[69]+0.03*constants[59])/(constants[79]+0.03*constants[56])); + computedConstants[81] = (constants[2] == 0.0)?constants[82]+computedConstants[0]*(constants[83]-constants[82]):(constants[2] == 1.0)?constants[86]+computedConstants[0]*(constants[87]-constants[86]):constants[84]+computedConstants[0]*(constants[85]-constants[84]); + computedConstants[96] = (constants[2] == 0.0)?constants[97]+computedConstants[0]*(constants[98]-constants[97]):(constants[2] == 1.0)?constants[101]+computedConstants[0]*(constants[102]-constants[101]):constants[99]+computedConstants[0]*(constants[100]-constants[99]); + computedConstants[112] = (constants[2] == 0.0)?constants[113]+computedConstants[0]*(constants[114]-constants[113]):(constants[2] == 1.0)?constants[117]+computedConstants[0]*(constants[118]-constants[117]):constants[115]+computedConstants[0]*(constants[116]-constants[115]); + computedConstants[128] = (constants[2] == 0.0)?constants[129]+computedConstants[0]*(constants[130]-constants[129]):(constants[2] == 1.0)?constants[133]+computedConstants[0]*(constants[134]-constants[133]):constants[131]+computedConstants[0]*(constants[132]-constants[131]); + computedConstants[135] = (constants[2] == 0.0)?constants[136]+computedConstants[0]*(constants[137]-constants[136]):(constants[2] == 1.0)?constants[140]+computedConstants[0]*(constants[141]-constants[140]):constants[138]+computedConstants[0]*(constants[139]-constants[138]); + computedConstants[146] = (constants[2] == 0.0)?constants[147]+computedConstants[0]*(constants[148]-constants[147]):(constants[2] == 1.0)?constants[151]+computedConstants[0]*(constants[152]-constants[151]):constants[149]+computedConstants[0]*(constants[150]-constants[149]); + computedConstants[158] = (constants[2] == 0.0)?0.002:(constants[2] == 1.0)?0.002:0.006; + computedConstants[160] = (constants[2] == 0.0)?constants[161]+computedConstants[0]*(constants[162]-constants[161]):(constants[2] == 1.0)?constants[165]+computedConstants[0]*(constants[166]-constants[165]):constants[163]+computedConstants[0]*(constants[164]-constants[163]); + computedConstants[169] = (constants[2] == 0.0)?constants[170]+computedConstants[0]*(constants[171]-constants[170]):(constants[2] == 1.0)?constants[174]+computedConstants[0]*(constants[175]-constants[174]):constants[172]+computedConstants[0]*(constants[173]-constants[172]); + computedConstants[176] = (constants[2] == 0.0)?constants[177]+computedConstants[0]*(constants[178]-constants[177]):(constants[2] == 1.0)?constants[181]+computedConstants[0]*(constants[182]-constants[181]):constants[179]+computedConstants[0]*(constants[180]-constants[179]); } void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { - variables[9] = variables[62]*pow(variables[56]/(variables[71]+variables[56]), 3.0)*pow(variables[69]/(variables[70]+variables[69]), 2.0)*1.6/(1.5+exp(-(states[0]+60.0)/40.0)); - variables[10] = (variables[2] == 0.0)?variables[49]*(pow(variables[56], 3.0)*variables[58]*exp(0.03743*states[0]*variables[57])-pow(variables[59], 3.0)*variables[60]*exp(0.0374*states[0]*(variables[57]-1.0)))/(1.0+variables[61]*(variables[60]*pow(variables[59], 3.0)+variables[58]*pow(variables[56], 3.0))):variables[49]*(pow(variables[56], 3.0)*variables[58]*exp(0.03743*states[0]*variables[57])-pow(variables[59], 3.0)*variables[60]*exp(0.03743*states[0]*(variables[57]-1.0)))/(1.0+variables[61]*(variables[60]*pow(variables[59], 3.0)+variables[58]*pow(variables[56], 3.0))); - variables[14] = (variables[2] != 2.0)?variables[176]*states[14]*(states[0]-variables[40]):variables[176]*states[14]*(states[0]+102.0); - variables[15] = (variables[2] != 2.0)?variables[169]*states[14]*(states[0]-variables[32]):variables[169]*states[14]*(states[0]-77.6); - variables[16] = variables[160]*pow(states[13], 2.0)*(states[0]-variables[80]); - variables[18] = variables[135]*states[8]*(states[0]-variables[40]); - variables[19] = variables[128]*states[9]*states[8]*(states[0]-variables[40]); - variables[20] = variables[112]*states[7]*states[6]*(states[0]-variables[119]); - variables[21] = variables[96]*(states[4]*states[5]+0.006/(1.0+exp(-(states[0]+14.1)/6.0)))*(states[0]-variables[103]); - variables[91] = (variables[2] == 0.0)?0.0952*exp(-0.063*(states[0]+34.4))/(1.0+1.66*exp(-0.225*(states[0]+63.7)))+0.0869:0.09518*exp(-0.06306*(states[0]+34.4))/(1.0+1.662*exp(-0.2251*(states[0]+63.7)))+0.08693; - variables[88] = (1.0-variables[91])*states[2]+variables[91]*states[3]; - variables[7] = variables[81]*pow(states[1], 3.0)*variables[88]*variables[59]*pow(variables[24], 2.0)/(variables[22]*variables[23])*(exp((states[0]-variables[32])*variables[24]/(variables[22]*variables[23]))-1.0)/(exp(states[0]*variables[24]/(variables[22]*variables[23]))-1.0)*states[0]; - variables[11] = variables[33]*(states[0]-variables[40]); - variables[12] = variables[41]*(states[0]-variables[48]); - variables[13] = variables[25]*(states[0]-variables[32]); - variables[153] = 0.6*states[11]+0.4*states[12]; - variables[17] = variables[146]*variables[153]*states[10]*(states[0]-variables[40]); - rates[0] = -1.0/variables[4]*(variables[7]+variables[21]+variables[20]+variables[19]+variables[18]+variables[17]+variables[16]+variables[15]+variables[14]+variables[13]+variables[12]+variables[11]+variables[10]+variables[9]+variables[8]); - variables[89] = (variables[2] == 0.0)?pow(1.0/(1.0+exp(-states[0]/5.46)), 1.0/3.0):pow(1.0/(1.0+exp(-(states[0]+30.32)/5.46)), 1.0/3.0); - variables[90] = (variables[2] == 0.0)?0.0006247/(0.832*exp(-0.335*(states[0]+56.7))+0.627*exp(0.082*(states[0]+65.01)))+4.0e-5:0.0006247/(0.8322166*exp(-0.33566*(states[0]+56.7062))+0.6274*exp(0.0823*(states[0]+65.0131)))+4.569e-5; - rates[1] = (variables[89]-states[1])/variables[90]; - variables[92] = 1.0/(1.0+exp((states[0]+66.1)/6.4)); - variables[93] = 3.717e-6*exp(-0.2815*(states[0]+17.11))/(1.0+0.003732*exp(-0.3426*(states[0]+37.76)))+0.0005977; - rates[2] = (variables[92]-states[2])/variables[93]; - variables[94] = variables[92]; - variables[95] = 3.186e-8*exp(-0.6219*(states[0]+18.8))/(1.0+7.189e-5*exp(-0.6683*(states[0]+34.07)))+0.003556; - rates[3] = (variables[94]-states[3])/variables[95]; - variables[104] = (variables[2] == 0.0)?1.0/(1.0+exp(-(states[0]+23.1)/6.0)):(variables[2] == 1.0)?1.0/(1.0+exp(-(states[0]+22.3+0.8*variables[0])/6.0)):1.0/(1.0+exp(-(states[0]+22.2)/6.0)); - variables[106] = (variables[2] == 0.0)?-28.38*(states[0]+35.0)/(exp(-(states[0]+35.0)/2.5)-1.0)-84.9*states[0]/(exp(-0.208*states[0])-1.0):(variables[2] == 1.0)?-28.39*(states[0]+35.0)/(exp(-(states[0]+35.0)/2.5)-1.0)-84.9*states[0]/(exp(-0.208*states[0])-1.0):-28.4*(states[0]+35.0)/(exp(-(states[0]+35.0)/2.5)-1.0)-84.9*states[0]/(exp(-0.208*states[0])-1.0); - variables[107] = (variables[2] == 1.0)?11.43*(states[0]-5.0)/(exp(0.4*(states[0]-5.0))-1.0):11.42*(states[0]-5.0)/(exp(0.4*(states[0]-5.0))-1.0); - variables[105] = 2.0/(variables[106]+variables[107]); - rates[5] = (variables[104]-states[5])/variables[105]; - variables[108] = 1.0/(1.0+exp((states[0]+45.0)/5.0)); - variables[110] = (variables[2] == 1.0)?3.75*(states[0]+28.0)/(exp((states[0]+28.0)/4.0)-1.0):3.12*(states[0]+28.0)/(exp((states[0]+28.0)/4.0)-1.0); - variables[111] = (variables[2] == 1.0)?30.0/(1.0+exp(-(states[0]+28.0)/4.0)):25.0/(1.0+exp(-(states[0]+28.0)/4.0)); - variables[109] = (variables[2] == 1.0)?(1.2-0.2*variables[0])/(variables[110]+variables[111]):1.0/(variables[110]+variables[111]); - rates[4] = (variables[108]-states[4])/variables[109]; - variables[120] = 1.0/(1.0+exp(-(states[0]+37.0)/6.8)); - variables[122] = 1068.0*exp((states[0]+26.3)/30.0); - variables[123] = 1068.0*exp(-(states[0]+26.3)/30.0); - variables[121] = 1.0/(variables[122]+variables[123]); - rates[7] = (variables[120]-states[7])/variables[121]; - variables[124] = 1.0/(1.0+exp((states[0]+71.0)/9.0)); - variables[126] = (variables[2] == 1.0)?15.3*exp(-(states[0]+71.0+0.7*variables[0])/83.3):15.3*exp(-(states[0]+71.7)/83.3); - variables[127] = (variables[2] == 1.0)?15.0*exp((states[0]+71.0)/15.38):15.0*exp((states[0]+71.7)/15.38); - variables[125] = 1.0/(variables[126]+variables[127]); - rates[6] = (variables[124]-states[6])/variables[125]; - variables[142] = 1.0/(1.0+exp((states[0]+59.37)/13.1)); - variables[143] = (variables[2] == 0.0)?0.0101+0.06517/(0.57*exp(-0.08*(states[0]+49.0)))+2.4e-5*exp(0.1*(states[0]+50.93)):(variables[2] == 1.0)?0.001/3.0*(30.31+195.5/(0.5686*exp(-0.08161*(states[0]+39.0+10.0*variables[0]))+0.7174*exp((0.2719-0.1719*variables[0])*1.0*(states[0]+40.93+10.0*variables[0])))):0.0101+0.06517/(0.5686*exp(-0.08161*(states[0]+39.0))+0.7174*exp(0.2719*(states[0]+40.93))); - rates[9] = (variables[142]-states[9])/variables[143]; - variables[144] = 1.0/(1.0+exp(-(states[0]-10.93)/19.7)); - variables[145] = (variables[2] == 0.0)?0.001*(2.98+15.59/(1.037*exp(0.09*(states[0]+30.61))+0.369*exp(-0.12*(states[0]+23.84)))):(variables[2] == 1.0)?0.0025*(1.191+7.838/(1.037*exp(0.09012*(states[0]+30.61))+0.369*exp(-0.119*(states[0]+23.84)))):0.001*(2.98+19.59/(1.037*exp(0.09012*(states[0]+30.61))+0.369*exp(-0.119*(states[0]+23.84)))); - rates[8] = (variables[144]-states[8])/variables[145]; - variables[154] = (variables[2] != 2.0)?1.0/(1.0+exp(-(states[0]+14.2)/10.6)):1.0/(1.0+exp(-(states[0]+13.2)/10.6)); - variables[155] = (variables[2] != 2.0)?1.0/(37.2*exp((states[0]-9.0)/15.9)+0.96*exp(-(states[0]-9.0)/22.5)):1.0/(37.2*exp((states[0]-10.0)/15.9)+0.96*exp(-(states[0]-10.0)/22.5)); - rates[11] = (variables[154]-states[11])/variables[155]; - variables[156] = variables[154]; - variables[157] = (variables[2] != 2.0)?1.0/(4.2*exp((states[0]-9.0)/17.0)+0.15*exp(-(states[0]-9.0)/21.6)):1.0/(4.2*exp((states[0]-10.0)/17.0)+0.15*exp(-(states[0]-10.0)/21.6)); - rates[12] = (variables[156]-states[12])/variables[157]; - variables[159] = 1.0/(1.0+exp((states[0]+18.6)/10.1)); - rates[10] = (variables[159]-states[10])/variables[158]; - variables[167] = 14.0/(1.0+exp(-(states[0]-40.0)/9.0)); - variables[168] = 1.0*exp(-states[0]/45.0); - rates[13] = variables[167]*(1.0-states[13])-variables[168]*states[13]; - variables[183] = (variables[2] == 0.0)?1.0*exp(-(states[0]+78.91)/26.62):1.0*exp(-(states[0]+78.91)/26.63); - variables[184] = 1.0*exp((states[0]+75.13)/21.25); - rates[14] = variables[183]*(1.0-states[14])-variables[184]*states[14]; + algebraic[9] = computedConstants[62]*pow(constants[56]/(constants[71]+constants[56]), 3.0)*pow(constants[69]/(constants[70]+constants[69]), 2.0)*1.6/(1.5+exp(-(states[0]+60.0)/40.0)); + algebraic[10] = (constants[2] == 0.0)?computedConstants[49]*(pow(constants[56], 3.0)*constants[58]*exp(0.03743*states[0]*constants[57])-pow(constants[59], 3.0)*constants[60]*exp(0.0374*states[0]*(constants[57]-1.0)))/(1.0+constants[61]*(constants[60]*pow(constants[59], 3.0)+constants[58]*pow(constants[56], 3.0))):computedConstants[49]*(pow(constants[56], 3.0)*constants[58]*exp(0.03743*states[0]*constants[57])-pow(constants[59], 3.0)*constants[60]*exp(0.03743*states[0]*(constants[57]-1.0)))/(1.0+constants[61]*(constants[60]*pow(constants[59], 3.0)+constants[58]*pow(constants[56], 3.0))); + algebraic[14] = (constants[2] != 2.0)?computedConstants[176]*states[14]*(states[0]-computedConstants[40]):computedConstants[176]*states[14]*(states[0]+102.0); + algebraic[15] = (constants[2] != 2.0)?computedConstants[169]*states[14]*(states[0]-computedConstants[32]):computedConstants[169]*states[14]*(states[0]-77.6); + algebraic[16] = computedConstants[160]*pow(states[13], 2.0)*(states[0]-computedConstants[80]); + algebraic[18] = computedConstants[135]*states[8]*(states[0]-computedConstants[40]); + algebraic[19] = computedConstants[128]*states[9]*states[8]*(states[0]-computedConstants[40]); + algebraic[20] = computedConstants[112]*states[7]*states[6]*(states[0]-constants[119]); + algebraic[21] = computedConstants[96]*(states[4]*states[5]+0.006/(1.0+exp(-(states[0]+14.1)/6.0)))*(states[0]-constants[103]); + algebraic[91] = (constants[2] == 0.0)?0.0952*exp(-0.063*(states[0]+34.4))/(1.0+1.66*exp(-0.225*(states[0]+63.7)))+0.0869:0.09518*exp(-0.06306*(states[0]+34.4))/(1.0+1.662*exp(-0.2251*(states[0]+63.7)))+0.08693; + algebraic[88] = (1.0-algebraic[91])*states[2]+algebraic[91]*states[3]; + algebraic[7] = computedConstants[81]*pow(states[1], 3.0)*algebraic[88]*constants[59]*pow(constants[24], 2.0)/(constants[22]*constants[23])*(exp((states[0]-computedConstants[32])*constants[24]/(constants[22]*constants[23]))-1.0)/(exp(states[0]*constants[24]/(constants[22]*constants[23]))-1.0)*states[0]; + algebraic[11] = computedConstants[33]*(states[0]-computedConstants[40]); + algebraic[12] = computedConstants[41]*(states[0]-computedConstants[48]); + algebraic[13] = computedConstants[25]*(states[0]-computedConstants[32]); + algebraic[153] = 0.6*states[11]+0.4*states[12]; + algebraic[17] = computedConstants[146]*algebraic[153]*states[10]*(states[0]-computedConstants[40]); + rates[0] = -1.0/computedConstants[4]*(algebraic[7]+algebraic[21]+algebraic[20]+algebraic[19]+algebraic[18]+algebraic[17]+algebraic[16]+algebraic[15]+algebraic[14]+algebraic[13]+algebraic[12]+algebraic[11]+algebraic[10]+algebraic[9]+computedConstants[8]); + algebraic[89] = (constants[2] == 0.0)?pow(1.0/(1.0+exp(-states[0]/5.46)), 1.0/3.0):pow(1.0/(1.0+exp(-(states[0]+30.32)/5.46)), 1.0/3.0); + algebraic[90] = (constants[2] == 0.0)?0.0006247/(0.832*exp(-0.335*(states[0]+56.7))+0.627*exp(0.082*(states[0]+65.01)))+4.0e-5:0.0006247/(0.8322166*exp(-0.33566*(states[0]+56.7062))+0.6274*exp(0.0823*(states[0]+65.0131)))+4.569e-5; + rates[1] = (algebraic[89]-states[1])/algebraic[90]; + algebraic[92] = 1.0/(1.0+exp((states[0]+66.1)/6.4)); + algebraic[93] = 3.717e-6*exp(-0.2815*(states[0]+17.11))/(1.0+0.003732*exp(-0.3426*(states[0]+37.76)))+0.0005977; + rates[2] = (algebraic[92]-states[2])/algebraic[93]; + algebraic[94] = algebraic[92]; + algebraic[95] = 3.186e-8*exp(-0.6219*(states[0]+18.8))/(1.0+7.189e-5*exp(-0.6683*(states[0]+34.07)))+0.003556; + rates[3] = (algebraic[94]-states[3])/algebraic[95]; + algebraic[104] = (constants[2] == 0.0)?1.0/(1.0+exp(-(states[0]+23.1)/6.0)):(constants[2] == 1.0)?1.0/(1.0+exp(-(states[0]+22.3+0.8*computedConstants[0])/6.0)):1.0/(1.0+exp(-(states[0]+22.2)/6.0)); + algebraic[106] = (constants[2] == 0.0)?-28.38*(states[0]+35.0)/(exp(-(states[0]+35.0)/2.5)-1.0)-84.9*states[0]/(exp(-0.208*states[0])-1.0):(constants[2] == 1.0)?-28.39*(states[0]+35.0)/(exp(-(states[0]+35.0)/2.5)-1.0)-84.9*states[0]/(exp(-0.208*states[0])-1.0):-28.4*(states[0]+35.0)/(exp(-(states[0]+35.0)/2.5)-1.0)-84.9*states[0]/(exp(-0.208*states[0])-1.0); + algebraic[107] = (constants[2] == 1.0)?11.43*(states[0]-5.0)/(exp(0.4*(states[0]-5.0))-1.0):11.42*(states[0]-5.0)/(exp(0.4*(states[0]-5.0))-1.0); + algebraic[105] = 2.0/(algebraic[106]+algebraic[107]); + rates[5] = (algebraic[104]-states[5])/algebraic[105]; + algebraic[108] = 1.0/(1.0+exp((states[0]+45.0)/5.0)); + algebraic[110] = (constants[2] == 1.0)?3.75*(states[0]+28.0)/(exp((states[0]+28.0)/4.0)-1.0):3.12*(states[0]+28.0)/(exp((states[0]+28.0)/4.0)-1.0); + algebraic[111] = (constants[2] == 1.0)?30.0/(1.0+exp(-(states[0]+28.0)/4.0)):25.0/(1.0+exp(-(states[0]+28.0)/4.0)); + algebraic[109] = (constants[2] == 1.0)?(1.2-0.2*computedConstants[0])/(algebraic[110]+algebraic[111]):1.0/(algebraic[110]+algebraic[111]); + rates[4] = (algebraic[108]-states[4])/algebraic[109]; + algebraic[120] = 1.0/(1.0+exp(-(states[0]+37.0)/6.8)); + algebraic[122] = 1068.0*exp((states[0]+26.3)/30.0); + algebraic[123] = 1068.0*exp(-(states[0]+26.3)/30.0); + algebraic[121] = 1.0/(algebraic[122]+algebraic[123]); + rates[7] = (algebraic[120]-states[7])/algebraic[121]; + algebraic[124] = 1.0/(1.0+exp((states[0]+71.0)/9.0)); + algebraic[126] = (constants[2] == 1.0)?15.3*exp(-(states[0]+71.0+0.7*computedConstants[0])/83.3):15.3*exp(-(states[0]+71.7)/83.3); + algebraic[127] = (constants[2] == 1.0)?15.0*exp((states[0]+71.0)/15.38):15.0*exp((states[0]+71.7)/15.38); + algebraic[125] = 1.0/(algebraic[126]+algebraic[127]); + rates[6] = (algebraic[124]-states[6])/algebraic[125]; + algebraic[142] = 1.0/(1.0+exp((states[0]+59.37)/13.1)); + algebraic[143] = (constants[2] == 0.0)?0.0101+0.06517/(0.57*exp(-0.08*(states[0]+49.0)))+2.4e-5*exp(0.1*(states[0]+50.93)):(constants[2] == 1.0)?0.001/3.0*(30.31+195.5/(0.5686*exp(-0.08161*(states[0]+39.0+10.0*computedConstants[0]))+0.7174*exp((0.2719-0.1719*computedConstants[0])*1.0*(states[0]+40.93+10.0*computedConstants[0])))):0.0101+0.06517/(0.5686*exp(-0.08161*(states[0]+39.0))+0.7174*exp(0.2719*(states[0]+40.93))); + rates[9] = (algebraic[142]-states[9])/algebraic[143]; + algebraic[144] = 1.0/(1.0+exp(-(states[0]-10.93)/19.7)); + algebraic[145] = (constants[2] == 0.0)?0.001*(2.98+15.59/(1.037*exp(0.09*(states[0]+30.61))+0.369*exp(-0.12*(states[0]+23.84)))):(constants[2] == 1.0)?0.0025*(1.191+7.838/(1.037*exp(0.09012*(states[0]+30.61))+0.369*exp(-0.119*(states[0]+23.84)))):0.001*(2.98+19.59/(1.037*exp(0.09012*(states[0]+30.61))+0.369*exp(-0.119*(states[0]+23.84)))); + rates[8] = (algebraic[144]-states[8])/algebraic[145]; + algebraic[154] = (constants[2] != 2.0)?1.0/(1.0+exp(-(states[0]+14.2)/10.6)):1.0/(1.0+exp(-(states[0]+13.2)/10.6)); + algebraic[155] = (constants[2] != 2.0)?1.0/(37.2*exp((states[0]-9.0)/15.9)+0.96*exp(-(states[0]-9.0)/22.5)):1.0/(37.2*exp((states[0]-10.0)/15.9)+0.96*exp(-(states[0]-10.0)/22.5)); + rates[11] = (algebraic[154]-states[11])/algebraic[155]; + algebraic[156] = algebraic[154]; + algebraic[157] = (constants[2] != 2.0)?1.0/(4.2*exp((states[0]-9.0)/17.0)+0.15*exp(-(states[0]-9.0)/21.6)):1.0/(4.2*exp((states[0]-10.0)/17.0)+0.15*exp(-(states[0]-10.0)/21.6)); + rates[12] = (algebraic[156]-states[12])/algebraic[157]; + algebraic[159] = 1.0/(1.0+exp((states[0]+18.6)/10.1)); + rates[10] = (algebraic[159]-states[10])/computedConstants[158]; + algebraic[167] = 14.0/(1.0+exp(-(states[0]-40.0)/9.0)); + algebraic[168] = 1.0*exp(-states[0]/45.0); + rates[13] = algebraic[167]*(1.0-states[13])-algebraic[168]*states[13]; + algebraic[183] = (constants[2] == 0.0)?1.0*exp(-(states[0]+78.91)/26.62):1.0*exp(-(states[0]+78.91)/26.63); + algebraic[184] = 1.0*exp((states[0]+75.13)/21.25); + rates[14] = algebraic[183]*(1.0-states[14])-algebraic[184]*states[14]; } void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { - variables[13] = variables[25]*(states[0]-variables[32]); - variables[11] = variables[33]*(states[0]-variables[40]); - variables[12] = variables[41]*(states[0]-variables[48]); - variables[10] = (variables[2] == 0.0)?variables[49]*(pow(variables[56], 3.0)*variables[58]*exp(0.03743*states[0]*variables[57])-pow(variables[59], 3.0)*variables[60]*exp(0.0374*states[0]*(variables[57]-1.0)))/(1.0+variables[61]*(variables[60]*pow(variables[59], 3.0)+variables[58]*pow(variables[56], 3.0))):variables[49]*(pow(variables[56], 3.0)*variables[58]*exp(0.03743*states[0]*variables[57])-pow(variables[59], 3.0)*variables[60]*exp(0.03743*states[0]*(variables[57]-1.0)))/(1.0+variables[61]*(variables[60]*pow(variables[59], 3.0)+variables[58]*pow(variables[56], 3.0))); - variables[9] = variables[62]*pow(variables[56]/(variables[71]+variables[56]), 3.0)*pow(variables[69]/(variables[70]+variables[69]), 2.0)*1.6/(1.5+exp(-(states[0]+60.0)/40.0)); - variables[91] = (variables[2] == 0.0)?0.0952*exp(-0.063*(states[0]+34.4))/(1.0+1.66*exp(-0.225*(states[0]+63.7)))+0.0869:0.09518*exp(-0.06306*(states[0]+34.4))/(1.0+1.662*exp(-0.2251*(states[0]+63.7)))+0.08693; - variables[88] = (1.0-variables[91])*states[2]+variables[91]*states[3]; - variables[7] = variables[81]*pow(states[1], 3.0)*variables[88]*variables[59]*pow(variables[24], 2.0)/(variables[22]*variables[23])*(exp((states[0]-variables[32])*variables[24]/(variables[22]*variables[23]))-1.0)/(exp(states[0]*variables[24]/(variables[22]*variables[23]))-1.0)*states[0]; - variables[89] = (variables[2] == 0.0)?pow(1.0/(1.0+exp(-states[0]/5.46)), 1.0/3.0):pow(1.0/(1.0+exp(-(states[0]+30.32)/5.46)), 1.0/3.0); - variables[90] = (variables[2] == 0.0)?0.0006247/(0.832*exp(-0.335*(states[0]+56.7))+0.627*exp(0.082*(states[0]+65.01)))+4.0e-5:0.0006247/(0.8322166*exp(-0.33566*(states[0]+56.7062))+0.6274*exp(0.0823*(states[0]+65.0131)))+4.569e-5; - variables[92] = 1.0/(1.0+exp((states[0]+66.1)/6.4)); - variables[94] = variables[92]; - variables[93] = 3.717e-6*exp(-0.2815*(states[0]+17.11))/(1.0+0.003732*exp(-0.3426*(states[0]+37.76)))+0.0005977; - variables[95] = 3.186e-8*exp(-0.6219*(states[0]+18.8))/(1.0+7.189e-5*exp(-0.6683*(states[0]+34.07)))+0.003556; - variables[21] = variables[96]*(states[4]*states[5]+0.006/(1.0+exp(-(states[0]+14.1)/6.0)))*(states[0]-variables[103]); - variables[106] = (variables[2] == 0.0)?-28.38*(states[0]+35.0)/(exp(-(states[0]+35.0)/2.5)-1.0)-84.9*states[0]/(exp(-0.208*states[0])-1.0):(variables[2] == 1.0)?-28.39*(states[0]+35.0)/(exp(-(states[0]+35.0)/2.5)-1.0)-84.9*states[0]/(exp(-0.208*states[0])-1.0):-28.4*(states[0]+35.0)/(exp(-(states[0]+35.0)/2.5)-1.0)-84.9*states[0]/(exp(-0.208*states[0])-1.0); - variables[107] = (variables[2] == 1.0)?11.43*(states[0]-5.0)/(exp(0.4*(states[0]-5.0))-1.0):11.42*(states[0]-5.0)/(exp(0.4*(states[0]-5.0))-1.0); - variables[105] = 2.0/(variables[106]+variables[107]); - variables[104] = (variables[2] == 0.0)?1.0/(1.0+exp(-(states[0]+23.1)/6.0)):(variables[2] == 1.0)?1.0/(1.0+exp(-(states[0]+22.3+0.8*variables[0])/6.0)):1.0/(1.0+exp(-(states[0]+22.2)/6.0)); - variables[110] = (variables[2] == 1.0)?3.75*(states[0]+28.0)/(exp((states[0]+28.0)/4.0)-1.0):3.12*(states[0]+28.0)/(exp((states[0]+28.0)/4.0)-1.0); - variables[111] = (variables[2] == 1.0)?30.0/(1.0+exp(-(states[0]+28.0)/4.0)):25.0/(1.0+exp(-(states[0]+28.0)/4.0)); - variables[109] = (variables[2] == 1.0)?(1.2-0.2*variables[0])/(variables[110]+variables[111]):1.0/(variables[110]+variables[111]); - variables[108] = 1.0/(1.0+exp((states[0]+45.0)/5.0)); - variables[20] = variables[112]*states[7]*states[6]*(states[0]-variables[119]); - variables[122] = 1068.0*exp((states[0]+26.3)/30.0); - variables[123] = 1068.0*exp(-(states[0]+26.3)/30.0); - variables[121] = 1.0/(variables[122]+variables[123]); - variables[120] = 1.0/(1.0+exp(-(states[0]+37.0)/6.8)); - variables[126] = (variables[2] == 1.0)?15.3*exp(-(states[0]+71.0+0.7*variables[0])/83.3):15.3*exp(-(states[0]+71.7)/83.3); - variables[127] = (variables[2] == 1.0)?15.0*exp((states[0]+71.0)/15.38):15.0*exp((states[0]+71.7)/15.38); - variables[125] = 1.0/(variables[126]+variables[127]); - variables[124] = 1.0/(1.0+exp((states[0]+71.0)/9.0)); - variables[19] = variables[128]*states[9]*states[8]*(states[0]-variables[40]); - variables[18] = variables[135]*states[8]*(states[0]-variables[40]); - variables[142] = 1.0/(1.0+exp((states[0]+59.37)/13.1)); - variables[143] = (variables[2] == 0.0)?0.0101+0.06517/(0.57*exp(-0.08*(states[0]+49.0)))+2.4e-5*exp(0.1*(states[0]+50.93)):(variables[2] == 1.0)?0.001/3.0*(30.31+195.5/(0.5686*exp(-0.08161*(states[0]+39.0+10.0*variables[0]))+0.7174*exp((0.2719-0.1719*variables[0])*1.0*(states[0]+40.93+10.0*variables[0])))):0.0101+0.06517/(0.5686*exp(-0.08161*(states[0]+39.0))+0.7174*exp(0.2719*(states[0]+40.93))); - variables[144] = 1.0/(1.0+exp(-(states[0]-10.93)/19.7)); - variables[145] = (variables[2] == 0.0)?0.001*(2.98+15.59/(1.037*exp(0.09*(states[0]+30.61))+0.369*exp(-0.12*(states[0]+23.84)))):(variables[2] == 1.0)?0.0025*(1.191+7.838/(1.037*exp(0.09012*(states[0]+30.61))+0.369*exp(-0.119*(states[0]+23.84)))):0.001*(2.98+19.59/(1.037*exp(0.09012*(states[0]+30.61))+0.369*exp(-0.119*(states[0]+23.84)))); - variables[153] = 0.6*states[11]+0.4*states[12]; - variables[17] = variables[146]*variables[153]*states[10]*(states[0]-variables[40]); - variables[154] = (variables[2] != 2.0)?1.0/(1.0+exp(-(states[0]+14.2)/10.6)):1.0/(1.0+exp(-(states[0]+13.2)/10.6)); - variables[155] = (variables[2] != 2.0)?1.0/(37.2*exp((states[0]-9.0)/15.9)+0.96*exp(-(states[0]-9.0)/22.5)):1.0/(37.2*exp((states[0]-10.0)/15.9)+0.96*exp(-(states[0]-10.0)/22.5)); - variables[156] = variables[154]; - variables[157] = (variables[2] != 2.0)?1.0/(4.2*exp((states[0]-9.0)/17.0)+0.15*exp(-(states[0]-9.0)/21.6)):1.0/(4.2*exp((states[0]-10.0)/17.0)+0.15*exp(-(states[0]-10.0)/21.6)); - variables[159] = 1.0/(1.0+exp((states[0]+18.6)/10.1)); - variables[16] = variables[160]*pow(states[13], 2.0)*(states[0]-variables[80]); - variables[167] = 14.0/(1.0+exp(-(states[0]-40.0)/9.0)); - variables[168] = 1.0*exp(-states[0]/45.0); - variables[15] = (variables[2] != 2.0)?variables[169]*states[14]*(states[0]-variables[32]):variables[169]*states[14]*(states[0]-77.6); - variables[14] = (variables[2] != 2.0)?variables[176]*states[14]*(states[0]-variables[40]):variables[176]*states[14]*(states[0]+102.0); - variables[183] = (variables[2] == 0.0)?1.0*exp(-(states[0]+78.91)/26.62):1.0*exp(-(states[0]+78.91)/26.63); - variables[184] = 1.0*exp((states[0]+75.13)/21.25); + algebraic[13] = computedConstants[25]*(states[0]-computedConstants[32]); + algebraic[11] = computedConstants[33]*(states[0]-computedConstants[40]); + algebraic[12] = computedConstants[41]*(states[0]-computedConstants[48]); + algebraic[10] = (constants[2] == 0.0)?computedConstants[49]*(pow(constants[56], 3.0)*constants[58]*exp(0.03743*states[0]*constants[57])-pow(constants[59], 3.0)*constants[60]*exp(0.0374*states[0]*(constants[57]-1.0)))/(1.0+constants[61]*(constants[60]*pow(constants[59], 3.0)+constants[58]*pow(constants[56], 3.0))):computedConstants[49]*(pow(constants[56], 3.0)*constants[58]*exp(0.03743*states[0]*constants[57])-pow(constants[59], 3.0)*constants[60]*exp(0.03743*states[0]*(constants[57]-1.0)))/(1.0+constants[61]*(constants[60]*pow(constants[59], 3.0)+constants[58]*pow(constants[56], 3.0))); + algebraic[9] = computedConstants[62]*pow(constants[56]/(constants[71]+constants[56]), 3.0)*pow(constants[69]/(constants[70]+constants[69]), 2.0)*1.6/(1.5+exp(-(states[0]+60.0)/40.0)); + algebraic[91] = (constants[2] == 0.0)?0.0952*exp(-0.063*(states[0]+34.4))/(1.0+1.66*exp(-0.225*(states[0]+63.7)))+0.0869:0.09518*exp(-0.06306*(states[0]+34.4))/(1.0+1.662*exp(-0.2251*(states[0]+63.7)))+0.08693; + algebraic[88] = (1.0-algebraic[91])*states[2]+algebraic[91]*states[3]; + algebraic[7] = computedConstants[81]*pow(states[1], 3.0)*algebraic[88]*constants[59]*pow(constants[24], 2.0)/(constants[22]*constants[23])*(exp((states[0]-computedConstants[32])*constants[24]/(constants[22]*constants[23]))-1.0)/(exp(states[0]*constants[24]/(constants[22]*constants[23]))-1.0)*states[0]; + algebraic[89] = (constants[2] == 0.0)?pow(1.0/(1.0+exp(-states[0]/5.46)), 1.0/3.0):pow(1.0/(1.0+exp(-(states[0]+30.32)/5.46)), 1.0/3.0); + algebraic[90] = (constants[2] == 0.0)?0.0006247/(0.832*exp(-0.335*(states[0]+56.7))+0.627*exp(0.082*(states[0]+65.01)))+4.0e-5:0.0006247/(0.8322166*exp(-0.33566*(states[0]+56.7062))+0.6274*exp(0.0823*(states[0]+65.0131)))+4.569e-5; + algebraic[92] = 1.0/(1.0+exp((states[0]+66.1)/6.4)); + algebraic[94] = algebraic[92]; + algebraic[93] = 3.717e-6*exp(-0.2815*(states[0]+17.11))/(1.0+0.003732*exp(-0.3426*(states[0]+37.76)))+0.0005977; + algebraic[95] = 3.186e-8*exp(-0.6219*(states[0]+18.8))/(1.0+7.189e-5*exp(-0.6683*(states[0]+34.07)))+0.003556; + algebraic[21] = computedConstants[96]*(states[4]*states[5]+0.006/(1.0+exp(-(states[0]+14.1)/6.0)))*(states[0]-constants[103]); + algebraic[106] = (constants[2] == 0.0)?-28.38*(states[0]+35.0)/(exp(-(states[0]+35.0)/2.5)-1.0)-84.9*states[0]/(exp(-0.208*states[0])-1.0):(constants[2] == 1.0)?-28.39*(states[0]+35.0)/(exp(-(states[0]+35.0)/2.5)-1.0)-84.9*states[0]/(exp(-0.208*states[0])-1.0):-28.4*(states[0]+35.0)/(exp(-(states[0]+35.0)/2.5)-1.0)-84.9*states[0]/(exp(-0.208*states[0])-1.0); + algebraic[107] = (constants[2] == 1.0)?11.43*(states[0]-5.0)/(exp(0.4*(states[0]-5.0))-1.0):11.42*(states[0]-5.0)/(exp(0.4*(states[0]-5.0))-1.0); + algebraic[105] = 2.0/(algebraic[106]+algebraic[107]); + algebraic[104] = (constants[2] == 0.0)?1.0/(1.0+exp(-(states[0]+23.1)/6.0)):(constants[2] == 1.0)?1.0/(1.0+exp(-(states[0]+22.3+0.8*computedConstants[0])/6.0)):1.0/(1.0+exp(-(states[0]+22.2)/6.0)); + algebraic[110] = (constants[2] == 1.0)?3.75*(states[0]+28.0)/(exp((states[0]+28.0)/4.0)-1.0):3.12*(states[0]+28.0)/(exp((states[0]+28.0)/4.0)-1.0); + algebraic[111] = (constants[2] == 1.0)?30.0/(1.0+exp(-(states[0]+28.0)/4.0)):25.0/(1.0+exp(-(states[0]+28.0)/4.0)); + algebraic[109] = (constants[2] == 1.0)?(1.2-0.2*computedConstants[0])/(algebraic[110]+algebraic[111]):1.0/(algebraic[110]+algebraic[111]); + algebraic[108] = 1.0/(1.0+exp((states[0]+45.0)/5.0)); + algebraic[20] = computedConstants[112]*states[7]*states[6]*(states[0]-constants[119]); + algebraic[122] = 1068.0*exp((states[0]+26.3)/30.0); + algebraic[123] = 1068.0*exp(-(states[0]+26.3)/30.0); + algebraic[121] = 1.0/(algebraic[122]+algebraic[123]); + algebraic[120] = 1.0/(1.0+exp(-(states[0]+37.0)/6.8)); + algebraic[126] = (constants[2] == 1.0)?15.3*exp(-(states[0]+71.0+0.7*computedConstants[0])/83.3):15.3*exp(-(states[0]+71.7)/83.3); + algebraic[127] = (constants[2] == 1.0)?15.0*exp((states[0]+71.0)/15.38):15.0*exp((states[0]+71.7)/15.38); + algebraic[125] = 1.0/(algebraic[126]+algebraic[127]); + algebraic[124] = 1.0/(1.0+exp((states[0]+71.0)/9.0)); + algebraic[19] = computedConstants[128]*states[9]*states[8]*(states[0]-computedConstants[40]); + algebraic[18] = computedConstants[135]*states[8]*(states[0]-computedConstants[40]); + algebraic[142] = 1.0/(1.0+exp((states[0]+59.37)/13.1)); + algebraic[143] = (constants[2] == 0.0)?0.0101+0.06517/(0.57*exp(-0.08*(states[0]+49.0)))+2.4e-5*exp(0.1*(states[0]+50.93)):(constants[2] == 1.0)?0.001/3.0*(30.31+195.5/(0.5686*exp(-0.08161*(states[0]+39.0+10.0*computedConstants[0]))+0.7174*exp((0.2719-0.1719*computedConstants[0])*1.0*(states[0]+40.93+10.0*computedConstants[0])))):0.0101+0.06517/(0.5686*exp(-0.08161*(states[0]+39.0))+0.7174*exp(0.2719*(states[0]+40.93))); + algebraic[144] = 1.0/(1.0+exp(-(states[0]-10.93)/19.7)); + algebraic[145] = (constants[2] == 0.0)?0.001*(2.98+15.59/(1.037*exp(0.09*(states[0]+30.61))+0.369*exp(-0.12*(states[0]+23.84)))):(constants[2] == 1.0)?0.0025*(1.191+7.838/(1.037*exp(0.09012*(states[0]+30.61))+0.369*exp(-0.119*(states[0]+23.84)))):0.001*(2.98+19.59/(1.037*exp(0.09012*(states[0]+30.61))+0.369*exp(-0.119*(states[0]+23.84)))); + algebraic[153] = 0.6*states[11]+0.4*states[12]; + algebraic[17] = computedConstants[146]*algebraic[153]*states[10]*(states[0]-computedConstants[40]); + algebraic[154] = (constants[2] != 2.0)?1.0/(1.0+exp(-(states[0]+14.2)/10.6)):1.0/(1.0+exp(-(states[0]+13.2)/10.6)); + algebraic[155] = (constants[2] != 2.0)?1.0/(37.2*exp((states[0]-9.0)/15.9)+0.96*exp(-(states[0]-9.0)/22.5)):1.0/(37.2*exp((states[0]-10.0)/15.9)+0.96*exp(-(states[0]-10.0)/22.5)); + algebraic[156] = algebraic[154]; + algebraic[157] = (constants[2] != 2.0)?1.0/(4.2*exp((states[0]-9.0)/17.0)+0.15*exp(-(states[0]-9.0)/21.6)):1.0/(4.2*exp((states[0]-10.0)/17.0)+0.15*exp(-(states[0]-10.0)/21.6)); + algebraic[159] = 1.0/(1.0+exp((states[0]+18.6)/10.1)); + algebraic[16] = computedConstants[160]*pow(states[13], 2.0)*(states[0]-computedConstants[80]); + algebraic[167] = 14.0/(1.0+exp(-(states[0]-40.0)/9.0)); + algebraic[168] = 1.0*exp(-states[0]/45.0); + algebraic[15] = (constants[2] != 2.0)?computedConstants[169]*states[14]*(states[0]-computedConstants[32]):computedConstants[169]*states[14]*(states[0]-77.6); + algebraic[14] = (constants[2] != 2.0)?computedConstants[176]*states[14]*(states[0]-computedConstants[40]):computedConstants[176]*states[14]*(states[0]+102.0); + algebraic[183] = (constants[2] == 0.0)?1.0*exp(-(states[0]+78.91)/26.62):1.0*exp(-(states[0]+78.91)/26.63); + algebraic[184] = 1.0*exp((states[0]+75.13)/21.25); } diff --git a/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.py b/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.py index 4a43aaffe1..241a885d14 100644 --- a/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.py +++ b/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.py @@ -247,116 +247,116 @@ def create_variables_array(): def initialise_variables(states, rates, constants): - variables[1] = 0.0 - variables[2] = 1.0 - variables[3] = 1.0309347 - variables[5] = 2.0e-5 - variables[6] = 6.5e-5 - variables[22] = 8314.0 - variables[23] = 310.0 - variables[24] = 96845.0 - variables[26] = 5.8e-5 - variables[27] = 0.000189 - variables[28] = 5.8e-5 - variables[29] = 0.000189 - variables[30] = 5.81818e-5 - variables[31] = 0.0001888 - variables[34] = 2.52e-5 - variables[35] = 8.19e-5 - variables[36] = 2.52e-5 - variables[37] = 8.19e-5 - variables[38] = 2.523636e-5 - variables[39] = 8.1892e-5 - variables[42] = 1.32e-5 - variables[43] = 4.3e-5 - variables[44] = 1.323e-5 - variables[45] = 4.29e-5 - variables[46] = 1.3236e-5 - variables[47] = 4.2952e-5 - variables[50] = 2.7e-6 - variables[51] = 8.8e-6 - variables[52] = 2.8e-6 - variables[53] = 8.8e-6 - variables[54] = 2.7229e-6 - variables[55] = 8.83584e-6 - variables[56] = 8.0 - variables[57] = 0.5 - variables[58] = 2.0 - variables[59] = 140.0 - variables[60] = 0.0001 - variables[61] = 0.0001 - variables[63] = 0.0478 - variables[64] = 0.16 - variables[65] = 0.0478 - variables[66] = 0.16 - variables[67] = 0.04782545 - variables[68] = 0.1551936 - variables[69] = 5.4 - variables[70] = 0.621 - variables[71] = 5.64 - variables[73] = 0.0 - variables[74] = 0.0 - variables[75] = 0.0042 - variables[76] = 0.03339 - variables[77] = 0.0 - variables[78] = 0.0 - variables[79] = 140.0 - variables[82] = 0.0 - variables[83] = 1.2e-6 - variables[84] = 0.0 - variables[85] = 3.7e-7 - variables[86] = 0.0 - variables[87] = 1.204e-6 - variables[97] = 0.0058 - variables[98] = 0.0659 - variables[99] = 0.0082 - variables[100] = 0.0659 - variables[101] = 0.0057938 - variables[102] = 0.06588648 - variables[103] = 46.4 - variables[113] = 0.0043 - variables[114] = 0.0139 - variables[115] = 0.0021 - variables[116] = 0.00694 - variables[117] = 0.00427806 - variables[118] = 0.0138823 - variables[119] = 45.0 - variables[129] = 0.00491 - variables[130] = 0.03649 - variables[131] = 0.004905 - variables[132] = 0.0365 - variables[133] = 0.004905 - variables[134] = 0.036495 - variables[136] = 6.65e-5 - variables[137] = 0.0114 - variables[138] = 0.000266 - variables[139] = 0.0114 - variables[140] = 6.645504e-5 - variables[141] = 0.01138376 - variables[147] = 0.000797 - variables[148] = 0.016 - variables[149] = 0.000738 - variables[150] = 0.0208 - variables[151] = 0.00079704 - variables[152] = 0.016 - variables[161] = 0.000518 - variables[162] = 0.0104 - variables[163] = 0.000345 - variables[164] = 0.0104 - variables[165] = 0.0003445 - variables[166] = 0.0104 - variables[170] = 0.000548 - variables[171] = 0.0069 - variables[172] = 0.000437 - variables[173] = 0.0055 - variables[174] = 0.0005465 - variables[175] = 0.006875 - variables[177] = 0.000548 - variables[178] = 0.0069 - variables[179] = 0.000437 - variables[180] = 0.0055 - variables[181] = 0.0005465 - variables[182] = 0.006875 + constants[1] = 0.0 + constants[2] = 1.0 + constants[3] = 1.0309347 + constants[5] = 2.0e-5 + constants[6] = 6.5e-5 + constants[22] = 8314.0 + constants[23] = 310.0 + constants[24] = 96845.0 + constants[26] = 5.8e-5 + constants[27] = 0.000189 + constants[28] = 5.8e-5 + constants[29] = 0.000189 + constants[30] = 5.81818e-5 + constants[31] = 0.0001888 + constants[34] = 2.52e-5 + constants[35] = 8.19e-5 + constants[36] = 2.52e-5 + constants[37] = 8.19e-5 + constants[38] = 2.523636e-5 + constants[39] = 8.1892e-5 + constants[42] = 1.32e-5 + constants[43] = 4.3e-5 + constants[44] = 1.323e-5 + constants[45] = 4.29e-5 + constants[46] = 1.3236e-5 + constants[47] = 4.2952e-5 + constants[50] = 2.7e-6 + constants[51] = 8.8e-6 + constants[52] = 2.8e-6 + constants[53] = 8.8e-6 + constants[54] = 2.7229e-6 + constants[55] = 8.83584e-6 + constants[56] = 8.0 + constants[57] = 0.5 + constants[58] = 2.0 + constants[59] = 140.0 + constants[60] = 0.0001 + constants[61] = 0.0001 + constants[63] = 0.0478 + constants[64] = 0.16 + constants[65] = 0.0478 + constants[66] = 0.16 + constants[67] = 0.04782545 + constants[68] = 0.1551936 + constants[69] = 5.4 + constants[70] = 0.621 + constants[71] = 5.64 + constants[73] = 0.0 + constants[74] = 0.0 + constants[75] = 0.0042 + constants[76] = 0.03339 + constants[77] = 0.0 + constants[78] = 0.0 + constants[79] = 140.0 + constants[82] = 0.0 + constants[83] = 1.2e-6 + constants[84] = 0.0 + constants[85] = 3.7e-7 + constants[86] = 0.0 + constants[87] = 1.204e-6 + constants[97] = 0.0058 + constants[98] = 0.0659 + constants[99] = 0.0082 + constants[100] = 0.0659 + constants[101] = 0.0057938 + constants[102] = 0.06588648 + constants[103] = 46.4 + constants[113] = 0.0043 + constants[114] = 0.0139 + constants[115] = 0.0021 + constants[116] = 0.00694 + constants[117] = 0.00427806 + constants[118] = 0.0138823 + constants[119] = 45.0 + constants[129] = 0.00491 + constants[130] = 0.03649 + constants[131] = 0.004905 + constants[132] = 0.0365 + constants[133] = 0.004905 + constants[134] = 0.036495 + constants[136] = 6.65e-5 + constants[137] = 0.0114 + constants[138] = 0.000266 + constants[139] = 0.0114 + constants[140] = 6.645504e-5 + constants[141] = 0.01138376 + constants[147] = 0.000797 + constants[148] = 0.016 + constants[149] = 0.000738 + constants[150] = 0.0208 + constants[151] = 0.00079704 + constants[152] = 0.016 + constants[161] = 0.000518 + constants[162] = 0.0104 + constants[163] = 0.000345 + constants[164] = 0.0104 + constants[165] = 0.0003445 + constants[166] = 0.0104 + constants[170] = 0.000548 + constants[171] = 0.0069 + constants[172] = 0.000437 + constants[173] = 0.0055 + constants[174] = 0.0005465 + constants[175] = 0.006875 + constants[177] = 0.000548 + constants[178] = 0.0069 + constants[179] = 0.000437 + constants[180] = 0.0055 + constants[181] = 0.0005465 + constants[182] = 0.006875 states[0] = -39.013558536 states[1] = 0.092361701692 states[2] = 0.015905380261 @@ -375,151 +375,151 @@ def initialise_variables(states, rates, constants): def compute_computed_constants(constants, computed_constants): - variables[0] = 1.07*(3.0*variables[1]-0.1)/(3.0*(1.0+0.7745*exp(-(3.0*variables[1]-2.05)/0.295))) if eq_func(variables[2], 0.0) else variables[3]*variables[1]/(1.0+0.7745*exp(-(3.0*variables[1]-2.05)/0.295)) if eq_func(variables[2], 1.0) else 1.07*29.0*variables[1]/(30.0*(1.0+0.7745*exp(-(29.0*variables[1]-24.5)/1.95))) - variables[4] = variables[5]+variables[0]*(variables[6]-variables[5]) - variables[25] = variables[26]+variables[0]*(variables[27]-variables[26]) if eq_func(variables[2], 0.0) else variables[30]+variables[0]*(variables[31]-variables[30]) if eq_func(variables[2], 1.0) else variables[28]+variables[0]*(variables[29]-variables[28]) - variables[33] = variables[34]+variables[0]*(variables[35]-variables[34]) if eq_func(variables[2], 0.0) else variables[38]+variables[0]*(variables[39]-variables[38]) if eq_func(variables[2], 1.0) else variables[36]+variables[0]*(variables[37]-variables[36]) - variables[41] = variables[42]+variables[0]*(variables[43]-variables[42]) if eq_func(variables[2], 0.0) else variables[46]+variables[0]*(variables[47]-variables[46]) if eq_func(variables[2], 1.0) else variables[44]+variables[0]*(variables[45]-variables[44]) - variables[49] = variables[50]+variables[0]*(variables[51]-variables[50]) if eq_func(variables[2], 0.0) else variables[54]+variables[0]*(variables[55]-variables[54]) if eq_func(variables[2], 1.0) else variables[52]+variables[0]*(variables[53]-variables[52]) - variables[62] = variables[63]+variables[0]*(variables[64]-variables[63]) if eq_func(variables[2], 0.0) else variables[67]+variables[0]*(variables[68]-variables[67]) if eq_func(variables[2], 1.0) else variables[65]+variables[0]*(variables[66]-variables[65]) - variables[72] = variables[73]+variables[0]*(variables[74]-variables[73]) if eq_func(variables[2], 0.0) else variables[77]+variables[0]*(variables[78]-variables[77]) if eq_func(variables[2], 1.0) else variables[75]+variables[0]*(variables[76]-variables[75]) - variables[8] = variables[72]*variables[60]/(variables[60]+0.0004) - variables[32] = variables[22]*variables[23]/variables[24]*log(variables[59]/variables[56]) - variables[40] = variables[22]*variables[23]/variables[24]*log(variables[69]/variables[79]) - variables[48] = variables[22]*variables[23]/(2.0*variables[24])*log(variables[58]/variables[60]) - variables[80] = variables[22]*variables[23]/variables[24]*log((variables[69]+0.12*variables[59])/(variables[79]+0.12*variables[56])) if eq_func(variables[2], 0.0) else variables[22]*variables[23]/variables[24]*log((variables[69]+0.03*variables[59])/(variables[79]+0.03*variables[56])) - variables[81] = variables[82]+variables[0]*(variables[83]-variables[82]) if eq_func(variables[2], 0.0) else variables[86]+variables[0]*(variables[87]-variables[86]) if eq_func(variables[2], 1.0) else variables[84]+variables[0]*(variables[85]-variables[84]) - variables[96] = variables[97]+variables[0]*(variables[98]-variables[97]) if eq_func(variables[2], 0.0) else variables[101]+variables[0]*(variables[102]-variables[101]) if eq_func(variables[2], 1.0) else variables[99]+variables[0]*(variables[100]-variables[99]) - variables[112] = variables[113]+variables[0]*(variables[114]-variables[113]) if eq_func(variables[2], 0.0) else variables[117]+variables[0]*(variables[118]-variables[117]) if eq_func(variables[2], 1.0) else variables[115]+variables[0]*(variables[116]-variables[115]) - variables[128] = variables[129]+variables[0]*(variables[130]-variables[129]) if eq_func(variables[2], 0.0) else variables[133]+variables[0]*(variables[134]-variables[133]) if eq_func(variables[2], 1.0) else variables[131]+variables[0]*(variables[132]-variables[131]) - variables[135] = variables[136]+variables[0]*(variables[137]-variables[136]) if eq_func(variables[2], 0.0) else variables[140]+variables[0]*(variables[141]-variables[140]) if eq_func(variables[2], 1.0) else variables[138]+variables[0]*(variables[139]-variables[138]) - variables[146] = variables[147]+variables[0]*(variables[148]-variables[147]) if eq_func(variables[2], 0.0) else variables[151]+variables[0]*(variables[152]-variables[151]) if eq_func(variables[2], 1.0) else variables[149]+variables[0]*(variables[150]-variables[149]) - variables[158] = 0.002 if eq_func(variables[2], 0.0) else 0.002 if eq_func(variables[2], 1.0) else 0.006 - variables[160] = variables[161]+variables[0]*(variables[162]-variables[161]) if eq_func(variables[2], 0.0) else variables[165]+variables[0]*(variables[166]-variables[165]) if eq_func(variables[2], 1.0) else variables[163]+variables[0]*(variables[164]-variables[163]) - variables[169] = variables[170]+variables[0]*(variables[171]-variables[170]) if eq_func(variables[2], 0.0) else variables[174]+variables[0]*(variables[175]-variables[174]) if eq_func(variables[2], 1.0) else variables[172]+variables[0]*(variables[173]-variables[172]) - variables[176] = variables[177]+variables[0]*(variables[178]-variables[177]) if eq_func(variables[2], 0.0) else variables[181]+variables[0]*(variables[182]-variables[181]) if eq_func(variables[2], 1.0) else variables[179]+variables[0]*(variables[180]-variables[179]) + computed_constants[0] = 1.07*(3.0*constants[1]-0.1)/(3.0*(1.0+0.7745*exp(-(3.0*constants[1]-2.05)/0.295))) if eq_func(constants[2], 0.0) else constants[3]*constants[1]/(1.0+0.7745*exp(-(3.0*constants[1]-2.05)/0.295)) if eq_func(constants[2], 1.0) else 1.07*29.0*constants[1]/(30.0*(1.0+0.7745*exp(-(29.0*constants[1]-24.5)/1.95))) + computed_constants[4] = constants[5]+computed_constants[0]*(constants[6]-constants[5]) + computed_constants[25] = constants[26]+computed_constants[0]*(constants[27]-constants[26]) if eq_func(constants[2], 0.0) else constants[30]+computed_constants[0]*(constants[31]-constants[30]) if eq_func(constants[2], 1.0) else constants[28]+computed_constants[0]*(constants[29]-constants[28]) + computed_constants[33] = constants[34]+computed_constants[0]*(constants[35]-constants[34]) if eq_func(constants[2], 0.0) else constants[38]+computed_constants[0]*(constants[39]-constants[38]) if eq_func(constants[2], 1.0) else constants[36]+computed_constants[0]*(constants[37]-constants[36]) + computed_constants[41] = constants[42]+computed_constants[0]*(constants[43]-constants[42]) if eq_func(constants[2], 0.0) else constants[46]+computed_constants[0]*(constants[47]-constants[46]) if eq_func(constants[2], 1.0) else constants[44]+computed_constants[0]*(constants[45]-constants[44]) + computed_constants[49] = constants[50]+computed_constants[0]*(constants[51]-constants[50]) if eq_func(constants[2], 0.0) else constants[54]+computed_constants[0]*(constants[55]-constants[54]) if eq_func(constants[2], 1.0) else constants[52]+computed_constants[0]*(constants[53]-constants[52]) + computed_constants[62] = constants[63]+computed_constants[0]*(constants[64]-constants[63]) if eq_func(constants[2], 0.0) else constants[67]+computed_constants[0]*(constants[68]-constants[67]) if eq_func(constants[2], 1.0) else constants[65]+computed_constants[0]*(constants[66]-constants[65]) + computed_constants[72] = constants[73]+computed_constants[0]*(constants[74]-constants[73]) if eq_func(constants[2], 0.0) else constants[77]+computed_constants[0]*(constants[78]-constants[77]) if eq_func(constants[2], 1.0) else constants[75]+computed_constants[0]*(constants[76]-constants[75]) + computed_constants[8] = computed_constants[72]*constants[60]/(constants[60]+0.0004) + computed_constants[32] = constants[22]*constants[23]/constants[24]*log(constants[59]/constants[56]) + computed_constants[40] = constants[22]*constants[23]/constants[24]*log(constants[69]/constants[79]) + computed_constants[48] = constants[22]*constants[23]/(2.0*constants[24])*log(constants[58]/constants[60]) + computed_constants[80] = constants[22]*constants[23]/constants[24]*log((constants[69]+0.12*constants[59])/(constants[79]+0.12*constants[56])) if eq_func(constants[2], 0.0) else constants[22]*constants[23]/constants[24]*log((constants[69]+0.03*constants[59])/(constants[79]+0.03*constants[56])) + computed_constants[81] = constants[82]+computed_constants[0]*(constants[83]-constants[82]) if eq_func(constants[2], 0.0) else constants[86]+computed_constants[0]*(constants[87]-constants[86]) if eq_func(constants[2], 1.0) else constants[84]+computed_constants[0]*(constants[85]-constants[84]) + computed_constants[96] = constants[97]+computed_constants[0]*(constants[98]-constants[97]) if eq_func(constants[2], 0.0) else constants[101]+computed_constants[0]*(constants[102]-constants[101]) if eq_func(constants[2], 1.0) else constants[99]+computed_constants[0]*(constants[100]-constants[99]) + computed_constants[112] = constants[113]+computed_constants[0]*(constants[114]-constants[113]) if eq_func(constants[2], 0.0) else constants[117]+computed_constants[0]*(constants[118]-constants[117]) if eq_func(constants[2], 1.0) else constants[115]+computed_constants[0]*(constants[116]-constants[115]) + computed_constants[128] = constants[129]+computed_constants[0]*(constants[130]-constants[129]) if eq_func(constants[2], 0.0) else constants[133]+computed_constants[0]*(constants[134]-constants[133]) if eq_func(constants[2], 1.0) else constants[131]+computed_constants[0]*(constants[132]-constants[131]) + computed_constants[135] = constants[136]+computed_constants[0]*(constants[137]-constants[136]) if eq_func(constants[2], 0.0) else constants[140]+computed_constants[0]*(constants[141]-constants[140]) if eq_func(constants[2], 1.0) else constants[138]+computed_constants[0]*(constants[139]-constants[138]) + computed_constants[146] = constants[147]+computed_constants[0]*(constants[148]-constants[147]) if eq_func(constants[2], 0.0) else constants[151]+computed_constants[0]*(constants[152]-constants[151]) if eq_func(constants[2], 1.0) else constants[149]+computed_constants[0]*(constants[150]-constants[149]) + computed_constants[158] = 0.002 if eq_func(constants[2], 0.0) else 0.002 if eq_func(constants[2], 1.0) else 0.006 + computed_constants[160] = constants[161]+computed_constants[0]*(constants[162]-constants[161]) if eq_func(constants[2], 0.0) else constants[165]+computed_constants[0]*(constants[166]-constants[165]) if eq_func(constants[2], 1.0) else constants[163]+computed_constants[0]*(constants[164]-constants[163]) + computed_constants[169] = constants[170]+computed_constants[0]*(constants[171]-constants[170]) if eq_func(constants[2], 0.0) else constants[174]+computed_constants[0]*(constants[175]-constants[174]) if eq_func(constants[2], 1.0) else constants[172]+computed_constants[0]*(constants[173]-constants[172]) + computed_constants[176] = constants[177]+computed_constants[0]*(constants[178]-constants[177]) if eq_func(constants[2], 0.0) else constants[181]+computed_constants[0]*(constants[182]-constants[181]) if eq_func(constants[2], 1.0) else constants[179]+computed_constants[0]*(constants[180]-constants[179]) def compute_rates(voi, states, rates, constants, computed_constants, algebraic): - variables[9] = variables[62]*pow(variables[56]/(variables[71]+variables[56]), 3.0)*pow(variables[69]/(variables[70]+variables[69]), 2.0)*1.6/(1.5+exp(-(states[0]+60.0)/40.0)) - variables[10] = variables[49]*(pow(variables[56], 3.0)*variables[58]*exp(0.03743*states[0]*variables[57])-pow(variables[59], 3.0)*variables[60]*exp(0.0374*states[0]*(variables[57]-1.0)))/(1.0+variables[61]*(variables[60]*pow(variables[59], 3.0)+variables[58]*pow(variables[56], 3.0))) if eq_func(variables[2], 0.0) else variables[49]*(pow(variables[56], 3.0)*variables[58]*exp(0.03743*states[0]*variables[57])-pow(variables[59], 3.0)*variables[60]*exp(0.03743*states[0]*(variables[57]-1.0)))/(1.0+variables[61]*(variables[60]*pow(variables[59], 3.0)+variables[58]*pow(variables[56], 3.0))) - variables[14] = variables[176]*states[14]*(states[0]-variables[40]) if neq_func(variables[2], 2.0) else variables[176]*states[14]*(states[0]+102.0) - variables[15] = variables[169]*states[14]*(states[0]-variables[32]) if neq_func(variables[2], 2.0) else variables[169]*states[14]*(states[0]-77.6) - variables[16] = variables[160]*pow(states[13], 2.0)*(states[0]-variables[80]) - variables[18] = variables[135]*states[8]*(states[0]-variables[40]) - variables[19] = variables[128]*states[9]*states[8]*(states[0]-variables[40]) - variables[20] = variables[112]*states[7]*states[6]*(states[0]-variables[119]) - variables[21] = variables[96]*(states[4]*states[5]+0.006/(1.0+exp(-(states[0]+14.1)/6.0)))*(states[0]-variables[103]) - variables[91] = 0.0952*exp(-0.063*(states[0]+34.4))/(1.0+1.66*exp(-0.225*(states[0]+63.7)))+0.0869 if eq_func(variables[2], 0.0) else 0.09518*exp(-0.06306*(states[0]+34.4))/(1.0+1.662*exp(-0.2251*(states[0]+63.7)))+0.08693 - variables[88] = (1.0-variables[91])*states[2]+variables[91]*states[3] - variables[7] = variables[81]*pow(states[1], 3.0)*variables[88]*variables[59]*pow(variables[24], 2.0)/(variables[22]*variables[23])*(exp((states[0]-variables[32])*variables[24]/(variables[22]*variables[23]))-1.0)/(exp(states[0]*variables[24]/(variables[22]*variables[23]))-1.0)*states[0] - variables[11] = variables[33]*(states[0]-variables[40]) - variables[12] = variables[41]*(states[0]-variables[48]) - variables[13] = variables[25]*(states[0]-variables[32]) - variables[153] = 0.6*states[11]+0.4*states[12] - variables[17] = variables[146]*variables[153]*states[10]*(states[0]-variables[40]) - rates[0] = -1.0/variables[4]*(variables[7]+variables[21]+variables[20]+variables[19]+variables[18]+variables[17]+variables[16]+variables[15]+variables[14]+variables[13]+variables[12]+variables[11]+variables[10]+variables[9]+variables[8]) - variables[89] = pow(1.0/(1.0+exp(-states[0]/5.46)), 1.0/3.0) if eq_func(variables[2], 0.0) else pow(1.0/(1.0+exp(-(states[0]+30.32)/5.46)), 1.0/3.0) - variables[90] = 0.0006247/(0.832*exp(-0.335*(states[0]+56.7))+0.627*exp(0.082*(states[0]+65.01)))+4.0e-5 if eq_func(variables[2], 0.0) else 0.0006247/(0.8322166*exp(-0.33566*(states[0]+56.7062))+0.6274*exp(0.0823*(states[0]+65.0131)))+4.569e-5 - rates[1] = (variables[89]-states[1])/variables[90] - variables[92] = 1.0/(1.0+exp((states[0]+66.1)/6.4)) - variables[93] = 3.717e-6*exp(-0.2815*(states[0]+17.11))/(1.0+0.003732*exp(-0.3426*(states[0]+37.76)))+0.0005977 - rates[2] = (variables[92]-states[2])/variables[93] - variables[94] = variables[92] - variables[95] = 3.186e-8*exp(-0.6219*(states[0]+18.8))/(1.0+7.189e-5*exp(-0.6683*(states[0]+34.07)))+0.003556 - rates[3] = (variables[94]-states[3])/variables[95] - variables[104] = 1.0/(1.0+exp(-(states[0]+23.1)/6.0)) if eq_func(variables[2], 0.0) else 1.0/(1.0+exp(-(states[0]+22.3+0.8*variables[0])/6.0)) if eq_func(variables[2], 1.0) else 1.0/(1.0+exp(-(states[0]+22.2)/6.0)) - variables[106] = -28.38*(states[0]+35.0)/(exp(-(states[0]+35.0)/2.5)-1.0)-84.9*states[0]/(exp(-0.208*states[0])-1.0) if eq_func(variables[2], 0.0) else -28.39*(states[0]+35.0)/(exp(-(states[0]+35.0)/2.5)-1.0)-84.9*states[0]/(exp(-0.208*states[0])-1.0) if eq_func(variables[2], 1.0) else -28.4*(states[0]+35.0)/(exp(-(states[0]+35.0)/2.5)-1.0)-84.9*states[0]/(exp(-0.208*states[0])-1.0) - variables[107] = 11.43*(states[0]-5.0)/(exp(0.4*(states[0]-5.0))-1.0) if eq_func(variables[2], 1.0) else 11.42*(states[0]-5.0)/(exp(0.4*(states[0]-5.0))-1.0) - variables[105] = 2.0/(variables[106]+variables[107]) - rates[5] = (variables[104]-states[5])/variables[105] - variables[108] = 1.0/(1.0+exp((states[0]+45.0)/5.0)) - variables[110] = 3.75*(states[0]+28.0)/(exp((states[0]+28.0)/4.0)-1.0) if eq_func(variables[2], 1.0) else 3.12*(states[0]+28.0)/(exp((states[0]+28.0)/4.0)-1.0) - variables[111] = 30.0/(1.0+exp(-(states[0]+28.0)/4.0)) if eq_func(variables[2], 1.0) else 25.0/(1.0+exp(-(states[0]+28.0)/4.0)) - variables[109] = (1.2-0.2*variables[0])/(variables[110]+variables[111]) if eq_func(variables[2], 1.0) else 1.0/(variables[110]+variables[111]) - rates[4] = (variables[108]-states[4])/variables[109] - variables[120] = 1.0/(1.0+exp(-(states[0]+37.0)/6.8)) - variables[122] = 1068.0*exp((states[0]+26.3)/30.0) - variables[123] = 1068.0*exp(-(states[0]+26.3)/30.0) - variables[121] = 1.0/(variables[122]+variables[123]) - rates[7] = (variables[120]-states[7])/variables[121] - variables[124] = 1.0/(1.0+exp((states[0]+71.0)/9.0)) - variables[126] = 15.3*exp(-(states[0]+71.0+0.7*variables[0])/83.3) if eq_func(variables[2], 1.0) else 15.3*exp(-(states[0]+71.7)/83.3) - variables[127] = 15.0*exp((states[0]+71.0)/15.38) if eq_func(variables[2], 1.0) else 15.0*exp((states[0]+71.7)/15.38) - variables[125] = 1.0/(variables[126]+variables[127]) - rates[6] = (variables[124]-states[6])/variables[125] - variables[142] = 1.0/(1.0+exp((states[0]+59.37)/13.1)) - variables[143] = 0.0101+0.06517/(0.57*exp(-0.08*(states[0]+49.0)))+2.4e-5*exp(0.1*(states[0]+50.93)) if eq_func(variables[2], 0.0) else 0.001/3.0*(30.31+195.5/(0.5686*exp(-0.08161*(states[0]+39.0+10.0*variables[0]))+0.7174*exp((0.2719-0.1719*variables[0])*1.0*(states[0]+40.93+10.0*variables[0])))) if eq_func(variables[2], 1.0) else 0.0101+0.06517/(0.5686*exp(-0.08161*(states[0]+39.0))+0.7174*exp(0.2719*(states[0]+40.93))) - rates[9] = (variables[142]-states[9])/variables[143] - variables[144] = 1.0/(1.0+exp(-(states[0]-10.93)/19.7)) - variables[145] = 0.001*(2.98+15.59/(1.037*exp(0.09*(states[0]+30.61))+0.369*exp(-0.12*(states[0]+23.84)))) if eq_func(variables[2], 0.0) else 0.0025*(1.191+7.838/(1.037*exp(0.09012*(states[0]+30.61))+0.369*exp(-0.119*(states[0]+23.84)))) if eq_func(variables[2], 1.0) else 0.001*(2.98+19.59/(1.037*exp(0.09012*(states[0]+30.61))+0.369*exp(-0.119*(states[0]+23.84)))) - rates[8] = (variables[144]-states[8])/variables[145] - variables[154] = 1.0/(1.0+exp(-(states[0]+14.2)/10.6)) if neq_func(variables[2], 2.0) else 1.0/(1.0+exp(-(states[0]+13.2)/10.6)) - variables[155] = 1.0/(37.2*exp((states[0]-9.0)/15.9)+0.96*exp(-(states[0]-9.0)/22.5)) if neq_func(variables[2], 2.0) else 1.0/(37.2*exp((states[0]-10.0)/15.9)+0.96*exp(-(states[0]-10.0)/22.5)) - rates[11] = (variables[154]-states[11])/variables[155] - variables[156] = variables[154] - variables[157] = 1.0/(4.2*exp((states[0]-9.0)/17.0)+0.15*exp(-(states[0]-9.0)/21.6)) if neq_func(variables[2], 2.0) else 1.0/(4.2*exp((states[0]-10.0)/17.0)+0.15*exp(-(states[0]-10.0)/21.6)) - rates[12] = (variables[156]-states[12])/variables[157] - variables[159] = 1.0/(1.0+exp((states[0]+18.6)/10.1)) - rates[10] = (variables[159]-states[10])/variables[158] - variables[167] = 14.0/(1.0+exp(-(states[0]-40.0)/9.0)) - variables[168] = 1.0*exp(-states[0]/45.0) - rates[13] = variables[167]*(1.0-states[13])-variables[168]*states[13] - variables[183] = 1.0*exp(-(states[0]+78.91)/26.62) if eq_func(variables[2], 0.0) else 1.0*exp(-(states[0]+78.91)/26.63) - variables[184] = 1.0*exp((states[0]+75.13)/21.25) - rates[14] = variables[183]*(1.0-states[14])-variables[184]*states[14] + algebraic[9] = computed_constants[62]*pow(constants[56]/(constants[71]+constants[56]), 3.0)*pow(constants[69]/(constants[70]+constants[69]), 2.0)*1.6/(1.5+exp(-(states[0]+60.0)/40.0)) + algebraic[10] = computed_constants[49]*(pow(constants[56], 3.0)*constants[58]*exp(0.03743*states[0]*constants[57])-pow(constants[59], 3.0)*constants[60]*exp(0.0374*states[0]*(constants[57]-1.0)))/(1.0+constants[61]*(constants[60]*pow(constants[59], 3.0)+constants[58]*pow(constants[56], 3.0))) if eq_func(constants[2], 0.0) else computed_constants[49]*(pow(constants[56], 3.0)*constants[58]*exp(0.03743*states[0]*constants[57])-pow(constants[59], 3.0)*constants[60]*exp(0.03743*states[0]*(constants[57]-1.0)))/(1.0+constants[61]*(constants[60]*pow(constants[59], 3.0)+constants[58]*pow(constants[56], 3.0))) + algebraic[14] = computed_constants[176]*states[14]*(states[0]-computed_constants[40]) if neq_func(constants[2], 2.0) else computed_constants[176]*states[14]*(states[0]+102.0) + algebraic[15] = computed_constants[169]*states[14]*(states[0]-computed_constants[32]) if neq_func(constants[2], 2.0) else computed_constants[169]*states[14]*(states[0]-77.6) + algebraic[16] = computed_constants[160]*pow(states[13], 2.0)*(states[0]-computed_constants[80]) + algebraic[18] = computed_constants[135]*states[8]*(states[0]-computed_constants[40]) + algebraic[19] = computed_constants[128]*states[9]*states[8]*(states[0]-computed_constants[40]) + algebraic[20] = computed_constants[112]*states[7]*states[6]*(states[0]-constants[119]) + algebraic[21] = computed_constants[96]*(states[4]*states[5]+0.006/(1.0+exp(-(states[0]+14.1)/6.0)))*(states[0]-constants[103]) + algebraic[91] = 0.0952*exp(-0.063*(states[0]+34.4))/(1.0+1.66*exp(-0.225*(states[0]+63.7)))+0.0869 if eq_func(constants[2], 0.0) else 0.09518*exp(-0.06306*(states[0]+34.4))/(1.0+1.662*exp(-0.2251*(states[0]+63.7)))+0.08693 + algebraic[88] = (1.0-algebraic[91])*states[2]+algebraic[91]*states[3] + algebraic[7] = computed_constants[81]*pow(states[1], 3.0)*algebraic[88]*constants[59]*pow(constants[24], 2.0)/(constants[22]*constants[23])*(exp((states[0]-computed_constants[32])*constants[24]/(constants[22]*constants[23]))-1.0)/(exp(states[0]*constants[24]/(constants[22]*constants[23]))-1.0)*states[0] + algebraic[11] = computed_constants[33]*(states[0]-computed_constants[40]) + algebraic[12] = computed_constants[41]*(states[0]-computed_constants[48]) + algebraic[13] = computed_constants[25]*(states[0]-computed_constants[32]) + algebraic[153] = 0.6*states[11]+0.4*states[12] + algebraic[17] = computed_constants[146]*algebraic[153]*states[10]*(states[0]-computed_constants[40]) + rates[0] = -1.0/computed_constants[4]*(algebraic[7]+algebraic[21]+algebraic[20]+algebraic[19]+algebraic[18]+algebraic[17]+algebraic[16]+algebraic[15]+algebraic[14]+algebraic[13]+algebraic[12]+algebraic[11]+algebraic[10]+algebraic[9]+computed_constants[8]) + algebraic[89] = pow(1.0/(1.0+exp(-states[0]/5.46)), 1.0/3.0) if eq_func(constants[2], 0.0) else pow(1.0/(1.0+exp(-(states[0]+30.32)/5.46)), 1.0/3.0) + algebraic[90] = 0.0006247/(0.832*exp(-0.335*(states[0]+56.7))+0.627*exp(0.082*(states[0]+65.01)))+4.0e-5 if eq_func(constants[2], 0.0) else 0.0006247/(0.8322166*exp(-0.33566*(states[0]+56.7062))+0.6274*exp(0.0823*(states[0]+65.0131)))+4.569e-5 + rates[1] = (algebraic[89]-states[1])/algebraic[90] + algebraic[92] = 1.0/(1.0+exp((states[0]+66.1)/6.4)) + algebraic[93] = 3.717e-6*exp(-0.2815*(states[0]+17.11))/(1.0+0.003732*exp(-0.3426*(states[0]+37.76)))+0.0005977 + rates[2] = (algebraic[92]-states[2])/algebraic[93] + algebraic[94] = algebraic[92] + algebraic[95] = 3.186e-8*exp(-0.6219*(states[0]+18.8))/(1.0+7.189e-5*exp(-0.6683*(states[0]+34.07)))+0.003556 + rates[3] = (algebraic[94]-states[3])/algebraic[95] + algebraic[104] = 1.0/(1.0+exp(-(states[0]+23.1)/6.0)) if eq_func(constants[2], 0.0) else 1.0/(1.0+exp(-(states[0]+22.3+0.8*computed_constants[0])/6.0)) if eq_func(constants[2], 1.0) else 1.0/(1.0+exp(-(states[0]+22.2)/6.0)) + algebraic[106] = -28.38*(states[0]+35.0)/(exp(-(states[0]+35.0)/2.5)-1.0)-84.9*states[0]/(exp(-0.208*states[0])-1.0) if eq_func(constants[2], 0.0) else -28.39*(states[0]+35.0)/(exp(-(states[0]+35.0)/2.5)-1.0)-84.9*states[0]/(exp(-0.208*states[0])-1.0) if eq_func(constants[2], 1.0) else -28.4*(states[0]+35.0)/(exp(-(states[0]+35.0)/2.5)-1.0)-84.9*states[0]/(exp(-0.208*states[0])-1.0) + algebraic[107] = 11.43*(states[0]-5.0)/(exp(0.4*(states[0]-5.0))-1.0) if eq_func(constants[2], 1.0) else 11.42*(states[0]-5.0)/(exp(0.4*(states[0]-5.0))-1.0) + algebraic[105] = 2.0/(algebraic[106]+algebraic[107]) + rates[5] = (algebraic[104]-states[5])/algebraic[105] + algebraic[108] = 1.0/(1.0+exp((states[0]+45.0)/5.0)) + algebraic[110] = 3.75*(states[0]+28.0)/(exp((states[0]+28.0)/4.0)-1.0) if eq_func(constants[2], 1.0) else 3.12*(states[0]+28.0)/(exp((states[0]+28.0)/4.0)-1.0) + algebraic[111] = 30.0/(1.0+exp(-(states[0]+28.0)/4.0)) if eq_func(constants[2], 1.0) else 25.0/(1.0+exp(-(states[0]+28.0)/4.0)) + algebraic[109] = (1.2-0.2*computed_constants[0])/(algebraic[110]+algebraic[111]) if eq_func(constants[2], 1.0) else 1.0/(algebraic[110]+algebraic[111]) + rates[4] = (algebraic[108]-states[4])/algebraic[109] + algebraic[120] = 1.0/(1.0+exp(-(states[0]+37.0)/6.8)) + algebraic[122] = 1068.0*exp((states[0]+26.3)/30.0) + algebraic[123] = 1068.0*exp(-(states[0]+26.3)/30.0) + algebraic[121] = 1.0/(algebraic[122]+algebraic[123]) + rates[7] = (algebraic[120]-states[7])/algebraic[121] + algebraic[124] = 1.0/(1.0+exp((states[0]+71.0)/9.0)) + algebraic[126] = 15.3*exp(-(states[0]+71.0+0.7*computed_constants[0])/83.3) if eq_func(constants[2], 1.0) else 15.3*exp(-(states[0]+71.7)/83.3) + algebraic[127] = 15.0*exp((states[0]+71.0)/15.38) if eq_func(constants[2], 1.0) else 15.0*exp((states[0]+71.7)/15.38) + algebraic[125] = 1.0/(algebraic[126]+algebraic[127]) + rates[6] = (algebraic[124]-states[6])/algebraic[125] + algebraic[142] = 1.0/(1.0+exp((states[0]+59.37)/13.1)) + algebraic[143] = 0.0101+0.06517/(0.57*exp(-0.08*(states[0]+49.0)))+2.4e-5*exp(0.1*(states[0]+50.93)) if eq_func(constants[2], 0.0) else 0.001/3.0*(30.31+195.5/(0.5686*exp(-0.08161*(states[0]+39.0+10.0*computed_constants[0]))+0.7174*exp((0.2719-0.1719*computed_constants[0])*1.0*(states[0]+40.93+10.0*computed_constants[0])))) if eq_func(constants[2], 1.0) else 0.0101+0.06517/(0.5686*exp(-0.08161*(states[0]+39.0))+0.7174*exp(0.2719*(states[0]+40.93))) + rates[9] = (algebraic[142]-states[9])/algebraic[143] + algebraic[144] = 1.0/(1.0+exp(-(states[0]-10.93)/19.7)) + algebraic[145] = 0.001*(2.98+15.59/(1.037*exp(0.09*(states[0]+30.61))+0.369*exp(-0.12*(states[0]+23.84)))) if eq_func(constants[2], 0.0) else 0.0025*(1.191+7.838/(1.037*exp(0.09012*(states[0]+30.61))+0.369*exp(-0.119*(states[0]+23.84)))) if eq_func(constants[2], 1.0) else 0.001*(2.98+19.59/(1.037*exp(0.09012*(states[0]+30.61))+0.369*exp(-0.119*(states[0]+23.84)))) + rates[8] = (algebraic[144]-states[8])/algebraic[145] + algebraic[154] = 1.0/(1.0+exp(-(states[0]+14.2)/10.6)) if neq_func(constants[2], 2.0) else 1.0/(1.0+exp(-(states[0]+13.2)/10.6)) + algebraic[155] = 1.0/(37.2*exp((states[0]-9.0)/15.9)+0.96*exp(-(states[0]-9.0)/22.5)) if neq_func(constants[2], 2.0) else 1.0/(37.2*exp((states[0]-10.0)/15.9)+0.96*exp(-(states[0]-10.0)/22.5)) + rates[11] = (algebraic[154]-states[11])/algebraic[155] + algebraic[156] = algebraic[154] + algebraic[157] = 1.0/(4.2*exp((states[0]-9.0)/17.0)+0.15*exp(-(states[0]-9.0)/21.6)) if neq_func(constants[2], 2.0) else 1.0/(4.2*exp((states[0]-10.0)/17.0)+0.15*exp(-(states[0]-10.0)/21.6)) + rates[12] = (algebraic[156]-states[12])/algebraic[157] + algebraic[159] = 1.0/(1.0+exp((states[0]+18.6)/10.1)) + rates[10] = (algebraic[159]-states[10])/computed_constants[158] + algebraic[167] = 14.0/(1.0+exp(-(states[0]-40.0)/9.0)) + algebraic[168] = 1.0*exp(-states[0]/45.0) + rates[13] = algebraic[167]*(1.0-states[13])-algebraic[168]*states[13] + algebraic[183] = 1.0*exp(-(states[0]+78.91)/26.62) if eq_func(constants[2], 0.0) else 1.0*exp(-(states[0]+78.91)/26.63) + algebraic[184] = 1.0*exp((states[0]+75.13)/21.25) + rates[14] = algebraic[183]*(1.0-states[14])-algebraic[184]*states[14] def compute_variables(voi, states, rates, constants, computed_constants, algebraic): - variables[13] = variables[25]*(states[0]-variables[32]) - variables[11] = variables[33]*(states[0]-variables[40]) - variables[12] = variables[41]*(states[0]-variables[48]) - variables[10] = variables[49]*(pow(variables[56], 3.0)*variables[58]*exp(0.03743*states[0]*variables[57])-pow(variables[59], 3.0)*variables[60]*exp(0.0374*states[0]*(variables[57]-1.0)))/(1.0+variables[61]*(variables[60]*pow(variables[59], 3.0)+variables[58]*pow(variables[56], 3.0))) if eq_func(variables[2], 0.0) else variables[49]*(pow(variables[56], 3.0)*variables[58]*exp(0.03743*states[0]*variables[57])-pow(variables[59], 3.0)*variables[60]*exp(0.03743*states[0]*(variables[57]-1.0)))/(1.0+variables[61]*(variables[60]*pow(variables[59], 3.0)+variables[58]*pow(variables[56], 3.0))) - variables[9] = variables[62]*pow(variables[56]/(variables[71]+variables[56]), 3.0)*pow(variables[69]/(variables[70]+variables[69]), 2.0)*1.6/(1.5+exp(-(states[0]+60.0)/40.0)) - variables[91] = 0.0952*exp(-0.063*(states[0]+34.4))/(1.0+1.66*exp(-0.225*(states[0]+63.7)))+0.0869 if eq_func(variables[2], 0.0) else 0.09518*exp(-0.06306*(states[0]+34.4))/(1.0+1.662*exp(-0.2251*(states[0]+63.7)))+0.08693 - variables[88] = (1.0-variables[91])*states[2]+variables[91]*states[3] - variables[7] = variables[81]*pow(states[1], 3.0)*variables[88]*variables[59]*pow(variables[24], 2.0)/(variables[22]*variables[23])*(exp((states[0]-variables[32])*variables[24]/(variables[22]*variables[23]))-1.0)/(exp(states[0]*variables[24]/(variables[22]*variables[23]))-1.0)*states[0] - variables[89] = pow(1.0/(1.0+exp(-states[0]/5.46)), 1.0/3.0) if eq_func(variables[2], 0.0) else pow(1.0/(1.0+exp(-(states[0]+30.32)/5.46)), 1.0/3.0) - variables[90] = 0.0006247/(0.832*exp(-0.335*(states[0]+56.7))+0.627*exp(0.082*(states[0]+65.01)))+4.0e-5 if eq_func(variables[2], 0.0) else 0.0006247/(0.8322166*exp(-0.33566*(states[0]+56.7062))+0.6274*exp(0.0823*(states[0]+65.0131)))+4.569e-5 - variables[92] = 1.0/(1.0+exp((states[0]+66.1)/6.4)) - variables[94] = variables[92] - variables[93] = 3.717e-6*exp(-0.2815*(states[0]+17.11))/(1.0+0.003732*exp(-0.3426*(states[0]+37.76)))+0.0005977 - variables[95] = 3.186e-8*exp(-0.6219*(states[0]+18.8))/(1.0+7.189e-5*exp(-0.6683*(states[0]+34.07)))+0.003556 - variables[21] = variables[96]*(states[4]*states[5]+0.006/(1.0+exp(-(states[0]+14.1)/6.0)))*(states[0]-variables[103]) - variables[106] = -28.38*(states[0]+35.0)/(exp(-(states[0]+35.0)/2.5)-1.0)-84.9*states[0]/(exp(-0.208*states[0])-1.0) if eq_func(variables[2], 0.0) else -28.39*(states[0]+35.0)/(exp(-(states[0]+35.0)/2.5)-1.0)-84.9*states[0]/(exp(-0.208*states[0])-1.0) if eq_func(variables[2], 1.0) else -28.4*(states[0]+35.0)/(exp(-(states[0]+35.0)/2.5)-1.0)-84.9*states[0]/(exp(-0.208*states[0])-1.0) - variables[107] = 11.43*(states[0]-5.0)/(exp(0.4*(states[0]-5.0))-1.0) if eq_func(variables[2], 1.0) else 11.42*(states[0]-5.0)/(exp(0.4*(states[0]-5.0))-1.0) - variables[105] = 2.0/(variables[106]+variables[107]) - variables[104] = 1.0/(1.0+exp(-(states[0]+23.1)/6.0)) if eq_func(variables[2], 0.0) else 1.0/(1.0+exp(-(states[0]+22.3+0.8*variables[0])/6.0)) if eq_func(variables[2], 1.0) else 1.0/(1.0+exp(-(states[0]+22.2)/6.0)) - variables[110] = 3.75*(states[0]+28.0)/(exp((states[0]+28.0)/4.0)-1.0) if eq_func(variables[2], 1.0) else 3.12*(states[0]+28.0)/(exp((states[0]+28.0)/4.0)-1.0) - variables[111] = 30.0/(1.0+exp(-(states[0]+28.0)/4.0)) if eq_func(variables[2], 1.0) else 25.0/(1.0+exp(-(states[0]+28.0)/4.0)) - variables[109] = (1.2-0.2*variables[0])/(variables[110]+variables[111]) if eq_func(variables[2], 1.0) else 1.0/(variables[110]+variables[111]) - variables[108] = 1.0/(1.0+exp((states[0]+45.0)/5.0)) - variables[20] = variables[112]*states[7]*states[6]*(states[0]-variables[119]) - variables[122] = 1068.0*exp((states[0]+26.3)/30.0) - variables[123] = 1068.0*exp(-(states[0]+26.3)/30.0) - variables[121] = 1.0/(variables[122]+variables[123]) - variables[120] = 1.0/(1.0+exp(-(states[0]+37.0)/6.8)) - variables[126] = 15.3*exp(-(states[0]+71.0+0.7*variables[0])/83.3) if eq_func(variables[2], 1.0) else 15.3*exp(-(states[0]+71.7)/83.3) - variables[127] = 15.0*exp((states[0]+71.0)/15.38) if eq_func(variables[2], 1.0) else 15.0*exp((states[0]+71.7)/15.38) - variables[125] = 1.0/(variables[126]+variables[127]) - variables[124] = 1.0/(1.0+exp((states[0]+71.0)/9.0)) - variables[19] = variables[128]*states[9]*states[8]*(states[0]-variables[40]) - variables[18] = variables[135]*states[8]*(states[0]-variables[40]) - variables[142] = 1.0/(1.0+exp((states[0]+59.37)/13.1)) - variables[143] = 0.0101+0.06517/(0.57*exp(-0.08*(states[0]+49.0)))+2.4e-5*exp(0.1*(states[0]+50.93)) if eq_func(variables[2], 0.0) else 0.001/3.0*(30.31+195.5/(0.5686*exp(-0.08161*(states[0]+39.0+10.0*variables[0]))+0.7174*exp((0.2719-0.1719*variables[0])*1.0*(states[0]+40.93+10.0*variables[0])))) if eq_func(variables[2], 1.0) else 0.0101+0.06517/(0.5686*exp(-0.08161*(states[0]+39.0))+0.7174*exp(0.2719*(states[0]+40.93))) - variables[144] = 1.0/(1.0+exp(-(states[0]-10.93)/19.7)) - variables[145] = 0.001*(2.98+15.59/(1.037*exp(0.09*(states[0]+30.61))+0.369*exp(-0.12*(states[0]+23.84)))) if eq_func(variables[2], 0.0) else 0.0025*(1.191+7.838/(1.037*exp(0.09012*(states[0]+30.61))+0.369*exp(-0.119*(states[0]+23.84)))) if eq_func(variables[2], 1.0) else 0.001*(2.98+19.59/(1.037*exp(0.09012*(states[0]+30.61))+0.369*exp(-0.119*(states[0]+23.84)))) - variables[153] = 0.6*states[11]+0.4*states[12] - variables[17] = variables[146]*variables[153]*states[10]*(states[0]-variables[40]) - variables[154] = 1.0/(1.0+exp(-(states[0]+14.2)/10.6)) if neq_func(variables[2], 2.0) else 1.0/(1.0+exp(-(states[0]+13.2)/10.6)) - variables[155] = 1.0/(37.2*exp((states[0]-9.0)/15.9)+0.96*exp(-(states[0]-9.0)/22.5)) if neq_func(variables[2], 2.0) else 1.0/(37.2*exp((states[0]-10.0)/15.9)+0.96*exp(-(states[0]-10.0)/22.5)) - variables[156] = variables[154] - variables[157] = 1.0/(4.2*exp((states[0]-9.0)/17.0)+0.15*exp(-(states[0]-9.0)/21.6)) if neq_func(variables[2], 2.0) else 1.0/(4.2*exp((states[0]-10.0)/17.0)+0.15*exp(-(states[0]-10.0)/21.6)) - variables[159] = 1.0/(1.0+exp((states[0]+18.6)/10.1)) - variables[16] = variables[160]*pow(states[13], 2.0)*(states[0]-variables[80]) - variables[167] = 14.0/(1.0+exp(-(states[0]-40.0)/9.0)) - variables[168] = 1.0*exp(-states[0]/45.0) - variables[15] = variables[169]*states[14]*(states[0]-variables[32]) if neq_func(variables[2], 2.0) else variables[169]*states[14]*(states[0]-77.6) - variables[14] = variables[176]*states[14]*(states[0]-variables[40]) if neq_func(variables[2], 2.0) else variables[176]*states[14]*(states[0]+102.0) - variables[183] = 1.0*exp(-(states[0]+78.91)/26.62) if eq_func(variables[2], 0.0) else 1.0*exp(-(states[0]+78.91)/26.63) - variables[184] = 1.0*exp((states[0]+75.13)/21.25) + algebraic[13] = computed_constants[25]*(states[0]-computed_constants[32]) + algebraic[11] = computed_constants[33]*(states[0]-computed_constants[40]) + algebraic[12] = computed_constants[41]*(states[0]-computed_constants[48]) + algebraic[10] = computed_constants[49]*(pow(constants[56], 3.0)*constants[58]*exp(0.03743*states[0]*constants[57])-pow(constants[59], 3.0)*constants[60]*exp(0.0374*states[0]*(constants[57]-1.0)))/(1.0+constants[61]*(constants[60]*pow(constants[59], 3.0)+constants[58]*pow(constants[56], 3.0))) if eq_func(constants[2], 0.0) else computed_constants[49]*(pow(constants[56], 3.0)*constants[58]*exp(0.03743*states[0]*constants[57])-pow(constants[59], 3.0)*constants[60]*exp(0.03743*states[0]*(constants[57]-1.0)))/(1.0+constants[61]*(constants[60]*pow(constants[59], 3.0)+constants[58]*pow(constants[56], 3.0))) + algebraic[9] = computed_constants[62]*pow(constants[56]/(constants[71]+constants[56]), 3.0)*pow(constants[69]/(constants[70]+constants[69]), 2.0)*1.6/(1.5+exp(-(states[0]+60.0)/40.0)) + algebraic[91] = 0.0952*exp(-0.063*(states[0]+34.4))/(1.0+1.66*exp(-0.225*(states[0]+63.7)))+0.0869 if eq_func(constants[2], 0.0) else 0.09518*exp(-0.06306*(states[0]+34.4))/(1.0+1.662*exp(-0.2251*(states[0]+63.7)))+0.08693 + algebraic[88] = (1.0-algebraic[91])*states[2]+algebraic[91]*states[3] + algebraic[7] = computed_constants[81]*pow(states[1], 3.0)*algebraic[88]*constants[59]*pow(constants[24], 2.0)/(constants[22]*constants[23])*(exp((states[0]-computed_constants[32])*constants[24]/(constants[22]*constants[23]))-1.0)/(exp(states[0]*constants[24]/(constants[22]*constants[23]))-1.0)*states[0] + algebraic[89] = pow(1.0/(1.0+exp(-states[0]/5.46)), 1.0/3.0) if eq_func(constants[2], 0.0) else pow(1.0/(1.0+exp(-(states[0]+30.32)/5.46)), 1.0/3.0) + algebraic[90] = 0.0006247/(0.832*exp(-0.335*(states[0]+56.7))+0.627*exp(0.082*(states[0]+65.01)))+4.0e-5 if eq_func(constants[2], 0.0) else 0.0006247/(0.8322166*exp(-0.33566*(states[0]+56.7062))+0.6274*exp(0.0823*(states[0]+65.0131)))+4.569e-5 + algebraic[92] = 1.0/(1.0+exp((states[0]+66.1)/6.4)) + algebraic[94] = algebraic[92] + algebraic[93] = 3.717e-6*exp(-0.2815*(states[0]+17.11))/(1.0+0.003732*exp(-0.3426*(states[0]+37.76)))+0.0005977 + algebraic[95] = 3.186e-8*exp(-0.6219*(states[0]+18.8))/(1.0+7.189e-5*exp(-0.6683*(states[0]+34.07)))+0.003556 + algebraic[21] = computed_constants[96]*(states[4]*states[5]+0.006/(1.0+exp(-(states[0]+14.1)/6.0)))*(states[0]-constants[103]) + algebraic[106] = -28.38*(states[0]+35.0)/(exp(-(states[0]+35.0)/2.5)-1.0)-84.9*states[0]/(exp(-0.208*states[0])-1.0) if eq_func(constants[2], 0.0) else -28.39*(states[0]+35.0)/(exp(-(states[0]+35.0)/2.5)-1.0)-84.9*states[0]/(exp(-0.208*states[0])-1.0) if eq_func(constants[2], 1.0) else -28.4*(states[0]+35.0)/(exp(-(states[0]+35.0)/2.5)-1.0)-84.9*states[0]/(exp(-0.208*states[0])-1.0) + algebraic[107] = 11.43*(states[0]-5.0)/(exp(0.4*(states[0]-5.0))-1.0) if eq_func(constants[2], 1.0) else 11.42*(states[0]-5.0)/(exp(0.4*(states[0]-5.0))-1.0) + algebraic[105] = 2.0/(algebraic[106]+algebraic[107]) + algebraic[104] = 1.0/(1.0+exp(-(states[0]+23.1)/6.0)) if eq_func(constants[2], 0.0) else 1.0/(1.0+exp(-(states[0]+22.3+0.8*computed_constants[0])/6.0)) if eq_func(constants[2], 1.0) else 1.0/(1.0+exp(-(states[0]+22.2)/6.0)) + algebraic[110] = 3.75*(states[0]+28.0)/(exp((states[0]+28.0)/4.0)-1.0) if eq_func(constants[2], 1.0) else 3.12*(states[0]+28.0)/(exp((states[0]+28.0)/4.0)-1.0) + algebraic[111] = 30.0/(1.0+exp(-(states[0]+28.0)/4.0)) if eq_func(constants[2], 1.0) else 25.0/(1.0+exp(-(states[0]+28.0)/4.0)) + algebraic[109] = (1.2-0.2*computed_constants[0])/(algebraic[110]+algebraic[111]) if eq_func(constants[2], 1.0) else 1.0/(algebraic[110]+algebraic[111]) + algebraic[108] = 1.0/(1.0+exp((states[0]+45.0)/5.0)) + algebraic[20] = computed_constants[112]*states[7]*states[6]*(states[0]-constants[119]) + algebraic[122] = 1068.0*exp((states[0]+26.3)/30.0) + algebraic[123] = 1068.0*exp(-(states[0]+26.3)/30.0) + algebraic[121] = 1.0/(algebraic[122]+algebraic[123]) + algebraic[120] = 1.0/(1.0+exp(-(states[0]+37.0)/6.8)) + algebraic[126] = 15.3*exp(-(states[0]+71.0+0.7*computed_constants[0])/83.3) if eq_func(constants[2], 1.0) else 15.3*exp(-(states[0]+71.7)/83.3) + algebraic[127] = 15.0*exp((states[0]+71.0)/15.38) if eq_func(constants[2], 1.0) else 15.0*exp((states[0]+71.7)/15.38) + algebraic[125] = 1.0/(algebraic[126]+algebraic[127]) + algebraic[124] = 1.0/(1.0+exp((states[0]+71.0)/9.0)) + algebraic[19] = computed_constants[128]*states[9]*states[8]*(states[0]-computed_constants[40]) + algebraic[18] = computed_constants[135]*states[8]*(states[0]-computed_constants[40]) + algebraic[142] = 1.0/(1.0+exp((states[0]+59.37)/13.1)) + algebraic[143] = 0.0101+0.06517/(0.57*exp(-0.08*(states[0]+49.0)))+2.4e-5*exp(0.1*(states[0]+50.93)) if eq_func(constants[2], 0.0) else 0.001/3.0*(30.31+195.5/(0.5686*exp(-0.08161*(states[0]+39.0+10.0*computed_constants[0]))+0.7174*exp((0.2719-0.1719*computed_constants[0])*1.0*(states[0]+40.93+10.0*computed_constants[0])))) if eq_func(constants[2], 1.0) else 0.0101+0.06517/(0.5686*exp(-0.08161*(states[0]+39.0))+0.7174*exp(0.2719*(states[0]+40.93))) + algebraic[144] = 1.0/(1.0+exp(-(states[0]-10.93)/19.7)) + algebraic[145] = 0.001*(2.98+15.59/(1.037*exp(0.09*(states[0]+30.61))+0.369*exp(-0.12*(states[0]+23.84)))) if eq_func(constants[2], 0.0) else 0.0025*(1.191+7.838/(1.037*exp(0.09012*(states[0]+30.61))+0.369*exp(-0.119*(states[0]+23.84)))) if eq_func(constants[2], 1.0) else 0.001*(2.98+19.59/(1.037*exp(0.09012*(states[0]+30.61))+0.369*exp(-0.119*(states[0]+23.84)))) + algebraic[153] = 0.6*states[11]+0.4*states[12] + algebraic[17] = computed_constants[146]*algebraic[153]*states[10]*(states[0]-computed_constants[40]) + algebraic[154] = 1.0/(1.0+exp(-(states[0]+14.2)/10.6)) if neq_func(constants[2], 2.0) else 1.0/(1.0+exp(-(states[0]+13.2)/10.6)) + algebraic[155] = 1.0/(37.2*exp((states[0]-9.0)/15.9)+0.96*exp(-(states[0]-9.0)/22.5)) if neq_func(constants[2], 2.0) else 1.0/(37.2*exp((states[0]-10.0)/15.9)+0.96*exp(-(states[0]-10.0)/22.5)) + algebraic[156] = algebraic[154] + algebraic[157] = 1.0/(4.2*exp((states[0]-9.0)/17.0)+0.15*exp(-(states[0]-9.0)/21.6)) if neq_func(constants[2], 2.0) else 1.0/(4.2*exp((states[0]-10.0)/17.0)+0.15*exp(-(states[0]-10.0)/21.6)) + algebraic[159] = 1.0/(1.0+exp((states[0]+18.6)/10.1)) + algebraic[16] = computed_constants[160]*pow(states[13], 2.0)*(states[0]-computed_constants[80]) + algebraic[167] = 14.0/(1.0+exp(-(states[0]-40.0)/9.0)) + algebraic[168] = 1.0*exp(-states[0]/45.0) + algebraic[15] = computed_constants[169]*states[14]*(states[0]-computed_constants[32]) if neq_func(constants[2], 2.0) else computed_constants[169]*states[14]*(states[0]-77.6) + algebraic[14] = computed_constants[176]*states[14]*(states[0]-computed_constants[40]) if neq_func(constants[2], 2.0) else computed_constants[176]*states[14]*(states[0]+102.0) + algebraic[183] = 1.0*exp(-(states[0]+78.91)/26.62) if eq_func(constants[2], 0.0) else 1.0*exp(-(states[0]+78.91)/26.63) + algebraic[184] = 1.0*exp((states[0]+75.13)/21.25) diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.c index b7a5b4fd4e..df6f7da7ae 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.c @@ -72,53 +72,53 @@ void deleteArray(double *array) void initialiseVariables(double voi, double *states, double *rates, double *constants, ExternalVariable externalVariable) { - variables[4] = 1.0; - variables[5] = 0.0; - variables[7] = 0.3; - variables[9] = 120.0; - variables[15] = 36.0; + constants[4] = 1.0; + constants[5] = 0.0; + constants[7] = 0.3; + constants[9] = 120.0; + constants[15] = 36.0; states[0] = 0.0; states[1] = 0.6; states[2] = 0.05; states[3] = 0.325; - variables[0] = externalVariable(voi, states, rates, variables, 0); + algebraic[0] = externalVariable(voi, states, rates, variables, 0); } void computeComputedConstants(double *constants, double *computedConstants) { - variables[6] = variables[5]-10.613; - variables[8] = variables[5]-115.0; - variables[14] = variables[5]+12.0; + computedConstants[6] = constants[5]-10.613; + computedConstants[8] = constants[5]-115.0; + computedConstants[14] = constants[5]+12.0; } void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) { - variables[0] = externalVariable(voi, states, rates, variables, 0); - variables[1] = variables[7]*(states[0]-variables[6]); - variables[2] = variables[15]*pow(states[3], 4.0)*(states[0]-variables[14]); - variables[3] = variables[9]*pow(states[2], 3.0)*states[1]*(states[0]-variables[8]); - rates[0] = -(-variables[0]+variables[3]+variables[2]+variables[1])/variables[4]; - variables[10] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0); - variables[11] = 4.0*exp(states[0]/18.0); - rates[2] = variables[10]*(1.0-states[2])-variables[11]*states[2]; - variables[12] = 0.07*exp(states[0]/20.0); - variables[13] = 1.0/(exp((states[0]+30.0)/10.0)+1.0); - rates[1] = variables[12]*(1.0-states[1])-variables[13]*states[1]; - variables[16] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0); - variables[17] = 0.125*exp(states[0]/80.0); - rates[3] = variables[16]*(1.0-states[3])-variables[17]*states[3]; + algebraic[0] = externalVariable(voi, states, rates, variables, 0); + algebraic[1] = constants[7]*(states[0]-computedConstants[6]); + algebraic[2] = constants[15]*pow(states[3], 4.0)*(states[0]-computedConstants[14]); + algebraic[3] = constants[9]*pow(states[2], 3.0)*states[1]*(states[0]-computedConstants[8]); + rates[0] = -(-algebraic[0]+algebraic[3]+algebraic[2]+algebraic[1])/constants[4]; + algebraic[10] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0); + algebraic[11] = 4.0*exp(states[0]/18.0); + rates[2] = algebraic[10]*(1.0-states[2])-algebraic[11]*states[2]; + algebraic[12] = 0.07*exp(states[0]/20.0); + algebraic[13] = 1.0/(exp((states[0]+30.0)/10.0)+1.0); + rates[1] = algebraic[12]*(1.0-states[1])-algebraic[13]*states[1]; + algebraic[16] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0); + algebraic[17] = 0.125*exp(states[0]/80.0); + rates[3] = algebraic[16]*(1.0-states[3])-algebraic[17]*states[3]; } void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) { - variables[0] = externalVariable(voi, states, rates, variables, 0); - variables[1] = variables[7]*(states[0]-variables[6]); - variables[3] = variables[9]*pow(states[2], 3.0)*states[1]*(states[0]-variables[8]); - variables[10] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0); - variables[11] = 4.0*exp(states[0]/18.0); - variables[12] = 0.07*exp(states[0]/20.0); - variables[13] = 1.0/(exp((states[0]+30.0)/10.0)+1.0); - variables[2] = variables[15]*pow(states[3], 4.0)*(states[0]-variables[14]); - variables[16] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0); - variables[17] = 0.125*exp(states[0]/80.0); + algebraic[0] = externalVariable(voi, states, rates, variables, 0); + algebraic[1] = constants[7]*(states[0]-computedConstants[6]); + algebraic[3] = constants[9]*pow(states[2], 3.0)*states[1]*(states[0]-computedConstants[8]); + algebraic[10] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0); + algebraic[11] = 4.0*exp(states[0]/18.0); + algebraic[12] = 0.07*exp(states[0]/20.0); + algebraic[13] = 1.0/(exp((states[0]+30.0)/10.0)+1.0); + algebraic[2] = constants[15]*pow(states[3], 4.0)*(states[0]-computedConstants[14]); + algebraic[16] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0); + algebraic[17] = 0.125*exp(states[0]/80.0); } diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.py index 0b83a47b5b..e287d4bc52 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.py @@ -74,49 +74,49 @@ def create_variables_array(): def initialise_variables(voi, states, rates, constants, external_variable): - variables[4] = 1.0 - variables[5] = 0.0 - variables[7] = 0.3 - variables[9] = 120.0 - variables[15] = 36.0 + constants[4] = 1.0 + constants[5] = 0.0 + constants[7] = 0.3 + constants[9] = 120.0 + constants[15] = 36.0 states[0] = 0.0 states[1] = 0.6 states[2] = 0.05 states[3] = 0.325 - variables[0] = external_variable(voi, states, rates, variables, 0) + algebraic[0] = external_variable(voi, states, rates, variables, 0) def compute_computed_constants(constants, computed_constants): - variables[6] = variables[5]-10.613 - variables[8] = variables[5]-115.0 - variables[14] = variables[5]+12.0 + computed_constants[6] = constants[5]-10.613 + computed_constants[8] = constants[5]-115.0 + computed_constants[14] = constants[5]+12.0 def compute_rates(voi, states, rates, constants, computed_constants, algebraic, external_variable): - variables[0] = external_variable(voi, states, rates, variables, 0) - variables[1] = variables[7]*(states[0]-variables[6]) - variables[2] = variables[15]*pow(states[3], 4.0)*(states[0]-variables[14]) - variables[3] = variables[9]*pow(states[2], 3.0)*states[1]*(states[0]-variables[8]) - rates[0] = -(-variables[0]+variables[3]+variables[2]+variables[1])/variables[4] - variables[10] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0) - variables[11] = 4.0*exp(states[0]/18.0) - rates[2] = variables[10]*(1.0-states[2])-variables[11]*states[2] - variables[12] = 0.07*exp(states[0]/20.0) - variables[13] = 1.0/(exp((states[0]+30.0)/10.0)+1.0) - rates[1] = variables[12]*(1.0-states[1])-variables[13]*states[1] - variables[16] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0) - variables[17] = 0.125*exp(states[0]/80.0) - rates[3] = variables[16]*(1.0-states[3])-variables[17]*states[3] + algebraic[0] = external_variable(voi, states, rates, variables, 0) + algebraic[1] = constants[7]*(states[0]-computed_constants[6]) + algebraic[2] = constants[15]*pow(states[3], 4.0)*(states[0]-computed_constants[14]) + algebraic[3] = constants[9]*pow(states[2], 3.0)*states[1]*(states[0]-computed_constants[8]) + rates[0] = -(-algebraic[0]+algebraic[3]+algebraic[2]+algebraic[1])/constants[4] + algebraic[10] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0) + algebraic[11] = 4.0*exp(states[0]/18.0) + rates[2] = algebraic[10]*(1.0-states[2])-algebraic[11]*states[2] + algebraic[12] = 0.07*exp(states[0]/20.0) + algebraic[13] = 1.0/(exp((states[0]+30.0)/10.0)+1.0) + rates[1] = algebraic[12]*(1.0-states[1])-algebraic[13]*states[1] + algebraic[16] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0) + algebraic[17] = 0.125*exp(states[0]/80.0) + rates[3] = algebraic[16]*(1.0-states[3])-algebraic[17]*states[3] def compute_variables(voi, states, rates, constants, computed_constants, algebraic, external_variable): - variables[0] = external_variable(voi, states, rates, variables, 0) - variables[1] = variables[7]*(states[0]-variables[6]) - variables[3] = variables[9]*pow(states[2], 3.0)*states[1]*(states[0]-variables[8]) - variables[10] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0) - variables[11] = 4.0*exp(states[0]/18.0) - variables[12] = 0.07*exp(states[0]/20.0) - variables[13] = 1.0/(exp((states[0]+30.0)/10.0)+1.0) - variables[2] = variables[15]*pow(states[3], 4.0)*(states[0]-variables[14]) - variables[16] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0) - variables[17] = 0.125*exp(states[0]/80.0) + algebraic[0] = external_variable(voi, states, rates, variables, 0) + algebraic[1] = constants[7]*(states[0]-computed_constants[6]) + algebraic[3] = constants[9]*pow(states[2], 3.0)*states[1]*(states[0]-computed_constants[8]) + algebraic[10] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0) + algebraic[11] = 4.0*exp(states[0]/18.0) + algebraic[12] = 0.07*exp(states[0]/20.0) + algebraic[13] = 1.0/(exp((states[0]+30.0)/10.0)+1.0) + algebraic[2] = constants[15]*pow(states[3], 4.0)*(states[0]-computed_constants[14]) + algebraic[16] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0) + algebraic[17] = 0.125*exp(states[0]/80.0) diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.c index 11925369a1..0c24c18ef4 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.c @@ -72,11 +72,11 @@ void deleteArray(double *array) void initialiseVariables(double *states, double *rates, double *constants) { - variables[4] = 1.0; - variables[5] = 0.0; - variables[7] = 0.3; - variables[9] = 120.0; - variables[15] = 36.0; + constants[4] = 1.0; + constants[5] = 0.0; + constants[7] = 0.3; + constants[9] = 120.0; + constants[15] = 36.0; states[0] = 0.0; states[1] = 0.6; states[2] = 0.05; @@ -85,38 +85,38 @@ void initialiseVariables(double *states, double *rates, double *constants) void computeComputedConstants(double *constants, double *computedConstants) { - variables[6] = variables[5]-10.613; - variables[8] = variables[5]-115.0; - variables[14] = variables[5]+12.0; + computedConstants[6] = constants[5]-10.613; + computedConstants[8] = constants[5]-115.0; + computedConstants[14] = constants[5]+12.0; } void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { - variables[0] = ((voi >= 10.0) && (voi <= 10.5))?-20.0:0.0; - variables[1] = variables[7]*(states[0]-variables[6]); - variables[2] = variables[15]*pow(states[3], 4.0)*(states[0]-variables[14]); - variables[3] = variables[9]*pow(states[2], 3.0)*states[1]*(states[0]-variables[8]); - rates[0] = -(-variables[0]+variables[3]+variables[2]+variables[1])/variables[4]; - variables[10] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0); - variables[11] = 4.0*exp(states[0]/18.0); - rates[2] = variables[10]*(1.0-states[2])-variables[11]*states[2]; - variables[12] = 0.07*exp(states[0]/20.0); - variables[13] = 1.0/(exp((states[0]+30.0)/10.0)+1.0); - rates[1] = variables[12]*(1.0-states[1])-variables[13]*states[1]; - variables[16] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0); - variables[17] = 0.125*exp(states[0]/80.0); - rates[3] = variables[16]*(1.0-states[3])-variables[17]*states[3]; + algebraic[0] = ((voi >= 10.0) && (voi <= 10.5))?-20.0:0.0; + algebraic[1] = constants[7]*(states[0]-computedConstants[6]); + algebraic[2] = constants[15]*pow(states[3], 4.0)*(states[0]-computedConstants[14]); + algebraic[3] = constants[9]*pow(states[2], 3.0)*states[1]*(states[0]-computedConstants[8]); + rates[0] = -(-algebraic[0]+algebraic[3]+algebraic[2]+algebraic[1])/constants[4]; + algebraic[10] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0); + algebraic[11] = 4.0*exp(states[0]/18.0); + rates[2] = algebraic[10]*(1.0-states[2])-algebraic[11]*states[2]; + algebraic[12] = 0.07*exp(states[0]/20.0); + algebraic[13] = 1.0/(exp((states[0]+30.0)/10.0)+1.0); + rates[1] = algebraic[12]*(1.0-states[1])-algebraic[13]*states[1]; + algebraic[16] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0); + algebraic[17] = 0.125*exp(states[0]/80.0); + rates[3] = algebraic[16]*(1.0-states[3])-algebraic[17]*states[3]; } void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { - variables[1] = variables[7]*(states[0]-variables[6]); - variables[3] = variables[9]*pow(states[2], 3.0)*states[1]*(states[0]-variables[8]); - variables[10] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0); - variables[11] = 4.0*exp(states[0]/18.0); - variables[12] = 0.07*exp(states[0]/20.0); - variables[13] = 1.0/(exp((states[0]+30.0)/10.0)+1.0); - variables[2] = variables[15]*pow(states[3], 4.0)*(states[0]-variables[14]); - variables[16] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0); - variables[17] = 0.125*exp(states[0]/80.0); + algebraic[1] = constants[7]*(states[0]-computedConstants[6]); + algebraic[3] = constants[9]*pow(states[2], 3.0)*states[1]*(states[0]-computedConstants[8]); + algebraic[10] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0); + algebraic[11] = 4.0*exp(states[0]/18.0); + algebraic[12] = 0.07*exp(states[0]/20.0); + algebraic[13] = 1.0/(exp((states[0]+30.0)/10.0)+1.0); + algebraic[2] = constants[15]*pow(states[3], 4.0)*(states[0]-computedConstants[14]); + algebraic[16] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0); + algebraic[17] = 0.125*exp(states[0]/80.0); } diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.c index 122e1223d2..bf291e2fb4 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.c @@ -72,53 +72,53 @@ void deleteArray(double *array) void initialiseVariables(double voi, double *states, double *rates, double *constants, ExternalVariable externalVariable) { - variables[4] = 1.0; - variables[5] = 0.0; - variables[7] = 0.3; - variables[9] = 120.0; - variables[15] = 36.0; + constants[4] = 1.0; + constants[5] = 0.0; + constants[7] = 0.3; + constants[9] = 120.0; + constants[15] = 36.0; states[0] = 0.0; states[1] = 0.6; states[2] = 0.05; states[3] = 0.325; - variables[6] = externalVariable(voi, states, rates, variables, 6); + algebraic[6] = externalVariable(voi, states, rates, variables, 6); } void computeComputedConstants(double *constants, double *computedConstants) { - variables[8] = variables[5]-115.0; - variables[14] = variables[5]+12.0; + computedConstants[8] = constants[5]-115.0; + computedConstants[14] = constants[5]+12.0; } void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) { - variables[0] = ((voi >= 10.0) && (voi <= 10.5))?-20.0:0.0; - variables[6] = externalVariable(voi, states, rates, variables, 6); - variables[1] = variables[7]*(states[0]-variables[6]); - variables[2] = variables[15]*pow(states[3], 4.0)*(states[0]-variables[14]); - variables[3] = variables[9]*pow(states[2], 3.0)*states[1]*(states[0]-variables[8]); - rates[0] = -(-variables[0]+variables[3]+variables[2]+variables[1])/variables[4]; - variables[10] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0); - variables[11] = 4.0*exp(states[0]/18.0); - rates[2] = variables[10]*(1.0-states[2])-variables[11]*states[2]; - variables[12] = 0.07*exp(states[0]/20.0); - variables[13] = 1.0/(exp((states[0]+30.0)/10.0)+1.0); - rates[1] = variables[12]*(1.0-states[1])-variables[13]*states[1]; - variables[16] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0); - variables[17] = 0.125*exp(states[0]/80.0); - rates[3] = variables[16]*(1.0-states[3])-variables[17]*states[3]; + algebraic[0] = ((voi >= 10.0) && (voi <= 10.5))?-20.0:0.0; + algebraic[6] = externalVariable(voi, states, rates, variables, 6); + algebraic[1] = constants[7]*(states[0]-algebraic[6]); + algebraic[2] = constants[15]*pow(states[3], 4.0)*(states[0]-computedConstants[14]); + algebraic[3] = constants[9]*pow(states[2], 3.0)*states[1]*(states[0]-computedConstants[8]); + rates[0] = -(-algebraic[0]+algebraic[3]+algebraic[2]+algebraic[1])/constants[4]; + algebraic[10] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0); + algebraic[11] = 4.0*exp(states[0]/18.0); + rates[2] = algebraic[10]*(1.0-states[2])-algebraic[11]*states[2]; + algebraic[12] = 0.07*exp(states[0]/20.0); + algebraic[13] = 1.0/(exp((states[0]+30.0)/10.0)+1.0); + rates[1] = algebraic[12]*(1.0-states[1])-algebraic[13]*states[1]; + algebraic[16] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0); + algebraic[17] = 0.125*exp(states[0]/80.0); + rates[3] = algebraic[16]*(1.0-states[3])-algebraic[17]*states[3]; } void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) { - variables[6] = externalVariable(voi, states, rates, variables, 6); - variables[1] = variables[7]*(states[0]-variables[6]); - variables[3] = variables[9]*pow(states[2], 3.0)*states[1]*(states[0]-variables[8]); - variables[10] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0); - variables[11] = 4.0*exp(states[0]/18.0); - variables[12] = 0.07*exp(states[0]/20.0); - variables[13] = 1.0/(exp((states[0]+30.0)/10.0)+1.0); - variables[2] = variables[15]*pow(states[3], 4.0)*(states[0]-variables[14]); - variables[16] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0); - variables[17] = 0.125*exp(states[0]/80.0); + algebraic[6] = externalVariable(voi, states, rates, variables, 6); + algebraic[1] = constants[7]*(states[0]-algebraic[6]); + algebraic[3] = constants[9]*pow(states[2], 3.0)*states[1]*(states[0]-computedConstants[8]); + algebraic[10] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0); + algebraic[11] = 4.0*exp(states[0]/18.0); + algebraic[12] = 0.07*exp(states[0]/20.0); + algebraic[13] = 1.0/(exp((states[0]+30.0)/10.0)+1.0); + algebraic[2] = constants[15]*pow(states[3], 4.0)*(states[0]-computedConstants[14]); + algebraic[16] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0); + algebraic[17] = 0.125*exp(states[0]/80.0); } diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.py index a68331edb9..2a928ef7fa 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.py @@ -74,49 +74,49 @@ def create_variables_array(): def initialise_variables(voi, states, rates, constants, external_variable): - variables[4] = 1.0 - variables[5] = 0.0 - variables[7] = 0.3 - variables[9] = 120.0 - variables[15] = 36.0 + constants[4] = 1.0 + constants[5] = 0.0 + constants[7] = 0.3 + constants[9] = 120.0 + constants[15] = 36.0 states[0] = 0.0 states[1] = 0.6 states[2] = 0.05 states[3] = 0.325 - variables[6] = external_variable(voi, states, rates, variables, 6) + algebraic[6] = external_variable(voi, states, rates, variables, 6) def compute_computed_constants(constants, computed_constants): - variables[8] = variables[5]-115.0 - variables[14] = variables[5]+12.0 + computed_constants[8] = constants[5]-115.0 + computed_constants[14] = constants[5]+12.0 def compute_rates(voi, states, rates, constants, computed_constants, algebraic, external_variable): - variables[0] = -20.0 if and_func(geq_func(voi, 10.0), leq_func(voi, 10.5)) else 0.0 - variables[6] = external_variable(voi, states, rates, variables, 6) - variables[1] = variables[7]*(states[0]-variables[6]) - variables[2] = variables[15]*pow(states[3], 4.0)*(states[0]-variables[14]) - variables[3] = variables[9]*pow(states[2], 3.0)*states[1]*(states[0]-variables[8]) - rates[0] = -(-variables[0]+variables[3]+variables[2]+variables[1])/variables[4] - variables[10] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0) - variables[11] = 4.0*exp(states[0]/18.0) - rates[2] = variables[10]*(1.0-states[2])-variables[11]*states[2] - variables[12] = 0.07*exp(states[0]/20.0) - variables[13] = 1.0/(exp((states[0]+30.0)/10.0)+1.0) - rates[1] = variables[12]*(1.0-states[1])-variables[13]*states[1] - variables[16] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0) - variables[17] = 0.125*exp(states[0]/80.0) - rates[3] = variables[16]*(1.0-states[3])-variables[17]*states[3] + algebraic[0] = -20.0 if and_func(geq_func(voi, 10.0), leq_func(voi, 10.5)) else 0.0 + algebraic[6] = external_variable(voi, states, rates, variables, 6) + algebraic[1] = constants[7]*(states[0]-algebraic[6]) + algebraic[2] = constants[15]*pow(states[3], 4.0)*(states[0]-computed_constants[14]) + algebraic[3] = constants[9]*pow(states[2], 3.0)*states[1]*(states[0]-computed_constants[8]) + rates[0] = -(-algebraic[0]+algebraic[3]+algebraic[2]+algebraic[1])/constants[4] + algebraic[10] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0) + algebraic[11] = 4.0*exp(states[0]/18.0) + rates[2] = algebraic[10]*(1.0-states[2])-algebraic[11]*states[2] + algebraic[12] = 0.07*exp(states[0]/20.0) + algebraic[13] = 1.0/(exp((states[0]+30.0)/10.0)+1.0) + rates[1] = algebraic[12]*(1.0-states[1])-algebraic[13]*states[1] + algebraic[16] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0) + algebraic[17] = 0.125*exp(states[0]/80.0) + rates[3] = algebraic[16]*(1.0-states[3])-algebraic[17]*states[3] def compute_variables(voi, states, rates, constants, computed_constants, algebraic, external_variable): - variables[6] = external_variable(voi, states, rates, variables, 6) - variables[1] = variables[7]*(states[0]-variables[6]) - variables[3] = variables[9]*pow(states[2], 3.0)*states[1]*(states[0]-variables[8]) - variables[10] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0) - variables[11] = 4.0*exp(states[0]/18.0) - variables[12] = 0.07*exp(states[0]/20.0) - variables[13] = 1.0/(exp((states[0]+30.0)/10.0)+1.0) - variables[2] = variables[15]*pow(states[3], 4.0)*(states[0]-variables[14]) - variables[16] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0) - variables[17] = 0.125*exp(states[0]/80.0) + algebraic[6] = external_variable(voi, states, rates, variables, 6) + algebraic[1] = constants[7]*(states[0]-algebraic[6]) + algebraic[3] = constants[9]*pow(states[2], 3.0)*states[1]*(states[0]-computed_constants[8]) + algebraic[10] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0) + algebraic[11] = 4.0*exp(states[0]/18.0) + algebraic[12] = 0.07*exp(states[0]/20.0) + algebraic[13] = 1.0/(exp((states[0]+30.0)/10.0)+1.0) + algebraic[2] = constants[15]*pow(states[3], 4.0)*(states[0]-computed_constants[14]) + algebraic[16] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0) + algebraic[17] = 0.125*exp(states[0]/80.0) diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.c index 074683762c..f3d7255142 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.c @@ -72,53 +72,53 @@ void deleteArray(double *array) void initialiseVariables(double voi, double *states, double *rates, double *constants, ExternalVariable externalVariable) { - variables[5] = 0.0; - variables[7] = 0.3; - variables[9] = 120.0; - variables[15] = 36.0; + constants[5] = 0.0; + constants[7] = 0.3; + constants[9] = 120.0; + constants[15] = 36.0; states[0] = 0.0; states[1] = 0.6; states[2] = 0.05; states[3] = 0.325; - variables[4] = externalVariable(voi, states, rates, variables, 4); + algebraic[4] = externalVariable(voi, states, rates, variables, 4); } void computeComputedConstants(double *constants, double *computedConstants) { - variables[6] = variables[5]-10.613; - variables[8] = variables[5]-115.0; - variables[14] = variables[5]+12.0; + computedConstants[6] = constants[5]-10.613; + computedConstants[8] = constants[5]-115.0; + computedConstants[14] = constants[5]+12.0; } void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) { - variables[0] = ((voi >= 10.0) && (voi <= 10.5))?-20.0:0.0; - variables[4] = externalVariable(voi, states, rates, variables, 4); - variables[1] = variables[7]*(states[0]-variables[6]); - variables[2] = variables[15]*pow(states[3], 4.0)*(states[0]-variables[14]); - variables[3] = variables[9]*pow(states[2], 3.0)*states[1]*(states[0]-variables[8]); - rates[0] = -(-variables[0]+variables[3]+variables[2]+variables[1])/variables[4]; - variables[10] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0); - variables[11] = 4.0*exp(states[0]/18.0); - rates[2] = variables[10]*(1.0-states[2])-variables[11]*states[2]; - variables[12] = 0.07*exp(states[0]/20.0); - variables[13] = 1.0/(exp((states[0]+30.0)/10.0)+1.0); - rates[1] = variables[12]*(1.0-states[1])-variables[13]*states[1]; - variables[16] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0); - variables[17] = 0.125*exp(states[0]/80.0); - rates[3] = variables[16]*(1.0-states[3])-variables[17]*states[3]; + algebraic[0] = ((voi >= 10.0) && (voi <= 10.5))?-20.0:0.0; + algebraic[4] = externalVariable(voi, states, rates, variables, 4); + algebraic[1] = constants[7]*(states[0]-computedConstants[6]); + algebraic[2] = constants[15]*pow(states[3], 4.0)*(states[0]-computedConstants[14]); + algebraic[3] = constants[9]*pow(states[2], 3.0)*states[1]*(states[0]-computedConstants[8]); + rates[0] = -(-algebraic[0]+algebraic[3]+algebraic[2]+algebraic[1])/algebraic[4]; + algebraic[10] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0); + algebraic[11] = 4.0*exp(states[0]/18.0); + rates[2] = algebraic[10]*(1.0-states[2])-algebraic[11]*states[2]; + algebraic[12] = 0.07*exp(states[0]/20.0); + algebraic[13] = 1.0/(exp((states[0]+30.0)/10.0)+1.0); + rates[1] = algebraic[12]*(1.0-states[1])-algebraic[13]*states[1]; + algebraic[16] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0); + algebraic[17] = 0.125*exp(states[0]/80.0); + rates[3] = algebraic[16]*(1.0-states[3])-algebraic[17]*states[3]; } void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) { - variables[1] = variables[7]*(states[0]-variables[6]); - variables[3] = variables[9]*pow(states[2], 3.0)*states[1]*(states[0]-variables[8]); - variables[10] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0); - variables[11] = 4.0*exp(states[0]/18.0); - variables[12] = 0.07*exp(states[0]/20.0); - variables[13] = 1.0/(exp((states[0]+30.0)/10.0)+1.0); - variables[2] = variables[15]*pow(states[3], 4.0)*(states[0]-variables[14]); - variables[16] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0); - variables[17] = 0.125*exp(states[0]/80.0); - variables[4] = externalVariable(voi, states, rates, variables, 4); + algebraic[1] = constants[7]*(states[0]-computedConstants[6]); + algebraic[3] = constants[9]*pow(states[2], 3.0)*states[1]*(states[0]-computedConstants[8]); + algebraic[10] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0); + algebraic[11] = 4.0*exp(states[0]/18.0); + algebraic[12] = 0.07*exp(states[0]/20.0); + algebraic[13] = 1.0/(exp((states[0]+30.0)/10.0)+1.0); + algebraic[2] = constants[15]*pow(states[3], 4.0)*(states[0]-computedConstants[14]); + algebraic[16] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0); + algebraic[17] = 0.125*exp(states[0]/80.0); + algebraic[4] = externalVariable(voi, states, rates, variables, 4); } diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.py index ea8e627d86..99304a266e 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.py @@ -74,49 +74,49 @@ def create_variables_array(): def initialise_variables(voi, states, rates, constants, external_variable): - variables[5] = 0.0 - variables[7] = 0.3 - variables[9] = 120.0 - variables[15] = 36.0 + constants[5] = 0.0 + constants[7] = 0.3 + constants[9] = 120.0 + constants[15] = 36.0 states[0] = 0.0 states[1] = 0.6 states[2] = 0.05 states[3] = 0.325 - variables[4] = external_variable(voi, states, rates, variables, 4) + algebraic[4] = external_variable(voi, states, rates, variables, 4) def compute_computed_constants(constants, computed_constants): - variables[6] = variables[5]-10.613 - variables[8] = variables[5]-115.0 - variables[14] = variables[5]+12.0 + computed_constants[6] = constants[5]-10.613 + computed_constants[8] = constants[5]-115.0 + computed_constants[14] = constants[5]+12.0 def compute_rates(voi, states, rates, constants, computed_constants, algebraic, external_variable): - variables[0] = -20.0 if and_func(geq_func(voi, 10.0), leq_func(voi, 10.5)) else 0.0 - variables[4] = external_variable(voi, states, rates, variables, 4) - variables[1] = variables[7]*(states[0]-variables[6]) - variables[2] = variables[15]*pow(states[3], 4.0)*(states[0]-variables[14]) - variables[3] = variables[9]*pow(states[2], 3.0)*states[1]*(states[0]-variables[8]) - rates[0] = -(-variables[0]+variables[3]+variables[2]+variables[1])/variables[4] - variables[10] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0) - variables[11] = 4.0*exp(states[0]/18.0) - rates[2] = variables[10]*(1.0-states[2])-variables[11]*states[2] - variables[12] = 0.07*exp(states[0]/20.0) - variables[13] = 1.0/(exp((states[0]+30.0)/10.0)+1.0) - rates[1] = variables[12]*(1.0-states[1])-variables[13]*states[1] - variables[16] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0) - variables[17] = 0.125*exp(states[0]/80.0) - rates[3] = variables[16]*(1.0-states[3])-variables[17]*states[3] + algebraic[0] = -20.0 if and_func(geq_func(voi, 10.0), leq_func(voi, 10.5)) else 0.0 + algebraic[4] = external_variable(voi, states, rates, variables, 4) + algebraic[1] = constants[7]*(states[0]-computed_constants[6]) + algebraic[2] = constants[15]*pow(states[3], 4.0)*(states[0]-computed_constants[14]) + algebraic[3] = constants[9]*pow(states[2], 3.0)*states[1]*(states[0]-computed_constants[8]) + rates[0] = -(-algebraic[0]+algebraic[3]+algebraic[2]+algebraic[1])/algebraic[4] + algebraic[10] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0) + algebraic[11] = 4.0*exp(states[0]/18.0) + rates[2] = algebraic[10]*(1.0-states[2])-algebraic[11]*states[2] + algebraic[12] = 0.07*exp(states[0]/20.0) + algebraic[13] = 1.0/(exp((states[0]+30.0)/10.0)+1.0) + rates[1] = algebraic[12]*(1.0-states[1])-algebraic[13]*states[1] + algebraic[16] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0) + algebraic[17] = 0.125*exp(states[0]/80.0) + rates[3] = algebraic[16]*(1.0-states[3])-algebraic[17]*states[3] def compute_variables(voi, states, rates, constants, computed_constants, algebraic, external_variable): - variables[1] = variables[7]*(states[0]-variables[6]) - variables[3] = variables[9]*pow(states[2], 3.0)*states[1]*(states[0]-variables[8]) - variables[10] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0) - variables[11] = 4.0*exp(states[0]/18.0) - variables[12] = 0.07*exp(states[0]/20.0) - variables[13] = 1.0/(exp((states[0]+30.0)/10.0)+1.0) - variables[2] = variables[15]*pow(states[3], 4.0)*(states[0]-variables[14]) - variables[16] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0) - variables[17] = 0.125*exp(states[0]/80.0) - variables[4] = external_variable(voi, states, rates, variables, 4) + algebraic[1] = constants[7]*(states[0]-computed_constants[6]) + algebraic[3] = constants[9]*pow(states[2], 3.0)*states[1]*(states[0]-computed_constants[8]) + algebraic[10] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0) + algebraic[11] = 4.0*exp(states[0]/18.0) + algebraic[12] = 0.07*exp(states[0]/20.0) + algebraic[13] = 1.0/(exp((states[0]+30.0)/10.0)+1.0) + algebraic[2] = constants[15]*pow(states[3], 4.0)*(states[0]-computed_constants[14]) + algebraic[16] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0) + algebraic[17] = 0.125*exp(states[0]/80.0) + algebraic[4] = external_variable(voi, states, rates, variables, 4) diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.c index 3dd59ed73c..79d7df0822 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.c @@ -87,9 +87,9 @@ void objectiveFunction0(double *u, double *f, void *data) double *rates = ((RootFindingInfo *) data)->rates; double *variables = ((RootFindingInfo *) data)->variables; - variables[0] = u[0]; + algebraic[0] = u[0]; - f[0] = variables[0]-(((voi >= 10.0) && (voi <= 10.5))?-20.0:0.0)-0.0; + f[0] = algebraic[0]-(((voi >= 10.0) && (voi <= 10.5))?-20.0:0.0)-0.0; } void findRoot0(double voi, double *states, double *rates, double *variables) @@ -97,11 +97,11 @@ void findRoot0(double voi, double *states, double *rates, double *variables) RootFindingInfo rfi = { voi, states, rates, variables }; double u[1]; - u[0] = variables[0]; + u[0] = algebraic[0]; nlaSolve(objectiveFunction0, u, 1, &rfi); - variables[0] = u[0]; + algebraic[0] = u[0]; } void objectiveFunction1(double *u, double *f, void *data) @@ -113,7 +113,7 @@ void objectiveFunction1(double *u, double *f, void *data) rates[0] = u[0]; - f[0] = rates[0]-(-(-variables[0]+variables[3]+variables[2]+variables[1])/variables[4])-0.0; + f[0] = rates[0]-(-(-algebraic[0]+algebraic[3]+algebraic[2]+algebraic[1])/constants[4])-0.0; } void findRoot1(double voi, double *states, double *rates, double *variables) @@ -135,9 +135,9 @@ void objectiveFunction2(double *u, double *f, void *data) double *rates = ((RootFindingInfo *) data)->rates; double *variables = ((RootFindingInfo *) data)->variables; - variables[6] = u[0]; + computedConstants[6] = u[0]; - f[0] = variables[6]-(variables[5]-10.613)-0.0; + f[0] = computedConstants[6]-(constants[5]-10.613)-0.0; } void findRoot2(double voi, double *states, double *rates, double *variables) @@ -145,11 +145,11 @@ void findRoot2(double voi, double *states, double *rates, double *variables) RootFindingInfo rfi = { voi, states, rates, variables }; double u[1]; - u[0] = variables[6]; + u[0] = algebraic[6]; nlaSolve(objectiveFunction2, u, 1, &rfi); - variables[6] = u[0]; + algebraic[6] = u[0]; } void objectiveFunction3(double *u, double *f, void *data) @@ -159,9 +159,9 @@ void objectiveFunction3(double *u, double *f, void *data) double *rates = ((RootFindingInfo *) data)->rates; double *variables = ((RootFindingInfo *) data)->variables; - variables[1] = u[0]; + algebraic[1] = u[0]; - f[0] = variables[1]-variables[7]*(states[0]-variables[6])-0.0; + f[0] = algebraic[1]-constants[7]*(states[0]-computedConstants[6])-0.0; } void findRoot3(double voi, double *states, double *rates, double *variables) @@ -169,11 +169,11 @@ void findRoot3(double voi, double *states, double *rates, double *variables) RootFindingInfo rfi = { voi, states, rates, variables }; double u[1]; - u[0] = variables[1]; + u[0] = algebraic[1]; nlaSolve(objectiveFunction3, u, 1, &rfi); - variables[1] = u[0]; + algebraic[1] = u[0]; } void objectiveFunction4(double *u, double *f, void *data) @@ -183,9 +183,9 @@ void objectiveFunction4(double *u, double *f, void *data) double *rates = ((RootFindingInfo *) data)->rates; double *variables = ((RootFindingInfo *) data)->variables; - variables[8] = u[0]; + computedConstants[8] = u[0]; - f[0] = variables[8]-(variables[5]-115.0)-0.0; + f[0] = computedConstants[8]-(constants[5]-115.0)-0.0; } void findRoot4(double voi, double *states, double *rates, double *variables) @@ -193,11 +193,11 @@ void findRoot4(double voi, double *states, double *rates, double *variables) RootFindingInfo rfi = { voi, states, rates, variables }; double u[1]; - u[0] = variables[8]; + u[0] = algebraic[8]; nlaSolve(objectiveFunction4, u, 1, &rfi); - variables[8] = u[0]; + algebraic[8] = u[0]; } void objectiveFunction5(double *u, double *f, void *data) @@ -207,9 +207,9 @@ void objectiveFunction5(double *u, double *f, void *data) double *rates = ((RootFindingInfo *) data)->rates; double *variables = ((RootFindingInfo *) data)->variables; - variables[3] = u[0]; + algebraic[3] = u[0]; - f[0] = variables[3]-variables[9]*pow(states[2], 3.0)*states[1]*(states[0]-variables[8])-0.0; + f[0] = algebraic[3]-constants[9]*pow(states[2], 3.0)*states[1]*(states[0]-computedConstants[8])-0.0; } void findRoot5(double voi, double *states, double *rates, double *variables) @@ -217,11 +217,11 @@ void findRoot5(double voi, double *states, double *rates, double *variables) RootFindingInfo rfi = { voi, states, rates, variables }; double u[1]; - u[0] = variables[3]; + u[0] = algebraic[3]; nlaSolve(objectiveFunction5, u, 1, &rfi); - variables[3] = u[0]; + algebraic[3] = u[0]; } void objectiveFunction6(double *u, double *f, void *data) @@ -231,9 +231,9 @@ void objectiveFunction6(double *u, double *f, void *data) double *rates = ((RootFindingInfo *) data)->rates; double *variables = ((RootFindingInfo *) data)->variables; - variables[10] = u[0]; + algebraic[10] = u[0]; - f[0] = variables[10]-0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0)-0.0; + f[0] = algebraic[10]-0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0)-0.0; } void findRoot6(double voi, double *states, double *rates, double *variables) @@ -241,11 +241,11 @@ void findRoot6(double voi, double *states, double *rates, double *variables) RootFindingInfo rfi = { voi, states, rates, variables }; double u[1]; - u[0] = variables[10]; + u[0] = algebraic[10]; nlaSolve(objectiveFunction6, u, 1, &rfi); - variables[10] = u[0]; + algebraic[10] = u[0]; } void objectiveFunction7(double *u, double *f, void *data) @@ -255,9 +255,9 @@ void objectiveFunction7(double *u, double *f, void *data) double *rates = ((RootFindingInfo *) data)->rates; double *variables = ((RootFindingInfo *) data)->variables; - variables[11] = u[0]; + algebraic[11] = u[0]; - f[0] = variables[11]-4.0*exp(states[0]/18.0)-0.0; + f[0] = algebraic[11]-4.0*exp(states[0]/18.0)-0.0; } void findRoot7(double voi, double *states, double *rates, double *variables) @@ -265,11 +265,11 @@ void findRoot7(double voi, double *states, double *rates, double *variables) RootFindingInfo rfi = { voi, states, rates, variables }; double u[1]; - u[0] = variables[11]; + u[0] = algebraic[11]; nlaSolve(objectiveFunction7, u, 1, &rfi); - variables[11] = u[0]; + algebraic[11] = u[0]; } void objectiveFunction8(double *u, double *f, void *data) @@ -281,7 +281,7 @@ void objectiveFunction8(double *u, double *f, void *data) rates[2] = u[0]; - f[0] = rates[2]-(variables[10]*(1.0-states[2])-variables[11]*states[2])-0.0; + f[0] = rates[2]-(algebraic[10]*(1.0-states[2])-algebraic[11]*states[2])-0.0; } void findRoot8(double voi, double *states, double *rates, double *variables) @@ -303,9 +303,9 @@ void objectiveFunction9(double *u, double *f, void *data) double *rates = ((RootFindingInfo *) data)->rates; double *variables = ((RootFindingInfo *) data)->variables; - variables[12] = u[0]; + algebraic[12] = u[0]; - f[0] = variables[12]-0.07*exp(states[0]/20.0)-0.0; + f[0] = algebraic[12]-0.07*exp(states[0]/20.0)-0.0; } void findRoot9(double voi, double *states, double *rates, double *variables) @@ -313,11 +313,11 @@ void findRoot9(double voi, double *states, double *rates, double *variables) RootFindingInfo rfi = { voi, states, rates, variables }; double u[1]; - u[0] = variables[12]; + u[0] = algebraic[12]; nlaSolve(objectiveFunction9, u, 1, &rfi); - variables[12] = u[0]; + algebraic[12] = u[0]; } void objectiveFunction10(double *u, double *f, void *data) @@ -327,9 +327,9 @@ void objectiveFunction10(double *u, double *f, void *data) double *rates = ((RootFindingInfo *) data)->rates; double *variables = ((RootFindingInfo *) data)->variables; - variables[13] = u[0]; + algebraic[13] = u[0]; - f[0] = variables[13]-1.0/(exp((states[0]+30.0)/10.0)+1.0)-0.0; + f[0] = algebraic[13]-1.0/(exp((states[0]+30.0)/10.0)+1.0)-0.0; } void findRoot10(double voi, double *states, double *rates, double *variables) @@ -337,11 +337,11 @@ void findRoot10(double voi, double *states, double *rates, double *variables) RootFindingInfo rfi = { voi, states, rates, variables }; double u[1]; - u[0] = variables[13]; + u[0] = algebraic[13]; nlaSolve(objectiveFunction10, u, 1, &rfi); - variables[13] = u[0]; + algebraic[13] = u[0]; } void objectiveFunction11(double *u, double *f, void *data) @@ -353,7 +353,7 @@ void objectiveFunction11(double *u, double *f, void *data) rates[1] = u[0]; - f[0] = rates[1]-(variables[12]*(1.0-states[1])-variables[13]*states[1])-0.0; + f[0] = rates[1]-(algebraic[12]*(1.0-states[1])-algebraic[13]*states[1])-0.0; } void findRoot11(double voi, double *states, double *rates, double *variables) @@ -375,9 +375,9 @@ void objectiveFunction12(double *u, double *f, void *data) double *rates = ((RootFindingInfo *) data)->rates; double *variables = ((RootFindingInfo *) data)->variables; - variables[14] = u[0]; + computedConstants[14] = u[0]; - f[0] = variables[14]-(variables[5]+12.0)-0.0; + f[0] = computedConstants[14]-(constants[5]+12.0)-0.0; } void findRoot12(double voi, double *states, double *rates, double *variables) @@ -385,11 +385,11 @@ void findRoot12(double voi, double *states, double *rates, double *variables) RootFindingInfo rfi = { voi, states, rates, variables }; double u[1]; - u[0] = variables[14]; + u[0] = algebraic[14]; nlaSolve(objectiveFunction12, u, 1, &rfi); - variables[14] = u[0]; + algebraic[14] = u[0]; } void objectiveFunction13(double *u, double *f, void *data) @@ -399,9 +399,9 @@ void objectiveFunction13(double *u, double *f, void *data) double *rates = ((RootFindingInfo *) data)->rates; double *variables = ((RootFindingInfo *) data)->variables; - variables[2] = u[0]; + algebraic[2] = u[0]; - f[0] = variables[2]-variables[15]*pow(states[3], 4.0)*(states[0]-variables[14])-0.0; + f[0] = algebraic[2]-constants[15]*pow(states[3], 4.0)*(states[0]-computedConstants[14])-0.0; } void findRoot13(double voi, double *states, double *rates, double *variables) @@ -409,11 +409,11 @@ void findRoot13(double voi, double *states, double *rates, double *variables) RootFindingInfo rfi = { voi, states, rates, variables }; double u[1]; - u[0] = variables[2]; + u[0] = algebraic[2]; nlaSolve(objectiveFunction13, u, 1, &rfi); - variables[2] = u[0]; + algebraic[2] = u[0]; } void objectiveFunction14(double *u, double *f, void *data) @@ -423,9 +423,9 @@ void objectiveFunction14(double *u, double *f, void *data) double *rates = ((RootFindingInfo *) data)->rates; double *variables = ((RootFindingInfo *) data)->variables; - variables[16] = u[0]; + algebraic[16] = u[0]; - f[0] = variables[16]-0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0)-0.0; + f[0] = algebraic[16]-0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0)-0.0; } void findRoot14(double voi, double *states, double *rates, double *variables) @@ -433,11 +433,11 @@ void findRoot14(double voi, double *states, double *rates, double *variables) RootFindingInfo rfi = { voi, states, rates, variables }; double u[1]; - u[0] = variables[16]; + u[0] = algebraic[16]; nlaSolve(objectiveFunction14, u, 1, &rfi); - variables[16] = u[0]; + algebraic[16] = u[0]; } void objectiveFunction15(double *u, double *f, void *data) @@ -447,9 +447,9 @@ void objectiveFunction15(double *u, double *f, void *data) double *rates = ((RootFindingInfo *) data)->rates; double *variables = ((RootFindingInfo *) data)->variables; - variables[17] = u[0]; + algebraic[17] = u[0]; - f[0] = variables[17]-0.125*exp(states[0]/80.0)-0.0; + f[0] = algebraic[17]-0.125*exp(states[0]/80.0)-0.0; } void findRoot15(double voi, double *states, double *rates, double *variables) @@ -457,11 +457,11 @@ void findRoot15(double voi, double *states, double *rates, double *variables) RootFindingInfo rfi = { voi, states, rates, variables }; double u[1]; - u[0] = variables[17]; + u[0] = algebraic[17]; nlaSolve(objectiveFunction15, u, 1, &rfi); - variables[17] = u[0]; + algebraic[17] = u[0]; } void objectiveFunction16(double *u, double *f, void *data) @@ -473,7 +473,7 @@ void objectiveFunction16(double *u, double *f, void *data) rates[3] = u[0]; - f[0] = rates[3]-(variables[16]*(1.0-states[3])-variables[17]*states[3])-0.0; + f[0] = rates[3]-(algebraic[16]*(1.0-states[3])-algebraic[17]*states[3])-0.0; } void findRoot16(double voi, double *states, double *rates, double *variables) @@ -490,24 +490,24 @@ void findRoot16(double voi, double *states, double *rates, double *variables) void initialiseVariables(double *states, double *rates, double *constants) { - variables[0] = 0.0; - variables[1] = 0.0; - variables[2] = 0.0; - variables[3] = 0.0; - variables[4] = 1.0; - variables[5] = 0.0; - variables[6] = 0.0; - variables[7] = 0.3; - variables[8] = 0.0; - variables[9] = 120.0; - variables[10] = 0.0; - variables[11] = 0.0; - variables[12] = 0.0; - variables[13] = 0.0; - variables[14] = 0.0; - variables[15] = 36.0; - variables[16] = 0.0; - variables[17] = 0.0; + algebraic[0] = 0.0; + algebraic[1] = 0.0; + algebraic[2] = 0.0; + algebraic[3] = 0.0; + constants[4] = 1.0; + constants[5] = 0.0; + computedConstants[6] = 0.0; + constants[7] = 0.3; + computedConstants[8] = 0.0; + constants[9] = 120.0; + algebraic[10] = 0.0; + algebraic[11] = 0.0; + algebraic[12] = 0.0; + algebraic[13] = 0.0; + computedConstants[14] = 0.0; + constants[15] = 36.0; + algebraic[16] = 0.0; + algebraic[17] = 0.0; states[0] = 0.0; states[1] = 0.6; states[2] = 0.05; diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.py index b74a9e03c2..068073cbd5 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.py @@ -81,19 +81,19 @@ def objective_function_0(u, f, data): rates = data[2] variables = data[3] - variables[0] = u[0] + algebraic[0] = u[0] - f[0] = variables[0]-(-20.0 if and_func(geq_func(voi, 10.0), leq_func(voi, 10.5)) else 0.0)-0.0 + f[0] = algebraic[0]-(-20.0 if and_func(geq_func(voi, 10.0), leq_func(voi, 10.5)) else 0.0)-0.0 def find_root_0(voi, states, rates, variables): u = [nan]*1 - u[0] = variables[0] + u[0] = algebraic[0] u = nla_solve(objective_function_0, u, 1, [voi, states, rates, variables]) - variables[0] = u[0] + algebraic[0] = u[0] def objective_function_1(u, f, data): @@ -104,7 +104,7 @@ def objective_function_1(u, f, data): rates[0] = u[0] - f[0] = rates[0]-(-(-variables[0]+variables[3]+variables[2]+variables[1])/variables[4])-0.0 + f[0] = rates[0]-(-(-algebraic[0]+algebraic[3]+algebraic[2]+algebraic[1])/constants[4])-0.0 def find_root_1(voi, states, rates, variables): @@ -123,19 +123,19 @@ def objective_function_2(u, f, data): rates = data[2] variables = data[3] - variables[6] = u[0] + computed_constants[6] = u[0] - f[0] = variables[6]-(variables[5]-10.613)-0.0 + f[0] = computed_constants[6]-(constants[5]-10.613)-0.0 def find_root_2(voi, states, rates, variables): u = [nan]*1 - u[0] = variables[6] + u[0] = algebraic[6] u = nla_solve(objective_function_2, u, 1, [voi, states, rates, variables]) - variables[6] = u[0] + algebraic[6] = u[0] def objective_function_3(u, f, data): @@ -144,19 +144,19 @@ def objective_function_3(u, f, data): rates = data[2] variables = data[3] - variables[1] = u[0] + algebraic[1] = u[0] - f[0] = variables[1]-variables[7]*(states[0]-variables[6])-0.0 + f[0] = algebraic[1]-constants[7]*(states[0]-computed_constants[6])-0.0 def find_root_3(voi, states, rates, variables): u = [nan]*1 - u[0] = variables[1] + u[0] = algebraic[1] u = nla_solve(objective_function_3, u, 1, [voi, states, rates, variables]) - variables[1] = u[0] + algebraic[1] = u[0] def objective_function_4(u, f, data): @@ -165,19 +165,19 @@ def objective_function_4(u, f, data): rates = data[2] variables = data[3] - variables[8] = u[0] + computed_constants[8] = u[0] - f[0] = variables[8]-(variables[5]-115.0)-0.0 + f[0] = computed_constants[8]-(constants[5]-115.0)-0.0 def find_root_4(voi, states, rates, variables): u = [nan]*1 - u[0] = variables[8] + u[0] = algebraic[8] u = nla_solve(objective_function_4, u, 1, [voi, states, rates, variables]) - variables[8] = u[0] + algebraic[8] = u[0] def objective_function_5(u, f, data): @@ -186,19 +186,19 @@ def objective_function_5(u, f, data): rates = data[2] variables = data[3] - variables[3] = u[0] + algebraic[3] = u[0] - f[0] = variables[3]-variables[9]*pow(states[2], 3.0)*states[1]*(states[0]-variables[8])-0.0 + f[0] = algebraic[3]-constants[9]*pow(states[2], 3.0)*states[1]*(states[0]-computed_constants[8])-0.0 def find_root_5(voi, states, rates, variables): u = [nan]*1 - u[0] = variables[3] + u[0] = algebraic[3] u = nla_solve(objective_function_5, u, 1, [voi, states, rates, variables]) - variables[3] = u[0] + algebraic[3] = u[0] def objective_function_6(u, f, data): @@ -207,19 +207,19 @@ def objective_function_6(u, f, data): rates = data[2] variables = data[3] - variables[10] = u[0] + algebraic[10] = u[0] - f[0] = variables[10]-0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0)-0.0 + f[0] = algebraic[10]-0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0)-0.0 def find_root_6(voi, states, rates, variables): u = [nan]*1 - u[0] = variables[10] + u[0] = algebraic[10] u = nla_solve(objective_function_6, u, 1, [voi, states, rates, variables]) - variables[10] = u[0] + algebraic[10] = u[0] def objective_function_7(u, f, data): @@ -228,19 +228,19 @@ def objective_function_7(u, f, data): rates = data[2] variables = data[3] - variables[11] = u[0] + algebraic[11] = u[0] - f[0] = variables[11]-4.0*exp(states[0]/18.0)-0.0 + f[0] = algebraic[11]-4.0*exp(states[0]/18.0)-0.0 def find_root_7(voi, states, rates, variables): u = [nan]*1 - u[0] = variables[11] + u[0] = algebraic[11] u = nla_solve(objective_function_7, u, 1, [voi, states, rates, variables]) - variables[11] = u[0] + algebraic[11] = u[0] def objective_function_8(u, f, data): @@ -251,7 +251,7 @@ def objective_function_8(u, f, data): rates[2] = u[0] - f[0] = rates[2]-(variables[10]*(1.0-states[2])-variables[11]*states[2])-0.0 + f[0] = rates[2]-(algebraic[10]*(1.0-states[2])-algebraic[11]*states[2])-0.0 def find_root_8(voi, states, rates, variables): @@ -270,19 +270,19 @@ def objective_function_9(u, f, data): rates = data[2] variables = data[3] - variables[12] = u[0] + algebraic[12] = u[0] - f[0] = variables[12]-0.07*exp(states[0]/20.0)-0.0 + f[0] = algebraic[12]-0.07*exp(states[0]/20.0)-0.0 def find_root_9(voi, states, rates, variables): u = [nan]*1 - u[0] = variables[12] + u[0] = algebraic[12] u = nla_solve(objective_function_9, u, 1, [voi, states, rates, variables]) - variables[12] = u[0] + algebraic[12] = u[0] def objective_function_10(u, f, data): @@ -291,19 +291,19 @@ def objective_function_10(u, f, data): rates = data[2] variables = data[3] - variables[13] = u[0] + algebraic[13] = u[0] - f[0] = variables[13]-1.0/(exp((states[0]+30.0)/10.0)+1.0)-0.0 + f[0] = algebraic[13]-1.0/(exp((states[0]+30.0)/10.0)+1.0)-0.0 def find_root_10(voi, states, rates, variables): u = [nan]*1 - u[0] = variables[13] + u[0] = algebraic[13] u = nla_solve(objective_function_10, u, 1, [voi, states, rates, variables]) - variables[13] = u[0] + algebraic[13] = u[0] def objective_function_11(u, f, data): @@ -314,7 +314,7 @@ def objective_function_11(u, f, data): rates[1] = u[0] - f[0] = rates[1]-(variables[12]*(1.0-states[1])-variables[13]*states[1])-0.0 + f[0] = rates[1]-(algebraic[12]*(1.0-states[1])-algebraic[13]*states[1])-0.0 def find_root_11(voi, states, rates, variables): @@ -333,19 +333,19 @@ def objective_function_12(u, f, data): rates = data[2] variables = data[3] - variables[14] = u[0] + computed_constants[14] = u[0] - f[0] = variables[14]-(variables[5]+12.0)-0.0 + f[0] = computed_constants[14]-(constants[5]+12.0)-0.0 def find_root_12(voi, states, rates, variables): u = [nan]*1 - u[0] = variables[14] + u[0] = algebraic[14] u = nla_solve(objective_function_12, u, 1, [voi, states, rates, variables]) - variables[14] = u[0] + algebraic[14] = u[0] def objective_function_13(u, f, data): @@ -354,19 +354,19 @@ def objective_function_13(u, f, data): rates = data[2] variables = data[3] - variables[2] = u[0] + algebraic[2] = u[0] - f[0] = variables[2]-variables[15]*pow(states[3], 4.0)*(states[0]-variables[14])-0.0 + f[0] = algebraic[2]-constants[15]*pow(states[3], 4.0)*(states[0]-computed_constants[14])-0.0 def find_root_13(voi, states, rates, variables): u = [nan]*1 - u[0] = variables[2] + u[0] = algebraic[2] u = nla_solve(objective_function_13, u, 1, [voi, states, rates, variables]) - variables[2] = u[0] + algebraic[2] = u[0] def objective_function_14(u, f, data): @@ -375,19 +375,19 @@ def objective_function_14(u, f, data): rates = data[2] variables = data[3] - variables[16] = u[0] + algebraic[16] = u[0] - f[0] = variables[16]-0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0)-0.0 + f[0] = algebraic[16]-0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0)-0.0 def find_root_14(voi, states, rates, variables): u = [nan]*1 - u[0] = variables[16] + u[0] = algebraic[16] u = nla_solve(objective_function_14, u, 1, [voi, states, rates, variables]) - variables[16] = u[0] + algebraic[16] = u[0] def objective_function_15(u, f, data): @@ -396,19 +396,19 @@ def objective_function_15(u, f, data): rates = data[2] variables = data[3] - variables[17] = u[0] + algebraic[17] = u[0] - f[0] = variables[17]-0.125*exp(states[0]/80.0)-0.0 + f[0] = algebraic[17]-0.125*exp(states[0]/80.0)-0.0 def find_root_15(voi, states, rates, variables): u = [nan]*1 - u[0] = variables[17] + u[0] = algebraic[17] u = nla_solve(objective_function_15, u, 1, [voi, states, rates, variables]) - variables[17] = u[0] + algebraic[17] = u[0] def objective_function_16(u, f, data): @@ -419,7 +419,7 @@ def objective_function_16(u, f, data): rates[3] = u[0] - f[0] = rates[3]-(variables[16]*(1.0-states[3])-variables[17]*states[3])-0.0 + f[0] = rates[3]-(algebraic[16]*(1.0-states[3])-algebraic[17]*states[3])-0.0 def find_root_16(voi, states, rates, variables): @@ -433,24 +433,24 @@ def find_root_16(voi, states, rates, variables): def initialise_variables(states, rates, constants): - variables[0] = 0.0 - variables[1] = 0.0 - variables[2] = 0.0 - variables[3] = 0.0 - variables[4] = 1.0 - variables[5] = 0.0 - variables[6] = 0.0 - variables[7] = 0.3 - variables[8] = 0.0 - variables[9] = 120.0 - variables[10] = 0.0 - variables[11] = 0.0 - variables[12] = 0.0 - variables[13] = 0.0 - variables[14] = 0.0 - variables[15] = 36.0 - variables[16] = 0.0 - variables[17] = 0.0 + algebraic[0] = 0.0 + algebraic[1] = 0.0 + algebraic[2] = 0.0 + algebraic[3] = 0.0 + constants[4] = 1.0 + constants[5] = 0.0 + computed_constants[6] = 0.0 + constants[7] = 0.3 + computed_constants[8] = 0.0 + constants[9] = 120.0 + algebraic[10] = 0.0 + algebraic[11] = 0.0 + algebraic[12] = 0.0 + algebraic[13] = 0.0 + computed_constants[14] = 0.0 + constants[15] = 36.0 + algebraic[16] = 0.0 + algebraic[17] = 0.0 states[0] = 0.0 states[1] = 0.6 states[2] = 0.05 diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.c index d71fcc4104..9533f72f59 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.c @@ -72,54 +72,54 @@ void deleteArray(double *array) void initialiseVariables(double voi, double *states, double *rates, double *constants, ExternalVariable externalVariable) { - variables[4] = 1.0; - variables[5] = 0.0; - variables[7] = 0.3; - variables[9] = 120.0; - variables[15] = 36.0; + constants[4] = 1.0; + constants[5] = 0.0; + constants[7] = 0.3; + constants[9] = 120.0; + constants[15] = 36.0; states[0] = 0.0; states[1] = 0.6; states[2] = 0.05; states[3] = 0.325; - variables[17] = externalVariable(voi, states, rates, variables, 17); - variables[0] = externalVariable(voi, states, rates, variables, 0); + algebraic[17] = externalVariable(voi, states, rates, variables, 17); + algebraic[0] = externalVariable(voi, states, rates, variables, 0); } void computeComputedConstants(double *constants, double *computedConstants) { - variables[6] = variables[5]-10.613; - variables[8] = variables[5]-115.0; - variables[14] = variables[5]+12.0; + computedConstants[6] = constants[5]-10.613; + computedConstants[8] = constants[5]-115.0; + computedConstants[14] = constants[5]+12.0; } void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) { - variables[17] = externalVariable(voi, states, rates, variables, 17); - variables[0] = externalVariable(voi, states, rates, variables, 0); - variables[1] = variables[7]*(states[0]-variables[6]); - variables[2] = variables[15]*pow(states[3], 4.0)*(states[0]-variables[14]); - variables[3] = variables[9]*pow(states[2], 3.0)*states[1]*(states[0]-variables[8]); - rates[0] = -(-variables[0]+variables[3]+variables[2]+variables[1])/variables[4]; - variables[10] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0); - variables[11] = 4.0*exp(states[0]/18.0); - rates[2] = variables[10]*(1.0-states[2])-variables[11]*states[2]; - variables[12] = 0.07*exp(states[0]/20.0); - variables[13] = 1.0/(exp((states[0]+30.0)/10.0)+1.0); - rates[1] = variables[12]*(1.0-states[1])-variables[13]*states[1]; - variables[16] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0); - rates[3] = variables[16]*(1.0-states[3])-variables[17]*states[3]; + algebraic[17] = externalVariable(voi, states, rates, variables, 17); + algebraic[0] = externalVariable(voi, states, rates, variables, 0); + algebraic[1] = constants[7]*(states[0]-computedConstants[6]); + algebraic[2] = constants[15]*pow(states[3], 4.0)*(states[0]-computedConstants[14]); + algebraic[3] = constants[9]*pow(states[2], 3.0)*states[1]*(states[0]-computedConstants[8]); + rates[0] = -(-algebraic[0]+algebraic[3]+algebraic[2]+algebraic[1])/constants[4]; + algebraic[10] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0); + algebraic[11] = 4.0*exp(states[0]/18.0); + rates[2] = algebraic[10]*(1.0-states[2])-algebraic[11]*states[2]; + algebraic[12] = 0.07*exp(states[0]/20.0); + algebraic[13] = 1.0/(exp((states[0]+30.0)/10.0)+1.0); + rates[1] = algebraic[12]*(1.0-states[1])-algebraic[13]*states[1]; + algebraic[16] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0); + rates[3] = algebraic[16]*(1.0-states[3])-algebraic[17]*states[3]; } void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) { - variables[17] = externalVariable(voi, states, rates, variables, 17); - variables[0] = externalVariable(voi, states, rates, variables, 0); - variables[1] = variables[7]*(states[0]-variables[6]); - variables[3] = variables[9]*pow(states[2], 3.0)*states[1]*(states[0]-variables[8]); - variables[10] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0); - variables[11] = 4.0*exp(states[0]/18.0); - variables[12] = 0.07*exp(states[0]/20.0); - variables[13] = 1.0/(exp((states[0]+30.0)/10.0)+1.0); - variables[2] = variables[15]*pow(states[3], 4.0)*(states[0]-variables[14]); - variables[16] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0); + algebraic[17] = externalVariable(voi, states, rates, variables, 17); + algebraic[0] = externalVariable(voi, states, rates, variables, 0); + algebraic[1] = constants[7]*(states[0]-computedConstants[6]); + algebraic[3] = constants[9]*pow(states[2], 3.0)*states[1]*(states[0]-computedConstants[8]); + algebraic[10] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0); + algebraic[11] = 4.0*exp(states[0]/18.0); + algebraic[12] = 0.07*exp(states[0]/20.0); + algebraic[13] = 1.0/(exp((states[0]+30.0)/10.0)+1.0); + algebraic[2] = constants[15]*pow(states[3], 4.0)*(states[0]-computedConstants[14]); + algebraic[16] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0); } diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.py index 4f026e071d..381f0a24f7 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.py @@ -74,50 +74,50 @@ def create_variables_array(): def initialise_variables(voi, states, rates, constants, external_variable): - variables[4] = 1.0 - variables[5] = 0.0 - variables[7] = 0.3 - variables[9] = 120.0 - variables[15] = 36.0 + constants[4] = 1.0 + constants[5] = 0.0 + constants[7] = 0.3 + constants[9] = 120.0 + constants[15] = 36.0 states[0] = 0.0 states[1] = 0.6 states[2] = 0.05 states[3] = 0.325 - variables[17] = external_variable(voi, states, rates, variables, 17) - variables[0] = external_variable(voi, states, rates, variables, 0) + algebraic[17] = external_variable(voi, states, rates, variables, 17) + algebraic[0] = external_variable(voi, states, rates, variables, 0) def compute_computed_constants(constants, computed_constants): - variables[6] = variables[5]-10.613 - variables[8] = variables[5]-115.0 - variables[14] = variables[5]+12.0 + computed_constants[6] = constants[5]-10.613 + computed_constants[8] = constants[5]-115.0 + computed_constants[14] = constants[5]+12.0 def compute_rates(voi, states, rates, constants, computed_constants, algebraic, external_variable): - variables[17] = external_variable(voi, states, rates, variables, 17) - variables[0] = external_variable(voi, states, rates, variables, 0) - variables[1] = variables[7]*(states[0]-variables[6]) - variables[2] = variables[15]*pow(states[3], 4.0)*(states[0]-variables[14]) - variables[3] = variables[9]*pow(states[2], 3.0)*states[1]*(states[0]-variables[8]) - rates[0] = -(-variables[0]+variables[3]+variables[2]+variables[1])/variables[4] - variables[10] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0) - variables[11] = 4.0*exp(states[0]/18.0) - rates[2] = variables[10]*(1.0-states[2])-variables[11]*states[2] - variables[12] = 0.07*exp(states[0]/20.0) - variables[13] = 1.0/(exp((states[0]+30.0)/10.0)+1.0) - rates[1] = variables[12]*(1.0-states[1])-variables[13]*states[1] - variables[16] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0) - rates[3] = variables[16]*(1.0-states[3])-variables[17]*states[3] + algebraic[17] = external_variable(voi, states, rates, variables, 17) + algebraic[0] = external_variable(voi, states, rates, variables, 0) + algebraic[1] = constants[7]*(states[0]-computed_constants[6]) + algebraic[2] = constants[15]*pow(states[3], 4.0)*(states[0]-computed_constants[14]) + algebraic[3] = constants[9]*pow(states[2], 3.0)*states[1]*(states[0]-computed_constants[8]) + rates[0] = -(-algebraic[0]+algebraic[3]+algebraic[2]+algebraic[1])/constants[4] + algebraic[10] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0) + algebraic[11] = 4.0*exp(states[0]/18.0) + rates[2] = algebraic[10]*(1.0-states[2])-algebraic[11]*states[2] + algebraic[12] = 0.07*exp(states[0]/20.0) + algebraic[13] = 1.0/(exp((states[0]+30.0)/10.0)+1.0) + rates[1] = algebraic[12]*(1.0-states[1])-algebraic[13]*states[1] + algebraic[16] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0) + rates[3] = algebraic[16]*(1.0-states[3])-algebraic[17]*states[3] def compute_variables(voi, states, rates, constants, computed_constants, algebraic, external_variable): - variables[17] = external_variable(voi, states, rates, variables, 17) - variables[0] = external_variable(voi, states, rates, variables, 0) - variables[1] = variables[7]*(states[0]-variables[6]) - variables[3] = variables[9]*pow(states[2], 3.0)*states[1]*(states[0]-variables[8]) - variables[10] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0) - variables[11] = 4.0*exp(states[0]/18.0) - variables[12] = 0.07*exp(states[0]/20.0) - variables[13] = 1.0/(exp((states[0]+30.0)/10.0)+1.0) - variables[2] = variables[15]*pow(states[3], 4.0)*(states[0]-variables[14]) - variables[16] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0) + algebraic[17] = external_variable(voi, states, rates, variables, 17) + algebraic[0] = external_variable(voi, states, rates, variables, 0) + algebraic[1] = constants[7]*(states[0]-computed_constants[6]) + algebraic[3] = constants[9]*pow(states[2], 3.0)*states[1]*(states[0]-computed_constants[8]) + algebraic[10] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0) + algebraic[11] = 4.0*exp(states[0]/18.0) + algebraic[12] = 0.07*exp(states[0]/20.0) + algebraic[13] = 1.0/(exp((states[0]+30.0)/10.0)+1.0) + algebraic[2] = constants[15]*pow(states[3], 4.0)*(states[0]-computed_constants[14]) + algebraic[16] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0) diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.c index 35e65eb5b6..4a61f2b747 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.c @@ -72,16 +72,16 @@ void deleteArray(double *array) void initialiseVariables(double voi, double *states, double *rates, double *constants, ExternalVariable externalVariable) { - variables[4] = 1.0; - variables[7] = 0.3; - variables[9] = 120.0; - variables[15] = 36.0; + constants[4] = 1.0; + constants[7] = 0.3; + constants[9] = 120.0; + constants[15] = 36.0; states[0] = 0.0; states[1] = 0.6; states[2] = 0.05; states[3] = 0.325; - variables[14] = externalVariable(voi, states, rates, variables, 14); - variables[5] = externalVariable(voi, states, rates, variables, 5); + algebraic[14] = externalVariable(voi, states, rates, variables, 14); + algebraic[5] = externalVariable(voi, states, rates, variables, 5); } void computeComputedConstants(double *constants, double *computedConstants) @@ -90,39 +90,39 @@ void computeComputedConstants(double *constants, double *computedConstants) void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) { - variables[0] = ((voi >= 10.0) && (voi <= 10.5))?-20.0:0.0; - variables[14] = externalVariable(voi, states, rates, variables, 14); - variables[5] = externalVariable(voi, states, rates, variables, 5); - variables[6] = variables[5]-10.613; - variables[1] = variables[7]*(states[0]-variables[6]); - variables[2] = variables[15]*pow(states[3], 4.0)*(states[0]-variables[14]); - variables[8] = variables[5]-115.0; - variables[3] = variables[9]*pow(states[2], 3.0)*states[1]*(states[0]-variables[8]); - rates[0] = -(-variables[0]+variables[3]+variables[2]+variables[1])/variables[4]; - variables[10] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0); - variables[11] = 4.0*exp(states[0]/18.0); - rates[2] = variables[10]*(1.0-states[2])-variables[11]*states[2]; - variables[12] = 0.07*exp(states[0]/20.0); - variables[13] = 1.0/(exp((states[0]+30.0)/10.0)+1.0); - rates[1] = variables[12]*(1.0-states[1])-variables[13]*states[1]; - variables[16] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0); - variables[17] = 0.125*exp(states[0]/80.0); - rates[3] = variables[16]*(1.0-states[3])-variables[17]*states[3]; + algebraic[0] = ((voi >= 10.0) && (voi <= 10.5))?-20.0:0.0; + algebraic[14] = externalVariable(voi, states, rates, variables, 14); + algebraic[5] = externalVariable(voi, states, rates, variables, 5); + algebraic[6] = algebraic[5]-10.613; + algebraic[1] = constants[7]*(states[0]-algebraic[6]); + algebraic[2] = constants[15]*pow(states[3], 4.0)*(states[0]-algebraic[14]); + algebraic[8] = algebraic[5]-115.0; + algebraic[3] = constants[9]*pow(states[2], 3.0)*states[1]*(states[0]-algebraic[8]); + rates[0] = -(-algebraic[0]+algebraic[3]+algebraic[2]+algebraic[1])/constants[4]; + algebraic[10] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0); + algebraic[11] = 4.0*exp(states[0]/18.0); + rates[2] = algebraic[10]*(1.0-states[2])-algebraic[11]*states[2]; + algebraic[12] = 0.07*exp(states[0]/20.0); + algebraic[13] = 1.0/(exp((states[0]+30.0)/10.0)+1.0); + rates[1] = algebraic[12]*(1.0-states[1])-algebraic[13]*states[1]; + algebraic[16] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0); + algebraic[17] = 0.125*exp(states[0]/80.0); + rates[3] = algebraic[16]*(1.0-states[3])-algebraic[17]*states[3]; } void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) { - variables[14] = externalVariable(voi, states, rates, variables, 14); - variables[5] = externalVariable(voi, states, rates, variables, 5); - variables[6] = variables[5]-10.613; - variables[1] = variables[7]*(states[0]-variables[6]); - variables[8] = variables[5]-115.0; - variables[3] = variables[9]*pow(states[2], 3.0)*states[1]*(states[0]-variables[8]); - variables[10] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0); - variables[11] = 4.0*exp(states[0]/18.0); - variables[12] = 0.07*exp(states[0]/20.0); - variables[13] = 1.0/(exp((states[0]+30.0)/10.0)+1.0); - variables[2] = variables[15]*pow(states[3], 4.0)*(states[0]-variables[14]); - variables[16] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0); - variables[17] = 0.125*exp(states[0]/80.0); + algebraic[14] = externalVariable(voi, states, rates, variables, 14); + algebraic[5] = externalVariable(voi, states, rates, variables, 5); + algebraic[6] = algebraic[5]-10.613; + algebraic[1] = constants[7]*(states[0]-algebraic[6]); + algebraic[8] = algebraic[5]-115.0; + algebraic[3] = constants[9]*pow(states[2], 3.0)*states[1]*(states[0]-algebraic[8]); + algebraic[10] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0); + algebraic[11] = 4.0*exp(states[0]/18.0); + algebraic[12] = 0.07*exp(states[0]/20.0); + algebraic[13] = 1.0/(exp((states[0]+30.0)/10.0)+1.0); + algebraic[2] = constants[15]*pow(states[3], 4.0)*(states[0]-algebraic[14]); + algebraic[16] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0); + algebraic[17] = 0.125*exp(states[0]/80.0); } diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.py index fa91989064..53027ad4cb 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.py @@ -74,16 +74,16 @@ def create_variables_array(): def initialise_variables(voi, states, rates, constants, external_variable): - variables[4] = 1.0 - variables[7] = 0.3 - variables[9] = 120.0 - variables[15] = 36.0 + constants[4] = 1.0 + constants[7] = 0.3 + constants[9] = 120.0 + constants[15] = 36.0 states[0] = 0.0 states[1] = 0.6 states[2] = 0.05 states[3] = 0.325 - variables[14] = external_variable(voi, states, rates, variables, 14) - variables[5] = external_variable(voi, states, rates, variables, 5) + algebraic[14] = external_variable(voi, states, rates, variables, 14) + algebraic[5] = external_variable(voi, states, rates, variables, 5) def compute_computed_constants(constants, computed_constants): @@ -91,37 +91,37 @@ def compute_computed_constants(constants, computed_constants): def compute_rates(voi, states, rates, constants, computed_constants, algebraic, external_variable): - variables[0] = -20.0 if and_func(geq_func(voi, 10.0), leq_func(voi, 10.5)) else 0.0 - variables[14] = external_variable(voi, states, rates, variables, 14) - variables[5] = external_variable(voi, states, rates, variables, 5) - variables[6] = variables[5]-10.613 - variables[1] = variables[7]*(states[0]-variables[6]) - variables[2] = variables[15]*pow(states[3], 4.0)*(states[0]-variables[14]) - variables[8] = variables[5]-115.0 - variables[3] = variables[9]*pow(states[2], 3.0)*states[1]*(states[0]-variables[8]) - rates[0] = -(-variables[0]+variables[3]+variables[2]+variables[1])/variables[4] - variables[10] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0) - variables[11] = 4.0*exp(states[0]/18.0) - rates[2] = variables[10]*(1.0-states[2])-variables[11]*states[2] - variables[12] = 0.07*exp(states[0]/20.0) - variables[13] = 1.0/(exp((states[0]+30.0)/10.0)+1.0) - rates[1] = variables[12]*(1.0-states[1])-variables[13]*states[1] - variables[16] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0) - variables[17] = 0.125*exp(states[0]/80.0) - rates[3] = variables[16]*(1.0-states[3])-variables[17]*states[3] + algebraic[0] = -20.0 if and_func(geq_func(voi, 10.0), leq_func(voi, 10.5)) else 0.0 + algebraic[14] = external_variable(voi, states, rates, variables, 14) + algebraic[5] = external_variable(voi, states, rates, variables, 5) + algebraic[6] = algebraic[5]-10.613 + algebraic[1] = constants[7]*(states[0]-algebraic[6]) + algebraic[2] = constants[15]*pow(states[3], 4.0)*(states[0]-algebraic[14]) + algebraic[8] = algebraic[5]-115.0 + algebraic[3] = constants[9]*pow(states[2], 3.0)*states[1]*(states[0]-algebraic[8]) + rates[0] = -(-algebraic[0]+algebraic[3]+algebraic[2]+algebraic[1])/constants[4] + algebraic[10] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0) + algebraic[11] = 4.0*exp(states[0]/18.0) + rates[2] = algebraic[10]*(1.0-states[2])-algebraic[11]*states[2] + algebraic[12] = 0.07*exp(states[0]/20.0) + algebraic[13] = 1.0/(exp((states[0]+30.0)/10.0)+1.0) + rates[1] = algebraic[12]*(1.0-states[1])-algebraic[13]*states[1] + algebraic[16] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0) + algebraic[17] = 0.125*exp(states[0]/80.0) + rates[3] = algebraic[16]*(1.0-states[3])-algebraic[17]*states[3] def compute_variables(voi, states, rates, constants, computed_constants, algebraic, external_variable): - variables[14] = external_variable(voi, states, rates, variables, 14) - variables[5] = external_variable(voi, states, rates, variables, 5) - variables[6] = variables[5]-10.613 - variables[1] = variables[7]*(states[0]-variables[6]) - variables[8] = variables[5]-115.0 - variables[3] = variables[9]*pow(states[2], 3.0)*states[1]*(states[0]-variables[8]) - variables[10] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0) - variables[11] = 4.0*exp(states[0]/18.0) - variables[12] = 0.07*exp(states[0]/20.0) - variables[13] = 1.0/(exp((states[0]+30.0)/10.0)+1.0) - variables[2] = variables[15]*pow(states[3], 4.0)*(states[0]-variables[14]) - variables[16] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0) - variables[17] = 0.125*exp(states[0]/80.0) + algebraic[14] = external_variable(voi, states, rates, variables, 14) + algebraic[5] = external_variable(voi, states, rates, variables, 5) + algebraic[6] = algebraic[5]-10.613 + algebraic[1] = constants[7]*(states[0]-algebraic[6]) + algebraic[8] = algebraic[5]-115.0 + algebraic[3] = constants[9]*pow(states[2], 3.0)*states[1]*(states[0]-algebraic[8]) + algebraic[10] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0) + algebraic[11] = 4.0*exp(states[0]/18.0) + algebraic[12] = 0.07*exp(states[0]/20.0) + algebraic[13] = 1.0/(exp((states[0]+30.0)/10.0)+1.0) + algebraic[2] = constants[15]*pow(states[3], 4.0)*(states[0]-algebraic[14]) + algebraic[16] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0) + algebraic[17] = 0.125*exp(states[0]/80.0) diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.c index a5180f9026..be516f51bd 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.c @@ -72,55 +72,55 @@ void deleteArray(double *array) void initialiseVariables(double voi, double *states, double *rates, double *constants, ExternalVariable externalVariable) { - variables[5] = 0.0; - variables[7] = 0.3; - variables[15] = 36.0; + constants[5] = 0.0; + constants[7] = 0.3; + constants[15] = 36.0; states[0] = 0.0; states[1] = 0.6; states[2] = 0.05; states[3] = 0.325; - variables[9] = externalVariable(voi, states, rates, variables, 9); - variables[4] = externalVariable(voi, states, rates, variables, 4); + algebraic[9] = externalVariable(voi, states, rates, variables, 9); + algebraic[4] = externalVariable(voi, states, rates, variables, 4); } void computeComputedConstants(double *constants, double *computedConstants) { - variables[6] = variables[5]-10.613; - variables[8] = variables[5]-115.0; - variables[14] = variables[5]+12.0; + computedConstants[6] = constants[5]-10.613; + computedConstants[8] = constants[5]-115.0; + computedConstants[14] = constants[5]+12.0; } void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) { - variables[0] = ((voi >= 10.0) && (voi <= 10.5))?-20.0:0.0; - variables[9] = externalVariable(voi, states, rates, variables, 9); - variables[4] = externalVariable(voi, states, rates, variables, 4); - variables[1] = variables[7]*(states[0]-variables[6]); - variables[2] = variables[15]*pow(states[3], 4.0)*(states[0]-variables[14]); - variables[3] = variables[9]*pow(states[2], 3.0)*states[1]*(states[0]-variables[8]); - rates[0] = -(-variables[0]+variables[3]+variables[2]+variables[1])/variables[4]; - variables[10] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0); - variables[11] = 4.0*exp(states[0]/18.0); - rates[2] = variables[10]*(1.0-states[2])-variables[11]*states[2]; - variables[12] = 0.07*exp(states[0]/20.0); - variables[13] = 1.0/(exp((states[0]+30.0)/10.0)+1.0); - rates[1] = variables[12]*(1.0-states[1])-variables[13]*states[1]; - variables[16] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0); - variables[17] = 0.125*exp(states[0]/80.0); - rates[3] = variables[16]*(1.0-states[3])-variables[17]*states[3]; + algebraic[0] = ((voi >= 10.0) && (voi <= 10.5))?-20.0:0.0; + algebraic[9] = externalVariable(voi, states, rates, variables, 9); + algebraic[4] = externalVariable(voi, states, rates, variables, 4); + algebraic[1] = constants[7]*(states[0]-computedConstants[6]); + algebraic[2] = constants[15]*pow(states[3], 4.0)*(states[0]-computedConstants[14]); + algebraic[3] = algebraic[9]*pow(states[2], 3.0)*states[1]*(states[0]-computedConstants[8]); + rates[0] = -(-algebraic[0]+algebraic[3]+algebraic[2]+algebraic[1])/algebraic[4]; + algebraic[10] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0); + algebraic[11] = 4.0*exp(states[0]/18.0); + rates[2] = algebraic[10]*(1.0-states[2])-algebraic[11]*states[2]; + algebraic[12] = 0.07*exp(states[0]/20.0); + algebraic[13] = 1.0/(exp((states[0]+30.0)/10.0)+1.0); + rates[1] = algebraic[12]*(1.0-states[1])-algebraic[13]*states[1]; + algebraic[16] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0); + algebraic[17] = 0.125*exp(states[0]/80.0); + rates[3] = algebraic[16]*(1.0-states[3])-algebraic[17]*states[3]; } void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) { - variables[1] = variables[7]*(states[0]-variables[6]); - variables[9] = externalVariable(voi, states, rates, variables, 9); - variables[3] = variables[9]*pow(states[2], 3.0)*states[1]*(states[0]-variables[8]); - variables[10] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0); - variables[11] = 4.0*exp(states[0]/18.0); - variables[12] = 0.07*exp(states[0]/20.0); - variables[13] = 1.0/(exp((states[0]+30.0)/10.0)+1.0); - variables[2] = variables[15]*pow(states[3], 4.0)*(states[0]-variables[14]); - variables[16] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0); - variables[17] = 0.125*exp(states[0]/80.0); - variables[4] = externalVariable(voi, states, rates, variables, 4); + algebraic[1] = constants[7]*(states[0]-computedConstants[6]); + algebraic[9] = externalVariable(voi, states, rates, variables, 9); + algebraic[3] = algebraic[9]*pow(states[2], 3.0)*states[1]*(states[0]-computedConstants[8]); + algebraic[10] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0); + algebraic[11] = 4.0*exp(states[0]/18.0); + algebraic[12] = 0.07*exp(states[0]/20.0); + algebraic[13] = 1.0/(exp((states[0]+30.0)/10.0)+1.0); + algebraic[2] = constants[15]*pow(states[3], 4.0)*(states[0]-computedConstants[14]); + algebraic[16] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0); + algebraic[17] = 0.125*exp(states[0]/80.0); + algebraic[4] = externalVariable(voi, states, rates, variables, 4); } diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.py index 71f9a4827e..e518a203f6 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.py @@ -74,51 +74,51 @@ def create_variables_array(): def initialise_variables(voi, states, rates, constants, external_variable): - variables[5] = 0.0 - variables[7] = 0.3 - variables[15] = 36.0 + constants[5] = 0.0 + constants[7] = 0.3 + constants[15] = 36.0 states[0] = 0.0 states[1] = 0.6 states[2] = 0.05 states[3] = 0.325 - variables[9] = external_variable(voi, states, rates, variables, 9) - variables[4] = external_variable(voi, states, rates, variables, 4) + algebraic[9] = external_variable(voi, states, rates, variables, 9) + algebraic[4] = external_variable(voi, states, rates, variables, 4) def compute_computed_constants(constants, computed_constants): - variables[6] = variables[5]-10.613 - variables[8] = variables[5]-115.0 - variables[14] = variables[5]+12.0 + computed_constants[6] = constants[5]-10.613 + computed_constants[8] = constants[5]-115.0 + computed_constants[14] = constants[5]+12.0 def compute_rates(voi, states, rates, constants, computed_constants, algebraic, external_variable): - variables[0] = -20.0 if and_func(geq_func(voi, 10.0), leq_func(voi, 10.5)) else 0.0 - variables[9] = external_variable(voi, states, rates, variables, 9) - variables[4] = external_variable(voi, states, rates, variables, 4) - variables[1] = variables[7]*(states[0]-variables[6]) - variables[2] = variables[15]*pow(states[3], 4.0)*(states[0]-variables[14]) - variables[3] = variables[9]*pow(states[2], 3.0)*states[1]*(states[0]-variables[8]) - rates[0] = -(-variables[0]+variables[3]+variables[2]+variables[1])/variables[4] - variables[10] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0) - variables[11] = 4.0*exp(states[0]/18.0) - rates[2] = variables[10]*(1.0-states[2])-variables[11]*states[2] - variables[12] = 0.07*exp(states[0]/20.0) - variables[13] = 1.0/(exp((states[0]+30.0)/10.0)+1.0) - rates[1] = variables[12]*(1.0-states[1])-variables[13]*states[1] - variables[16] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0) - variables[17] = 0.125*exp(states[0]/80.0) - rates[3] = variables[16]*(1.0-states[3])-variables[17]*states[3] + algebraic[0] = -20.0 if and_func(geq_func(voi, 10.0), leq_func(voi, 10.5)) else 0.0 + algebraic[9] = external_variable(voi, states, rates, variables, 9) + algebraic[4] = external_variable(voi, states, rates, variables, 4) + algebraic[1] = constants[7]*(states[0]-computed_constants[6]) + algebraic[2] = constants[15]*pow(states[3], 4.0)*(states[0]-computed_constants[14]) + algebraic[3] = algebraic[9]*pow(states[2], 3.0)*states[1]*(states[0]-computed_constants[8]) + rates[0] = -(-algebraic[0]+algebraic[3]+algebraic[2]+algebraic[1])/algebraic[4] + algebraic[10] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0) + algebraic[11] = 4.0*exp(states[0]/18.0) + rates[2] = algebraic[10]*(1.0-states[2])-algebraic[11]*states[2] + algebraic[12] = 0.07*exp(states[0]/20.0) + algebraic[13] = 1.0/(exp((states[0]+30.0)/10.0)+1.0) + rates[1] = algebraic[12]*(1.0-states[1])-algebraic[13]*states[1] + algebraic[16] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0) + algebraic[17] = 0.125*exp(states[0]/80.0) + rates[3] = algebraic[16]*(1.0-states[3])-algebraic[17]*states[3] def compute_variables(voi, states, rates, constants, computed_constants, algebraic, external_variable): - variables[1] = variables[7]*(states[0]-variables[6]) - variables[9] = external_variable(voi, states, rates, variables, 9) - variables[3] = variables[9]*pow(states[2], 3.0)*states[1]*(states[0]-variables[8]) - variables[10] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0) - variables[11] = 4.0*exp(states[0]/18.0) - variables[12] = 0.07*exp(states[0]/20.0) - variables[13] = 1.0/(exp((states[0]+30.0)/10.0)+1.0) - variables[2] = variables[15]*pow(states[3], 4.0)*(states[0]-variables[14]) - variables[16] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0) - variables[17] = 0.125*exp(states[0]/80.0) - variables[4] = external_variable(voi, states, rates, variables, 4) + algebraic[1] = constants[7]*(states[0]-computed_constants[6]) + algebraic[9] = external_variable(voi, states, rates, variables, 9) + algebraic[3] = algebraic[9]*pow(states[2], 3.0)*states[1]*(states[0]-computed_constants[8]) + algebraic[10] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0) + algebraic[11] = 4.0*exp(states[0]/18.0) + algebraic[12] = 0.07*exp(states[0]/20.0) + algebraic[13] = 1.0/(exp((states[0]+30.0)/10.0)+1.0) + algebraic[2] = constants[15]*pow(states[3], 4.0)*(states[0]-computed_constants[14]) + algebraic[16] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0) + algebraic[17] = 0.125*exp(states[0]/80.0) + algebraic[4] = external_variable(voi, states, rates, variables, 4) diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.c index 0f7cdf5056..a8baed030d 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.c @@ -72,43 +72,43 @@ void deleteArray(double *array) void initialiseVariables(double voi, double *states, double *rates, double *constants, ExternalVariable externalVariable) { - variables[5] = 1.0; - variables[6] = 0.0; - variables[8] = 0.3; - variables[10] = 120.0; - variables[17] = 36.0; + constants[5] = 1.0; + constants[6] = 0.0; + constants[8] = 0.3; + constants[10] = 120.0; + constants[17] = 36.0; states[0] = 0.6; states[1] = 0.325; - variables[1] = externalVariable(voi, states, rates, variables, 1); - variables[11] = externalVariable(voi, states, rates, variables, 11); + algebraic[1] = externalVariable(voi, states, rates, variables, 1); + algebraic[11] = externalVariable(voi, states, rates, variables, 11); } void computeComputedConstants(double *constants, double *computedConstants) { - variables[7] = variables[6]-10.613; - variables[9] = variables[6]-115.0; - variables[16] = variables[6]+12.0; + computedConstants[7] = constants[6]-10.613; + computedConstants[9] = constants[6]-115.0; + computedConstants[16] = constants[6]+12.0; } void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) { - variables[1] = externalVariable(voi, states, rates, variables, 1); - variables[14] = 0.07*exp(variables[1]/20.0); - variables[15] = 1.0/(exp((variables[1]+30.0)/10.0)+1.0); - rates[0] = variables[14]*(1.0-states[0])-variables[15]*states[0]; - variables[18] = 0.01*(variables[1]+10.0)/(exp((variables[1]+10.0)/10.0)-1.0); - variables[19] = 0.125*exp(variables[1]/80.0); - rates[1] = variables[18]*(1.0-states[1])-variables[19]*states[1]; + algebraic[1] = externalVariable(voi, states, rates, variables, 1); + algebraic[14] = 0.07*exp(algebraic[1]/20.0); + algebraic[15] = 1.0/(exp((algebraic[1]+30.0)/10.0)+1.0); + rates[0] = algebraic[14]*(1.0-states[0])-algebraic[15]*states[0]; + algebraic[18] = 0.01*(algebraic[1]+10.0)/(exp((algebraic[1]+10.0)/10.0)-1.0); + algebraic[19] = 0.125*exp(algebraic[1]/80.0); + rates[1] = algebraic[18]*(1.0-states[1])-algebraic[19]*states[1]; } void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) { - variables[0] = ((voi >= 10.0) && (voi <= 10.5))?-20.0:0.0; - variables[1] = externalVariable(voi, states, rates, variables, 1); - variables[2] = variables[8]*(variables[1]-variables[7]); - variables[11] = externalVariable(voi, states, rates, variables, 11); - variables[4] = variables[10]*pow(variables[11], 3.0)*states[0]*(variables[1]-variables[9]); - variables[12] = 0.1*(variables[1]+25.0)/(exp((variables[1]+25.0)/10.0)-1.0); - variables[13] = 4.0*exp(variables[1]/18.0); - variables[3] = variables[17]*pow(states[1], 4.0)*(variables[1]-variables[16]); + algebraic[0] = ((voi >= 10.0) && (voi <= 10.5))?-20.0:0.0; + algebraic[1] = externalVariable(voi, states, rates, variables, 1); + algebraic[2] = constants[8]*(algebraic[1]-computedConstants[7]); + algebraic[11] = externalVariable(voi, states, rates, variables, 11); + algebraic[4] = constants[10]*pow(algebraic[11], 3.0)*states[0]*(algebraic[1]-computedConstants[9]); + algebraic[12] = 0.1*(algebraic[1]+25.0)/(exp((algebraic[1]+25.0)/10.0)-1.0); + algebraic[13] = 4.0*exp(algebraic[1]/18.0); + algebraic[3] = constants[17]*pow(states[1], 4.0)*(algebraic[1]-computedConstants[16]); } diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.py index 16326c27d3..914194e7fb 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.py @@ -74,39 +74,39 @@ def create_variables_array(): def initialise_variables(voi, states, rates, constants, external_variable): - variables[5] = 1.0 - variables[6] = 0.0 - variables[8] = 0.3 - variables[10] = 120.0 - variables[17] = 36.0 + constants[5] = 1.0 + constants[6] = 0.0 + constants[8] = 0.3 + constants[10] = 120.0 + constants[17] = 36.0 states[0] = 0.6 states[1] = 0.325 - variables[1] = external_variable(voi, states, rates, variables, 1) - variables[11] = external_variable(voi, states, rates, variables, 11) + algebraic[1] = external_variable(voi, states, rates, variables, 1) + algebraic[11] = external_variable(voi, states, rates, variables, 11) def compute_computed_constants(constants, computed_constants): - variables[7] = variables[6]-10.613 - variables[9] = variables[6]-115.0 - variables[16] = variables[6]+12.0 + computed_constants[7] = constants[6]-10.613 + computed_constants[9] = constants[6]-115.0 + computed_constants[16] = constants[6]+12.0 def compute_rates(voi, states, rates, constants, computed_constants, algebraic, external_variable): - variables[1] = external_variable(voi, states, rates, variables, 1) - variables[14] = 0.07*exp(variables[1]/20.0) - variables[15] = 1.0/(exp((variables[1]+30.0)/10.0)+1.0) - rates[0] = variables[14]*(1.0-states[0])-variables[15]*states[0] - variables[18] = 0.01*(variables[1]+10.0)/(exp((variables[1]+10.0)/10.0)-1.0) - variables[19] = 0.125*exp(variables[1]/80.0) - rates[1] = variables[18]*(1.0-states[1])-variables[19]*states[1] + algebraic[1] = external_variable(voi, states, rates, variables, 1) + algebraic[14] = 0.07*exp(algebraic[1]/20.0) + algebraic[15] = 1.0/(exp((algebraic[1]+30.0)/10.0)+1.0) + rates[0] = algebraic[14]*(1.0-states[0])-algebraic[15]*states[0] + algebraic[18] = 0.01*(algebraic[1]+10.0)/(exp((algebraic[1]+10.0)/10.0)-1.0) + algebraic[19] = 0.125*exp(algebraic[1]/80.0) + rates[1] = algebraic[18]*(1.0-states[1])-algebraic[19]*states[1] def compute_variables(voi, states, rates, constants, computed_constants, algebraic, external_variable): - variables[0] = -20.0 if and_func(geq_func(voi, 10.0), leq_func(voi, 10.5)) else 0.0 - variables[1] = external_variable(voi, states, rates, variables, 1) - variables[2] = variables[8]*(variables[1]-variables[7]) - variables[11] = external_variable(voi, states, rates, variables, 11) - variables[4] = variables[10]*pow(variables[11], 3.0)*states[0]*(variables[1]-variables[9]) - variables[12] = 0.1*(variables[1]+25.0)/(exp((variables[1]+25.0)/10.0)-1.0) - variables[13] = 4.0*exp(variables[1]/18.0) - variables[3] = variables[17]*pow(states[1], 4.0)*(variables[1]-variables[16]) + algebraic[0] = -20.0 if and_func(geq_func(voi, 10.0), leq_func(voi, 10.5)) else 0.0 + algebraic[1] = external_variable(voi, states, rates, variables, 1) + algebraic[2] = constants[8]*(algebraic[1]-computed_constants[7]) + algebraic[11] = external_variable(voi, states, rates, variables, 11) + algebraic[4] = constants[10]*pow(algebraic[11], 3.0)*states[0]*(algebraic[1]-computed_constants[9]) + algebraic[12] = 0.1*(algebraic[1]+25.0)/(exp((algebraic[1]+25.0)/10.0)-1.0) + algebraic[13] = 4.0*exp(algebraic[1]/18.0) + algebraic[3] = constants[17]*pow(states[1], 4.0)*(algebraic[1]-computed_constants[16]) diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.c index 4deb76e688..b21ab1d041 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.c @@ -72,46 +72,46 @@ void deleteArray(double *array) void initialiseVariables(double voi, double *states, double *rates, double *constants, ExternalVariable externalVariable) { - variables[5] = 1.0; - variables[6] = 0.0; - variables[8] = 0.3; - variables[10] = 120.0; - variables[16] = 36.0; + constants[5] = 1.0; + constants[6] = 0.0; + constants[8] = 0.3; + constants[10] = 120.0; + constants[16] = 36.0; states[0] = 0.6; states[1] = 0.05; states[2] = 0.325; - variables[1] = externalVariable(voi, states, rates, variables, 1); - variables[17] = externalVariable(voi, states, rates, variables, 17); - variables[4] = externalVariable(voi, states, rates, variables, 4); + algebraic[1] = externalVariable(voi, states, rates, variables, 1); + algebraic[17] = externalVariable(voi, states, rates, variables, 17); + algebraic[4] = externalVariable(voi, states, rates, variables, 4); } void computeComputedConstants(double *constants, double *computedConstants) { - variables[7] = variables[6]-10.613; - variables[9] = variables[6]-115.0; - variables[15] = variables[6]+12.0; + computedConstants[7] = constants[6]-10.613; + computedConstants[9] = constants[6]-115.0; + computedConstants[15] = constants[6]+12.0; } void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) { - variables[1] = externalVariable(voi, states, rates, variables, 1); - variables[11] = 0.1*(variables[1]+25.0)/(exp((variables[1]+25.0)/10.0)-1.0); - variables[12] = 4.0*exp(variables[1]/18.0); - rates[1] = variables[11]*(1.0-states[1])-variables[12]*states[1]; - variables[13] = 0.07*exp(variables[1]/20.0); - variables[14] = 1.0/(exp((variables[1]+30.0)/10.0)+1.0); - rates[0] = variables[13]*(1.0-states[0])-variables[14]*states[0]; - variables[17] = externalVariable(voi, states, rates, variables, 17); - variables[18] = 0.125*exp(variables[1]/80.0); - rates[2] = variables[17]*(1.0-states[2])-variables[18]*states[2]; + algebraic[1] = externalVariable(voi, states, rates, variables, 1); + algebraic[11] = 0.1*(algebraic[1]+25.0)/(exp((algebraic[1]+25.0)/10.0)-1.0); + algebraic[12] = 4.0*exp(algebraic[1]/18.0); + rates[1] = algebraic[11]*(1.0-states[1])-algebraic[12]*states[1]; + algebraic[13] = 0.07*exp(algebraic[1]/20.0); + algebraic[14] = 1.0/(exp((algebraic[1]+30.0)/10.0)+1.0); + rates[0] = algebraic[13]*(1.0-states[0])-algebraic[14]*states[0]; + algebraic[17] = externalVariable(voi, states, rates, variables, 17); + algebraic[18] = 0.125*exp(algebraic[1]/80.0); + rates[2] = algebraic[17]*(1.0-states[2])-algebraic[18]*states[2]; } void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) { - variables[0] = ((voi >= 10.0) && (voi <= 10.5))?-20.0:0.0; - variables[1] = externalVariable(voi, states, rates, variables, 1); - variables[2] = variables[8]*(variables[1]-variables[7]); - variables[17] = externalVariable(voi, states, rates, variables, 17); - variables[4] = externalVariable(voi, states, rates, variables, 4); - variables[3] = variables[16]*pow(states[2], 4.0)*(variables[1]-variables[15]); + algebraic[0] = ((voi >= 10.0) && (voi <= 10.5))?-20.0:0.0; + algebraic[1] = externalVariable(voi, states, rates, variables, 1); + algebraic[2] = constants[8]*(algebraic[1]-computedConstants[7]); + algebraic[17] = externalVariable(voi, states, rates, variables, 17); + algebraic[4] = externalVariable(voi, states, rates, variables, 4); + algebraic[3] = constants[16]*pow(states[2], 4.0)*(algebraic[1]-computedConstants[15]); } diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.py index 89c02e24c7..d64291b4a8 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.py @@ -74,42 +74,42 @@ def create_variables_array(): def initialise_variables(voi, states, rates, constants, external_variable): - variables[5] = 1.0 - variables[6] = 0.0 - variables[8] = 0.3 - variables[10] = 120.0 - variables[16] = 36.0 + constants[5] = 1.0 + constants[6] = 0.0 + constants[8] = 0.3 + constants[10] = 120.0 + constants[16] = 36.0 states[0] = 0.6 states[1] = 0.05 states[2] = 0.325 - variables[1] = external_variable(voi, states, rates, variables, 1) - variables[17] = external_variable(voi, states, rates, variables, 17) - variables[4] = external_variable(voi, states, rates, variables, 4) + algebraic[1] = external_variable(voi, states, rates, variables, 1) + algebraic[17] = external_variable(voi, states, rates, variables, 17) + algebraic[4] = external_variable(voi, states, rates, variables, 4) def compute_computed_constants(constants, computed_constants): - variables[7] = variables[6]-10.613 - variables[9] = variables[6]-115.0 - variables[15] = variables[6]+12.0 + computed_constants[7] = constants[6]-10.613 + computed_constants[9] = constants[6]-115.0 + computed_constants[15] = constants[6]+12.0 def compute_rates(voi, states, rates, constants, computed_constants, algebraic, external_variable): - variables[1] = external_variable(voi, states, rates, variables, 1) - variables[11] = 0.1*(variables[1]+25.0)/(exp((variables[1]+25.0)/10.0)-1.0) - variables[12] = 4.0*exp(variables[1]/18.0) - rates[1] = variables[11]*(1.0-states[1])-variables[12]*states[1] - variables[13] = 0.07*exp(variables[1]/20.0) - variables[14] = 1.0/(exp((variables[1]+30.0)/10.0)+1.0) - rates[0] = variables[13]*(1.0-states[0])-variables[14]*states[0] - variables[17] = external_variable(voi, states, rates, variables, 17) - variables[18] = 0.125*exp(variables[1]/80.0) - rates[2] = variables[17]*(1.0-states[2])-variables[18]*states[2] + algebraic[1] = external_variable(voi, states, rates, variables, 1) + algebraic[11] = 0.1*(algebraic[1]+25.0)/(exp((algebraic[1]+25.0)/10.0)-1.0) + algebraic[12] = 4.0*exp(algebraic[1]/18.0) + rates[1] = algebraic[11]*(1.0-states[1])-algebraic[12]*states[1] + algebraic[13] = 0.07*exp(algebraic[1]/20.0) + algebraic[14] = 1.0/(exp((algebraic[1]+30.0)/10.0)+1.0) + rates[0] = algebraic[13]*(1.0-states[0])-algebraic[14]*states[0] + algebraic[17] = external_variable(voi, states, rates, variables, 17) + algebraic[18] = 0.125*exp(algebraic[1]/80.0) + rates[2] = algebraic[17]*(1.0-states[2])-algebraic[18]*states[2] def compute_variables(voi, states, rates, constants, computed_constants, algebraic, external_variable): - variables[0] = -20.0 if and_func(geq_func(voi, 10.0), leq_func(voi, 10.5)) else 0.0 - variables[1] = external_variable(voi, states, rates, variables, 1) - variables[2] = variables[8]*(variables[1]-variables[7]) - variables[17] = external_variable(voi, states, rates, variables, 17) - variables[4] = external_variable(voi, states, rates, variables, 4) - variables[3] = variables[16]*pow(states[2], 4.0)*(variables[1]-variables[15]) + algebraic[0] = -20.0 if and_func(geq_func(voi, 10.0), leq_func(voi, 10.5)) else 0.0 + algebraic[1] = external_variable(voi, states, rates, variables, 1) + algebraic[2] = constants[8]*(algebraic[1]-computed_constants[7]) + algebraic[17] = external_variable(voi, states, rates, variables, 17) + algebraic[4] = external_variable(voi, states, rates, variables, 4) + algebraic[3] = constants[16]*pow(states[2], 4.0)*(algebraic[1]-computed_constants[15]) diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.py index a1d5201a66..87eb31f08e 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.py @@ -73,11 +73,11 @@ def create_variables_array(): def initialise_variables(states, rates, constants): - variables[4] = 1.0 - variables[5] = 0.0 - variables[7] = 0.3 - variables[9] = 120.0 - variables[15] = 36.0 + constants[4] = 1.0 + constants[5] = 0.0 + constants[7] = 0.3 + constants[9] = 120.0 + constants[15] = 36.0 states[0] = 0.0 states[1] = 0.6 states[2] = 0.05 @@ -85,35 +85,35 @@ def initialise_variables(states, rates, constants): def compute_computed_constants(constants, computed_constants): - variables[6] = variables[5]-10.613 - variables[8] = variables[5]-115.0 - variables[14] = variables[5]+12.0 + computed_constants[6] = constants[5]-10.613 + computed_constants[8] = constants[5]-115.0 + computed_constants[14] = constants[5]+12.0 def compute_rates(voi, states, rates, constants, computed_constants, algebraic): - variables[0] = -20.0 if and_func(geq_func(voi, 10.0), leq_func(voi, 10.5)) else 0.0 - variables[1] = variables[7]*(states[0]-variables[6]) - variables[2] = variables[15]*pow(states[3], 4.0)*(states[0]-variables[14]) - variables[3] = variables[9]*pow(states[2], 3.0)*states[1]*(states[0]-variables[8]) - rates[0] = -(-variables[0]+variables[3]+variables[2]+variables[1])/variables[4] - variables[10] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0) - variables[11] = 4.0*exp(states[0]/18.0) - rates[2] = variables[10]*(1.0-states[2])-variables[11]*states[2] - variables[12] = 0.07*exp(states[0]/20.0) - variables[13] = 1.0/(exp((states[0]+30.0)/10.0)+1.0) - rates[1] = variables[12]*(1.0-states[1])-variables[13]*states[1] - variables[16] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0) - variables[17] = 0.125*exp(states[0]/80.0) - rates[3] = variables[16]*(1.0-states[3])-variables[17]*states[3] + algebraic[0] = -20.0 if and_func(geq_func(voi, 10.0), leq_func(voi, 10.5)) else 0.0 + algebraic[1] = constants[7]*(states[0]-computed_constants[6]) + algebraic[2] = constants[15]*pow(states[3], 4.0)*(states[0]-computed_constants[14]) + algebraic[3] = constants[9]*pow(states[2], 3.0)*states[1]*(states[0]-computed_constants[8]) + rates[0] = -(-algebraic[0]+algebraic[3]+algebraic[2]+algebraic[1])/constants[4] + algebraic[10] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0) + algebraic[11] = 4.0*exp(states[0]/18.0) + rates[2] = algebraic[10]*(1.0-states[2])-algebraic[11]*states[2] + algebraic[12] = 0.07*exp(states[0]/20.0) + algebraic[13] = 1.0/(exp((states[0]+30.0)/10.0)+1.0) + rates[1] = algebraic[12]*(1.0-states[1])-algebraic[13]*states[1] + algebraic[16] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0) + algebraic[17] = 0.125*exp(states[0]/80.0) + rates[3] = algebraic[16]*(1.0-states[3])-algebraic[17]*states[3] def compute_variables(voi, states, rates, constants, computed_constants, algebraic): - variables[1] = variables[7]*(states[0]-variables[6]) - variables[3] = variables[9]*pow(states[2], 3.0)*states[1]*(states[0]-variables[8]) - variables[10] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0) - variables[11] = 4.0*exp(states[0]/18.0) - variables[12] = 0.07*exp(states[0]/20.0) - variables[13] = 1.0/(exp((states[0]+30.0)/10.0)+1.0) - variables[2] = variables[15]*pow(states[3], 4.0)*(states[0]-variables[14]) - variables[16] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0) - variables[17] = 0.125*exp(states[0]/80.0) + algebraic[1] = constants[7]*(states[0]-computed_constants[6]) + algebraic[3] = constants[9]*pow(states[2], 3.0)*states[1]*(states[0]-computed_constants[8]) + algebraic[10] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0) + algebraic[11] = 4.0*exp(states[0]/18.0) + algebraic[12] = 0.07*exp(states[0]/20.0) + algebraic[13] = 1.0/(exp((states[0]+30.0)/10.0)+1.0) + algebraic[2] = constants[15]*pow(states[3], 4.0)*(states[0]-computed_constants[14]) + algebraic[16] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0) + algebraic[17] = 0.125*exp(states[0]/80.0) diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.c index b042ee21e7..083b39125e 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.c @@ -72,50 +72,50 @@ void deleteArray(double *array) void initialiseVariables(double voi, double *states, double *rates, double *constants, ExternalVariable externalVariable) { - variables[4] = 1.0; - variables[5] = 0.0; - variables[7] = 0.3; - variables[9] = 120.0; - variables[16] = 36.0; + constants[4] = 1.0; + constants[5] = 0.0; + constants[7] = 0.3; + constants[9] = 120.0; + constants[16] = 36.0; states[0] = 0.0; states[1] = 0.6; states[2] = 0.325; - variables[10] = externalVariable(voi, states, rates, variables, 10); + algebraic[10] = externalVariable(voi, states, rates, variables, 10); } void computeComputedConstants(double *constants, double *computedConstants) { - variables[6] = variables[5]-10.613; - variables[8] = variables[5]-115.0; - variables[15] = variables[5]+12.0; + computedConstants[6] = constants[5]-10.613; + computedConstants[8] = constants[5]-115.0; + computedConstants[15] = constants[5]+12.0; } void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) { - variables[0] = ((voi >= 10.0) && (voi <= 10.5))?-20.0:0.0; - variables[1] = variables[7]*(states[0]-variables[6]); - variables[2] = variables[16]*pow(states[2], 4.0)*(states[0]-variables[15]); - variables[10] = externalVariable(voi, states, rates, variables, 10); - variables[3] = variables[9]*pow(variables[10], 3.0)*states[1]*(states[0]-variables[8]); - rates[0] = -(-variables[0]+variables[3]+variables[2]+variables[1])/variables[4]; - variables[13] = 0.07*exp(states[0]/20.0); - variables[14] = 1.0/(exp((states[0]+30.0)/10.0)+1.0); - rates[1] = variables[13]*(1.0-states[1])-variables[14]*states[1]; - variables[17] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0); - variables[18] = 0.125*exp(states[0]/80.0); - rates[2] = variables[17]*(1.0-states[2])-variables[18]*states[2]; + algebraic[0] = ((voi >= 10.0) && (voi <= 10.5))?-20.0:0.0; + algebraic[1] = constants[7]*(states[0]-computedConstants[6]); + algebraic[2] = constants[16]*pow(states[2], 4.0)*(states[0]-computedConstants[15]); + algebraic[10] = externalVariable(voi, states, rates, variables, 10); + algebraic[3] = constants[9]*pow(algebraic[10], 3.0)*states[1]*(states[0]-computedConstants[8]); + rates[0] = -(-algebraic[0]+algebraic[3]+algebraic[2]+algebraic[1])/constants[4]; + algebraic[13] = 0.07*exp(states[0]/20.0); + algebraic[14] = 1.0/(exp((states[0]+30.0)/10.0)+1.0); + rates[1] = algebraic[13]*(1.0-states[1])-algebraic[14]*states[1]; + algebraic[17] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0); + algebraic[18] = 0.125*exp(states[0]/80.0); + rates[2] = algebraic[17]*(1.0-states[2])-algebraic[18]*states[2]; } void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) { - variables[1] = variables[7]*(states[0]-variables[6]); - variables[10] = externalVariable(voi, states, rates, variables, 10); - variables[3] = variables[9]*pow(variables[10], 3.0)*states[1]*(states[0]-variables[8]); - variables[11] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0); - variables[12] = 4.0*exp(states[0]/18.0); - variables[13] = 0.07*exp(states[0]/20.0); - variables[14] = 1.0/(exp((states[0]+30.0)/10.0)+1.0); - variables[2] = variables[16]*pow(states[2], 4.0)*(states[0]-variables[15]); - variables[17] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0); - variables[18] = 0.125*exp(states[0]/80.0); + algebraic[1] = constants[7]*(states[0]-computedConstants[6]); + algebraic[10] = externalVariable(voi, states, rates, variables, 10); + algebraic[3] = constants[9]*pow(algebraic[10], 3.0)*states[1]*(states[0]-computedConstants[8]); + algebraic[11] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0); + algebraic[12] = 4.0*exp(states[0]/18.0); + algebraic[13] = 0.07*exp(states[0]/20.0); + algebraic[14] = 1.0/(exp((states[0]+30.0)/10.0)+1.0); + algebraic[2] = constants[16]*pow(states[2], 4.0)*(states[0]-computedConstants[15]); + algebraic[17] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0); + algebraic[18] = 0.125*exp(states[0]/80.0); } diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.py index 39debf9ca9..bee8d59e4f 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.py @@ -74,46 +74,46 @@ def create_variables_array(): def initialise_variables(voi, states, rates, constants, external_variable): - variables[4] = 1.0 - variables[5] = 0.0 - variables[7] = 0.3 - variables[9] = 120.0 - variables[16] = 36.0 + constants[4] = 1.0 + constants[5] = 0.0 + constants[7] = 0.3 + constants[9] = 120.0 + constants[16] = 36.0 states[0] = 0.0 states[1] = 0.6 states[2] = 0.325 - variables[10] = external_variable(voi, states, rates, variables, 10) + algebraic[10] = external_variable(voi, states, rates, variables, 10) def compute_computed_constants(constants, computed_constants): - variables[6] = variables[5]-10.613 - variables[8] = variables[5]-115.0 - variables[15] = variables[5]+12.0 + computed_constants[6] = constants[5]-10.613 + computed_constants[8] = constants[5]-115.0 + computed_constants[15] = constants[5]+12.0 def compute_rates(voi, states, rates, constants, computed_constants, algebraic, external_variable): - variables[0] = -20.0 if and_func(geq_func(voi, 10.0), leq_func(voi, 10.5)) else 0.0 - variables[1] = variables[7]*(states[0]-variables[6]) - variables[2] = variables[16]*pow(states[2], 4.0)*(states[0]-variables[15]) - variables[10] = external_variable(voi, states, rates, variables, 10) - variables[3] = variables[9]*pow(variables[10], 3.0)*states[1]*(states[0]-variables[8]) - rates[0] = -(-variables[0]+variables[3]+variables[2]+variables[1])/variables[4] - variables[13] = 0.07*exp(states[0]/20.0) - variables[14] = 1.0/(exp((states[0]+30.0)/10.0)+1.0) - rates[1] = variables[13]*(1.0-states[1])-variables[14]*states[1] - variables[17] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0) - variables[18] = 0.125*exp(states[0]/80.0) - rates[2] = variables[17]*(1.0-states[2])-variables[18]*states[2] + algebraic[0] = -20.0 if and_func(geq_func(voi, 10.0), leq_func(voi, 10.5)) else 0.0 + algebraic[1] = constants[7]*(states[0]-computed_constants[6]) + algebraic[2] = constants[16]*pow(states[2], 4.0)*(states[0]-computed_constants[15]) + algebraic[10] = external_variable(voi, states, rates, variables, 10) + algebraic[3] = constants[9]*pow(algebraic[10], 3.0)*states[1]*(states[0]-computed_constants[8]) + rates[0] = -(-algebraic[0]+algebraic[3]+algebraic[2]+algebraic[1])/constants[4] + algebraic[13] = 0.07*exp(states[0]/20.0) + algebraic[14] = 1.0/(exp((states[0]+30.0)/10.0)+1.0) + rates[1] = algebraic[13]*(1.0-states[1])-algebraic[14]*states[1] + algebraic[17] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0) + algebraic[18] = 0.125*exp(states[0]/80.0) + rates[2] = algebraic[17]*(1.0-states[2])-algebraic[18]*states[2] def compute_variables(voi, states, rates, constants, computed_constants, algebraic, external_variable): - variables[1] = variables[7]*(states[0]-variables[6]) - variables[10] = external_variable(voi, states, rates, variables, 10) - variables[3] = variables[9]*pow(variables[10], 3.0)*states[1]*(states[0]-variables[8]) - variables[11] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0) - variables[12] = 4.0*exp(states[0]/18.0) - variables[13] = 0.07*exp(states[0]/20.0) - variables[14] = 1.0/(exp((states[0]+30.0)/10.0)+1.0) - variables[2] = variables[16]*pow(states[2], 4.0)*(states[0]-variables[15]) - variables[17] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0) - variables[18] = 0.125*exp(states[0]/80.0) + algebraic[1] = constants[7]*(states[0]-computed_constants[6]) + algebraic[10] = external_variable(voi, states, rates, variables, 10) + algebraic[3] = constants[9]*pow(algebraic[10], 3.0)*states[1]*(states[0]-computed_constants[8]) + algebraic[11] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0) + algebraic[12] = 4.0*exp(states[0]/18.0) + algebraic[13] = 0.07*exp(states[0]/20.0) + algebraic[14] = 1.0/(exp((states[0]+30.0)/10.0)+1.0) + algebraic[2] = constants[16]*pow(states[2], 4.0)*(states[0]-computed_constants[15]) + algebraic[17] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0) + algebraic[18] = 0.125*exp(states[0]/80.0) diff --git a/tests/resources/generator/noble_model_1962/model.c b/tests/resources/generator/noble_model_1962/model.c index 8edc882e14..e8a1804744 100644 --- a/tests/resources/generator/noble_model_1962/model.c +++ b/tests/resources/generator/noble_model_1962/model.c @@ -71,11 +71,11 @@ void deleteArray(double *array) void initialiseVariables(double *states, double *rates, double *constants) { - variables[3] = 12.0; - variables[4] = 0.075; - variables[5] = -60.0; - variables[7] = 400.0; - variables[8] = 40.0; + constants[3] = 12.0; + constants[4] = 0.075; + constants[5] = -60.0; + constants[7] = 400.0; + constants[8] = 40.0; states[0] = -87.0; states[1] = 0.01; states[2] = 0.8; @@ -88,36 +88,36 @@ void computeComputedConstants(double *constants, double *computedConstants) void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { - variables[6] = pow(states[1], 3.0)*states[2]*variables[7]; - variables[0] = (variables[6]+0.14)*(states[0]-variables[8]); - variables[1] = variables[4]*(states[0]-variables[5]); - variables[13] = 1.2*exp((-states[0]-90.0)/50.0)+0.015*exp((states[0]+90.0)/60.0); - variables[14] = 1.2*pow(states[3], 4.0); - variables[2] = (variables[13]+variables[14])*(states[0]+100.0); - rates[0] = -(variables[0]+variables[2]+variables[1])/variables[3]; - variables[9] = 0.1*(-states[0]-48.0)/(exp((-states[0]-48.0)/15.0)-1.0); - variables[10] = 0.12*(states[0]+8.0)/(exp((states[0]+8.0)/5.0)-1.0); - rates[1] = variables[9]*(1.0-states[1])-variables[10]*states[1]; - variables[11] = 0.17*exp((-states[0]-90.0)/20.0); - variables[12] = 1.0/(1.0+exp((-states[0]-42.0)/10.0)); - rates[2] = variables[11]*(1.0-states[2])-variables[12]*states[2]; - variables[15] = 0.0001*(-states[0]-50.0)/(exp((-states[0]-50.0)/10.0)-1.0); - variables[16] = 0.002*exp((-states[0]-90.0)/80.0); - rates[3] = variables[15]*(1.0-states[3])-variables[16]*states[3]; + algebraic[6] = pow(states[1], 3.0)*states[2]*constants[7]; + algebraic[0] = (algebraic[6]+0.14)*(states[0]-constants[8]); + algebraic[1] = constants[4]*(states[0]-constants[5]); + algebraic[13] = 1.2*exp((-states[0]-90.0)/50.0)+0.015*exp((states[0]+90.0)/60.0); + algebraic[14] = 1.2*pow(states[3], 4.0); + algebraic[2] = (algebraic[13]+algebraic[14])*(states[0]+100.0); + rates[0] = -(algebraic[0]+algebraic[2]+algebraic[1])/constants[3]; + algebraic[9] = 0.1*(-states[0]-48.0)/(exp((-states[0]-48.0)/15.0)-1.0); + algebraic[10] = 0.12*(states[0]+8.0)/(exp((states[0]+8.0)/5.0)-1.0); + rates[1] = algebraic[9]*(1.0-states[1])-algebraic[10]*states[1]; + algebraic[11] = 0.17*exp((-states[0]-90.0)/20.0); + algebraic[12] = 1.0/(1.0+exp((-states[0]-42.0)/10.0)); + rates[2] = algebraic[11]*(1.0-states[2])-algebraic[12]*states[2]; + algebraic[15] = 0.0001*(-states[0]-50.0)/(exp((-states[0]-50.0)/10.0)-1.0); + algebraic[16] = 0.002*exp((-states[0]-90.0)/80.0); + rates[3] = algebraic[15]*(1.0-states[3])-algebraic[16]*states[3]; } void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { - variables[1] = variables[4]*(states[0]-variables[5]); - variables[6] = pow(states[1], 3.0)*states[2]*variables[7]; - variables[0] = (variables[6]+0.14)*(states[0]-variables[8]); - variables[9] = 0.1*(-states[0]-48.0)/(exp((-states[0]-48.0)/15.0)-1.0); - variables[10] = 0.12*(states[0]+8.0)/(exp((states[0]+8.0)/5.0)-1.0); - variables[11] = 0.17*exp((-states[0]-90.0)/20.0); - variables[12] = 1.0/(1.0+exp((-states[0]-42.0)/10.0)); - variables[13] = 1.2*exp((-states[0]-90.0)/50.0)+0.015*exp((states[0]+90.0)/60.0); - variables[14] = 1.2*pow(states[3], 4.0); - variables[2] = (variables[13]+variables[14])*(states[0]+100.0); - variables[15] = 0.0001*(-states[0]-50.0)/(exp((-states[0]-50.0)/10.0)-1.0); - variables[16] = 0.002*exp((-states[0]-90.0)/80.0); + algebraic[1] = constants[4]*(states[0]-constants[5]); + algebraic[6] = pow(states[1], 3.0)*states[2]*constants[7]; + algebraic[0] = (algebraic[6]+0.14)*(states[0]-constants[8]); + algebraic[9] = 0.1*(-states[0]-48.0)/(exp((-states[0]-48.0)/15.0)-1.0); + algebraic[10] = 0.12*(states[0]+8.0)/(exp((states[0]+8.0)/5.0)-1.0); + algebraic[11] = 0.17*exp((-states[0]-90.0)/20.0); + algebraic[12] = 1.0/(1.0+exp((-states[0]-42.0)/10.0)); + algebraic[13] = 1.2*exp((-states[0]-90.0)/50.0)+0.015*exp((states[0]+90.0)/60.0); + algebraic[14] = 1.2*pow(states[3], 4.0); + algebraic[2] = (algebraic[13]+algebraic[14])*(states[0]+100.0); + algebraic[15] = 0.0001*(-states[0]-50.0)/(exp((-states[0]-50.0)/10.0)-1.0); + algebraic[16] = 0.002*exp((-states[0]-90.0)/80.0); } diff --git a/tests/resources/generator/noble_model_1962/model.py b/tests/resources/generator/noble_model_1962/model.py index 878cc89603..d9672b95f4 100644 --- a/tests/resources/generator/noble_model_1962/model.py +++ b/tests/resources/generator/noble_model_1962/model.py @@ -60,11 +60,11 @@ def create_variables_array(): def initialise_variables(states, rates, constants): - variables[3] = 12.0 - variables[4] = 0.075 - variables[5] = -60.0 - variables[7] = 400.0 - variables[8] = 40.0 + constants[3] = 12.0 + constants[4] = 0.075 + constants[5] = -60.0 + constants[7] = 400.0 + constants[8] = 40.0 states[0] = -87.0 states[1] = 0.01 states[2] = 0.8 @@ -76,34 +76,34 @@ def compute_computed_constants(constants, computed_constants): def compute_rates(voi, states, rates, constants, computed_constants, algebraic): - variables[6] = pow(states[1], 3.0)*states[2]*variables[7] - variables[0] = (variables[6]+0.14)*(states[0]-variables[8]) - variables[1] = variables[4]*(states[0]-variables[5]) - variables[13] = 1.2*exp((-states[0]-90.0)/50.0)+0.015*exp((states[0]+90.0)/60.0) - variables[14] = 1.2*pow(states[3], 4.0) - variables[2] = (variables[13]+variables[14])*(states[0]+100.0) - rates[0] = -(variables[0]+variables[2]+variables[1])/variables[3] - variables[9] = 0.1*(-states[0]-48.0)/(exp((-states[0]-48.0)/15.0)-1.0) - variables[10] = 0.12*(states[0]+8.0)/(exp((states[0]+8.0)/5.0)-1.0) - rates[1] = variables[9]*(1.0-states[1])-variables[10]*states[1] - variables[11] = 0.17*exp((-states[0]-90.0)/20.0) - variables[12] = 1.0/(1.0+exp((-states[0]-42.0)/10.0)) - rates[2] = variables[11]*(1.0-states[2])-variables[12]*states[2] - variables[15] = 0.0001*(-states[0]-50.0)/(exp((-states[0]-50.0)/10.0)-1.0) - variables[16] = 0.002*exp((-states[0]-90.0)/80.0) - rates[3] = variables[15]*(1.0-states[3])-variables[16]*states[3] + algebraic[6] = pow(states[1], 3.0)*states[2]*constants[7] + algebraic[0] = (algebraic[6]+0.14)*(states[0]-constants[8]) + algebraic[1] = constants[4]*(states[0]-constants[5]) + algebraic[13] = 1.2*exp((-states[0]-90.0)/50.0)+0.015*exp((states[0]+90.0)/60.0) + algebraic[14] = 1.2*pow(states[3], 4.0) + algebraic[2] = (algebraic[13]+algebraic[14])*(states[0]+100.0) + rates[0] = -(algebraic[0]+algebraic[2]+algebraic[1])/constants[3] + algebraic[9] = 0.1*(-states[0]-48.0)/(exp((-states[0]-48.0)/15.0)-1.0) + algebraic[10] = 0.12*(states[0]+8.0)/(exp((states[0]+8.0)/5.0)-1.0) + rates[1] = algebraic[9]*(1.0-states[1])-algebraic[10]*states[1] + algebraic[11] = 0.17*exp((-states[0]-90.0)/20.0) + algebraic[12] = 1.0/(1.0+exp((-states[0]-42.0)/10.0)) + rates[2] = algebraic[11]*(1.0-states[2])-algebraic[12]*states[2] + algebraic[15] = 0.0001*(-states[0]-50.0)/(exp((-states[0]-50.0)/10.0)-1.0) + algebraic[16] = 0.002*exp((-states[0]-90.0)/80.0) + rates[3] = algebraic[15]*(1.0-states[3])-algebraic[16]*states[3] def compute_variables(voi, states, rates, constants, computed_constants, algebraic): - variables[1] = variables[4]*(states[0]-variables[5]) - variables[6] = pow(states[1], 3.0)*states[2]*variables[7] - variables[0] = (variables[6]+0.14)*(states[0]-variables[8]) - variables[9] = 0.1*(-states[0]-48.0)/(exp((-states[0]-48.0)/15.0)-1.0) - variables[10] = 0.12*(states[0]+8.0)/(exp((states[0]+8.0)/5.0)-1.0) - variables[11] = 0.17*exp((-states[0]-90.0)/20.0) - variables[12] = 1.0/(1.0+exp((-states[0]-42.0)/10.0)) - variables[13] = 1.2*exp((-states[0]-90.0)/50.0)+0.015*exp((states[0]+90.0)/60.0) - variables[14] = 1.2*pow(states[3], 4.0) - variables[2] = (variables[13]+variables[14])*(states[0]+100.0) - variables[15] = 0.0001*(-states[0]-50.0)/(exp((-states[0]-50.0)/10.0)-1.0) - variables[16] = 0.002*exp((-states[0]-90.0)/80.0) + algebraic[1] = constants[4]*(states[0]-constants[5]) + algebraic[6] = pow(states[1], 3.0)*states[2]*constants[7] + algebraic[0] = (algebraic[6]+0.14)*(states[0]-constants[8]) + algebraic[9] = 0.1*(-states[0]-48.0)/(exp((-states[0]-48.0)/15.0)-1.0) + algebraic[10] = 0.12*(states[0]+8.0)/(exp((states[0]+8.0)/5.0)-1.0) + algebraic[11] = 0.17*exp((-states[0]-90.0)/20.0) + algebraic[12] = 1.0/(1.0+exp((-states[0]-42.0)/10.0)) + algebraic[13] = 1.2*exp((-states[0]-90.0)/50.0)+0.015*exp((states[0]+90.0)/60.0) + algebraic[14] = 1.2*pow(states[3], 4.0) + algebraic[2] = (algebraic[13]+algebraic[14])*(states[0]+100.0) + algebraic[15] = 0.0001*(-states[0]-50.0)/(exp((-states[0]-50.0)/10.0)-1.0) + algebraic[16] = 0.002*exp((-states[0]-90.0)/80.0) diff --git a/tests/resources/generator/ode_computed_var_on_rhs/model.c b/tests/resources/generator/ode_computed_var_on_rhs/model.c index 741fc1a1ed..1bf89a3b88 100644 --- a/tests/resources/generator/ode_computed_var_on_rhs/model.c +++ b/tests/resources/generator/ode_computed_var_on_rhs/model.c @@ -52,7 +52,7 @@ void deleteArray(double *array) void initialiseVariables(double *states, double *rates, double *constants) { - variables[0] = 1.0; + computedConstants[0] = 1.0; states[0] = 1.0; } @@ -62,7 +62,7 @@ void computeComputedConstants(double *constants, double *computedConstants) void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { - rates[0] = variables[0]; + rates[0] = computedConstants[0]; } void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) diff --git a/tests/resources/generator/ode_computed_var_on_rhs/model.py b/tests/resources/generator/ode_computed_var_on_rhs/model.py index 865bb0a917..e60d2476d8 100644 --- a/tests/resources/generator/ode_computed_var_on_rhs/model.py +++ b/tests/resources/generator/ode_computed_var_on_rhs/model.py @@ -41,7 +41,7 @@ def create_variables_array(): def initialise_variables(states, rates, constants): - variables[0] = 1.0 + computed_constants[0] = 1.0 states[0] = 1.0 @@ -50,7 +50,7 @@ def compute_computed_constants(constants, computed_constants): def compute_rates(voi, states, rates, constants, computed_constants, algebraic): - rates[0] = variables[0] + rates[0] = computed_constants[0] def compute_variables(voi, states, rates, constants, computed_constants, algebraic): diff --git a/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.c b/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.c index 2bc00c84fa..cf371f670a 100644 --- a/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.c +++ b/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.c @@ -52,7 +52,7 @@ void deleteArray(double *array) void initialiseVariables(double *states, double *rates, double *constants) { - variables[0] = 1.0; + computedConstants[0] = 1.0; states[0] = 1.0; } @@ -62,7 +62,7 @@ void computeComputedConstants(double *constants, double *computedConstants) void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { - rates[0] = variables[0]; + rates[0] = computedConstants[0]; } void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) diff --git a/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.py b/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.py index 34f7dfbc53..847ad0446a 100644 --- a/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.py +++ b/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.py @@ -41,7 +41,7 @@ def create_variables_array(): def initialise_variables(states, rates, constants): - variables[0] = 1.0 + computed_constants[0] = 1.0 states[0] = 1.0 @@ -50,7 +50,7 @@ def compute_computed_constants(constants, computed_constants): def compute_rates(voi, states, rates, constants, computed_constants, algebraic): - rates[0] = variables[0] + rates[0] = computed_constants[0] def compute_variables(voi, states, rates, constants, computed_constants, algebraic): diff --git a/tests/resources/generator/ode_const_var_on_rhs/model.c b/tests/resources/generator/ode_const_var_on_rhs/model.c index 65d922d8b1..da29f52f60 100644 --- a/tests/resources/generator/ode_const_var_on_rhs/model.c +++ b/tests/resources/generator/ode_const_var_on_rhs/model.c @@ -52,7 +52,7 @@ void deleteArray(double *array) void initialiseVariables(double *states, double *rates, double *constants) { - variables[0] = 1.0; + constants[0] = 1.0; states[0] = 1.0; } @@ -62,7 +62,7 @@ void computeComputedConstants(double *constants, double *computedConstants) void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { - rates[0] = variables[0]; + rates[0] = constants[0]; } void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) diff --git a/tests/resources/generator/ode_const_var_on_rhs/model.py b/tests/resources/generator/ode_const_var_on_rhs/model.py index e2df2355f5..351e628e47 100644 --- a/tests/resources/generator/ode_const_var_on_rhs/model.py +++ b/tests/resources/generator/ode_const_var_on_rhs/model.py @@ -41,7 +41,7 @@ def create_variables_array(): def initialise_variables(states, rates, constants): - variables[0] = 1.0 + constants[0] = 1.0 states[0] = 1.0 @@ -50,7 +50,7 @@ def compute_computed_constants(constants, computed_constants): def compute_rates(voi, states, rates, constants, computed_constants, algebraic): - rates[0] = variables[0] + rates[0] = constants[0] def compute_variables(voi, states, rates, constants, computed_constants, algebraic): diff --git a/tests/resources/generator/ode_const_var_on_rhs_one_component/model.c b/tests/resources/generator/ode_const_var_on_rhs_one_component/model.c index 8ea505b7f0..9f18d3d5e9 100644 --- a/tests/resources/generator/ode_const_var_on_rhs_one_component/model.c +++ b/tests/resources/generator/ode_const_var_on_rhs_one_component/model.c @@ -52,7 +52,7 @@ void deleteArray(double *array) void initialiseVariables(double *states, double *rates, double *constants) { - variables[0] = 1.0; + constants[0] = 1.0; states[0] = 1.0; } @@ -62,7 +62,7 @@ void computeComputedConstants(double *constants, double *computedConstants) void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { - rates[0] = variables[0]; + rates[0] = constants[0]; } void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) diff --git a/tests/resources/generator/ode_const_var_on_rhs_one_component/model.py b/tests/resources/generator/ode_const_var_on_rhs_one_component/model.py index 939cc09a0c..0ed240fa53 100644 --- a/tests/resources/generator/ode_const_var_on_rhs_one_component/model.py +++ b/tests/resources/generator/ode_const_var_on_rhs_one_component/model.py @@ -41,7 +41,7 @@ def create_variables_array(): def initialise_variables(states, rates, constants): - variables[0] = 1.0 + constants[0] = 1.0 states[0] = 1.0 @@ -50,7 +50,7 @@ def compute_computed_constants(constants, computed_constants): def compute_rates(voi, states, rates, constants, computed_constants, algebraic): - rates[0] = variables[0] + rates[0] = constants[0] def compute_variables(voi, states, rates, constants, computed_constants, algebraic): diff --git a/tests/resources/generator/ode_multiple_dependent_odes/model.c b/tests/resources/generator/ode_multiple_dependent_odes/model.c index bab99e785c..89cfc22b72 100644 --- a/tests/resources/generator/ode_multiple_dependent_odes/model.c +++ b/tests/resources/generator/ode_multiple_dependent_odes/model.c @@ -53,7 +53,7 @@ void deleteArray(double *array) void initialiseVariables(double *states, double *rates, double *constants) { - variables[0] = 1.0; + constants[0] = 1.0; states[0] = -2.0; states[1] = 0.0; } @@ -65,7 +65,7 @@ void computeComputedConstants(double *constants, double *computedConstants) void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { rates[0] = states[1]*1.0; - rates[1] = (variables[0]*(1.0-pow(states[0], 2.0))*states[1]-states[0])*1.0; + rates[1] = (constants[0]*(1.0-pow(states[0], 2.0))*states[1]-states[0])*1.0; } void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) diff --git a/tests/resources/generator/ode_multiple_dependent_odes/model.py b/tests/resources/generator/ode_multiple_dependent_odes/model.py index 50498a2bad..34b35116b6 100644 --- a/tests/resources/generator/ode_multiple_dependent_odes/model.py +++ b/tests/resources/generator/ode_multiple_dependent_odes/model.py @@ -42,7 +42,7 @@ def create_variables_array(): def initialise_variables(states, rates, constants): - variables[0] = 1.0 + constants[0] = 1.0 states[0] = -2.0 states[1] = 0.0 @@ -53,7 +53,7 @@ def compute_computed_constants(constants, computed_constants): def compute_rates(voi, states, rates, constants, computed_constants, algebraic): rates[0] = states[1]*1.0 - rates[1] = (variables[0]*(1.0-pow(states[0], 2.0))*states[1]-states[0])*1.0 + rates[1] = (constants[0]*(1.0-pow(states[0], 2.0))*states[1]-states[0])*1.0 def compute_variables(voi, states, rates, constants, computed_constants, algebraic): diff --git a/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.c b/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.c index c5e7e02a6a..00d0e6e7a7 100644 --- a/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.c +++ b/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.c @@ -53,7 +53,7 @@ void deleteArray(double *array) void initialiseVariables(double *states, double *rates, double *constants) { - variables[0] = 1.0; + constants[0] = 1.0; states[0] = -2.0; states[1] = 0.0; } @@ -65,7 +65,7 @@ void computeComputedConstants(double *constants, double *computedConstants) void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { rates[0] = states[1]*1.0; - rates[1] = (variables[0]*(1.0-pow(states[0], 2.0))*states[1]-states[0])*1.0; + rates[1] = (constants[0]*(1.0-pow(states[0], 2.0))*states[1]-states[0])*1.0; } void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) diff --git a/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.py b/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.py index d5b1bf1b9a..59377dde9e 100644 --- a/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.py +++ b/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.py @@ -42,7 +42,7 @@ def create_variables_array(): def initialise_variables(states, rates, constants): - variables[0] = 1.0 + constants[0] = 1.0 states[0] = -2.0 states[1] = 0.0 @@ -53,7 +53,7 @@ def compute_computed_constants(constants, computed_constants): def compute_rates(voi, states, rates, constants, computed_constants, algebraic): rates[0] = states[1]*1.0 - rates[1] = (variables[0]*(1.0-pow(states[0], 2.0))*states[1]-states[0])*1.0 + rates[1] = (constants[0]*(1.0-pow(states[0], 2.0))*states[1]-states[0])*1.0 def compute_variables(voi, states, rates, constants, computed_constants, algebraic): diff --git a/tests/resources/generator/ode_multiple_odes_with_same_name/model.c b/tests/resources/generator/ode_multiple_odes_with_same_name/model.c index 967c844565..b3c86f5bbf 100644 --- a/tests/resources/generator/ode_multiple_odes_with_same_name/model.c +++ b/tests/resources/generator/ode_multiple_odes_with_same_name/model.c @@ -53,7 +53,7 @@ void deleteArray(double *array) void initialiseVariables(double *states, double *rates, double *constants) { - variables[0] = 1.0; + constants[0] = 1.0; states[0] = 1.0; states[1] = 1.0; } @@ -65,7 +65,7 @@ void computeComputedConstants(double *constants, double *computedConstants) void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { rates[0] = 1.0; - rates[1] = variables[0]; + rates[1] = constants[0]; } void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) diff --git a/tests/resources/generator/ode_multiple_odes_with_same_name/model.py b/tests/resources/generator/ode_multiple_odes_with_same_name/model.py index 8ac8235fc0..93bd5d2fd4 100644 --- a/tests/resources/generator/ode_multiple_odes_with_same_name/model.py +++ b/tests/resources/generator/ode_multiple_odes_with_same_name/model.py @@ -42,7 +42,7 @@ def create_variables_array(): def initialise_variables(states, rates, constants): - variables[0] = 1.0 + constants[0] = 1.0 states[0] = 1.0 states[1] = 1.0 @@ -53,7 +53,7 @@ def compute_computed_constants(constants, computed_constants): def compute_rates(voi, states, rates, constants, computed_constants, algebraic): rates[0] = 1.0 - rates[1] = variables[0] + rates[1] = constants[0] def compute_variables(voi, states, rates, constants, computed_constants, algebraic): diff --git a/tests/resources/generator/robertson_model_1966/model.dae.c b/tests/resources/generator/robertson_model_1966/model.dae.c index 1f99605fa1..d25ae1df36 100644 --- a/tests/resources/generator/robertson_model_1966/model.dae.c +++ b/tests/resources/generator/robertson_model_1966/model.dae.c @@ -72,9 +72,9 @@ void objectiveFunction0(double *u, double *f, void *data) double *rates = ((RootFindingInfo *) data)->rates; double *variables = ((RootFindingInfo *) data)->variables; - variables[2] = u[0]; + algebraic[2] = u[0]; - f[0] = 1.0-(states[0]+states[1]+variables[2]); + f[0] = 1.0-(states[0]+states[1]+algebraic[2]); } void findRoot0(double voi, double *states, double *rates, double *variables) @@ -82,19 +82,19 @@ void findRoot0(double voi, double *states, double *rates, double *variables) RootFindingInfo rfi = { voi, states, rates, variables }; double u[1]; - u[0] = variables[2]; + u[0] = algebraic[2]; nlaSolve(objectiveFunction0, u, 1, &rfi); - variables[2] = u[0]; + algebraic[2] = u[0]; } void initialiseVariables(double *states, double *rates, double *constants) { - variables[0] = 0.04; - variables[1] = 1.0e4; - variables[2] = 0.0; - variables[3] = 3.0e7; + constants[0] = 0.04; + constants[1] = 1.0e4; + algebraic[2] = 0.0; + constants[3] = 3.0e7; states[0] = 1.0; states[1] = 0.0; } @@ -106,12 +106,12 @@ void computeComputedConstants(double *constants, double *computedConstants) void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { findRoot0(voi, states, rates, variables); - rates[0] = -variables[0]*states[0]+variables[1]*states[1]*variables[2]; - rates[1] = variables[0]*states[0]-variables[3]*pow(states[1], 2.0)-variables[1]*states[1]*variables[2]; + rates[0] = -constants[0]*states[0]+constants[1]*states[1]*algebraic[2]; + rates[1] = constants[0]*states[0]-constants[3]*pow(states[1], 2.0)-constants[1]*states[1]*algebraic[2]; } void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { findRoot0(voi, states, rates, variables); - variables[4] = 10000.0*states[1]; + algebraic[4] = 10000.0*states[1]; } diff --git a/tests/resources/generator/robertson_model_1966/model.dae.py b/tests/resources/generator/robertson_model_1966/model.dae.py index 02d98e3c79..a01a61531f 100644 --- a/tests/resources/generator/robertson_model_1966/model.dae.py +++ b/tests/resources/generator/robertson_model_1966/model.dae.py @@ -54,26 +54,26 @@ def objective_function_0(u, f, data): rates = data[2] variables = data[3] - variables[2] = u[0] + algebraic[2] = u[0] - f[0] = 1.0-(states[0]+states[1]+variables[2]) + f[0] = 1.0-(states[0]+states[1]+algebraic[2]) def find_root_0(voi, states, rates, variables): u = [nan]*1 - u[0] = variables[2] + u[0] = algebraic[2] u = nla_solve(objective_function_0, u, 1, [voi, states, rates, variables]) - variables[2] = u[0] + algebraic[2] = u[0] def initialise_variables(states, rates, constants): - variables[0] = 0.04 - variables[1] = 1.0e4 - variables[2] = 0.0 - variables[3] = 3.0e7 + constants[0] = 0.04 + constants[1] = 1.0e4 + algebraic[2] = 0.0 + constants[3] = 3.0e7 states[0] = 1.0 states[1] = 0.0 @@ -84,10 +84,10 @@ def compute_computed_constants(constants, computed_constants): def compute_rates(voi, states, rates, constants, computed_constants, algebraic): find_root_0(voi, states, rates, variables) - rates[0] = -variables[0]*states[0]+variables[1]*states[1]*variables[2] - rates[1] = variables[0]*states[0]-variables[3]*pow(states[1], 2.0)-variables[1]*states[1]*variables[2] + rates[0] = -constants[0]*states[0]+constants[1]*states[1]*algebraic[2] + rates[1] = constants[0]*states[0]-constants[3]*pow(states[1], 2.0)-constants[1]*states[1]*algebraic[2] def compute_variables(voi, states, rates, constants, computed_constants, algebraic): find_root_0(voi, states, rates, variables) - variables[4] = 10000.0*states[1] + algebraic[4] = 10000.0*states[1] diff --git a/tests/resources/generator/robertson_model_1966/model.ode.c b/tests/resources/generator/robertson_model_1966/model.ode.c index 755412f68b..c513ea1bd3 100644 --- a/tests/resources/generator/robertson_model_1966/model.ode.c +++ b/tests/resources/generator/robertson_model_1966/model.ode.c @@ -57,9 +57,9 @@ void deleteArray(double *array) void initialiseVariables(double *states, double *rates, double *constants) { - variables[0] = 0.04; - variables[1] = 1.0e4; - variables[2] = 3.0e7; + constants[0] = 0.04; + constants[1] = 1.0e4; + constants[2] = 3.0e7; states[0] = 1.0; states[1] = 0.0; states[2] = 0.0; @@ -71,12 +71,12 @@ void computeComputedConstants(double *constants, double *computedConstants) void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { - rates[0] = -variables[0]*states[0]+variables[1]*states[2]*states[1]; - rates[2] = variables[0]*states[0]-variables[2]*pow(states[2], 2.0)-variables[1]*states[2]*states[1]; - rates[1] = variables[2]*pow(states[2], 2.0); + rates[0] = -constants[0]*states[0]+constants[1]*states[2]*states[1]; + rates[2] = constants[0]*states[0]-constants[2]*pow(states[2], 2.0)-constants[1]*states[2]*states[1]; + rates[1] = constants[2]*pow(states[2], 2.0); } void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { - variables[3] = 10000.0*states[2]; + algebraic[3] = 10000.0*states[2]; } diff --git a/tests/resources/generator/robertson_model_1966/model.ode.py b/tests/resources/generator/robertson_model_1966/model.ode.py index 5fba7eba4d..5724071fcd 100644 --- a/tests/resources/generator/robertson_model_1966/model.ode.py +++ b/tests/resources/generator/robertson_model_1966/model.ode.py @@ -46,9 +46,9 @@ def create_variables_array(): def initialise_variables(states, rates, constants): - variables[0] = 0.04 - variables[1] = 1.0e4 - variables[2] = 3.0e7 + constants[0] = 0.04 + constants[1] = 1.0e4 + constants[2] = 3.0e7 states[0] = 1.0 states[1] = 0.0 states[2] = 0.0 @@ -59,10 +59,10 @@ def compute_computed_constants(constants, computed_constants): def compute_rates(voi, states, rates, constants, computed_constants, algebraic): - rates[0] = -variables[0]*states[0]+variables[1]*states[2]*states[1] - rates[2] = variables[0]*states[0]-variables[2]*pow(states[2], 2.0)-variables[1]*states[2]*states[1] - rates[1] = variables[2]*pow(states[2], 2.0) + rates[0] = -constants[0]*states[0]+constants[1]*states[2]*states[1] + rates[2] = constants[0]*states[0]-constants[2]*pow(states[2], 2.0)-constants[1]*states[2]*states[1] + rates[1] = constants[2]*pow(states[2], 2.0) def compute_variables(voi, states, rates, constants, computed_constants, algebraic): - variables[3] = 10000.0*states[2] + algebraic[3] = 10000.0*states[2] diff --git a/tests/resources/generator/sine_model_imports/model.c b/tests/resources/generator/sine_model_imports/model.c index 29f467ca1f..6dfb92f02b 100644 --- a/tests/resources/generator/sine_model_imports/model.c +++ b/tests/resources/generator/sine_model_imports/model.c @@ -61,14 +61,14 @@ void deleteArray(double *array) void initialiseVariables(double *states, double *rates, double *constants) { - variables[1] = 0.0; - variables[3] = 0.75; - variables[4] = 2.0/3.14159265358979; - variables[5] = 2.0*3.14159265358979; - variables[6] = 3.14159265358979/2.0; - variables[7] = 3.14159265358979; - variables[8] = 3.0*3.14159265358979/2.0; - states[0] = variables[1]; + constants[1] = 0.0; + constants[3] = 0.75; + computedConstants[4] = 2.0/3.14159265358979; + computedConstants[5] = 2.0*3.14159265358979; + computedConstants[6] = 3.14159265358979/2.0; + computedConstants[7] = 3.14159265358979; + computedConstants[8] = 3.0*3.14159265358979/2.0; + states[0] = constants[1]; } void computeComputedConstants(double *constants, double *computedConstants) @@ -82,7 +82,7 @@ void computeRates(double voi, double *states, double *rates, double *constants, void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { - variables[0] = sin(voi); - variables[9] = (voi < variables[6])?voi*variables[4]-0.5:(voi < variables[7])?(3.14159265358979-voi)*variables[4]-0.5:(voi < variables[8])?(voi-3.14159265358979)*variables[4]-0.5:(variables[5]-voi)*variables[4]-0.5; - variables[2] = (voi < variables[6])?-variables[9]*variables[9]+variables[3]+variables[9]:(voi < variables[7])?-variables[9]*variables[9]+variables[3]+variables[9]:(voi < variables[8])?variables[9]*variables[9]-variables[3]-variables[9]:variables[9]*variables[9]-variables[3]-variables[9]; + algebraic[0] = sin(voi); + algebraic[9] = (voi < computedConstants[6])?voi*computedConstants[4]-0.5:(voi < computedConstants[7])?(3.14159265358979-voi)*computedConstants[4]-0.5:(voi < computedConstants[8])?(voi-3.14159265358979)*computedConstants[4]-0.5:(computedConstants[5]-voi)*computedConstants[4]-0.5; + algebraic[2] = (voi < computedConstants[6])?-algebraic[9]*algebraic[9]+constants[3]+algebraic[9]:(voi < computedConstants[7])?-algebraic[9]*algebraic[9]+constants[3]+algebraic[9]:(voi < computedConstants[8])?algebraic[9]*algebraic[9]-constants[3]-algebraic[9]:algebraic[9]*algebraic[9]-constants[3]-algebraic[9]; } diff --git a/tests/resources/generator/sine_model_imports/model.py b/tests/resources/generator/sine_model_imports/model.py index 3319297ff1..2c2c463977 100644 --- a/tests/resources/generator/sine_model_imports/model.py +++ b/tests/resources/generator/sine_model_imports/model.py @@ -54,14 +54,14 @@ def create_variables_array(): def initialise_variables(states, rates, constants): - variables[1] = 0.0 - variables[3] = 0.75 - variables[4] = 2.0/3.14159265358979 - variables[5] = 2.0*3.14159265358979 - variables[6] = 3.14159265358979/2.0 - variables[7] = 3.14159265358979 - variables[8] = 3.0*3.14159265358979/2.0 - states[0] = variables[1] + constants[1] = 0.0 + constants[3] = 0.75 + computed_constants[4] = 2.0/3.14159265358979 + computed_constants[5] = 2.0*3.14159265358979 + computed_constants[6] = 3.14159265358979/2.0 + computed_constants[7] = 3.14159265358979 + computed_constants[8] = 3.0*3.14159265358979/2.0 + states[0] = constants[1] def compute_computed_constants(constants, computed_constants): @@ -73,6 +73,6 @@ def compute_rates(voi, states, rates, constants, computed_constants, algebraic): def compute_variables(voi, states, rates, constants, computed_constants, algebraic): - variables[0] = sin(voi) - variables[9] = voi*variables[4]-0.5 if lt_func(voi, variables[6]) else (3.14159265358979-voi)*variables[4]-0.5 if lt_func(voi, variables[7]) else (voi-3.14159265358979)*variables[4]-0.5 if lt_func(voi, variables[8]) else (variables[5]-voi)*variables[4]-0.5 - variables[2] = -variables[9]*variables[9]+variables[3]+variables[9] if lt_func(voi, variables[6]) else -variables[9]*variables[9]+variables[3]+variables[9] if lt_func(voi, variables[7]) else variables[9]*variables[9]-variables[3]-variables[9] if lt_func(voi, variables[8]) else variables[9]*variables[9]-variables[3]-variables[9] + algebraic[0] = sin(voi) + algebraic[9] = voi*computed_constants[4]-0.5 if lt_func(voi, computed_constants[6]) else (3.14159265358979-voi)*computed_constants[4]-0.5 if lt_func(voi, computed_constants[7]) else (voi-3.14159265358979)*computed_constants[4]-0.5 if lt_func(voi, computed_constants[8]) else (computed_constants[5]-voi)*computed_constants[4]-0.5 + algebraic[2] = -algebraic[9]*algebraic[9]+constants[3]+algebraic[9] if lt_func(voi, computed_constants[6]) else -algebraic[9]*algebraic[9]+constants[3]+algebraic[9] if lt_func(voi, computed_constants[7]) else algebraic[9]*algebraic[9]-constants[3]-algebraic[9] if lt_func(voi, computed_constants[8]) else algebraic[9]*algebraic[9]-constants[3]-algebraic[9] diff --git a/tests/resources/generator/unknown_variable_as_external_variable/model.c b/tests/resources/generator/unknown_variable_as_external_variable/model.c index 1d5fac7e88..8167206cd0 100644 --- a/tests/resources/generator/unknown_variable_as_external_variable/model.c +++ b/tests/resources/generator/unknown_variable_as_external_variable/model.c @@ -43,15 +43,15 @@ void deleteArray(double *array) void initialiseVariables(double *constants, ExternalVariable externalVariable) { - variables[1] = 1.1; - variables[2] = 21262500.0; - variables[3] = 150.0; - variables[4] = 3402000.0; - variables[5] = 2.0; - variables[6] = 2902500.0; - variables[7] = 810000.0; - variables[8] = 247140.0; - variables[9] = externalVariable(variables, 9); + constants[1] = 1.1; + constants[2] = 21262500.0; + constants[3] = 150.0; + constants[4] = 3402000.0; + constants[5] = 2.0; + constants[6] = 2902500.0; + constants[7] = 810000.0; + constants[8] = 247140.0; + algebraic[9] = externalVariable(variables, 9); } void computeComputedConstants(double *constants, double *computedConstants) @@ -60,6 +60,6 @@ void computeComputedConstants(double *constants, double *computedConstants) void computeVariables(double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) { - variables[9] = externalVariable(variables, 9); - variables[0] = variables[1]*(variables[2]*variables[3]-variables[4]*variables[5])/(variables[6]*variables[5]+variables[9]*variables[3]+variables[8]*variables[5]*variables[3]+variables[7]); + algebraic[9] = externalVariable(variables, 9); + algebraic[0] = constants[1]*(constants[2]*constants[3]-constants[4]*constants[5])/(constants[6]*constants[5]+algebraic[9]*constants[3]+constants[8]*constants[5]*constants[3]+constants[7]); } diff --git a/tests/resources/generator/unknown_variable_as_external_variable/model.py b/tests/resources/generator/unknown_variable_as_external_variable/model.py index 8f2c23fba0..3c5f0470c2 100644 --- a/tests/resources/generator/unknown_variable_as_external_variable/model.py +++ b/tests/resources/generator/unknown_variable_as_external_variable/model.py @@ -38,15 +38,15 @@ def create_variables_array(): def initialise_variables(constants, external_variable): - variables[1] = 1.1 - variables[2] = 21262500.0 - variables[3] = 150.0 - variables[4] = 3402000.0 - variables[5] = 2.0 - variables[6] = 2902500.0 - variables[7] = 810000.0 - variables[8] = 247140.0 - variables[9] = external_variable(variables, 9) + constants[1] = 1.1 + constants[2] = 21262500.0 + constants[3] = 150.0 + constants[4] = 3402000.0 + constants[5] = 2.0 + constants[6] = 2902500.0 + constants[7] = 810000.0 + constants[8] = 247140.0 + algebraic[9] = external_variable(variables, 9) def compute_computed_constants(constants, computed_constants): @@ -54,5 +54,5 @@ def compute_computed_constants(constants, computed_constants): def compute_variables(constants, computed_constants, algebraic, external_variable): - variables[9] = external_variable(variables, 9) - variables[0] = variables[1]*(variables[2]*variables[3]-variables[4]*variables[5])/(variables[6]*variables[5]+variables[9]*variables[3]+variables[8]*variables[5]*variables[3]+variables[7]) + algebraic[9] = external_variable(variables, 9) + algebraic[0] = constants[1]*(constants[2]*constants[3]-constants[4]*constants[5])/(constants[6]*constants[5]+algebraic[9]*constants[3]+constants[8]*constants[5]*constants[3]+constants[7]) diff --git a/tests/resources/generator/variable_initialised_using_a_constant/model.c b/tests/resources/generator/variable_initialised_using_a_constant/model.c index bbd31e50ca..79800b918a 100644 --- a/tests/resources/generator/variable_initialised_using_a_constant/model.c +++ b/tests/resources/generator/variable_initialised_using_a_constant/model.c @@ -52,8 +52,8 @@ void deleteArray(double *array) void initialiseVariables(double *states, double *rates, double *constants) { - variables[0] = 7.0; - states[0] = variables[0]; + constants[0] = 7.0; + states[0] = constants[0]; } void computeComputedConstants(double *constants, double *computedConstants) diff --git a/tests/resources/generator/variable_initialised_using_a_constant/model.py b/tests/resources/generator/variable_initialised_using_a_constant/model.py index e6b607b12b..54a1159391 100644 --- a/tests/resources/generator/variable_initialised_using_a_constant/model.py +++ b/tests/resources/generator/variable_initialised_using_a_constant/model.py @@ -41,8 +41,8 @@ def create_variables_array(): def initialise_variables(states, rates, constants): - variables[0] = 7.0 - states[0] = variables[0] + constants[0] = 7.0 + states[0] = constants[0] def compute_computed_constants(constants, computed_constants): From 01bfdec489adc37a2e40fd2ed7ccce0da45d0360 Mon Sep 17 00:00:00 2001 From: Alan Garny Date: Thu, 8 Aug 2024 11:34:04 +0200 Subject: [PATCH 11/85] Analyser: track the constant, computed constant, and algebraic indexes. --- src/analyser.cpp | 32 +- tests/bindings/python/test_analyser.py | 2 +- tests/resources/coverage/generator/model.c | 434 +++++------ .../generator/model.implementation.out | 434 +++++------ .../generator/model.modified.profile.c | 434 +++++------ .../generator/model.modified.profile.py | 434 +++++------ tests/resources/coverage/generator/model.out | 434 +++++------ tests/resources/coverage/generator/model.py | 434 +++++------ .../algebraic_eqn_const_var_on_rhs/model.c | 4 +- .../algebraic_eqn_const_var_on_rhs/model.py | 4 +- .../algebraic_eqn_derivative_on_rhs/model.c | 2 +- .../algebraic_eqn_derivative_on_rhs/model.py | 2 +- .../model.c | 2 +- .../model.py | 2 +- .../algebraic_eqn_state_var_on_rhs/model.c | 2 +- .../algebraic_eqn_state_var_on_rhs/model.py | 2 +- .../model.c | 2 +- .../model.py | 2 +- .../model.c | 10 +- .../model.external.c | 4 +- .../model.external.py | 4 +- .../model.py | 10 +- .../model.not.ordered.c | 10 +- .../model.not.ordered.py | 10 +- .../model.ordered.c | 28 +- .../model.ordered.py | 28 +- .../generator/cell_geometry_model/model.c | 8 +- .../generator/cell_geometry_model/model.py | 8 +- .../generator/cellml_slc_example/model.py | 20 +- .../cellml_unit_scaling_constant/model.c | 4 +- .../cellml_unit_scaling_constant/model.py | 4 +- .../generator/dae_cellml_1_1_model/model.c | 34 +- .../generator/dae_cellml_1_1_model/model.py | 34 +- .../model.c | 684 +++++++++--------- .../model.py | 684 +++++++++--------- .../model.c | 504 ++++++------- .../model.py | 504 ++++++------- .../model.algebraic.c | 60 +- .../model.algebraic.py | 60 +- .../model.c | 60 +- .../model.computed.constant.c | 64 +- .../model.computed.constant.py | 64 +- .../model.constant.c | 56 +- .../model.constant.py | 56 +- .../model.dae.c | 114 +-- .../model.dae.py | 114 +-- .../model.dependent.algebraic.c | 62 +- .../model.dependent.algebraic.py | 62 +- .../model.dependent.computed.constant.c | 72 +- .../model.dependent.computed.constant.py | 72 +- .../model.dependent.constant.c | 60 +- .../model.dependent.constant.py | 60 +- .../model.dependent.state.c | 42 +- .../model.dependent.state.py | 42 +- .../model.external.c | 42 +- .../model.external.py | 42 +- .../model.py | 60 +- .../model.state.c | 60 +- .../model.state.py | 60 +- .../generator/noble_model_1962/model.c | 66 +- .../generator/noble_model_1962/model.py | 66 +- .../robertson_model_1966/model.dae.c | 18 +- .../robertson_model_1966/model.dae.py | 18 +- .../robertson_model_1966/model.ode.c | 2 +- .../robertson_model_1966/model.ode.py | 2 +- .../generator/sine_model_imports/model.c | 20 +- .../generator/sine_model_imports/model.py | 20 +- .../model.c | 22 +- .../model.py | 22 +- 69 files changed, 3455 insertions(+), 3439 deletions(-) diff --git a/src/analyser.cpp b/src/analyser.cpp index 23a6938618..d9a48da5da 100644 --- a/src/analyser.cpp +++ b/src/analyser.cpp @@ -208,7 +208,8 @@ struct AnalyserInternalEquation bool variableOnRhs(const AnalyserInternalVariablePtr &variable); bool variableOnLhsOrRhs(const AnalyserInternalVariablePtr &variable); - bool check(const AnalyserModelPtr &model, size_t &stateIndex, size_t &variableIndex, bool checkNlaSystems); + bool check(const AnalyserModelPtr &model, size_t &stateIndex, size_t &constantIndex, + size_t &computedConstantIndex, size_t &algebraicIndex, bool checkNlaSystems); }; AnalyserInternalEquationPtr AnalyserInternalEquation::create(const ComponentPtr &component) @@ -321,7 +322,8 @@ bool AnalyserInternalEquation::variableOnLhsOrRhs(const AnalyserInternalVariable } bool AnalyserInternalEquation::check(const AnalyserModelPtr &model, - size_t &stateIndex, size_t &variableIndex, + size_t &stateIndex, size_t &constantIndex, + size_t &computedConstantIndex, size_t &algebraicIndex, bool checkNlaSystems) { // Nothing to check if the equation has a known type. @@ -437,7 +439,12 @@ bool AnalyserInternalEquation::check(const AnalyserModelPtr &model, case AnalyserInternalVariable::Type::ALGEBRAIC: variable->mIndex = (variable->mType == AnalyserInternalVariable::Type::STATE) ? ++stateIndex : - ++variableIndex; + (variable->mType == AnalyserInternalVariable::Type::CONSTANT) ? + ++constantIndex : + ((variable->mType == AnalyserInternalVariable::Type::COMPUTED_TRUE_CONSTANT) + || (variable->mType == AnalyserInternalVariable::Type::COMPUTED_VARIABLE_BASED_CONSTANT)) ? + ++computedConstantIndex : + ++algebraicIndex; mUnknownVariables.push_back(variable); @@ -2748,7 +2755,9 @@ void Analyser::AnalyserImpl::analyseModel(const ModelPtr &model) // model valid). auto stateIndex = MAX_SIZE_T; - auto variableIndex = MAX_SIZE_T; + auto constantIndex = MAX_SIZE_T; + auto computedConstantIndex = MAX_SIZE_T; + auto algebraicIndex = MAX_SIZE_T; auto loopNumber = 1; bool relevantCheck; auto checkNlaSystems = false; @@ -2757,7 +2766,8 @@ void Analyser::AnalyserImpl::analyseModel(const ModelPtr &model) relevantCheck = false; for (const auto &internalEquation : mInternalEquations) { - relevantCheck = internalEquation->check(mModel, stateIndex, variableIndex, checkNlaSystems) + relevantCheck = internalEquation->check(mModel, stateIndex, constantIndex, computedConstantIndex, + algebraicIndex, checkNlaSystems) || relevantCheck; } @@ -2802,7 +2812,7 @@ void Analyser::AnalyserImpl::analyseModel(const ModelPtr &model) case AnalyserInternalVariable::Type::INITIALISED: // The variable is (still) initialised so it has to be a constant. - internalVariable->makeConstant(variableIndex); + internalVariable->makeConstant(constantIndex); break; case AnalyserInternalVariable::Type::OVERCONSTRAINED: @@ -3058,7 +3068,9 @@ void Analyser::AnalyserImpl::analyseModel(const ModelPtr &model) std::map v2avMappings; stateIndex = MAX_SIZE_T; - variableIndex = MAX_SIZE_T; + constantIndex = MAX_SIZE_T; + computedConstantIndex = MAX_SIZE_T; + algebraicIndex = MAX_SIZE_T; for (const auto &internalVariable : mInternalVariables) { // Determine the type of the variable. @@ -3108,7 +3120,11 @@ void Analyser::AnalyserImpl::analyseModel(const ModelPtr &model) variable->mPimpl->populate(type, (type == AnalyserVariable::Type::STATE) ? ++stateIndex : - ++variableIndex, + (type == AnalyserVariable::Type::CONSTANT) ? + ++constantIndex : + (type == AnalyserVariable::Type::COMPUTED_CONSTANT) ? + ++computedConstantIndex : + ++algebraicIndex, (type == AnalyserVariable::Type::EXTERNAL) ? nullptr : internalVariable->mInitialisingVariable, diff --git a/tests/bindings/python/test_analyser.py b/tests/bindings/python/test_analyser.py index 3895e4b40d..ca3d36b0e6 100644 --- a/tests/bindings/python/test_analyser.py +++ b/tests/bindings/python/test_analyser.py @@ -163,7 +163,7 @@ def test_coverage(self): self.assertEqual(AnalyserVariable.Type.CONSTANT, av.type()) self.assertEqual("constant", AnalyserVariable.typeAsString(av.type())) self.assertEqual("constant", AnalyserVariable_typeAsString(av.type())) - self.assertEqual(3, av.index()) + self.assertEqual(0, av.index()) self.assertIsNotNone(av.initialisingVariable()) self.assertIsNotNone(av.variable()) self.assertEqual(1, av.equationCount()) diff --git a/tests/resources/coverage/generator/model.c b/tests/resources/coverage/generator/model.c index 872419de42..0918ab6d4c 100644 --- a/tests/resources/coverage/generator/model.c +++ b/tests/resources/coverage/generator/model.c @@ -356,11 +356,11 @@ void objectiveFunction0(double *u, double *f, void *data) double *rates = ((RootFindingInfo *) data)->rates; double *variables = ((RootFindingInfo *) data)->variables; - algebraic[205] = u[0]; - algebraic[206] = u[1]; + algebraic[0] = u[0]; + algebraic[1] = u[1]; - f[0] = algebraic[205]+algebraic[206]+states[0]-0.0; - f[1] = algebraic[205]-algebraic[206]-(computedConstants[207]+computedConstants[208]); + f[0] = algebraic[0]+algebraic[1]+states[0]-0.0; + f[1] = algebraic[0]-algebraic[1]-(computedConstants[198]+computedConstants[199]); } void findRoot0(double voi, double *states, double *rates, double *variables) @@ -368,231 +368,231 @@ void findRoot0(double voi, double *states, double *rates, double *variables) RootFindingInfo rfi = { voi, states, rates, variables }; double u[2]; - u[0] = algebraic[205]; - u[1] = algebraic[206]; + u[0] = algebraic[0]; + u[1] = algebraic[1]; nlaSolve(objectiveFunction0, u, 2, &rfi); - algebraic[205] = u[0]; - algebraic[206] = u[1]; + algebraic[0] = u[0]; + algebraic[1] = u[1]; } void initialiseVariables(double *states, double *rates, double *constants) { - constants[1] = 1.0; - constants[2] = 2.0; - constants[6] = 3.0; - constants[18] = 4.0; - constants[179] = 5.0; - constants[180] = 6.0; - constants[182] = 7.0; - algebraic[205] = 1.0; - algebraic[206] = 2.0; - computedConstants[184] = 123.0; - computedConstants[185] = 123.456789; - computedConstants[186] = 123.0e99; - computedConstants[187] = 123.456789e99; - computedConstants[189] = 1.0; - computedConstants[190] = 0.0; - computedConstants[191] = 2.71828182845905; - computedConstants[192] = 3.14159265358979; - computedConstants[193] = INFINITY; - computedConstants[194] = NAN; - computedConstants[207] = 1.0; - computedConstants[208] = 3.0; + constants[0] = 1.0; + constants[1] = 2.0; + constants[2] = 3.0; + constants[3] = 4.0; + constants[4] = 5.0; + constants[5] = 6.0; + constants[6] = 7.0; + algebraic[0] = 1.0; + algebraic[1] = 2.0; + computedConstants[177] = 123.0; + computedConstants[178] = 123.456789; + computedConstants[179] = 123.0e99; + computedConstants[180] = 123.456789e99; + computedConstants[182] = 1.0; + computedConstants[183] = 0.0; + computedConstants[184] = 2.71828182845905; + computedConstants[185] = 3.14159265358979; + computedConstants[186] = INFINITY; + computedConstants[187] = NAN; + computedConstants[198] = 1.0; + computedConstants[199] = 3.0; states[0] = 0.0; } void computeComputedConstants(double *constants, double *computedConstants) { - computedConstants[0] = constants[1] == constants[2]; - computedConstants[3] = constants[1]/(constants[2] == constants[2]); - computedConstants[4] = constants[1] != constants[2]; - computedConstants[5] = constants[1]/(constants[2] != constants[6]); - computedConstants[7] = constants[1] < constants[2]; - computedConstants[8] = constants[1]/(constants[2] < constants[6]); - computedConstants[9] = constants[1] <= constants[2]; - computedConstants[10] = constants[1]/(constants[2] <= constants[6]); - computedConstants[11] = constants[1] > constants[2]; - computedConstants[12] = constants[1]/(constants[2] > constants[6]); - computedConstants[13] = constants[1] >= constants[2]; - computedConstants[14] = constants[1]/(constants[2] >= constants[6]); - computedConstants[15] = constants[1] && constants[2]; - computedConstants[16] = constants[1] && constants[2] && constants[6]; - computedConstants[17] = (constants[1] < constants[2]) && (constants[6] > constants[18]); - computedConstants[19] = (constants[1]+constants[2]) && (constants[6] > constants[18]); - computedConstants[20] = constants[1] && (constants[2] > constants[6]); - computedConstants[21] = (constants[1]-constants[2]) && (constants[6] > constants[18]); - computedConstants[22] = -constants[1] && (constants[2] > constants[6]); - computedConstants[23] = pow(constants[1], constants[2]) && (constants[6] > constants[18]); - computedConstants[24] = pow(constants[1], 1.0/constants[2]) && (constants[6] > constants[18]); - computedConstants[25] = (constants[1] < constants[2]) && (constants[6]+constants[18]); - computedConstants[26] = (constants[1] < constants[2]) && constants[6]; - computedConstants[27] = (constants[1] < constants[2]) && (constants[6]-constants[18]); - computedConstants[28] = (constants[1] < constants[2]) && -constants[6]; - computedConstants[29] = (constants[1] < constants[2]) && pow(constants[6], constants[18]); - computedConstants[30] = (constants[1] < constants[2]) && pow(constants[6], 1.0/constants[18]); - computedConstants[31] = constants[1]/(constants[2] && constants[6]); - computedConstants[32] = constants[1] || constants[2]; - computedConstants[33] = constants[1] || constants[2] || constants[6]; - computedConstants[34] = (constants[1] < constants[2]) || (constants[6] > constants[18]); - computedConstants[35] = (constants[1]+constants[2]) || (constants[6] > constants[18]); - computedConstants[36] = constants[1] || (constants[2] > constants[6]); - computedConstants[37] = (constants[1]-constants[2]) || (constants[6] > constants[18]); - computedConstants[38] = -constants[1] || (constants[2] > constants[6]); - computedConstants[39] = pow(constants[1], constants[2]) || (constants[6] > constants[18]); - computedConstants[40] = pow(constants[1], 1.0/constants[2]) || (constants[6] > constants[18]); - computedConstants[41] = (constants[1] < constants[2]) || (constants[6]+constants[18]); - computedConstants[42] = (constants[1] < constants[2]) || constants[6]; - computedConstants[43] = (constants[1] < constants[2]) || (constants[6]-constants[18]); - computedConstants[44] = (constants[1] < constants[2]) || -constants[6]; - computedConstants[45] = (constants[1] < constants[2]) || pow(constants[6], constants[18]); - computedConstants[46] = (constants[1] < constants[2]) || pow(constants[6], 1.0/constants[18]); - computedConstants[47] = constants[1]/(constants[2] || constants[6]); - computedConstants[48] = xor(constants[1], constants[2]); - computedConstants[49] = xor(constants[1], xor(constants[2], constants[6])); - computedConstants[50] = xor(constants[1] < constants[2], constants[6] > constants[18]); - computedConstants[51] = xor(constants[1]+constants[2], constants[6] > constants[18]); - computedConstants[52] = xor(constants[1], constants[2] > constants[6]); - computedConstants[53] = xor(constants[1]-constants[2], constants[6] > constants[18]); - computedConstants[54] = xor(-constants[1], constants[2] > constants[6]); - computedConstants[55] = xor(pow(constants[1], constants[2]), constants[6] > constants[18]); - computedConstants[56] = xor(pow(constants[1], 1.0/constants[2]), constants[6] > constants[18]); - computedConstants[57] = xor(constants[1] < constants[2], constants[6]+constants[18]); - computedConstants[58] = xor(constants[1] < constants[2], constants[6]); - computedConstants[59] = xor(constants[1] < constants[2], constants[6]-constants[18]); - computedConstants[60] = xor(constants[1] < constants[2], -constants[6]); - computedConstants[61] = xor(constants[1] < constants[2], pow(constants[6], constants[18])); - computedConstants[62] = xor(constants[1] < constants[2], pow(constants[6], 1.0/constants[18])); - computedConstants[63] = constants[1]/xor(constants[2], constants[6]); - computedConstants[64] = !constants[1]; - computedConstants[65] = constants[1]+constants[2]; - computedConstants[66] = constants[1]+constants[2]+constants[6]; - computedConstants[67] = (constants[1] < constants[2])+(constants[6] > constants[18]); - computedConstants[68] = constants[1]; - computedConstants[69] = constants[1]-constants[2]; - computedConstants[70] = (constants[1] < constants[2])-(constants[6] > constants[18]); - computedConstants[71] = (constants[1] < constants[2])-(constants[6]+constants[18]); - computedConstants[72] = (constants[1] < constants[2])-constants[6]; - computedConstants[73] = constants[1]-(-constants[2]); - computedConstants[74] = constants[1]-(-constants[2]*constants[6]); - computedConstants[75] = -constants[1]; - computedConstants[76] = -(constants[1] < constants[2]); - computedConstants[77] = constants[1]*constants[2]; - computedConstants[78] = constants[1]*constants[2]*constants[6]; - computedConstants[79] = (constants[1] < constants[2])*(constants[6] > constants[18]); - computedConstants[80] = (constants[1]+constants[2])*(constants[6] > constants[18]); - computedConstants[81] = constants[1]*(constants[2] > constants[6]); - computedConstants[82] = (constants[1]-constants[2])*(constants[6] > constants[18]); - computedConstants[83] = -constants[1]*(constants[2] > constants[6]); - computedConstants[84] = (constants[1] < constants[2])*(constants[6]+constants[18]); - computedConstants[85] = (constants[1] < constants[2])*constants[6]; - computedConstants[86] = (constants[1] < constants[2])*(constants[6]-constants[18]); - computedConstants[87] = (constants[1] < constants[2])*-constants[6]; - computedConstants[88] = constants[1]/constants[2]; - computedConstants[89] = (constants[1] < constants[2])/(constants[18] > constants[6]); - computedConstants[90] = (constants[1]+constants[2])/(constants[18] > constants[6]); - computedConstants[91] = constants[1]/(constants[6] > constants[2]); - computedConstants[92] = (constants[1]-constants[2])/(constants[18] > constants[6]); - computedConstants[93] = -constants[1]/(constants[6] > constants[2]); - computedConstants[94] = (constants[1] < constants[2])/(constants[6]+constants[18]); - computedConstants[95] = (constants[1] < constants[2])/constants[6]; - computedConstants[96] = (constants[1] < constants[2])/(constants[6]-constants[18]); - computedConstants[97] = (constants[1] < constants[2])/-constants[6]; - computedConstants[98] = (constants[1] < constants[2])/(constants[6]*constants[18]); - computedConstants[99] = (constants[1] < constants[2])/(constants[6]/constants[18]); - computedConstants[100] = sqrt(constants[1]); - computedConstants[101] = pow(constants[1], 2.0); - computedConstants[102] = pow(constants[1], 3.0); - computedConstants[103] = pow(constants[1], constants[2]); - computedConstants[104] = pow(constants[1] <= constants[2], constants[6] >= constants[18]); - computedConstants[105] = pow(constants[1]+constants[2], constants[6] >= constants[18]); - computedConstants[106] = pow(constants[1], constants[2] >= constants[6]); - computedConstants[107] = pow(constants[1]-constants[2], constants[6] >= constants[18]); - computedConstants[108] = pow(-constants[1], constants[2] >= constants[6]); - computedConstants[109] = pow(constants[1]*constants[2], constants[6] >= constants[18]); - computedConstants[110] = pow(constants[1]/constants[2], constants[6] >= constants[18]); - computedConstants[111] = pow(constants[1] <= constants[2], constants[6]+constants[18]); - computedConstants[112] = pow(constants[1] <= constants[2], constants[6]); - computedConstants[113] = pow(constants[1] <= constants[2], constants[6]-constants[18]); - computedConstants[114] = pow(constants[1] <= constants[2], -constants[6]); - computedConstants[115] = pow(constants[1] <= constants[2], constants[6]*constants[18]); - computedConstants[116] = pow(constants[1] <= constants[2], constants[6]/constants[18]); - computedConstants[117] = pow(constants[1] <= constants[2], pow(constants[6], constants[18])); - computedConstants[118] = pow(constants[1] <= constants[2], pow(constants[6], 1.0/constants[18])); - computedConstants[119] = sqrt(constants[1]); - computedConstants[120] = sqrt(constants[1]); - computedConstants[121] = pow(constants[1], 1.0/3.0); - computedConstants[122] = pow(constants[1], 1.0/constants[2]); - computedConstants[123] = pow(constants[1] < constants[2], 1.0/(constants[18] > constants[6])); - computedConstants[124] = pow(constants[1]+constants[2], 1.0/(constants[18] > constants[6])); - computedConstants[125] = pow(constants[1], 1.0/(constants[6] > constants[2])); - computedConstants[126] = pow(constants[1]-constants[2], 1.0/(constants[18] > constants[6])); - computedConstants[127] = pow(-constants[1], 1.0/(constants[6] > constants[2])); - computedConstants[128] = pow(constants[1]*constants[2], 1.0/(constants[18] > constants[6])); - computedConstants[129] = pow(constants[1]/constants[2], 1.0/(constants[18] > constants[6])); - computedConstants[130] = pow(constants[1] < constants[2], 1.0/(constants[6]+constants[18])); - computedConstants[131] = pow(constants[1] < constants[2], 1.0/constants[6]); - computedConstants[132] = pow(constants[1] < constants[2], 1.0/(constants[6]-constants[18])); - computedConstants[133] = pow(constants[1] < constants[2], 1.0/-constants[6]); - computedConstants[134] = pow(constants[1] < constants[2], 1.0/(constants[6]*constants[18])); - computedConstants[135] = pow(constants[1] < constants[2], 1.0/(constants[6]/constants[18])); - computedConstants[136] = pow(constants[1] < constants[2], 1.0/pow(constants[6], constants[18])); - computedConstants[137] = pow(constants[1] < constants[2], 1.0/pow(constants[6], 1.0/constants[18])); - computedConstants[138] = fabs(constants[1]); - computedConstants[139] = exp(constants[1]); - computedConstants[140] = log(constants[1]); - computedConstants[141] = log10(constants[1]); - computedConstants[142] = log(constants[1])/log(2.0); - computedConstants[143] = log10(constants[1]); - computedConstants[144] = log(constants[1])/log(constants[2]); - computedConstants[145] = ceil(constants[1]); - computedConstants[146] = floor(constants[1]); - computedConstants[147] = min(constants[1], constants[2]); - computedConstants[148] = min(constants[1], min(constants[2], constants[6])); - computedConstants[149] = max(constants[1], constants[2]); - computedConstants[150] = max(constants[1], max(constants[2], constants[6])); - computedConstants[151] = fmod(constants[1], constants[2]); - computedConstants[152] = sin(constants[1]); - computedConstants[153] = cos(constants[1]); - computedConstants[154] = tan(constants[1]); - computedConstants[155] = sec(constants[1]); - computedConstants[156] = csc(constants[1]); - computedConstants[157] = cot(constants[1]); - computedConstants[158] = sinh(constants[1]); - computedConstants[159] = cosh(constants[1]); - computedConstants[160] = tanh(constants[1]); - computedConstants[161] = sech(constants[1]); - computedConstants[162] = csch(constants[1]); - computedConstants[163] = coth(constants[1]); - computedConstants[164] = asin(constants[1]); - computedConstants[165] = acos(constants[1]); - computedConstants[166] = atan(constants[1]); - computedConstants[167] = asec(constants[1]); - computedConstants[168] = acsc(constants[1]); - computedConstants[169] = acot(constants[1]); - computedConstants[170] = asinh(constants[1]); - computedConstants[171] = acosh(constants[1]); - computedConstants[172] = atanh(constants[1]/2.0); - computedConstants[173] = asech(constants[1]); - computedConstants[174] = acsch(constants[1]); - computedConstants[175] = acoth(2.0*constants[1]); - computedConstants[176] = (constants[1] > constants[2])?constants[1]:NAN; - computedConstants[177] = (constants[1] > constants[2])?constants[1]:constants[6]; - computedConstants[178] = (constants[1] > constants[2])?constants[1]:(constants[6] > constants[18])?constants[6]:(constants[179] > constants[180])?constants[179]:NAN; - computedConstants[181] = (constants[1] > constants[2])?constants[1]:(constants[6] > constants[18])?constants[6]:(constants[179] > constants[180])?constants[179]:constants[182]; - computedConstants[183] = 123.0+((constants[1] > constants[2])?constants[1]:NAN); - computedConstants[188] = constants[1]; - computedConstants[195] = (constants[1] && constants[2])+((constants[6] > constants[18])?constants[2]:NAN)+constants[179]+(constants[180] && constants[182]); - computedConstants[196] = (constants[1] && constants[2])-(((constants[6] > constants[18])?constants[2]:NAN)-(constants[179]-((constants[6] > constants[18])?constants[2]:NAN)))-(constants[180] && constants[182]); - computedConstants[197] = (constants[1] && constants[2])*((constants[6] > constants[18])?constants[2]:NAN)*constants[179]*((constants[6] > constants[18])?constants[2]:NAN)*(constants[180] && constants[182]); - computedConstants[198] = (constants[1] && constants[2])/(((constants[6] > constants[18])?constants[2]:NAN)/(constants[179]/((constants[6] > constants[18])?constants[2]:NAN))); - computedConstants[199] = (constants[1] || constants[2]) && xor(constants[1], constants[2]) && ((constants[6] > constants[18])?constants[2]:NAN) && constants[179] && ((constants[6] > constants[18])?constants[2]:NAN) && xor(constants[1], constants[2]) && (constants[1] || constants[2]); - computedConstants[200] = (constants[1] && constants[2]) || xor(constants[1], constants[2]) || ((constants[6] > constants[18])?constants[2]:NAN) || constants[179] || ((constants[6] > constants[18])?constants[2]:NAN) || xor(constants[1], constants[2]) || (constants[1] && constants[2]); - computedConstants[201] = xor(constants[1] && constants[2], xor(constants[1] || constants[2], xor((constants[6] > constants[18])?constants[2]:NAN, xor(xor(xor(constants[179], (constants[6] > constants[18])?constants[2]:NAN), constants[1] || constants[2]), constants[1] && constants[2])))); - computedConstants[202] = pow(constants[1] && constants[2], pow((constants[6] > constants[18])?constants[2]:NAN, pow(pow(constants[179], (constants[6] > constants[18])?constants[2]:NAN), constants[1] && constants[2]))); - computedConstants[203] = pow(pow(pow(constants[1] && constants[2], 1.0/pow((constants[6] > constants[18])?constants[2]:NAN, 1.0/constants[179])), 1.0/((constants[6] > constants[18])?constants[2]:NAN)), 1.0/(constants[1] && constants[2])); - computedConstants[204] = -(constants[1] && constants[2])+-((constants[6] > constants[18])?constants[2]:NAN); + computedConstants[0] = constants[0] == constants[1]; + computedConstants[1] = constants[0]/(constants[1] == constants[1]); + computedConstants[2] = constants[0] != constants[1]; + computedConstants[3] = constants[0]/(constants[1] != constants[2]); + computedConstants[4] = constants[0] < constants[1]; + computedConstants[5] = constants[0]/(constants[1] < constants[2]); + computedConstants[6] = constants[0] <= constants[1]; + computedConstants[7] = constants[0]/(constants[1] <= constants[2]); + computedConstants[8] = constants[0] > constants[1]; + computedConstants[9] = constants[0]/(constants[1] > constants[2]); + computedConstants[10] = constants[0] >= constants[1]; + computedConstants[11] = constants[0]/(constants[1] >= constants[2]); + computedConstants[12] = constants[0] && constants[1]; + computedConstants[13] = constants[0] && constants[1] && constants[2]; + computedConstants[14] = (constants[0] < constants[1]) && (constants[2] > constants[3]); + computedConstants[15] = (constants[0]+constants[1]) && (constants[2] > constants[3]); + computedConstants[16] = constants[0] && (constants[1] > constants[2]); + computedConstants[17] = (constants[0]-constants[1]) && (constants[2] > constants[3]); + computedConstants[18] = -constants[0] && (constants[1] > constants[2]); + computedConstants[19] = pow(constants[0], constants[1]) && (constants[2] > constants[3]); + computedConstants[20] = pow(constants[0], 1.0/constants[1]) && (constants[2] > constants[3]); + computedConstants[21] = (constants[0] < constants[1]) && (constants[2]+constants[3]); + computedConstants[22] = (constants[0] < constants[1]) && constants[2]; + computedConstants[23] = (constants[0] < constants[1]) && (constants[2]-constants[3]); + computedConstants[24] = (constants[0] < constants[1]) && -constants[2]; + computedConstants[25] = (constants[0] < constants[1]) && pow(constants[2], constants[3]); + computedConstants[26] = (constants[0] < constants[1]) && pow(constants[2], 1.0/constants[3]); + computedConstants[27] = constants[0]/(constants[1] && constants[2]); + computedConstants[28] = constants[0] || constants[1]; + computedConstants[29] = constants[0] || constants[1] || constants[2]; + computedConstants[30] = (constants[0] < constants[1]) || (constants[2] > constants[3]); + computedConstants[31] = (constants[0]+constants[1]) || (constants[2] > constants[3]); + computedConstants[32] = constants[0] || (constants[1] > constants[2]); + computedConstants[33] = (constants[0]-constants[1]) || (constants[2] > constants[3]); + computedConstants[34] = -constants[0] || (constants[1] > constants[2]); + computedConstants[35] = pow(constants[0], constants[1]) || (constants[2] > constants[3]); + computedConstants[36] = pow(constants[0], 1.0/constants[1]) || (constants[2] > constants[3]); + computedConstants[37] = (constants[0] < constants[1]) || (constants[2]+constants[3]); + computedConstants[38] = (constants[0] < constants[1]) || constants[2]; + computedConstants[39] = (constants[0] < constants[1]) || (constants[2]-constants[3]); + computedConstants[40] = (constants[0] < constants[1]) || -constants[2]; + computedConstants[41] = (constants[0] < constants[1]) || pow(constants[2], constants[3]); + computedConstants[42] = (constants[0] < constants[1]) || pow(constants[2], 1.0/constants[3]); + computedConstants[43] = constants[0]/(constants[1] || constants[2]); + computedConstants[44] = xor(constants[0], constants[1]); + computedConstants[45] = xor(constants[0], xor(constants[1], constants[2])); + computedConstants[46] = xor(constants[0] < constants[1], constants[2] > constants[3]); + computedConstants[47] = xor(constants[0]+constants[1], constants[2] > constants[3]); + computedConstants[48] = xor(constants[0], constants[1] > constants[2]); + computedConstants[49] = xor(constants[0]-constants[1], constants[2] > constants[3]); + computedConstants[50] = xor(-constants[0], constants[1] > constants[2]); + computedConstants[51] = xor(pow(constants[0], constants[1]), constants[2] > constants[3]); + computedConstants[52] = xor(pow(constants[0], 1.0/constants[1]), constants[2] > constants[3]); + computedConstants[53] = xor(constants[0] < constants[1], constants[2]+constants[3]); + computedConstants[54] = xor(constants[0] < constants[1], constants[2]); + computedConstants[55] = xor(constants[0] < constants[1], constants[2]-constants[3]); + computedConstants[56] = xor(constants[0] < constants[1], -constants[2]); + computedConstants[57] = xor(constants[0] < constants[1], pow(constants[2], constants[3])); + computedConstants[58] = xor(constants[0] < constants[1], pow(constants[2], 1.0/constants[3])); + computedConstants[59] = constants[0]/xor(constants[1], constants[2]); + computedConstants[60] = !constants[0]; + computedConstants[61] = constants[0]+constants[1]; + computedConstants[62] = constants[0]+constants[1]+constants[2]; + computedConstants[63] = (constants[0] < constants[1])+(constants[2] > constants[3]); + computedConstants[64] = constants[0]; + computedConstants[65] = constants[0]-constants[1]; + computedConstants[66] = (constants[0] < constants[1])-(constants[2] > constants[3]); + computedConstants[67] = (constants[0] < constants[1])-(constants[2]+constants[3]); + computedConstants[68] = (constants[0] < constants[1])-constants[2]; + computedConstants[69] = constants[0]-(-constants[1]); + computedConstants[70] = constants[0]-(-constants[1]*constants[2]); + computedConstants[71] = -constants[0]; + computedConstants[72] = -(constants[0] < constants[1]); + computedConstants[73] = constants[0]*constants[1]; + computedConstants[74] = constants[0]*constants[1]*constants[2]; + computedConstants[75] = (constants[0] < constants[1])*(constants[2] > constants[3]); + computedConstants[76] = (constants[0]+constants[1])*(constants[2] > constants[3]); + computedConstants[77] = constants[0]*(constants[1] > constants[2]); + computedConstants[78] = (constants[0]-constants[1])*(constants[2] > constants[3]); + computedConstants[79] = -constants[0]*(constants[1] > constants[2]); + computedConstants[80] = (constants[0] < constants[1])*(constants[2]+constants[3]); + computedConstants[81] = (constants[0] < constants[1])*constants[2]; + computedConstants[82] = (constants[0] < constants[1])*(constants[2]-constants[3]); + computedConstants[83] = (constants[0] < constants[1])*-constants[2]; + computedConstants[84] = constants[0]/constants[1]; + computedConstants[85] = (constants[0] < constants[1])/(constants[3] > constants[2]); + computedConstants[86] = (constants[0]+constants[1])/(constants[3] > constants[2]); + computedConstants[87] = constants[0]/(constants[2] > constants[1]); + computedConstants[88] = (constants[0]-constants[1])/(constants[3] > constants[2]); + computedConstants[89] = -constants[0]/(constants[2] > constants[1]); + computedConstants[90] = (constants[0] < constants[1])/(constants[2]+constants[3]); + computedConstants[91] = (constants[0] < constants[1])/constants[2]; + computedConstants[92] = (constants[0] < constants[1])/(constants[2]-constants[3]); + computedConstants[93] = (constants[0] < constants[1])/-constants[2]; + computedConstants[94] = (constants[0] < constants[1])/(constants[2]*constants[3]); + computedConstants[95] = (constants[0] < constants[1])/(constants[2]/constants[3]); + computedConstants[96] = sqrt(constants[0]); + computedConstants[97] = pow(constants[0], 2.0); + computedConstants[98] = pow(constants[0], 3.0); + computedConstants[99] = pow(constants[0], constants[1]); + computedConstants[100] = pow(constants[0] <= constants[1], constants[2] >= constants[3]); + computedConstants[101] = pow(constants[0]+constants[1], constants[2] >= constants[3]); + computedConstants[102] = pow(constants[0], constants[1] >= constants[2]); + computedConstants[103] = pow(constants[0]-constants[1], constants[2] >= constants[3]); + computedConstants[104] = pow(-constants[0], constants[1] >= constants[2]); + computedConstants[105] = pow(constants[0]*constants[1], constants[2] >= constants[3]); + computedConstants[106] = pow(constants[0]/constants[1], constants[2] >= constants[3]); + computedConstants[107] = pow(constants[0] <= constants[1], constants[2]+constants[3]); + computedConstants[108] = pow(constants[0] <= constants[1], constants[2]); + computedConstants[109] = pow(constants[0] <= constants[1], constants[2]-constants[3]); + computedConstants[110] = pow(constants[0] <= constants[1], -constants[2]); + computedConstants[111] = pow(constants[0] <= constants[1], constants[2]*constants[3]); + computedConstants[112] = pow(constants[0] <= constants[1], constants[2]/constants[3]); + computedConstants[113] = pow(constants[0] <= constants[1], pow(constants[2], constants[3])); + computedConstants[114] = pow(constants[0] <= constants[1], pow(constants[2], 1.0/constants[3])); + computedConstants[115] = sqrt(constants[0]); + computedConstants[116] = sqrt(constants[0]); + computedConstants[117] = pow(constants[0], 1.0/3.0); + computedConstants[118] = pow(constants[0], 1.0/constants[1]); + computedConstants[119] = pow(constants[0] < constants[1], 1.0/(constants[3] > constants[2])); + computedConstants[120] = pow(constants[0]+constants[1], 1.0/(constants[3] > constants[2])); + computedConstants[121] = pow(constants[0], 1.0/(constants[2] > constants[1])); + computedConstants[122] = pow(constants[0]-constants[1], 1.0/(constants[3] > constants[2])); + computedConstants[123] = pow(-constants[0], 1.0/(constants[2] > constants[1])); + computedConstants[124] = pow(constants[0]*constants[1], 1.0/(constants[3] > constants[2])); + computedConstants[125] = pow(constants[0]/constants[1], 1.0/(constants[3] > constants[2])); + computedConstants[126] = pow(constants[0] < constants[1], 1.0/(constants[2]+constants[3])); + computedConstants[127] = pow(constants[0] < constants[1], 1.0/constants[2]); + computedConstants[128] = pow(constants[0] < constants[1], 1.0/(constants[2]-constants[3])); + computedConstants[129] = pow(constants[0] < constants[1], 1.0/-constants[2]); + computedConstants[130] = pow(constants[0] < constants[1], 1.0/(constants[2]*constants[3])); + computedConstants[131] = pow(constants[0] < constants[1], 1.0/(constants[2]/constants[3])); + computedConstants[132] = pow(constants[0] < constants[1], 1.0/pow(constants[2], constants[3])); + computedConstants[133] = pow(constants[0] < constants[1], 1.0/pow(constants[2], 1.0/constants[3])); + computedConstants[134] = fabs(constants[0]); + computedConstants[135] = exp(constants[0]); + computedConstants[136] = log(constants[0]); + computedConstants[137] = log10(constants[0]); + computedConstants[138] = log(constants[0])/log(2.0); + computedConstants[139] = log10(constants[0]); + computedConstants[140] = log(constants[0])/log(constants[1]); + computedConstants[141] = ceil(constants[0]); + computedConstants[142] = floor(constants[0]); + computedConstants[143] = min(constants[0], constants[1]); + computedConstants[144] = min(constants[0], min(constants[1], constants[2])); + computedConstants[145] = max(constants[0], constants[1]); + computedConstants[146] = max(constants[0], max(constants[1], constants[2])); + computedConstants[147] = fmod(constants[0], constants[1]); + computedConstants[148] = sin(constants[0]); + computedConstants[149] = cos(constants[0]); + computedConstants[150] = tan(constants[0]); + computedConstants[151] = sec(constants[0]); + computedConstants[152] = csc(constants[0]); + computedConstants[153] = cot(constants[0]); + computedConstants[154] = sinh(constants[0]); + computedConstants[155] = cosh(constants[0]); + computedConstants[156] = tanh(constants[0]); + computedConstants[157] = sech(constants[0]); + computedConstants[158] = csch(constants[0]); + computedConstants[159] = coth(constants[0]); + computedConstants[160] = asin(constants[0]); + computedConstants[161] = acos(constants[0]); + computedConstants[162] = atan(constants[0]); + computedConstants[163] = asec(constants[0]); + computedConstants[164] = acsc(constants[0]); + computedConstants[165] = acot(constants[0]); + computedConstants[166] = asinh(constants[0]); + computedConstants[167] = acosh(constants[0]); + computedConstants[168] = atanh(constants[0]/2.0); + computedConstants[169] = asech(constants[0]); + computedConstants[170] = acsch(constants[0]); + computedConstants[171] = acoth(2.0*constants[0]); + computedConstants[172] = (constants[0] > constants[1])?constants[0]:NAN; + computedConstants[173] = (constants[0] > constants[1])?constants[0]:constants[2]; + computedConstants[174] = (constants[0] > constants[1])?constants[0]:(constants[2] > constants[3])?constants[2]:(constants[4] > constants[5])?constants[4]:NAN; + computedConstants[175] = (constants[0] > constants[1])?constants[0]:(constants[2] > constants[3])?constants[2]:(constants[4] > constants[5])?constants[4]:constants[6]; + computedConstants[176] = 123.0+((constants[0] > constants[1])?constants[0]:NAN); + computedConstants[181] = constants[0]; + computedConstants[188] = (constants[0] && constants[1])+((constants[2] > constants[3])?constants[1]:NAN)+constants[4]+(constants[5] && constants[6]); + computedConstants[189] = (constants[0] && constants[1])-(((constants[2] > constants[3])?constants[1]:NAN)-(constants[4]-((constants[2] > constants[3])?constants[1]:NAN)))-(constants[5] && constants[6]); + computedConstants[190] = (constants[0] && constants[1])*((constants[2] > constants[3])?constants[1]:NAN)*constants[4]*((constants[2] > constants[3])?constants[1]:NAN)*(constants[5] && constants[6]); + computedConstants[191] = (constants[0] && constants[1])/(((constants[2] > constants[3])?constants[1]:NAN)/(constants[4]/((constants[2] > constants[3])?constants[1]:NAN))); + computedConstants[192] = (constants[0] || constants[1]) && xor(constants[0], constants[1]) && ((constants[2] > constants[3])?constants[1]:NAN) && constants[4] && ((constants[2] > constants[3])?constants[1]:NAN) && xor(constants[0], constants[1]) && (constants[0] || constants[1]); + computedConstants[193] = (constants[0] && constants[1]) || xor(constants[0], constants[1]) || ((constants[2] > constants[3])?constants[1]:NAN) || constants[4] || ((constants[2] > constants[3])?constants[1]:NAN) || xor(constants[0], constants[1]) || (constants[0] && constants[1]); + computedConstants[194] = xor(constants[0] && constants[1], xor(constants[0] || constants[1], xor((constants[2] > constants[3])?constants[1]:NAN, xor(xor(xor(constants[4], (constants[2] > constants[3])?constants[1]:NAN), constants[0] || constants[1]), constants[0] && constants[1])))); + computedConstants[195] = pow(constants[0] && constants[1], pow((constants[2] > constants[3])?constants[1]:NAN, pow(pow(constants[4], (constants[2] > constants[3])?constants[1]:NAN), constants[0] && constants[1]))); + computedConstants[196] = pow(pow(pow(constants[0] && constants[1], 1.0/pow((constants[2] > constants[3])?constants[1]:NAN, 1.0/constants[4])), 1.0/((constants[2] > constants[3])?constants[1]:NAN)), 1.0/(constants[0] && constants[1])); + computedConstants[197] = -(constants[0] && constants[1])+-((constants[2] > constants[3])?constants[1]:NAN); } void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) diff --git a/tests/resources/coverage/generator/model.implementation.out b/tests/resources/coverage/generator/model.implementation.out index 9656a17964..03233d9176 100644 --- a/tests/resources/coverage/generator/model.implementation.out +++ b/tests/resources/coverage/generator/model.implementation.out @@ -125,11 +125,11 @@ void objectiveFunction0(double *u, double *f, void *data) double *rates = ((RootFindingInfo *) data)->rates; double *variables = ((RootFindingInfo *) data)->variables; - algebraic[205] = u[0]; - algebraic[206] = u[1]; + algebraic[0] = u[0]; + algebraic[1] = u[1]; - f[0] = algebraic[205]+algebraic[206]+states[0]-0.0; - f[1] = algebraic[205]-algebraic[206]-(computedConstants[207]+computedConstants[208]); + f[0] = algebraic[0]+algebraic[1]+states[0]-0.0; + f[1] = algebraic[0]-algebraic[1]-(computedConstants[198]+computedConstants[199]); } void findRoot0(double voi, double *states, double *rates, double *variables) @@ -137,231 +137,231 @@ void findRoot0(double voi, double *states, double *rates, double *variables) RootFindingInfo rfi = { voi, states, rates, variables }; double u[2]; - u[0] = algebraic[205]; - u[1] = algebraic[206]; + u[0] = algebraic[0]; + u[1] = algebraic[1]; nlaSolve(objectiveFunction0, u, 2, &rfi); - algebraic[205] = u[0]; - algebraic[206] = u[1]; + algebraic[0] = u[0]; + algebraic[1] = u[1]; } void initialiseVariables(double *states, double *rates, double *constants) { - constants[1] = 1.0; - constants[2] = 2.0; - constants[6] = 3.0; - constants[18] = 4.0; - constants[179] = 5.0; - constants[180] = 6.0; - constants[182] = 7.0; - algebraic[205] = 1.0; - algebraic[206] = 2.0; - computedConstants[184] = 123.0; - computedConstants[185] = 123.456789; - computedConstants[186] = 123.0e99; - computedConstants[187] = 123.456789e99; - computedConstants[189] = 1.0; - computedConstants[190] = 0.0; - computedConstants[191] = 2.71828182845905; - computedConstants[192] = 3.14159265358979; - computedConstants[193] = INFINITY; - computedConstants[194] = NAN; - computedConstants[207] = 1.0; - computedConstants[208] = 3.0; + constants[0] = 1.0; + constants[1] = 2.0; + constants[2] = 3.0; + constants[3] = 4.0; + constants[4] = 5.0; + constants[5] = 6.0; + constants[6] = 7.0; + algebraic[0] = 1.0; + algebraic[1] = 2.0; + computedConstants[177] = 123.0; + computedConstants[178] = 123.456789; + computedConstants[179] = 123.0e99; + computedConstants[180] = 123.456789e99; + computedConstants[182] = 1.0; + computedConstants[183] = 0.0; + computedConstants[184] = 2.71828182845905; + computedConstants[185] = 3.14159265358979; + computedConstants[186] = INFINITY; + computedConstants[187] = NAN; + computedConstants[198] = 1.0; + computedConstants[199] = 3.0; states[0] = 0.0; } void computeComputedConstants(double *constants, double *computedConstants) { - computedConstants[0] = eq(constants[1], constants[2]); - computedConstants[3] = constants[1]/eq(constants[2], constants[2]); - computedConstants[4] = neq(constants[1], constants[2]); - computedConstants[5] = constants[1]/neq(constants[2], constants[6]); - computedConstants[7] = lt(constants[1], constants[2]); - computedConstants[8] = constants[1]/lt(constants[2], constants[6]); - computedConstants[9] = leq(constants[1], constants[2]); - computedConstants[10] = constants[1]/leq(constants[2], constants[6]); - computedConstants[11] = gt(constants[1], constants[2]); - computedConstants[12] = constants[1]/gt(constants[2], constants[6]); - computedConstants[13] = geq(constants[1], constants[2]); - computedConstants[14] = constants[1]/geq(constants[2], constants[6]); - computedConstants[15] = and(constants[1], constants[2]); - computedConstants[16] = and(constants[1], and(constants[2], constants[6])); - computedConstants[17] = and(lt(constants[1], constants[2]), gt(constants[6], constants[18])); - computedConstants[19] = and(constants[1]+constants[2], gt(constants[6], constants[18])); - computedConstants[20] = and(constants[1], gt(constants[2], constants[6])); - computedConstants[21] = and(constants[1]-constants[2], gt(constants[6], constants[18])); - computedConstants[22] = and(-constants[1], gt(constants[2], constants[6])); - computedConstants[23] = and(pow(constants[1], constants[2]), gt(constants[6], constants[18])); - computedConstants[24] = and(pow(constants[1], 1.0/constants[2]), gt(constants[6], constants[18])); - computedConstants[25] = and(lt(constants[1], constants[2]), constants[6]+constants[18]); - computedConstants[26] = and(lt(constants[1], constants[2]), constants[6]); - computedConstants[27] = and(lt(constants[1], constants[2]), constants[6]-constants[18]); - computedConstants[28] = and(lt(constants[1], constants[2]), -constants[6]); - computedConstants[29] = and(lt(constants[1], constants[2]), pow(constants[6], constants[18])); - computedConstants[30] = and(lt(constants[1], constants[2]), pow(constants[6], 1.0/constants[18])); - computedConstants[31] = constants[1]/and(constants[2], constants[6]); - computedConstants[32] = or(constants[1], constants[2]); - computedConstants[33] = or(constants[1], or(constants[2], constants[6])); - computedConstants[34] = or(lt(constants[1], constants[2]), gt(constants[6], constants[18])); - computedConstants[35] = or(constants[1]+constants[2], gt(constants[6], constants[18])); - computedConstants[36] = or(constants[1], gt(constants[2], constants[6])); - computedConstants[37] = or(constants[1]-constants[2], gt(constants[6], constants[18])); - computedConstants[38] = or(-constants[1], gt(constants[2], constants[6])); - computedConstants[39] = or(pow(constants[1], constants[2]), gt(constants[6], constants[18])); - computedConstants[40] = or(pow(constants[1], 1.0/constants[2]), gt(constants[6], constants[18])); - computedConstants[41] = or(lt(constants[1], constants[2]), constants[6]+constants[18]); - computedConstants[42] = or(lt(constants[1], constants[2]), constants[6]); - computedConstants[43] = or(lt(constants[1], constants[2]), constants[6]-constants[18]); - computedConstants[44] = or(lt(constants[1], constants[2]), -constants[6]); - computedConstants[45] = or(lt(constants[1], constants[2]), pow(constants[6], constants[18])); - computedConstants[46] = or(lt(constants[1], constants[2]), pow(constants[6], 1.0/constants[18])); - computedConstants[47] = constants[1]/or(constants[2], constants[6]); - computedConstants[48] = xor(constants[1], constants[2]); - computedConstants[49] = xor(constants[1], xor(constants[2], constants[6])); - computedConstants[50] = xor(lt(constants[1], constants[2]), gt(constants[6], constants[18])); - computedConstants[51] = xor(constants[1]+constants[2], gt(constants[6], constants[18])); - computedConstants[52] = xor(constants[1], gt(constants[2], constants[6])); - computedConstants[53] = xor(constants[1]-constants[2], gt(constants[6], constants[18])); - computedConstants[54] = xor(-constants[1], gt(constants[2], constants[6])); - computedConstants[55] = xor(pow(constants[1], constants[2]), gt(constants[6], constants[18])); - computedConstants[56] = xor(pow(constants[1], 1.0/constants[2]), gt(constants[6], constants[18])); - computedConstants[57] = xor(lt(constants[1], constants[2]), constants[6]+constants[18]); - computedConstants[58] = xor(lt(constants[1], constants[2]), constants[6]); - computedConstants[59] = xor(lt(constants[1], constants[2]), constants[6]-constants[18]); - computedConstants[60] = xor(lt(constants[1], constants[2]), -constants[6]); - computedConstants[61] = xor(lt(constants[1], constants[2]), pow(constants[6], constants[18])); - computedConstants[62] = xor(lt(constants[1], constants[2]), pow(constants[6], 1.0/constants[18])); - computedConstants[63] = constants[1]/xor(constants[2], constants[6]); - computedConstants[64] = not(constants[1]); - computedConstants[65] = constants[1]+constants[2]; - computedConstants[66] = constants[1]+constants[2]+constants[6]; - computedConstants[67] = lt(constants[1], constants[2])+gt(constants[6], constants[18]); - computedConstants[68] = constants[1]; - computedConstants[69] = constants[1]-constants[2]; - computedConstants[70] = lt(constants[1], constants[2])-gt(constants[6], constants[18]); - computedConstants[71] = lt(constants[1], constants[2])-(constants[6]+constants[18]); - computedConstants[72] = lt(constants[1], constants[2])-constants[6]; - computedConstants[73] = constants[1]-(-constants[2]); - computedConstants[74] = constants[1]-(-constants[2]*constants[6]); - computedConstants[75] = -constants[1]; - computedConstants[76] = -lt(constants[1], constants[2]); - computedConstants[77] = constants[1]*constants[2]; - computedConstants[78] = constants[1]*constants[2]*constants[6]; - computedConstants[79] = lt(constants[1], constants[2])*gt(constants[6], constants[18]); - computedConstants[80] = (constants[1]+constants[2])*gt(constants[6], constants[18]); - computedConstants[81] = constants[1]*gt(constants[2], constants[6]); - computedConstants[82] = (constants[1]-constants[2])*gt(constants[6], constants[18]); - computedConstants[83] = -constants[1]*gt(constants[2], constants[6]); - computedConstants[84] = lt(constants[1], constants[2])*(constants[6]+constants[18]); - computedConstants[85] = lt(constants[1], constants[2])*constants[6]; - computedConstants[86] = lt(constants[1], constants[2])*(constants[6]-constants[18]); - computedConstants[87] = lt(constants[1], constants[2])*-constants[6]; - computedConstants[88] = constants[1]/constants[2]; - computedConstants[89] = lt(constants[1], constants[2])/gt(constants[18], constants[6]); - computedConstants[90] = (constants[1]+constants[2])/gt(constants[18], constants[6]); - computedConstants[91] = constants[1]/gt(constants[6], constants[2]); - computedConstants[92] = (constants[1]-constants[2])/gt(constants[18], constants[6]); - computedConstants[93] = -constants[1]/gt(constants[6], constants[2]); - computedConstants[94] = lt(constants[1], constants[2])/(constants[6]+constants[18]); - computedConstants[95] = lt(constants[1], constants[2])/constants[6]; - computedConstants[96] = lt(constants[1], constants[2])/(constants[6]-constants[18]); - computedConstants[97] = lt(constants[1], constants[2])/-constants[6]; - computedConstants[98] = lt(constants[1], constants[2])/(constants[6]*constants[18]); - computedConstants[99] = lt(constants[1], constants[2])/(constants[6]/constants[18]); - computedConstants[100] = sqrt(constants[1]); - computedConstants[101] = pow(constants[1], 2.0); - computedConstants[102] = pow(constants[1], 3.0); - computedConstants[103] = pow(constants[1], constants[2]); - computedConstants[104] = pow(leq(constants[1], constants[2]), geq(constants[6], constants[18])); - computedConstants[105] = pow(constants[1]+constants[2], geq(constants[6], constants[18])); - computedConstants[106] = pow(constants[1], geq(constants[2], constants[6])); - computedConstants[107] = pow(constants[1]-constants[2], geq(constants[6], constants[18])); - computedConstants[108] = pow(-constants[1], geq(constants[2], constants[6])); - computedConstants[109] = pow(constants[1]*constants[2], geq(constants[6], constants[18])); - computedConstants[110] = pow(constants[1]/constants[2], geq(constants[6], constants[18])); - computedConstants[111] = pow(leq(constants[1], constants[2]), constants[6]+constants[18]); - computedConstants[112] = pow(leq(constants[1], constants[2]), constants[6]); - computedConstants[113] = pow(leq(constants[1], constants[2]), constants[6]-constants[18]); - computedConstants[114] = pow(leq(constants[1], constants[2]), -constants[6]); - computedConstants[115] = pow(leq(constants[1], constants[2]), constants[6]*constants[18]); - computedConstants[116] = pow(leq(constants[1], constants[2]), constants[6]/constants[18]); - computedConstants[117] = pow(leq(constants[1], constants[2]), pow(constants[6], constants[18])); - computedConstants[118] = pow(leq(constants[1], constants[2]), pow(constants[6], 1.0/constants[18])); - computedConstants[119] = sqrt(constants[1]); - computedConstants[120] = sqrt(constants[1]); - computedConstants[121] = pow(constants[1], 1.0/3.0); - computedConstants[122] = pow(constants[1], 1.0/constants[2]); - computedConstants[123] = pow(lt(constants[1], constants[2]), 1.0/gt(constants[18], constants[6])); - computedConstants[124] = pow(constants[1]+constants[2], 1.0/gt(constants[18], constants[6])); - computedConstants[125] = pow(constants[1], 1.0/gt(constants[6], constants[2])); - computedConstants[126] = pow(constants[1]-constants[2], 1.0/gt(constants[18], constants[6])); - computedConstants[127] = pow(-constants[1], 1.0/gt(constants[6], constants[2])); - computedConstants[128] = pow(constants[1]*constants[2], 1.0/gt(constants[18], constants[6])); - computedConstants[129] = pow(constants[1]/constants[2], 1.0/gt(constants[18], constants[6])); - computedConstants[130] = pow(lt(constants[1], constants[2]), 1.0/(constants[6]+constants[18])); - computedConstants[131] = pow(lt(constants[1], constants[2]), 1.0/constants[6]); - computedConstants[132] = pow(lt(constants[1], constants[2]), 1.0/(constants[6]-constants[18])); - computedConstants[133] = pow(lt(constants[1], constants[2]), 1.0/-constants[6]); - computedConstants[134] = pow(lt(constants[1], constants[2]), 1.0/(constants[6]*constants[18])); - computedConstants[135] = pow(lt(constants[1], constants[2]), 1.0/(constants[6]/constants[18])); - computedConstants[136] = pow(lt(constants[1], constants[2]), 1.0/pow(constants[6], constants[18])); - computedConstants[137] = pow(lt(constants[1], constants[2]), 1.0/pow(constants[6], 1.0/constants[18])); - computedConstants[138] = fabs(constants[1]); - computedConstants[139] = exp(constants[1]); - computedConstants[140] = log(constants[1]); - computedConstants[141] = log10(constants[1]); - computedConstants[142] = log(constants[1])/log(2.0); - computedConstants[143] = log10(constants[1]); - computedConstants[144] = log(constants[1])/log(constants[2]); - computedConstants[145] = ceil(constants[1]); - computedConstants[146] = floor(constants[1]); - computedConstants[147] = min(constants[1], constants[2]); - computedConstants[148] = min(constants[1], min(constants[2], constants[6])); - computedConstants[149] = max(constants[1], constants[2]); - computedConstants[150] = max(constants[1], max(constants[2], constants[6])); - computedConstants[151] = fmod(constants[1], constants[2]); - computedConstants[152] = sin(constants[1]); - computedConstants[153] = cos(constants[1]); - computedConstants[154] = tan(constants[1]); - computedConstants[155] = sec(constants[1]); - computedConstants[156] = csc(constants[1]); - computedConstants[157] = cot(constants[1]); - computedConstants[158] = sinh(constants[1]); - computedConstants[159] = cosh(constants[1]); - computedConstants[160] = tanh(constants[1]); - computedConstants[161] = sech(constants[1]); - computedConstants[162] = csch(constants[1]); - computedConstants[163] = coth(constants[1]); - computedConstants[164] = asin(constants[1]); - computedConstants[165] = acos(constants[1]); - computedConstants[166] = atan(constants[1]); - computedConstants[167] = asec(constants[1]); - computedConstants[168] = acsc(constants[1]); - computedConstants[169] = acot(constants[1]); - computedConstants[170] = asinh(constants[1]); - computedConstants[171] = acosh(constants[1]); - computedConstants[172] = atanh(constants[1]/2.0); - computedConstants[173] = asech(constants[1]); - computedConstants[174] = acsch(constants[1]); - computedConstants[175] = acoth(2.0*constants[1]); - computedConstants[176] = (gt(constants[1], constants[2]))?constants[1]:NAN; - computedConstants[177] = (gt(constants[1], constants[2]))?constants[1]:constants[6]; - computedConstants[178] = (gt(constants[1], constants[2]))?constants[1]:(gt(constants[6], constants[18]))?constants[6]:(gt(constants[179], constants[180]))?constants[179]:NAN; - computedConstants[181] = (gt(constants[1], constants[2]))?constants[1]:(gt(constants[6], constants[18]))?constants[6]:(gt(constants[179], constants[180]))?constants[179]:constants[182]; - computedConstants[183] = 123.0+((gt(constants[1], constants[2]))?constants[1]:NAN); - computedConstants[188] = constants[1]; - computedConstants[195] = and(constants[1], constants[2])+((gt(constants[6], constants[18]))?constants[2]:NAN)+constants[179]+and(constants[180], constants[182]); - computedConstants[196] = and(constants[1], constants[2])-(((gt(constants[6], constants[18]))?constants[2]:NAN)-(constants[179]-((gt(constants[6], constants[18]))?constants[2]:NAN)))-and(constants[180], constants[182]); - computedConstants[197] = and(constants[1], constants[2])*((gt(constants[6], constants[18]))?constants[2]:NAN)*constants[179]*((gt(constants[6], constants[18]))?constants[2]:NAN)*and(constants[180], constants[182]); - computedConstants[198] = and(constants[1], constants[2])/(((gt(constants[6], constants[18]))?constants[2]:NAN)/(constants[179]/((gt(constants[6], constants[18]))?constants[2]:NAN))); - computedConstants[199] = and(or(constants[1], constants[2]), and(xor(constants[1], constants[2]), and((gt(constants[6], constants[18]))?constants[2]:NAN, and(and(and(constants[179], (gt(constants[6], constants[18]))?constants[2]:NAN), xor(constants[1], constants[2])), or(constants[1], constants[2]))))); - computedConstants[200] = or(and(constants[1], constants[2]), or(xor(constants[1], constants[2]), or((gt(constants[6], constants[18]))?constants[2]:NAN, or(or(or(constants[179], (gt(constants[6], constants[18]))?constants[2]:NAN), xor(constants[1], constants[2])), and(constants[1], constants[2]))))); - computedConstants[201] = xor(and(constants[1], constants[2]), xor(or(constants[1], constants[2]), xor((gt(constants[6], constants[18]))?constants[2]:NAN, xor(xor(xor(constants[179], (gt(constants[6], constants[18]))?constants[2]:NAN), or(constants[1], constants[2])), and(constants[1], constants[2]))))); - computedConstants[202] = pow(and(constants[1], constants[2]), pow((gt(constants[6], constants[18]))?constants[2]:NAN, pow(pow(constants[179], (gt(constants[6], constants[18]))?constants[2]:NAN), and(constants[1], constants[2])))); - computedConstants[203] = pow(pow(pow(and(constants[1], constants[2]), 1.0/pow((gt(constants[6], constants[18]))?constants[2]:NAN, 1.0/constants[179])), 1.0/((gt(constants[6], constants[18]))?constants[2]:NAN)), 1.0/and(constants[1], constants[2])); - computedConstants[204] = -and(constants[1], constants[2])+-((gt(constants[6], constants[18]))?constants[2]:NAN); + computedConstants[0] = eq(constants[0], constants[1]); + computedConstants[1] = constants[0]/eq(constants[1], constants[1]); + computedConstants[2] = neq(constants[0], constants[1]); + computedConstants[3] = constants[0]/neq(constants[1], constants[2]); + computedConstants[4] = lt(constants[0], constants[1]); + computedConstants[5] = constants[0]/lt(constants[1], constants[2]); + computedConstants[6] = leq(constants[0], constants[1]); + computedConstants[7] = constants[0]/leq(constants[1], constants[2]); + computedConstants[8] = gt(constants[0], constants[1]); + computedConstants[9] = constants[0]/gt(constants[1], constants[2]); + computedConstants[10] = geq(constants[0], constants[1]); + computedConstants[11] = constants[0]/geq(constants[1], constants[2]); + computedConstants[12] = and(constants[0], constants[1]); + computedConstants[13] = and(constants[0], and(constants[1], constants[2])); + computedConstants[14] = and(lt(constants[0], constants[1]), gt(constants[2], constants[3])); + computedConstants[15] = and(constants[0]+constants[1], gt(constants[2], constants[3])); + computedConstants[16] = and(constants[0], gt(constants[1], constants[2])); + computedConstants[17] = and(constants[0]-constants[1], gt(constants[2], constants[3])); + computedConstants[18] = and(-constants[0], gt(constants[1], constants[2])); + computedConstants[19] = and(pow(constants[0], constants[1]), gt(constants[2], constants[3])); + computedConstants[20] = and(pow(constants[0], 1.0/constants[1]), gt(constants[2], constants[3])); + computedConstants[21] = and(lt(constants[0], constants[1]), constants[2]+constants[3]); + computedConstants[22] = and(lt(constants[0], constants[1]), constants[2]); + computedConstants[23] = and(lt(constants[0], constants[1]), constants[2]-constants[3]); + computedConstants[24] = and(lt(constants[0], constants[1]), -constants[2]); + computedConstants[25] = and(lt(constants[0], constants[1]), pow(constants[2], constants[3])); + computedConstants[26] = and(lt(constants[0], constants[1]), pow(constants[2], 1.0/constants[3])); + computedConstants[27] = constants[0]/and(constants[1], constants[2]); + computedConstants[28] = or(constants[0], constants[1]); + computedConstants[29] = or(constants[0], or(constants[1], constants[2])); + computedConstants[30] = or(lt(constants[0], constants[1]), gt(constants[2], constants[3])); + computedConstants[31] = or(constants[0]+constants[1], gt(constants[2], constants[3])); + computedConstants[32] = or(constants[0], gt(constants[1], constants[2])); + computedConstants[33] = or(constants[0]-constants[1], gt(constants[2], constants[3])); + computedConstants[34] = or(-constants[0], gt(constants[1], constants[2])); + computedConstants[35] = or(pow(constants[0], constants[1]), gt(constants[2], constants[3])); + computedConstants[36] = or(pow(constants[0], 1.0/constants[1]), gt(constants[2], constants[3])); + computedConstants[37] = or(lt(constants[0], constants[1]), constants[2]+constants[3]); + computedConstants[38] = or(lt(constants[0], constants[1]), constants[2]); + computedConstants[39] = or(lt(constants[0], constants[1]), constants[2]-constants[3]); + computedConstants[40] = or(lt(constants[0], constants[1]), -constants[2]); + computedConstants[41] = or(lt(constants[0], constants[1]), pow(constants[2], constants[3])); + computedConstants[42] = or(lt(constants[0], constants[1]), pow(constants[2], 1.0/constants[3])); + computedConstants[43] = constants[0]/or(constants[1], constants[2]); + computedConstants[44] = xor(constants[0], constants[1]); + computedConstants[45] = xor(constants[0], xor(constants[1], constants[2])); + computedConstants[46] = xor(lt(constants[0], constants[1]), gt(constants[2], constants[3])); + computedConstants[47] = xor(constants[0]+constants[1], gt(constants[2], constants[3])); + computedConstants[48] = xor(constants[0], gt(constants[1], constants[2])); + computedConstants[49] = xor(constants[0]-constants[1], gt(constants[2], constants[3])); + computedConstants[50] = xor(-constants[0], gt(constants[1], constants[2])); + computedConstants[51] = xor(pow(constants[0], constants[1]), gt(constants[2], constants[3])); + computedConstants[52] = xor(pow(constants[0], 1.0/constants[1]), gt(constants[2], constants[3])); + computedConstants[53] = xor(lt(constants[0], constants[1]), constants[2]+constants[3]); + computedConstants[54] = xor(lt(constants[0], constants[1]), constants[2]); + computedConstants[55] = xor(lt(constants[0], constants[1]), constants[2]-constants[3]); + computedConstants[56] = xor(lt(constants[0], constants[1]), -constants[2]); + computedConstants[57] = xor(lt(constants[0], constants[1]), pow(constants[2], constants[3])); + computedConstants[58] = xor(lt(constants[0], constants[1]), pow(constants[2], 1.0/constants[3])); + computedConstants[59] = constants[0]/xor(constants[1], constants[2]); + computedConstants[60] = not(constants[0]); + computedConstants[61] = constants[0]+constants[1]; + computedConstants[62] = constants[0]+constants[1]+constants[2]; + computedConstants[63] = lt(constants[0], constants[1])+gt(constants[2], constants[3]); + computedConstants[64] = constants[0]; + computedConstants[65] = constants[0]-constants[1]; + computedConstants[66] = lt(constants[0], constants[1])-gt(constants[2], constants[3]); + computedConstants[67] = lt(constants[0], constants[1])-(constants[2]+constants[3]); + computedConstants[68] = lt(constants[0], constants[1])-constants[2]; + computedConstants[69] = constants[0]-(-constants[1]); + computedConstants[70] = constants[0]-(-constants[1]*constants[2]); + computedConstants[71] = -constants[0]; + computedConstants[72] = -lt(constants[0], constants[1]); + computedConstants[73] = constants[0]*constants[1]; + computedConstants[74] = constants[0]*constants[1]*constants[2]; + computedConstants[75] = lt(constants[0], constants[1])*gt(constants[2], constants[3]); + computedConstants[76] = (constants[0]+constants[1])*gt(constants[2], constants[3]); + computedConstants[77] = constants[0]*gt(constants[1], constants[2]); + computedConstants[78] = (constants[0]-constants[1])*gt(constants[2], constants[3]); + computedConstants[79] = -constants[0]*gt(constants[1], constants[2]); + computedConstants[80] = lt(constants[0], constants[1])*(constants[2]+constants[3]); + computedConstants[81] = lt(constants[0], constants[1])*constants[2]; + computedConstants[82] = lt(constants[0], constants[1])*(constants[2]-constants[3]); + computedConstants[83] = lt(constants[0], constants[1])*-constants[2]; + computedConstants[84] = constants[0]/constants[1]; + computedConstants[85] = lt(constants[0], constants[1])/gt(constants[3], constants[2]); + computedConstants[86] = (constants[0]+constants[1])/gt(constants[3], constants[2]); + computedConstants[87] = constants[0]/gt(constants[2], constants[1]); + computedConstants[88] = (constants[0]-constants[1])/gt(constants[3], constants[2]); + computedConstants[89] = -constants[0]/gt(constants[2], constants[1]); + computedConstants[90] = lt(constants[0], constants[1])/(constants[2]+constants[3]); + computedConstants[91] = lt(constants[0], constants[1])/constants[2]; + computedConstants[92] = lt(constants[0], constants[1])/(constants[2]-constants[3]); + computedConstants[93] = lt(constants[0], constants[1])/-constants[2]; + computedConstants[94] = lt(constants[0], constants[1])/(constants[2]*constants[3]); + computedConstants[95] = lt(constants[0], constants[1])/(constants[2]/constants[3]); + computedConstants[96] = sqrt(constants[0]); + computedConstants[97] = pow(constants[0], 2.0); + computedConstants[98] = pow(constants[0], 3.0); + computedConstants[99] = pow(constants[0], constants[1]); + computedConstants[100] = pow(leq(constants[0], constants[1]), geq(constants[2], constants[3])); + computedConstants[101] = pow(constants[0]+constants[1], geq(constants[2], constants[3])); + computedConstants[102] = pow(constants[0], geq(constants[1], constants[2])); + computedConstants[103] = pow(constants[0]-constants[1], geq(constants[2], constants[3])); + computedConstants[104] = pow(-constants[0], geq(constants[1], constants[2])); + computedConstants[105] = pow(constants[0]*constants[1], geq(constants[2], constants[3])); + computedConstants[106] = pow(constants[0]/constants[1], geq(constants[2], constants[3])); + computedConstants[107] = pow(leq(constants[0], constants[1]), constants[2]+constants[3]); + computedConstants[108] = pow(leq(constants[0], constants[1]), constants[2]); + computedConstants[109] = pow(leq(constants[0], constants[1]), constants[2]-constants[3]); + computedConstants[110] = pow(leq(constants[0], constants[1]), -constants[2]); + computedConstants[111] = pow(leq(constants[0], constants[1]), constants[2]*constants[3]); + computedConstants[112] = pow(leq(constants[0], constants[1]), constants[2]/constants[3]); + computedConstants[113] = pow(leq(constants[0], constants[1]), pow(constants[2], constants[3])); + computedConstants[114] = pow(leq(constants[0], constants[1]), pow(constants[2], 1.0/constants[3])); + computedConstants[115] = sqrt(constants[0]); + computedConstants[116] = sqrt(constants[0]); + computedConstants[117] = pow(constants[0], 1.0/3.0); + computedConstants[118] = pow(constants[0], 1.0/constants[1]); + computedConstants[119] = pow(lt(constants[0], constants[1]), 1.0/gt(constants[3], constants[2])); + computedConstants[120] = pow(constants[0]+constants[1], 1.0/gt(constants[3], constants[2])); + computedConstants[121] = pow(constants[0], 1.0/gt(constants[2], constants[1])); + computedConstants[122] = pow(constants[0]-constants[1], 1.0/gt(constants[3], constants[2])); + computedConstants[123] = pow(-constants[0], 1.0/gt(constants[2], constants[1])); + computedConstants[124] = pow(constants[0]*constants[1], 1.0/gt(constants[3], constants[2])); + computedConstants[125] = pow(constants[0]/constants[1], 1.0/gt(constants[3], constants[2])); + computedConstants[126] = pow(lt(constants[0], constants[1]), 1.0/(constants[2]+constants[3])); + computedConstants[127] = pow(lt(constants[0], constants[1]), 1.0/constants[2]); + computedConstants[128] = pow(lt(constants[0], constants[1]), 1.0/(constants[2]-constants[3])); + computedConstants[129] = pow(lt(constants[0], constants[1]), 1.0/-constants[2]); + computedConstants[130] = pow(lt(constants[0], constants[1]), 1.0/(constants[2]*constants[3])); + computedConstants[131] = pow(lt(constants[0], constants[1]), 1.0/(constants[2]/constants[3])); + computedConstants[132] = pow(lt(constants[0], constants[1]), 1.0/pow(constants[2], constants[3])); + computedConstants[133] = pow(lt(constants[0], constants[1]), 1.0/pow(constants[2], 1.0/constants[3])); + computedConstants[134] = fabs(constants[0]); + computedConstants[135] = exp(constants[0]); + computedConstants[136] = log(constants[0]); + computedConstants[137] = log10(constants[0]); + computedConstants[138] = log(constants[0])/log(2.0); + computedConstants[139] = log10(constants[0]); + computedConstants[140] = log(constants[0])/log(constants[1]); + computedConstants[141] = ceil(constants[0]); + computedConstants[142] = floor(constants[0]); + computedConstants[143] = min(constants[0], constants[1]); + computedConstants[144] = min(constants[0], min(constants[1], constants[2])); + computedConstants[145] = max(constants[0], constants[1]); + computedConstants[146] = max(constants[0], max(constants[1], constants[2])); + computedConstants[147] = fmod(constants[0], constants[1]); + computedConstants[148] = sin(constants[0]); + computedConstants[149] = cos(constants[0]); + computedConstants[150] = tan(constants[0]); + computedConstants[151] = sec(constants[0]); + computedConstants[152] = csc(constants[0]); + computedConstants[153] = cot(constants[0]); + computedConstants[154] = sinh(constants[0]); + computedConstants[155] = cosh(constants[0]); + computedConstants[156] = tanh(constants[0]); + computedConstants[157] = sech(constants[0]); + computedConstants[158] = csch(constants[0]); + computedConstants[159] = coth(constants[0]); + computedConstants[160] = asin(constants[0]); + computedConstants[161] = acos(constants[0]); + computedConstants[162] = atan(constants[0]); + computedConstants[163] = asec(constants[0]); + computedConstants[164] = acsc(constants[0]); + computedConstants[165] = acot(constants[0]); + computedConstants[166] = asinh(constants[0]); + computedConstants[167] = acosh(constants[0]); + computedConstants[168] = atanh(constants[0]/2.0); + computedConstants[169] = asech(constants[0]); + computedConstants[170] = acsch(constants[0]); + computedConstants[171] = acoth(2.0*constants[0]); + computedConstants[172] = (gt(constants[0], constants[1]))?constants[0]:NAN; + computedConstants[173] = (gt(constants[0], constants[1]))?constants[0]:constants[2]; + computedConstants[174] = (gt(constants[0], constants[1]))?constants[0]:(gt(constants[2], constants[3]))?constants[2]:(gt(constants[4], constants[5]))?constants[4]:NAN; + computedConstants[175] = (gt(constants[0], constants[1]))?constants[0]:(gt(constants[2], constants[3]))?constants[2]:(gt(constants[4], constants[5]))?constants[4]:constants[6]; + computedConstants[176] = 123.0+((gt(constants[0], constants[1]))?constants[0]:NAN); + computedConstants[181] = constants[0]; + computedConstants[188] = and(constants[0], constants[1])+((gt(constants[2], constants[3]))?constants[1]:NAN)+constants[4]+and(constants[5], constants[6]); + computedConstants[189] = and(constants[0], constants[1])-(((gt(constants[2], constants[3]))?constants[1]:NAN)-(constants[4]-((gt(constants[2], constants[3]))?constants[1]:NAN)))-and(constants[5], constants[6]); + computedConstants[190] = and(constants[0], constants[1])*((gt(constants[2], constants[3]))?constants[1]:NAN)*constants[4]*((gt(constants[2], constants[3]))?constants[1]:NAN)*and(constants[5], constants[6]); + computedConstants[191] = and(constants[0], constants[1])/(((gt(constants[2], constants[3]))?constants[1]:NAN)/(constants[4]/((gt(constants[2], constants[3]))?constants[1]:NAN))); + computedConstants[192] = and(or(constants[0], constants[1]), and(xor(constants[0], constants[1]), and((gt(constants[2], constants[3]))?constants[1]:NAN, and(and(and(constants[4], (gt(constants[2], constants[3]))?constants[1]:NAN), xor(constants[0], constants[1])), or(constants[0], constants[1]))))); + computedConstants[193] = or(and(constants[0], constants[1]), or(xor(constants[0], constants[1]), or((gt(constants[2], constants[3]))?constants[1]:NAN, or(or(or(constants[4], (gt(constants[2], constants[3]))?constants[1]:NAN), xor(constants[0], constants[1])), and(constants[0], constants[1]))))); + computedConstants[194] = xor(and(constants[0], constants[1]), xor(or(constants[0], constants[1]), xor((gt(constants[2], constants[3]))?constants[1]:NAN, xor(xor(xor(constants[4], (gt(constants[2], constants[3]))?constants[1]:NAN), or(constants[0], constants[1])), and(constants[0], constants[1]))))); + computedConstants[195] = pow(and(constants[0], constants[1]), pow((gt(constants[2], constants[3]))?constants[1]:NAN, pow(pow(constants[4], (gt(constants[2], constants[3]))?constants[1]:NAN), and(constants[0], constants[1])))); + computedConstants[196] = pow(pow(pow(and(constants[0], constants[1]), 1.0/pow((gt(constants[2], constants[3]))?constants[1]:NAN, 1.0/constants[4])), 1.0/((gt(constants[2], constants[3]))?constants[1]:NAN)), 1.0/and(constants[0], constants[1])); + computedConstants[197] = -and(constants[0], constants[1])+-((gt(constants[2], constants[3]))?constants[1]:NAN); } void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) diff --git a/tests/resources/coverage/generator/model.modified.profile.c b/tests/resources/coverage/generator/model.modified.profile.c index b5bd907469..986e598213 100644 --- a/tests/resources/coverage/generator/model.modified.profile.c +++ b/tests/resources/coverage/generator/model.modified.profile.c @@ -356,11 +356,11 @@ void objectiveFunction0(double *u, double *f, void *data) double *rates = ((RootFindingInfo *) data)->rates; double *variables = ((RootFindingInfo *) data)->variables; - algebraic[205] = u[0]; - algebraic[206] = u[1]; + algebraic[0] = u[0]; + algebraic[1] = u[1]; - f[0] = algebraic[205]+algebraic[206]+states[0]-0.0; - f[1] = algebraic[205]-algebraic[206]-(computedConstants[207]+computedConstants[208]); + f[0] = algebraic[0]+algebraic[1]+states[0]-0.0; + f[1] = algebraic[0]-algebraic[1]-(computedConstants[198]+computedConstants[199]); } void findRoot0(double voi, double *states, double *rates, double *variables) @@ -368,231 +368,231 @@ void findRoot0(double voi, double *states, double *rates, double *variables) RootFindingInfo rfi = { voi, states, rates, variables }; double u[2]; - u[0] = algebraic[205]; - u[1] = algebraic[206]; + u[0] = algebraic[0]; + u[1] = algebraic[1]; nlaSolve(objectiveFunction0, u, 2, &rfi); - algebraic[205] = u[0]; - algebraic[206] = u[1]; + algebraic[0] = u[0]; + algebraic[1] = u[1]; } void initialiseVariables(double *states, double *rates, double *constants) { - constants[1] = 1.0; - constants[2] = 2.0; - constants[6] = 3.0; - constants[18] = 4.0; - constants[179] = 5.0; - constants[180] = 6.0; - constants[182] = 7.0; - algebraic[205] = 1.0; - algebraic[206] = 2.0; - computedConstants[184] = 123.0; - computedConstants[185] = 123.456789; - computedConstants[186] = 123.0e99; - computedConstants[187] = 123.456789e99; - computedConstants[189] = 1.0; - computedConstants[190] = 0.0; - computedConstants[191] = 2.71828182845905; - computedConstants[192] = 3.14159265358979; - computedConstants[193] = INFINITY; - computedConstants[194] = NAN; - computedConstants[207] = 1.0; - computedConstants[208] = 3.0; + constants[0] = 1.0; + constants[1] = 2.0; + constants[2] = 3.0; + constants[3] = 4.0; + constants[4] = 5.0; + constants[5] = 6.0; + constants[6] = 7.0; + algebraic[0] = 1.0; + algebraic[1] = 2.0; + computedConstants[177] = 123.0; + computedConstants[178] = 123.456789; + computedConstants[179] = 123.0e99; + computedConstants[180] = 123.456789e99; + computedConstants[182] = 1.0; + computedConstants[183] = 0.0; + computedConstants[184] = 2.71828182845905; + computedConstants[185] = 3.14159265358979; + computedConstants[186] = INFINITY; + computedConstants[187] = NAN; + computedConstants[198] = 1.0; + computedConstants[199] = 3.0; states[0] = 0.0; } void computeComputedConstants(double *constants, double *computedConstants) { - computedConstants[0] = constants[1] == constants[2]; - computedConstants[3] = constants[1]/(constants[2] == constants[2]); - computedConstants[4] = constants[1] != constants[2]; - computedConstants[5] = constants[1]/(constants[2] != constants[6]); - computedConstants[7] = constants[1] < constants[2]; - computedConstants[8] = constants[1]/(constants[2] < constants[6]); - computedConstants[9] = constants[1] <= constants[2]; - computedConstants[10] = constants[1]/(constants[2] <= constants[6]); - computedConstants[11] = constants[1] > constants[2]; - computedConstants[12] = constants[1]/(constants[2] > constants[6]); - computedConstants[13] = constants[1] >= constants[2]; - computedConstants[14] = constants[1]/(constants[2] >= constants[6]); - computedConstants[15] = constants[1] && constants[2]; - computedConstants[16] = constants[1] && constants[2] && constants[6]; - computedConstants[17] = (constants[1] < constants[2]) && (constants[6] > constants[18]); - computedConstants[19] = (constants[1]+constants[2]) && (constants[6] > constants[18]); - computedConstants[20] = constants[1] && (constants[2] > constants[6]); - computedConstants[21] = (constants[1]-constants[2]) && (constants[6] > constants[18]); - computedConstants[22] = -constants[1] && (constants[2] > constants[6]); - computedConstants[23] = pow(constants[1], constants[2]) && (constants[6] > constants[18]); - computedConstants[24] = pow(constants[1], 1.0/constants[2]) && (constants[6] > constants[18]); - computedConstants[25] = (constants[1] < constants[2]) && (constants[6]+constants[18]); - computedConstants[26] = (constants[1] < constants[2]) && constants[6]; - computedConstants[27] = (constants[1] < constants[2]) && (constants[6]-constants[18]); - computedConstants[28] = (constants[1] < constants[2]) && -constants[6]; - computedConstants[29] = (constants[1] < constants[2]) && pow(constants[6], constants[18]); - computedConstants[30] = (constants[1] < constants[2]) && pow(constants[6], 1.0/constants[18]); - computedConstants[31] = constants[1]/(constants[2] && constants[6]); - computedConstants[32] = constants[1] || constants[2]; - computedConstants[33] = constants[1] || constants[2] || constants[6]; - computedConstants[34] = (constants[1] < constants[2]) || (constants[6] > constants[18]); - computedConstants[35] = (constants[1]+constants[2]) || (constants[6] > constants[18]); - computedConstants[36] = constants[1] || (constants[2] > constants[6]); - computedConstants[37] = (constants[1]-constants[2]) || (constants[6] > constants[18]); - computedConstants[38] = -constants[1] || (constants[2] > constants[6]); - computedConstants[39] = pow(constants[1], constants[2]) || (constants[6] > constants[18]); - computedConstants[40] = pow(constants[1], 1.0/constants[2]) || (constants[6] > constants[18]); - computedConstants[41] = (constants[1] < constants[2]) || (constants[6]+constants[18]); - computedConstants[42] = (constants[1] < constants[2]) || constants[6]; - computedConstants[43] = (constants[1] < constants[2]) || (constants[6]-constants[18]); - computedConstants[44] = (constants[1] < constants[2]) || -constants[6]; - computedConstants[45] = (constants[1] < constants[2]) || pow(constants[6], constants[18]); - computedConstants[46] = (constants[1] < constants[2]) || pow(constants[6], 1.0/constants[18]); - computedConstants[47] = constants[1]/(constants[2] || constants[6]); - computedConstants[48] = xor(constants[1], constants[2]); - computedConstants[49] = xor(constants[1], xor(constants[2], constants[6])); - computedConstants[50] = xor(constants[1] < constants[2], constants[6] > constants[18]); - computedConstants[51] = xor(constants[1]+constants[2], constants[6] > constants[18]); - computedConstants[52] = xor(constants[1], constants[2] > constants[6]); - computedConstants[53] = xor(constants[1]-constants[2], constants[6] > constants[18]); - computedConstants[54] = xor(-constants[1], constants[2] > constants[6]); - computedConstants[55] = xor(pow(constants[1], constants[2]), constants[6] > constants[18]); - computedConstants[56] = xor(pow(constants[1], 1.0/constants[2]), constants[6] > constants[18]); - computedConstants[57] = xor(constants[1] < constants[2], constants[6]+constants[18]); - computedConstants[58] = xor(constants[1] < constants[2], constants[6]); - computedConstants[59] = xor(constants[1] < constants[2], constants[6]-constants[18]); - computedConstants[60] = xor(constants[1] < constants[2], -constants[6]); - computedConstants[61] = xor(constants[1] < constants[2], pow(constants[6], constants[18])); - computedConstants[62] = xor(constants[1] < constants[2], pow(constants[6], 1.0/constants[18])); - computedConstants[63] = constants[1]/xor(constants[2], constants[6]); - computedConstants[64] = !constants[1]; - computedConstants[65] = constants[1]+constants[2]; - computedConstants[66] = constants[1]+constants[2]+constants[6]; - computedConstants[67] = (constants[1] < constants[2])+(constants[6] > constants[18]); - computedConstants[68] = constants[1]; - computedConstants[69] = constants[1]-constants[2]; - computedConstants[70] = (constants[1] < constants[2])-(constants[6] > constants[18]); - computedConstants[71] = (constants[1] < constants[2])-(constants[6]+constants[18]); - computedConstants[72] = (constants[1] < constants[2])-constants[6]; - computedConstants[73] = constants[1]-(-constants[2]); - computedConstants[74] = constants[1]-(-constants[2]*constants[6]); - computedConstants[75] = -constants[1]; - computedConstants[76] = -(constants[1] < constants[2]); - computedConstants[77] = constants[1]*constants[2]; - computedConstants[78] = constants[1]*constants[2]*constants[6]; - computedConstants[79] = (constants[1] < constants[2])*(constants[6] > constants[18]); - computedConstants[80] = (constants[1]+constants[2])*(constants[6] > constants[18]); - computedConstants[81] = constants[1]*(constants[2] > constants[6]); - computedConstants[82] = (constants[1]-constants[2])*(constants[6] > constants[18]); - computedConstants[83] = -constants[1]*(constants[2] > constants[6]); - computedConstants[84] = (constants[1] < constants[2])*(constants[6]+constants[18]); - computedConstants[85] = (constants[1] < constants[2])*constants[6]; - computedConstants[86] = (constants[1] < constants[2])*(constants[6]-constants[18]); - computedConstants[87] = (constants[1] < constants[2])*-constants[6]; - computedConstants[88] = constants[1]/constants[2]; - computedConstants[89] = (constants[1] < constants[2])/(constants[18] > constants[6]); - computedConstants[90] = (constants[1]+constants[2])/(constants[18] > constants[6]); - computedConstants[91] = constants[1]/(constants[6] > constants[2]); - computedConstants[92] = (constants[1]-constants[2])/(constants[18] > constants[6]); - computedConstants[93] = -constants[1]/(constants[6] > constants[2]); - computedConstants[94] = (constants[1] < constants[2])/(constants[6]+constants[18]); - computedConstants[95] = (constants[1] < constants[2])/constants[6]; - computedConstants[96] = (constants[1] < constants[2])/(constants[6]-constants[18]); - computedConstants[97] = (constants[1] < constants[2])/-constants[6]; - computedConstants[98] = (constants[1] < constants[2])/(constants[6]*constants[18]); - computedConstants[99] = (constants[1] < constants[2])/(constants[6]/constants[18]); - computedConstants[100] = sqrt(constants[1]); - computedConstants[101] = pow(constants[1], 2.0); - computedConstants[102] = pow(constants[1], 3.0); - computedConstants[103] = pow(constants[1], constants[2]); - computedConstants[104] = pow(constants[1] <= constants[2], constants[6] >= constants[18]); - computedConstants[105] = pow(constants[1]+constants[2], constants[6] >= constants[18]); - computedConstants[106] = pow(constants[1], constants[2] >= constants[6]); - computedConstants[107] = pow(constants[1]-constants[2], constants[6] >= constants[18]); - computedConstants[108] = pow(-constants[1], constants[2] >= constants[6]); - computedConstants[109] = pow(constants[1]*constants[2], constants[6] >= constants[18]); - computedConstants[110] = pow(constants[1]/constants[2], constants[6] >= constants[18]); - computedConstants[111] = pow(constants[1] <= constants[2], constants[6]+constants[18]); - computedConstants[112] = pow(constants[1] <= constants[2], constants[6]); - computedConstants[113] = pow(constants[1] <= constants[2], constants[6]-constants[18]); - computedConstants[114] = pow(constants[1] <= constants[2], -constants[6]); - computedConstants[115] = pow(constants[1] <= constants[2], constants[6]*constants[18]); - computedConstants[116] = pow(constants[1] <= constants[2], constants[6]/constants[18]); - computedConstants[117] = pow(constants[1] <= constants[2], pow(constants[6], constants[18])); - computedConstants[118] = pow(constants[1] <= constants[2], pow(constants[6], 1.0/constants[18])); - computedConstants[119] = sqrt(constants[1]); - computedConstants[120] = sqrt(constants[1]); - computedConstants[121] = pow(constants[1], 1.0/3.0); - computedConstants[122] = pow(constants[1], 1.0/constants[2]); - computedConstants[123] = pow(constants[1] < constants[2], 1.0/(constants[18] > constants[6])); - computedConstants[124] = pow(constants[1]+constants[2], 1.0/(constants[18] > constants[6])); - computedConstants[125] = pow(constants[1], 1.0/(constants[6] > constants[2])); - computedConstants[126] = pow(constants[1]-constants[2], 1.0/(constants[18] > constants[6])); - computedConstants[127] = pow(-constants[1], 1.0/(constants[6] > constants[2])); - computedConstants[128] = pow(constants[1]*constants[2], 1.0/(constants[18] > constants[6])); - computedConstants[129] = pow(constants[1]/constants[2], 1.0/(constants[18] > constants[6])); - computedConstants[130] = pow(constants[1] < constants[2], 1.0/(constants[6]+constants[18])); - computedConstants[131] = pow(constants[1] < constants[2], 1.0/constants[6]); - computedConstants[132] = pow(constants[1] < constants[2], 1.0/(constants[6]-constants[18])); - computedConstants[133] = pow(constants[1] < constants[2], 1.0/-constants[6]); - computedConstants[134] = pow(constants[1] < constants[2], 1.0/(constants[6]*constants[18])); - computedConstants[135] = pow(constants[1] < constants[2], 1.0/(constants[6]/constants[18])); - computedConstants[136] = pow(constants[1] < constants[2], 1.0/pow(constants[6], constants[18])); - computedConstants[137] = pow(constants[1] < constants[2], 1.0/pow(constants[6], 1.0/constants[18])); - computedConstants[138] = fabs(constants[1]); - computedConstants[139] = exp(constants[1]); - computedConstants[140] = log(constants[1]); - computedConstants[141] = log10(constants[1]); - computedConstants[142] = log(constants[1])/log(2.0); - computedConstants[143] = log10(constants[1]); - computedConstants[144] = log(constants[1])/log(constants[2]); - computedConstants[145] = ceil(constants[1]); - computedConstants[146] = floor(constants[1]); - computedConstants[147] = min(constants[1], constants[2]); - computedConstants[148] = min(constants[1], min(constants[2], constants[6])); - computedConstants[149] = max(constants[1], constants[2]); - computedConstants[150] = max(constants[1], max(constants[2], constants[6])); - computedConstants[151] = fmod(constants[1], constants[2]); - computedConstants[152] = sin(constants[1]); - computedConstants[153] = cos(constants[1]); - computedConstants[154] = tan(constants[1]); - computedConstants[155] = sec(constants[1]); - computedConstants[156] = csc(constants[1]); - computedConstants[157] = cot(constants[1]); - computedConstants[158] = sinh(constants[1]); - computedConstants[159] = cosh(constants[1]); - computedConstants[160] = tanh(constants[1]); - computedConstants[161] = sech(constants[1]); - computedConstants[162] = csch(constants[1]); - computedConstants[163] = coth(constants[1]); - computedConstants[164] = asin(constants[1]); - computedConstants[165] = acos(constants[1]); - computedConstants[166] = atan(constants[1]); - computedConstants[167] = asec(constants[1]); - computedConstants[168] = acsc(constants[1]); - computedConstants[169] = acot(constants[1]); - computedConstants[170] = asinh(constants[1]); - computedConstants[171] = acosh(constants[1]); - computedConstants[172] = atanh(constants[1]/2.0); - computedConstants[173] = asech(constants[1]); - computedConstants[174] = acsch(constants[1]); - computedConstants[175] = acoth(2.0*constants[1]); - computedConstants[176] = (constants[1] > constants[2])?constants[1]:NAN; - computedConstants[177] = (constants[1] > constants[2])?constants[1]:constants[6]; - computedConstants[178] = (constants[1] > constants[2])?constants[1]:(constants[6] > constants[18])?constants[6]:(constants[179] > constants[180])?constants[179]:NAN; - computedConstants[181] = (constants[1] > constants[2])?constants[1]:(constants[6] > constants[18])?constants[6]:(constants[179] > constants[180])?constants[179]:constants[182]; - computedConstants[183] = 123.0+((constants[1] > constants[2])?constants[1]:NAN); - computedConstants[188] = constants[1]; - computedConstants[195] = (constants[1] && constants[2])+((constants[6] > constants[18])?constants[2]:NAN)+constants[179]+(constants[180] && constants[182]); - computedConstants[196] = (constants[1] && constants[2])-(((constants[6] > constants[18])?constants[2]:NAN)-(constants[179]-((constants[6] > constants[18])?constants[2]:NAN)))-(constants[180] && constants[182]); - computedConstants[197] = (constants[1] && constants[2])*((constants[6] > constants[18])?constants[2]:NAN)*constants[179]*((constants[6] > constants[18])?constants[2]:NAN)*(constants[180] && constants[182]); - computedConstants[198] = (constants[1] && constants[2])/(((constants[6] > constants[18])?constants[2]:NAN)/(constants[179]/((constants[6] > constants[18])?constants[2]:NAN))); - computedConstants[199] = (constants[1] || constants[2]) && xor(constants[1], constants[2]) && ((constants[6] > constants[18])?constants[2]:NAN) && constants[179] && ((constants[6] > constants[18])?constants[2]:NAN) && xor(constants[1], constants[2]) && (constants[1] || constants[2]); - computedConstants[200] = (constants[1] && constants[2]) || xor(constants[1], constants[2]) || ((constants[6] > constants[18])?constants[2]:NAN) || constants[179] || ((constants[6] > constants[18])?constants[2]:NAN) || xor(constants[1], constants[2]) || (constants[1] && constants[2]); - computedConstants[201] = xor(constants[1] && constants[2], xor(constants[1] || constants[2], xor((constants[6] > constants[18])?constants[2]:NAN, xor(xor(xor(constants[179], (constants[6] > constants[18])?constants[2]:NAN), constants[1] || constants[2]), constants[1] && constants[2])))); - computedConstants[202] = pow(constants[1] && constants[2], pow((constants[6] > constants[18])?constants[2]:NAN, pow(pow(constants[179], (constants[6] > constants[18])?constants[2]:NAN), constants[1] && constants[2]))); - computedConstants[203] = pow(pow(pow(constants[1] && constants[2], 1.0/pow((constants[6] > constants[18])?constants[2]:NAN, 1.0/constants[179])), 1.0/((constants[6] > constants[18])?constants[2]:NAN)), 1.0/(constants[1] && constants[2])); - computedConstants[204] = -(constants[1] && constants[2])+-((constants[6] > constants[18])?constants[2]:NAN); + computedConstants[0] = constants[0] == constants[1]; + computedConstants[1] = constants[0]/(constants[1] == constants[1]); + computedConstants[2] = constants[0] != constants[1]; + computedConstants[3] = constants[0]/(constants[1] != constants[2]); + computedConstants[4] = constants[0] < constants[1]; + computedConstants[5] = constants[0]/(constants[1] < constants[2]); + computedConstants[6] = constants[0] <= constants[1]; + computedConstants[7] = constants[0]/(constants[1] <= constants[2]); + computedConstants[8] = constants[0] > constants[1]; + computedConstants[9] = constants[0]/(constants[1] > constants[2]); + computedConstants[10] = constants[0] >= constants[1]; + computedConstants[11] = constants[0]/(constants[1] >= constants[2]); + computedConstants[12] = constants[0] && constants[1]; + computedConstants[13] = constants[0] && constants[1] && constants[2]; + computedConstants[14] = (constants[0] < constants[1]) && (constants[2] > constants[3]); + computedConstants[15] = (constants[0]+constants[1]) && (constants[2] > constants[3]); + computedConstants[16] = constants[0] && (constants[1] > constants[2]); + computedConstants[17] = (constants[0]-constants[1]) && (constants[2] > constants[3]); + computedConstants[18] = -constants[0] && (constants[1] > constants[2]); + computedConstants[19] = pow(constants[0], constants[1]) && (constants[2] > constants[3]); + computedConstants[20] = pow(constants[0], 1.0/constants[1]) && (constants[2] > constants[3]); + computedConstants[21] = (constants[0] < constants[1]) && (constants[2]+constants[3]); + computedConstants[22] = (constants[0] < constants[1]) && constants[2]; + computedConstants[23] = (constants[0] < constants[1]) && (constants[2]-constants[3]); + computedConstants[24] = (constants[0] < constants[1]) && -constants[2]; + computedConstants[25] = (constants[0] < constants[1]) && pow(constants[2], constants[3]); + computedConstants[26] = (constants[0] < constants[1]) && pow(constants[2], 1.0/constants[3]); + computedConstants[27] = constants[0]/(constants[1] && constants[2]); + computedConstants[28] = constants[0] || constants[1]; + computedConstants[29] = constants[0] || constants[1] || constants[2]; + computedConstants[30] = (constants[0] < constants[1]) || (constants[2] > constants[3]); + computedConstants[31] = (constants[0]+constants[1]) || (constants[2] > constants[3]); + computedConstants[32] = constants[0] || (constants[1] > constants[2]); + computedConstants[33] = (constants[0]-constants[1]) || (constants[2] > constants[3]); + computedConstants[34] = -constants[0] || (constants[1] > constants[2]); + computedConstants[35] = pow(constants[0], constants[1]) || (constants[2] > constants[3]); + computedConstants[36] = pow(constants[0], 1.0/constants[1]) || (constants[2] > constants[3]); + computedConstants[37] = (constants[0] < constants[1]) || (constants[2]+constants[3]); + computedConstants[38] = (constants[0] < constants[1]) || constants[2]; + computedConstants[39] = (constants[0] < constants[1]) || (constants[2]-constants[3]); + computedConstants[40] = (constants[0] < constants[1]) || -constants[2]; + computedConstants[41] = (constants[0] < constants[1]) || pow(constants[2], constants[3]); + computedConstants[42] = (constants[0] < constants[1]) || pow(constants[2], 1.0/constants[3]); + computedConstants[43] = constants[0]/(constants[1] || constants[2]); + computedConstants[44] = xor(constants[0], constants[1]); + computedConstants[45] = xor(constants[0], xor(constants[1], constants[2])); + computedConstants[46] = xor(constants[0] < constants[1], constants[2] > constants[3]); + computedConstants[47] = xor(constants[0]+constants[1], constants[2] > constants[3]); + computedConstants[48] = xor(constants[0], constants[1] > constants[2]); + computedConstants[49] = xor(constants[0]-constants[1], constants[2] > constants[3]); + computedConstants[50] = xor(-constants[0], constants[1] > constants[2]); + computedConstants[51] = xor(pow(constants[0], constants[1]), constants[2] > constants[3]); + computedConstants[52] = xor(pow(constants[0], 1.0/constants[1]), constants[2] > constants[3]); + computedConstants[53] = xor(constants[0] < constants[1], constants[2]+constants[3]); + computedConstants[54] = xor(constants[0] < constants[1], constants[2]); + computedConstants[55] = xor(constants[0] < constants[1], constants[2]-constants[3]); + computedConstants[56] = xor(constants[0] < constants[1], -constants[2]); + computedConstants[57] = xor(constants[0] < constants[1], pow(constants[2], constants[3])); + computedConstants[58] = xor(constants[0] < constants[1], pow(constants[2], 1.0/constants[3])); + computedConstants[59] = constants[0]/xor(constants[1], constants[2]); + computedConstants[60] = !constants[0]; + computedConstants[61] = constants[0]+constants[1]; + computedConstants[62] = constants[0]+constants[1]+constants[2]; + computedConstants[63] = (constants[0] < constants[1])+(constants[2] > constants[3]); + computedConstants[64] = constants[0]; + computedConstants[65] = constants[0]-constants[1]; + computedConstants[66] = (constants[0] < constants[1])-(constants[2] > constants[3]); + computedConstants[67] = (constants[0] < constants[1])-(constants[2]+constants[3]); + computedConstants[68] = (constants[0] < constants[1])-constants[2]; + computedConstants[69] = constants[0]-(-constants[1]); + computedConstants[70] = constants[0]-(-constants[1]*constants[2]); + computedConstants[71] = -constants[0]; + computedConstants[72] = -(constants[0] < constants[1]); + computedConstants[73] = constants[0]*constants[1]; + computedConstants[74] = constants[0]*constants[1]*constants[2]; + computedConstants[75] = (constants[0] < constants[1])*(constants[2] > constants[3]); + computedConstants[76] = (constants[0]+constants[1])*(constants[2] > constants[3]); + computedConstants[77] = constants[0]*(constants[1] > constants[2]); + computedConstants[78] = (constants[0]-constants[1])*(constants[2] > constants[3]); + computedConstants[79] = -constants[0]*(constants[1] > constants[2]); + computedConstants[80] = (constants[0] < constants[1])*(constants[2]+constants[3]); + computedConstants[81] = (constants[0] < constants[1])*constants[2]; + computedConstants[82] = (constants[0] < constants[1])*(constants[2]-constants[3]); + computedConstants[83] = (constants[0] < constants[1])*-constants[2]; + computedConstants[84] = constants[0]/constants[1]; + computedConstants[85] = (constants[0] < constants[1])/(constants[3] > constants[2]); + computedConstants[86] = (constants[0]+constants[1])/(constants[3] > constants[2]); + computedConstants[87] = constants[0]/(constants[2] > constants[1]); + computedConstants[88] = (constants[0]-constants[1])/(constants[3] > constants[2]); + computedConstants[89] = -constants[0]/(constants[2] > constants[1]); + computedConstants[90] = (constants[0] < constants[1])/(constants[2]+constants[3]); + computedConstants[91] = (constants[0] < constants[1])/constants[2]; + computedConstants[92] = (constants[0] < constants[1])/(constants[2]-constants[3]); + computedConstants[93] = (constants[0] < constants[1])/-constants[2]; + computedConstants[94] = (constants[0] < constants[1])/(constants[2]*constants[3]); + computedConstants[95] = (constants[0] < constants[1])/(constants[2]/constants[3]); + computedConstants[96] = sqrt(constants[0]); + computedConstants[97] = pow(constants[0], 2.0); + computedConstants[98] = pow(constants[0], 3.0); + computedConstants[99] = pow(constants[0], constants[1]); + computedConstants[100] = pow(constants[0] <= constants[1], constants[2] >= constants[3]); + computedConstants[101] = pow(constants[0]+constants[1], constants[2] >= constants[3]); + computedConstants[102] = pow(constants[0], constants[1] >= constants[2]); + computedConstants[103] = pow(constants[0]-constants[1], constants[2] >= constants[3]); + computedConstants[104] = pow(-constants[0], constants[1] >= constants[2]); + computedConstants[105] = pow(constants[0]*constants[1], constants[2] >= constants[3]); + computedConstants[106] = pow(constants[0]/constants[1], constants[2] >= constants[3]); + computedConstants[107] = pow(constants[0] <= constants[1], constants[2]+constants[3]); + computedConstants[108] = pow(constants[0] <= constants[1], constants[2]); + computedConstants[109] = pow(constants[0] <= constants[1], constants[2]-constants[3]); + computedConstants[110] = pow(constants[0] <= constants[1], -constants[2]); + computedConstants[111] = pow(constants[0] <= constants[1], constants[2]*constants[3]); + computedConstants[112] = pow(constants[0] <= constants[1], constants[2]/constants[3]); + computedConstants[113] = pow(constants[0] <= constants[1], pow(constants[2], constants[3])); + computedConstants[114] = pow(constants[0] <= constants[1], pow(constants[2], 1.0/constants[3])); + computedConstants[115] = sqrt(constants[0]); + computedConstants[116] = sqrt(constants[0]); + computedConstants[117] = pow(constants[0], 1.0/3.0); + computedConstants[118] = pow(constants[0], 1.0/constants[1]); + computedConstants[119] = pow(constants[0] < constants[1], 1.0/(constants[3] > constants[2])); + computedConstants[120] = pow(constants[0]+constants[1], 1.0/(constants[3] > constants[2])); + computedConstants[121] = pow(constants[0], 1.0/(constants[2] > constants[1])); + computedConstants[122] = pow(constants[0]-constants[1], 1.0/(constants[3] > constants[2])); + computedConstants[123] = pow(-constants[0], 1.0/(constants[2] > constants[1])); + computedConstants[124] = pow(constants[0]*constants[1], 1.0/(constants[3] > constants[2])); + computedConstants[125] = pow(constants[0]/constants[1], 1.0/(constants[3] > constants[2])); + computedConstants[126] = pow(constants[0] < constants[1], 1.0/(constants[2]+constants[3])); + computedConstants[127] = pow(constants[0] < constants[1], 1.0/constants[2]); + computedConstants[128] = pow(constants[0] < constants[1], 1.0/(constants[2]-constants[3])); + computedConstants[129] = pow(constants[0] < constants[1], 1.0/-constants[2]); + computedConstants[130] = pow(constants[0] < constants[1], 1.0/(constants[2]*constants[3])); + computedConstants[131] = pow(constants[0] < constants[1], 1.0/(constants[2]/constants[3])); + computedConstants[132] = pow(constants[0] < constants[1], 1.0/pow(constants[2], constants[3])); + computedConstants[133] = pow(constants[0] < constants[1], 1.0/pow(constants[2], 1.0/constants[3])); + computedConstants[134] = fabs(constants[0]); + computedConstants[135] = exp(constants[0]); + computedConstants[136] = log(constants[0]); + computedConstants[137] = log10(constants[0]); + computedConstants[138] = log(constants[0])/log(2.0); + computedConstants[139] = log10(constants[0]); + computedConstants[140] = log(constants[0])/log(constants[1]); + computedConstants[141] = ceil(constants[0]); + computedConstants[142] = floor(constants[0]); + computedConstants[143] = min(constants[0], constants[1]); + computedConstants[144] = min(constants[0], min(constants[1], constants[2])); + computedConstants[145] = max(constants[0], constants[1]); + computedConstants[146] = max(constants[0], max(constants[1], constants[2])); + computedConstants[147] = fmod(constants[0], constants[1]); + computedConstants[148] = sin(constants[0]); + computedConstants[149] = cos(constants[0]); + computedConstants[150] = tan(constants[0]); + computedConstants[151] = sec(constants[0]); + computedConstants[152] = csc(constants[0]); + computedConstants[153] = cot(constants[0]); + computedConstants[154] = sinh(constants[0]); + computedConstants[155] = cosh(constants[0]); + computedConstants[156] = tanh(constants[0]); + computedConstants[157] = sech(constants[0]); + computedConstants[158] = csch(constants[0]); + computedConstants[159] = coth(constants[0]); + computedConstants[160] = asin(constants[0]); + computedConstants[161] = acos(constants[0]); + computedConstants[162] = atan(constants[0]); + computedConstants[163] = asec(constants[0]); + computedConstants[164] = acsc(constants[0]); + computedConstants[165] = acot(constants[0]); + computedConstants[166] = asinh(constants[0]); + computedConstants[167] = acosh(constants[0]); + computedConstants[168] = atanh(constants[0]/2.0); + computedConstants[169] = asech(constants[0]); + computedConstants[170] = acsch(constants[0]); + computedConstants[171] = acoth(2.0*constants[0]); + computedConstants[172] = (constants[0] > constants[1])?constants[0]:NAN; + computedConstants[173] = (constants[0] > constants[1])?constants[0]:constants[2]; + computedConstants[174] = (constants[0] > constants[1])?constants[0]:(constants[2] > constants[3])?constants[2]:(constants[4] > constants[5])?constants[4]:NAN; + computedConstants[175] = (constants[0] > constants[1])?constants[0]:(constants[2] > constants[3])?constants[2]:(constants[4] > constants[5])?constants[4]:constants[6]; + computedConstants[176] = 123.0+((constants[0] > constants[1])?constants[0]:NAN); + computedConstants[181] = constants[0]; + computedConstants[188] = (constants[0] && constants[1])+((constants[2] > constants[3])?constants[1]:NAN)+constants[4]+(constants[5] && constants[6]); + computedConstants[189] = (constants[0] && constants[1])-(((constants[2] > constants[3])?constants[1]:NAN)-(constants[4]-((constants[2] > constants[3])?constants[1]:NAN)))-(constants[5] && constants[6]); + computedConstants[190] = (constants[0] && constants[1])*((constants[2] > constants[3])?constants[1]:NAN)*constants[4]*((constants[2] > constants[3])?constants[1]:NAN)*(constants[5] && constants[6]); + computedConstants[191] = (constants[0] && constants[1])/(((constants[2] > constants[3])?constants[1]:NAN)/(constants[4]/((constants[2] > constants[3])?constants[1]:NAN))); + computedConstants[192] = (constants[0] || constants[1]) && xor(constants[0], constants[1]) && ((constants[2] > constants[3])?constants[1]:NAN) && constants[4] && ((constants[2] > constants[3])?constants[1]:NAN) && xor(constants[0], constants[1]) && (constants[0] || constants[1]); + computedConstants[193] = (constants[0] && constants[1]) || xor(constants[0], constants[1]) || ((constants[2] > constants[3])?constants[1]:NAN) || constants[4] || ((constants[2] > constants[3])?constants[1]:NAN) || xor(constants[0], constants[1]) || (constants[0] && constants[1]); + computedConstants[194] = xor(constants[0] && constants[1], xor(constants[0] || constants[1], xor((constants[2] > constants[3])?constants[1]:NAN, xor(xor(xor(constants[4], (constants[2] > constants[3])?constants[1]:NAN), constants[0] || constants[1]), constants[0] && constants[1])))); + computedConstants[195] = pow(constants[0] && constants[1], pow((constants[2] > constants[3])?constants[1]:NAN, pow(pow(constants[4], (constants[2] > constants[3])?constants[1]:NAN), constants[0] && constants[1]))); + computedConstants[196] = pow(pow(pow(constants[0] && constants[1], 1.0/pow((constants[2] > constants[3])?constants[1]:NAN, 1.0/constants[4])), 1.0/((constants[2] > constants[3])?constants[1]:NAN)), 1.0/(constants[0] && constants[1])); + computedConstants[197] = -(constants[0] && constants[1])+-((constants[2] > constants[3])?constants[1]:NAN); } void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) diff --git a/tests/resources/coverage/generator/model.modified.profile.py b/tests/resources/coverage/generator/model.modified.profile.py index 4eeb5c9faa..4f4499cf7e 100644 --- a/tests/resources/coverage/generator/model.modified.profile.py +++ b/tests/resources/coverage/generator/model.modified.profile.py @@ -359,239 +359,239 @@ def objective_function_0(u, f, data): rates = data[2] variables = data[3] - algebraic[205] = u[0] - algebraic[206] = u[1] + algebraic[0] = u[0] + algebraic[1] = u[1] - f[0] = algebraic[205]+algebraic[206]+states[0]-0.0 - f[1] = algebraic[205]-algebraic[206]-(computed_constants[207]+computed_constants[208]) + f[0] = algebraic[0]+algebraic[1]+states[0]-0.0 + f[1] = algebraic[0]-algebraic[1]-(computed_constants[198]+computed_constants[199]) def find_root_0(voi, states, rates, variables): u = [nan]*2 - u[0] = algebraic[205] - u[1] = algebraic[206] + u[0] = algebraic[0] + u[1] = algebraic[1] u = nla_solve(objective_function_0, u, 2, [voi, states, rates, variables]) - algebraic[205] = u[0] - algebraic[206] = u[1] + algebraic[0] = u[0] + algebraic[1] = u[1] def initialise_variables(states, rates, constants): - constants[1] = 1.0 - constants[2] = 2.0 - constants[6] = 3.0 - constants[18] = 4.0 - constants[179] = 5.0 - constants[180] = 6.0 - constants[182] = 7.0 - algebraic[205] = 1.0 - algebraic[206] = 2.0 - computed_constants[184] = 123.0 - computed_constants[185] = 123.456789 - computed_constants[186] = 123.0e99 - computed_constants[187] = 123.456789e99 - computed_constants[189] = 1.0 - computed_constants[190] = 0.0 - computed_constants[191] = 2.71828182845905 - computed_constants[192] = 3.14159265358979 - computed_constants[193] = inf - computed_constants[194] = nan - computed_constants[207] = 1.0 - computed_constants[208] = 3.0 + constants[0] = 1.0 + constants[1] = 2.0 + constants[2] = 3.0 + constants[3] = 4.0 + constants[4] = 5.0 + constants[5] = 6.0 + constants[6] = 7.0 + algebraic[0] = 1.0 + algebraic[1] = 2.0 + computed_constants[177] = 123.0 + computed_constants[178] = 123.456789 + computed_constants[179] = 123.0e99 + computed_constants[180] = 123.456789e99 + computed_constants[182] = 1.0 + computed_constants[183] = 0.0 + computed_constants[184] = 2.71828182845905 + computed_constants[185] = 3.14159265358979 + computed_constants[186] = inf + computed_constants[187] = nan + computed_constants[198] = 1.0 + computed_constants[199] = 3.0 states[0] = 0.0 def compute_computed_constants(constants, computed_constants): - computed_constants[0] = eq_func(constants[1], constants[2]) - computed_constants[3] = constants[1]/eq_func(constants[2], constants[2]) - computed_constants[4] = neq_func(constants[1], constants[2]) - computed_constants[5] = constants[1]/neq_func(constants[2], constants[6]) - computed_constants[7] = lt_func(constants[1], constants[2]) - computed_constants[8] = constants[1]/lt_func(constants[2], constants[6]) - computed_constants[9] = leq_func(constants[1], constants[2]) - computed_constants[10] = constants[1]/leq_func(constants[2], constants[6]) - computed_constants[11] = gt_func(constants[1], constants[2]) - computed_constants[12] = constants[1]/gt_func(constants[2], constants[6]) - computed_constants[13] = geq_func(constants[1], constants[2]) - computed_constants[14] = constants[1]/geq_func(constants[2], constants[6]) - computed_constants[15] = and_func(constants[1], constants[2]) - computed_constants[16] = and_func(constants[1], and_func(constants[2], constants[6])) - computed_constants[17] = and_func(lt_func(constants[1], constants[2]), gt_func(constants[6], constants[18])) - computed_constants[19] = and_func(constants[1]+constants[2], gt_func(constants[6], constants[18])) - computed_constants[20] = and_func(constants[1], gt_func(constants[2], constants[6])) - computed_constants[21] = and_func(constants[1]-constants[2], gt_func(constants[6], constants[18])) - computed_constants[22] = and_func(-constants[1], gt_func(constants[2], constants[6])) - computed_constants[23] = and_func(pow(constants[1], constants[2]), gt_func(constants[6], constants[18])) - computed_constants[24] = and_func(pow(constants[1], 1.0/constants[2]), gt_func(constants[6], constants[18])) - computed_constants[25] = and_func(lt_func(constants[1], constants[2]), constants[6]+constants[18]) - computed_constants[26] = and_func(lt_func(constants[1], constants[2]), constants[6]) - computed_constants[27] = and_func(lt_func(constants[1], constants[2]), constants[6]-constants[18]) - computed_constants[28] = and_func(lt_func(constants[1], constants[2]), -constants[6]) - computed_constants[29] = and_func(lt_func(constants[1], constants[2]), pow(constants[6], constants[18])) - computed_constants[30] = and_func(lt_func(constants[1], constants[2]), pow(constants[6], 1.0/constants[18])) - computed_constants[31] = constants[1]/and_func(constants[2], constants[6]) - computed_constants[32] = or_func(constants[1], constants[2]) - computed_constants[33] = or_func(constants[1], or_func(constants[2], constants[6])) - computed_constants[34] = or_func(lt_func(constants[1], constants[2]), gt_func(constants[6], constants[18])) - computed_constants[35] = or_func(constants[1]+constants[2], gt_func(constants[6], constants[18])) - computed_constants[36] = or_func(constants[1], gt_func(constants[2], constants[6])) - computed_constants[37] = or_func(constants[1]-constants[2], gt_func(constants[6], constants[18])) - computed_constants[38] = or_func(-constants[1], gt_func(constants[2], constants[6])) - computed_constants[39] = or_func(pow(constants[1], constants[2]), gt_func(constants[6], constants[18])) - computed_constants[40] = or_func(pow(constants[1], 1.0/constants[2]), gt_func(constants[6], constants[18])) - computed_constants[41] = or_func(lt_func(constants[1], constants[2]), constants[6]+constants[18]) - computed_constants[42] = or_func(lt_func(constants[1], constants[2]), constants[6]) - computed_constants[43] = or_func(lt_func(constants[1], constants[2]), constants[6]-constants[18]) - computed_constants[44] = or_func(lt_func(constants[1], constants[2]), -constants[6]) - computed_constants[45] = or_func(lt_func(constants[1], constants[2]), pow(constants[6], constants[18])) - computed_constants[46] = or_func(lt_func(constants[1], constants[2]), pow(constants[6], 1.0/constants[18])) - computed_constants[47] = constants[1]/or_func(constants[2], constants[6]) - computed_constants[48] = xor_func(constants[1], constants[2]) - computed_constants[49] = xor_func(constants[1], xor_func(constants[2], constants[6])) - computed_constants[50] = xor_func(lt_func(constants[1], constants[2]), gt_func(constants[6], constants[18])) - computed_constants[51] = xor_func(constants[1]+constants[2], gt_func(constants[6], constants[18])) - computed_constants[52] = xor_func(constants[1], gt_func(constants[2], constants[6])) - computed_constants[53] = xor_func(constants[1]-constants[2], gt_func(constants[6], constants[18])) - computed_constants[54] = xor_func(-constants[1], gt_func(constants[2], constants[6])) - computed_constants[55] = xor_func(pow(constants[1], constants[2]), gt_func(constants[6], constants[18])) - computed_constants[56] = xor_func(pow(constants[1], 1.0/constants[2]), gt_func(constants[6], constants[18])) - computed_constants[57] = xor_func(lt_func(constants[1], constants[2]), constants[6]+constants[18]) - computed_constants[58] = xor_func(lt_func(constants[1], constants[2]), constants[6]) - computed_constants[59] = xor_func(lt_func(constants[1], constants[2]), constants[6]-constants[18]) - computed_constants[60] = xor_func(lt_func(constants[1], constants[2]), -constants[6]) - computed_constants[61] = xor_func(lt_func(constants[1], constants[2]), pow(constants[6], constants[18])) - computed_constants[62] = xor_func(lt_func(constants[1], constants[2]), pow(constants[6], 1.0/constants[18])) - computed_constants[63] = constants[1]/xor_func(constants[2], constants[6]) - computed_constants[64] = not_func(constants[1]) - computed_constants[65] = constants[1]+constants[2] - computed_constants[66] = constants[1]+constants[2]+constants[6] - computed_constants[67] = lt_func(constants[1], constants[2])+gt_func(constants[6], constants[18]) - computed_constants[68] = constants[1] - computed_constants[69] = constants[1]-constants[2] - computed_constants[70] = lt_func(constants[1], constants[2])-gt_func(constants[6], constants[18]) - computed_constants[71] = lt_func(constants[1], constants[2])-(constants[6]+constants[18]) - computed_constants[72] = lt_func(constants[1], constants[2])-constants[6] - computed_constants[73] = constants[1]-(-constants[2]) - computed_constants[74] = constants[1]-(-constants[2]*constants[6]) - computed_constants[75] = -constants[1] - computed_constants[76] = -lt_func(constants[1], constants[2]) - computed_constants[77] = constants[1]*constants[2] - computed_constants[78] = constants[1]*constants[2]*constants[6] - computed_constants[79] = lt_func(constants[1], constants[2])*gt_func(constants[6], constants[18]) - computed_constants[80] = (constants[1]+constants[2])*gt_func(constants[6], constants[18]) - computed_constants[81] = constants[1]*gt_func(constants[2], constants[6]) - computed_constants[82] = (constants[1]-constants[2])*gt_func(constants[6], constants[18]) - computed_constants[83] = -constants[1]*gt_func(constants[2], constants[6]) - computed_constants[84] = lt_func(constants[1], constants[2])*(constants[6]+constants[18]) - computed_constants[85] = lt_func(constants[1], constants[2])*constants[6] - computed_constants[86] = lt_func(constants[1], constants[2])*(constants[6]-constants[18]) - computed_constants[87] = lt_func(constants[1], constants[2])*-constants[6] - computed_constants[88] = constants[1]/constants[2] - computed_constants[89] = lt_func(constants[1], constants[2])/gt_func(constants[18], constants[6]) - computed_constants[90] = (constants[1]+constants[2])/gt_func(constants[18], constants[6]) - computed_constants[91] = constants[1]/gt_func(constants[6], constants[2]) - computed_constants[92] = (constants[1]-constants[2])/gt_func(constants[18], constants[6]) - computed_constants[93] = -constants[1]/gt_func(constants[6], constants[2]) - computed_constants[94] = lt_func(constants[1], constants[2])/(constants[6]+constants[18]) - computed_constants[95] = lt_func(constants[1], constants[2])/constants[6] - computed_constants[96] = lt_func(constants[1], constants[2])/(constants[6]-constants[18]) - computed_constants[97] = lt_func(constants[1], constants[2])/-constants[6] - computed_constants[98] = lt_func(constants[1], constants[2])/(constants[6]*constants[18]) - computed_constants[99] = lt_func(constants[1], constants[2])/(constants[6]/constants[18]) - computed_constants[100] = sqrt(constants[1]) - computed_constants[101] = pow(constants[1], 2.0) - computed_constants[102] = pow(constants[1], 3.0) - computed_constants[103] = pow(constants[1], constants[2]) - computed_constants[104] = pow(leq_func(constants[1], constants[2]), geq_func(constants[6], constants[18])) - computed_constants[105] = pow(constants[1]+constants[2], geq_func(constants[6], constants[18])) - computed_constants[106] = pow(constants[1], geq_func(constants[2], constants[6])) - computed_constants[107] = pow(constants[1]-constants[2], geq_func(constants[6], constants[18])) - computed_constants[108] = pow(-constants[1], geq_func(constants[2], constants[6])) - computed_constants[109] = pow(constants[1]*constants[2], geq_func(constants[6], constants[18])) - computed_constants[110] = pow(constants[1]/constants[2], geq_func(constants[6], constants[18])) - computed_constants[111] = pow(leq_func(constants[1], constants[2]), constants[6]+constants[18]) - computed_constants[112] = pow(leq_func(constants[1], constants[2]), constants[6]) - computed_constants[113] = pow(leq_func(constants[1], constants[2]), constants[6]-constants[18]) - computed_constants[114] = pow(leq_func(constants[1], constants[2]), -constants[6]) - computed_constants[115] = pow(leq_func(constants[1], constants[2]), constants[6]*constants[18]) - computed_constants[116] = pow(leq_func(constants[1], constants[2]), constants[6]/constants[18]) - computed_constants[117] = pow(leq_func(constants[1], constants[2]), pow(constants[6], constants[18])) - computed_constants[118] = pow(leq_func(constants[1], constants[2]), pow(constants[6], 1.0/constants[18])) - computed_constants[119] = sqrt(constants[1]) - computed_constants[120] = sqrt(constants[1]) - computed_constants[121] = pow(constants[1], 1.0/3.0) - computed_constants[122] = pow(constants[1], 1.0/constants[2]) - computed_constants[123] = pow(lt_func(constants[1], constants[2]), 1.0/gt_func(constants[18], constants[6])) - computed_constants[124] = pow(constants[1]+constants[2], 1.0/gt_func(constants[18], constants[6])) - computed_constants[125] = pow(constants[1], 1.0/gt_func(constants[6], constants[2])) - computed_constants[126] = pow(constants[1]-constants[2], 1.0/gt_func(constants[18], constants[6])) - computed_constants[127] = pow(-constants[1], 1.0/gt_func(constants[6], constants[2])) - computed_constants[128] = pow(constants[1]*constants[2], 1.0/gt_func(constants[18], constants[6])) - computed_constants[129] = pow(constants[1]/constants[2], 1.0/gt_func(constants[18], constants[6])) - computed_constants[130] = pow(lt_func(constants[1], constants[2]), 1.0/(constants[6]+constants[18])) - computed_constants[131] = pow(lt_func(constants[1], constants[2]), 1.0/constants[6]) - computed_constants[132] = pow(lt_func(constants[1], constants[2]), 1.0/(constants[6]-constants[18])) - computed_constants[133] = pow(lt_func(constants[1], constants[2]), 1.0/-constants[6]) - computed_constants[134] = pow(lt_func(constants[1], constants[2]), 1.0/(constants[6]*constants[18])) - computed_constants[135] = pow(lt_func(constants[1], constants[2]), 1.0/(constants[6]/constants[18])) - computed_constants[136] = pow(lt_func(constants[1], constants[2]), 1.0/pow(constants[6], constants[18])) - computed_constants[137] = pow(lt_func(constants[1], constants[2]), 1.0/pow(constants[6], 1.0/constants[18])) - computed_constants[138] = fabs(constants[1]) - computed_constants[139] = exp(constants[1]) - computed_constants[140] = log(constants[1]) - computed_constants[141] = log10(constants[1]) - computed_constants[142] = log(constants[1])/log(2.0) - computed_constants[143] = log10(constants[1]) - computed_constants[144] = log(constants[1])/log(constants[2]) - computed_constants[145] = ceil(constants[1]) - computed_constants[146] = floor(constants[1]) - computed_constants[147] = min(constants[1], constants[2]) - computed_constants[148] = min(constants[1], min(constants[2], constants[6])) - computed_constants[149] = max(constants[1], constants[2]) - computed_constants[150] = max(constants[1], max(constants[2], constants[6])) - computed_constants[151] = fmod(constants[1], constants[2]) - computed_constants[152] = sin(constants[1]) - computed_constants[153] = cos(constants[1]) - computed_constants[154] = tan(constants[1]) - computed_constants[155] = sec(constants[1]) - computed_constants[156] = csc(constants[1]) - computed_constants[157] = cot(constants[1]) - computed_constants[158] = sinh(constants[1]) - computed_constants[159] = cosh(constants[1]) - computed_constants[160] = tanh(constants[1]) - computed_constants[161] = sech(constants[1]) - computed_constants[162] = csch(constants[1]) - computed_constants[163] = coth(constants[1]) - computed_constants[164] = asin(constants[1]) - computed_constants[165] = acos(constants[1]) - computed_constants[166] = atan(constants[1]) - computed_constants[167] = asec(constants[1]) - computed_constants[168] = acsc(constants[1]) - computed_constants[169] = acot(constants[1]) - computed_constants[170] = asinh(constants[1]) - computed_constants[171] = acosh(constants[1]) - computed_constants[172] = atanh(constants[1]/2.0) - computed_constants[173] = asech(constants[1]) - computed_constants[174] = acsch(constants[1]) - computed_constants[175] = acoth(2.0*constants[1]) - computed_constants[176] = constants[1] if gt_func(constants[1], constants[2]) else nan - computed_constants[177] = constants[1] if gt_func(constants[1], constants[2]) else constants[6] - computed_constants[178] = constants[1] if gt_func(constants[1], constants[2]) else constants[6] if gt_func(constants[6], constants[18]) else constants[179] if gt_func(constants[179], constants[180]) else nan - computed_constants[181] = constants[1] if gt_func(constants[1], constants[2]) else constants[6] if gt_func(constants[6], constants[18]) else constants[179] if gt_func(constants[179], constants[180]) else constants[182] - computed_constants[183] = 123.0+(constants[1] if gt_func(constants[1], constants[2]) else nan) - computed_constants[188] = constants[1] - computed_constants[195] = and_func(constants[1], constants[2])+(constants[2] if gt_func(constants[6], constants[18]) else nan)+constants[179]+and_func(constants[180], constants[182]) - computed_constants[196] = and_func(constants[1], constants[2])-((constants[2] if gt_func(constants[6], constants[18]) else nan)-(constants[179]-(constants[2] if gt_func(constants[6], constants[18]) else nan)))-and_func(constants[180], constants[182]) - computed_constants[197] = and_func(constants[1], constants[2])*(constants[2] if gt_func(constants[6], constants[18]) else nan)*constants[179]*(constants[2] if gt_func(constants[6], constants[18]) else nan)*and_func(constants[180], constants[182]) - computed_constants[198] = and_func(constants[1], constants[2])/((constants[2] if gt_func(constants[6], constants[18]) else nan)/(constants[179]/(constants[2] if gt_func(constants[6], constants[18]) else nan))) - computed_constants[199] = and_func(or_func(constants[1], constants[2]), and_func(xor_func(constants[1], constants[2]), and_func(constants[2] if gt_func(constants[6], constants[18]) else nan, and_func(and_func(and_func(constants[179], constants[2] if gt_func(constants[6], constants[18]) else nan), xor_func(constants[1], constants[2])), or_func(constants[1], constants[2]))))) - computed_constants[200] = or_func(and_func(constants[1], constants[2]), or_func(xor_func(constants[1], constants[2]), or_func(constants[2] if gt_func(constants[6], constants[18]) else nan, or_func(or_func(or_func(constants[179], constants[2] if gt_func(constants[6], constants[18]) else nan), xor_func(constants[1], constants[2])), and_func(constants[1], constants[2]))))) - computed_constants[201] = xor_func(and_func(constants[1], constants[2]), xor_func(or_func(constants[1], constants[2]), xor_func(constants[2] if gt_func(constants[6], constants[18]) else nan, xor_func(xor_func(xor_func(constants[179], constants[2] if gt_func(constants[6], constants[18]) else nan), or_func(constants[1], constants[2])), and_func(constants[1], constants[2]))))) - computed_constants[202] = pow(and_func(constants[1], constants[2]), pow(constants[2] if gt_func(constants[6], constants[18]) else nan, pow(pow(constants[179], constants[2] if gt_func(constants[6], constants[18]) else nan), and_func(constants[1], constants[2])))) - computed_constants[203] = pow(pow(pow(and_func(constants[1], constants[2]), 1.0/pow(constants[2] if gt_func(constants[6], constants[18]) else nan, 1.0/constants[179])), 1.0/(constants[2] if gt_func(constants[6], constants[18]) else nan)), 1.0/and_func(constants[1], constants[2])) - computed_constants[204] = -and_func(constants[1], constants[2])+-(constants[2] if gt_func(constants[6], constants[18]) else nan) + computed_constants[0] = eq_func(constants[0], constants[1]) + computed_constants[1] = constants[0]/eq_func(constants[1], constants[1]) + computed_constants[2] = neq_func(constants[0], constants[1]) + computed_constants[3] = constants[0]/neq_func(constants[1], constants[2]) + computed_constants[4] = lt_func(constants[0], constants[1]) + computed_constants[5] = constants[0]/lt_func(constants[1], constants[2]) + computed_constants[6] = leq_func(constants[0], constants[1]) + computed_constants[7] = constants[0]/leq_func(constants[1], constants[2]) + computed_constants[8] = gt_func(constants[0], constants[1]) + computed_constants[9] = constants[0]/gt_func(constants[1], constants[2]) + computed_constants[10] = geq_func(constants[0], constants[1]) + computed_constants[11] = constants[0]/geq_func(constants[1], constants[2]) + computed_constants[12] = and_func(constants[0], constants[1]) + computed_constants[13] = and_func(constants[0], and_func(constants[1], constants[2])) + computed_constants[14] = and_func(lt_func(constants[0], constants[1]), gt_func(constants[2], constants[3])) + computed_constants[15] = and_func(constants[0]+constants[1], gt_func(constants[2], constants[3])) + computed_constants[16] = and_func(constants[0], gt_func(constants[1], constants[2])) + computed_constants[17] = and_func(constants[0]-constants[1], gt_func(constants[2], constants[3])) + computed_constants[18] = and_func(-constants[0], gt_func(constants[1], constants[2])) + computed_constants[19] = and_func(pow(constants[0], constants[1]), gt_func(constants[2], constants[3])) + computed_constants[20] = and_func(pow(constants[0], 1.0/constants[1]), gt_func(constants[2], constants[3])) + computed_constants[21] = and_func(lt_func(constants[0], constants[1]), constants[2]+constants[3]) + computed_constants[22] = and_func(lt_func(constants[0], constants[1]), constants[2]) + computed_constants[23] = and_func(lt_func(constants[0], constants[1]), constants[2]-constants[3]) + computed_constants[24] = and_func(lt_func(constants[0], constants[1]), -constants[2]) + computed_constants[25] = and_func(lt_func(constants[0], constants[1]), pow(constants[2], constants[3])) + computed_constants[26] = and_func(lt_func(constants[0], constants[1]), pow(constants[2], 1.0/constants[3])) + computed_constants[27] = constants[0]/and_func(constants[1], constants[2]) + computed_constants[28] = or_func(constants[0], constants[1]) + computed_constants[29] = or_func(constants[0], or_func(constants[1], constants[2])) + computed_constants[30] = or_func(lt_func(constants[0], constants[1]), gt_func(constants[2], constants[3])) + computed_constants[31] = or_func(constants[0]+constants[1], gt_func(constants[2], constants[3])) + computed_constants[32] = or_func(constants[0], gt_func(constants[1], constants[2])) + computed_constants[33] = or_func(constants[0]-constants[1], gt_func(constants[2], constants[3])) + computed_constants[34] = or_func(-constants[0], gt_func(constants[1], constants[2])) + computed_constants[35] = or_func(pow(constants[0], constants[1]), gt_func(constants[2], constants[3])) + computed_constants[36] = or_func(pow(constants[0], 1.0/constants[1]), gt_func(constants[2], constants[3])) + computed_constants[37] = or_func(lt_func(constants[0], constants[1]), constants[2]+constants[3]) + computed_constants[38] = or_func(lt_func(constants[0], constants[1]), constants[2]) + computed_constants[39] = or_func(lt_func(constants[0], constants[1]), constants[2]-constants[3]) + computed_constants[40] = or_func(lt_func(constants[0], constants[1]), -constants[2]) + computed_constants[41] = or_func(lt_func(constants[0], constants[1]), pow(constants[2], constants[3])) + computed_constants[42] = or_func(lt_func(constants[0], constants[1]), pow(constants[2], 1.0/constants[3])) + computed_constants[43] = constants[0]/or_func(constants[1], constants[2]) + computed_constants[44] = xor_func(constants[0], constants[1]) + computed_constants[45] = xor_func(constants[0], xor_func(constants[1], constants[2])) + computed_constants[46] = xor_func(lt_func(constants[0], constants[1]), gt_func(constants[2], constants[3])) + computed_constants[47] = xor_func(constants[0]+constants[1], gt_func(constants[2], constants[3])) + computed_constants[48] = xor_func(constants[0], gt_func(constants[1], constants[2])) + computed_constants[49] = xor_func(constants[0]-constants[1], gt_func(constants[2], constants[3])) + computed_constants[50] = xor_func(-constants[0], gt_func(constants[1], constants[2])) + computed_constants[51] = xor_func(pow(constants[0], constants[1]), gt_func(constants[2], constants[3])) + computed_constants[52] = xor_func(pow(constants[0], 1.0/constants[1]), gt_func(constants[2], constants[3])) + computed_constants[53] = xor_func(lt_func(constants[0], constants[1]), constants[2]+constants[3]) + computed_constants[54] = xor_func(lt_func(constants[0], constants[1]), constants[2]) + computed_constants[55] = xor_func(lt_func(constants[0], constants[1]), constants[2]-constants[3]) + computed_constants[56] = xor_func(lt_func(constants[0], constants[1]), -constants[2]) + computed_constants[57] = xor_func(lt_func(constants[0], constants[1]), pow(constants[2], constants[3])) + computed_constants[58] = xor_func(lt_func(constants[0], constants[1]), pow(constants[2], 1.0/constants[3])) + computed_constants[59] = constants[0]/xor_func(constants[1], constants[2]) + computed_constants[60] = not_func(constants[0]) + computed_constants[61] = constants[0]+constants[1] + computed_constants[62] = constants[0]+constants[1]+constants[2] + computed_constants[63] = lt_func(constants[0], constants[1])+gt_func(constants[2], constants[3]) + computed_constants[64] = constants[0] + computed_constants[65] = constants[0]-constants[1] + computed_constants[66] = lt_func(constants[0], constants[1])-gt_func(constants[2], constants[3]) + computed_constants[67] = lt_func(constants[0], constants[1])-(constants[2]+constants[3]) + computed_constants[68] = lt_func(constants[0], constants[1])-constants[2] + computed_constants[69] = constants[0]-(-constants[1]) + computed_constants[70] = constants[0]-(-constants[1]*constants[2]) + computed_constants[71] = -constants[0] + computed_constants[72] = -lt_func(constants[0], constants[1]) + computed_constants[73] = constants[0]*constants[1] + computed_constants[74] = constants[0]*constants[1]*constants[2] + computed_constants[75] = lt_func(constants[0], constants[1])*gt_func(constants[2], constants[3]) + computed_constants[76] = (constants[0]+constants[1])*gt_func(constants[2], constants[3]) + computed_constants[77] = constants[0]*gt_func(constants[1], constants[2]) + computed_constants[78] = (constants[0]-constants[1])*gt_func(constants[2], constants[3]) + computed_constants[79] = -constants[0]*gt_func(constants[1], constants[2]) + computed_constants[80] = lt_func(constants[0], constants[1])*(constants[2]+constants[3]) + computed_constants[81] = lt_func(constants[0], constants[1])*constants[2] + computed_constants[82] = lt_func(constants[0], constants[1])*(constants[2]-constants[3]) + computed_constants[83] = lt_func(constants[0], constants[1])*-constants[2] + computed_constants[84] = constants[0]/constants[1] + computed_constants[85] = lt_func(constants[0], constants[1])/gt_func(constants[3], constants[2]) + computed_constants[86] = (constants[0]+constants[1])/gt_func(constants[3], constants[2]) + computed_constants[87] = constants[0]/gt_func(constants[2], constants[1]) + computed_constants[88] = (constants[0]-constants[1])/gt_func(constants[3], constants[2]) + computed_constants[89] = -constants[0]/gt_func(constants[2], constants[1]) + computed_constants[90] = lt_func(constants[0], constants[1])/(constants[2]+constants[3]) + computed_constants[91] = lt_func(constants[0], constants[1])/constants[2] + computed_constants[92] = lt_func(constants[0], constants[1])/(constants[2]-constants[3]) + computed_constants[93] = lt_func(constants[0], constants[1])/-constants[2] + computed_constants[94] = lt_func(constants[0], constants[1])/(constants[2]*constants[3]) + computed_constants[95] = lt_func(constants[0], constants[1])/(constants[2]/constants[3]) + computed_constants[96] = sqrt(constants[0]) + computed_constants[97] = pow(constants[0], 2.0) + computed_constants[98] = pow(constants[0], 3.0) + computed_constants[99] = pow(constants[0], constants[1]) + computed_constants[100] = pow(leq_func(constants[0], constants[1]), geq_func(constants[2], constants[3])) + computed_constants[101] = pow(constants[0]+constants[1], geq_func(constants[2], constants[3])) + computed_constants[102] = pow(constants[0], geq_func(constants[1], constants[2])) + computed_constants[103] = pow(constants[0]-constants[1], geq_func(constants[2], constants[3])) + computed_constants[104] = pow(-constants[0], geq_func(constants[1], constants[2])) + computed_constants[105] = pow(constants[0]*constants[1], geq_func(constants[2], constants[3])) + computed_constants[106] = pow(constants[0]/constants[1], geq_func(constants[2], constants[3])) + computed_constants[107] = pow(leq_func(constants[0], constants[1]), constants[2]+constants[3]) + computed_constants[108] = pow(leq_func(constants[0], constants[1]), constants[2]) + computed_constants[109] = pow(leq_func(constants[0], constants[1]), constants[2]-constants[3]) + computed_constants[110] = pow(leq_func(constants[0], constants[1]), -constants[2]) + computed_constants[111] = pow(leq_func(constants[0], constants[1]), constants[2]*constants[3]) + computed_constants[112] = pow(leq_func(constants[0], constants[1]), constants[2]/constants[3]) + computed_constants[113] = pow(leq_func(constants[0], constants[1]), pow(constants[2], constants[3])) + computed_constants[114] = pow(leq_func(constants[0], constants[1]), pow(constants[2], 1.0/constants[3])) + computed_constants[115] = sqrt(constants[0]) + computed_constants[116] = sqrt(constants[0]) + computed_constants[117] = pow(constants[0], 1.0/3.0) + computed_constants[118] = pow(constants[0], 1.0/constants[1]) + computed_constants[119] = pow(lt_func(constants[0], constants[1]), 1.0/gt_func(constants[3], constants[2])) + computed_constants[120] = pow(constants[0]+constants[1], 1.0/gt_func(constants[3], constants[2])) + computed_constants[121] = pow(constants[0], 1.0/gt_func(constants[2], constants[1])) + computed_constants[122] = pow(constants[0]-constants[1], 1.0/gt_func(constants[3], constants[2])) + computed_constants[123] = pow(-constants[0], 1.0/gt_func(constants[2], constants[1])) + computed_constants[124] = pow(constants[0]*constants[1], 1.0/gt_func(constants[3], constants[2])) + computed_constants[125] = pow(constants[0]/constants[1], 1.0/gt_func(constants[3], constants[2])) + computed_constants[126] = pow(lt_func(constants[0], constants[1]), 1.0/(constants[2]+constants[3])) + computed_constants[127] = pow(lt_func(constants[0], constants[1]), 1.0/constants[2]) + computed_constants[128] = pow(lt_func(constants[0], constants[1]), 1.0/(constants[2]-constants[3])) + computed_constants[129] = pow(lt_func(constants[0], constants[1]), 1.0/-constants[2]) + computed_constants[130] = pow(lt_func(constants[0], constants[1]), 1.0/(constants[2]*constants[3])) + computed_constants[131] = pow(lt_func(constants[0], constants[1]), 1.0/(constants[2]/constants[3])) + computed_constants[132] = pow(lt_func(constants[0], constants[1]), 1.0/pow(constants[2], constants[3])) + computed_constants[133] = pow(lt_func(constants[0], constants[1]), 1.0/pow(constants[2], 1.0/constants[3])) + computed_constants[134] = fabs(constants[0]) + computed_constants[135] = exp(constants[0]) + computed_constants[136] = log(constants[0]) + computed_constants[137] = log10(constants[0]) + computed_constants[138] = log(constants[0])/log(2.0) + computed_constants[139] = log10(constants[0]) + computed_constants[140] = log(constants[0])/log(constants[1]) + computed_constants[141] = ceil(constants[0]) + computed_constants[142] = floor(constants[0]) + computed_constants[143] = min(constants[0], constants[1]) + computed_constants[144] = min(constants[0], min(constants[1], constants[2])) + computed_constants[145] = max(constants[0], constants[1]) + computed_constants[146] = max(constants[0], max(constants[1], constants[2])) + computed_constants[147] = fmod(constants[0], constants[1]) + computed_constants[148] = sin(constants[0]) + computed_constants[149] = cos(constants[0]) + computed_constants[150] = tan(constants[0]) + computed_constants[151] = sec(constants[0]) + computed_constants[152] = csc(constants[0]) + computed_constants[153] = cot(constants[0]) + computed_constants[154] = sinh(constants[0]) + computed_constants[155] = cosh(constants[0]) + computed_constants[156] = tanh(constants[0]) + computed_constants[157] = sech(constants[0]) + computed_constants[158] = csch(constants[0]) + computed_constants[159] = coth(constants[0]) + computed_constants[160] = asin(constants[0]) + computed_constants[161] = acos(constants[0]) + computed_constants[162] = atan(constants[0]) + computed_constants[163] = asec(constants[0]) + computed_constants[164] = acsc(constants[0]) + computed_constants[165] = acot(constants[0]) + computed_constants[166] = asinh(constants[0]) + computed_constants[167] = acosh(constants[0]) + computed_constants[168] = atanh(constants[0]/2.0) + computed_constants[169] = asech(constants[0]) + computed_constants[170] = acsch(constants[0]) + computed_constants[171] = acoth(2.0*constants[0]) + computed_constants[172] = constants[0] if gt_func(constants[0], constants[1]) else nan + computed_constants[173] = constants[0] if gt_func(constants[0], constants[1]) else constants[2] + computed_constants[174] = constants[0] if gt_func(constants[0], constants[1]) else constants[2] if gt_func(constants[2], constants[3]) else constants[4] if gt_func(constants[4], constants[5]) else nan + computed_constants[175] = constants[0] if gt_func(constants[0], constants[1]) else constants[2] if gt_func(constants[2], constants[3]) else constants[4] if gt_func(constants[4], constants[5]) else constants[6] + computed_constants[176] = 123.0+(constants[0] if gt_func(constants[0], constants[1]) else nan) + computed_constants[181] = constants[0] + computed_constants[188] = and_func(constants[0], constants[1])+(constants[1] if gt_func(constants[2], constants[3]) else nan)+constants[4]+and_func(constants[5], constants[6]) + computed_constants[189] = and_func(constants[0], constants[1])-((constants[1] if gt_func(constants[2], constants[3]) else nan)-(constants[4]-(constants[1] if gt_func(constants[2], constants[3]) else nan)))-and_func(constants[5], constants[6]) + computed_constants[190] = and_func(constants[0], constants[1])*(constants[1] if gt_func(constants[2], constants[3]) else nan)*constants[4]*(constants[1] if gt_func(constants[2], constants[3]) else nan)*and_func(constants[5], constants[6]) + computed_constants[191] = and_func(constants[0], constants[1])/((constants[1] if gt_func(constants[2], constants[3]) else nan)/(constants[4]/(constants[1] if gt_func(constants[2], constants[3]) else nan))) + computed_constants[192] = and_func(or_func(constants[0], constants[1]), and_func(xor_func(constants[0], constants[1]), and_func(constants[1] if gt_func(constants[2], constants[3]) else nan, and_func(and_func(and_func(constants[4], constants[1] if gt_func(constants[2], constants[3]) else nan), xor_func(constants[0], constants[1])), or_func(constants[0], constants[1]))))) + computed_constants[193] = or_func(and_func(constants[0], constants[1]), or_func(xor_func(constants[0], constants[1]), or_func(constants[1] if gt_func(constants[2], constants[3]) else nan, or_func(or_func(or_func(constants[4], constants[1] if gt_func(constants[2], constants[3]) else nan), xor_func(constants[0], constants[1])), and_func(constants[0], constants[1]))))) + computed_constants[194] = xor_func(and_func(constants[0], constants[1]), xor_func(or_func(constants[0], constants[1]), xor_func(constants[1] if gt_func(constants[2], constants[3]) else nan, xor_func(xor_func(xor_func(constants[4], constants[1] if gt_func(constants[2], constants[3]) else nan), or_func(constants[0], constants[1])), and_func(constants[0], constants[1]))))) + computed_constants[195] = pow(and_func(constants[0], constants[1]), pow(constants[1] if gt_func(constants[2], constants[3]) else nan, pow(pow(constants[4], constants[1] if gt_func(constants[2], constants[3]) else nan), and_func(constants[0], constants[1])))) + computed_constants[196] = pow(pow(pow(and_func(constants[0], constants[1]), 1.0/pow(constants[1] if gt_func(constants[2], constants[3]) else nan, 1.0/constants[4])), 1.0/(constants[1] if gt_func(constants[2], constants[3]) else nan)), 1.0/and_func(constants[0], constants[1])) + computed_constants[197] = -and_func(constants[0], constants[1])+-(constants[1] if gt_func(constants[2], constants[3]) else nan) def compute_rates(voi, states, rates, constants, computed_constants, algebraic): diff --git a/tests/resources/coverage/generator/model.out b/tests/resources/coverage/generator/model.out index f35ae16224..97c8f00378 100644 --- a/tests/resources/coverage/generator/model.out +++ b/tests/resources/coverage/generator/model.out @@ -95,11 +95,11 @@ void objectiveFunction0(double *u, double *f, void *data) double *rates = ((RootFindingInfo *) data)->rates; double *variables = ((RootFindingInfo *) data)->variables; - algebraic[205] = u[0]; - algebraic[206] = u[1]; + algebraic[0] = u[0]; + algebraic[1] = u[1]; - f[0] = algebraic[205]+algebraic[206]+states[0]-0.0; - f[1] = algebraic[205]-algebraic[206]-(computedConstants[207]+computedConstants[208]); + f[0] = algebraic[0]+algebraic[1]+states[0]-0.0; + f[1] = algebraic[0]-algebraic[1]-(computedConstants[198]+computedConstants[199]); } void findRoot0(double voi, double *states, double *rates, double *variables) @@ -107,231 +107,231 @@ void findRoot0(double voi, double *states, double *rates, double *variables) RootFindingInfo rfi = { voi, states, rates, variables }; double u[2]; - u[0] = algebraic[205]; - u[1] = algebraic[206]; + u[0] = algebraic[0]; + u[1] = algebraic[1]; nlaSolve(objectiveFunction0, u, 2, &rfi); - algebraic[205] = u[0]; - algebraic[206] = u[1]; + algebraic[0] = u[0]; + algebraic[1] = u[1]; } void initialiseVariables(double *states, double *rates, double *constants) { - constants[1] = 1.0; - constants[2] = 2.0; - constants[6] = 3.0; - constants[18] = 4.0; - constants[179] = 5.0; - constants[180] = 6.0; - constants[182] = 7.0; - algebraic[205] = 1.0; - algebraic[206] = 2.0; - computedConstants[184] = 123.0; - computedConstants[185] = 123.456789; - computedConstants[186] = 123.0e99; - computedConstants[187] = 123.456789e99; - computedConstants[189] = 1.0; - computedConstants[190] = 0.0; - computedConstants[191] = 2.71828182845905; - computedConstants[192] = 3.14159265358979; - computedConstants[193] = INFINITY; - computedConstants[194] = NAN; - computedConstants[207] = 1.0; - computedConstants[208] = 3.0; + constants[0] = 1.0; + constants[1] = 2.0; + constants[2] = 3.0; + constants[3] = 4.0; + constants[4] = 5.0; + constants[5] = 6.0; + constants[6] = 7.0; + algebraic[0] = 1.0; + algebraic[1] = 2.0; + computedConstants[177] = 123.0; + computedConstants[178] = 123.456789; + computedConstants[179] = 123.0e99; + computedConstants[180] = 123.456789e99; + computedConstants[182] = 1.0; + computedConstants[183] = 0.0; + computedConstants[184] = 2.71828182845905; + computedConstants[185] = 3.14159265358979; + computedConstants[186] = INFINITY; + computedConstants[187] = NAN; + computedConstants[198] = 1.0; + computedConstants[199] = 3.0; states[0] = 0.0; } void computeComputedConstants(double *constants, double *computedConstants) { - computedConstants[0] = constants[1] == constants[2]; - computedConstants[3] = constants[1]/(constants[2] == constants[2]); - computedConstants[4] = constants[1] != constants[2]; - computedConstants[5] = constants[1]/(constants[2] != constants[6]); - computedConstants[7] = constants[1] < constants[2]; - computedConstants[8] = constants[1]/(constants[2] < constants[6]); - computedConstants[9] = constants[1] <= constants[2]; - computedConstants[10] = constants[1]/(constants[2] <= constants[6]); - computedConstants[11] = constants[1] > constants[2]; - computedConstants[12] = constants[1]/(constants[2] > constants[6]); - computedConstants[13] = constants[1] >= constants[2]; - computedConstants[14] = constants[1]/(constants[2] >= constants[6]); - computedConstants[15] = constants[1] && constants[2]; - computedConstants[16] = constants[1] && constants[2] && constants[6]; - computedConstants[17] = (constants[1] < constants[2]) && (constants[6] > constants[18]); - computedConstants[19] = (constants[1]+constants[2]) && (constants[6] > constants[18]); - computedConstants[20] = constants[1] && (constants[2] > constants[6]); - computedConstants[21] = (constants[1]-constants[2]) && (constants[6] > constants[18]); - computedConstants[22] = -constants[1] && (constants[2] > constants[6]); - computedConstants[23] = (constants[1]^^constants[2]) && (constants[6] > constants[18]); - computedConstants[24] = (constants[1]^^(1.0/constants[2])) && (constants[6] > constants[18]); - computedConstants[25] = (constants[1] < constants[2]) && (constants[6]+constants[18]); - computedConstants[26] = (constants[1] < constants[2]) && constants[6]; - computedConstants[27] = (constants[1] < constants[2]) && (constants[6]-constants[18]); - computedConstants[28] = (constants[1] < constants[2]) && -constants[6]; - computedConstants[29] = (constants[1] < constants[2]) && (constants[6]^^constants[18]); - computedConstants[30] = (constants[1] < constants[2]) && (constants[6]^^(1.0/constants[18])); - computedConstants[31] = constants[1]/(constants[2] && constants[6]); - computedConstants[32] = constants[1] || constants[2]; - computedConstants[33] = constants[1] || constants[2] || constants[6]; - computedConstants[34] = (constants[1] < constants[2]) || (constants[6] > constants[18]); - computedConstants[35] = (constants[1]+constants[2]) || (constants[6] > constants[18]); - computedConstants[36] = constants[1] || (constants[2] > constants[6]); - computedConstants[37] = (constants[1]-constants[2]) || (constants[6] > constants[18]); - computedConstants[38] = -constants[1] || (constants[2] > constants[6]); - computedConstants[39] = (constants[1]^^constants[2]) || (constants[6] > constants[18]); - computedConstants[40] = (constants[1]^^(1.0/constants[2])) || (constants[6] > constants[18]); - computedConstants[41] = (constants[1] < constants[2]) || (constants[6]+constants[18]); - computedConstants[42] = (constants[1] < constants[2]) || constants[6]; - computedConstants[43] = (constants[1] < constants[2]) || (constants[6]-constants[18]); - computedConstants[44] = (constants[1] < constants[2]) || -constants[6]; - computedConstants[45] = (constants[1] < constants[2]) || (constants[6]^^constants[18]); - computedConstants[46] = (constants[1] < constants[2]) || (constants[6]^^(1.0/constants[18])); - computedConstants[47] = constants[1]/(constants[2] || constants[6]); - computedConstants[48] = constants[1]^constants[2]; - computedConstants[49] = constants[1]^constants[2]^constants[6]; - computedConstants[50] = (constants[1] < constants[2])^(constants[6] > constants[18]); - computedConstants[51] = (constants[1]+constants[2])^(constants[6] > constants[18]); - computedConstants[52] = constants[1]^(constants[2] > constants[6]); - computedConstants[53] = (constants[1]-constants[2])^(constants[6] > constants[18]); - computedConstants[54] = -constants[1]^(constants[2] > constants[6]); - computedConstants[55] = (constants[1]^^constants[2])^(constants[6] > constants[18]); - computedConstants[56] = (constants[1]^^(1.0/constants[2]))^(constants[6] > constants[18]); - computedConstants[57] = (constants[1] < constants[2])^(constants[6]+constants[18]); - computedConstants[58] = (constants[1] < constants[2])^constants[6]; - computedConstants[59] = (constants[1] < constants[2])^(constants[6]-constants[18]); - computedConstants[60] = (constants[1] < constants[2])^-constants[6]; - computedConstants[61] = (constants[1] < constants[2])^(constants[6]^^constants[18]); - computedConstants[62] = (constants[1] < constants[2])^(constants[6]^^(1.0/constants[18])); - computedConstants[63] = constants[1]/(constants[2]^constants[6]); - computedConstants[64] = !constants[1]; - computedConstants[65] = constants[1]+constants[2]; - computedConstants[66] = constants[1]+constants[2]+constants[6]; - computedConstants[67] = (constants[1] < constants[2])+(constants[6] > constants[18]); - computedConstants[68] = constants[1]; - computedConstants[69] = constants[1]-constants[2]; - computedConstants[70] = (constants[1] < constants[2])-(constants[6] > constants[18]); - computedConstants[71] = (constants[1] < constants[2])-(constants[6]+constants[18]); - computedConstants[72] = (constants[1] < constants[2])-constants[6]; - computedConstants[73] = constants[1]-(-constants[2]); - computedConstants[74] = constants[1]-(-constants[2]*constants[6]); - computedConstants[75] = -constants[1]; - computedConstants[76] = -(constants[1] < constants[2]); - computedConstants[77] = constants[1]*constants[2]; - computedConstants[78] = constants[1]*constants[2]*constants[6]; - computedConstants[79] = (constants[1] < constants[2])*(constants[6] > constants[18]); - computedConstants[80] = (constants[1]+constants[2])*(constants[6] > constants[18]); - computedConstants[81] = constants[1]*(constants[2] > constants[6]); - computedConstants[82] = (constants[1]-constants[2])*(constants[6] > constants[18]); - computedConstants[83] = -constants[1]*(constants[2] > constants[6]); - computedConstants[84] = (constants[1] < constants[2])*(constants[6]+constants[18]); - computedConstants[85] = (constants[1] < constants[2])*constants[6]; - computedConstants[86] = (constants[1] < constants[2])*(constants[6]-constants[18]); - computedConstants[87] = (constants[1] < constants[2])*-constants[6]; - computedConstants[88] = constants[1]/constants[2]; - computedConstants[89] = (constants[1] < constants[2])/(constants[18] > constants[6]); - computedConstants[90] = (constants[1]+constants[2])/(constants[18] > constants[6]); - computedConstants[91] = constants[1]/(constants[6] > constants[2]); - computedConstants[92] = (constants[1]-constants[2])/(constants[18] > constants[6]); - computedConstants[93] = -constants[1]/(constants[6] > constants[2]); - computedConstants[94] = (constants[1] < constants[2])/(constants[6]+constants[18]); - computedConstants[95] = (constants[1] < constants[2])/constants[6]; - computedConstants[96] = (constants[1] < constants[2])/(constants[6]-constants[18]); - computedConstants[97] = (constants[1] < constants[2])/-constants[6]; - computedConstants[98] = (constants[1] < constants[2])/(constants[6]*constants[18]); - computedConstants[99] = (constants[1] < constants[2])/(constants[6]/constants[18]); - computedConstants[100] = sqrt(constants[1]); - computedConstants[101] = sqr(constants[1]); - computedConstants[102] = constants[1]^^3.0; - computedConstants[103] = constants[1]^^constants[2]; - computedConstants[104] = (constants[1] <= constants[2])^^(constants[6] >= constants[18]); - computedConstants[105] = (constants[1]+constants[2])^^(constants[6] >= constants[18]); - computedConstants[106] = constants[1]^^(constants[2] >= constants[6]); - computedConstants[107] = (constants[1]-constants[2])^^(constants[6] >= constants[18]); - computedConstants[108] = (-constants[1])^^(constants[2] >= constants[6]); - computedConstants[109] = (constants[1]*constants[2])^^(constants[6] >= constants[18]); - computedConstants[110] = (constants[1]/constants[2])^^(constants[6] >= constants[18]); - computedConstants[111] = (constants[1] <= constants[2])^^(constants[6]+constants[18]); - computedConstants[112] = (constants[1] <= constants[2])^^constants[6]; - computedConstants[113] = (constants[1] <= constants[2])^^constants[6]-constants[18]; - computedConstants[114] = (constants[1] <= constants[2])^^-constants[6]; - computedConstants[115] = (constants[1] <= constants[2])^^(constants[6]*constants[18]); - computedConstants[116] = (constants[1] <= constants[2])^^(constants[6]/constants[18]); - computedConstants[117] = (constants[1] <= constants[2])^^(constants[6]^^constants[18]); - computedConstants[118] = (constants[1] <= constants[2])^^(constants[6]^^(1.0/constants[18])); - computedConstants[119] = sqrt(constants[1]); - computedConstants[120] = sqrt(constants[1]); - computedConstants[121] = constants[1]^^(1.0/3.0); - computedConstants[122] = constants[1]^^(1.0/constants[2]); - computedConstants[123] = (constants[1] < constants[2])^^(1.0/(constants[18] > constants[6])); - computedConstants[124] = (constants[1]+constants[2])^^(1.0/(constants[18] > constants[6])); - computedConstants[125] = constants[1]^^(1.0/(constants[6] > constants[2])); - computedConstants[126] = (constants[1]-constants[2])^^(1.0/(constants[18] > constants[6])); - computedConstants[127] = (-constants[1])^^(1.0/(constants[6] > constants[2])); - computedConstants[128] = (constants[1]*constants[2])^^(1.0/(constants[18] > constants[6])); - computedConstants[129] = (constants[1]/constants[2])^^(1.0/(constants[18] > constants[6])); - computedConstants[130] = (constants[1] < constants[2])^^(1.0/(constants[6]+constants[18])); - computedConstants[131] = (constants[1] < constants[2])^^(1.0/constants[6]); - computedConstants[132] = (constants[1] < constants[2])^^(1.0/(constants[6]-constants[18])); - computedConstants[133] = (constants[1] < constants[2])^^(1.0/(-constants[6])); - computedConstants[134] = (constants[1] < constants[2])^^(1.0/(constants[6]*constants[18])); - computedConstants[135] = (constants[1] < constants[2])^^(1.0/(constants[6]/constants[18])); - computedConstants[136] = (constants[1] < constants[2])^^(1.0/(constants[6]^^constants[18])); - computedConstants[137] = (constants[1] < constants[2])^^(1.0/(constants[6]^^(1.0/constants[18]))); - computedConstants[138] = fabs(constants[1]); - computedConstants[139] = exp(constants[1]); - computedConstants[140] = log(constants[1]); - computedConstants[141] = log10(constants[1]); - computedConstants[142] = log(constants[1])/log(2.0); - computedConstants[143] = log10(constants[1]); - computedConstants[144] = log(constants[1])/log(constants[2]); - computedConstants[145] = ceil(constants[1]); - computedConstants[146] = floor(constants[1]); - computedConstants[147] = min(constants[1], constants[2]); - computedConstants[148] = min(constants[1], min(constants[2], constants[6])); - computedConstants[149] = max(constants[1], constants[2]); - computedConstants[150] = max(constants[1], max(constants[2], constants[6])); - computedConstants[151] = fmod(constants[1], constants[2]); - computedConstants[152] = sin(constants[1]); - computedConstants[153] = cos(constants[1]); - computedConstants[154] = tan(constants[1]); - computedConstants[155] = sec(constants[1]); - computedConstants[156] = csc(constants[1]); - computedConstants[157] = cot(constants[1]); - computedConstants[158] = sinh(constants[1]); - computedConstants[159] = cosh(constants[1]); - computedConstants[160] = tanh(constants[1]); - computedConstants[161] = sech(constants[1]); - computedConstants[162] = csch(constants[1]); - computedConstants[163] = coth(constants[1]); - computedConstants[164] = asin(constants[1]); - computedConstants[165] = acos(constants[1]); - computedConstants[166] = atan(constants[1]); - computedConstants[167] = asec(constants[1]); - computedConstants[168] = acsc(constants[1]); - computedConstants[169] = acot(constants[1]); - computedConstants[170] = asinh(constants[1]); - computedConstants[171] = acosh(constants[1]); - computedConstants[172] = atanh(constants[1]/2.0); - computedConstants[173] = asech(constants[1]); - computedConstants[174] = acsch(constants[1]); - computedConstants[175] = acoth(2.0*constants[1]); - computedConstants[176] = piecewise(constants[1] > constants[2], constants[1], NAN); - computedConstants[177] = piecewise(constants[1] > constants[2], constants[1], constants[6]); - computedConstants[178] = piecewise(constants[1] > constants[2], constants[1], piecewise(constants[6] > constants[18], constants[6], piecewise(constants[179] > constants[180], constants[179], NAN))); - computedConstants[181] = piecewise(constants[1] > constants[2], constants[1], piecewise(constants[6] > constants[18], constants[6], piecewise(constants[179] > constants[180], constants[179], constants[182]))); - computedConstants[183] = 123.0+piecewise(constants[1] > constants[2], constants[1], NAN); - computedConstants[188] = constants[1]; - computedConstants[195] = (constants[1] && constants[2])+piecewise(constants[6] > constants[18], constants[2], NAN)+constants[179]+(constants[180] && constants[182]); - computedConstants[196] = (constants[1] && constants[2])-(piecewise(constants[6] > constants[18], constants[2], NAN)-(constants[179]-piecewise(constants[6] > constants[18], constants[2], NAN)))-(constants[180] && constants[182]); - computedConstants[197] = (constants[1] && constants[2])*piecewise(constants[6] > constants[18], constants[2], NAN)*constants[179]*piecewise(constants[6] > constants[18], constants[2], NAN)*(constants[180] && constants[182]); - computedConstants[198] = (constants[1] && constants[2])/(piecewise(constants[6] > constants[18], constants[2], NAN)/(constants[179]/piecewise(constants[6] > constants[18], constants[2], NAN))); - computedConstants[199] = (constants[1] || constants[2]) && (constants[1]^constants[2]) && piecewise(constants[6] > constants[18], constants[2], NAN) && constants[179] && piecewise(constants[6] > constants[18], constants[2], NAN) && (constants[1]^constants[2]) && (constants[1] || constants[2]); - computedConstants[200] = (constants[1] && constants[2]) || (constants[1]^constants[2]) || piecewise(constants[6] > constants[18], constants[2], NAN) || constants[179] || piecewise(constants[6] > constants[18], constants[2], NAN) || (constants[1]^constants[2]) || (constants[1] && constants[2]); - computedConstants[201] = (constants[1] && constants[2])^(constants[1] || constants[2])^piecewise(constants[6] > constants[18], constants[2], NAN)^constants[179]^piecewise(constants[6] > constants[18], constants[2], NAN)^(constants[1] || constants[2])^(constants[1] && constants[2]); - computedConstants[202] = (constants[1] && constants[2])^^(piecewise(constants[6] > constants[18], constants[2], NAN)^^(constants[179]^^piecewise(constants[6] > constants[18], constants[2], NAN)^^(constants[1] && constants[2]))); - computedConstants[203] = (constants[1] && constants[2])^^(1.0/(piecewise(constants[6] > constants[18], constants[2], NAN)^^(1.0/constants[179])))^^(1.0/piecewise(constants[6] > constants[18], constants[2], NAN))^^(1.0/(constants[1] && constants[2])); - computedConstants[204] = -(constants[1] && constants[2])+-piecewise(constants[6] > constants[18], constants[2], NAN); + computedConstants[0] = constants[0] == constants[1]; + computedConstants[1] = constants[0]/(constants[1] == constants[1]); + computedConstants[2] = constants[0] != constants[1]; + computedConstants[3] = constants[0]/(constants[1] != constants[2]); + computedConstants[4] = constants[0] < constants[1]; + computedConstants[5] = constants[0]/(constants[1] < constants[2]); + computedConstants[6] = constants[0] <= constants[1]; + computedConstants[7] = constants[0]/(constants[1] <= constants[2]); + computedConstants[8] = constants[0] > constants[1]; + computedConstants[9] = constants[0]/(constants[1] > constants[2]); + computedConstants[10] = constants[0] >= constants[1]; + computedConstants[11] = constants[0]/(constants[1] >= constants[2]); + computedConstants[12] = constants[0] && constants[1]; + computedConstants[13] = constants[0] && constants[1] && constants[2]; + computedConstants[14] = (constants[0] < constants[1]) && (constants[2] > constants[3]); + computedConstants[15] = (constants[0]+constants[1]) && (constants[2] > constants[3]); + computedConstants[16] = constants[0] && (constants[1] > constants[2]); + computedConstants[17] = (constants[0]-constants[1]) && (constants[2] > constants[3]); + computedConstants[18] = -constants[0] && (constants[1] > constants[2]); + computedConstants[19] = (constants[0]^^constants[1]) && (constants[2] > constants[3]); + computedConstants[20] = (constants[0]^^(1.0/constants[1])) && (constants[2] > constants[3]); + computedConstants[21] = (constants[0] < constants[1]) && (constants[2]+constants[3]); + computedConstants[22] = (constants[0] < constants[1]) && constants[2]; + computedConstants[23] = (constants[0] < constants[1]) && (constants[2]-constants[3]); + computedConstants[24] = (constants[0] < constants[1]) && -constants[2]; + computedConstants[25] = (constants[0] < constants[1]) && (constants[2]^^constants[3]); + computedConstants[26] = (constants[0] < constants[1]) && (constants[2]^^(1.0/constants[3])); + computedConstants[27] = constants[0]/(constants[1] && constants[2]); + computedConstants[28] = constants[0] || constants[1]; + computedConstants[29] = constants[0] || constants[1] || constants[2]; + computedConstants[30] = (constants[0] < constants[1]) || (constants[2] > constants[3]); + computedConstants[31] = (constants[0]+constants[1]) || (constants[2] > constants[3]); + computedConstants[32] = constants[0] || (constants[1] > constants[2]); + computedConstants[33] = (constants[0]-constants[1]) || (constants[2] > constants[3]); + computedConstants[34] = -constants[0] || (constants[1] > constants[2]); + computedConstants[35] = (constants[0]^^constants[1]) || (constants[2] > constants[3]); + computedConstants[36] = (constants[0]^^(1.0/constants[1])) || (constants[2] > constants[3]); + computedConstants[37] = (constants[0] < constants[1]) || (constants[2]+constants[3]); + computedConstants[38] = (constants[0] < constants[1]) || constants[2]; + computedConstants[39] = (constants[0] < constants[1]) || (constants[2]-constants[3]); + computedConstants[40] = (constants[0] < constants[1]) || -constants[2]; + computedConstants[41] = (constants[0] < constants[1]) || (constants[2]^^constants[3]); + computedConstants[42] = (constants[0] < constants[1]) || (constants[2]^^(1.0/constants[3])); + computedConstants[43] = constants[0]/(constants[1] || constants[2]); + computedConstants[44] = constants[0]^constants[1]; + computedConstants[45] = constants[0]^constants[1]^constants[2]; + computedConstants[46] = (constants[0] < constants[1])^(constants[2] > constants[3]); + computedConstants[47] = (constants[0]+constants[1])^(constants[2] > constants[3]); + computedConstants[48] = constants[0]^(constants[1] > constants[2]); + computedConstants[49] = (constants[0]-constants[1])^(constants[2] > constants[3]); + computedConstants[50] = -constants[0]^(constants[1] > constants[2]); + computedConstants[51] = (constants[0]^^constants[1])^(constants[2] > constants[3]); + computedConstants[52] = (constants[0]^^(1.0/constants[1]))^(constants[2] > constants[3]); + computedConstants[53] = (constants[0] < constants[1])^(constants[2]+constants[3]); + computedConstants[54] = (constants[0] < constants[1])^constants[2]; + computedConstants[55] = (constants[0] < constants[1])^(constants[2]-constants[3]); + computedConstants[56] = (constants[0] < constants[1])^-constants[2]; + computedConstants[57] = (constants[0] < constants[1])^(constants[2]^^constants[3]); + computedConstants[58] = (constants[0] < constants[1])^(constants[2]^^(1.0/constants[3])); + computedConstants[59] = constants[0]/(constants[1]^constants[2]); + computedConstants[60] = !constants[0]; + computedConstants[61] = constants[0]+constants[1]; + computedConstants[62] = constants[0]+constants[1]+constants[2]; + computedConstants[63] = (constants[0] < constants[1])+(constants[2] > constants[3]); + computedConstants[64] = constants[0]; + computedConstants[65] = constants[0]-constants[1]; + computedConstants[66] = (constants[0] < constants[1])-(constants[2] > constants[3]); + computedConstants[67] = (constants[0] < constants[1])-(constants[2]+constants[3]); + computedConstants[68] = (constants[0] < constants[1])-constants[2]; + computedConstants[69] = constants[0]-(-constants[1]); + computedConstants[70] = constants[0]-(-constants[1]*constants[2]); + computedConstants[71] = -constants[0]; + computedConstants[72] = -(constants[0] < constants[1]); + computedConstants[73] = constants[0]*constants[1]; + computedConstants[74] = constants[0]*constants[1]*constants[2]; + computedConstants[75] = (constants[0] < constants[1])*(constants[2] > constants[3]); + computedConstants[76] = (constants[0]+constants[1])*(constants[2] > constants[3]); + computedConstants[77] = constants[0]*(constants[1] > constants[2]); + computedConstants[78] = (constants[0]-constants[1])*(constants[2] > constants[3]); + computedConstants[79] = -constants[0]*(constants[1] > constants[2]); + computedConstants[80] = (constants[0] < constants[1])*(constants[2]+constants[3]); + computedConstants[81] = (constants[0] < constants[1])*constants[2]; + computedConstants[82] = (constants[0] < constants[1])*(constants[2]-constants[3]); + computedConstants[83] = (constants[0] < constants[1])*-constants[2]; + computedConstants[84] = constants[0]/constants[1]; + computedConstants[85] = (constants[0] < constants[1])/(constants[3] > constants[2]); + computedConstants[86] = (constants[0]+constants[1])/(constants[3] > constants[2]); + computedConstants[87] = constants[0]/(constants[2] > constants[1]); + computedConstants[88] = (constants[0]-constants[1])/(constants[3] > constants[2]); + computedConstants[89] = -constants[0]/(constants[2] > constants[1]); + computedConstants[90] = (constants[0] < constants[1])/(constants[2]+constants[3]); + computedConstants[91] = (constants[0] < constants[1])/constants[2]; + computedConstants[92] = (constants[0] < constants[1])/(constants[2]-constants[3]); + computedConstants[93] = (constants[0] < constants[1])/-constants[2]; + computedConstants[94] = (constants[0] < constants[1])/(constants[2]*constants[3]); + computedConstants[95] = (constants[0] < constants[1])/(constants[2]/constants[3]); + computedConstants[96] = sqrt(constants[0]); + computedConstants[97] = sqr(constants[0]); + computedConstants[98] = constants[0]^^3.0; + computedConstants[99] = constants[0]^^constants[1]; + computedConstants[100] = (constants[0] <= constants[1])^^(constants[2] >= constants[3]); + computedConstants[101] = (constants[0]+constants[1])^^(constants[2] >= constants[3]); + computedConstants[102] = constants[0]^^(constants[1] >= constants[2]); + computedConstants[103] = (constants[0]-constants[1])^^(constants[2] >= constants[3]); + computedConstants[104] = (-constants[0])^^(constants[1] >= constants[2]); + computedConstants[105] = (constants[0]*constants[1])^^(constants[2] >= constants[3]); + computedConstants[106] = (constants[0]/constants[1])^^(constants[2] >= constants[3]); + computedConstants[107] = (constants[0] <= constants[1])^^(constants[2]+constants[3]); + computedConstants[108] = (constants[0] <= constants[1])^^constants[2]; + computedConstants[109] = (constants[0] <= constants[1])^^constants[2]-constants[3]; + computedConstants[110] = (constants[0] <= constants[1])^^-constants[2]; + computedConstants[111] = (constants[0] <= constants[1])^^(constants[2]*constants[3]); + computedConstants[112] = (constants[0] <= constants[1])^^(constants[2]/constants[3]); + computedConstants[113] = (constants[0] <= constants[1])^^(constants[2]^^constants[3]); + computedConstants[114] = (constants[0] <= constants[1])^^(constants[2]^^(1.0/constants[3])); + computedConstants[115] = sqrt(constants[0]); + computedConstants[116] = sqrt(constants[0]); + computedConstants[117] = constants[0]^^(1.0/3.0); + computedConstants[118] = constants[0]^^(1.0/constants[1]); + computedConstants[119] = (constants[0] < constants[1])^^(1.0/(constants[3] > constants[2])); + computedConstants[120] = (constants[0]+constants[1])^^(1.0/(constants[3] > constants[2])); + computedConstants[121] = constants[0]^^(1.0/(constants[2] > constants[1])); + computedConstants[122] = (constants[0]-constants[1])^^(1.0/(constants[3] > constants[2])); + computedConstants[123] = (-constants[0])^^(1.0/(constants[2] > constants[1])); + computedConstants[124] = (constants[0]*constants[1])^^(1.0/(constants[3] > constants[2])); + computedConstants[125] = (constants[0]/constants[1])^^(1.0/(constants[3] > constants[2])); + computedConstants[126] = (constants[0] < constants[1])^^(1.0/(constants[2]+constants[3])); + computedConstants[127] = (constants[0] < constants[1])^^(1.0/constants[2]); + computedConstants[128] = (constants[0] < constants[1])^^(1.0/(constants[2]-constants[3])); + computedConstants[129] = (constants[0] < constants[1])^^(1.0/(-constants[2])); + computedConstants[130] = (constants[0] < constants[1])^^(1.0/(constants[2]*constants[3])); + computedConstants[131] = (constants[0] < constants[1])^^(1.0/(constants[2]/constants[3])); + computedConstants[132] = (constants[0] < constants[1])^^(1.0/(constants[2]^^constants[3])); + computedConstants[133] = (constants[0] < constants[1])^^(1.0/(constants[2]^^(1.0/constants[3]))); + computedConstants[134] = fabs(constants[0]); + computedConstants[135] = exp(constants[0]); + computedConstants[136] = log(constants[0]); + computedConstants[137] = log10(constants[0]); + computedConstants[138] = log(constants[0])/log(2.0); + computedConstants[139] = log10(constants[0]); + computedConstants[140] = log(constants[0])/log(constants[1]); + computedConstants[141] = ceil(constants[0]); + computedConstants[142] = floor(constants[0]); + computedConstants[143] = min(constants[0], constants[1]); + computedConstants[144] = min(constants[0], min(constants[1], constants[2])); + computedConstants[145] = max(constants[0], constants[1]); + computedConstants[146] = max(constants[0], max(constants[1], constants[2])); + computedConstants[147] = fmod(constants[0], constants[1]); + computedConstants[148] = sin(constants[0]); + computedConstants[149] = cos(constants[0]); + computedConstants[150] = tan(constants[0]); + computedConstants[151] = sec(constants[0]); + computedConstants[152] = csc(constants[0]); + computedConstants[153] = cot(constants[0]); + computedConstants[154] = sinh(constants[0]); + computedConstants[155] = cosh(constants[0]); + computedConstants[156] = tanh(constants[0]); + computedConstants[157] = sech(constants[0]); + computedConstants[158] = csch(constants[0]); + computedConstants[159] = coth(constants[0]); + computedConstants[160] = asin(constants[0]); + computedConstants[161] = acos(constants[0]); + computedConstants[162] = atan(constants[0]); + computedConstants[163] = asec(constants[0]); + computedConstants[164] = acsc(constants[0]); + computedConstants[165] = acot(constants[0]); + computedConstants[166] = asinh(constants[0]); + computedConstants[167] = acosh(constants[0]); + computedConstants[168] = atanh(constants[0]/2.0); + computedConstants[169] = asech(constants[0]); + computedConstants[170] = acsch(constants[0]); + computedConstants[171] = acoth(2.0*constants[0]); + computedConstants[172] = piecewise(constants[0] > constants[1], constants[0], NAN); + computedConstants[173] = piecewise(constants[0] > constants[1], constants[0], constants[2]); + computedConstants[174] = piecewise(constants[0] > constants[1], constants[0], piecewise(constants[2] > constants[3], constants[2], piecewise(constants[4] > constants[5], constants[4], NAN))); + computedConstants[175] = piecewise(constants[0] > constants[1], constants[0], piecewise(constants[2] > constants[3], constants[2], piecewise(constants[4] > constants[5], constants[4], constants[6]))); + computedConstants[176] = 123.0+piecewise(constants[0] > constants[1], constants[0], NAN); + computedConstants[181] = constants[0]; + computedConstants[188] = (constants[0] && constants[1])+piecewise(constants[2] > constants[3], constants[1], NAN)+constants[4]+(constants[5] && constants[6]); + computedConstants[189] = (constants[0] && constants[1])-(piecewise(constants[2] > constants[3], constants[1], NAN)-(constants[4]-piecewise(constants[2] > constants[3], constants[1], NAN)))-(constants[5] && constants[6]); + computedConstants[190] = (constants[0] && constants[1])*piecewise(constants[2] > constants[3], constants[1], NAN)*constants[4]*piecewise(constants[2] > constants[3], constants[1], NAN)*(constants[5] && constants[6]); + computedConstants[191] = (constants[0] && constants[1])/(piecewise(constants[2] > constants[3], constants[1], NAN)/(constants[4]/piecewise(constants[2] > constants[3], constants[1], NAN))); + computedConstants[192] = (constants[0] || constants[1]) && (constants[0]^constants[1]) && piecewise(constants[2] > constants[3], constants[1], NAN) && constants[4] && piecewise(constants[2] > constants[3], constants[1], NAN) && (constants[0]^constants[1]) && (constants[0] || constants[1]); + computedConstants[193] = (constants[0] && constants[1]) || (constants[0]^constants[1]) || piecewise(constants[2] > constants[3], constants[1], NAN) || constants[4] || piecewise(constants[2] > constants[3], constants[1], NAN) || (constants[0]^constants[1]) || (constants[0] && constants[1]); + computedConstants[194] = (constants[0] && constants[1])^(constants[0] || constants[1])^piecewise(constants[2] > constants[3], constants[1], NAN)^constants[4]^piecewise(constants[2] > constants[3], constants[1], NAN)^(constants[0] || constants[1])^(constants[0] && constants[1]); + computedConstants[195] = (constants[0] && constants[1])^^(piecewise(constants[2] > constants[3], constants[1], NAN)^^(constants[4]^^piecewise(constants[2] > constants[3], constants[1], NAN)^^(constants[0] && constants[1]))); + computedConstants[196] = (constants[0] && constants[1])^^(1.0/(piecewise(constants[2] > constants[3], constants[1], NAN)^^(1.0/constants[4])))^^(1.0/piecewise(constants[2] > constants[3], constants[1], NAN))^^(1.0/(constants[0] && constants[1])); + computedConstants[197] = -(constants[0] && constants[1])+-piecewise(constants[2] > constants[3], constants[1], NAN); } void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) diff --git a/tests/resources/coverage/generator/model.py b/tests/resources/coverage/generator/model.py index acbe541a58..b945c4eb06 100644 --- a/tests/resources/coverage/generator/model.py +++ b/tests/resources/coverage/generator/model.py @@ -359,239 +359,239 @@ def objective_function_0(u, f, data): rates = data[2] variables = data[3] - algebraic[205] = u[0] - algebraic[206] = u[1] + algebraic[0] = u[0] + algebraic[1] = u[1] - f[0] = algebraic[205]+algebraic[206]+states[0]-0.0 - f[1] = algebraic[205]-algebraic[206]-(computed_constants[207]+computed_constants[208]) + f[0] = algebraic[0]+algebraic[1]+states[0]-0.0 + f[1] = algebraic[0]-algebraic[1]-(computed_constants[198]+computed_constants[199]) def find_root_0(voi, states, rates, variables): u = [nan]*2 - u[0] = algebraic[205] - u[1] = algebraic[206] + u[0] = algebraic[0] + u[1] = algebraic[1] u = nla_solve(objective_function_0, u, 2, [voi, states, rates, variables]) - algebraic[205] = u[0] - algebraic[206] = u[1] + algebraic[0] = u[0] + algebraic[1] = u[1] def initialise_variables(states, rates, constants): - constants[1] = 1.0 - constants[2] = 2.0 - constants[6] = 3.0 - constants[18] = 4.0 - constants[179] = 5.0 - constants[180] = 6.0 - constants[182] = 7.0 - algebraic[205] = 1.0 - algebraic[206] = 2.0 - computed_constants[184] = 123.0 - computed_constants[185] = 123.456789 - computed_constants[186] = 123.0e99 - computed_constants[187] = 123.456789e99 - computed_constants[189] = 1.0 - computed_constants[190] = 0.0 - computed_constants[191] = 2.71828182845905 - computed_constants[192] = 3.14159265358979 - computed_constants[193] = inf - computed_constants[194] = nan - computed_constants[207] = 1.0 - computed_constants[208] = 3.0 + constants[0] = 1.0 + constants[1] = 2.0 + constants[2] = 3.0 + constants[3] = 4.0 + constants[4] = 5.0 + constants[5] = 6.0 + constants[6] = 7.0 + algebraic[0] = 1.0 + algebraic[1] = 2.0 + computed_constants[177] = 123.0 + computed_constants[178] = 123.456789 + computed_constants[179] = 123.0e99 + computed_constants[180] = 123.456789e99 + computed_constants[182] = 1.0 + computed_constants[183] = 0.0 + computed_constants[184] = 2.71828182845905 + computed_constants[185] = 3.14159265358979 + computed_constants[186] = inf + computed_constants[187] = nan + computed_constants[198] = 1.0 + computed_constants[199] = 3.0 states[0] = 0.0 def compute_computed_constants(constants, computed_constants): - computed_constants[0] = eq_func(constants[1], constants[2]) - computed_constants[3] = constants[1]/eq_func(constants[2], constants[2]) - computed_constants[4] = neq_func(constants[1], constants[2]) - computed_constants[5] = constants[1]/neq_func(constants[2], constants[6]) - computed_constants[7] = lt_func(constants[1], constants[2]) - computed_constants[8] = constants[1]/lt_func(constants[2], constants[6]) - computed_constants[9] = leq_func(constants[1], constants[2]) - computed_constants[10] = constants[1]/leq_func(constants[2], constants[6]) - computed_constants[11] = gt_func(constants[1], constants[2]) - computed_constants[12] = constants[1]/gt_func(constants[2], constants[6]) - computed_constants[13] = geq_func(constants[1], constants[2]) - computed_constants[14] = constants[1]/geq_func(constants[2], constants[6]) - computed_constants[15] = and_func(constants[1], constants[2]) - computed_constants[16] = and_func(constants[1], and_func(constants[2], constants[6])) - computed_constants[17] = and_func(lt_func(constants[1], constants[2]), gt_func(constants[6], constants[18])) - computed_constants[19] = and_func(constants[1]+constants[2], gt_func(constants[6], constants[18])) - computed_constants[20] = and_func(constants[1], gt_func(constants[2], constants[6])) - computed_constants[21] = and_func(constants[1]-constants[2], gt_func(constants[6], constants[18])) - computed_constants[22] = and_func(-constants[1], gt_func(constants[2], constants[6])) - computed_constants[23] = and_func(pow(constants[1], constants[2]), gt_func(constants[6], constants[18])) - computed_constants[24] = and_func(pow(constants[1], 1.0/constants[2]), gt_func(constants[6], constants[18])) - computed_constants[25] = and_func(lt_func(constants[1], constants[2]), constants[6]+constants[18]) - computed_constants[26] = and_func(lt_func(constants[1], constants[2]), constants[6]) - computed_constants[27] = and_func(lt_func(constants[1], constants[2]), constants[6]-constants[18]) - computed_constants[28] = and_func(lt_func(constants[1], constants[2]), -constants[6]) - computed_constants[29] = and_func(lt_func(constants[1], constants[2]), pow(constants[6], constants[18])) - computed_constants[30] = and_func(lt_func(constants[1], constants[2]), pow(constants[6], 1.0/constants[18])) - computed_constants[31] = constants[1]/and_func(constants[2], constants[6]) - computed_constants[32] = or_func(constants[1], constants[2]) - computed_constants[33] = or_func(constants[1], or_func(constants[2], constants[6])) - computed_constants[34] = or_func(lt_func(constants[1], constants[2]), gt_func(constants[6], constants[18])) - computed_constants[35] = or_func(constants[1]+constants[2], gt_func(constants[6], constants[18])) - computed_constants[36] = or_func(constants[1], gt_func(constants[2], constants[6])) - computed_constants[37] = or_func(constants[1]-constants[2], gt_func(constants[6], constants[18])) - computed_constants[38] = or_func(-constants[1], gt_func(constants[2], constants[6])) - computed_constants[39] = or_func(pow(constants[1], constants[2]), gt_func(constants[6], constants[18])) - computed_constants[40] = or_func(pow(constants[1], 1.0/constants[2]), gt_func(constants[6], constants[18])) - computed_constants[41] = or_func(lt_func(constants[1], constants[2]), constants[6]+constants[18]) - computed_constants[42] = or_func(lt_func(constants[1], constants[2]), constants[6]) - computed_constants[43] = or_func(lt_func(constants[1], constants[2]), constants[6]-constants[18]) - computed_constants[44] = or_func(lt_func(constants[1], constants[2]), -constants[6]) - computed_constants[45] = or_func(lt_func(constants[1], constants[2]), pow(constants[6], constants[18])) - computed_constants[46] = or_func(lt_func(constants[1], constants[2]), pow(constants[6], 1.0/constants[18])) - computed_constants[47] = constants[1]/or_func(constants[2], constants[6]) - computed_constants[48] = xor_func(constants[1], constants[2]) - computed_constants[49] = xor_func(constants[1], xor_func(constants[2], constants[6])) - computed_constants[50] = xor_func(lt_func(constants[1], constants[2]), gt_func(constants[6], constants[18])) - computed_constants[51] = xor_func(constants[1]+constants[2], gt_func(constants[6], constants[18])) - computed_constants[52] = xor_func(constants[1], gt_func(constants[2], constants[6])) - computed_constants[53] = xor_func(constants[1]-constants[2], gt_func(constants[6], constants[18])) - computed_constants[54] = xor_func(-constants[1], gt_func(constants[2], constants[6])) - computed_constants[55] = xor_func(pow(constants[1], constants[2]), gt_func(constants[6], constants[18])) - computed_constants[56] = xor_func(pow(constants[1], 1.0/constants[2]), gt_func(constants[6], constants[18])) - computed_constants[57] = xor_func(lt_func(constants[1], constants[2]), constants[6]+constants[18]) - computed_constants[58] = xor_func(lt_func(constants[1], constants[2]), constants[6]) - computed_constants[59] = xor_func(lt_func(constants[1], constants[2]), constants[6]-constants[18]) - computed_constants[60] = xor_func(lt_func(constants[1], constants[2]), -constants[6]) - computed_constants[61] = xor_func(lt_func(constants[1], constants[2]), pow(constants[6], constants[18])) - computed_constants[62] = xor_func(lt_func(constants[1], constants[2]), pow(constants[6], 1.0/constants[18])) - computed_constants[63] = constants[1]/xor_func(constants[2], constants[6]) - computed_constants[64] = not_func(constants[1]) - computed_constants[65] = constants[1]+constants[2] - computed_constants[66] = constants[1]+constants[2]+constants[6] - computed_constants[67] = lt_func(constants[1], constants[2])+gt_func(constants[6], constants[18]) - computed_constants[68] = constants[1] - computed_constants[69] = constants[1]-constants[2] - computed_constants[70] = lt_func(constants[1], constants[2])-gt_func(constants[6], constants[18]) - computed_constants[71] = lt_func(constants[1], constants[2])-(constants[6]+constants[18]) - computed_constants[72] = lt_func(constants[1], constants[2])-constants[6] - computed_constants[73] = constants[1]-(-constants[2]) - computed_constants[74] = constants[1]-(-constants[2]*constants[6]) - computed_constants[75] = -constants[1] - computed_constants[76] = -lt_func(constants[1], constants[2]) - computed_constants[77] = constants[1]*constants[2] - computed_constants[78] = constants[1]*constants[2]*constants[6] - computed_constants[79] = lt_func(constants[1], constants[2])*gt_func(constants[6], constants[18]) - computed_constants[80] = (constants[1]+constants[2])*gt_func(constants[6], constants[18]) - computed_constants[81] = constants[1]*gt_func(constants[2], constants[6]) - computed_constants[82] = (constants[1]-constants[2])*gt_func(constants[6], constants[18]) - computed_constants[83] = -constants[1]*gt_func(constants[2], constants[6]) - computed_constants[84] = lt_func(constants[1], constants[2])*(constants[6]+constants[18]) - computed_constants[85] = lt_func(constants[1], constants[2])*constants[6] - computed_constants[86] = lt_func(constants[1], constants[2])*(constants[6]-constants[18]) - computed_constants[87] = lt_func(constants[1], constants[2])*-constants[6] - computed_constants[88] = constants[1]/constants[2] - computed_constants[89] = lt_func(constants[1], constants[2])/gt_func(constants[18], constants[6]) - computed_constants[90] = (constants[1]+constants[2])/gt_func(constants[18], constants[6]) - computed_constants[91] = constants[1]/gt_func(constants[6], constants[2]) - computed_constants[92] = (constants[1]-constants[2])/gt_func(constants[18], constants[6]) - computed_constants[93] = -constants[1]/gt_func(constants[6], constants[2]) - computed_constants[94] = lt_func(constants[1], constants[2])/(constants[6]+constants[18]) - computed_constants[95] = lt_func(constants[1], constants[2])/constants[6] - computed_constants[96] = lt_func(constants[1], constants[2])/(constants[6]-constants[18]) - computed_constants[97] = lt_func(constants[1], constants[2])/-constants[6] - computed_constants[98] = lt_func(constants[1], constants[2])/(constants[6]*constants[18]) - computed_constants[99] = lt_func(constants[1], constants[2])/(constants[6]/constants[18]) - computed_constants[100] = sqrt(constants[1]) - computed_constants[101] = pow(constants[1], 2.0) - computed_constants[102] = pow(constants[1], 3.0) - computed_constants[103] = pow(constants[1], constants[2]) - computed_constants[104] = pow(leq_func(constants[1], constants[2]), geq_func(constants[6], constants[18])) - computed_constants[105] = pow(constants[1]+constants[2], geq_func(constants[6], constants[18])) - computed_constants[106] = pow(constants[1], geq_func(constants[2], constants[6])) - computed_constants[107] = pow(constants[1]-constants[2], geq_func(constants[6], constants[18])) - computed_constants[108] = pow(-constants[1], geq_func(constants[2], constants[6])) - computed_constants[109] = pow(constants[1]*constants[2], geq_func(constants[6], constants[18])) - computed_constants[110] = pow(constants[1]/constants[2], geq_func(constants[6], constants[18])) - computed_constants[111] = pow(leq_func(constants[1], constants[2]), constants[6]+constants[18]) - computed_constants[112] = pow(leq_func(constants[1], constants[2]), constants[6]) - computed_constants[113] = pow(leq_func(constants[1], constants[2]), constants[6]-constants[18]) - computed_constants[114] = pow(leq_func(constants[1], constants[2]), -constants[6]) - computed_constants[115] = pow(leq_func(constants[1], constants[2]), constants[6]*constants[18]) - computed_constants[116] = pow(leq_func(constants[1], constants[2]), constants[6]/constants[18]) - computed_constants[117] = pow(leq_func(constants[1], constants[2]), pow(constants[6], constants[18])) - computed_constants[118] = pow(leq_func(constants[1], constants[2]), pow(constants[6], 1.0/constants[18])) - computed_constants[119] = sqrt(constants[1]) - computed_constants[120] = sqrt(constants[1]) - computed_constants[121] = pow(constants[1], 1.0/3.0) - computed_constants[122] = pow(constants[1], 1.0/constants[2]) - computed_constants[123] = pow(lt_func(constants[1], constants[2]), 1.0/gt_func(constants[18], constants[6])) - computed_constants[124] = pow(constants[1]+constants[2], 1.0/gt_func(constants[18], constants[6])) - computed_constants[125] = pow(constants[1], 1.0/gt_func(constants[6], constants[2])) - computed_constants[126] = pow(constants[1]-constants[2], 1.0/gt_func(constants[18], constants[6])) - computed_constants[127] = pow(-constants[1], 1.0/gt_func(constants[6], constants[2])) - computed_constants[128] = pow(constants[1]*constants[2], 1.0/gt_func(constants[18], constants[6])) - computed_constants[129] = pow(constants[1]/constants[2], 1.0/gt_func(constants[18], constants[6])) - computed_constants[130] = pow(lt_func(constants[1], constants[2]), 1.0/(constants[6]+constants[18])) - computed_constants[131] = pow(lt_func(constants[1], constants[2]), 1.0/constants[6]) - computed_constants[132] = pow(lt_func(constants[1], constants[2]), 1.0/(constants[6]-constants[18])) - computed_constants[133] = pow(lt_func(constants[1], constants[2]), 1.0/-constants[6]) - computed_constants[134] = pow(lt_func(constants[1], constants[2]), 1.0/(constants[6]*constants[18])) - computed_constants[135] = pow(lt_func(constants[1], constants[2]), 1.0/(constants[6]/constants[18])) - computed_constants[136] = pow(lt_func(constants[1], constants[2]), 1.0/pow(constants[6], constants[18])) - computed_constants[137] = pow(lt_func(constants[1], constants[2]), 1.0/pow(constants[6], 1.0/constants[18])) - computed_constants[138] = fabs(constants[1]) - computed_constants[139] = exp(constants[1]) - computed_constants[140] = log(constants[1]) - computed_constants[141] = log10(constants[1]) - computed_constants[142] = log(constants[1])/log(2.0) - computed_constants[143] = log10(constants[1]) - computed_constants[144] = log(constants[1])/log(constants[2]) - computed_constants[145] = ceil(constants[1]) - computed_constants[146] = floor(constants[1]) - computed_constants[147] = min(constants[1], constants[2]) - computed_constants[148] = min(constants[1], min(constants[2], constants[6])) - computed_constants[149] = max(constants[1], constants[2]) - computed_constants[150] = max(constants[1], max(constants[2], constants[6])) - computed_constants[151] = fmod(constants[1], constants[2]) - computed_constants[152] = sin(constants[1]) - computed_constants[153] = cos(constants[1]) - computed_constants[154] = tan(constants[1]) - computed_constants[155] = sec(constants[1]) - computed_constants[156] = csc(constants[1]) - computed_constants[157] = cot(constants[1]) - computed_constants[158] = sinh(constants[1]) - computed_constants[159] = cosh(constants[1]) - computed_constants[160] = tanh(constants[1]) - computed_constants[161] = sech(constants[1]) - computed_constants[162] = csch(constants[1]) - computed_constants[163] = coth(constants[1]) - computed_constants[164] = asin(constants[1]) - computed_constants[165] = acos(constants[1]) - computed_constants[166] = atan(constants[1]) - computed_constants[167] = asec(constants[1]) - computed_constants[168] = acsc(constants[1]) - computed_constants[169] = acot(constants[1]) - computed_constants[170] = asinh(constants[1]) - computed_constants[171] = acosh(constants[1]) - computed_constants[172] = atanh(constants[1]/2.0) - computed_constants[173] = asech(constants[1]) - computed_constants[174] = acsch(constants[1]) - computed_constants[175] = acoth(2.0*constants[1]) - computed_constants[176] = constants[1] if gt_func(constants[1], constants[2]) else nan - computed_constants[177] = constants[1] if gt_func(constants[1], constants[2]) else constants[6] - computed_constants[178] = constants[1] if gt_func(constants[1], constants[2]) else constants[6] if gt_func(constants[6], constants[18]) else constants[179] if gt_func(constants[179], constants[180]) else nan - computed_constants[181] = constants[1] if gt_func(constants[1], constants[2]) else constants[6] if gt_func(constants[6], constants[18]) else constants[179] if gt_func(constants[179], constants[180]) else constants[182] - computed_constants[183] = 123.0+(constants[1] if gt_func(constants[1], constants[2]) else nan) - computed_constants[188] = constants[1] - computed_constants[195] = and_func(constants[1], constants[2])+(constants[2] if gt_func(constants[6], constants[18]) else nan)+constants[179]+and_func(constants[180], constants[182]) - computed_constants[196] = and_func(constants[1], constants[2])-((constants[2] if gt_func(constants[6], constants[18]) else nan)-(constants[179]-(constants[2] if gt_func(constants[6], constants[18]) else nan)))-and_func(constants[180], constants[182]) - computed_constants[197] = and_func(constants[1], constants[2])*(constants[2] if gt_func(constants[6], constants[18]) else nan)*constants[179]*(constants[2] if gt_func(constants[6], constants[18]) else nan)*and_func(constants[180], constants[182]) - computed_constants[198] = and_func(constants[1], constants[2])/((constants[2] if gt_func(constants[6], constants[18]) else nan)/(constants[179]/(constants[2] if gt_func(constants[6], constants[18]) else nan))) - computed_constants[199] = and_func(or_func(constants[1], constants[2]), and_func(xor_func(constants[1], constants[2]), and_func(constants[2] if gt_func(constants[6], constants[18]) else nan, and_func(and_func(and_func(constants[179], constants[2] if gt_func(constants[6], constants[18]) else nan), xor_func(constants[1], constants[2])), or_func(constants[1], constants[2]))))) - computed_constants[200] = or_func(and_func(constants[1], constants[2]), or_func(xor_func(constants[1], constants[2]), or_func(constants[2] if gt_func(constants[6], constants[18]) else nan, or_func(or_func(or_func(constants[179], constants[2] if gt_func(constants[6], constants[18]) else nan), xor_func(constants[1], constants[2])), and_func(constants[1], constants[2]))))) - computed_constants[201] = xor_func(and_func(constants[1], constants[2]), xor_func(or_func(constants[1], constants[2]), xor_func(constants[2] if gt_func(constants[6], constants[18]) else nan, xor_func(xor_func(xor_func(constants[179], constants[2] if gt_func(constants[6], constants[18]) else nan), or_func(constants[1], constants[2])), and_func(constants[1], constants[2]))))) - computed_constants[202] = pow(and_func(constants[1], constants[2]), pow(constants[2] if gt_func(constants[6], constants[18]) else nan, pow(pow(constants[179], constants[2] if gt_func(constants[6], constants[18]) else nan), and_func(constants[1], constants[2])))) - computed_constants[203] = pow(pow(pow(and_func(constants[1], constants[2]), 1.0/pow(constants[2] if gt_func(constants[6], constants[18]) else nan, 1.0/constants[179])), 1.0/(constants[2] if gt_func(constants[6], constants[18]) else nan)), 1.0/and_func(constants[1], constants[2])) - computed_constants[204] = -and_func(constants[1], constants[2])+-(constants[2] if gt_func(constants[6], constants[18]) else nan) + computed_constants[0] = eq_func(constants[0], constants[1]) + computed_constants[1] = constants[0]/eq_func(constants[1], constants[1]) + computed_constants[2] = neq_func(constants[0], constants[1]) + computed_constants[3] = constants[0]/neq_func(constants[1], constants[2]) + computed_constants[4] = lt_func(constants[0], constants[1]) + computed_constants[5] = constants[0]/lt_func(constants[1], constants[2]) + computed_constants[6] = leq_func(constants[0], constants[1]) + computed_constants[7] = constants[0]/leq_func(constants[1], constants[2]) + computed_constants[8] = gt_func(constants[0], constants[1]) + computed_constants[9] = constants[0]/gt_func(constants[1], constants[2]) + computed_constants[10] = geq_func(constants[0], constants[1]) + computed_constants[11] = constants[0]/geq_func(constants[1], constants[2]) + computed_constants[12] = and_func(constants[0], constants[1]) + computed_constants[13] = and_func(constants[0], and_func(constants[1], constants[2])) + computed_constants[14] = and_func(lt_func(constants[0], constants[1]), gt_func(constants[2], constants[3])) + computed_constants[15] = and_func(constants[0]+constants[1], gt_func(constants[2], constants[3])) + computed_constants[16] = and_func(constants[0], gt_func(constants[1], constants[2])) + computed_constants[17] = and_func(constants[0]-constants[1], gt_func(constants[2], constants[3])) + computed_constants[18] = and_func(-constants[0], gt_func(constants[1], constants[2])) + computed_constants[19] = and_func(pow(constants[0], constants[1]), gt_func(constants[2], constants[3])) + computed_constants[20] = and_func(pow(constants[0], 1.0/constants[1]), gt_func(constants[2], constants[3])) + computed_constants[21] = and_func(lt_func(constants[0], constants[1]), constants[2]+constants[3]) + computed_constants[22] = and_func(lt_func(constants[0], constants[1]), constants[2]) + computed_constants[23] = and_func(lt_func(constants[0], constants[1]), constants[2]-constants[3]) + computed_constants[24] = and_func(lt_func(constants[0], constants[1]), -constants[2]) + computed_constants[25] = and_func(lt_func(constants[0], constants[1]), pow(constants[2], constants[3])) + computed_constants[26] = and_func(lt_func(constants[0], constants[1]), pow(constants[2], 1.0/constants[3])) + computed_constants[27] = constants[0]/and_func(constants[1], constants[2]) + computed_constants[28] = or_func(constants[0], constants[1]) + computed_constants[29] = or_func(constants[0], or_func(constants[1], constants[2])) + computed_constants[30] = or_func(lt_func(constants[0], constants[1]), gt_func(constants[2], constants[3])) + computed_constants[31] = or_func(constants[0]+constants[1], gt_func(constants[2], constants[3])) + computed_constants[32] = or_func(constants[0], gt_func(constants[1], constants[2])) + computed_constants[33] = or_func(constants[0]-constants[1], gt_func(constants[2], constants[3])) + computed_constants[34] = or_func(-constants[0], gt_func(constants[1], constants[2])) + computed_constants[35] = or_func(pow(constants[0], constants[1]), gt_func(constants[2], constants[3])) + computed_constants[36] = or_func(pow(constants[0], 1.0/constants[1]), gt_func(constants[2], constants[3])) + computed_constants[37] = or_func(lt_func(constants[0], constants[1]), constants[2]+constants[3]) + computed_constants[38] = or_func(lt_func(constants[0], constants[1]), constants[2]) + computed_constants[39] = or_func(lt_func(constants[0], constants[1]), constants[2]-constants[3]) + computed_constants[40] = or_func(lt_func(constants[0], constants[1]), -constants[2]) + computed_constants[41] = or_func(lt_func(constants[0], constants[1]), pow(constants[2], constants[3])) + computed_constants[42] = or_func(lt_func(constants[0], constants[1]), pow(constants[2], 1.0/constants[3])) + computed_constants[43] = constants[0]/or_func(constants[1], constants[2]) + computed_constants[44] = xor_func(constants[0], constants[1]) + computed_constants[45] = xor_func(constants[0], xor_func(constants[1], constants[2])) + computed_constants[46] = xor_func(lt_func(constants[0], constants[1]), gt_func(constants[2], constants[3])) + computed_constants[47] = xor_func(constants[0]+constants[1], gt_func(constants[2], constants[3])) + computed_constants[48] = xor_func(constants[0], gt_func(constants[1], constants[2])) + computed_constants[49] = xor_func(constants[0]-constants[1], gt_func(constants[2], constants[3])) + computed_constants[50] = xor_func(-constants[0], gt_func(constants[1], constants[2])) + computed_constants[51] = xor_func(pow(constants[0], constants[1]), gt_func(constants[2], constants[3])) + computed_constants[52] = xor_func(pow(constants[0], 1.0/constants[1]), gt_func(constants[2], constants[3])) + computed_constants[53] = xor_func(lt_func(constants[0], constants[1]), constants[2]+constants[3]) + computed_constants[54] = xor_func(lt_func(constants[0], constants[1]), constants[2]) + computed_constants[55] = xor_func(lt_func(constants[0], constants[1]), constants[2]-constants[3]) + computed_constants[56] = xor_func(lt_func(constants[0], constants[1]), -constants[2]) + computed_constants[57] = xor_func(lt_func(constants[0], constants[1]), pow(constants[2], constants[3])) + computed_constants[58] = xor_func(lt_func(constants[0], constants[1]), pow(constants[2], 1.0/constants[3])) + computed_constants[59] = constants[0]/xor_func(constants[1], constants[2]) + computed_constants[60] = not_func(constants[0]) + computed_constants[61] = constants[0]+constants[1] + computed_constants[62] = constants[0]+constants[1]+constants[2] + computed_constants[63] = lt_func(constants[0], constants[1])+gt_func(constants[2], constants[3]) + computed_constants[64] = constants[0] + computed_constants[65] = constants[0]-constants[1] + computed_constants[66] = lt_func(constants[0], constants[1])-gt_func(constants[2], constants[3]) + computed_constants[67] = lt_func(constants[0], constants[1])-(constants[2]+constants[3]) + computed_constants[68] = lt_func(constants[0], constants[1])-constants[2] + computed_constants[69] = constants[0]-(-constants[1]) + computed_constants[70] = constants[0]-(-constants[1]*constants[2]) + computed_constants[71] = -constants[0] + computed_constants[72] = -lt_func(constants[0], constants[1]) + computed_constants[73] = constants[0]*constants[1] + computed_constants[74] = constants[0]*constants[1]*constants[2] + computed_constants[75] = lt_func(constants[0], constants[1])*gt_func(constants[2], constants[3]) + computed_constants[76] = (constants[0]+constants[1])*gt_func(constants[2], constants[3]) + computed_constants[77] = constants[0]*gt_func(constants[1], constants[2]) + computed_constants[78] = (constants[0]-constants[1])*gt_func(constants[2], constants[3]) + computed_constants[79] = -constants[0]*gt_func(constants[1], constants[2]) + computed_constants[80] = lt_func(constants[0], constants[1])*(constants[2]+constants[3]) + computed_constants[81] = lt_func(constants[0], constants[1])*constants[2] + computed_constants[82] = lt_func(constants[0], constants[1])*(constants[2]-constants[3]) + computed_constants[83] = lt_func(constants[0], constants[1])*-constants[2] + computed_constants[84] = constants[0]/constants[1] + computed_constants[85] = lt_func(constants[0], constants[1])/gt_func(constants[3], constants[2]) + computed_constants[86] = (constants[0]+constants[1])/gt_func(constants[3], constants[2]) + computed_constants[87] = constants[0]/gt_func(constants[2], constants[1]) + computed_constants[88] = (constants[0]-constants[1])/gt_func(constants[3], constants[2]) + computed_constants[89] = -constants[0]/gt_func(constants[2], constants[1]) + computed_constants[90] = lt_func(constants[0], constants[1])/(constants[2]+constants[3]) + computed_constants[91] = lt_func(constants[0], constants[1])/constants[2] + computed_constants[92] = lt_func(constants[0], constants[1])/(constants[2]-constants[3]) + computed_constants[93] = lt_func(constants[0], constants[1])/-constants[2] + computed_constants[94] = lt_func(constants[0], constants[1])/(constants[2]*constants[3]) + computed_constants[95] = lt_func(constants[0], constants[1])/(constants[2]/constants[3]) + computed_constants[96] = sqrt(constants[0]) + computed_constants[97] = pow(constants[0], 2.0) + computed_constants[98] = pow(constants[0], 3.0) + computed_constants[99] = pow(constants[0], constants[1]) + computed_constants[100] = pow(leq_func(constants[0], constants[1]), geq_func(constants[2], constants[3])) + computed_constants[101] = pow(constants[0]+constants[1], geq_func(constants[2], constants[3])) + computed_constants[102] = pow(constants[0], geq_func(constants[1], constants[2])) + computed_constants[103] = pow(constants[0]-constants[1], geq_func(constants[2], constants[3])) + computed_constants[104] = pow(-constants[0], geq_func(constants[1], constants[2])) + computed_constants[105] = pow(constants[0]*constants[1], geq_func(constants[2], constants[3])) + computed_constants[106] = pow(constants[0]/constants[1], geq_func(constants[2], constants[3])) + computed_constants[107] = pow(leq_func(constants[0], constants[1]), constants[2]+constants[3]) + computed_constants[108] = pow(leq_func(constants[0], constants[1]), constants[2]) + computed_constants[109] = pow(leq_func(constants[0], constants[1]), constants[2]-constants[3]) + computed_constants[110] = pow(leq_func(constants[0], constants[1]), -constants[2]) + computed_constants[111] = pow(leq_func(constants[0], constants[1]), constants[2]*constants[3]) + computed_constants[112] = pow(leq_func(constants[0], constants[1]), constants[2]/constants[3]) + computed_constants[113] = pow(leq_func(constants[0], constants[1]), pow(constants[2], constants[3])) + computed_constants[114] = pow(leq_func(constants[0], constants[1]), pow(constants[2], 1.0/constants[3])) + computed_constants[115] = sqrt(constants[0]) + computed_constants[116] = sqrt(constants[0]) + computed_constants[117] = pow(constants[0], 1.0/3.0) + computed_constants[118] = pow(constants[0], 1.0/constants[1]) + computed_constants[119] = pow(lt_func(constants[0], constants[1]), 1.0/gt_func(constants[3], constants[2])) + computed_constants[120] = pow(constants[0]+constants[1], 1.0/gt_func(constants[3], constants[2])) + computed_constants[121] = pow(constants[0], 1.0/gt_func(constants[2], constants[1])) + computed_constants[122] = pow(constants[0]-constants[1], 1.0/gt_func(constants[3], constants[2])) + computed_constants[123] = pow(-constants[0], 1.0/gt_func(constants[2], constants[1])) + computed_constants[124] = pow(constants[0]*constants[1], 1.0/gt_func(constants[3], constants[2])) + computed_constants[125] = pow(constants[0]/constants[1], 1.0/gt_func(constants[3], constants[2])) + computed_constants[126] = pow(lt_func(constants[0], constants[1]), 1.0/(constants[2]+constants[3])) + computed_constants[127] = pow(lt_func(constants[0], constants[1]), 1.0/constants[2]) + computed_constants[128] = pow(lt_func(constants[0], constants[1]), 1.0/(constants[2]-constants[3])) + computed_constants[129] = pow(lt_func(constants[0], constants[1]), 1.0/-constants[2]) + computed_constants[130] = pow(lt_func(constants[0], constants[1]), 1.0/(constants[2]*constants[3])) + computed_constants[131] = pow(lt_func(constants[0], constants[1]), 1.0/(constants[2]/constants[3])) + computed_constants[132] = pow(lt_func(constants[0], constants[1]), 1.0/pow(constants[2], constants[3])) + computed_constants[133] = pow(lt_func(constants[0], constants[1]), 1.0/pow(constants[2], 1.0/constants[3])) + computed_constants[134] = fabs(constants[0]) + computed_constants[135] = exp(constants[0]) + computed_constants[136] = log(constants[0]) + computed_constants[137] = log10(constants[0]) + computed_constants[138] = log(constants[0])/log(2.0) + computed_constants[139] = log10(constants[0]) + computed_constants[140] = log(constants[0])/log(constants[1]) + computed_constants[141] = ceil(constants[0]) + computed_constants[142] = floor(constants[0]) + computed_constants[143] = min(constants[0], constants[1]) + computed_constants[144] = min(constants[0], min(constants[1], constants[2])) + computed_constants[145] = max(constants[0], constants[1]) + computed_constants[146] = max(constants[0], max(constants[1], constants[2])) + computed_constants[147] = fmod(constants[0], constants[1]) + computed_constants[148] = sin(constants[0]) + computed_constants[149] = cos(constants[0]) + computed_constants[150] = tan(constants[0]) + computed_constants[151] = sec(constants[0]) + computed_constants[152] = csc(constants[0]) + computed_constants[153] = cot(constants[0]) + computed_constants[154] = sinh(constants[0]) + computed_constants[155] = cosh(constants[0]) + computed_constants[156] = tanh(constants[0]) + computed_constants[157] = sech(constants[0]) + computed_constants[158] = csch(constants[0]) + computed_constants[159] = coth(constants[0]) + computed_constants[160] = asin(constants[0]) + computed_constants[161] = acos(constants[0]) + computed_constants[162] = atan(constants[0]) + computed_constants[163] = asec(constants[0]) + computed_constants[164] = acsc(constants[0]) + computed_constants[165] = acot(constants[0]) + computed_constants[166] = asinh(constants[0]) + computed_constants[167] = acosh(constants[0]) + computed_constants[168] = atanh(constants[0]/2.0) + computed_constants[169] = asech(constants[0]) + computed_constants[170] = acsch(constants[0]) + computed_constants[171] = acoth(2.0*constants[0]) + computed_constants[172] = constants[0] if gt_func(constants[0], constants[1]) else nan + computed_constants[173] = constants[0] if gt_func(constants[0], constants[1]) else constants[2] + computed_constants[174] = constants[0] if gt_func(constants[0], constants[1]) else constants[2] if gt_func(constants[2], constants[3]) else constants[4] if gt_func(constants[4], constants[5]) else nan + computed_constants[175] = constants[0] if gt_func(constants[0], constants[1]) else constants[2] if gt_func(constants[2], constants[3]) else constants[4] if gt_func(constants[4], constants[5]) else constants[6] + computed_constants[176] = 123.0+(constants[0] if gt_func(constants[0], constants[1]) else nan) + computed_constants[181] = constants[0] + computed_constants[188] = and_func(constants[0], constants[1])+(constants[1] if gt_func(constants[2], constants[3]) else nan)+constants[4]+and_func(constants[5], constants[6]) + computed_constants[189] = and_func(constants[0], constants[1])-((constants[1] if gt_func(constants[2], constants[3]) else nan)-(constants[4]-(constants[1] if gt_func(constants[2], constants[3]) else nan)))-and_func(constants[5], constants[6]) + computed_constants[190] = and_func(constants[0], constants[1])*(constants[1] if gt_func(constants[2], constants[3]) else nan)*constants[4]*(constants[1] if gt_func(constants[2], constants[3]) else nan)*and_func(constants[5], constants[6]) + computed_constants[191] = and_func(constants[0], constants[1])/((constants[1] if gt_func(constants[2], constants[3]) else nan)/(constants[4]/(constants[1] if gt_func(constants[2], constants[3]) else nan))) + computed_constants[192] = and_func(or_func(constants[0], constants[1]), and_func(xor_func(constants[0], constants[1]), and_func(constants[1] if gt_func(constants[2], constants[3]) else nan, and_func(and_func(and_func(constants[4], constants[1] if gt_func(constants[2], constants[3]) else nan), xor_func(constants[0], constants[1])), or_func(constants[0], constants[1]))))) + computed_constants[193] = or_func(and_func(constants[0], constants[1]), or_func(xor_func(constants[0], constants[1]), or_func(constants[1] if gt_func(constants[2], constants[3]) else nan, or_func(or_func(or_func(constants[4], constants[1] if gt_func(constants[2], constants[3]) else nan), xor_func(constants[0], constants[1])), and_func(constants[0], constants[1]))))) + computed_constants[194] = xor_func(and_func(constants[0], constants[1]), xor_func(or_func(constants[0], constants[1]), xor_func(constants[1] if gt_func(constants[2], constants[3]) else nan, xor_func(xor_func(xor_func(constants[4], constants[1] if gt_func(constants[2], constants[3]) else nan), or_func(constants[0], constants[1])), and_func(constants[0], constants[1]))))) + computed_constants[195] = pow(and_func(constants[0], constants[1]), pow(constants[1] if gt_func(constants[2], constants[3]) else nan, pow(pow(constants[4], constants[1] if gt_func(constants[2], constants[3]) else nan), and_func(constants[0], constants[1])))) + computed_constants[196] = pow(pow(pow(and_func(constants[0], constants[1]), 1.0/pow(constants[1] if gt_func(constants[2], constants[3]) else nan, 1.0/constants[4])), 1.0/(constants[1] if gt_func(constants[2], constants[3]) else nan)), 1.0/and_func(constants[0], constants[1])) + computed_constants[197] = -and_func(constants[0], constants[1])+-(constants[1] if gt_func(constants[2], constants[3]) else nan) def compute_rates(voi, states, rates, constants, computed_constants, algebraic): diff --git a/tests/resources/generator/algebraic_eqn_const_var_on_rhs/model.c b/tests/resources/generator/algebraic_eqn_const_var_on_rhs/model.c index 6624303897..332ca74062 100644 --- a/tests/resources/generator/algebraic_eqn_const_var_on_rhs/model.c +++ b/tests/resources/generator/algebraic_eqn_const_var_on_rhs/model.c @@ -35,12 +35,12 @@ void deleteArray(double *array) void initialiseVariables(double *constants) { - constants[1] = 1.0; + constants[0] = 1.0; } void computeComputedConstants(double *constants, double *computedConstants) { - computedConstants[0] = constants[1]; + computedConstants[0] = constants[0]; } void computeVariables(double *constants, double *computedConstants, double *algebraic) diff --git a/tests/resources/generator/algebraic_eqn_const_var_on_rhs/model.py b/tests/resources/generator/algebraic_eqn_const_var_on_rhs/model.py index 9b07f95029..491cd5db6c 100644 --- a/tests/resources/generator/algebraic_eqn_const_var_on_rhs/model.py +++ b/tests/resources/generator/algebraic_eqn_const_var_on_rhs/model.py @@ -29,11 +29,11 @@ def create_variables_array(): def initialise_variables(constants): - constants[1] = 1.0 + constants[0] = 1.0 def compute_computed_constants(constants, computed_constants): - computed_constants[0] = constants[1] + computed_constants[0] = constants[0] def compute_variables(constants, computed_constants, algebraic): diff --git a/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.c b/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.c index c08dde32e6..3dad3588b0 100644 --- a/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.c +++ b/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.c @@ -68,5 +68,5 @@ void computeRates(double voi, double *states, double *rates, double *constants, void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { - algebraic[1] = rates[0]; + algebraic[0] = rates[0]; } diff --git a/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.py b/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.py index 5e2901ca36..636d498ebc 100644 --- a/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.py +++ b/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.py @@ -55,4 +55,4 @@ def compute_rates(voi, states, rates, constants, computed_constants, algebraic): def compute_variables(voi, states, rates, constants, computed_constants, algebraic): - algebraic[1] = rates[0] + algebraic[0] = rates[0] diff --git a/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.c b/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.c index 5d3967ab00..7c848f4303 100644 --- a/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.c +++ b/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.c @@ -68,5 +68,5 @@ void computeRates(double voi, double *states, double *rates, double *constants, void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { - algebraic[1] = rates[0]; + algebraic[0] = rates[0]; } diff --git a/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.py b/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.py index 3390600530..1b1a4ab6e7 100644 --- a/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.py +++ b/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.py @@ -55,4 +55,4 @@ def compute_rates(voi, states, rates, constants, computed_constants, algebraic): def compute_variables(voi, states, rates, constants, computed_constants, algebraic): - algebraic[1] = rates[0] + algebraic[0] = rates[0] diff --git a/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.c b/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.c index cd735eda2b..42c4bd5eb7 100644 --- a/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.c +++ b/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.c @@ -68,5 +68,5 @@ void computeRates(double voi, double *states, double *rates, double *constants, void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { - algebraic[1] = 2.0*states[0]; + algebraic[0] = 2.0*states[0]; } diff --git a/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.py b/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.py index bca3f1f415..1515ba7746 100644 --- a/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.py +++ b/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.py @@ -55,4 +55,4 @@ def compute_rates(voi, states, rates, constants, computed_constants, algebraic): def compute_variables(voi, states, rates, constants, computed_constants, algebraic): - algebraic[1] = 2.0*states[0] + algebraic[0] = 2.0*states[0] diff --git a/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.c b/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.c index 8836720f31..02fe6c001b 100644 --- a/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.c +++ b/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.c @@ -68,5 +68,5 @@ void computeRates(double voi, double *states, double *rates, double *constants, void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { - algebraic[1] = 2.0*states[0]; + algebraic[0] = 2.0*states[0]; } diff --git a/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.py b/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.py index 409f890e5e..25de4def2c 100644 --- a/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.py +++ b/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.py @@ -55,4 +55,4 @@ def compute_rates(voi, states, rates, constants, computed_constants, algebraic): def compute_variables(voi, states, rates, constants, computed_constants, algebraic): - algebraic[1] = 2.0*states[0] + algebraic[0] = 2.0*states[0] diff --git a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.c b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.c index 8466d70b10..76b2c4760b 100644 --- a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.c +++ b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.c @@ -46,9 +46,9 @@ void objectiveFunction0(double *u, double *f, void *data) { double *variables = ((RootFindingInfo *) data)->variables; - algebraic[3] = u[0]; + algebraic[0] = u[0]; - f[0] = algebraic[3]+computedConstants[0]-(computedConstants[1]+computedConstants[2]); + f[0] = algebraic[0]+computedConstants[0]-(computedConstants[1]+computedConstants[2]); } void findRoot0(double *variables) @@ -56,16 +56,16 @@ void findRoot0(double *variables) RootFindingInfo rfi = { variables }; double u[1]; - u[0] = algebraic[3]; + u[0] = algebraic[0]; nlaSolve(objectiveFunction0, u, 1, &rfi); - algebraic[3] = u[0]; + algebraic[0] = u[0]; } void initialiseVariables(double *constants) { - algebraic[3] = 1.0; + algebraic[0] = 1.0; computedConstants[0] = 3.0; computedConstants[1] = 5.0; computedConstants[2] = 7.0; diff --git a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.c b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.c index 57c92c1e13..060991c4c8 100644 --- a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.c +++ b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.c @@ -40,7 +40,7 @@ void initialiseVariables(double *constants, ExternalVariable externalVariable) computedConstants[0] = 3.0; computedConstants[1] = 5.0; computedConstants[2] = 7.0; - algebraic[3] = externalVariable(variables, 3); + algebraic[0] = externalVariable(variables, 0); } void computeComputedConstants(double *constants, double *computedConstants) @@ -49,5 +49,5 @@ void computeComputedConstants(double *constants, double *computedConstants) void computeVariables(double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) { - algebraic[3] = externalVariable(variables, 3); + algebraic[0] = externalVariable(variables, 0); } diff --git a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.py b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.py index de574c9043..136bed0a66 100644 --- a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.py +++ b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.py @@ -35,7 +35,7 @@ def initialise_variables(constants, external_variable): computed_constants[0] = 3.0 computed_constants[1] = 5.0 computed_constants[2] = 7.0 - algebraic[3] = external_variable(variables, 3) + algebraic[0] = external_variable(variables, 0) def compute_computed_constants(constants, computed_constants): @@ -43,4 +43,4 @@ def compute_computed_constants(constants, computed_constants): def compute_variables(constants, computed_constants, algebraic, external_variable): - algebraic[3] = external_variable(variables, 3) + algebraic[0] = external_variable(variables, 0) diff --git a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.py b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.py index 646d98b2af..c84ffdf6af 100644 --- a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.py +++ b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.py @@ -36,23 +36,23 @@ def create_variables_array(): def objective_function_0(u, f, data): variables = data[0] - algebraic[3] = u[0] + algebraic[0] = u[0] - f[0] = algebraic[3]+computed_constants[0]-(computed_constants[1]+computed_constants[2]) + f[0] = algebraic[0]+computed_constants[0]-(computed_constants[1]+computed_constants[2]) def find_root_0(variables): u = [nan]*1 - u[0] = algebraic[3] + u[0] = algebraic[0] u = nla_solve(objective_function_0, u, 1, [variables]) - algebraic[3] = u[0] + algebraic[0] = u[0] def initialise_variables(constants): - algebraic[3] = 1.0 + algebraic[0] = 1.0 computed_constants[0] = 3.0 computed_constants[1] = 5.0 computed_constants[2] = 7.0 diff --git a/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.c b/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.c index 209f9dc7b5..c628b10acd 100644 --- a/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.c +++ b/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.c @@ -51,8 +51,8 @@ void objectiveFunction0(double *u, double *f, void *data) algebraic[2] = u[0]; algebraic[1] = u[1]; - f[0] = 3.0*computedConstants[3]+2.0*algebraic[1]+algebraic[2]-57.0; - f[1] = computedConstants[3]+3.0*algebraic[1]-algebraic[2]-19.0; + f[0] = 3.0*computedConstants[0]+2.0*algebraic[1]+algebraic[2]-57.0; + f[1] = computedConstants[0]+3.0*algebraic[1]-algebraic[2]-19.0; } void findRoot0(double *variables) @@ -73,13 +73,13 @@ void initialiseVariables(double *constants) { algebraic[1] = 1.0; algebraic[2] = 1.0; - constants[4] = 3.0; - constants[5] = 5.0; + constants[0] = 3.0; + constants[1] = 5.0; } void computeComputedConstants(double *constants, double *computedConstants) { - computedConstants[3] = 3.0*constants[4]+constants[5]; + computedConstants[0] = 3.0*constants[0]+constants[1]; } void computeVariables(double *constants, double *computedConstants, double *algebraic) diff --git a/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.py b/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.py index 2c1c63ab8c..083873c38c 100644 --- a/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.py +++ b/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.py @@ -41,8 +41,8 @@ def objective_function_0(u, f, data): algebraic[2] = u[0] algebraic[1] = u[1] - f[0] = 3.0*computed_constants[3]+2.0*algebraic[1]+algebraic[2]-57.0 - f[1] = computed_constants[3]+3.0*algebraic[1]-algebraic[2]-19.0 + f[0] = 3.0*computed_constants[0]+2.0*algebraic[1]+algebraic[2]-57.0 + f[1] = computed_constants[0]+3.0*algebraic[1]-algebraic[2]-19.0 def find_root_0(variables): @@ -60,12 +60,12 @@ def find_root_0(variables): def initialise_variables(constants): algebraic[1] = 1.0 algebraic[2] = 1.0 - constants[4] = 3.0 - constants[5] = 5.0 + constants[0] = 3.0 + constants[1] = 5.0 def compute_computed_constants(constants, computed_constants): - computed_constants[3] = 3.0*constants[4]+constants[5] + computed_constants[0] = 3.0*constants[0]+constants[1] def compute_variables(constants, computed_constants, algebraic): diff --git a/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.c b/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.c index 2802b5299a..c7e93bd95d 100644 --- a/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.c +++ b/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.c @@ -48,11 +48,11 @@ void objectiveFunction0(double *u, double *f, void *data) { double *variables = ((RootFindingInfo *) data)->variables; - algebraic[3] = u[0]; - algebraic[4] = u[1]; + algebraic[0] = u[0]; + algebraic[1] = u[1]; - f[0] = 3.0*computedConstants[0]+2.0*algebraic[4]+algebraic[3]-57.0; - f[1] = computedConstants[0]+3.0*algebraic[4]-algebraic[3]-19.0; + f[0] = 3.0*computedConstants[0]+2.0*algebraic[1]+algebraic[0]-57.0; + f[1] = computedConstants[0]+3.0*algebraic[1]-algebraic[0]-19.0; } void findRoot0(double *variables) @@ -60,30 +60,30 @@ void findRoot0(double *variables) RootFindingInfo rfi = { variables }; double u[2]; - u[0] = algebraic[3]; - u[1] = algebraic[4]; + u[0] = algebraic[0]; + u[1] = algebraic[1]; nlaSolve(objectiveFunction0, u, 2, &rfi); - algebraic[3] = u[0]; - algebraic[4] = u[1]; + algebraic[0] = u[0]; + algebraic[1] = u[1]; } void initialiseVariables(double *constants) { - constants[1] = 3.0; - constants[2] = 5.0; - algebraic[3] = 1.0; - algebraic[4] = 1.0; + constants[0] = 3.0; + constants[1] = 5.0; + algebraic[0] = 1.0; + algebraic[1] = 1.0; } void computeComputedConstants(double *constants, double *computedConstants) { - computedConstants[0] = 3.0*constants[1]+constants[2]; + computedConstants[0] = 3.0*constants[0]+constants[1]; } void computeVariables(double *constants, double *computedConstants, double *algebraic) { findRoot0(variables); - algebraic[5] = algebraic[4]+algebraic[3]; + algebraic[2] = algebraic[1]+algebraic[0]; } diff --git a/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.py b/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.py index d6259b2b98..8b965af0b9 100644 --- a/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.py +++ b/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.py @@ -38,36 +38,36 @@ def create_variables_array(): def objective_function_0(u, f, data): variables = data[0] - algebraic[3] = u[0] - algebraic[4] = u[1] + algebraic[0] = u[0] + algebraic[1] = u[1] - f[0] = 3.0*computed_constants[0]+2.0*algebraic[4]+algebraic[3]-57.0 - f[1] = computed_constants[0]+3.0*algebraic[4]-algebraic[3]-19.0 + f[0] = 3.0*computed_constants[0]+2.0*algebraic[1]+algebraic[0]-57.0 + f[1] = computed_constants[0]+3.0*algebraic[1]-algebraic[0]-19.0 def find_root_0(variables): u = [nan]*2 - u[0] = algebraic[3] - u[1] = algebraic[4] + u[0] = algebraic[0] + u[1] = algebraic[1] u = nla_solve(objective_function_0, u, 2, [variables]) - algebraic[3] = u[0] - algebraic[4] = u[1] + algebraic[0] = u[0] + algebraic[1] = u[1] def initialise_variables(constants): - constants[1] = 3.0 - constants[2] = 5.0 - algebraic[3] = 1.0 - algebraic[4] = 1.0 + constants[0] = 3.0 + constants[1] = 5.0 + algebraic[0] = 1.0 + algebraic[1] = 1.0 def compute_computed_constants(constants, computed_constants): - computed_constants[0] = 3.0*constants[1]+constants[2] + computed_constants[0] = 3.0*constants[0]+constants[1] def compute_variables(constants, computed_constants, algebraic): find_root_0(variables) - algebraic[5] = algebraic[4]+algebraic[3] + algebraic[2] = algebraic[1]+algebraic[0] diff --git a/tests/resources/generator/cell_geometry_model/model.c b/tests/resources/generator/cell_geometry_model/model.c index 91884cff90..a5db4ad9c7 100644 --- a/tests/resources/generator/cell_geometry_model/model.c +++ b/tests/resources/generator/cell_geometry_model/model.c @@ -37,14 +37,14 @@ void deleteArray(double *array) void initialiseVariables(double *constants) { - constants[1] = 0.01; - constants[2] = 0.0011; + constants[0] = 0.01; + constants[1] = 0.0011; } void computeComputedConstants(double *constants, double *computedConstants) { - computedConstants[0] = 1000.0*3.14*constants[2]*constants[2]*constants[1]; - computedConstants[3] = 0.02*computedConstants[0]; + computedConstants[0] = 1000.0*3.14*constants[1]*constants[1]*constants[0]; + computedConstants[1] = 0.02*computedConstants[0]; } void computeVariables(double *constants, double *computedConstants, double *algebraic) diff --git a/tests/resources/generator/cell_geometry_model/model.py b/tests/resources/generator/cell_geometry_model/model.py index bcbef6f85a..6c941fc867 100644 --- a/tests/resources/generator/cell_geometry_model/model.py +++ b/tests/resources/generator/cell_geometry_model/model.py @@ -31,13 +31,13 @@ def create_variables_array(): def initialise_variables(constants): - constants[1] = 0.01 - constants[2] = 0.0011 + constants[0] = 0.01 + constants[1] = 0.0011 def compute_computed_constants(constants, computed_constants): - computed_constants[0] = 1000.0*3.14*constants[2]*constants[2]*constants[1] - computed_constants[3] = 0.02*computed_constants[0] + computed_constants[0] = 1000.0*3.14*constants[1]*constants[1]*constants[0] + computed_constants[1] = 0.02*computed_constants[0] def compute_variables(constants, computed_constants, algebraic): diff --git a/tests/resources/generator/cellml_slc_example/model.py b/tests/resources/generator/cellml_slc_example/model.py index ea8cac8cf8..f13fcec596 100644 --- a/tests/resources/generator/cellml_slc_example/model.py +++ b/tests/resources/generator/cellml_slc_example/model.py @@ -37,19 +37,19 @@ def create_variables_array(): def initialise_variables(constants): - constants[1] = 1.1 - constants[2] = 21262500.0 - constants[3] = 150.0 - constants[4] = 3402000.0 - constants[5] = 2.0 - constants[6] = 2902500.0 - constants[7] = 810000.0 - constants[8] = 247140.0 - constants[9] = 2902500.0 + constants[0] = 1.1 + constants[1] = 21262500.0 + constants[2] = 150.0 + constants[3] = 3402000.0 + constants[4] = 2.0 + constants[5] = 2902500.0 + constants[6] = 810000.0 + constants[7] = 247140.0 + constants[8] = 2902500.0 def compute_computed_constants(constants, computed_constants): - computed_constants[0] = constants[1]*(constants[2]*constants[3]-constants[4]*constants[5])/(constants[6]*constants[5]+constants[9]*constants[3]+constants[8]*constants[5]*constants[3]+constants[7]) + computed_constants[0] = constants[0]*(constants[1]*constants[2]-constants[3]*constants[4])/(constants[5]*constants[4]+constants[8]*constants[2]+constants[7]*constants[4]*constants[2]+constants[6]) def compute_variables(constants, computed_constants, algebraic): diff --git a/tests/resources/generator/cellml_unit_scaling_constant/model.c b/tests/resources/generator/cellml_unit_scaling_constant/model.c index 79847cd595..dea2a68eaa 100644 --- a/tests/resources/generator/cellml_unit_scaling_constant/model.c +++ b/tests/resources/generator/cellml_unit_scaling_constant/model.c @@ -41,8 +41,8 @@ void initialiseVariables(double *constants) void computeComputedConstants(double *constants, double *computedConstants) { - computedConstants[1] = constants[0]+constants[0]; - computedConstants[2] = 0.001*constants[0]+0.001*constants[0]; + computedConstants[0] = constants[0]+constants[0]; + computedConstants[1] = 0.001*constants[0]+0.001*constants[0]; } void computeVariables(double *constants, double *computedConstants, double *algebraic) diff --git a/tests/resources/generator/cellml_unit_scaling_constant/model.py b/tests/resources/generator/cellml_unit_scaling_constant/model.py index 8d1f0b000f..ec8df9c839 100644 --- a/tests/resources/generator/cellml_unit_scaling_constant/model.py +++ b/tests/resources/generator/cellml_unit_scaling_constant/model.py @@ -34,8 +34,8 @@ def initialise_variables(constants): def compute_computed_constants(constants, computed_constants): - computed_constants[1] = constants[0]+constants[0] - computed_constants[2] = 0.001*constants[0]+0.001*constants[0] + computed_constants[0] = constants[0]+constants[0] + computed_constants[1] = 0.001*constants[0]+0.001*constants[0] def compute_variables(constants, computed_constants, algebraic): diff --git a/tests/resources/generator/dae_cellml_1_1_model/model.c b/tests/resources/generator/dae_cellml_1_1_model/model.c index aff41afb7a..89c29978dd 100644 --- a/tests/resources/generator/dae_cellml_1_1_model/model.c +++ b/tests/resources/generator/dae_cellml_1_1_model/model.c @@ -79,7 +79,7 @@ void objectiveFunction0(double *u, double *f, void *data) algebraic[0] = u[0]; - f[0] = constants[1]-(algebraic[0]+algebraic[2]); + f[0] = constants[0]-(algebraic[0]+algebraic[1]); } void findRoot0(double voi, double *states, double *rates, double *variables) @@ -101,9 +101,9 @@ void objectiveFunction1(double *u, double *f, void *data) double *rates = ((RootFindingInfo *) data)->rates; double *variables = ((RootFindingInfo *) data)->variables; - algebraic[6] = u[0]; + algebraic[4] = u[0]; - f[0] = algebraic[4]-(algebraic[5]+algebraic[6]); + f[0] = algebraic[2]-(algebraic[3]+algebraic[4]); } void findRoot1(double voi, double *states, double *rates, double *variables) @@ -111,22 +111,22 @@ void findRoot1(double voi, double *states, double *rates, double *variables) RootFindingInfo rfi = { voi, states, rates, variables }; double u[1]; - u[0] = algebraic[6]; + u[0] = algebraic[4]; nlaSolve(objectiveFunction1, u, 1, &rfi); - algebraic[6] = u[0]; + algebraic[4] = u[0]; } void initialiseVariables(double *states, double *rates, double *constants) { algebraic[0] = 0.0; + constants[0] = 1.0; constants[1] = 1.0; - constants[3] = 1.0; - algebraic[6] = 0.0; - constants[7] = 20.0; - constants[8] = 2.0; - constants[9] = 10.0; + algebraic[4] = 0.0; + constants[2] = 20.0; + constants[3] = 2.0; + constants[4] = 10.0; states[0] = 1.0; states[1] = 0.0; } @@ -137,20 +137,20 @@ void computeComputedConstants(double *constants, double *computedConstants) void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { - algebraic[2] = states[1]+constants[3]; + algebraic[1] = states[1]+constants[1]; findRoot0(voi, states, rates, variables); rates[0] = algebraic[0]; - algebraic[4] = states[0]/constants[7]; - algebraic[5] = constants[8]*algebraic[2]; + algebraic[2] = states[0]/constants[2]; + algebraic[3] = constants[3]*algebraic[1]; findRoot1(voi, states, rates, variables); - rates[1] = algebraic[6]/constants[9]; + rates[1] = algebraic[4]/constants[4]; } void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { - algebraic[2] = states[1]+constants[3]; + algebraic[1] = states[1]+constants[1]; findRoot0(voi, states, rates, variables); - algebraic[4] = states[0]/constants[7]; - algebraic[5] = constants[8]*algebraic[2]; + algebraic[2] = states[0]/constants[2]; + algebraic[3] = constants[3]*algebraic[1]; findRoot1(voi, states, rates, variables); } diff --git a/tests/resources/generator/dae_cellml_1_1_model/model.py b/tests/resources/generator/dae_cellml_1_1_model/model.py index 764fb8703d..c1147dd4ff 100644 --- a/tests/resources/generator/dae_cellml_1_1_model/model.py +++ b/tests/resources/generator/dae_cellml_1_1_model/model.py @@ -61,7 +61,7 @@ def objective_function_0(u, f, data): algebraic[0] = u[0] - f[0] = constants[1]-(algebraic[0]+algebraic[2]) + f[0] = constants[0]-(algebraic[0]+algebraic[1]) def find_root_0(voi, states, rates, variables): @@ -80,29 +80,29 @@ def objective_function_1(u, f, data): rates = data[2] variables = data[3] - algebraic[6] = u[0] + algebraic[4] = u[0] - f[0] = algebraic[4]-(algebraic[5]+algebraic[6]) + f[0] = algebraic[2]-(algebraic[3]+algebraic[4]) def find_root_1(voi, states, rates, variables): u = [nan]*1 - u[0] = algebraic[6] + u[0] = algebraic[4] u = nla_solve(objective_function_1, u, 1, [voi, states, rates, variables]) - algebraic[6] = u[0] + algebraic[4] = u[0] def initialise_variables(states, rates, constants): algebraic[0] = 0.0 + constants[0] = 1.0 constants[1] = 1.0 - constants[3] = 1.0 - algebraic[6] = 0.0 - constants[7] = 20.0 - constants[8] = 2.0 - constants[9] = 10.0 + algebraic[4] = 0.0 + constants[2] = 20.0 + constants[3] = 2.0 + constants[4] = 10.0 states[0] = 1.0 states[1] = 0.0 @@ -112,18 +112,18 @@ def compute_computed_constants(constants, computed_constants): def compute_rates(voi, states, rates, constants, computed_constants, algebraic): - algebraic[2] = states[1]+constants[3] + algebraic[1] = states[1]+constants[1] find_root_0(voi, states, rates, variables) rates[0] = algebraic[0] - algebraic[4] = states[0]/constants[7] - algebraic[5] = constants[8]*algebraic[2] + algebraic[2] = states[0]/constants[2] + algebraic[3] = constants[3]*algebraic[1] find_root_1(voi, states, rates, variables) - rates[1] = algebraic[6]/constants[9] + rates[1] = algebraic[4]/constants[4] def compute_variables(voi, states, rates, constants, computed_constants, algebraic): - algebraic[2] = states[1]+constants[3] + algebraic[1] = states[1]+constants[1] find_root_0(voi, states, rates, variables) - algebraic[4] = states[0]/constants[7] - algebraic[5] = constants[8]*algebraic[2] + algebraic[2] = states[0]/constants[2] + algebraic[3] = constants[3]*algebraic[1] find_root_1(voi, states, rates, variables) diff --git a/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.c b/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.c index ccb8d7ddf3..bfbc945a46 100644 --- a/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.c +++ b/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.c @@ -302,95 +302,95 @@ void initialiseVariables(double *states, double *rates, double *constants) { constants[0] = 0.0; constants[1] = 0.0; + constants[2] = 140.0; + constants[3] = 5.4; constants[4] = 140.0; - constants[7] = 5.4; - constants[8] = 140.0; - constants[10] = 1.8; - constants[11] = 1.0; - constants[17] = 96485.3415; - constants[22] = 14.0; - constants[23] = 1.4; - constants[24] = 0.08105; - constants[25] = 0.0; - constants[30] = 3.343; - constants[39] = 26.44; - constants[40] = 0.0207; - constants[41] = 0.1369; - constants[43] = 395.3; - constants[44] = 2.289; - constants[45] = 0.4315; - constants[46] = 26.44; - constants[47] = 4.663; - constants[48] = 3.663; - constants[49] = 0.0; - constants[51] = 1628.0; - constants[52] = 561.4; - constants[54] = 148041085.1; - constants[57] = 15.0; - constants[58] = 1.0; - constants[59] = 0.45; - constants[60] = 2.5; - constants[62] = 10000.0; - constants[64] = 500.0; - constants[65] = 5.0; - constants[66] = 660.0; - constants[70] = 5.0; - constants[72] = 5.469e-5; - constants[74] = 0.000286113; - constants[75] = 5.0e-5; - constants[77] = 0.04; - constants[79] = 88800.0; - constants[80] = 446.0; - constants[82] = 227700.0; - constants[83] = 7.51; - constants[85] = 2277.0; - constants[86] = 2.5; - constants[87] = 751.0; - constants[89] = 1.642e6; - constants[90] = 542.0; - constants[93] = 175.4; - constants[94] = 445.0; - constants[95] = 0.031; - constants[96] = 0.062; - constants[97] = 0.045; - constants[98] = 10.0; - constants[104] = 67.0; - constants[105] = 3.9; - constants[106] = 0.02; - constants[107] = 0.0012; - constants[108] = 0.46; - constants[109] = 0.0116; - constants[118] = 5.7e-5; - constants[119] = 8314.472; - constants[120] = 310.0; - constants[122] = 0.0; - constants[123] = -35.0; - constants[124] = 0.5; - constants[125] = 0.5; - constants[126] = -45.0; - constants[128] = 0.00427; - constants[129] = 45.0; - constants[131] = 0.5927; - constants[135] = 0.0; - constants[141] = 0.0; - constants[144] = 0.0223; - constants[146] = 0.0; - constants[150] = 1.0e-5; - constants[157] = 0.1539e-3; - constants[163] = 0.4578; - constants[169] = -16.4508; - constants[170] = 4.3371; - constants[177] = 0.0; - constants[178] = 0.0; - constants[181] = 0.000338; - constants[183] = 0.0075; - constants[184] = 0.04132; - constants[189] = 0.0; - constants[190] = 3.5e-3; - constants[195] = 0.00424; - constants[204] = 0.00065; - constants[211] = 1.0; - constants[212] = 0.00345; + constants[5] = 1.8; + constants[6] = 1.0; + constants[7] = 96485.3415; + constants[8] = 14.0; + constants[9] = 1.4; + constants[10] = 0.08105; + constants[11] = 0.0; + constants[12] = 3.343; + constants[13] = 26.44; + constants[14] = 0.0207; + constants[15] = 0.1369; + constants[16] = 395.3; + constants[17] = 2.289; + constants[18] = 0.4315; + constants[19] = 26.44; + constants[20] = 4.663; + constants[21] = 3.663; + constants[22] = 0.0; + constants[23] = 1628.0; + constants[24] = 561.4; + constants[25] = 148041085.1; + constants[26] = 15.0; + constants[27] = 1.0; + constants[28] = 0.45; + constants[29] = 2.5; + constants[30] = 10000.0; + constants[31] = 500.0; + constants[32] = 5.0; + constants[33] = 660.0; + constants[34] = 5.0; + constants[35] = 5.469e-5; + constants[36] = 0.000286113; + constants[37] = 5.0e-5; + constants[38] = 0.04; + constants[39] = 88800.0; + constants[40] = 446.0; + constants[41] = 227700.0; + constants[42] = 7.51; + constants[43] = 2277.0; + constants[44] = 2.5; + constants[45] = 751.0; + constants[46] = 1.642e6; + constants[47] = 542.0; + constants[48] = 175.4; + constants[49] = 445.0; + constants[50] = 0.031; + constants[51] = 0.062; + constants[52] = 0.045; + constants[53] = 10.0; + constants[54] = 67.0; + constants[55] = 3.9; + constants[56] = 0.02; + constants[57] = 0.0012; + constants[58] = 0.46; + constants[59] = 0.0116; + constants[60] = 5.7e-5; + constants[61] = 8314.472; + constants[62] = 310.0; + constants[63] = 0.0; + constants[64] = -35.0; + constants[65] = 0.5; + constants[66] = 0.5; + constants[67] = -45.0; + constants[68] = 0.00427; + constants[69] = 45.0; + constants[70] = 0.5927; + constants[71] = 0.0; + constants[72] = 0.0; + constants[73] = 0.0223; + constants[74] = 0.0; + constants[75] = 1.0e-5; + constants[76] = 0.1539e-3; + constants[77] = 0.4578; + constants[78] = -16.4508; + constants[79] = 4.3371; + constants[80] = 0.0; + constants[81] = 0.0; + constants[82] = 0.000338; + constants[83] = 0.0075; + constants[84] = 0.04132; + constants[85] = 0.0; + constants[86] = 3.5e-3; + constants[87] = 0.00424; + constants[88] = 0.00065; + constants[89] = 1.0; + constants[90] = 0.00345; states[0] = 6.226104e-5; states[1] = 5.0; states[2] = 0.409551; @@ -428,266 +428,266 @@ void initialiseVariables(double *states, double *rates, double *constants) void computeComputedConstants(double *constants, double *computedConstants) { - computedConstants[3] = constants[119]*constants[120]/constants[17]; - computedConstants[6] = computedConstants[3]*log(constants[7]/constants[8]); - computedConstants[20] = (constants[1] > 0.0)?1.2:1.0; - computedConstants[35] = constants[4]/(constants[47]+constants[4]); - computedConstants[68] = (constants[1] > 0.0)?-0.25:(constants[0] > 0.0)?0.7*constants[0]/(0.00009+constants[0]):0.0; - computedConstants[69] = constants[70]*(1.0-computedConstants[68]); - computedConstants[103] = 0.000000001*3.14159265358979*pow(constants[105], 2.0)*constants[104]; - computedConstants[19] = 0.000000001*2.0*3.14159265358979*constants[106]*(constants[105]-constants[106]/2.0)*constants[104]; - computedConstants[100] = constants[107]*computedConstants[103]; - computedConstants[18] = constants[108]*computedConstants[103]-computedConstants[19]; - computedConstants[99] = constants[109]*computedConstants[103]; - computedConstants[127] = constants[128]/(constants[7]/(constants[7]+constants[129])); - computedConstants[130] = computedConstants[127]/(constants[131]+1.0); - computedConstants[132] = constants[131]*computedConstants[130]; - computedConstants[133] = computedConstants[132]*constants[7]/(constants[7]+constants[129]); - computedConstants[134] = computedConstants[130]*constants[7]/(constants[7]+constants[129]); - computedConstants[137] = (constants[0] > 0.0)?-1.0-9.898*pow(1.0*constants[0], 0.618)/(pow(1.0*constants[0], 0.618)+0.00122423):0.0; - computedConstants[138] = (constants[1] > 0.0)?7.5:0.0; - computedConstants[162] = (constants[1] > 0.0)?1.23:1.0; - computedConstants[165] = 0.31*constants[0]/(constants[0]+0.00009); - computedConstants[166] = (constants[1] > 0.0)?-8.0:0.0; - computedConstants[167] = (constants[1] > 0.0)?-27.0:0.0; - computedConstants[203] = (constants[1] > 0.0)?1.2*constants[204]:constants[204]; - computedConstants[206] = (constants[1] > 0.0)?-14.0:0.0; - computedConstants[213] = (3.5988-0.025641)/(1.0+0.0000012155/pow(1.0*constants[0], 1.6951))+0.025641; + computedConstants[0] = constants[61]*constants[62]/constants[7]; + computedConstants[1] = computedConstants[0]*log(constants[3]/constants[4]); + computedConstants[4] = (constants[1] > 0.0)?1.2:1.0; + computedConstants[5] = constants[2]/(constants[20]+constants[2]); + computedConstants[6] = (constants[1] > 0.0)?-0.25:(constants[0] > 0.0)?0.7*constants[0]/(0.00009+constants[0]):0.0; + computedConstants[7] = constants[34]*(1.0-computedConstants[6]); + computedConstants[10] = 0.000000001*3.14159265358979*pow(constants[55], 2.0)*constants[54]; + computedConstants[3] = 0.000000001*2.0*3.14159265358979*constants[56]*(constants[55]-constants[56]/2.0)*constants[54]; + computedConstants[9] = constants[57]*computedConstants[10]; + computedConstants[2] = constants[58]*computedConstants[10]-computedConstants[3]; + computedConstants[8] = constants[59]*computedConstants[10]; + computedConstants[11] = constants[68]/(constants[3]/(constants[3]+constants[69])); + computedConstants[12] = computedConstants[11]/(constants[70]+1.0); + computedConstants[13] = constants[70]*computedConstants[12]; + computedConstants[14] = computedConstants[13]*constants[3]/(constants[3]+constants[69]); + computedConstants[15] = computedConstants[12]*constants[3]/(constants[3]+constants[69]); + computedConstants[16] = (constants[0] > 0.0)?-1.0-9.898*pow(1.0*constants[0], 0.618)/(pow(1.0*constants[0], 0.618)+0.00122423):0.0; + computedConstants[17] = (constants[1] > 0.0)?7.5:0.0; + computedConstants[18] = (constants[1] > 0.0)?1.23:1.0; + computedConstants[19] = 0.31*constants[0]/(constants[0]+0.00009); + computedConstants[20] = (constants[1] > 0.0)?-8.0:0.0; + computedConstants[21] = (constants[1] > 0.0)?-27.0:0.0; + computedConstants[22] = (constants[1] > 0.0)?1.2*constants[88]:constants[88]; + computedConstants[23] = (constants[1] > 0.0)?-14.0:0.0; + computedConstants[24] = (3.5988-0.025641)/(1.0+0.0000012155/pow(1.0*constants[0], 1.6951))+0.025641; } void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { - algebraic[5] = states[1]; - algebraic[142] = computedConstants[3]*log((constants[4]+0.12*constants[7])/(algebraic[5]+0.12*constants[8])); - algebraic[121] = ((voi > constants[124]) && (voi < constants[124]+constants[125]))?constants[123]:constants[126]; - algebraic[21] = (constants[122] >= 1.0)?algebraic[121]:states[15]; - algebraic[143] = constants[144]*pow(states[18], 3.0)*states[17]*(algebraic[21]-algebraic[142]); - algebraic[145] = constants[146]*pow(states[18], 3.0)*(algebraic[21]-algebraic[142]); - algebraic[12] = algebraic[143]+algebraic[145]; - algebraic[15] = 0.0000185*constants[163]*(algebraic[21]-0.0)/(computedConstants[3]*(1.0-exp(-1.0*(algebraic[21]-0.0)/computedConstants[3])))*(algebraic[5]-constants[4]*exp(-1.0*(algebraic[21]-0.0)/computedConstants[3]))*states[23]*states[22]*states[21]; - algebraic[2] = computedConstants[3]*log(constants[4]/algebraic[5]); - algebraic[16] = states[16]*computedConstants[133]*(algebraic[21]-algebraic[2])*(1.0-constants[135]); - algebraic[14] = computedConstants[20]*constants[24]*pow(1.0+pow(constants[23]/constants[7], 1.2), -1.0)*pow(1.0+pow(constants[22]/algebraic[5], 1.3), -1.0)*pow(1.0+exp(-(algebraic[21]-algebraic[2]+110.0)/20.0), -1.0); - algebraic[50] = 1.0+constants[10]/constants[48]*(1.0+exp(constants[49]*algebraic[21]/computedConstants[3]))+constants[4]/constants[51]*(1.0+constants[4]/constants[52]*(1.0+constants[4]/constants[47])); - algebraic[27] = constants[10]/constants[48]*exp(constants[49]*algebraic[21]/computedConstants[3])/algebraic[50]; - algebraic[42] = 1.0+states[0]/constants[40]*(1.0+exp(-constants[41]*algebraic[21]/computedConstants[3])+algebraic[5]/constants[46])+algebraic[5]/constants[43]*(1.0+algebraic[5]/constants[44]*(1.0+algebraic[5]/constants[39])); - algebraic[29] = states[0]/constants[40]*exp(-constants[41]*algebraic[21]/computedConstants[3])/algebraic[42]; - algebraic[36] = algebraic[5]/(constants[39]+algebraic[5]); - algebraic[37] = exp(constants[45]*algebraic[21]/(2.0*computedConstants[3])); - algebraic[33] = exp(-constants[45]*algebraic[21]/(2.0*computedConstants[3])); - algebraic[38] = algebraic[5]/constants[43]*algebraic[5]/constants[44]*(1.0+algebraic[5]/constants[39])*exp(constants[45]*algebraic[21]/(2.0*computedConstants[3]))/algebraic[42]; - algebraic[26] = algebraic[37]*algebraic[36]*(algebraic[38]+algebraic[29])+algebraic[33]*algebraic[29]*(computedConstants[35]+algebraic[37]); - algebraic[34] = constants[4]/constants[51]*constants[4]/constants[52]*(1.0+constants[4]/constants[47])*exp(-constants[45]*algebraic[21]/(2.0*computedConstants[3]))/algebraic[50]; - algebraic[28] = algebraic[33]*computedConstants[35]*(algebraic[34]+algebraic[27])+algebraic[27]*algebraic[37]*(algebraic[36]+algebraic[33]); - algebraic[31] = algebraic[34]*computedConstants[35]*(algebraic[38]+algebraic[29])+algebraic[38]*algebraic[27]*(computedConstants[35]+algebraic[37]); - algebraic[32] = algebraic[38]*algebraic[36]*(algebraic[34]+algebraic[27])+algebraic[29]*algebraic[34]*(algebraic[36]+algebraic[33]); - algebraic[13] = (1.0-constants[25])*constants[30]*(algebraic[26]*algebraic[27]-algebraic[28]*algebraic[29])/(algebraic[28]+algebraic[26]+algebraic[32]+algebraic[31]); - rates[1] = (1.0-constants[11])*-1.0*(algebraic[12]+algebraic[16]+algebraic[15]+3.0*algebraic[14]+3.0*algebraic[13])/(1.0*(computedConstants[18]+computedConstants[19])*constants[17]); - algebraic[56] = constants[57]-(constants[57]-constants[58])/(1.0+pow(constants[59]/states[2], constants[60])); - algebraic[63] = constants[64]*algebraic[56]; - algebraic[61] = constants[62]/algebraic[56]; - rates[4] = constants[65]*states[5]-algebraic[63]*states[0]*states[4]-(algebraic[61]*pow(states[0], 2.0)*states[4]-constants[66]*states[3]); - rates[3] = algebraic[61]*pow(states[0], 2.0)*states[4]-constants[66]*states[3]-(algebraic[63]*states[0]*states[3]-constants[65]*states[6]); - rates[6] = algebraic[63]*states[0]*states[3]-constants[65]*states[6]-(constants[66]*states[6]-algebraic[61]*pow(states[0], 2.0)*states[5]); - rates[5] = constants[66]*states[6]-algebraic[61]*pow(states[0], 2.0)*states[5]-(constants[65]*states[5]-algebraic[63]*states[0]*states[4]); - algebraic[78] = constants[79]*states[7]*(1.0-states[9])-constants[80]*states[9]; - rates[9] = algebraic[78]; - algebraic[81] = constants[82]*states[7]*(1.0-(states[10]+states[11]))-constants[83]*states[10]; - rates[10] = algebraic[81]; - algebraic[84] = constants[85]*constants[86]*(1.0-(states[10]+states[11]))-constants[87]*states[11]; - rates[11] = algebraic[84]; - algebraic[88] = constants[89]*states[7]*(1.0-states[12])-constants[90]*states[12]; - rates[12] = algebraic[88]; - algebraic[91] = constants[89]*states[0]*(1.0-states[13])-constants[90]*states[13]; - rates[13] = algebraic[91]; - algebraic[92] = constants[93]*states[2]*(1.0-states[14])-constants[94]*states[14]; - rates[14] = algebraic[92]; - algebraic[71] = (states[0]-states[7])/constants[72]; - algebraic[73] = computedConstants[69]/(1.0+exp((-states[7]+constants[74])/constants[75])); - rates[7] = 1.0*(algebraic[71]*computedConstants[19]-algebraic[73]*computedConstants[99])/computedConstants[18]-(constants[97]*algebraic[88]+constants[95]*algebraic[78]+constants[96]*algebraic[81]); - algebraic[53] = constants[54]*states[3]*(states[2]-states[0]); - algebraic[101] = 2.0*constants[163]*(algebraic[21]-0.0)/(computedConstants[3]*(1.0-exp(-1.0*(algebraic[21]-0.0)*2.0/computedConstants[3])))*(states[0]-constants[10]*exp(-2.0*(algebraic[21]-0.0)/computedConstants[3]))*states[23]*states[22]*states[21]; - algebraic[102] = 2.0*constants[184]*algebraic[21]/(computedConstants[3]*(1.0-exp(-1.0*algebraic[21]*2.0/computedConstants[3])))*(states[0]-constants[10]*exp(-2.0*algebraic[21]/computedConstants[3]))*states[25]*states[24]; - rates[0] = algebraic[53]*computedConstants[100]/computedConstants[19]-((algebraic[101]+algebraic[102]-2.0*algebraic[13])/(2.0*constants[17]*computedConstants[19])+algebraic[71]+constants[97]*algebraic[91]); - algebraic[76] = (states[8]-states[2])/constants[77]; - rates[8] = algebraic[73]-algebraic[76]*computedConstants[100]/computedConstants[99]; - rates[2] = algebraic[76]-(algebraic[53]+constants[98]*algebraic[92]); - algebraic[136] = states[16]*computedConstants[134]*(algebraic[21]-computedConstants[6])*(1.0-constants[135]); - algebraic[111] = algebraic[16]+algebraic[136]; - algebraic[112] = constants[157]*states[20]*states[19]*(algebraic[21]-computedConstants[6]); - algebraic[113] = (constants[0] > 0.0)?constants[211]*constants[212]*(algebraic[21]-computedConstants[6])*(1.0+exp((algebraic[21]+20.0)/20.0))*states[32]:0.0; - algebraic[164] = 0.000365*constants[163]*(algebraic[21]-0.0)/(computedConstants[3]*(1.0-exp(-1.0*(algebraic[21]-0.0)/computedConstants[3])))*(constants[8]-constants[7]*exp(-1.0*(algebraic[21]-0.0)/computedConstants[3]))*states[23]*states[22]*states[21]; - algebraic[114] = (algebraic[101]+algebraic[164]+algebraic[15])*(1.0-computedConstants[165])*1.0*computedConstants[162]; - algebraic[115] = constants[190]*(algebraic[21]-computedConstants[6])*states[27]*states[26]; - algebraic[205] = computedConstants[3]*log((constants[7]+0.12*constants[4])/(constants[8]+0.12*algebraic[5])); - algebraic[116] = computedConstants[203]*(algebraic[21]-algebraic[205])*pow(states[31], 2.0); - algebraic[117] = constants[195]*(algebraic[21]-computedConstants[6])*(0.9*states[29]+0.1*states[30])*states[28]; - algebraic[110] = algebraic[111]+algebraic[117]+algebraic[116]+algebraic[115]+algebraic[14]+algebraic[13]+algebraic[12]+algebraic[114]+algebraic[102]+algebraic[113]+algebraic[112]; - rates[15] = -algebraic[110]/constants[118]; - algebraic[140] = (algebraic[21] < -(80.0-computedConstants[137]-computedConstants[138]-constants[141]))?0.01329+0.99921/(1.0+exp((algebraic[21]+97.134-computedConstants[137]-computedConstants[138]-constants[141])/8.1752)):0.0002501*exp(-(algebraic[21]-computedConstants[137]-computedConstants[138]-constants[141])/12.861); - algebraic[139] = 1.0/(0.36*(algebraic[21]+148.8-computedConstants[137]-computedConstants[138])/(exp(0.066*(algebraic[21]+148.8-computedConstants[137]-computedConstants[138]))-1.0)+0.1*(algebraic[21]+87.3-computedConstants[137]-computedConstants[138])/(1.0-exp(-0.2*(algebraic[21]+87.3-computedConstants[137]-computedConstants[138]))))-0.054; - rates[16] = (algebraic[140]-states[16])/algebraic[139]; - algebraic[147] = 1.0/(1.0+exp(-(algebraic[21]+42.0504)/8.3106)); - algebraic[148] = algebraic[21]+41.0; - algebraic[149] = (fabs(algebraic[148]) < constants[150])?2000.0:200.0*algebraic[148]/(1.0-exp(-0.1*algebraic[148])); - algebraic[151] = 8000.0*exp(-0.056*(algebraic[21]+66.0)); - algebraic[152] = 1.0/(algebraic[149]+algebraic[151]); - rates[18] = (algebraic[147]-states[18])/algebraic[152]; - algebraic[153] = 1.0/(1.0+exp((algebraic[21]+69.804)/4.4565)); - algebraic[154] = 20.0*exp(-0.125*(algebraic[21]+75.0)); - algebraic[155] = 2000.0/(320.0*exp(-0.1*(algebraic[21]+75.0))+1.0); - algebraic[156] = 1.0/(algebraic[154]+algebraic[155]); - rates[17] = (algebraic[153]-states[17])/algebraic[156]; - algebraic[158] = 1.0/(1.0+exp((algebraic[21]+6.0)/-8.6)); - algebraic[159] = 0.009/(1.0+exp((algebraic[21]+5.0)/12.0))+0.0005; - rates[20] = (algebraic[158]-states[20])/algebraic[159]; - algebraic[160] = 1.0/(1.0+exp((algebraic[21]+7.5)/10.0)); - algebraic[161] = 0.59/(1.0+exp((algebraic[21]+60.0)/10.0))+3.05; - rates[19] = (algebraic[160]-states[19])/algebraic[161]; - algebraic[168] = 1.0/(1.0+exp(-(algebraic[21]-constants[169]-computedConstants[166])/(constants[170]*(1.0+computedConstants[167]/100.0)))); - algebraic[174] = (algebraic[21] == -41.8)?-41.80001:(algebraic[21] == 0.0)?0.0:(algebraic[21] == -6.8)?-6.80001:algebraic[21]; - algebraic[172] = -0.02839*(algebraic[174]+41.8)/(exp(-(algebraic[174]+41.8)/2.5)-1.0)-0.0849*(algebraic[174]+6.8)/(exp(-(algebraic[174]+6.8)/4.8)-1.0); - algebraic[175] = (algebraic[21] == -1.8)?-1.80001:algebraic[21]; - algebraic[173] = 0.01143*(algebraic[175]+1.8)/(exp((algebraic[175]+1.8)/2.5)-1.0); - algebraic[171] = 0.001/(algebraic[172]+algebraic[173]); - rates[23] = (algebraic[168]-states[23])/algebraic[171]; - algebraic[176] = 1.0/(1.0+exp((algebraic[21]+37.4+constants[177])/(5.3+constants[178]))); - algebraic[179] = 0.001*(44.3+230.0*exp(-pow((algebraic[21]+36.0)/10.0, 2.0))); - rates[22] = (algebraic[176]-states[22])/algebraic[179]; - algebraic[180] = constants[181]/(constants[181]+states[0]); - algebraic[182] = 0.001*algebraic[180]/constants[183]; - rates[21] = (algebraic[180]-states[21])/algebraic[182]; - algebraic[185] = 1.0/(1.0+exp(-(algebraic[21]+38.3)/5.5)); - algebraic[186] = 0.001/(1.068*exp((algebraic[21]+38.3)/30.0)+1.068*exp(-(algebraic[21]+38.3)/30.0)); - rates[25] = (algebraic[185]-states[25])/algebraic[186]; - algebraic[187] = 1.0/(1.0+exp((algebraic[21]+58.7)/3.8)); - algebraic[188] = 1.0/(16.67*exp(-(algebraic[21]+75.0)/83.3)+16.67*exp((algebraic[21]+75.0)/15.38))+constants[189]; - rates[24] = (algebraic[187]-states[24])/algebraic[188]; - algebraic[191] = 1.0/(1.0+exp((algebraic[21]+49.0)/13.0)); - algebraic[192] = 0.001*0.6*(65.17/(0.57*exp(-0.08*(algebraic[21]+44.0))+0.065*exp(0.1*(algebraic[21]+45.93)))+10.1); - rates[27] = (algebraic[191]-states[27])/algebraic[192]; - algebraic[193] = 1.0/(1.0+exp(-(algebraic[21]-19.3)/15.0)); - algebraic[194] = 0.001*0.66*1.4*(15.59/(1.037*exp(0.09*(algebraic[21]+30.61))+0.369*exp(-0.12*(algebraic[21]+23.84)))+2.98); - rates[26] = (algebraic[193]-states[26])/algebraic[194]; - algebraic[198] = 1.0/(1.0+exp(-(algebraic[21]+10.0144)/7.6607)); - algebraic[199] = 0.84655354/(4.2*exp(algebraic[21]/17.0)+0.15*exp(-algebraic[21]/21.6)); - rates[30] = (algebraic[198]-states[30])/algebraic[199]; - algebraic[200] = 1.0/(30.0*exp(algebraic[21]/10.0)+exp(-algebraic[21]/12.0)); - rates[29] = (algebraic[198]-states[29])/algebraic[200]; - algebraic[202] = 1.0/(1.0+exp((algebraic[21]+28.6)/17.1)); - algebraic[201] = 1.0/(100.0*exp(-algebraic[21]/54.645)+656.0*exp(algebraic[21]/106.157)); - rates[28] = (algebraic[202]-states[28])/algebraic[201]; - algebraic[207] = sqrt(1.0/(1.0+exp(-(algebraic[21]+0.6383-computedConstants[206])/10.7071))); - algebraic[209] = 28.0/(1.0+exp(-(algebraic[21]-40.0-computedConstants[206])/3.0)); - algebraic[210] = 1.0*exp(-(algebraic[21]-computedConstants[206]-5.0)/25.0); - algebraic[208] = 1.0/(algebraic[209]+algebraic[210]); - rates[31] = (algebraic[207]-states[31])/algebraic[208]; - algebraic[214] = 10.0*exp(0.0133*(algebraic[21]+40.0)); - algebraic[215] = computedConstants[213]/(computedConstants[213]+algebraic[214]); - algebraic[216] = 1.0/(computedConstants[213]+algebraic[214]); - rates[32] = (algebraic[215]-states[32])/algebraic[216]; + algebraic[1] = states[1]; + algebraic[51] = computedConstants[0]*log((constants[2]+0.12*constants[3])/(algebraic[1]+0.12*constants[4])); + algebraic[47] = ((voi > constants[65]) && (voi < constants[65]+constants[66]))?constants[64]:constants[67]; + algebraic[8] = (constants[63] >= 1.0)?algebraic[47]:states[15]; + algebraic[52] = constants[73]*pow(states[18], 3.0)*states[17]*(algebraic[8]-algebraic[51]); + algebraic[53] = constants[74]*pow(states[18], 3.0)*(algebraic[8]-algebraic[51]); + algebraic[3] = algebraic[52]+algebraic[53]; + algebraic[6] = 0.0000185*constants[77]*(algebraic[8]-0.0)/(computedConstants[0]*(1.0-exp(-1.0*(algebraic[8]-0.0)/computedConstants[0])))*(algebraic[1]-constants[2]*exp(-1.0*(algebraic[8]-0.0)/computedConstants[0]))*states[23]*states[22]*states[21]; + algebraic[0] = computedConstants[0]*log(constants[2]/algebraic[1]); + algebraic[7] = states[16]*computedConstants[14]*(algebraic[8]-algebraic[0])*(1.0-constants[71]); + algebraic[5] = computedConstants[4]*constants[10]*pow(1.0+pow(constants[9]/constants[3], 1.2), -1.0)*pow(1.0+pow(constants[8]/algebraic[1], 1.3), -1.0)*pow(1.0+exp(-(algebraic[8]-algebraic[0]+110.0)/20.0), -1.0); + algebraic[21] = 1.0+constants[5]/constants[21]*(1.0+exp(constants[22]*algebraic[8]/computedConstants[0]))+constants[2]/constants[23]*(1.0+constants[2]/constants[24]*(1.0+constants[2]/constants[20])); + algebraic[10] = constants[5]/constants[21]*exp(constants[22]*algebraic[8]/computedConstants[0])/algebraic[21]; + algebraic[20] = 1.0+states[0]/constants[14]*(1.0+exp(-constants[15]*algebraic[8]/computedConstants[0])+algebraic[1]/constants[19])+algebraic[1]/constants[16]*(1.0+algebraic[1]/constants[17]*(1.0+algebraic[1]/constants[13])); + algebraic[12] = states[0]/constants[14]*exp(-constants[15]*algebraic[8]/computedConstants[0])/algebraic[20]; + algebraic[17] = algebraic[1]/(constants[13]+algebraic[1]); + algebraic[18] = exp(constants[18]*algebraic[8]/(2.0*computedConstants[0])); + algebraic[15] = exp(-constants[18]*algebraic[8]/(2.0*computedConstants[0])); + algebraic[19] = algebraic[1]/constants[16]*algebraic[1]/constants[17]*(1.0+algebraic[1]/constants[13])*exp(constants[18]*algebraic[8]/(2.0*computedConstants[0]))/algebraic[20]; + algebraic[9] = algebraic[18]*algebraic[17]*(algebraic[19]+algebraic[12])+algebraic[15]*algebraic[12]*(computedConstants[5]+algebraic[18]); + algebraic[16] = constants[2]/constants[23]*constants[2]/constants[24]*(1.0+constants[2]/constants[20])*exp(-constants[18]*algebraic[8]/(2.0*computedConstants[0]))/algebraic[21]; + algebraic[11] = algebraic[15]*computedConstants[5]*(algebraic[16]+algebraic[10])+algebraic[10]*algebraic[18]*(algebraic[17]+algebraic[15]); + algebraic[13] = algebraic[16]*computedConstants[5]*(algebraic[19]+algebraic[12])+algebraic[19]*algebraic[10]*(computedConstants[5]+algebraic[18]); + algebraic[14] = algebraic[19]*algebraic[17]*(algebraic[16]+algebraic[10])+algebraic[12]*algebraic[16]*(algebraic[17]+algebraic[15]); + algebraic[4] = (1.0-constants[11])*constants[12]*(algebraic[9]*algebraic[10]-algebraic[11]*algebraic[12])/(algebraic[11]+algebraic[9]+algebraic[14]+algebraic[13]); + rates[1] = (1.0-constants[6])*-1.0*(algebraic[3]+algebraic[7]+algebraic[6]+3.0*algebraic[5]+3.0*algebraic[4])/(1.0*(computedConstants[2]+computedConstants[3])*constants[7]); + algebraic[24] = constants[26]-(constants[26]-constants[27])/(1.0+pow(constants[28]/states[2], constants[29])); + algebraic[26] = constants[31]*algebraic[24]; + algebraic[25] = constants[30]/algebraic[24]; + rates[4] = constants[32]*states[5]-algebraic[26]*states[0]*states[4]-(algebraic[25]*pow(states[0], 2.0)*states[4]-constants[33]*states[3]); + rates[3] = algebraic[25]*pow(states[0], 2.0)*states[4]-constants[33]*states[3]-(algebraic[26]*states[0]*states[3]-constants[32]*states[6]); + rates[6] = algebraic[26]*states[0]*states[3]-constants[32]*states[6]-(constants[33]*states[6]-algebraic[25]*pow(states[0], 2.0)*states[5]); + rates[5] = constants[33]*states[6]-algebraic[25]*pow(states[0], 2.0)*states[5]-(constants[32]*states[5]-algebraic[26]*states[0]*states[4]); + algebraic[31] = constants[39]*states[7]*(1.0-states[9])-constants[40]*states[9]; + rates[9] = algebraic[31]; + algebraic[32] = constants[41]*states[7]*(1.0-(states[10]+states[11]))-constants[42]*states[10]; + rates[10] = algebraic[32]; + algebraic[33] = constants[43]*constants[44]*(1.0-(states[10]+states[11]))-constants[45]*states[11]; + rates[11] = algebraic[33]; + algebraic[34] = constants[46]*states[7]*(1.0-states[12])-constants[47]*states[12]; + rates[12] = algebraic[34]; + algebraic[35] = constants[46]*states[0]*(1.0-states[13])-constants[47]*states[13]; + rates[13] = algebraic[35]; + algebraic[36] = constants[48]*states[2]*(1.0-states[14])-constants[49]*states[14]; + rates[14] = algebraic[36]; + algebraic[28] = (states[0]-states[7])/constants[35]; + algebraic[29] = computedConstants[7]/(1.0+exp((-states[7]+constants[36])/constants[37])); + rates[7] = 1.0*(algebraic[28]*computedConstants[3]-algebraic[29]*computedConstants[8])/computedConstants[2]-(constants[52]*algebraic[34]+constants[50]*algebraic[31]+constants[51]*algebraic[32]); + algebraic[22] = constants[25]*states[3]*(states[2]-states[0]); + algebraic[37] = 2.0*constants[77]*(algebraic[8]-0.0)/(computedConstants[0]*(1.0-exp(-1.0*(algebraic[8]-0.0)*2.0/computedConstants[0])))*(states[0]-constants[5]*exp(-2.0*(algebraic[8]-0.0)/computedConstants[0]))*states[23]*states[22]*states[21]; + algebraic[38] = 2.0*constants[84]*algebraic[8]/(computedConstants[0]*(1.0-exp(-1.0*algebraic[8]*2.0/computedConstants[0])))*(states[0]-constants[5]*exp(-2.0*algebraic[8]/computedConstants[0]))*states[25]*states[24]; + rates[0] = algebraic[22]*computedConstants[9]/computedConstants[3]-((algebraic[37]+algebraic[38]-2.0*algebraic[4])/(2.0*constants[7]*computedConstants[3])+algebraic[28]+constants[52]*algebraic[35]); + algebraic[30] = (states[8]-states[2])/constants[38]; + rates[8] = algebraic[29]-algebraic[30]*computedConstants[9]/computedConstants[8]; + rates[2] = algebraic[30]-(algebraic[22]+constants[53]*algebraic[36]); + algebraic[48] = states[16]*computedConstants[15]*(algebraic[8]-computedConstants[1])*(1.0-constants[71]); + algebraic[40] = algebraic[7]+algebraic[48]; + algebraic[41] = constants[76]*states[20]*states[19]*(algebraic[8]-computedConstants[1]); + algebraic[42] = (constants[0] > 0.0)?constants[89]*constants[90]*(algebraic[8]-computedConstants[1])*(1.0+exp((algebraic[8]+20.0)/20.0))*states[32]:0.0; + algebraic[67] = 0.000365*constants[77]*(algebraic[8]-0.0)/(computedConstants[0]*(1.0-exp(-1.0*(algebraic[8]-0.0)/computedConstants[0])))*(constants[4]-constants[3]*exp(-1.0*(algebraic[8]-0.0)/computedConstants[0]))*states[23]*states[22]*states[21]; + algebraic[43] = (algebraic[37]+algebraic[67]+algebraic[6])*(1.0-computedConstants[19])*1.0*computedConstants[18]; + algebraic[44] = constants[86]*(algebraic[8]-computedConstants[1])*states[27]*states[26]; + algebraic[93] = computedConstants[0]*log((constants[3]+0.12*constants[2])/(constants[4]+0.12*algebraic[1])); + algebraic[45] = computedConstants[22]*(algebraic[8]-algebraic[93])*pow(states[31], 2.0); + algebraic[46] = constants[87]*(algebraic[8]-computedConstants[1])*(0.9*states[29]+0.1*states[30])*states[28]; + algebraic[39] = algebraic[40]+algebraic[46]+algebraic[45]+algebraic[44]+algebraic[5]+algebraic[4]+algebraic[3]+algebraic[43]+algebraic[38]+algebraic[42]+algebraic[41]; + rates[15] = -algebraic[39]/constants[60]; + algebraic[50] = (algebraic[8] < -(80.0-computedConstants[16]-computedConstants[17]-constants[72]))?0.01329+0.99921/(1.0+exp((algebraic[8]+97.134-computedConstants[16]-computedConstants[17]-constants[72])/8.1752)):0.0002501*exp(-(algebraic[8]-computedConstants[16]-computedConstants[17]-constants[72])/12.861); + algebraic[49] = 1.0/(0.36*(algebraic[8]+148.8-computedConstants[16]-computedConstants[17])/(exp(0.066*(algebraic[8]+148.8-computedConstants[16]-computedConstants[17]))-1.0)+0.1*(algebraic[8]+87.3-computedConstants[16]-computedConstants[17])/(1.0-exp(-0.2*(algebraic[8]+87.3-computedConstants[16]-computedConstants[17]))))-0.054; + rates[16] = (algebraic[50]-states[16])/algebraic[49]; + algebraic[54] = 1.0/(1.0+exp(-(algebraic[8]+42.0504)/8.3106)); + algebraic[55] = algebraic[8]+41.0; + algebraic[56] = (fabs(algebraic[55]) < constants[75])?2000.0:200.0*algebraic[55]/(1.0-exp(-0.1*algebraic[55])); + algebraic[57] = 8000.0*exp(-0.056*(algebraic[8]+66.0)); + algebraic[58] = 1.0/(algebraic[56]+algebraic[57]); + rates[18] = (algebraic[54]-states[18])/algebraic[58]; + algebraic[59] = 1.0/(1.0+exp((algebraic[8]+69.804)/4.4565)); + algebraic[60] = 20.0*exp(-0.125*(algebraic[8]+75.0)); + algebraic[61] = 2000.0/(320.0*exp(-0.1*(algebraic[8]+75.0))+1.0); + algebraic[62] = 1.0/(algebraic[60]+algebraic[61]); + rates[17] = (algebraic[59]-states[17])/algebraic[62]; + algebraic[63] = 1.0/(1.0+exp((algebraic[8]+6.0)/-8.6)); + algebraic[64] = 0.009/(1.0+exp((algebraic[8]+5.0)/12.0))+0.0005; + rates[20] = (algebraic[63]-states[20])/algebraic[64]; + algebraic[65] = 1.0/(1.0+exp((algebraic[8]+7.5)/10.0)); + algebraic[66] = 0.59/(1.0+exp((algebraic[8]+60.0)/10.0))+3.05; + rates[19] = (algebraic[65]-states[19])/algebraic[66]; + algebraic[68] = 1.0/(1.0+exp(-(algebraic[8]-constants[78]-computedConstants[20])/(constants[79]*(1.0+computedConstants[21]/100.0)))); + algebraic[72] = (algebraic[8] == -41.8)?-41.80001:(algebraic[8] == 0.0)?0.0:(algebraic[8] == -6.8)?-6.80001:algebraic[8]; + algebraic[70] = -0.02839*(algebraic[72]+41.8)/(exp(-(algebraic[72]+41.8)/2.5)-1.0)-0.0849*(algebraic[72]+6.8)/(exp(-(algebraic[72]+6.8)/4.8)-1.0); + algebraic[73] = (algebraic[8] == -1.8)?-1.80001:algebraic[8]; + algebraic[71] = 0.01143*(algebraic[73]+1.8)/(exp((algebraic[73]+1.8)/2.5)-1.0); + algebraic[69] = 0.001/(algebraic[70]+algebraic[71]); + rates[23] = (algebraic[68]-states[23])/algebraic[69]; + algebraic[74] = 1.0/(1.0+exp((algebraic[8]+37.4+constants[80])/(5.3+constants[81]))); + algebraic[75] = 0.001*(44.3+230.0*exp(-pow((algebraic[8]+36.0)/10.0, 2.0))); + rates[22] = (algebraic[74]-states[22])/algebraic[75]; + algebraic[76] = constants[82]/(constants[82]+states[0]); + algebraic[77] = 0.001*algebraic[76]/constants[83]; + rates[21] = (algebraic[76]-states[21])/algebraic[77]; + algebraic[78] = 1.0/(1.0+exp(-(algebraic[8]+38.3)/5.5)); + algebraic[79] = 0.001/(1.068*exp((algebraic[8]+38.3)/30.0)+1.068*exp(-(algebraic[8]+38.3)/30.0)); + rates[25] = (algebraic[78]-states[25])/algebraic[79]; + algebraic[80] = 1.0/(1.0+exp((algebraic[8]+58.7)/3.8)); + algebraic[81] = 1.0/(16.67*exp(-(algebraic[8]+75.0)/83.3)+16.67*exp((algebraic[8]+75.0)/15.38))+constants[85]; + rates[24] = (algebraic[80]-states[24])/algebraic[81]; + algebraic[82] = 1.0/(1.0+exp((algebraic[8]+49.0)/13.0)); + algebraic[83] = 0.001*0.6*(65.17/(0.57*exp(-0.08*(algebraic[8]+44.0))+0.065*exp(0.1*(algebraic[8]+45.93)))+10.1); + rates[27] = (algebraic[82]-states[27])/algebraic[83]; + algebraic[84] = 1.0/(1.0+exp(-(algebraic[8]-19.3)/15.0)); + algebraic[85] = 0.001*0.66*1.4*(15.59/(1.037*exp(0.09*(algebraic[8]+30.61))+0.369*exp(-0.12*(algebraic[8]+23.84)))+2.98); + rates[26] = (algebraic[84]-states[26])/algebraic[85]; + algebraic[88] = 1.0/(1.0+exp(-(algebraic[8]+10.0144)/7.6607)); + algebraic[89] = 0.84655354/(4.2*exp(algebraic[8]/17.0)+0.15*exp(-algebraic[8]/21.6)); + rates[30] = (algebraic[88]-states[30])/algebraic[89]; + algebraic[90] = 1.0/(30.0*exp(algebraic[8]/10.0)+exp(-algebraic[8]/12.0)); + rates[29] = (algebraic[88]-states[29])/algebraic[90]; + algebraic[92] = 1.0/(1.0+exp((algebraic[8]+28.6)/17.1)); + algebraic[91] = 1.0/(100.0*exp(-algebraic[8]/54.645)+656.0*exp(algebraic[8]/106.157)); + rates[28] = (algebraic[92]-states[28])/algebraic[91]; + algebraic[94] = sqrt(1.0/(1.0+exp(-(algebraic[8]+0.6383-computedConstants[23])/10.7071))); + algebraic[96] = 28.0/(1.0+exp(-(algebraic[8]-40.0-computedConstants[23])/3.0)); + algebraic[97] = 1.0*exp(-(algebraic[8]-computedConstants[23]-5.0)/25.0); + algebraic[95] = 1.0/(algebraic[96]+algebraic[97]); + rates[31] = (algebraic[94]-states[31])/algebraic[95]; + algebraic[98] = 10.0*exp(0.0133*(algebraic[8]+40.0)); + algebraic[99] = computedConstants[24]/(computedConstants[24]+algebraic[98]); + algebraic[100] = 1.0/(computedConstants[24]+algebraic[98]); + rates[32] = (algebraic[99]-states[32])/algebraic[100]; } void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { - algebraic[5] = states[1]; - algebraic[2] = computedConstants[3]*log(constants[4]/algebraic[5]); - algebraic[9] = 0.5*computedConstants[3]*log(constants[10]/states[0]); - algebraic[21] = (constants[122] >= 1.0)?algebraic[121]:states[15]; - algebraic[14] = computedConstants[20]*constants[24]*pow(1.0+pow(constants[23]/constants[7], 1.2), -1.0)*pow(1.0+pow(constants[22]/algebraic[5], 1.3), -1.0)*pow(1.0+exp(-(algebraic[21]-algebraic[2]+110.0)/20.0), -1.0); - algebraic[50] = 1.0+constants[10]/constants[48]*(1.0+exp(constants[49]*algebraic[21]/computedConstants[3]))+constants[4]/constants[51]*(1.0+constants[4]/constants[52]*(1.0+constants[4]/constants[47])); - algebraic[27] = constants[10]/constants[48]*exp(constants[49]*algebraic[21]/computedConstants[3])/algebraic[50]; - algebraic[42] = 1.0+states[0]/constants[40]*(1.0+exp(-constants[41]*algebraic[21]/computedConstants[3])+algebraic[5]/constants[46])+algebraic[5]/constants[43]*(1.0+algebraic[5]/constants[44]*(1.0+algebraic[5]/constants[39])); - algebraic[29] = states[0]/constants[40]*exp(-constants[41]*algebraic[21]/computedConstants[3])/algebraic[42]; - algebraic[36] = algebraic[5]/(constants[39]+algebraic[5]); - algebraic[37] = exp(constants[45]*algebraic[21]/(2.0*computedConstants[3])); - algebraic[33] = exp(-constants[45]*algebraic[21]/(2.0*computedConstants[3])); - algebraic[38] = algebraic[5]/constants[43]*algebraic[5]/constants[44]*(1.0+algebraic[5]/constants[39])*exp(constants[45]*algebraic[21]/(2.0*computedConstants[3]))/algebraic[42]; - algebraic[26] = algebraic[37]*algebraic[36]*(algebraic[38]+algebraic[29])+algebraic[33]*algebraic[29]*(computedConstants[35]+algebraic[37]); - algebraic[34] = constants[4]/constants[51]*constants[4]/constants[52]*(1.0+constants[4]/constants[47])*exp(-constants[45]*algebraic[21]/(2.0*computedConstants[3]))/algebraic[50]; - algebraic[28] = algebraic[33]*computedConstants[35]*(algebraic[34]+algebraic[27])+algebraic[27]*algebraic[37]*(algebraic[36]+algebraic[33]); - algebraic[31] = algebraic[34]*computedConstants[35]*(algebraic[38]+algebraic[29])+algebraic[38]*algebraic[27]*(computedConstants[35]+algebraic[37]); - algebraic[32] = algebraic[38]*algebraic[36]*(algebraic[34]+algebraic[27])+algebraic[29]*algebraic[34]*(algebraic[36]+algebraic[33]); - algebraic[13] = (1.0-constants[25])*constants[30]*(algebraic[26]*algebraic[27]-algebraic[28]*algebraic[29])/(algebraic[28]+algebraic[26]+algebraic[32]+algebraic[31]); - algebraic[53] = constants[54]*states[3]*(states[2]-states[0]); - algebraic[55] = states[2]-states[0]; - algebraic[56] = constants[57]-(constants[57]-constants[58])/(1.0+pow(constants[59]/states[2], constants[60])); - algebraic[61] = constants[62]/algebraic[56]; - algebraic[63] = constants[64]*algebraic[56]; - algebraic[67] = states[4]+states[3]+states[6]+states[5]; - algebraic[71] = (states[0]-states[7])/constants[72]; - algebraic[73] = computedConstants[69]/(1.0+exp((-states[7]+constants[74])/constants[75])); - algebraic[76] = (states[8]-states[2])/constants[77]; - algebraic[78] = constants[79]*states[7]*(1.0-states[9])-constants[80]*states[9]; - algebraic[81] = constants[82]*states[7]*(1.0-(states[10]+states[11]))-constants[83]*states[10]; - algebraic[84] = constants[85]*constants[86]*(1.0-(states[10]+states[11]))-constants[87]*states[11]; - algebraic[88] = constants[89]*states[7]*(1.0-states[12])-constants[90]*states[12]; - algebraic[91] = constants[89]*states[0]*(1.0-states[13])-constants[90]*states[13]; - algebraic[92] = constants[93]*states[2]*(1.0-states[14])-constants[94]*states[14]; - algebraic[16] = states[16]*computedConstants[133]*(algebraic[21]-algebraic[2])*(1.0-constants[135]); - algebraic[136] = states[16]*computedConstants[134]*(algebraic[21]-computedConstants[6])*(1.0-constants[135]); - algebraic[111] = algebraic[16]+algebraic[136]; - algebraic[112] = constants[157]*states[20]*states[19]*(algebraic[21]-computedConstants[6]); - algebraic[113] = (constants[0] > 0.0)?constants[211]*constants[212]*(algebraic[21]-computedConstants[6])*(1.0+exp((algebraic[21]+20.0)/20.0))*states[32]:0.0; - algebraic[102] = 2.0*constants[184]*algebraic[21]/(computedConstants[3]*(1.0-exp(-1.0*algebraic[21]*2.0/computedConstants[3])))*(states[0]-constants[10]*exp(-2.0*algebraic[21]/computedConstants[3]))*states[25]*states[24]; - algebraic[101] = 2.0*constants[163]*(algebraic[21]-0.0)/(computedConstants[3]*(1.0-exp(-1.0*(algebraic[21]-0.0)*2.0/computedConstants[3])))*(states[0]-constants[10]*exp(-2.0*(algebraic[21]-0.0)/computedConstants[3]))*states[23]*states[22]*states[21]; - algebraic[15] = 0.0000185*constants[163]*(algebraic[21]-0.0)/(computedConstants[3]*(1.0-exp(-1.0*(algebraic[21]-0.0)/computedConstants[3])))*(algebraic[5]-constants[4]*exp(-1.0*(algebraic[21]-0.0)/computedConstants[3]))*states[23]*states[22]*states[21]; - algebraic[164] = 0.000365*constants[163]*(algebraic[21]-0.0)/(computedConstants[3]*(1.0-exp(-1.0*(algebraic[21]-0.0)/computedConstants[3])))*(constants[8]-constants[7]*exp(-1.0*(algebraic[21]-0.0)/computedConstants[3]))*states[23]*states[22]*states[21]; - algebraic[114] = (algebraic[101]+algebraic[164]+algebraic[15])*(1.0-computedConstants[165])*1.0*computedConstants[162]; - algebraic[142] = computedConstants[3]*log((constants[4]+0.12*constants[7])/(algebraic[5]+0.12*constants[8])); - algebraic[143] = constants[144]*pow(states[18], 3.0)*states[17]*(algebraic[21]-algebraic[142]); - algebraic[145] = constants[146]*pow(states[18], 3.0)*(algebraic[21]-algebraic[142]); - algebraic[12] = algebraic[143]+algebraic[145]; - algebraic[115] = constants[190]*(algebraic[21]-computedConstants[6])*states[27]*states[26]; - algebraic[205] = computedConstants[3]*log((constants[7]+0.12*constants[4])/(constants[8]+0.12*algebraic[5])); - algebraic[116] = computedConstants[203]*(algebraic[21]-algebraic[205])*pow(states[31], 2.0); - algebraic[117] = constants[195]*(algebraic[21]-computedConstants[6])*(0.9*states[29]+0.1*states[30])*states[28]; - algebraic[110] = algebraic[111]+algebraic[117]+algebraic[116]+algebraic[115]+algebraic[14]+algebraic[13]+algebraic[12]+algebraic[114]+algebraic[102]+algebraic[113]+algebraic[112]; - algebraic[139] = 1.0/(0.36*(algebraic[21]+148.8-computedConstants[137]-computedConstants[138])/(exp(0.066*(algebraic[21]+148.8-computedConstants[137]-computedConstants[138]))-1.0)+0.1*(algebraic[21]+87.3-computedConstants[137]-computedConstants[138])/(1.0-exp(-0.2*(algebraic[21]+87.3-computedConstants[137]-computedConstants[138]))))-0.054; - algebraic[140] = (algebraic[21] < -(80.0-computedConstants[137]-computedConstants[138]-constants[141]))?0.01329+0.99921/(1.0+exp((algebraic[21]+97.134-computedConstants[137]-computedConstants[138]-constants[141])/8.1752)):0.0002501*exp(-(algebraic[21]-computedConstants[137]-computedConstants[138]-constants[141])/12.861); - algebraic[147] = 1.0/(1.0+exp(-(algebraic[21]+42.0504)/8.3106)); - algebraic[148] = algebraic[21]+41.0; - algebraic[149] = (fabs(algebraic[148]) < constants[150])?2000.0:200.0*algebraic[148]/(1.0-exp(-0.1*algebraic[148])); - algebraic[151] = 8000.0*exp(-0.056*(algebraic[21]+66.0)); - algebraic[152] = 1.0/(algebraic[149]+algebraic[151]); - algebraic[153] = 1.0/(1.0+exp((algebraic[21]+69.804)/4.4565)); - algebraic[154] = 20.0*exp(-0.125*(algebraic[21]+75.0)); - algebraic[155] = 2000.0/(320.0*exp(-0.1*(algebraic[21]+75.0))+1.0); - algebraic[156] = 1.0/(algebraic[154]+algebraic[155]); - algebraic[158] = 1.0/(1.0+exp((algebraic[21]+6.0)/-8.6)); - algebraic[159] = 0.009/(1.0+exp((algebraic[21]+5.0)/12.0))+0.0005; - algebraic[160] = 1.0/(1.0+exp((algebraic[21]+7.5)/10.0)); - algebraic[161] = 0.59/(1.0+exp((algebraic[21]+60.0)/10.0))+3.05; - algebraic[168] = 1.0/(1.0+exp(-(algebraic[21]-constants[169]-computedConstants[166])/(constants[170]*(1.0+computedConstants[167]/100.0)))); - algebraic[174] = (algebraic[21] == -41.8)?-41.80001:(algebraic[21] == 0.0)?0.0:(algebraic[21] == -6.8)?-6.80001:algebraic[21]; - algebraic[172] = -0.02839*(algebraic[174]+41.8)/(exp(-(algebraic[174]+41.8)/2.5)-1.0)-0.0849*(algebraic[174]+6.8)/(exp(-(algebraic[174]+6.8)/4.8)-1.0); - algebraic[175] = (algebraic[21] == -1.8)?-1.80001:algebraic[21]; - algebraic[173] = 0.01143*(algebraic[175]+1.8)/(exp((algebraic[175]+1.8)/2.5)-1.0); - algebraic[171] = 0.001/(algebraic[172]+algebraic[173]); - algebraic[176] = 1.0/(1.0+exp((algebraic[21]+37.4+constants[177])/(5.3+constants[178]))); - algebraic[179] = 0.001*(44.3+230.0*exp(-pow((algebraic[21]+36.0)/10.0, 2.0))); - algebraic[180] = constants[181]/(constants[181]+states[0]); - algebraic[182] = 0.001*algebraic[180]/constants[183]; - algebraic[185] = 1.0/(1.0+exp(-(algebraic[21]+38.3)/5.5)); - algebraic[186] = 0.001/(1.068*exp((algebraic[21]+38.3)/30.0)+1.068*exp(-(algebraic[21]+38.3)/30.0)); - algebraic[187] = 1.0/(1.0+exp((algebraic[21]+58.7)/3.8)); - algebraic[188] = 1.0/(16.67*exp(-(algebraic[21]+75.0)/83.3)+16.67*exp((algebraic[21]+75.0)/15.38))+constants[189]; - algebraic[191] = 1.0/(1.0+exp((algebraic[21]+49.0)/13.0)); - algebraic[192] = 0.001*0.6*(65.17/(0.57*exp(-0.08*(algebraic[21]+44.0))+0.065*exp(0.1*(algebraic[21]+45.93)))+10.1); - algebraic[193] = 1.0/(1.0+exp(-(algebraic[21]-19.3)/15.0)); - algebraic[194] = 0.001*0.66*1.4*(15.59/(1.037*exp(0.09*(algebraic[21]+30.61))+0.369*exp(-0.12*(algebraic[21]+23.84)))+2.98); - algebraic[196] = 1.0/(1.0+exp(-(algebraic[21]+23.2)/6.6))/(0.84655354/(37.2*exp(algebraic[21]/11.9)+0.96*exp(-algebraic[21]/18.5))); - algebraic[197] = 4.0*((37.2*exp(algebraic[21]/15.9)+0.96*exp(-algebraic[21]/22.5))/0.84655354-1.0/(1.0+exp(-(algebraic[21]+23.2)/10.6))/(0.84655354/(37.2*exp(algebraic[21]/15.9)+0.96*exp(-algebraic[21]/22.5)))); - algebraic[198] = 1.0/(1.0+exp(-(algebraic[21]+10.0144)/7.6607)); - algebraic[199] = 0.84655354/(4.2*exp(algebraic[21]/17.0)+0.15*exp(-algebraic[21]/21.6)); - algebraic[200] = 1.0/(30.0*exp(algebraic[21]/10.0)+exp(-algebraic[21]/12.0)); - algebraic[201] = 1.0/(100.0*exp(-algebraic[21]/54.645)+656.0*exp(algebraic[21]/106.157)); - algebraic[202] = 1.0/(1.0+exp((algebraic[21]+28.6)/17.1)); - algebraic[207] = sqrt(1.0/(1.0+exp(-(algebraic[21]+0.6383-computedConstants[206])/10.7071))); - algebraic[209] = 28.0/(1.0+exp(-(algebraic[21]-40.0-computedConstants[206])/3.0)); - algebraic[210] = 1.0*exp(-(algebraic[21]-computedConstants[206]-5.0)/25.0); - algebraic[208] = 1.0/(algebraic[209]+algebraic[210]); - algebraic[214] = 10.0*exp(0.0133*(algebraic[21]+40.0)); - algebraic[215] = computedConstants[213]/(computedConstants[213]+algebraic[214]); - algebraic[216] = 1.0/(computedConstants[213]+algebraic[214]); + algebraic[1] = states[1]; + algebraic[0] = computedConstants[0]*log(constants[2]/algebraic[1]); + algebraic[2] = 0.5*computedConstants[0]*log(constants[5]/states[0]); + algebraic[8] = (constants[63] >= 1.0)?algebraic[47]:states[15]; + algebraic[5] = computedConstants[4]*constants[10]*pow(1.0+pow(constants[9]/constants[3], 1.2), -1.0)*pow(1.0+pow(constants[8]/algebraic[1], 1.3), -1.0)*pow(1.0+exp(-(algebraic[8]-algebraic[0]+110.0)/20.0), -1.0); + algebraic[21] = 1.0+constants[5]/constants[21]*(1.0+exp(constants[22]*algebraic[8]/computedConstants[0]))+constants[2]/constants[23]*(1.0+constants[2]/constants[24]*(1.0+constants[2]/constants[20])); + algebraic[10] = constants[5]/constants[21]*exp(constants[22]*algebraic[8]/computedConstants[0])/algebraic[21]; + algebraic[20] = 1.0+states[0]/constants[14]*(1.0+exp(-constants[15]*algebraic[8]/computedConstants[0])+algebraic[1]/constants[19])+algebraic[1]/constants[16]*(1.0+algebraic[1]/constants[17]*(1.0+algebraic[1]/constants[13])); + algebraic[12] = states[0]/constants[14]*exp(-constants[15]*algebraic[8]/computedConstants[0])/algebraic[20]; + algebraic[17] = algebraic[1]/(constants[13]+algebraic[1]); + algebraic[18] = exp(constants[18]*algebraic[8]/(2.0*computedConstants[0])); + algebraic[15] = exp(-constants[18]*algebraic[8]/(2.0*computedConstants[0])); + algebraic[19] = algebraic[1]/constants[16]*algebraic[1]/constants[17]*(1.0+algebraic[1]/constants[13])*exp(constants[18]*algebraic[8]/(2.0*computedConstants[0]))/algebraic[20]; + algebraic[9] = algebraic[18]*algebraic[17]*(algebraic[19]+algebraic[12])+algebraic[15]*algebraic[12]*(computedConstants[5]+algebraic[18]); + algebraic[16] = constants[2]/constants[23]*constants[2]/constants[24]*(1.0+constants[2]/constants[20])*exp(-constants[18]*algebraic[8]/(2.0*computedConstants[0]))/algebraic[21]; + algebraic[11] = algebraic[15]*computedConstants[5]*(algebraic[16]+algebraic[10])+algebraic[10]*algebraic[18]*(algebraic[17]+algebraic[15]); + algebraic[13] = algebraic[16]*computedConstants[5]*(algebraic[19]+algebraic[12])+algebraic[19]*algebraic[10]*(computedConstants[5]+algebraic[18]); + algebraic[14] = algebraic[19]*algebraic[17]*(algebraic[16]+algebraic[10])+algebraic[12]*algebraic[16]*(algebraic[17]+algebraic[15]); + algebraic[4] = (1.0-constants[11])*constants[12]*(algebraic[9]*algebraic[10]-algebraic[11]*algebraic[12])/(algebraic[11]+algebraic[9]+algebraic[14]+algebraic[13]); + algebraic[22] = constants[25]*states[3]*(states[2]-states[0]); + algebraic[23] = states[2]-states[0]; + algebraic[24] = constants[26]-(constants[26]-constants[27])/(1.0+pow(constants[28]/states[2], constants[29])); + algebraic[25] = constants[30]/algebraic[24]; + algebraic[26] = constants[31]*algebraic[24]; + algebraic[27] = states[4]+states[3]+states[6]+states[5]; + algebraic[28] = (states[0]-states[7])/constants[35]; + algebraic[29] = computedConstants[7]/(1.0+exp((-states[7]+constants[36])/constants[37])); + algebraic[30] = (states[8]-states[2])/constants[38]; + algebraic[31] = constants[39]*states[7]*(1.0-states[9])-constants[40]*states[9]; + algebraic[32] = constants[41]*states[7]*(1.0-(states[10]+states[11]))-constants[42]*states[10]; + algebraic[33] = constants[43]*constants[44]*(1.0-(states[10]+states[11]))-constants[45]*states[11]; + algebraic[34] = constants[46]*states[7]*(1.0-states[12])-constants[47]*states[12]; + algebraic[35] = constants[46]*states[0]*(1.0-states[13])-constants[47]*states[13]; + algebraic[36] = constants[48]*states[2]*(1.0-states[14])-constants[49]*states[14]; + algebraic[7] = states[16]*computedConstants[14]*(algebraic[8]-algebraic[0])*(1.0-constants[71]); + algebraic[48] = states[16]*computedConstants[15]*(algebraic[8]-computedConstants[1])*(1.0-constants[71]); + algebraic[40] = algebraic[7]+algebraic[48]; + algebraic[41] = constants[76]*states[20]*states[19]*(algebraic[8]-computedConstants[1]); + algebraic[42] = (constants[0] > 0.0)?constants[89]*constants[90]*(algebraic[8]-computedConstants[1])*(1.0+exp((algebraic[8]+20.0)/20.0))*states[32]:0.0; + algebraic[38] = 2.0*constants[84]*algebraic[8]/(computedConstants[0]*(1.0-exp(-1.0*algebraic[8]*2.0/computedConstants[0])))*(states[0]-constants[5]*exp(-2.0*algebraic[8]/computedConstants[0]))*states[25]*states[24]; + algebraic[37] = 2.0*constants[77]*(algebraic[8]-0.0)/(computedConstants[0]*(1.0-exp(-1.0*(algebraic[8]-0.0)*2.0/computedConstants[0])))*(states[0]-constants[5]*exp(-2.0*(algebraic[8]-0.0)/computedConstants[0]))*states[23]*states[22]*states[21]; + algebraic[6] = 0.0000185*constants[77]*(algebraic[8]-0.0)/(computedConstants[0]*(1.0-exp(-1.0*(algebraic[8]-0.0)/computedConstants[0])))*(algebraic[1]-constants[2]*exp(-1.0*(algebraic[8]-0.0)/computedConstants[0]))*states[23]*states[22]*states[21]; + algebraic[67] = 0.000365*constants[77]*(algebraic[8]-0.0)/(computedConstants[0]*(1.0-exp(-1.0*(algebraic[8]-0.0)/computedConstants[0])))*(constants[4]-constants[3]*exp(-1.0*(algebraic[8]-0.0)/computedConstants[0]))*states[23]*states[22]*states[21]; + algebraic[43] = (algebraic[37]+algebraic[67]+algebraic[6])*(1.0-computedConstants[19])*1.0*computedConstants[18]; + algebraic[51] = computedConstants[0]*log((constants[2]+0.12*constants[3])/(algebraic[1]+0.12*constants[4])); + algebraic[52] = constants[73]*pow(states[18], 3.0)*states[17]*(algebraic[8]-algebraic[51]); + algebraic[53] = constants[74]*pow(states[18], 3.0)*(algebraic[8]-algebraic[51]); + algebraic[3] = algebraic[52]+algebraic[53]; + algebraic[44] = constants[86]*(algebraic[8]-computedConstants[1])*states[27]*states[26]; + algebraic[93] = computedConstants[0]*log((constants[3]+0.12*constants[2])/(constants[4]+0.12*algebraic[1])); + algebraic[45] = computedConstants[22]*(algebraic[8]-algebraic[93])*pow(states[31], 2.0); + algebraic[46] = constants[87]*(algebraic[8]-computedConstants[1])*(0.9*states[29]+0.1*states[30])*states[28]; + algebraic[39] = algebraic[40]+algebraic[46]+algebraic[45]+algebraic[44]+algebraic[5]+algebraic[4]+algebraic[3]+algebraic[43]+algebraic[38]+algebraic[42]+algebraic[41]; + algebraic[49] = 1.0/(0.36*(algebraic[8]+148.8-computedConstants[16]-computedConstants[17])/(exp(0.066*(algebraic[8]+148.8-computedConstants[16]-computedConstants[17]))-1.0)+0.1*(algebraic[8]+87.3-computedConstants[16]-computedConstants[17])/(1.0-exp(-0.2*(algebraic[8]+87.3-computedConstants[16]-computedConstants[17]))))-0.054; + algebraic[50] = (algebraic[8] < -(80.0-computedConstants[16]-computedConstants[17]-constants[72]))?0.01329+0.99921/(1.0+exp((algebraic[8]+97.134-computedConstants[16]-computedConstants[17]-constants[72])/8.1752)):0.0002501*exp(-(algebraic[8]-computedConstants[16]-computedConstants[17]-constants[72])/12.861); + algebraic[54] = 1.0/(1.0+exp(-(algebraic[8]+42.0504)/8.3106)); + algebraic[55] = algebraic[8]+41.0; + algebraic[56] = (fabs(algebraic[55]) < constants[75])?2000.0:200.0*algebraic[55]/(1.0-exp(-0.1*algebraic[55])); + algebraic[57] = 8000.0*exp(-0.056*(algebraic[8]+66.0)); + algebraic[58] = 1.0/(algebraic[56]+algebraic[57]); + algebraic[59] = 1.0/(1.0+exp((algebraic[8]+69.804)/4.4565)); + algebraic[60] = 20.0*exp(-0.125*(algebraic[8]+75.0)); + algebraic[61] = 2000.0/(320.0*exp(-0.1*(algebraic[8]+75.0))+1.0); + algebraic[62] = 1.0/(algebraic[60]+algebraic[61]); + algebraic[63] = 1.0/(1.0+exp((algebraic[8]+6.0)/-8.6)); + algebraic[64] = 0.009/(1.0+exp((algebraic[8]+5.0)/12.0))+0.0005; + algebraic[65] = 1.0/(1.0+exp((algebraic[8]+7.5)/10.0)); + algebraic[66] = 0.59/(1.0+exp((algebraic[8]+60.0)/10.0))+3.05; + algebraic[68] = 1.0/(1.0+exp(-(algebraic[8]-constants[78]-computedConstants[20])/(constants[79]*(1.0+computedConstants[21]/100.0)))); + algebraic[72] = (algebraic[8] == -41.8)?-41.80001:(algebraic[8] == 0.0)?0.0:(algebraic[8] == -6.8)?-6.80001:algebraic[8]; + algebraic[70] = -0.02839*(algebraic[72]+41.8)/(exp(-(algebraic[72]+41.8)/2.5)-1.0)-0.0849*(algebraic[72]+6.8)/(exp(-(algebraic[72]+6.8)/4.8)-1.0); + algebraic[73] = (algebraic[8] == -1.8)?-1.80001:algebraic[8]; + algebraic[71] = 0.01143*(algebraic[73]+1.8)/(exp((algebraic[73]+1.8)/2.5)-1.0); + algebraic[69] = 0.001/(algebraic[70]+algebraic[71]); + algebraic[74] = 1.0/(1.0+exp((algebraic[8]+37.4+constants[80])/(5.3+constants[81]))); + algebraic[75] = 0.001*(44.3+230.0*exp(-pow((algebraic[8]+36.0)/10.0, 2.0))); + algebraic[76] = constants[82]/(constants[82]+states[0]); + algebraic[77] = 0.001*algebraic[76]/constants[83]; + algebraic[78] = 1.0/(1.0+exp(-(algebraic[8]+38.3)/5.5)); + algebraic[79] = 0.001/(1.068*exp((algebraic[8]+38.3)/30.0)+1.068*exp(-(algebraic[8]+38.3)/30.0)); + algebraic[80] = 1.0/(1.0+exp((algebraic[8]+58.7)/3.8)); + algebraic[81] = 1.0/(16.67*exp(-(algebraic[8]+75.0)/83.3)+16.67*exp((algebraic[8]+75.0)/15.38))+constants[85]; + algebraic[82] = 1.0/(1.0+exp((algebraic[8]+49.0)/13.0)); + algebraic[83] = 0.001*0.6*(65.17/(0.57*exp(-0.08*(algebraic[8]+44.0))+0.065*exp(0.1*(algebraic[8]+45.93)))+10.1); + algebraic[84] = 1.0/(1.0+exp(-(algebraic[8]-19.3)/15.0)); + algebraic[85] = 0.001*0.66*1.4*(15.59/(1.037*exp(0.09*(algebraic[8]+30.61))+0.369*exp(-0.12*(algebraic[8]+23.84)))+2.98); + algebraic[86] = 1.0/(1.0+exp(-(algebraic[8]+23.2)/6.6))/(0.84655354/(37.2*exp(algebraic[8]/11.9)+0.96*exp(-algebraic[8]/18.5))); + algebraic[87] = 4.0*((37.2*exp(algebraic[8]/15.9)+0.96*exp(-algebraic[8]/22.5))/0.84655354-1.0/(1.0+exp(-(algebraic[8]+23.2)/10.6))/(0.84655354/(37.2*exp(algebraic[8]/15.9)+0.96*exp(-algebraic[8]/22.5)))); + algebraic[88] = 1.0/(1.0+exp(-(algebraic[8]+10.0144)/7.6607)); + algebraic[89] = 0.84655354/(4.2*exp(algebraic[8]/17.0)+0.15*exp(-algebraic[8]/21.6)); + algebraic[90] = 1.0/(30.0*exp(algebraic[8]/10.0)+exp(-algebraic[8]/12.0)); + algebraic[91] = 1.0/(100.0*exp(-algebraic[8]/54.645)+656.0*exp(algebraic[8]/106.157)); + algebraic[92] = 1.0/(1.0+exp((algebraic[8]+28.6)/17.1)); + algebraic[94] = sqrt(1.0/(1.0+exp(-(algebraic[8]+0.6383-computedConstants[23])/10.7071))); + algebraic[96] = 28.0/(1.0+exp(-(algebraic[8]-40.0-computedConstants[23])/3.0)); + algebraic[97] = 1.0*exp(-(algebraic[8]-computedConstants[23]-5.0)/25.0); + algebraic[95] = 1.0/(algebraic[96]+algebraic[97]); + algebraic[98] = 10.0*exp(0.0133*(algebraic[8]+40.0)); + algebraic[99] = computedConstants[24]/(computedConstants[24]+algebraic[98]); + algebraic[100] = 1.0/(computedConstants[24]+algebraic[98]); } diff --git a/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.py b/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.py index 109e8280db..3141afa7a2 100644 --- a/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.py +++ b/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.py @@ -311,95 +311,95 @@ def create_variables_array(): def initialise_variables(states, rates, constants): constants[0] = 0.0 constants[1] = 0.0 + constants[2] = 140.0 + constants[3] = 5.4 constants[4] = 140.0 - constants[7] = 5.4 - constants[8] = 140.0 - constants[10] = 1.8 - constants[11] = 1.0 - constants[17] = 96485.3415 - constants[22] = 14.0 - constants[23] = 1.4 - constants[24] = 0.08105 - constants[25] = 0.0 - constants[30] = 3.343 - constants[39] = 26.44 - constants[40] = 0.0207 - constants[41] = 0.1369 - constants[43] = 395.3 - constants[44] = 2.289 - constants[45] = 0.4315 - constants[46] = 26.44 - constants[47] = 4.663 - constants[48] = 3.663 - constants[49] = 0.0 - constants[51] = 1628.0 - constants[52] = 561.4 - constants[54] = 148041085.1 - constants[57] = 15.0 - constants[58] = 1.0 - constants[59] = 0.45 - constants[60] = 2.5 - constants[62] = 10000.0 - constants[64] = 500.0 - constants[65] = 5.0 - constants[66] = 660.0 - constants[70] = 5.0 - constants[72] = 5.469e-5 - constants[74] = 0.000286113 - constants[75] = 5.0e-5 - constants[77] = 0.04 - constants[79] = 88800.0 - constants[80] = 446.0 - constants[82] = 227700.0 - constants[83] = 7.51 - constants[85] = 2277.0 - constants[86] = 2.5 - constants[87] = 751.0 - constants[89] = 1.642e6 - constants[90] = 542.0 - constants[93] = 175.4 - constants[94] = 445.0 - constants[95] = 0.031 - constants[96] = 0.062 - constants[97] = 0.045 - constants[98] = 10.0 - constants[104] = 67.0 - constants[105] = 3.9 - constants[106] = 0.02 - constants[107] = 0.0012 - constants[108] = 0.46 - constants[109] = 0.0116 - constants[118] = 5.7e-5 - constants[119] = 8314.472 - constants[120] = 310.0 - constants[122] = 0.0 - constants[123] = -35.0 - constants[124] = 0.5 - constants[125] = 0.5 - constants[126] = -45.0 - constants[128] = 0.00427 - constants[129] = 45.0 - constants[131] = 0.5927 - constants[135] = 0.0 - constants[141] = 0.0 - constants[144] = 0.0223 - constants[146] = 0.0 - constants[150] = 1.0e-5 - constants[157] = 0.1539e-3 - constants[163] = 0.4578 - constants[169] = -16.4508 - constants[170] = 4.3371 - constants[177] = 0.0 - constants[178] = 0.0 - constants[181] = 0.000338 - constants[183] = 0.0075 - constants[184] = 0.04132 - constants[189] = 0.0 - constants[190] = 3.5e-3 - constants[195] = 0.00424 - constants[204] = 0.00065 - constants[211] = 1.0 - constants[212] = 0.00345 + constants[5] = 1.8 + constants[6] = 1.0 + constants[7] = 96485.3415 + constants[8] = 14.0 + constants[9] = 1.4 + constants[10] = 0.08105 + constants[11] = 0.0 + constants[12] = 3.343 + constants[13] = 26.44 + constants[14] = 0.0207 + constants[15] = 0.1369 + constants[16] = 395.3 + constants[17] = 2.289 + constants[18] = 0.4315 + constants[19] = 26.44 + constants[20] = 4.663 + constants[21] = 3.663 + constants[22] = 0.0 + constants[23] = 1628.0 + constants[24] = 561.4 + constants[25] = 148041085.1 + constants[26] = 15.0 + constants[27] = 1.0 + constants[28] = 0.45 + constants[29] = 2.5 + constants[30] = 10000.0 + constants[31] = 500.0 + constants[32] = 5.0 + constants[33] = 660.0 + constants[34] = 5.0 + constants[35] = 5.469e-5 + constants[36] = 0.000286113 + constants[37] = 5.0e-5 + constants[38] = 0.04 + constants[39] = 88800.0 + constants[40] = 446.0 + constants[41] = 227700.0 + constants[42] = 7.51 + constants[43] = 2277.0 + constants[44] = 2.5 + constants[45] = 751.0 + constants[46] = 1.642e6 + constants[47] = 542.0 + constants[48] = 175.4 + constants[49] = 445.0 + constants[50] = 0.031 + constants[51] = 0.062 + constants[52] = 0.045 + constants[53] = 10.0 + constants[54] = 67.0 + constants[55] = 3.9 + constants[56] = 0.02 + constants[57] = 0.0012 + constants[58] = 0.46 + constants[59] = 0.0116 + constants[60] = 5.7e-5 + constants[61] = 8314.472 + constants[62] = 310.0 + constants[63] = 0.0 + constants[64] = -35.0 + constants[65] = 0.5 + constants[66] = 0.5 + constants[67] = -45.0 + constants[68] = 0.00427 + constants[69] = 45.0 + constants[70] = 0.5927 + constants[71] = 0.0 + constants[72] = 0.0 + constants[73] = 0.0223 + constants[74] = 0.0 + constants[75] = 1.0e-5 + constants[76] = 0.1539e-3 + constants[77] = 0.4578 + constants[78] = -16.4508 + constants[79] = 4.3371 + constants[80] = 0.0 + constants[81] = 0.0 + constants[82] = 0.000338 + constants[83] = 0.0075 + constants[84] = 0.04132 + constants[85] = 0.0 + constants[86] = 3.5e-3 + constants[87] = 0.00424 + constants[88] = 0.00065 + constants[89] = 1.0 + constants[90] = 0.00345 states[0] = 6.226104e-5 states[1] = 5.0 states[2] = 0.409551 @@ -436,263 +436,263 @@ def initialise_variables(states, rates, constants): def compute_computed_constants(constants, computed_constants): - computed_constants[3] = constants[119]*constants[120]/constants[17] - computed_constants[6] = computed_constants[3]*log(constants[7]/constants[8]) - computed_constants[20] = 1.2 if gt_func(constants[1], 0.0) else 1.0 - computed_constants[35] = constants[4]/(constants[47]+constants[4]) - computed_constants[68] = -0.25 if gt_func(constants[1], 0.0) else 0.7*constants[0]/(0.00009+constants[0]) if gt_func(constants[0], 0.0) else 0.0 - computed_constants[69] = constants[70]*(1.0-computed_constants[68]) - computed_constants[103] = 0.000000001*3.14159265358979*pow(constants[105], 2.0)*constants[104] - computed_constants[19] = 0.000000001*2.0*3.14159265358979*constants[106]*(constants[105]-constants[106]/2.0)*constants[104] - computed_constants[100] = constants[107]*computed_constants[103] - computed_constants[18] = constants[108]*computed_constants[103]-computed_constants[19] - computed_constants[99] = constants[109]*computed_constants[103] - computed_constants[127] = constants[128]/(constants[7]/(constants[7]+constants[129])) - computed_constants[130] = computed_constants[127]/(constants[131]+1.0) - computed_constants[132] = constants[131]*computed_constants[130] - computed_constants[133] = computed_constants[132]*constants[7]/(constants[7]+constants[129]) - computed_constants[134] = computed_constants[130]*constants[7]/(constants[7]+constants[129]) - computed_constants[137] = -1.0-9.898*pow(1.0*constants[0], 0.618)/(pow(1.0*constants[0], 0.618)+0.00122423) if gt_func(constants[0], 0.0) else 0.0 - computed_constants[138] = 7.5 if gt_func(constants[1], 0.0) else 0.0 - computed_constants[162] = 1.23 if gt_func(constants[1], 0.0) else 1.0 - computed_constants[165] = 0.31*constants[0]/(constants[0]+0.00009) - computed_constants[166] = -8.0 if gt_func(constants[1], 0.0) else 0.0 - computed_constants[167] = -27.0 if gt_func(constants[1], 0.0) else 0.0 - computed_constants[203] = 1.2*constants[204] if gt_func(constants[1], 0.0) else constants[204] - computed_constants[206] = -14.0 if gt_func(constants[1], 0.0) else 0.0 - computed_constants[213] = (3.5988-0.025641)/(1.0+0.0000012155/pow(1.0*constants[0], 1.6951))+0.025641 + computed_constants[0] = constants[61]*constants[62]/constants[7] + computed_constants[1] = computed_constants[0]*log(constants[3]/constants[4]) + computed_constants[4] = 1.2 if gt_func(constants[1], 0.0) else 1.0 + computed_constants[5] = constants[2]/(constants[20]+constants[2]) + computed_constants[6] = -0.25 if gt_func(constants[1], 0.0) else 0.7*constants[0]/(0.00009+constants[0]) if gt_func(constants[0], 0.0) else 0.0 + computed_constants[7] = constants[34]*(1.0-computed_constants[6]) + computed_constants[10] = 0.000000001*3.14159265358979*pow(constants[55], 2.0)*constants[54] + computed_constants[3] = 0.000000001*2.0*3.14159265358979*constants[56]*(constants[55]-constants[56]/2.0)*constants[54] + computed_constants[9] = constants[57]*computed_constants[10] + computed_constants[2] = constants[58]*computed_constants[10]-computed_constants[3] + computed_constants[8] = constants[59]*computed_constants[10] + computed_constants[11] = constants[68]/(constants[3]/(constants[3]+constants[69])) + computed_constants[12] = computed_constants[11]/(constants[70]+1.0) + computed_constants[13] = constants[70]*computed_constants[12] + computed_constants[14] = computed_constants[13]*constants[3]/(constants[3]+constants[69]) + computed_constants[15] = computed_constants[12]*constants[3]/(constants[3]+constants[69]) + computed_constants[16] = -1.0-9.898*pow(1.0*constants[0], 0.618)/(pow(1.0*constants[0], 0.618)+0.00122423) if gt_func(constants[0], 0.0) else 0.0 + computed_constants[17] = 7.5 if gt_func(constants[1], 0.0) else 0.0 + computed_constants[18] = 1.23 if gt_func(constants[1], 0.0) else 1.0 + computed_constants[19] = 0.31*constants[0]/(constants[0]+0.00009) + computed_constants[20] = -8.0 if gt_func(constants[1], 0.0) else 0.0 + computed_constants[21] = -27.0 if gt_func(constants[1], 0.0) else 0.0 + computed_constants[22] = 1.2*constants[88] if gt_func(constants[1], 0.0) else constants[88] + computed_constants[23] = -14.0 if gt_func(constants[1], 0.0) else 0.0 + computed_constants[24] = (3.5988-0.025641)/(1.0+0.0000012155/pow(1.0*constants[0], 1.6951))+0.025641 def compute_rates(voi, states, rates, constants, computed_constants, algebraic): - algebraic[5] = states[1] - algebraic[142] = computed_constants[3]*log((constants[4]+0.12*constants[7])/(algebraic[5]+0.12*constants[8])) - algebraic[121] = constants[123] if and_func(gt_func(voi, constants[124]), lt_func(voi, constants[124]+constants[125])) else constants[126] - algebraic[21] = algebraic[121] if geq_func(constants[122], 1.0) else states[15] - algebraic[143] = constants[144]*pow(states[18], 3.0)*states[17]*(algebraic[21]-algebraic[142]) - algebraic[145] = constants[146]*pow(states[18], 3.0)*(algebraic[21]-algebraic[142]) - algebraic[12] = algebraic[143]+algebraic[145] - algebraic[15] = 0.0000185*constants[163]*(algebraic[21]-0.0)/(computed_constants[3]*(1.0-exp(-1.0*(algebraic[21]-0.0)/computed_constants[3])))*(algebraic[5]-constants[4]*exp(-1.0*(algebraic[21]-0.0)/computed_constants[3]))*states[23]*states[22]*states[21] - algebraic[2] = computed_constants[3]*log(constants[4]/algebraic[5]) - algebraic[16] = states[16]*computed_constants[133]*(algebraic[21]-algebraic[2])*(1.0-constants[135]) - algebraic[14] = computed_constants[20]*constants[24]*pow(1.0+pow(constants[23]/constants[7], 1.2), -1.0)*pow(1.0+pow(constants[22]/algebraic[5], 1.3), -1.0)*pow(1.0+exp(-(algebraic[21]-algebraic[2]+110.0)/20.0), -1.0) - algebraic[50] = 1.0+constants[10]/constants[48]*(1.0+exp(constants[49]*algebraic[21]/computed_constants[3]))+constants[4]/constants[51]*(1.0+constants[4]/constants[52]*(1.0+constants[4]/constants[47])) - algebraic[27] = constants[10]/constants[48]*exp(constants[49]*algebraic[21]/computed_constants[3])/algebraic[50] - algebraic[42] = 1.0+states[0]/constants[40]*(1.0+exp(-constants[41]*algebraic[21]/computed_constants[3])+algebraic[5]/constants[46])+algebraic[5]/constants[43]*(1.0+algebraic[5]/constants[44]*(1.0+algebraic[5]/constants[39])) - algebraic[29] = states[0]/constants[40]*exp(-constants[41]*algebraic[21]/computed_constants[3])/algebraic[42] - algebraic[36] = algebraic[5]/(constants[39]+algebraic[5]) - algebraic[37] = exp(constants[45]*algebraic[21]/(2.0*computed_constants[3])) - algebraic[33] = exp(-constants[45]*algebraic[21]/(2.0*computed_constants[3])) - algebraic[38] = algebraic[5]/constants[43]*algebraic[5]/constants[44]*(1.0+algebraic[5]/constants[39])*exp(constants[45]*algebraic[21]/(2.0*computed_constants[3]))/algebraic[42] - algebraic[26] = algebraic[37]*algebraic[36]*(algebraic[38]+algebraic[29])+algebraic[33]*algebraic[29]*(computed_constants[35]+algebraic[37]) - algebraic[34] = constants[4]/constants[51]*constants[4]/constants[52]*(1.0+constants[4]/constants[47])*exp(-constants[45]*algebraic[21]/(2.0*computed_constants[3]))/algebraic[50] - algebraic[28] = algebraic[33]*computed_constants[35]*(algebraic[34]+algebraic[27])+algebraic[27]*algebraic[37]*(algebraic[36]+algebraic[33]) - algebraic[31] = algebraic[34]*computed_constants[35]*(algebraic[38]+algebraic[29])+algebraic[38]*algebraic[27]*(computed_constants[35]+algebraic[37]) - algebraic[32] = algebraic[38]*algebraic[36]*(algebraic[34]+algebraic[27])+algebraic[29]*algebraic[34]*(algebraic[36]+algebraic[33]) - algebraic[13] = (1.0-constants[25])*constants[30]*(algebraic[26]*algebraic[27]-algebraic[28]*algebraic[29])/(algebraic[28]+algebraic[26]+algebraic[32]+algebraic[31]) - rates[1] = (1.0-constants[11])*-1.0*(algebraic[12]+algebraic[16]+algebraic[15]+3.0*algebraic[14]+3.0*algebraic[13])/(1.0*(computed_constants[18]+computed_constants[19])*constants[17]) - algebraic[56] = constants[57]-(constants[57]-constants[58])/(1.0+pow(constants[59]/states[2], constants[60])) - algebraic[63] = constants[64]*algebraic[56] - algebraic[61] = constants[62]/algebraic[56] - rates[4] = constants[65]*states[5]-algebraic[63]*states[0]*states[4]-(algebraic[61]*pow(states[0], 2.0)*states[4]-constants[66]*states[3]) - rates[3] = algebraic[61]*pow(states[0], 2.0)*states[4]-constants[66]*states[3]-(algebraic[63]*states[0]*states[3]-constants[65]*states[6]) - rates[6] = algebraic[63]*states[0]*states[3]-constants[65]*states[6]-(constants[66]*states[6]-algebraic[61]*pow(states[0], 2.0)*states[5]) - rates[5] = constants[66]*states[6]-algebraic[61]*pow(states[0], 2.0)*states[5]-(constants[65]*states[5]-algebraic[63]*states[0]*states[4]) - algebraic[78] = constants[79]*states[7]*(1.0-states[9])-constants[80]*states[9] - rates[9] = algebraic[78] - algebraic[81] = constants[82]*states[7]*(1.0-(states[10]+states[11]))-constants[83]*states[10] - rates[10] = algebraic[81] - algebraic[84] = constants[85]*constants[86]*(1.0-(states[10]+states[11]))-constants[87]*states[11] - rates[11] = algebraic[84] - algebraic[88] = constants[89]*states[7]*(1.0-states[12])-constants[90]*states[12] - rates[12] = algebraic[88] - algebraic[91] = constants[89]*states[0]*(1.0-states[13])-constants[90]*states[13] - rates[13] = algebraic[91] - algebraic[92] = constants[93]*states[2]*(1.0-states[14])-constants[94]*states[14] - rates[14] = algebraic[92] - algebraic[71] = (states[0]-states[7])/constants[72] - algebraic[73] = computed_constants[69]/(1.0+exp((-states[7]+constants[74])/constants[75])) - rates[7] = 1.0*(algebraic[71]*computed_constants[19]-algebraic[73]*computed_constants[99])/computed_constants[18]-(constants[97]*algebraic[88]+constants[95]*algebraic[78]+constants[96]*algebraic[81]) - algebraic[53] = constants[54]*states[3]*(states[2]-states[0]) - algebraic[101] = 2.0*constants[163]*(algebraic[21]-0.0)/(computed_constants[3]*(1.0-exp(-1.0*(algebraic[21]-0.0)*2.0/computed_constants[3])))*(states[0]-constants[10]*exp(-2.0*(algebraic[21]-0.0)/computed_constants[3]))*states[23]*states[22]*states[21] - algebraic[102] = 2.0*constants[184]*algebraic[21]/(computed_constants[3]*(1.0-exp(-1.0*algebraic[21]*2.0/computed_constants[3])))*(states[0]-constants[10]*exp(-2.0*algebraic[21]/computed_constants[3]))*states[25]*states[24] - rates[0] = algebraic[53]*computed_constants[100]/computed_constants[19]-((algebraic[101]+algebraic[102]-2.0*algebraic[13])/(2.0*constants[17]*computed_constants[19])+algebraic[71]+constants[97]*algebraic[91]) - algebraic[76] = (states[8]-states[2])/constants[77] - rates[8] = algebraic[73]-algebraic[76]*computed_constants[100]/computed_constants[99] - rates[2] = algebraic[76]-(algebraic[53]+constants[98]*algebraic[92]) - algebraic[136] = states[16]*computed_constants[134]*(algebraic[21]-computed_constants[6])*(1.0-constants[135]) - algebraic[111] = algebraic[16]+algebraic[136] - algebraic[112] = constants[157]*states[20]*states[19]*(algebraic[21]-computed_constants[6]) - algebraic[113] = constants[211]*constants[212]*(algebraic[21]-computed_constants[6])*(1.0+exp((algebraic[21]+20.0)/20.0))*states[32] if gt_func(constants[0], 0.0) else 0.0 - algebraic[164] = 0.000365*constants[163]*(algebraic[21]-0.0)/(computed_constants[3]*(1.0-exp(-1.0*(algebraic[21]-0.0)/computed_constants[3])))*(constants[8]-constants[7]*exp(-1.0*(algebraic[21]-0.0)/computed_constants[3]))*states[23]*states[22]*states[21] - algebraic[114] = (algebraic[101]+algebraic[164]+algebraic[15])*(1.0-computed_constants[165])*1.0*computed_constants[162] - algebraic[115] = constants[190]*(algebraic[21]-computed_constants[6])*states[27]*states[26] - algebraic[205] = computed_constants[3]*log((constants[7]+0.12*constants[4])/(constants[8]+0.12*algebraic[5])) - algebraic[116] = computed_constants[203]*(algebraic[21]-algebraic[205])*pow(states[31], 2.0) - algebraic[117] = constants[195]*(algebraic[21]-computed_constants[6])*(0.9*states[29]+0.1*states[30])*states[28] - algebraic[110] = algebraic[111]+algebraic[117]+algebraic[116]+algebraic[115]+algebraic[14]+algebraic[13]+algebraic[12]+algebraic[114]+algebraic[102]+algebraic[113]+algebraic[112] - rates[15] = -algebraic[110]/constants[118] - algebraic[140] = 0.01329+0.99921/(1.0+exp((algebraic[21]+97.134-computed_constants[137]-computed_constants[138]-constants[141])/8.1752)) if lt_func(algebraic[21], -(80.0-computed_constants[137]-computed_constants[138]-constants[141])) else 0.0002501*exp(-(algebraic[21]-computed_constants[137]-computed_constants[138]-constants[141])/12.861) - algebraic[139] = 1.0/(0.36*(algebraic[21]+148.8-computed_constants[137]-computed_constants[138])/(exp(0.066*(algebraic[21]+148.8-computed_constants[137]-computed_constants[138]))-1.0)+0.1*(algebraic[21]+87.3-computed_constants[137]-computed_constants[138])/(1.0-exp(-0.2*(algebraic[21]+87.3-computed_constants[137]-computed_constants[138]))))-0.054 - rates[16] = (algebraic[140]-states[16])/algebraic[139] - algebraic[147] = 1.0/(1.0+exp(-(algebraic[21]+42.0504)/8.3106)) - algebraic[148] = algebraic[21]+41.0 - algebraic[149] = 2000.0 if lt_func(fabs(algebraic[148]), constants[150]) else 200.0*algebraic[148]/(1.0-exp(-0.1*algebraic[148])) - algebraic[151] = 8000.0*exp(-0.056*(algebraic[21]+66.0)) - algebraic[152] = 1.0/(algebraic[149]+algebraic[151]) - rates[18] = (algebraic[147]-states[18])/algebraic[152] - algebraic[153] = 1.0/(1.0+exp((algebraic[21]+69.804)/4.4565)) - algebraic[154] = 20.0*exp(-0.125*(algebraic[21]+75.0)) - algebraic[155] = 2000.0/(320.0*exp(-0.1*(algebraic[21]+75.0))+1.0) - algebraic[156] = 1.0/(algebraic[154]+algebraic[155]) - rates[17] = (algebraic[153]-states[17])/algebraic[156] - algebraic[158] = 1.0/(1.0+exp((algebraic[21]+6.0)/-8.6)) - algebraic[159] = 0.009/(1.0+exp((algebraic[21]+5.0)/12.0))+0.0005 - rates[20] = (algebraic[158]-states[20])/algebraic[159] - algebraic[160] = 1.0/(1.0+exp((algebraic[21]+7.5)/10.0)) - algebraic[161] = 0.59/(1.0+exp((algebraic[21]+60.0)/10.0))+3.05 - rates[19] = (algebraic[160]-states[19])/algebraic[161] - algebraic[168] = 1.0/(1.0+exp(-(algebraic[21]-constants[169]-computed_constants[166])/(constants[170]*(1.0+computed_constants[167]/100.0)))) - algebraic[174] = -41.80001 if eq_func(algebraic[21], -41.8) else 0.0 if eq_func(algebraic[21], 0.0) else -6.80001 if eq_func(algebraic[21], -6.8) else algebraic[21] - algebraic[172] = -0.02839*(algebraic[174]+41.8)/(exp(-(algebraic[174]+41.8)/2.5)-1.0)-0.0849*(algebraic[174]+6.8)/(exp(-(algebraic[174]+6.8)/4.8)-1.0) - algebraic[175] = -1.80001 if eq_func(algebraic[21], -1.8) else algebraic[21] - algebraic[173] = 0.01143*(algebraic[175]+1.8)/(exp((algebraic[175]+1.8)/2.5)-1.0) - algebraic[171] = 0.001/(algebraic[172]+algebraic[173]) - rates[23] = (algebraic[168]-states[23])/algebraic[171] - algebraic[176] = 1.0/(1.0+exp((algebraic[21]+37.4+constants[177])/(5.3+constants[178]))) - algebraic[179] = 0.001*(44.3+230.0*exp(-pow((algebraic[21]+36.0)/10.0, 2.0))) - rates[22] = (algebraic[176]-states[22])/algebraic[179] - algebraic[180] = constants[181]/(constants[181]+states[0]) - algebraic[182] = 0.001*algebraic[180]/constants[183] - rates[21] = (algebraic[180]-states[21])/algebraic[182] - algebraic[185] = 1.0/(1.0+exp(-(algebraic[21]+38.3)/5.5)) - algebraic[186] = 0.001/(1.068*exp((algebraic[21]+38.3)/30.0)+1.068*exp(-(algebraic[21]+38.3)/30.0)) - rates[25] = (algebraic[185]-states[25])/algebraic[186] - algebraic[187] = 1.0/(1.0+exp((algebraic[21]+58.7)/3.8)) - algebraic[188] = 1.0/(16.67*exp(-(algebraic[21]+75.0)/83.3)+16.67*exp((algebraic[21]+75.0)/15.38))+constants[189] - rates[24] = (algebraic[187]-states[24])/algebraic[188] - algebraic[191] = 1.0/(1.0+exp((algebraic[21]+49.0)/13.0)) - algebraic[192] = 0.001*0.6*(65.17/(0.57*exp(-0.08*(algebraic[21]+44.0))+0.065*exp(0.1*(algebraic[21]+45.93)))+10.1) - rates[27] = (algebraic[191]-states[27])/algebraic[192] - algebraic[193] = 1.0/(1.0+exp(-(algebraic[21]-19.3)/15.0)) - algebraic[194] = 0.001*0.66*1.4*(15.59/(1.037*exp(0.09*(algebraic[21]+30.61))+0.369*exp(-0.12*(algebraic[21]+23.84)))+2.98) - rates[26] = (algebraic[193]-states[26])/algebraic[194] - algebraic[198] = 1.0/(1.0+exp(-(algebraic[21]+10.0144)/7.6607)) - algebraic[199] = 0.84655354/(4.2*exp(algebraic[21]/17.0)+0.15*exp(-algebraic[21]/21.6)) - rates[30] = (algebraic[198]-states[30])/algebraic[199] - algebraic[200] = 1.0/(30.0*exp(algebraic[21]/10.0)+exp(-algebraic[21]/12.0)) - rates[29] = (algebraic[198]-states[29])/algebraic[200] - algebraic[202] = 1.0/(1.0+exp((algebraic[21]+28.6)/17.1)) - algebraic[201] = 1.0/(100.0*exp(-algebraic[21]/54.645)+656.0*exp(algebraic[21]/106.157)) - rates[28] = (algebraic[202]-states[28])/algebraic[201] - algebraic[207] = sqrt(1.0/(1.0+exp(-(algebraic[21]+0.6383-computed_constants[206])/10.7071))) - algebraic[209] = 28.0/(1.0+exp(-(algebraic[21]-40.0-computed_constants[206])/3.0)) - algebraic[210] = 1.0*exp(-(algebraic[21]-computed_constants[206]-5.0)/25.0) - algebraic[208] = 1.0/(algebraic[209]+algebraic[210]) - rates[31] = (algebraic[207]-states[31])/algebraic[208] - algebraic[214] = 10.0*exp(0.0133*(algebraic[21]+40.0)) - algebraic[215] = computed_constants[213]/(computed_constants[213]+algebraic[214]) - algebraic[216] = 1.0/(computed_constants[213]+algebraic[214]) - rates[32] = (algebraic[215]-states[32])/algebraic[216] + algebraic[1] = states[1] + algebraic[51] = computed_constants[0]*log((constants[2]+0.12*constants[3])/(algebraic[1]+0.12*constants[4])) + algebraic[47] = constants[64] if and_func(gt_func(voi, constants[65]), lt_func(voi, constants[65]+constants[66])) else constants[67] + algebraic[8] = algebraic[47] if geq_func(constants[63], 1.0) else states[15] + algebraic[52] = constants[73]*pow(states[18], 3.0)*states[17]*(algebraic[8]-algebraic[51]) + algebraic[53] = constants[74]*pow(states[18], 3.0)*(algebraic[8]-algebraic[51]) + algebraic[3] = algebraic[52]+algebraic[53] + algebraic[6] = 0.0000185*constants[77]*(algebraic[8]-0.0)/(computed_constants[0]*(1.0-exp(-1.0*(algebraic[8]-0.0)/computed_constants[0])))*(algebraic[1]-constants[2]*exp(-1.0*(algebraic[8]-0.0)/computed_constants[0]))*states[23]*states[22]*states[21] + algebraic[0] = computed_constants[0]*log(constants[2]/algebraic[1]) + algebraic[7] = states[16]*computed_constants[14]*(algebraic[8]-algebraic[0])*(1.0-constants[71]) + algebraic[5] = computed_constants[4]*constants[10]*pow(1.0+pow(constants[9]/constants[3], 1.2), -1.0)*pow(1.0+pow(constants[8]/algebraic[1], 1.3), -1.0)*pow(1.0+exp(-(algebraic[8]-algebraic[0]+110.0)/20.0), -1.0) + algebraic[21] = 1.0+constants[5]/constants[21]*(1.0+exp(constants[22]*algebraic[8]/computed_constants[0]))+constants[2]/constants[23]*(1.0+constants[2]/constants[24]*(1.0+constants[2]/constants[20])) + algebraic[10] = constants[5]/constants[21]*exp(constants[22]*algebraic[8]/computed_constants[0])/algebraic[21] + algebraic[20] = 1.0+states[0]/constants[14]*(1.0+exp(-constants[15]*algebraic[8]/computed_constants[0])+algebraic[1]/constants[19])+algebraic[1]/constants[16]*(1.0+algebraic[1]/constants[17]*(1.0+algebraic[1]/constants[13])) + algebraic[12] = states[0]/constants[14]*exp(-constants[15]*algebraic[8]/computed_constants[0])/algebraic[20] + algebraic[17] = algebraic[1]/(constants[13]+algebraic[1]) + algebraic[18] = exp(constants[18]*algebraic[8]/(2.0*computed_constants[0])) + algebraic[15] = exp(-constants[18]*algebraic[8]/(2.0*computed_constants[0])) + algebraic[19] = algebraic[1]/constants[16]*algebraic[1]/constants[17]*(1.0+algebraic[1]/constants[13])*exp(constants[18]*algebraic[8]/(2.0*computed_constants[0]))/algebraic[20] + algebraic[9] = algebraic[18]*algebraic[17]*(algebraic[19]+algebraic[12])+algebraic[15]*algebraic[12]*(computed_constants[5]+algebraic[18]) + algebraic[16] = constants[2]/constants[23]*constants[2]/constants[24]*(1.0+constants[2]/constants[20])*exp(-constants[18]*algebraic[8]/(2.0*computed_constants[0]))/algebraic[21] + algebraic[11] = algebraic[15]*computed_constants[5]*(algebraic[16]+algebraic[10])+algebraic[10]*algebraic[18]*(algebraic[17]+algebraic[15]) + algebraic[13] = algebraic[16]*computed_constants[5]*(algebraic[19]+algebraic[12])+algebraic[19]*algebraic[10]*(computed_constants[5]+algebraic[18]) + algebraic[14] = algebraic[19]*algebraic[17]*(algebraic[16]+algebraic[10])+algebraic[12]*algebraic[16]*(algebraic[17]+algebraic[15]) + algebraic[4] = (1.0-constants[11])*constants[12]*(algebraic[9]*algebraic[10]-algebraic[11]*algebraic[12])/(algebraic[11]+algebraic[9]+algebraic[14]+algebraic[13]) + rates[1] = (1.0-constants[6])*-1.0*(algebraic[3]+algebraic[7]+algebraic[6]+3.0*algebraic[5]+3.0*algebraic[4])/(1.0*(computed_constants[2]+computed_constants[3])*constants[7]) + algebraic[24] = constants[26]-(constants[26]-constants[27])/(1.0+pow(constants[28]/states[2], constants[29])) + algebraic[26] = constants[31]*algebraic[24] + algebraic[25] = constants[30]/algebraic[24] + rates[4] = constants[32]*states[5]-algebraic[26]*states[0]*states[4]-(algebraic[25]*pow(states[0], 2.0)*states[4]-constants[33]*states[3]) + rates[3] = algebraic[25]*pow(states[0], 2.0)*states[4]-constants[33]*states[3]-(algebraic[26]*states[0]*states[3]-constants[32]*states[6]) + rates[6] = algebraic[26]*states[0]*states[3]-constants[32]*states[6]-(constants[33]*states[6]-algebraic[25]*pow(states[0], 2.0)*states[5]) + rates[5] = constants[33]*states[6]-algebraic[25]*pow(states[0], 2.0)*states[5]-(constants[32]*states[5]-algebraic[26]*states[0]*states[4]) + algebraic[31] = constants[39]*states[7]*(1.0-states[9])-constants[40]*states[9] + rates[9] = algebraic[31] + algebraic[32] = constants[41]*states[7]*(1.0-(states[10]+states[11]))-constants[42]*states[10] + rates[10] = algebraic[32] + algebraic[33] = constants[43]*constants[44]*(1.0-(states[10]+states[11]))-constants[45]*states[11] + rates[11] = algebraic[33] + algebraic[34] = constants[46]*states[7]*(1.0-states[12])-constants[47]*states[12] + rates[12] = algebraic[34] + algebraic[35] = constants[46]*states[0]*(1.0-states[13])-constants[47]*states[13] + rates[13] = algebraic[35] + algebraic[36] = constants[48]*states[2]*(1.0-states[14])-constants[49]*states[14] + rates[14] = algebraic[36] + algebraic[28] = (states[0]-states[7])/constants[35] + algebraic[29] = computed_constants[7]/(1.0+exp((-states[7]+constants[36])/constants[37])) + rates[7] = 1.0*(algebraic[28]*computed_constants[3]-algebraic[29]*computed_constants[8])/computed_constants[2]-(constants[52]*algebraic[34]+constants[50]*algebraic[31]+constants[51]*algebraic[32]) + algebraic[22] = constants[25]*states[3]*(states[2]-states[0]) + algebraic[37] = 2.0*constants[77]*(algebraic[8]-0.0)/(computed_constants[0]*(1.0-exp(-1.0*(algebraic[8]-0.0)*2.0/computed_constants[0])))*(states[0]-constants[5]*exp(-2.0*(algebraic[8]-0.0)/computed_constants[0]))*states[23]*states[22]*states[21] + algebraic[38] = 2.0*constants[84]*algebraic[8]/(computed_constants[0]*(1.0-exp(-1.0*algebraic[8]*2.0/computed_constants[0])))*(states[0]-constants[5]*exp(-2.0*algebraic[8]/computed_constants[0]))*states[25]*states[24] + rates[0] = algebraic[22]*computed_constants[9]/computed_constants[3]-((algebraic[37]+algebraic[38]-2.0*algebraic[4])/(2.0*constants[7]*computed_constants[3])+algebraic[28]+constants[52]*algebraic[35]) + algebraic[30] = (states[8]-states[2])/constants[38] + rates[8] = algebraic[29]-algebraic[30]*computed_constants[9]/computed_constants[8] + rates[2] = algebraic[30]-(algebraic[22]+constants[53]*algebraic[36]) + algebraic[48] = states[16]*computed_constants[15]*(algebraic[8]-computed_constants[1])*(1.0-constants[71]) + algebraic[40] = algebraic[7]+algebraic[48] + algebraic[41] = constants[76]*states[20]*states[19]*(algebraic[8]-computed_constants[1]) + algebraic[42] = constants[89]*constants[90]*(algebraic[8]-computed_constants[1])*(1.0+exp((algebraic[8]+20.0)/20.0))*states[32] if gt_func(constants[0], 0.0) else 0.0 + algebraic[67] = 0.000365*constants[77]*(algebraic[8]-0.0)/(computed_constants[0]*(1.0-exp(-1.0*(algebraic[8]-0.0)/computed_constants[0])))*(constants[4]-constants[3]*exp(-1.0*(algebraic[8]-0.0)/computed_constants[0]))*states[23]*states[22]*states[21] + algebraic[43] = (algebraic[37]+algebraic[67]+algebraic[6])*(1.0-computed_constants[19])*1.0*computed_constants[18] + algebraic[44] = constants[86]*(algebraic[8]-computed_constants[1])*states[27]*states[26] + algebraic[93] = computed_constants[0]*log((constants[3]+0.12*constants[2])/(constants[4]+0.12*algebraic[1])) + algebraic[45] = computed_constants[22]*(algebraic[8]-algebraic[93])*pow(states[31], 2.0) + algebraic[46] = constants[87]*(algebraic[8]-computed_constants[1])*(0.9*states[29]+0.1*states[30])*states[28] + algebraic[39] = algebraic[40]+algebraic[46]+algebraic[45]+algebraic[44]+algebraic[5]+algebraic[4]+algebraic[3]+algebraic[43]+algebraic[38]+algebraic[42]+algebraic[41] + rates[15] = -algebraic[39]/constants[60] + algebraic[50] = 0.01329+0.99921/(1.0+exp((algebraic[8]+97.134-computed_constants[16]-computed_constants[17]-constants[72])/8.1752)) if lt_func(algebraic[8], -(80.0-computed_constants[16]-computed_constants[17]-constants[72])) else 0.0002501*exp(-(algebraic[8]-computed_constants[16]-computed_constants[17]-constants[72])/12.861) + algebraic[49] = 1.0/(0.36*(algebraic[8]+148.8-computed_constants[16]-computed_constants[17])/(exp(0.066*(algebraic[8]+148.8-computed_constants[16]-computed_constants[17]))-1.0)+0.1*(algebraic[8]+87.3-computed_constants[16]-computed_constants[17])/(1.0-exp(-0.2*(algebraic[8]+87.3-computed_constants[16]-computed_constants[17]))))-0.054 + rates[16] = (algebraic[50]-states[16])/algebraic[49] + algebraic[54] = 1.0/(1.0+exp(-(algebraic[8]+42.0504)/8.3106)) + algebraic[55] = algebraic[8]+41.0 + algebraic[56] = 2000.0 if lt_func(fabs(algebraic[55]), constants[75]) else 200.0*algebraic[55]/(1.0-exp(-0.1*algebraic[55])) + algebraic[57] = 8000.0*exp(-0.056*(algebraic[8]+66.0)) + algebraic[58] = 1.0/(algebraic[56]+algebraic[57]) + rates[18] = (algebraic[54]-states[18])/algebraic[58] + algebraic[59] = 1.0/(1.0+exp((algebraic[8]+69.804)/4.4565)) + algebraic[60] = 20.0*exp(-0.125*(algebraic[8]+75.0)) + algebraic[61] = 2000.0/(320.0*exp(-0.1*(algebraic[8]+75.0))+1.0) + algebraic[62] = 1.0/(algebraic[60]+algebraic[61]) + rates[17] = (algebraic[59]-states[17])/algebraic[62] + algebraic[63] = 1.0/(1.0+exp((algebraic[8]+6.0)/-8.6)) + algebraic[64] = 0.009/(1.0+exp((algebraic[8]+5.0)/12.0))+0.0005 + rates[20] = (algebraic[63]-states[20])/algebraic[64] + algebraic[65] = 1.0/(1.0+exp((algebraic[8]+7.5)/10.0)) + algebraic[66] = 0.59/(1.0+exp((algebraic[8]+60.0)/10.0))+3.05 + rates[19] = (algebraic[65]-states[19])/algebraic[66] + algebraic[68] = 1.0/(1.0+exp(-(algebraic[8]-constants[78]-computed_constants[20])/(constants[79]*(1.0+computed_constants[21]/100.0)))) + algebraic[72] = -41.80001 if eq_func(algebraic[8], -41.8) else 0.0 if eq_func(algebraic[8], 0.0) else -6.80001 if eq_func(algebraic[8], -6.8) else algebraic[8] + algebraic[70] = -0.02839*(algebraic[72]+41.8)/(exp(-(algebraic[72]+41.8)/2.5)-1.0)-0.0849*(algebraic[72]+6.8)/(exp(-(algebraic[72]+6.8)/4.8)-1.0) + algebraic[73] = -1.80001 if eq_func(algebraic[8], -1.8) else algebraic[8] + algebraic[71] = 0.01143*(algebraic[73]+1.8)/(exp((algebraic[73]+1.8)/2.5)-1.0) + algebraic[69] = 0.001/(algebraic[70]+algebraic[71]) + rates[23] = (algebraic[68]-states[23])/algebraic[69] + algebraic[74] = 1.0/(1.0+exp((algebraic[8]+37.4+constants[80])/(5.3+constants[81]))) + algebraic[75] = 0.001*(44.3+230.0*exp(-pow((algebraic[8]+36.0)/10.0, 2.0))) + rates[22] = (algebraic[74]-states[22])/algebraic[75] + algebraic[76] = constants[82]/(constants[82]+states[0]) + algebraic[77] = 0.001*algebraic[76]/constants[83] + rates[21] = (algebraic[76]-states[21])/algebraic[77] + algebraic[78] = 1.0/(1.0+exp(-(algebraic[8]+38.3)/5.5)) + algebraic[79] = 0.001/(1.068*exp((algebraic[8]+38.3)/30.0)+1.068*exp(-(algebraic[8]+38.3)/30.0)) + rates[25] = (algebraic[78]-states[25])/algebraic[79] + algebraic[80] = 1.0/(1.0+exp((algebraic[8]+58.7)/3.8)) + algebraic[81] = 1.0/(16.67*exp(-(algebraic[8]+75.0)/83.3)+16.67*exp((algebraic[8]+75.0)/15.38))+constants[85] + rates[24] = (algebraic[80]-states[24])/algebraic[81] + algebraic[82] = 1.0/(1.0+exp((algebraic[8]+49.0)/13.0)) + algebraic[83] = 0.001*0.6*(65.17/(0.57*exp(-0.08*(algebraic[8]+44.0))+0.065*exp(0.1*(algebraic[8]+45.93)))+10.1) + rates[27] = (algebraic[82]-states[27])/algebraic[83] + algebraic[84] = 1.0/(1.0+exp(-(algebraic[8]-19.3)/15.0)) + algebraic[85] = 0.001*0.66*1.4*(15.59/(1.037*exp(0.09*(algebraic[8]+30.61))+0.369*exp(-0.12*(algebraic[8]+23.84)))+2.98) + rates[26] = (algebraic[84]-states[26])/algebraic[85] + algebraic[88] = 1.0/(1.0+exp(-(algebraic[8]+10.0144)/7.6607)) + algebraic[89] = 0.84655354/(4.2*exp(algebraic[8]/17.0)+0.15*exp(-algebraic[8]/21.6)) + rates[30] = (algebraic[88]-states[30])/algebraic[89] + algebraic[90] = 1.0/(30.0*exp(algebraic[8]/10.0)+exp(-algebraic[8]/12.0)) + rates[29] = (algebraic[88]-states[29])/algebraic[90] + algebraic[92] = 1.0/(1.0+exp((algebraic[8]+28.6)/17.1)) + algebraic[91] = 1.0/(100.0*exp(-algebraic[8]/54.645)+656.0*exp(algebraic[8]/106.157)) + rates[28] = (algebraic[92]-states[28])/algebraic[91] + algebraic[94] = sqrt(1.0/(1.0+exp(-(algebraic[8]+0.6383-computed_constants[23])/10.7071))) + algebraic[96] = 28.0/(1.0+exp(-(algebraic[8]-40.0-computed_constants[23])/3.0)) + algebraic[97] = 1.0*exp(-(algebraic[8]-computed_constants[23]-5.0)/25.0) + algebraic[95] = 1.0/(algebraic[96]+algebraic[97]) + rates[31] = (algebraic[94]-states[31])/algebraic[95] + algebraic[98] = 10.0*exp(0.0133*(algebraic[8]+40.0)) + algebraic[99] = computed_constants[24]/(computed_constants[24]+algebraic[98]) + algebraic[100] = 1.0/(computed_constants[24]+algebraic[98]) + rates[32] = (algebraic[99]-states[32])/algebraic[100] def compute_variables(voi, states, rates, constants, computed_constants, algebraic): - algebraic[5] = states[1] - algebraic[2] = computed_constants[3]*log(constants[4]/algebraic[5]) - algebraic[9] = 0.5*computed_constants[3]*log(constants[10]/states[0]) - algebraic[21] = algebraic[121] if geq_func(constants[122], 1.0) else states[15] - algebraic[14] = computed_constants[20]*constants[24]*pow(1.0+pow(constants[23]/constants[7], 1.2), -1.0)*pow(1.0+pow(constants[22]/algebraic[5], 1.3), -1.0)*pow(1.0+exp(-(algebraic[21]-algebraic[2]+110.0)/20.0), -1.0) - algebraic[50] = 1.0+constants[10]/constants[48]*(1.0+exp(constants[49]*algebraic[21]/computed_constants[3]))+constants[4]/constants[51]*(1.0+constants[4]/constants[52]*(1.0+constants[4]/constants[47])) - algebraic[27] = constants[10]/constants[48]*exp(constants[49]*algebraic[21]/computed_constants[3])/algebraic[50] - algebraic[42] = 1.0+states[0]/constants[40]*(1.0+exp(-constants[41]*algebraic[21]/computed_constants[3])+algebraic[5]/constants[46])+algebraic[5]/constants[43]*(1.0+algebraic[5]/constants[44]*(1.0+algebraic[5]/constants[39])) - algebraic[29] = states[0]/constants[40]*exp(-constants[41]*algebraic[21]/computed_constants[3])/algebraic[42] - algebraic[36] = algebraic[5]/(constants[39]+algebraic[5]) - algebraic[37] = exp(constants[45]*algebraic[21]/(2.0*computed_constants[3])) - algebraic[33] = exp(-constants[45]*algebraic[21]/(2.0*computed_constants[3])) - algebraic[38] = algebraic[5]/constants[43]*algebraic[5]/constants[44]*(1.0+algebraic[5]/constants[39])*exp(constants[45]*algebraic[21]/(2.0*computed_constants[3]))/algebraic[42] - algebraic[26] = algebraic[37]*algebraic[36]*(algebraic[38]+algebraic[29])+algebraic[33]*algebraic[29]*(computed_constants[35]+algebraic[37]) - algebraic[34] = constants[4]/constants[51]*constants[4]/constants[52]*(1.0+constants[4]/constants[47])*exp(-constants[45]*algebraic[21]/(2.0*computed_constants[3]))/algebraic[50] - algebraic[28] = algebraic[33]*computed_constants[35]*(algebraic[34]+algebraic[27])+algebraic[27]*algebraic[37]*(algebraic[36]+algebraic[33]) - algebraic[31] = algebraic[34]*computed_constants[35]*(algebraic[38]+algebraic[29])+algebraic[38]*algebraic[27]*(computed_constants[35]+algebraic[37]) - algebraic[32] = algebraic[38]*algebraic[36]*(algebraic[34]+algebraic[27])+algebraic[29]*algebraic[34]*(algebraic[36]+algebraic[33]) - algebraic[13] = (1.0-constants[25])*constants[30]*(algebraic[26]*algebraic[27]-algebraic[28]*algebraic[29])/(algebraic[28]+algebraic[26]+algebraic[32]+algebraic[31]) - algebraic[53] = constants[54]*states[3]*(states[2]-states[0]) - algebraic[55] = states[2]-states[0] - algebraic[56] = constants[57]-(constants[57]-constants[58])/(1.0+pow(constants[59]/states[2], constants[60])) - algebraic[61] = constants[62]/algebraic[56] - algebraic[63] = constants[64]*algebraic[56] - algebraic[67] = states[4]+states[3]+states[6]+states[5] - algebraic[71] = (states[0]-states[7])/constants[72] - algebraic[73] = computed_constants[69]/(1.0+exp((-states[7]+constants[74])/constants[75])) - algebraic[76] = (states[8]-states[2])/constants[77] - algebraic[78] = constants[79]*states[7]*(1.0-states[9])-constants[80]*states[9] - algebraic[81] = constants[82]*states[7]*(1.0-(states[10]+states[11]))-constants[83]*states[10] - algebraic[84] = constants[85]*constants[86]*(1.0-(states[10]+states[11]))-constants[87]*states[11] - algebraic[88] = constants[89]*states[7]*(1.0-states[12])-constants[90]*states[12] - algebraic[91] = constants[89]*states[0]*(1.0-states[13])-constants[90]*states[13] - algebraic[92] = constants[93]*states[2]*(1.0-states[14])-constants[94]*states[14] - algebraic[16] = states[16]*computed_constants[133]*(algebraic[21]-algebraic[2])*(1.0-constants[135]) - algebraic[136] = states[16]*computed_constants[134]*(algebraic[21]-computed_constants[6])*(1.0-constants[135]) - algebraic[111] = algebraic[16]+algebraic[136] - algebraic[112] = constants[157]*states[20]*states[19]*(algebraic[21]-computed_constants[6]) - algebraic[113] = constants[211]*constants[212]*(algebraic[21]-computed_constants[6])*(1.0+exp((algebraic[21]+20.0)/20.0))*states[32] if gt_func(constants[0], 0.0) else 0.0 - algebraic[102] = 2.0*constants[184]*algebraic[21]/(computed_constants[3]*(1.0-exp(-1.0*algebraic[21]*2.0/computed_constants[3])))*(states[0]-constants[10]*exp(-2.0*algebraic[21]/computed_constants[3]))*states[25]*states[24] - algebraic[101] = 2.0*constants[163]*(algebraic[21]-0.0)/(computed_constants[3]*(1.0-exp(-1.0*(algebraic[21]-0.0)*2.0/computed_constants[3])))*(states[0]-constants[10]*exp(-2.0*(algebraic[21]-0.0)/computed_constants[3]))*states[23]*states[22]*states[21] - algebraic[15] = 0.0000185*constants[163]*(algebraic[21]-0.0)/(computed_constants[3]*(1.0-exp(-1.0*(algebraic[21]-0.0)/computed_constants[3])))*(algebraic[5]-constants[4]*exp(-1.0*(algebraic[21]-0.0)/computed_constants[3]))*states[23]*states[22]*states[21] - algebraic[164] = 0.000365*constants[163]*(algebraic[21]-0.0)/(computed_constants[3]*(1.0-exp(-1.0*(algebraic[21]-0.0)/computed_constants[3])))*(constants[8]-constants[7]*exp(-1.0*(algebraic[21]-0.0)/computed_constants[3]))*states[23]*states[22]*states[21] - algebraic[114] = (algebraic[101]+algebraic[164]+algebraic[15])*(1.0-computed_constants[165])*1.0*computed_constants[162] - algebraic[142] = computed_constants[3]*log((constants[4]+0.12*constants[7])/(algebraic[5]+0.12*constants[8])) - algebraic[143] = constants[144]*pow(states[18], 3.0)*states[17]*(algebraic[21]-algebraic[142]) - algebraic[145] = constants[146]*pow(states[18], 3.0)*(algebraic[21]-algebraic[142]) - algebraic[12] = algebraic[143]+algebraic[145] - algebraic[115] = constants[190]*(algebraic[21]-computed_constants[6])*states[27]*states[26] - algebraic[205] = computed_constants[3]*log((constants[7]+0.12*constants[4])/(constants[8]+0.12*algebraic[5])) - algebraic[116] = computed_constants[203]*(algebraic[21]-algebraic[205])*pow(states[31], 2.0) - algebraic[117] = constants[195]*(algebraic[21]-computed_constants[6])*(0.9*states[29]+0.1*states[30])*states[28] - algebraic[110] = algebraic[111]+algebraic[117]+algebraic[116]+algebraic[115]+algebraic[14]+algebraic[13]+algebraic[12]+algebraic[114]+algebraic[102]+algebraic[113]+algebraic[112] - algebraic[139] = 1.0/(0.36*(algebraic[21]+148.8-computed_constants[137]-computed_constants[138])/(exp(0.066*(algebraic[21]+148.8-computed_constants[137]-computed_constants[138]))-1.0)+0.1*(algebraic[21]+87.3-computed_constants[137]-computed_constants[138])/(1.0-exp(-0.2*(algebraic[21]+87.3-computed_constants[137]-computed_constants[138]))))-0.054 - algebraic[140] = 0.01329+0.99921/(1.0+exp((algebraic[21]+97.134-computed_constants[137]-computed_constants[138]-constants[141])/8.1752)) if lt_func(algebraic[21], -(80.0-computed_constants[137]-computed_constants[138]-constants[141])) else 0.0002501*exp(-(algebraic[21]-computed_constants[137]-computed_constants[138]-constants[141])/12.861) - algebraic[147] = 1.0/(1.0+exp(-(algebraic[21]+42.0504)/8.3106)) - algebraic[148] = algebraic[21]+41.0 - algebraic[149] = 2000.0 if lt_func(fabs(algebraic[148]), constants[150]) else 200.0*algebraic[148]/(1.0-exp(-0.1*algebraic[148])) - algebraic[151] = 8000.0*exp(-0.056*(algebraic[21]+66.0)) - algebraic[152] = 1.0/(algebraic[149]+algebraic[151]) - algebraic[153] = 1.0/(1.0+exp((algebraic[21]+69.804)/4.4565)) - algebraic[154] = 20.0*exp(-0.125*(algebraic[21]+75.0)) - algebraic[155] = 2000.0/(320.0*exp(-0.1*(algebraic[21]+75.0))+1.0) - algebraic[156] = 1.0/(algebraic[154]+algebraic[155]) - algebraic[158] = 1.0/(1.0+exp((algebraic[21]+6.0)/-8.6)) - algebraic[159] = 0.009/(1.0+exp((algebraic[21]+5.0)/12.0))+0.0005 - algebraic[160] = 1.0/(1.0+exp((algebraic[21]+7.5)/10.0)) - algebraic[161] = 0.59/(1.0+exp((algebraic[21]+60.0)/10.0))+3.05 - algebraic[168] = 1.0/(1.0+exp(-(algebraic[21]-constants[169]-computed_constants[166])/(constants[170]*(1.0+computed_constants[167]/100.0)))) - algebraic[174] = -41.80001 if eq_func(algebraic[21], -41.8) else 0.0 if eq_func(algebraic[21], 0.0) else -6.80001 if eq_func(algebraic[21], -6.8) else algebraic[21] - algebraic[172] = -0.02839*(algebraic[174]+41.8)/(exp(-(algebraic[174]+41.8)/2.5)-1.0)-0.0849*(algebraic[174]+6.8)/(exp(-(algebraic[174]+6.8)/4.8)-1.0) - algebraic[175] = -1.80001 if eq_func(algebraic[21], -1.8) else algebraic[21] - algebraic[173] = 0.01143*(algebraic[175]+1.8)/(exp((algebraic[175]+1.8)/2.5)-1.0) - algebraic[171] = 0.001/(algebraic[172]+algebraic[173]) - algebraic[176] = 1.0/(1.0+exp((algebraic[21]+37.4+constants[177])/(5.3+constants[178]))) - algebraic[179] = 0.001*(44.3+230.0*exp(-pow((algebraic[21]+36.0)/10.0, 2.0))) - algebraic[180] = constants[181]/(constants[181]+states[0]) - algebraic[182] = 0.001*algebraic[180]/constants[183] - algebraic[185] = 1.0/(1.0+exp(-(algebraic[21]+38.3)/5.5)) - algebraic[186] = 0.001/(1.068*exp((algebraic[21]+38.3)/30.0)+1.068*exp(-(algebraic[21]+38.3)/30.0)) - algebraic[187] = 1.0/(1.0+exp((algebraic[21]+58.7)/3.8)) - algebraic[188] = 1.0/(16.67*exp(-(algebraic[21]+75.0)/83.3)+16.67*exp((algebraic[21]+75.0)/15.38))+constants[189] - algebraic[191] = 1.0/(1.0+exp((algebraic[21]+49.0)/13.0)) - algebraic[192] = 0.001*0.6*(65.17/(0.57*exp(-0.08*(algebraic[21]+44.0))+0.065*exp(0.1*(algebraic[21]+45.93)))+10.1) - algebraic[193] = 1.0/(1.0+exp(-(algebraic[21]-19.3)/15.0)) - algebraic[194] = 0.001*0.66*1.4*(15.59/(1.037*exp(0.09*(algebraic[21]+30.61))+0.369*exp(-0.12*(algebraic[21]+23.84)))+2.98) - algebraic[196] = 1.0/(1.0+exp(-(algebraic[21]+23.2)/6.6))/(0.84655354/(37.2*exp(algebraic[21]/11.9)+0.96*exp(-algebraic[21]/18.5))) - algebraic[197] = 4.0*((37.2*exp(algebraic[21]/15.9)+0.96*exp(-algebraic[21]/22.5))/0.84655354-1.0/(1.0+exp(-(algebraic[21]+23.2)/10.6))/(0.84655354/(37.2*exp(algebraic[21]/15.9)+0.96*exp(-algebraic[21]/22.5)))) - algebraic[198] = 1.0/(1.0+exp(-(algebraic[21]+10.0144)/7.6607)) - algebraic[199] = 0.84655354/(4.2*exp(algebraic[21]/17.0)+0.15*exp(-algebraic[21]/21.6)) - algebraic[200] = 1.0/(30.0*exp(algebraic[21]/10.0)+exp(-algebraic[21]/12.0)) - algebraic[201] = 1.0/(100.0*exp(-algebraic[21]/54.645)+656.0*exp(algebraic[21]/106.157)) - algebraic[202] = 1.0/(1.0+exp((algebraic[21]+28.6)/17.1)) - algebraic[207] = sqrt(1.0/(1.0+exp(-(algebraic[21]+0.6383-computed_constants[206])/10.7071))) - algebraic[209] = 28.0/(1.0+exp(-(algebraic[21]-40.0-computed_constants[206])/3.0)) - algebraic[210] = 1.0*exp(-(algebraic[21]-computed_constants[206]-5.0)/25.0) - algebraic[208] = 1.0/(algebraic[209]+algebraic[210]) - algebraic[214] = 10.0*exp(0.0133*(algebraic[21]+40.0)) - algebraic[215] = computed_constants[213]/(computed_constants[213]+algebraic[214]) - algebraic[216] = 1.0/(computed_constants[213]+algebraic[214]) + algebraic[1] = states[1] + algebraic[0] = computed_constants[0]*log(constants[2]/algebraic[1]) + algebraic[2] = 0.5*computed_constants[0]*log(constants[5]/states[0]) + algebraic[8] = algebraic[47] if geq_func(constants[63], 1.0) else states[15] + algebraic[5] = computed_constants[4]*constants[10]*pow(1.0+pow(constants[9]/constants[3], 1.2), -1.0)*pow(1.0+pow(constants[8]/algebraic[1], 1.3), -1.0)*pow(1.0+exp(-(algebraic[8]-algebraic[0]+110.0)/20.0), -1.0) + algebraic[21] = 1.0+constants[5]/constants[21]*(1.0+exp(constants[22]*algebraic[8]/computed_constants[0]))+constants[2]/constants[23]*(1.0+constants[2]/constants[24]*(1.0+constants[2]/constants[20])) + algebraic[10] = constants[5]/constants[21]*exp(constants[22]*algebraic[8]/computed_constants[0])/algebraic[21] + algebraic[20] = 1.0+states[0]/constants[14]*(1.0+exp(-constants[15]*algebraic[8]/computed_constants[0])+algebraic[1]/constants[19])+algebraic[1]/constants[16]*(1.0+algebraic[1]/constants[17]*(1.0+algebraic[1]/constants[13])) + algebraic[12] = states[0]/constants[14]*exp(-constants[15]*algebraic[8]/computed_constants[0])/algebraic[20] + algebraic[17] = algebraic[1]/(constants[13]+algebraic[1]) + algebraic[18] = exp(constants[18]*algebraic[8]/(2.0*computed_constants[0])) + algebraic[15] = exp(-constants[18]*algebraic[8]/(2.0*computed_constants[0])) + algebraic[19] = algebraic[1]/constants[16]*algebraic[1]/constants[17]*(1.0+algebraic[1]/constants[13])*exp(constants[18]*algebraic[8]/(2.0*computed_constants[0]))/algebraic[20] + algebraic[9] = algebraic[18]*algebraic[17]*(algebraic[19]+algebraic[12])+algebraic[15]*algebraic[12]*(computed_constants[5]+algebraic[18]) + algebraic[16] = constants[2]/constants[23]*constants[2]/constants[24]*(1.0+constants[2]/constants[20])*exp(-constants[18]*algebraic[8]/(2.0*computed_constants[0]))/algebraic[21] + algebraic[11] = algebraic[15]*computed_constants[5]*(algebraic[16]+algebraic[10])+algebraic[10]*algebraic[18]*(algebraic[17]+algebraic[15]) + algebraic[13] = algebraic[16]*computed_constants[5]*(algebraic[19]+algebraic[12])+algebraic[19]*algebraic[10]*(computed_constants[5]+algebraic[18]) + algebraic[14] = algebraic[19]*algebraic[17]*(algebraic[16]+algebraic[10])+algebraic[12]*algebraic[16]*(algebraic[17]+algebraic[15]) + algebraic[4] = (1.0-constants[11])*constants[12]*(algebraic[9]*algebraic[10]-algebraic[11]*algebraic[12])/(algebraic[11]+algebraic[9]+algebraic[14]+algebraic[13]) + algebraic[22] = constants[25]*states[3]*(states[2]-states[0]) + algebraic[23] = states[2]-states[0] + algebraic[24] = constants[26]-(constants[26]-constants[27])/(1.0+pow(constants[28]/states[2], constants[29])) + algebraic[25] = constants[30]/algebraic[24] + algebraic[26] = constants[31]*algebraic[24] + algebraic[27] = states[4]+states[3]+states[6]+states[5] + algebraic[28] = (states[0]-states[7])/constants[35] + algebraic[29] = computed_constants[7]/(1.0+exp((-states[7]+constants[36])/constants[37])) + algebraic[30] = (states[8]-states[2])/constants[38] + algebraic[31] = constants[39]*states[7]*(1.0-states[9])-constants[40]*states[9] + algebraic[32] = constants[41]*states[7]*(1.0-(states[10]+states[11]))-constants[42]*states[10] + algebraic[33] = constants[43]*constants[44]*(1.0-(states[10]+states[11]))-constants[45]*states[11] + algebraic[34] = constants[46]*states[7]*(1.0-states[12])-constants[47]*states[12] + algebraic[35] = constants[46]*states[0]*(1.0-states[13])-constants[47]*states[13] + algebraic[36] = constants[48]*states[2]*(1.0-states[14])-constants[49]*states[14] + algebraic[7] = states[16]*computed_constants[14]*(algebraic[8]-algebraic[0])*(1.0-constants[71]) + algebraic[48] = states[16]*computed_constants[15]*(algebraic[8]-computed_constants[1])*(1.0-constants[71]) + algebraic[40] = algebraic[7]+algebraic[48] + algebraic[41] = constants[76]*states[20]*states[19]*(algebraic[8]-computed_constants[1]) + algebraic[42] = constants[89]*constants[90]*(algebraic[8]-computed_constants[1])*(1.0+exp((algebraic[8]+20.0)/20.0))*states[32] if gt_func(constants[0], 0.0) else 0.0 + algebraic[38] = 2.0*constants[84]*algebraic[8]/(computed_constants[0]*(1.0-exp(-1.0*algebraic[8]*2.0/computed_constants[0])))*(states[0]-constants[5]*exp(-2.0*algebraic[8]/computed_constants[0]))*states[25]*states[24] + algebraic[37] = 2.0*constants[77]*(algebraic[8]-0.0)/(computed_constants[0]*(1.0-exp(-1.0*(algebraic[8]-0.0)*2.0/computed_constants[0])))*(states[0]-constants[5]*exp(-2.0*(algebraic[8]-0.0)/computed_constants[0]))*states[23]*states[22]*states[21] + algebraic[6] = 0.0000185*constants[77]*(algebraic[8]-0.0)/(computed_constants[0]*(1.0-exp(-1.0*(algebraic[8]-0.0)/computed_constants[0])))*(algebraic[1]-constants[2]*exp(-1.0*(algebraic[8]-0.0)/computed_constants[0]))*states[23]*states[22]*states[21] + algebraic[67] = 0.000365*constants[77]*(algebraic[8]-0.0)/(computed_constants[0]*(1.0-exp(-1.0*(algebraic[8]-0.0)/computed_constants[0])))*(constants[4]-constants[3]*exp(-1.0*(algebraic[8]-0.0)/computed_constants[0]))*states[23]*states[22]*states[21] + algebraic[43] = (algebraic[37]+algebraic[67]+algebraic[6])*(1.0-computed_constants[19])*1.0*computed_constants[18] + algebraic[51] = computed_constants[0]*log((constants[2]+0.12*constants[3])/(algebraic[1]+0.12*constants[4])) + algebraic[52] = constants[73]*pow(states[18], 3.0)*states[17]*(algebraic[8]-algebraic[51]) + algebraic[53] = constants[74]*pow(states[18], 3.0)*(algebraic[8]-algebraic[51]) + algebraic[3] = algebraic[52]+algebraic[53] + algebraic[44] = constants[86]*(algebraic[8]-computed_constants[1])*states[27]*states[26] + algebraic[93] = computed_constants[0]*log((constants[3]+0.12*constants[2])/(constants[4]+0.12*algebraic[1])) + algebraic[45] = computed_constants[22]*(algebraic[8]-algebraic[93])*pow(states[31], 2.0) + algebraic[46] = constants[87]*(algebraic[8]-computed_constants[1])*(0.9*states[29]+0.1*states[30])*states[28] + algebraic[39] = algebraic[40]+algebraic[46]+algebraic[45]+algebraic[44]+algebraic[5]+algebraic[4]+algebraic[3]+algebraic[43]+algebraic[38]+algebraic[42]+algebraic[41] + algebraic[49] = 1.0/(0.36*(algebraic[8]+148.8-computed_constants[16]-computed_constants[17])/(exp(0.066*(algebraic[8]+148.8-computed_constants[16]-computed_constants[17]))-1.0)+0.1*(algebraic[8]+87.3-computed_constants[16]-computed_constants[17])/(1.0-exp(-0.2*(algebraic[8]+87.3-computed_constants[16]-computed_constants[17]))))-0.054 + algebraic[50] = 0.01329+0.99921/(1.0+exp((algebraic[8]+97.134-computed_constants[16]-computed_constants[17]-constants[72])/8.1752)) if lt_func(algebraic[8], -(80.0-computed_constants[16]-computed_constants[17]-constants[72])) else 0.0002501*exp(-(algebraic[8]-computed_constants[16]-computed_constants[17]-constants[72])/12.861) + algebraic[54] = 1.0/(1.0+exp(-(algebraic[8]+42.0504)/8.3106)) + algebraic[55] = algebraic[8]+41.0 + algebraic[56] = 2000.0 if lt_func(fabs(algebraic[55]), constants[75]) else 200.0*algebraic[55]/(1.0-exp(-0.1*algebraic[55])) + algebraic[57] = 8000.0*exp(-0.056*(algebraic[8]+66.0)) + algebraic[58] = 1.0/(algebraic[56]+algebraic[57]) + algebraic[59] = 1.0/(1.0+exp((algebraic[8]+69.804)/4.4565)) + algebraic[60] = 20.0*exp(-0.125*(algebraic[8]+75.0)) + algebraic[61] = 2000.0/(320.0*exp(-0.1*(algebraic[8]+75.0))+1.0) + algebraic[62] = 1.0/(algebraic[60]+algebraic[61]) + algebraic[63] = 1.0/(1.0+exp((algebraic[8]+6.0)/-8.6)) + algebraic[64] = 0.009/(1.0+exp((algebraic[8]+5.0)/12.0))+0.0005 + algebraic[65] = 1.0/(1.0+exp((algebraic[8]+7.5)/10.0)) + algebraic[66] = 0.59/(1.0+exp((algebraic[8]+60.0)/10.0))+3.05 + algebraic[68] = 1.0/(1.0+exp(-(algebraic[8]-constants[78]-computed_constants[20])/(constants[79]*(1.0+computed_constants[21]/100.0)))) + algebraic[72] = -41.80001 if eq_func(algebraic[8], -41.8) else 0.0 if eq_func(algebraic[8], 0.0) else -6.80001 if eq_func(algebraic[8], -6.8) else algebraic[8] + algebraic[70] = -0.02839*(algebraic[72]+41.8)/(exp(-(algebraic[72]+41.8)/2.5)-1.0)-0.0849*(algebraic[72]+6.8)/(exp(-(algebraic[72]+6.8)/4.8)-1.0) + algebraic[73] = -1.80001 if eq_func(algebraic[8], -1.8) else algebraic[8] + algebraic[71] = 0.01143*(algebraic[73]+1.8)/(exp((algebraic[73]+1.8)/2.5)-1.0) + algebraic[69] = 0.001/(algebraic[70]+algebraic[71]) + algebraic[74] = 1.0/(1.0+exp((algebraic[8]+37.4+constants[80])/(5.3+constants[81]))) + algebraic[75] = 0.001*(44.3+230.0*exp(-pow((algebraic[8]+36.0)/10.0, 2.0))) + algebraic[76] = constants[82]/(constants[82]+states[0]) + algebraic[77] = 0.001*algebraic[76]/constants[83] + algebraic[78] = 1.0/(1.0+exp(-(algebraic[8]+38.3)/5.5)) + algebraic[79] = 0.001/(1.068*exp((algebraic[8]+38.3)/30.0)+1.068*exp(-(algebraic[8]+38.3)/30.0)) + algebraic[80] = 1.0/(1.0+exp((algebraic[8]+58.7)/3.8)) + algebraic[81] = 1.0/(16.67*exp(-(algebraic[8]+75.0)/83.3)+16.67*exp((algebraic[8]+75.0)/15.38))+constants[85] + algebraic[82] = 1.0/(1.0+exp((algebraic[8]+49.0)/13.0)) + algebraic[83] = 0.001*0.6*(65.17/(0.57*exp(-0.08*(algebraic[8]+44.0))+0.065*exp(0.1*(algebraic[8]+45.93)))+10.1) + algebraic[84] = 1.0/(1.0+exp(-(algebraic[8]-19.3)/15.0)) + algebraic[85] = 0.001*0.66*1.4*(15.59/(1.037*exp(0.09*(algebraic[8]+30.61))+0.369*exp(-0.12*(algebraic[8]+23.84)))+2.98) + algebraic[86] = 1.0/(1.0+exp(-(algebraic[8]+23.2)/6.6))/(0.84655354/(37.2*exp(algebraic[8]/11.9)+0.96*exp(-algebraic[8]/18.5))) + algebraic[87] = 4.0*((37.2*exp(algebraic[8]/15.9)+0.96*exp(-algebraic[8]/22.5))/0.84655354-1.0/(1.0+exp(-(algebraic[8]+23.2)/10.6))/(0.84655354/(37.2*exp(algebraic[8]/15.9)+0.96*exp(-algebraic[8]/22.5)))) + algebraic[88] = 1.0/(1.0+exp(-(algebraic[8]+10.0144)/7.6607)) + algebraic[89] = 0.84655354/(4.2*exp(algebraic[8]/17.0)+0.15*exp(-algebraic[8]/21.6)) + algebraic[90] = 1.0/(30.0*exp(algebraic[8]/10.0)+exp(-algebraic[8]/12.0)) + algebraic[91] = 1.0/(100.0*exp(-algebraic[8]/54.645)+656.0*exp(algebraic[8]/106.157)) + algebraic[92] = 1.0/(1.0+exp((algebraic[8]+28.6)/17.1)) + algebraic[94] = sqrt(1.0/(1.0+exp(-(algebraic[8]+0.6383-computed_constants[23])/10.7071))) + algebraic[96] = 28.0/(1.0+exp(-(algebraic[8]-40.0-computed_constants[23])/3.0)) + algebraic[97] = 1.0*exp(-(algebraic[8]-computed_constants[23]-5.0)/25.0) + algebraic[95] = 1.0/(algebraic[96]+algebraic[97]) + algebraic[98] = 10.0*exp(0.0133*(algebraic[8]+40.0)) + algebraic[99] = computed_constants[24]/(computed_constants[24]+algebraic[98]) + algebraic[100] = 1.0/(computed_constants[24]+algebraic[98]) diff --git a/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.c b/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.c index 2290241662..05de7d9e69 100644 --- a/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.c +++ b/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.c @@ -250,116 +250,116 @@ void deleteArray(double *array) void initialiseVariables(double *states, double *rates, double *constants) { - constants[1] = 0.0; - constants[2] = 1.0; - constants[3] = 1.0309347; - constants[5] = 2.0e-5; - constants[6] = 6.5e-5; - constants[22] = 8314.0; - constants[23] = 310.0; - constants[24] = 96845.0; - constants[26] = 5.8e-5; - constants[27] = 0.000189; - constants[28] = 5.8e-5; - constants[29] = 0.000189; - constants[30] = 5.81818e-5; - constants[31] = 0.0001888; - constants[34] = 2.52e-5; - constants[35] = 8.19e-5; - constants[36] = 2.52e-5; - constants[37] = 8.19e-5; - constants[38] = 2.523636e-5; - constants[39] = 8.1892e-5; - constants[42] = 1.32e-5; - constants[43] = 4.3e-5; - constants[44] = 1.323e-5; - constants[45] = 4.29e-5; - constants[46] = 1.3236e-5; - constants[47] = 4.2952e-5; - constants[50] = 2.7e-6; - constants[51] = 8.8e-6; - constants[52] = 2.8e-6; - constants[53] = 8.8e-6; - constants[54] = 2.7229e-6; - constants[55] = 8.83584e-6; - constants[56] = 8.0; - constants[57] = 0.5; - constants[58] = 2.0; - constants[59] = 140.0; - constants[60] = 0.0001; - constants[61] = 0.0001; - constants[63] = 0.0478; - constants[64] = 0.16; - constants[65] = 0.0478; - constants[66] = 0.16; - constants[67] = 0.04782545; - constants[68] = 0.1551936; - constants[69] = 5.4; - constants[70] = 0.621; - constants[71] = 5.64; - constants[73] = 0.0; - constants[74] = 0.0; - constants[75] = 0.0042; - constants[76] = 0.03339; - constants[77] = 0.0; - constants[78] = 0.0; - constants[79] = 140.0; - constants[82] = 0.0; - constants[83] = 1.2e-6; - constants[84] = 0.0; - constants[85] = 3.7e-7; - constants[86] = 0.0; - constants[87] = 1.204e-6; - constants[97] = 0.0058; - constants[98] = 0.0659; - constants[99] = 0.0082; - constants[100] = 0.0659; - constants[101] = 0.0057938; - constants[102] = 0.06588648; - constants[103] = 46.4; - constants[113] = 0.0043; - constants[114] = 0.0139; - constants[115] = 0.0021; - constants[116] = 0.00694; - constants[117] = 0.00427806; - constants[118] = 0.0138823; - constants[119] = 45.0; - constants[129] = 0.00491; - constants[130] = 0.03649; - constants[131] = 0.004905; - constants[132] = 0.0365; - constants[133] = 0.004905; - constants[134] = 0.036495; - constants[136] = 6.65e-5; - constants[137] = 0.0114; - constants[138] = 0.000266; - constants[139] = 0.0114; - constants[140] = 6.645504e-5; - constants[141] = 0.01138376; - constants[147] = 0.000797; - constants[148] = 0.016; - constants[149] = 0.000738; - constants[150] = 0.0208; - constants[151] = 0.00079704; - constants[152] = 0.016; - constants[161] = 0.000518; - constants[162] = 0.0104; - constants[163] = 0.000345; - constants[164] = 0.0104; - constants[165] = 0.0003445; - constants[166] = 0.0104; - constants[170] = 0.000548; - constants[171] = 0.0069; - constants[172] = 0.000437; - constants[173] = 0.0055; - constants[174] = 0.0005465; - constants[175] = 0.006875; - constants[177] = 0.000548; - constants[178] = 0.0069; - constants[179] = 0.000437; - constants[180] = 0.0055; - constants[181] = 0.0005465; - constants[182] = 0.006875; + constants[0] = 0.0; + constants[1] = 1.0; + constants[2] = 1.0309347; + constants[3] = 2.0e-5; + constants[4] = 6.5e-5; + constants[5] = 8314.0; + constants[6] = 310.0; + constants[7] = 96845.0; + constants[8] = 5.8e-5; + constants[9] = 0.000189; + constants[10] = 5.8e-5; + constants[11] = 0.000189; + constants[12] = 5.81818e-5; + constants[13] = 0.0001888; + constants[14] = 2.52e-5; + constants[15] = 8.19e-5; + constants[16] = 2.52e-5; + constants[17] = 8.19e-5; + constants[18] = 2.523636e-5; + constants[19] = 8.1892e-5; + constants[20] = 1.32e-5; + constants[21] = 4.3e-5; + constants[22] = 1.323e-5; + constants[23] = 4.29e-5; + constants[24] = 1.3236e-5; + constants[25] = 4.2952e-5; + constants[26] = 2.7e-6; + constants[27] = 8.8e-6; + constants[28] = 2.8e-6; + constants[29] = 8.8e-6; + constants[30] = 2.7229e-6; + constants[31] = 8.83584e-6; + constants[32] = 8.0; + constants[33] = 0.5; + constants[34] = 2.0; + constants[35] = 140.0; + constants[36] = 0.0001; + constants[37] = 0.0001; + constants[38] = 0.0478; + constants[39] = 0.16; + constants[40] = 0.0478; + constants[41] = 0.16; + constants[42] = 0.04782545; + constants[43] = 0.1551936; + constants[44] = 5.4; + constants[45] = 0.621; + constants[46] = 5.64; + constants[47] = 0.0; + constants[48] = 0.0; + constants[49] = 0.0042; + constants[50] = 0.03339; + constants[51] = 0.0; + constants[52] = 0.0; + constants[53] = 140.0; + constants[54] = 0.0; + constants[55] = 1.2e-6; + constants[56] = 0.0; + constants[57] = 3.7e-7; + constants[58] = 0.0; + constants[59] = 1.204e-6; + constants[60] = 0.0058; + constants[61] = 0.0659; + constants[62] = 0.0082; + constants[63] = 0.0659; + constants[64] = 0.0057938; + constants[65] = 0.06588648; + constants[66] = 46.4; + constants[67] = 0.0043; + constants[68] = 0.0139; + constants[69] = 0.0021; + constants[70] = 0.00694; + constants[71] = 0.00427806; + constants[72] = 0.0138823; + constants[73] = 45.0; + constants[74] = 0.00491; + constants[75] = 0.03649; + constants[76] = 0.004905; + constants[77] = 0.0365; + constants[78] = 0.004905; + constants[79] = 0.036495; + constants[80] = 6.65e-5; + constants[81] = 0.0114; + constants[82] = 0.000266; + constants[83] = 0.0114; + constants[84] = 6.645504e-5; + constants[85] = 0.01138376; + constants[86] = 0.000797; + constants[87] = 0.016; + constants[88] = 0.000738; + constants[89] = 0.0208; + constants[90] = 0.00079704; + constants[91] = 0.016; + constants[92] = 0.000518; + constants[93] = 0.0104; + constants[94] = 0.000345; + constants[95] = 0.0104; + constants[96] = 0.0003445; + constants[97] = 0.0104; + constants[98] = 0.000548; + constants[99] = 0.0069; + constants[100] = 0.000437; + constants[101] = 0.0055; + constants[102] = 0.0005465; + constants[103] = 0.006875; + constants[104] = 0.000548; + constants[105] = 0.0069; + constants[106] = 0.000437; + constants[107] = 0.0055; + constants[108] = 0.0005465; + constants[109] = 0.006875; states[0] = -39.013558536; states[1] = 0.092361701692; states[2] = 0.015905380261; @@ -379,154 +379,154 @@ void initialiseVariables(double *states, double *rates, double *constants) void computeComputedConstants(double *constants, double *computedConstants) { - computedConstants[0] = (constants[2] == 0.0)?1.07*(3.0*constants[1]-0.1)/(3.0*(1.0+0.7745*exp(-(3.0*constants[1]-2.05)/0.295))):(constants[2] == 1.0)?constants[3]*constants[1]/(1.0+0.7745*exp(-(3.0*constants[1]-2.05)/0.295)):1.07*29.0*constants[1]/(30.0*(1.0+0.7745*exp(-(29.0*constants[1]-24.5)/1.95))); - computedConstants[4] = constants[5]+computedConstants[0]*(constants[6]-constants[5]); - computedConstants[25] = (constants[2] == 0.0)?constants[26]+computedConstants[0]*(constants[27]-constants[26]):(constants[2] == 1.0)?constants[30]+computedConstants[0]*(constants[31]-constants[30]):constants[28]+computedConstants[0]*(constants[29]-constants[28]); - computedConstants[33] = (constants[2] == 0.0)?constants[34]+computedConstants[0]*(constants[35]-constants[34]):(constants[2] == 1.0)?constants[38]+computedConstants[0]*(constants[39]-constants[38]):constants[36]+computedConstants[0]*(constants[37]-constants[36]); - computedConstants[41] = (constants[2] == 0.0)?constants[42]+computedConstants[0]*(constants[43]-constants[42]):(constants[2] == 1.0)?constants[46]+computedConstants[0]*(constants[47]-constants[46]):constants[44]+computedConstants[0]*(constants[45]-constants[44]); - computedConstants[49] = (constants[2] == 0.0)?constants[50]+computedConstants[0]*(constants[51]-constants[50]):(constants[2] == 1.0)?constants[54]+computedConstants[0]*(constants[55]-constants[54]):constants[52]+computedConstants[0]*(constants[53]-constants[52]); - computedConstants[62] = (constants[2] == 0.0)?constants[63]+computedConstants[0]*(constants[64]-constants[63]):(constants[2] == 1.0)?constants[67]+computedConstants[0]*(constants[68]-constants[67]):constants[65]+computedConstants[0]*(constants[66]-constants[65]); - computedConstants[72] = (constants[2] == 0.0)?constants[73]+computedConstants[0]*(constants[74]-constants[73]):(constants[2] == 1.0)?constants[77]+computedConstants[0]*(constants[78]-constants[77]):constants[75]+computedConstants[0]*(constants[76]-constants[75]); - computedConstants[8] = computedConstants[72]*constants[60]/(constants[60]+0.0004); - computedConstants[32] = constants[22]*constants[23]/constants[24]*log(constants[59]/constants[56]); - computedConstants[40] = constants[22]*constants[23]/constants[24]*log(constants[69]/constants[79]); - computedConstants[48] = constants[22]*constants[23]/(2.0*constants[24])*log(constants[58]/constants[60]); - computedConstants[80] = (constants[2] == 0.0)?constants[22]*constants[23]/constants[24]*log((constants[69]+0.12*constants[59])/(constants[79]+0.12*constants[56])):constants[22]*constants[23]/constants[24]*log((constants[69]+0.03*constants[59])/(constants[79]+0.03*constants[56])); - computedConstants[81] = (constants[2] == 0.0)?constants[82]+computedConstants[0]*(constants[83]-constants[82]):(constants[2] == 1.0)?constants[86]+computedConstants[0]*(constants[87]-constants[86]):constants[84]+computedConstants[0]*(constants[85]-constants[84]); - computedConstants[96] = (constants[2] == 0.0)?constants[97]+computedConstants[0]*(constants[98]-constants[97]):(constants[2] == 1.0)?constants[101]+computedConstants[0]*(constants[102]-constants[101]):constants[99]+computedConstants[0]*(constants[100]-constants[99]); - computedConstants[112] = (constants[2] == 0.0)?constants[113]+computedConstants[0]*(constants[114]-constants[113]):(constants[2] == 1.0)?constants[117]+computedConstants[0]*(constants[118]-constants[117]):constants[115]+computedConstants[0]*(constants[116]-constants[115]); - computedConstants[128] = (constants[2] == 0.0)?constants[129]+computedConstants[0]*(constants[130]-constants[129]):(constants[2] == 1.0)?constants[133]+computedConstants[0]*(constants[134]-constants[133]):constants[131]+computedConstants[0]*(constants[132]-constants[131]); - computedConstants[135] = (constants[2] == 0.0)?constants[136]+computedConstants[0]*(constants[137]-constants[136]):(constants[2] == 1.0)?constants[140]+computedConstants[0]*(constants[141]-constants[140]):constants[138]+computedConstants[0]*(constants[139]-constants[138]); - computedConstants[146] = (constants[2] == 0.0)?constants[147]+computedConstants[0]*(constants[148]-constants[147]):(constants[2] == 1.0)?constants[151]+computedConstants[0]*(constants[152]-constants[151]):constants[149]+computedConstants[0]*(constants[150]-constants[149]); - computedConstants[158] = (constants[2] == 0.0)?0.002:(constants[2] == 1.0)?0.002:0.006; - computedConstants[160] = (constants[2] == 0.0)?constants[161]+computedConstants[0]*(constants[162]-constants[161]):(constants[2] == 1.0)?constants[165]+computedConstants[0]*(constants[166]-constants[165]):constants[163]+computedConstants[0]*(constants[164]-constants[163]); - computedConstants[169] = (constants[2] == 0.0)?constants[170]+computedConstants[0]*(constants[171]-constants[170]):(constants[2] == 1.0)?constants[174]+computedConstants[0]*(constants[175]-constants[174]):constants[172]+computedConstants[0]*(constants[173]-constants[172]); - computedConstants[176] = (constants[2] == 0.0)?constants[177]+computedConstants[0]*(constants[178]-constants[177]):(constants[2] == 1.0)?constants[181]+computedConstants[0]*(constants[182]-constants[181]):constants[179]+computedConstants[0]*(constants[180]-constants[179]); + computedConstants[0] = (constants[1] == 0.0)?1.07*(3.0*constants[0]-0.1)/(3.0*(1.0+0.7745*exp(-(3.0*constants[0]-2.05)/0.295))):(constants[1] == 1.0)?constants[2]*constants[0]/(1.0+0.7745*exp(-(3.0*constants[0]-2.05)/0.295)):1.07*29.0*constants[0]/(30.0*(1.0+0.7745*exp(-(29.0*constants[0]-24.5)/1.95))); + computedConstants[1] = constants[3]+computedConstants[0]*(constants[4]-constants[3]); + computedConstants[3] = (constants[1] == 0.0)?constants[8]+computedConstants[0]*(constants[9]-constants[8]):(constants[1] == 1.0)?constants[12]+computedConstants[0]*(constants[13]-constants[12]):constants[10]+computedConstants[0]*(constants[11]-constants[10]); + computedConstants[5] = (constants[1] == 0.0)?constants[14]+computedConstants[0]*(constants[15]-constants[14]):(constants[1] == 1.0)?constants[18]+computedConstants[0]*(constants[19]-constants[18]):constants[16]+computedConstants[0]*(constants[17]-constants[16]); + computedConstants[7] = (constants[1] == 0.0)?constants[20]+computedConstants[0]*(constants[21]-constants[20]):(constants[1] == 1.0)?constants[24]+computedConstants[0]*(constants[25]-constants[24]):constants[22]+computedConstants[0]*(constants[23]-constants[22]); + computedConstants[9] = (constants[1] == 0.0)?constants[26]+computedConstants[0]*(constants[27]-constants[26]):(constants[1] == 1.0)?constants[30]+computedConstants[0]*(constants[31]-constants[30]):constants[28]+computedConstants[0]*(constants[29]-constants[28]); + computedConstants[10] = (constants[1] == 0.0)?constants[38]+computedConstants[0]*(constants[39]-constants[38]):(constants[1] == 1.0)?constants[42]+computedConstants[0]*(constants[43]-constants[42]):constants[40]+computedConstants[0]*(constants[41]-constants[40]); + computedConstants[11] = (constants[1] == 0.0)?constants[47]+computedConstants[0]*(constants[48]-constants[47]):(constants[1] == 1.0)?constants[51]+computedConstants[0]*(constants[52]-constants[51]):constants[49]+computedConstants[0]*(constants[50]-constants[49]); + computedConstants[2] = computedConstants[11]*constants[36]/(constants[36]+0.0004); + computedConstants[4] = constants[5]*constants[6]/constants[7]*log(constants[35]/constants[32]); + computedConstants[6] = constants[5]*constants[6]/constants[7]*log(constants[44]/constants[53]); + computedConstants[8] = constants[5]*constants[6]/(2.0*constants[7])*log(constants[34]/constants[36]); + computedConstants[12] = (constants[1] == 0.0)?constants[5]*constants[6]/constants[7]*log((constants[44]+0.12*constants[35])/(constants[53]+0.12*constants[32])):constants[5]*constants[6]/constants[7]*log((constants[44]+0.03*constants[35])/(constants[53]+0.03*constants[32])); + computedConstants[13] = (constants[1] == 0.0)?constants[54]+computedConstants[0]*(constants[55]-constants[54]):(constants[1] == 1.0)?constants[58]+computedConstants[0]*(constants[59]-constants[58]):constants[56]+computedConstants[0]*(constants[57]-constants[56]); + computedConstants[14] = (constants[1] == 0.0)?constants[60]+computedConstants[0]*(constants[61]-constants[60]):(constants[1] == 1.0)?constants[64]+computedConstants[0]*(constants[65]-constants[64]):constants[62]+computedConstants[0]*(constants[63]-constants[62]); + computedConstants[15] = (constants[1] == 0.0)?constants[67]+computedConstants[0]*(constants[68]-constants[67]):(constants[1] == 1.0)?constants[71]+computedConstants[0]*(constants[72]-constants[71]):constants[69]+computedConstants[0]*(constants[70]-constants[69]); + computedConstants[16] = (constants[1] == 0.0)?constants[74]+computedConstants[0]*(constants[75]-constants[74]):(constants[1] == 1.0)?constants[78]+computedConstants[0]*(constants[79]-constants[78]):constants[76]+computedConstants[0]*(constants[77]-constants[76]); + computedConstants[17] = (constants[1] == 0.0)?constants[80]+computedConstants[0]*(constants[81]-constants[80]):(constants[1] == 1.0)?constants[84]+computedConstants[0]*(constants[85]-constants[84]):constants[82]+computedConstants[0]*(constants[83]-constants[82]); + computedConstants[18] = (constants[1] == 0.0)?constants[86]+computedConstants[0]*(constants[87]-constants[86]):(constants[1] == 1.0)?constants[90]+computedConstants[0]*(constants[91]-constants[90]):constants[88]+computedConstants[0]*(constants[89]-constants[88]); + computedConstants[19] = (constants[1] == 0.0)?0.002:(constants[1] == 1.0)?0.002:0.006; + computedConstants[20] = (constants[1] == 0.0)?constants[92]+computedConstants[0]*(constants[93]-constants[92]):(constants[1] == 1.0)?constants[96]+computedConstants[0]*(constants[97]-constants[96]):constants[94]+computedConstants[0]*(constants[95]-constants[94]); + computedConstants[21] = (constants[1] == 0.0)?constants[98]+computedConstants[0]*(constants[99]-constants[98]):(constants[1] == 1.0)?constants[102]+computedConstants[0]*(constants[103]-constants[102]):constants[100]+computedConstants[0]*(constants[101]-constants[100]); + computedConstants[22] = (constants[1] == 0.0)?constants[104]+computedConstants[0]*(constants[105]-constants[104]):(constants[1] == 1.0)?constants[108]+computedConstants[0]*(constants[109]-constants[108]):constants[106]+computedConstants[0]*(constants[107]-constants[106]); } void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { - algebraic[9] = computedConstants[62]*pow(constants[56]/(constants[71]+constants[56]), 3.0)*pow(constants[69]/(constants[70]+constants[69]), 2.0)*1.6/(1.5+exp(-(states[0]+60.0)/40.0)); - algebraic[10] = (constants[2] == 0.0)?computedConstants[49]*(pow(constants[56], 3.0)*constants[58]*exp(0.03743*states[0]*constants[57])-pow(constants[59], 3.0)*constants[60]*exp(0.0374*states[0]*(constants[57]-1.0)))/(1.0+constants[61]*(constants[60]*pow(constants[59], 3.0)+constants[58]*pow(constants[56], 3.0))):computedConstants[49]*(pow(constants[56], 3.0)*constants[58]*exp(0.03743*states[0]*constants[57])-pow(constants[59], 3.0)*constants[60]*exp(0.03743*states[0]*(constants[57]-1.0)))/(1.0+constants[61]*(constants[60]*pow(constants[59], 3.0)+constants[58]*pow(constants[56], 3.0))); - algebraic[14] = (constants[2] != 2.0)?computedConstants[176]*states[14]*(states[0]-computedConstants[40]):computedConstants[176]*states[14]*(states[0]+102.0); - algebraic[15] = (constants[2] != 2.0)?computedConstants[169]*states[14]*(states[0]-computedConstants[32]):computedConstants[169]*states[14]*(states[0]-77.6); - algebraic[16] = computedConstants[160]*pow(states[13], 2.0)*(states[0]-computedConstants[80]); - algebraic[18] = computedConstants[135]*states[8]*(states[0]-computedConstants[40]); - algebraic[19] = computedConstants[128]*states[9]*states[8]*(states[0]-computedConstants[40]); - algebraic[20] = computedConstants[112]*states[7]*states[6]*(states[0]-constants[119]); - algebraic[21] = computedConstants[96]*(states[4]*states[5]+0.006/(1.0+exp(-(states[0]+14.1)/6.0)))*(states[0]-constants[103]); - algebraic[91] = (constants[2] == 0.0)?0.0952*exp(-0.063*(states[0]+34.4))/(1.0+1.66*exp(-0.225*(states[0]+63.7)))+0.0869:0.09518*exp(-0.06306*(states[0]+34.4))/(1.0+1.662*exp(-0.2251*(states[0]+63.7)))+0.08693; - algebraic[88] = (1.0-algebraic[91])*states[2]+algebraic[91]*states[3]; - algebraic[7] = computedConstants[81]*pow(states[1], 3.0)*algebraic[88]*constants[59]*pow(constants[24], 2.0)/(constants[22]*constants[23])*(exp((states[0]-computedConstants[32])*constants[24]/(constants[22]*constants[23]))-1.0)/(exp(states[0]*constants[24]/(constants[22]*constants[23]))-1.0)*states[0]; - algebraic[11] = computedConstants[33]*(states[0]-computedConstants[40]); - algebraic[12] = computedConstants[41]*(states[0]-computedConstants[48]); - algebraic[13] = computedConstants[25]*(states[0]-computedConstants[32]); - algebraic[153] = 0.6*states[11]+0.4*states[12]; - algebraic[17] = computedConstants[146]*algebraic[153]*states[10]*(states[0]-computedConstants[40]); - rates[0] = -1.0/computedConstants[4]*(algebraic[7]+algebraic[21]+algebraic[20]+algebraic[19]+algebraic[18]+algebraic[17]+algebraic[16]+algebraic[15]+algebraic[14]+algebraic[13]+algebraic[12]+algebraic[11]+algebraic[10]+algebraic[9]+computedConstants[8]); - algebraic[89] = (constants[2] == 0.0)?pow(1.0/(1.0+exp(-states[0]/5.46)), 1.0/3.0):pow(1.0/(1.0+exp(-(states[0]+30.32)/5.46)), 1.0/3.0); - algebraic[90] = (constants[2] == 0.0)?0.0006247/(0.832*exp(-0.335*(states[0]+56.7))+0.627*exp(0.082*(states[0]+65.01)))+4.0e-5:0.0006247/(0.8322166*exp(-0.33566*(states[0]+56.7062))+0.6274*exp(0.0823*(states[0]+65.0131)))+4.569e-5; - rates[1] = (algebraic[89]-states[1])/algebraic[90]; - algebraic[92] = 1.0/(1.0+exp((states[0]+66.1)/6.4)); - algebraic[93] = 3.717e-6*exp(-0.2815*(states[0]+17.11))/(1.0+0.003732*exp(-0.3426*(states[0]+37.76)))+0.0005977; - rates[2] = (algebraic[92]-states[2])/algebraic[93]; - algebraic[94] = algebraic[92]; - algebraic[95] = 3.186e-8*exp(-0.6219*(states[0]+18.8))/(1.0+7.189e-5*exp(-0.6683*(states[0]+34.07)))+0.003556; - rates[3] = (algebraic[94]-states[3])/algebraic[95]; - algebraic[104] = (constants[2] == 0.0)?1.0/(1.0+exp(-(states[0]+23.1)/6.0)):(constants[2] == 1.0)?1.0/(1.0+exp(-(states[0]+22.3+0.8*computedConstants[0])/6.0)):1.0/(1.0+exp(-(states[0]+22.2)/6.0)); - algebraic[106] = (constants[2] == 0.0)?-28.38*(states[0]+35.0)/(exp(-(states[0]+35.0)/2.5)-1.0)-84.9*states[0]/(exp(-0.208*states[0])-1.0):(constants[2] == 1.0)?-28.39*(states[0]+35.0)/(exp(-(states[0]+35.0)/2.5)-1.0)-84.9*states[0]/(exp(-0.208*states[0])-1.0):-28.4*(states[0]+35.0)/(exp(-(states[0]+35.0)/2.5)-1.0)-84.9*states[0]/(exp(-0.208*states[0])-1.0); - algebraic[107] = (constants[2] == 1.0)?11.43*(states[0]-5.0)/(exp(0.4*(states[0]-5.0))-1.0):11.42*(states[0]-5.0)/(exp(0.4*(states[0]-5.0))-1.0); - algebraic[105] = 2.0/(algebraic[106]+algebraic[107]); - rates[5] = (algebraic[104]-states[5])/algebraic[105]; - algebraic[108] = 1.0/(1.0+exp((states[0]+45.0)/5.0)); - algebraic[110] = (constants[2] == 1.0)?3.75*(states[0]+28.0)/(exp((states[0]+28.0)/4.0)-1.0):3.12*(states[0]+28.0)/(exp((states[0]+28.0)/4.0)-1.0); - algebraic[111] = (constants[2] == 1.0)?30.0/(1.0+exp(-(states[0]+28.0)/4.0)):25.0/(1.0+exp(-(states[0]+28.0)/4.0)); - algebraic[109] = (constants[2] == 1.0)?(1.2-0.2*computedConstants[0])/(algebraic[110]+algebraic[111]):1.0/(algebraic[110]+algebraic[111]); - rates[4] = (algebraic[108]-states[4])/algebraic[109]; - algebraic[120] = 1.0/(1.0+exp(-(states[0]+37.0)/6.8)); - algebraic[122] = 1068.0*exp((states[0]+26.3)/30.0); - algebraic[123] = 1068.0*exp(-(states[0]+26.3)/30.0); - algebraic[121] = 1.0/(algebraic[122]+algebraic[123]); - rates[7] = (algebraic[120]-states[7])/algebraic[121]; - algebraic[124] = 1.0/(1.0+exp((states[0]+71.0)/9.0)); - algebraic[126] = (constants[2] == 1.0)?15.3*exp(-(states[0]+71.0+0.7*computedConstants[0])/83.3):15.3*exp(-(states[0]+71.7)/83.3); - algebraic[127] = (constants[2] == 1.0)?15.0*exp((states[0]+71.0)/15.38):15.0*exp((states[0]+71.7)/15.38); - algebraic[125] = 1.0/(algebraic[126]+algebraic[127]); - rates[6] = (algebraic[124]-states[6])/algebraic[125]; - algebraic[142] = 1.0/(1.0+exp((states[0]+59.37)/13.1)); - algebraic[143] = (constants[2] == 0.0)?0.0101+0.06517/(0.57*exp(-0.08*(states[0]+49.0)))+2.4e-5*exp(0.1*(states[0]+50.93)):(constants[2] == 1.0)?0.001/3.0*(30.31+195.5/(0.5686*exp(-0.08161*(states[0]+39.0+10.0*computedConstants[0]))+0.7174*exp((0.2719-0.1719*computedConstants[0])*1.0*(states[0]+40.93+10.0*computedConstants[0])))):0.0101+0.06517/(0.5686*exp(-0.08161*(states[0]+39.0))+0.7174*exp(0.2719*(states[0]+40.93))); - rates[9] = (algebraic[142]-states[9])/algebraic[143]; - algebraic[144] = 1.0/(1.0+exp(-(states[0]-10.93)/19.7)); - algebraic[145] = (constants[2] == 0.0)?0.001*(2.98+15.59/(1.037*exp(0.09*(states[0]+30.61))+0.369*exp(-0.12*(states[0]+23.84)))):(constants[2] == 1.0)?0.0025*(1.191+7.838/(1.037*exp(0.09012*(states[0]+30.61))+0.369*exp(-0.119*(states[0]+23.84)))):0.001*(2.98+19.59/(1.037*exp(0.09012*(states[0]+30.61))+0.369*exp(-0.119*(states[0]+23.84)))); - rates[8] = (algebraic[144]-states[8])/algebraic[145]; - algebraic[154] = (constants[2] != 2.0)?1.0/(1.0+exp(-(states[0]+14.2)/10.6)):1.0/(1.0+exp(-(states[0]+13.2)/10.6)); - algebraic[155] = (constants[2] != 2.0)?1.0/(37.2*exp((states[0]-9.0)/15.9)+0.96*exp(-(states[0]-9.0)/22.5)):1.0/(37.2*exp((states[0]-10.0)/15.9)+0.96*exp(-(states[0]-10.0)/22.5)); - rates[11] = (algebraic[154]-states[11])/algebraic[155]; - algebraic[156] = algebraic[154]; - algebraic[157] = (constants[2] != 2.0)?1.0/(4.2*exp((states[0]-9.0)/17.0)+0.15*exp(-(states[0]-9.0)/21.6)):1.0/(4.2*exp((states[0]-10.0)/17.0)+0.15*exp(-(states[0]-10.0)/21.6)); - rates[12] = (algebraic[156]-states[12])/algebraic[157]; - algebraic[159] = 1.0/(1.0+exp((states[0]+18.6)/10.1)); - rates[10] = (algebraic[159]-states[10])/computedConstants[158]; - algebraic[167] = 14.0/(1.0+exp(-(states[0]-40.0)/9.0)); - algebraic[168] = 1.0*exp(-states[0]/45.0); - rates[13] = algebraic[167]*(1.0-states[13])-algebraic[168]*states[13]; - algebraic[183] = (constants[2] == 0.0)?1.0*exp(-(states[0]+78.91)/26.62):1.0*exp(-(states[0]+78.91)/26.63); - algebraic[184] = 1.0*exp((states[0]+75.13)/21.25); - rates[14] = algebraic[183]*(1.0-states[14])-algebraic[184]*states[14]; + algebraic[1] = computedConstants[10]*pow(constants[32]/(constants[46]+constants[32]), 3.0)*pow(constants[44]/(constants[45]+constants[44]), 2.0)*1.6/(1.5+exp(-(states[0]+60.0)/40.0)); + algebraic[2] = (constants[1] == 0.0)?computedConstants[9]*(pow(constants[32], 3.0)*constants[34]*exp(0.03743*states[0]*constants[33])-pow(constants[35], 3.0)*constants[36]*exp(0.0374*states[0]*(constants[33]-1.0)))/(1.0+constants[37]*(constants[36]*pow(constants[35], 3.0)+constants[34]*pow(constants[32], 3.0))):computedConstants[9]*(pow(constants[32], 3.0)*constants[34]*exp(0.03743*states[0]*constants[33])-pow(constants[35], 3.0)*constants[36]*exp(0.03743*states[0]*(constants[33]-1.0)))/(1.0+constants[37]*(constants[36]*pow(constants[35], 3.0)+constants[34]*pow(constants[32], 3.0))); + algebraic[6] = (constants[1] != 2.0)?computedConstants[22]*states[14]*(states[0]-computedConstants[6]):computedConstants[22]*states[14]*(states[0]+102.0); + algebraic[7] = (constants[1] != 2.0)?computedConstants[21]*states[14]*(states[0]-computedConstants[4]):computedConstants[21]*states[14]*(states[0]-77.6); + algebraic[8] = computedConstants[20]*pow(states[13], 2.0)*(states[0]-computedConstants[12]); + algebraic[10] = computedConstants[17]*states[8]*(states[0]-computedConstants[6]); + algebraic[11] = computedConstants[16]*states[9]*states[8]*(states[0]-computedConstants[6]); + algebraic[12] = computedConstants[15]*states[7]*states[6]*(states[0]-constants[73]); + algebraic[13] = computedConstants[14]*(states[4]*states[5]+0.006/(1.0+exp(-(states[0]+14.1)/6.0)))*(states[0]-constants[66]); + algebraic[17] = (constants[1] == 0.0)?0.0952*exp(-0.063*(states[0]+34.4))/(1.0+1.66*exp(-0.225*(states[0]+63.7)))+0.0869:0.09518*exp(-0.06306*(states[0]+34.4))/(1.0+1.662*exp(-0.2251*(states[0]+63.7)))+0.08693; + algebraic[14] = (1.0-algebraic[17])*states[2]+algebraic[17]*states[3]; + algebraic[0] = computedConstants[13]*pow(states[1], 3.0)*algebraic[14]*constants[35]*pow(constants[7], 2.0)/(constants[5]*constants[6])*(exp((states[0]-computedConstants[4])*constants[7]/(constants[5]*constants[6]))-1.0)/(exp(states[0]*constants[7]/(constants[5]*constants[6]))-1.0)*states[0]; + algebraic[3] = computedConstants[5]*(states[0]-computedConstants[6]); + algebraic[4] = computedConstants[7]*(states[0]-computedConstants[8]); + algebraic[5] = computedConstants[3]*(states[0]-computedConstants[4]); + algebraic[42] = 0.6*states[11]+0.4*states[12]; + algebraic[9] = computedConstants[18]*algebraic[42]*states[10]*(states[0]-computedConstants[6]); + rates[0] = -1.0/computedConstants[1]*(algebraic[0]+algebraic[13]+algebraic[12]+algebraic[11]+algebraic[10]+algebraic[9]+algebraic[8]+algebraic[7]+algebraic[6]+algebraic[5]+algebraic[4]+algebraic[3]+algebraic[2]+algebraic[1]+computedConstants[2]); + algebraic[15] = (constants[1] == 0.0)?pow(1.0/(1.0+exp(-states[0]/5.46)), 1.0/3.0):pow(1.0/(1.0+exp(-(states[0]+30.32)/5.46)), 1.0/3.0); + algebraic[16] = (constants[1] == 0.0)?0.0006247/(0.832*exp(-0.335*(states[0]+56.7))+0.627*exp(0.082*(states[0]+65.01)))+4.0e-5:0.0006247/(0.8322166*exp(-0.33566*(states[0]+56.7062))+0.6274*exp(0.0823*(states[0]+65.0131)))+4.569e-5; + rates[1] = (algebraic[15]-states[1])/algebraic[16]; + algebraic[18] = 1.0/(1.0+exp((states[0]+66.1)/6.4)); + algebraic[19] = 3.717e-6*exp(-0.2815*(states[0]+17.11))/(1.0+0.003732*exp(-0.3426*(states[0]+37.76)))+0.0005977; + rates[2] = (algebraic[18]-states[2])/algebraic[19]; + algebraic[20] = algebraic[18]; + algebraic[21] = 3.186e-8*exp(-0.6219*(states[0]+18.8))/(1.0+7.189e-5*exp(-0.6683*(states[0]+34.07)))+0.003556; + rates[3] = (algebraic[20]-states[3])/algebraic[21]; + algebraic[22] = (constants[1] == 0.0)?1.0/(1.0+exp(-(states[0]+23.1)/6.0)):(constants[1] == 1.0)?1.0/(1.0+exp(-(states[0]+22.3+0.8*computedConstants[0])/6.0)):1.0/(1.0+exp(-(states[0]+22.2)/6.0)); + algebraic[24] = (constants[1] == 0.0)?-28.38*(states[0]+35.0)/(exp(-(states[0]+35.0)/2.5)-1.0)-84.9*states[0]/(exp(-0.208*states[0])-1.0):(constants[1] == 1.0)?-28.39*(states[0]+35.0)/(exp(-(states[0]+35.0)/2.5)-1.0)-84.9*states[0]/(exp(-0.208*states[0])-1.0):-28.4*(states[0]+35.0)/(exp(-(states[0]+35.0)/2.5)-1.0)-84.9*states[0]/(exp(-0.208*states[0])-1.0); + algebraic[25] = (constants[1] == 1.0)?11.43*(states[0]-5.0)/(exp(0.4*(states[0]-5.0))-1.0):11.42*(states[0]-5.0)/(exp(0.4*(states[0]-5.0))-1.0); + algebraic[23] = 2.0/(algebraic[24]+algebraic[25]); + rates[5] = (algebraic[22]-states[5])/algebraic[23]; + algebraic[26] = 1.0/(1.0+exp((states[0]+45.0)/5.0)); + algebraic[28] = (constants[1] == 1.0)?3.75*(states[0]+28.0)/(exp((states[0]+28.0)/4.0)-1.0):3.12*(states[0]+28.0)/(exp((states[0]+28.0)/4.0)-1.0); + algebraic[29] = (constants[1] == 1.0)?30.0/(1.0+exp(-(states[0]+28.0)/4.0)):25.0/(1.0+exp(-(states[0]+28.0)/4.0)); + algebraic[27] = (constants[1] == 1.0)?(1.2-0.2*computedConstants[0])/(algebraic[28]+algebraic[29]):1.0/(algebraic[28]+algebraic[29]); + rates[4] = (algebraic[26]-states[4])/algebraic[27]; + algebraic[30] = 1.0/(1.0+exp(-(states[0]+37.0)/6.8)); + algebraic[32] = 1068.0*exp((states[0]+26.3)/30.0); + algebraic[33] = 1068.0*exp(-(states[0]+26.3)/30.0); + algebraic[31] = 1.0/(algebraic[32]+algebraic[33]); + rates[7] = (algebraic[30]-states[7])/algebraic[31]; + algebraic[34] = 1.0/(1.0+exp((states[0]+71.0)/9.0)); + algebraic[36] = (constants[1] == 1.0)?15.3*exp(-(states[0]+71.0+0.7*computedConstants[0])/83.3):15.3*exp(-(states[0]+71.7)/83.3); + algebraic[37] = (constants[1] == 1.0)?15.0*exp((states[0]+71.0)/15.38):15.0*exp((states[0]+71.7)/15.38); + algebraic[35] = 1.0/(algebraic[36]+algebraic[37]); + rates[6] = (algebraic[34]-states[6])/algebraic[35]; + algebraic[38] = 1.0/(1.0+exp((states[0]+59.37)/13.1)); + algebraic[39] = (constants[1] == 0.0)?0.0101+0.06517/(0.57*exp(-0.08*(states[0]+49.0)))+2.4e-5*exp(0.1*(states[0]+50.93)):(constants[1] == 1.0)?0.001/3.0*(30.31+195.5/(0.5686*exp(-0.08161*(states[0]+39.0+10.0*computedConstants[0]))+0.7174*exp((0.2719-0.1719*computedConstants[0])*1.0*(states[0]+40.93+10.0*computedConstants[0])))):0.0101+0.06517/(0.5686*exp(-0.08161*(states[0]+39.0))+0.7174*exp(0.2719*(states[0]+40.93))); + rates[9] = (algebraic[38]-states[9])/algebraic[39]; + algebraic[40] = 1.0/(1.0+exp(-(states[0]-10.93)/19.7)); + algebraic[41] = (constants[1] == 0.0)?0.001*(2.98+15.59/(1.037*exp(0.09*(states[0]+30.61))+0.369*exp(-0.12*(states[0]+23.84)))):(constants[1] == 1.0)?0.0025*(1.191+7.838/(1.037*exp(0.09012*(states[0]+30.61))+0.369*exp(-0.119*(states[0]+23.84)))):0.001*(2.98+19.59/(1.037*exp(0.09012*(states[0]+30.61))+0.369*exp(-0.119*(states[0]+23.84)))); + rates[8] = (algebraic[40]-states[8])/algebraic[41]; + algebraic[43] = (constants[1] != 2.0)?1.0/(1.0+exp(-(states[0]+14.2)/10.6)):1.0/(1.0+exp(-(states[0]+13.2)/10.6)); + algebraic[44] = (constants[1] != 2.0)?1.0/(37.2*exp((states[0]-9.0)/15.9)+0.96*exp(-(states[0]-9.0)/22.5)):1.0/(37.2*exp((states[0]-10.0)/15.9)+0.96*exp(-(states[0]-10.0)/22.5)); + rates[11] = (algebraic[43]-states[11])/algebraic[44]; + algebraic[45] = algebraic[43]; + algebraic[46] = (constants[1] != 2.0)?1.0/(4.2*exp((states[0]-9.0)/17.0)+0.15*exp(-(states[0]-9.0)/21.6)):1.0/(4.2*exp((states[0]-10.0)/17.0)+0.15*exp(-(states[0]-10.0)/21.6)); + rates[12] = (algebraic[45]-states[12])/algebraic[46]; + algebraic[47] = 1.0/(1.0+exp((states[0]+18.6)/10.1)); + rates[10] = (algebraic[47]-states[10])/computedConstants[19]; + algebraic[48] = 14.0/(1.0+exp(-(states[0]-40.0)/9.0)); + algebraic[49] = 1.0*exp(-states[0]/45.0); + rates[13] = algebraic[48]*(1.0-states[13])-algebraic[49]*states[13]; + algebraic[50] = (constants[1] == 0.0)?1.0*exp(-(states[0]+78.91)/26.62):1.0*exp(-(states[0]+78.91)/26.63); + algebraic[51] = 1.0*exp((states[0]+75.13)/21.25); + rates[14] = algebraic[50]*(1.0-states[14])-algebraic[51]*states[14]; } void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { - algebraic[13] = computedConstants[25]*(states[0]-computedConstants[32]); - algebraic[11] = computedConstants[33]*(states[0]-computedConstants[40]); - algebraic[12] = computedConstants[41]*(states[0]-computedConstants[48]); - algebraic[10] = (constants[2] == 0.0)?computedConstants[49]*(pow(constants[56], 3.0)*constants[58]*exp(0.03743*states[0]*constants[57])-pow(constants[59], 3.0)*constants[60]*exp(0.0374*states[0]*(constants[57]-1.0)))/(1.0+constants[61]*(constants[60]*pow(constants[59], 3.0)+constants[58]*pow(constants[56], 3.0))):computedConstants[49]*(pow(constants[56], 3.0)*constants[58]*exp(0.03743*states[0]*constants[57])-pow(constants[59], 3.0)*constants[60]*exp(0.03743*states[0]*(constants[57]-1.0)))/(1.0+constants[61]*(constants[60]*pow(constants[59], 3.0)+constants[58]*pow(constants[56], 3.0))); - algebraic[9] = computedConstants[62]*pow(constants[56]/(constants[71]+constants[56]), 3.0)*pow(constants[69]/(constants[70]+constants[69]), 2.0)*1.6/(1.5+exp(-(states[0]+60.0)/40.0)); - algebraic[91] = (constants[2] == 0.0)?0.0952*exp(-0.063*(states[0]+34.4))/(1.0+1.66*exp(-0.225*(states[0]+63.7)))+0.0869:0.09518*exp(-0.06306*(states[0]+34.4))/(1.0+1.662*exp(-0.2251*(states[0]+63.7)))+0.08693; - algebraic[88] = (1.0-algebraic[91])*states[2]+algebraic[91]*states[3]; - algebraic[7] = computedConstants[81]*pow(states[1], 3.0)*algebraic[88]*constants[59]*pow(constants[24], 2.0)/(constants[22]*constants[23])*(exp((states[0]-computedConstants[32])*constants[24]/(constants[22]*constants[23]))-1.0)/(exp(states[0]*constants[24]/(constants[22]*constants[23]))-1.0)*states[0]; - algebraic[89] = (constants[2] == 0.0)?pow(1.0/(1.0+exp(-states[0]/5.46)), 1.0/3.0):pow(1.0/(1.0+exp(-(states[0]+30.32)/5.46)), 1.0/3.0); - algebraic[90] = (constants[2] == 0.0)?0.0006247/(0.832*exp(-0.335*(states[0]+56.7))+0.627*exp(0.082*(states[0]+65.01)))+4.0e-5:0.0006247/(0.8322166*exp(-0.33566*(states[0]+56.7062))+0.6274*exp(0.0823*(states[0]+65.0131)))+4.569e-5; - algebraic[92] = 1.0/(1.0+exp((states[0]+66.1)/6.4)); - algebraic[94] = algebraic[92]; - algebraic[93] = 3.717e-6*exp(-0.2815*(states[0]+17.11))/(1.0+0.003732*exp(-0.3426*(states[0]+37.76)))+0.0005977; - algebraic[95] = 3.186e-8*exp(-0.6219*(states[0]+18.8))/(1.0+7.189e-5*exp(-0.6683*(states[0]+34.07)))+0.003556; - algebraic[21] = computedConstants[96]*(states[4]*states[5]+0.006/(1.0+exp(-(states[0]+14.1)/6.0)))*(states[0]-constants[103]); - algebraic[106] = (constants[2] == 0.0)?-28.38*(states[0]+35.0)/(exp(-(states[0]+35.0)/2.5)-1.0)-84.9*states[0]/(exp(-0.208*states[0])-1.0):(constants[2] == 1.0)?-28.39*(states[0]+35.0)/(exp(-(states[0]+35.0)/2.5)-1.0)-84.9*states[0]/(exp(-0.208*states[0])-1.0):-28.4*(states[0]+35.0)/(exp(-(states[0]+35.0)/2.5)-1.0)-84.9*states[0]/(exp(-0.208*states[0])-1.0); - algebraic[107] = (constants[2] == 1.0)?11.43*(states[0]-5.0)/(exp(0.4*(states[0]-5.0))-1.0):11.42*(states[0]-5.0)/(exp(0.4*(states[0]-5.0))-1.0); - algebraic[105] = 2.0/(algebraic[106]+algebraic[107]); - algebraic[104] = (constants[2] == 0.0)?1.0/(1.0+exp(-(states[0]+23.1)/6.0)):(constants[2] == 1.0)?1.0/(1.0+exp(-(states[0]+22.3+0.8*computedConstants[0])/6.0)):1.0/(1.0+exp(-(states[0]+22.2)/6.0)); - algebraic[110] = (constants[2] == 1.0)?3.75*(states[0]+28.0)/(exp((states[0]+28.0)/4.0)-1.0):3.12*(states[0]+28.0)/(exp((states[0]+28.0)/4.0)-1.0); - algebraic[111] = (constants[2] == 1.0)?30.0/(1.0+exp(-(states[0]+28.0)/4.0)):25.0/(1.0+exp(-(states[0]+28.0)/4.0)); - algebraic[109] = (constants[2] == 1.0)?(1.2-0.2*computedConstants[0])/(algebraic[110]+algebraic[111]):1.0/(algebraic[110]+algebraic[111]); - algebraic[108] = 1.0/(1.0+exp((states[0]+45.0)/5.0)); - algebraic[20] = computedConstants[112]*states[7]*states[6]*(states[0]-constants[119]); - algebraic[122] = 1068.0*exp((states[0]+26.3)/30.0); - algebraic[123] = 1068.0*exp(-(states[0]+26.3)/30.0); - algebraic[121] = 1.0/(algebraic[122]+algebraic[123]); - algebraic[120] = 1.0/(1.0+exp(-(states[0]+37.0)/6.8)); - algebraic[126] = (constants[2] == 1.0)?15.3*exp(-(states[0]+71.0+0.7*computedConstants[0])/83.3):15.3*exp(-(states[0]+71.7)/83.3); - algebraic[127] = (constants[2] == 1.0)?15.0*exp((states[0]+71.0)/15.38):15.0*exp((states[0]+71.7)/15.38); - algebraic[125] = 1.0/(algebraic[126]+algebraic[127]); - algebraic[124] = 1.0/(1.0+exp((states[0]+71.0)/9.0)); - algebraic[19] = computedConstants[128]*states[9]*states[8]*(states[0]-computedConstants[40]); - algebraic[18] = computedConstants[135]*states[8]*(states[0]-computedConstants[40]); - algebraic[142] = 1.0/(1.0+exp((states[0]+59.37)/13.1)); - algebraic[143] = (constants[2] == 0.0)?0.0101+0.06517/(0.57*exp(-0.08*(states[0]+49.0)))+2.4e-5*exp(0.1*(states[0]+50.93)):(constants[2] == 1.0)?0.001/3.0*(30.31+195.5/(0.5686*exp(-0.08161*(states[0]+39.0+10.0*computedConstants[0]))+0.7174*exp((0.2719-0.1719*computedConstants[0])*1.0*(states[0]+40.93+10.0*computedConstants[0])))):0.0101+0.06517/(0.5686*exp(-0.08161*(states[0]+39.0))+0.7174*exp(0.2719*(states[0]+40.93))); - algebraic[144] = 1.0/(1.0+exp(-(states[0]-10.93)/19.7)); - algebraic[145] = (constants[2] == 0.0)?0.001*(2.98+15.59/(1.037*exp(0.09*(states[0]+30.61))+0.369*exp(-0.12*(states[0]+23.84)))):(constants[2] == 1.0)?0.0025*(1.191+7.838/(1.037*exp(0.09012*(states[0]+30.61))+0.369*exp(-0.119*(states[0]+23.84)))):0.001*(2.98+19.59/(1.037*exp(0.09012*(states[0]+30.61))+0.369*exp(-0.119*(states[0]+23.84)))); - algebraic[153] = 0.6*states[11]+0.4*states[12]; - algebraic[17] = computedConstants[146]*algebraic[153]*states[10]*(states[0]-computedConstants[40]); - algebraic[154] = (constants[2] != 2.0)?1.0/(1.0+exp(-(states[0]+14.2)/10.6)):1.0/(1.0+exp(-(states[0]+13.2)/10.6)); - algebraic[155] = (constants[2] != 2.0)?1.0/(37.2*exp((states[0]-9.0)/15.9)+0.96*exp(-(states[0]-9.0)/22.5)):1.0/(37.2*exp((states[0]-10.0)/15.9)+0.96*exp(-(states[0]-10.0)/22.5)); - algebraic[156] = algebraic[154]; - algebraic[157] = (constants[2] != 2.0)?1.0/(4.2*exp((states[0]-9.0)/17.0)+0.15*exp(-(states[0]-9.0)/21.6)):1.0/(4.2*exp((states[0]-10.0)/17.0)+0.15*exp(-(states[0]-10.0)/21.6)); - algebraic[159] = 1.0/(1.0+exp((states[0]+18.6)/10.1)); - algebraic[16] = computedConstants[160]*pow(states[13], 2.0)*(states[0]-computedConstants[80]); - algebraic[167] = 14.0/(1.0+exp(-(states[0]-40.0)/9.0)); - algebraic[168] = 1.0*exp(-states[0]/45.0); - algebraic[15] = (constants[2] != 2.0)?computedConstants[169]*states[14]*(states[0]-computedConstants[32]):computedConstants[169]*states[14]*(states[0]-77.6); - algebraic[14] = (constants[2] != 2.0)?computedConstants[176]*states[14]*(states[0]-computedConstants[40]):computedConstants[176]*states[14]*(states[0]+102.0); - algebraic[183] = (constants[2] == 0.0)?1.0*exp(-(states[0]+78.91)/26.62):1.0*exp(-(states[0]+78.91)/26.63); - algebraic[184] = 1.0*exp((states[0]+75.13)/21.25); + algebraic[5] = computedConstants[3]*(states[0]-computedConstants[4]); + algebraic[3] = computedConstants[5]*(states[0]-computedConstants[6]); + algebraic[4] = computedConstants[7]*(states[0]-computedConstants[8]); + algebraic[2] = (constants[1] == 0.0)?computedConstants[9]*(pow(constants[32], 3.0)*constants[34]*exp(0.03743*states[0]*constants[33])-pow(constants[35], 3.0)*constants[36]*exp(0.0374*states[0]*(constants[33]-1.0)))/(1.0+constants[37]*(constants[36]*pow(constants[35], 3.0)+constants[34]*pow(constants[32], 3.0))):computedConstants[9]*(pow(constants[32], 3.0)*constants[34]*exp(0.03743*states[0]*constants[33])-pow(constants[35], 3.0)*constants[36]*exp(0.03743*states[0]*(constants[33]-1.0)))/(1.0+constants[37]*(constants[36]*pow(constants[35], 3.0)+constants[34]*pow(constants[32], 3.0))); + algebraic[1] = computedConstants[10]*pow(constants[32]/(constants[46]+constants[32]), 3.0)*pow(constants[44]/(constants[45]+constants[44]), 2.0)*1.6/(1.5+exp(-(states[0]+60.0)/40.0)); + algebraic[17] = (constants[1] == 0.0)?0.0952*exp(-0.063*(states[0]+34.4))/(1.0+1.66*exp(-0.225*(states[0]+63.7)))+0.0869:0.09518*exp(-0.06306*(states[0]+34.4))/(1.0+1.662*exp(-0.2251*(states[0]+63.7)))+0.08693; + algebraic[14] = (1.0-algebraic[17])*states[2]+algebraic[17]*states[3]; + algebraic[0] = computedConstants[13]*pow(states[1], 3.0)*algebraic[14]*constants[35]*pow(constants[7], 2.0)/(constants[5]*constants[6])*(exp((states[0]-computedConstants[4])*constants[7]/(constants[5]*constants[6]))-1.0)/(exp(states[0]*constants[7]/(constants[5]*constants[6]))-1.0)*states[0]; + algebraic[15] = (constants[1] == 0.0)?pow(1.0/(1.0+exp(-states[0]/5.46)), 1.0/3.0):pow(1.0/(1.0+exp(-(states[0]+30.32)/5.46)), 1.0/3.0); + algebraic[16] = (constants[1] == 0.0)?0.0006247/(0.832*exp(-0.335*(states[0]+56.7))+0.627*exp(0.082*(states[0]+65.01)))+4.0e-5:0.0006247/(0.8322166*exp(-0.33566*(states[0]+56.7062))+0.6274*exp(0.0823*(states[0]+65.0131)))+4.569e-5; + algebraic[18] = 1.0/(1.0+exp((states[0]+66.1)/6.4)); + algebraic[20] = algebraic[18]; + algebraic[19] = 3.717e-6*exp(-0.2815*(states[0]+17.11))/(1.0+0.003732*exp(-0.3426*(states[0]+37.76)))+0.0005977; + algebraic[21] = 3.186e-8*exp(-0.6219*(states[0]+18.8))/(1.0+7.189e-5*exp(-0.6683*(states[0]+34.07)))+0.003556; + algebraic[13] = computedConstants[14]*(states[4]*states[5]+0.006/(1.0+exp(-(states[0]+14.1)/6.0)))*(states[0]-constants[66]); + algebraic[24] = (constants[1] == 0.0)?-28.38*(states[0]+35.0)/(exp(-(states[0]+35.0)/2.5)-1.0)-84.9*states[0]/(exp(-0.208*states[0])-1.0):(constants[1] == 1.0)?-28.39*(states[0]+35.0)/(exp(-(states[0]+35.0)/2.5)-1.0)-84.9*states[0]/(exp(-0.208*states[0])-1.0):-28.4*(states[0]+35.0)/(exp(-(states[0]+35.0)/2.5)-1.0)-84.9*states[0]/(exp(-0.208*states[0])-1.0); + algebraic[25] = (constants[1] == 1.0)?11.43*(states[0]-5.0)/(exp(0.4*(states[0]-5.0))-1.0):11.42*(states[0]-5.0)/(exp(0.4*(states[0]-5.0))-1.0); + algebraic[23] = 2.0/(algebraic[24]+algebraic[25]); + algebraic[22] = (constants[1] == 0.0)?1.0/(1.0+exp(-(states[0]+23.1)/6.0)):(constants[1] == 1.0)?1.0/(1.0+exp(-(states[0]+22.3+0.8*computedConstants[0])/6.0)):1.0/(1.0+exp(-(states[0]+22.2)/6.0)); + algebraic[28] = (constants[1] == 1.0)?3.75*(states[0]+28.0)/(exp((states[0]+28.0)/4.0)-1.0):3.12*(states[0]+28.0)/(exp((states[0]+28.0)/4.0)-1.0); + algebraic[29] = (constants[1] == 1.0)?30.0/(1.0+exp(-(states[0]+28.0)/4.0)):25.0/(1.0+exp(-(states[0]+28.0)/4.0)); + algebraic[27] = (constants[1] == 1.0)?(1.2-0.2*computedConstants[0])/(algebraic[28]+algebraic[29]):1.0/(algebraic[28]+algebraic[29]); + algebraic[26] = 1.0/(1.0+exp((states[0]+45.0)/5.0)); + algebraic[12] = computedConstants[15]*states[7]*states[6]*(states[0]-constants[73]); + algebraic[32] = 1068.0*exp((states[0]+26.3)/30.0); + algebraic[33] = 1068.0*exp(-(states[0]+26.3)/30.0); + algebraic[31] = 1.0/(algebraic[32]+algebraic[33]); + algebraic[30] = 1.0/(1.0+exp(-(states[0]+37.0)/6.8)); + algebraic[36] = (constants[1] == 1.0)?15.3*exp(-(states[0]+71.0+0.7*computedConstants[0])/83.3):15.3*exp(-(states[0]+71.7)/83.3); + algebraic[37] = (constants[1] == 1.0)?15.0*exp((states[0]+71.0)/15.38):15.0*exp((states[0]+71.7)/15.38); + algebraic[35] = 1.0/(algebraic[36]+algebraic[37]); + algebraic[34] = 1.0/(1.0+exp((states[0]+71.0)/9.0)); + algebraic[11] = computedConstants[16]*states[9]*states[8]*(states[0]-computedConstants[6]); + algebraic[10] = computedConstants[17]*states[8]*(states[0]-computedConstants[6]); + algebraic[38] = 1.0/(1.0+exp((states[0]+59.37)/13.1)); + algebraic[39] = (constants[1] == 0.0)?0.0101+0.06517/(0.57*exp(-0.08*(states[0]+49.0)))+2.4e-5*exp(0.1*(states[0]+50.93)):(constants[1] == 1.0)?0.001/3.0*(30.31+195.5/(0.5686*exp(-0.08161*(states[0]+39.0+10.0*computedConstants[0]))+0.7174*exp((0.2719-0.1719*computedConstants[0])*1.0*(states[0]+40.93+10.0*computedConstants[0])))):0.0101+0.06517/(0.5686*exp(-0.08161*(states[0]+39.0))+0.7174*exp(0.2719*(states[0]+40.93))); + algebraic[40] = 1.0/(1.0+exp(-(states[0]-10.93)/19.7)); + algebraic[41] = (constants[1] == 0.0)?0.001*(2.98+15.59/(1.037*exp(0.09*(states[0]+30.61))+0.369*exp(-0.12*(states[0]+23.84)))):(constants[1] == 1.0)?0.0025*(1.191+7.838/(1.037*exp(0.09012*(states[0]+30.61))+0.369*exp(-0.119*(states[0]+23.84)))):0.001*(2.98+19.59/(1.037*exp(0.09012*(states[0]+30.61))+0.369*exp(-0.119*(states[0]+23.84)))); + algebraic[42] = 0.6*states[11]+0.4*states[12]; + algebraic[9] = computedConstants[18]*algebraic[42]*states[10]*(states[0]-computedConstants[6]); + algebraic[43] = (constants[1] != 2.0)?1.0/(1.0+exp(-(states[0]+14.2)/10.6)):1.0/(1.0+exp(-(states[0]+13.2)/10.6)); + algebraic[44] = (constants[1] != 2.0)?1.0/(37.2*exp((states[0]-9.0)/15.9)+0.96*exp(-(states[0]-9.0)/22.5)):1.0/(37.2*exp((states[0]-10.0)/15.9)+0.96*exp(-(states[0]-10.0)/22.5)); + algebraic[45] = algebraic[43]; + algebraic[46] = (constants[1] != 2.0)?1.0/(4.2*exp((states[0]-9.0)/17.0)+0.15*exp(-(states[0]-9.0)/21.6)):1.0/(4.2*exp((states[0]-10.0)/17.0)+0.15*exp(-(states[0]-10.0)/21.6)); + algebraic[47] = 1.0/(1.0+exp((states[0]+18.6)/10.1)); + algebraic[8] = computedConstants[20]*pow(states[13], 2.0)*(states[0]-computedConstants[12]); + algebraic[48] = 14.0/(1.0+exp(-(states[0]-40.0)/9.0)); + algebraic[49] = 1.0*exp(-states[0]/45.0); + algebraic[7] = (constants[1] != 2.0)?computedConstants[21]*states[14]*(states[0]-computedConstants[4]):computedConstants[21]*states[14]*(states[0]-77.6); + algebraic[6] = (constants[1] != 2.0)?computedConstants[22]*states[14]*(states[0]-computedConstants[6]):computedConstants[22]*states[14]*(states[0]+102.0); + algebraic[50] = (constants[1] == 0.0)?1.0*exp(-(states[0]+78.91)/26.62):1.0*exp(-(states[0]+78.91)/26.63); + algebraic[51] = 1.0*exp((states[0]+75.13)/21.25); } diff --git a/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.py b/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.py index 241a885d14..b07aec10ec 100644 --- a/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.py +++ b/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.py @@ -247,116 +247,116 @@ def create_variables_array(): def initialise_variables(states, rates, constants): - constants[1] = 0.0 - constants[2] = 1.0 - constants[3] = 1.0309347 - constants[5] = 2.0e-5 - constants[6] = 6.5e-5 - constants[22] = 8314.0 - constants[23] = 310.0 - constants[24] = 96845.0 - constants[26] = 5.8e-5 - constants[27] = 0.000189 - constants[28] = 5.8e-5 - constants[29] = 0.000189 - constants[30] = 5.81818e-5 - constants[31] = 0.0001888 - constants[34] = 2.52e-5 - constants[35] = 8.19e-5 - constants[36] = 2.52e-5 - constants[37] = 8.19e-5 - constants[38] = 2.523636e-5 - constants[39] = 8.1892e-5 - constants[42] = 1.32e-5 - constants[43] = 4.3e-5 - constants[44] = 1.323e-5 - constants[45] = 4.29e-5 - constants[46] = 1.3236e-5 - constants[47] = 4.2952e-5 - constants[50] = 2.7e-6 - constants[51] = 8.8e-6 - constants[52] = 2.8e-6 - constants[53] = 8.8e-6 - constants[54] = 2.7229e-6 - constants[55] = 8.83584e-6 - constants[56] = 8.0 - constants[57] = 0.5 - constants[58] = 2.0 - constants[59] = 140.0 - constants[60] = 0.0001 - constants[61] = 0.0001 - constants[63] = 0.0478 - constants[64] = 0.16 - constants[65] = 0.0478 - constants[66] = 0.16 - constants[67] = 0.04782545 - constants[68] = 0.1551936 - constants[69] = 5.4 - constants[70] = 0.621 - constants[71] = 5.64 - constants[73] = 0.0 - constants[74] = 0.0 - constants[75] = 0.0042 - constants[76] = 0.03339 - constants[77] = 0.0 - constants[78] = 0.0 - constants[79] = 140.0 - constants[82] = 0.0 - constants[83] = 1.2e-6 - constants[84] = 0.0 - constants[85] = 3.7e-7 - constants[86] = 0.0 - constants[87] = 1.204e-6 - constants[97] = 0.0058 - constants[98] = 0.0659 - constants[99] = 0.0082 - constants[100] = 0.0659 - constants[101] = 0.0057938 - constants[102] = 0.06588648 - constants[103] = 46.4 - constants[113] = 0.0043 - constants[114] = 0.0139 - constants[115] = 0.0021 - constants[116] = 0.00694 - constants[117] = 0.00427806 - constants[118] = 0.0138823 - constants[119] = 45.0 - constants[129] = 0.00491 - constants[130] = 0.03649 - constants[131] = 0.004905 - constants[132] = 0.0365 - constants[133] = 0.004905 - constants[134] = 0.036495 - constants[136] = 6.65e-5 - constants[137] = 0.0114 - constants[138] = 0.000266 - constants[139] = 0.0114 - constants[140] = 6.645504e-5 - constants[141] = 0.01138376 - constants[147] = 0.000797 - constants[148] = 0.016 - constants[149] = 0.000738 - constants[150] = 0.0208 - constants[151] = 0.00079704 - constants[152] = 0.016 - constants[161] = 0.000518 - constants[162] = 0.0104 - constants[163] = 0.000345 - constants[164] = 0.0104 - constants[165] = 0.0003445 - constants[166] = 0.0104 - constants[170] = 0.000548 - constants[171] = 0.0069 - constants[172] = 0.000437 - constants[173] = 0.0055 - constants[174] = 0.0005465 - constants[175] = 0.006875 - constants[177] = 0.000548 - constants[178] = 0.0069 - constants[179] = 0.000437 - constants[180] = 0.0055 - constants[181] = 0.0005465 - constants[182] = 0.006875 + constants[0] = 0.0 + constants[1] = 1.0 + constants[2] = 1.0309347 + constants[3] = 2.0e-5 + constants[4] = 6.5e-5 + constants[5] = 8314.0 + constants[6] = 310.0 + constants[7] = 96845.0 + constants[8] = 5.8e-5 + constants[9] = 0.000189 + constants[10] = 5.8e-5 + constants[11] = 0.000189 + constants[12] = 5.81818e-5 + constants[13] = 0.0001888 + constants[14] = 2.52e-5 + constants[15] = 8.19e-5 + constants[16] = 2.52e-5 + constants[17] = 8.19e-5 + constants[18] = 2.523636e-5 + constants[19] = 8.1892e-5 + constants[20] = 1.32e-5 + constants[21] = 4.3e-5 + constants[22] = 1.323e-5 + constants[23] = 4.29e-5 + constants[24] = 1.3236e-5 + constants[25] = 4.2952e-5 + constants[26] = 2.7e-6 + constants[27] = 8.8e-6 + constants[28] = 2.8e-6 + constants[29] = 8.8e-6 + constants[30] = 2.7229e-6 + constants[31] = 8.83584e-6 + constants[32] = 8.0 + constants[33] = 0.5 + constants[34] = 2.0 + constants[35] = 140.0 + constants[36] = 0.0001 + constants[37] = 0.0001 + constants[38] = 0.0478 + constants[39] = 0.16 + constants[40] = 0.0478 + constants[41] = 0.16 + constants[42] = 0.04782545 + constants[43] = 0.1551936 + constants[44] = 5.4 + constants[45] = 0.621 + constants[46] = 5.64 + constants[47] = 0.0 + constants[48] = 0.0 + constants[49] = 0.0042 + constants[50] = 0.03339 + constants[51] = 0.0 + constants[52] = 0.0 + constants[53] = 140.0 + constants[54] = 0.0 + constants[55] = 1.2e-6 + constants[56] = 0.0 + constants[57] = 3.7e-7 + constants[58] = 0.0 + constants[59] = 1.204e-6 + constants[60] = 0.0058 + constants[61] = 0.0659 + constants[62] = 0.0082 + constants[63] = 0.0659 + constants[64] = 0.0057938 + constants[65] = 0.06588648 + constants[66] = 46.4 + constants[67] = 0.0043 + constants[68] = 0.0139 + constants[69] = 0.0021 + constants[70] = 0.00694 + constants[71] = 0.00427806 + constants[72] = 0.0138823 + constants[73] = 45.0 + constants[74] = 0.00491 + constants[75] = 0.03649 + constants[76] = 0.004905 + constants[77] = 0.0365 + constants[78] = 0.004905 + constants[79] = 0.036495 + constants[80] = 6.65e-5 + constants[81] = 0.0114 + constants[82] = 0.000266 + constants[83] = 0.0114 + constants[84] = 6.645504e-5 + constants[85] = 0.01138376 + constants[86] = 0.000797 + constants[87] = 0.016 + constants[88] = 0.000738 + constants[89] = 0.0208 + constants[90] = 0.00079704 + constants[91] = 0.016 + constants[92] = 0.000518 + constants[93] = 0.0104 + constants[94] = 0.000345 + constants[95] = 0.0104 + constants[96] = 0.0003445 + constants[97] = 0.0104 + constants[98] = 0.000548 + constants[99] = 0.0069 + constants[100] = 0.000437 + constants[101] = 0.0055 + constants[102] = 0.0005465 + constants[103] = 0.006875 + constants[104] = 0.000548 + constants[105] = 0.0069 + constants[106] = 0.000437 + constants[107] = 0.0055 + constants[108] = 0.0005465 + constants[109] = 0.006875 states[0] = -39.013558536 states[1] = 0.092361701692 states[2] = 0.015905380261 @@ -375,151 +375,151 @@ def initialise_variables(states, rates, constants): def compute_computed_constants(constants, computed_constants): - computed_constants[0] = 1.07*(3.0*constants[1]-0.1)/(3.0*(1.0+0.7745*exp(-(3.0*constants[1]-2.05)/0.295))) if eq_func(constants[2], 0.0) else constants[3]*constants[1]/(1.0+0.7745*exp(-(3.0*constants[1]-2.05)/0.295)) if eq_func(constants[2], 1.0) else 1.07*29.0*constants[1]/(30.0*(1.0+0.7745*exp(-(29.0*constants[1]-24.5)/1.95))) - computed_constants[4] = constants[5]+computed_constants[0]*(constants[6]-constants[5]) - computed_constants[25] = constants[26]+computed_constants[0]*(constants[27]-constants[26]) if eq_func(constants[2], 0.0) else constants[30]+computed_constants[0]*(constants[31]-constants[30]) if eq_func(constants[2], 1.0) else constants[28]+computed_constants[0]*(constants[29]-constants[28]) - computed_constants[33] = constants[34]+computed_constants[0]*(constants[35]-constants[34]) if eq_func(constants[2], 0.0) else constants[38]+computed_constants[0]*(constants[39]-constants[38]) if eq_func(constants[2], 1.0) else constants[36]+computed_constants[0]*(constants[37]-constants[36]) - computed_constants[41] = constants[42]+computed_constants[0]*(constants[43]-constants[42]) if eq_func(constants[2], 0.0) else constants[46]+computed_constants[0]*(constants[47]-constants[46]) if eq_func(constants[2], 1.0) else constants[44]+computed_constants[0]*(constants[45]-constants[44]) - computed_constants[49] = constants[50]+computed_constants[0]*(constants[51]-constants[50]) if eq_func(constants[2], 0.0) else constants[54]+computed_constants[0]*(constants[55]-constants[54]) if eq_func(constants[2], 1.0) else constants[52]+computed_constants[0]*(constants[53]-constants[52]) - computed_constants[62] = constants[63]+computed_constants[0]*(constants[64]-constants[63]) if eq_func(constants[2], 0.0) else constants[67]+computed_constants[0]*(constants[68]-constants[67]) if eq_func(constants[2], 1.0) else constants[65]+computed_constants[0]*(constants[66]-constants[65]) - computed_constants[72] = constants[73]+computed_constants[0]*(constants[74]-constants[73]) if eq_func(constants[2], 0.0) else constants[77]+computed_constants[0]*(constants[78]-constants[77]) if eq_func(constants[2], 1.0) else constants[75]+computed_constants[0]*(constants[76]-constants[75]) - computed_constants[8] = computed_constants[72]*constants[60]/(constants[60]+0.0004) - computed_constants[32] = constants[22]*constants[23]/constants[24]*log(constants[59]/constants[56]) - computed_constants[40] = constants[22]*constants[23]/constants[24]*log(constants[69]/constants[79]) - computed_constants[48] = constants[22]*constants[23]/(2.0*constants[24])*log(constants[58]/constants[60]) - computed_constants[80] = constants[22]*constants[23]/constants[24]*log((constants[69]+0.12*constants[59])/(constants[79]+0.12*constants[56])) if eq_func(constants[2], 0.0) else constants[22]*constants[23]/constants[24]*log((constants[69]+0.03*constants[59])/(constants[79]+0.03*constants[56])) - computed_constants[81] = constants[82]+computed_constants[0]*(constants[83]-constants[82]) if eq_func(constants[2], 0.0) else constants[86]+computed_constants[0]*(constants[87]-constants[86]) if eq_func(constants[2], 1.0) else constants[84]+computed_constants[0]*(constants[85]-constants[84]) - computed_constants[96] = constants[97]+computed_constants[0]*(constants[98]-constants[97]) if eq_func(constants[2], 0.0) else constants[101]+computed_constants[0]*(constants[102]-constants[101]) if eq_func(constants[2], 1.0) else constants[99]+computed_constants[0]*(constants[100]-constants[99]) - computed_constants[112] = constants[113]+computed_constants[0]*(constants[114]-constants[113]) if eq_func(constants[2], 0.0) else constants[117]+computed_constants[0]*(constants[118]-constants[117]) if eq_func(constants[2], 1.0) else constants[115]+computed_constants[0]*(constants[116]-constants[115]) - computed_constants[128] = constants[129]+computed_constants[0]*(constants[130]-constants[129]) if eq_func(constants[2], 0.0) else constants[133]+computed_constants[0]*(constants[134]-constants[133]) if eq_func(constants[2], 1.0) else constants[131]+computed_constants[0]*(constants[132]-constants[131]) - computed_constants[135] = constants[136]+computed_constants[0]*(constants[137]-constants[136]) if eq_func(constants[2], 0.0) else constants[140]+computed_constants[0]*(constants[141]-constants[140]) if eq_func(constants[2], 1.0) else constants[138]+computed_constants[0]*(constants[139]-constants[138]) - computed_constants[146] = constants[147]+computed_constants[0]*(constants[148]-constants[147]) if eq_func(constants[2], 0.0) else constants[151]+computed_constants[0]*(constants[152]-constants[151]) if eq_func(constants[2], 1.0) else constants[149]+computed_constants[0]*(constants[150]-constants[149]) - computed_constants[158] = 0.002 if eq_func(constants[2], 0.0) else 0.002 if eq_func(constants[2], 1.0) else 0.006 - computed_constants[160] = constants[161]+computed_constants[0]*(constants[162]-constants[161]) if eq_func(constants[2], 0.0) else constants[165]+computed_constants[0]*(constants[166]-constants[165]) if eq_func(constants[2], 1.0) else constants[163]+computed_constants[0]*(constants[164]-constants[163]) - computed_constants[169] = constants[170]+computed_constants[0]*(constants[171]-constants[170]) if eq_func(constants[2], 0.0) else constants[174]+computed_constants[0]*(constants[175]-constants[174]) if eq_func(constants[2], 1.0) else constants[172]+computed_constants[0]*(constants[173]-constants[172]) - computed_constants[176] = constants[177]+computed_constants[0]*(constants[178]-constants[177]) if eq_func(constants[2], 0.0) else constants[181]+computed_constants[0]*(constants[182]-constants[181]) if eq_func(constants[2], 1.0) else constants[179]+computed_constants[0]*(constants[180]-constants[179]) + computed_constants[0] = 1.07*(3.0*constants[0]-0.1)/(3.0*(1.0+0.7745*exp(-(3.0*constants[0]-2.05)/0.295))) if eq_func(constants[1], 0.0) else constants[2]*constants[0]/(1.0+0.7745*exp(-(3.0*constants[0]-2.05)/0.295)) if eq_func(constants[1], 1.0) else 1.07*29.0*constants[0]/(30.0*(1.0+0.7745*exp(-(29.0*constants[0]-24.5)/1.95))) + computed_constants[1] = constants[3]+computed_constants[0]*(constants[4]-constants[3]) + computed_constants[3] = constants[8]+computed_constants[0]*(constants[9]-constants[8]) if eq_func(constants[1], 0.0) else constants[12]+computed_constants[0]*(constants[13]-constants[12]) if eq_func(constants[1], 1.0) else constants[10]+computed_constants[0]*(constants[11]-constants[10]) + computed_constants[5] = constants[14]+computed_constants[0]*(constants[15]-constants[14]) if eq_func(constants[1], 0.0) else constants[18]+computed_constants[0]*(constants[19]-constants[18]) if eq_func(constants[1], 1.0) else constants[16]+computed_constants[0]*(constants[17]-constants[16]) + computed_constants[7] = constants[20]+computed_constants[0]*(constants[21]-constants[20]) if eq_func(constants[1], 0.0) else constants[24]+computed_constants[0]*(constants[25]-constants[24]) if eq_func(constants[1], 1.0) else constants[22]+computed_constants[0]*(constants[23]-constants[22]) + computed_constants[9] = constants[26]+computed_constants[0]*(constants[27]-constants[26]) if eq_func(constants[1], 0.0) else constants[30]+computed_constants[0]*(constants[31]-constants[30]) if eq_func(constants[1], 1.0) else constants[28]+computed_constants[0]*(constants[29]-constants[28]) + computed_constants[10] = constants[38]+computed_constants[0]*(constants[39]-constants[38]) if eq_func(constants[1], 0.0) else constants[42]+computed_constants[0]*(constants[43]-constants[42]) if eq_func(constants[1], 1.0) else constants[40]+computed_constants[0]*(constants[41]-constants[40]) + computed_constants[11] = constants[47]+computed_constants[0]*(constants[48]-constants[47]) if eq_func(constants[1], 0.0) else constants[51]+computed_constants[0]*(constants[52]-constants[51]) if eq_func(constants[1], 1.0) else constants[49]+computed_constants[0]*(constants[50]-constants[49]) + computed_constants[2] = computed_constants[11]*constants[36]/(constants[36]+0.0004) + computed_constants[4] = constants[5]*constants[6]/constants[7]*log(constants[35]/constants[32]) + computed_constants[6] = constants[5]*constants[6]/constants[7]*log(constants[44]/constants[53]) + computed_constants[8] = constants[5]*constants[6]/(2.0*constants[7])*log(constants[34]/constants[36]) + computed_constants[12] = constants[5]*constants[6]/constants[7]*log((constants[44]+0.12*constants[35])/(constants[53]+0.12*constants[32])) if eq_func(constants[1], 0.0) else constants[5]*constants[6]/constants[7]*log((constants[44]+0.03*constants[35])/(constants[53]+0.03*constants[32])) + computed_constants[13] = constants[54]+computed_constants[0]*(constants[55]-constants[54]) if eq_func(constants[1], 0.0) else constants[58]+computed_constants[0]*(constants[59]-constants[58]) if eq_func(constants[1], 1.0) else constants[56]+computed_constants[0]*(constants[57]-constants[56]) + computed_constants[14] = constants[60]+computed_constants[0]*(constants[61]-constants[60]) if eq_func(constants[1], 0.0) else constants[64]+computed_constants[0]*(constants[65]-constants[64]) if eq_func(constants[1], 1.0) else constants[62]+computed_constants[0]*(constants[63]-constants[62]) + computed_constants[15] = constants[67]+computed_constants[0]*(constants[68]-constants[67]) if eq_func(constants[1], 0.0) else constants[71]+computed_constants[0]*(constants[72]-constants[71]) if eq_func(constants[1], 1.0) else constants[69]+computed_constants[0]*(constants[70]-constants[69]) + computed_constants[16] = constants[74]+computed_constants[0]*(constants[75]-constants[74]) if eq_func(constants[1], 0.0) else constants[78]+computed_constants[0]*(constants[79]-constants[78]) if eq_func(constants[1], 1.0) else constants[76]+computed_constants[0]*(constants[77]-constants[76]) + computed_constants[17] = constants[80]+computed_constants[0]*(constants[81]-constants[80]) if eq_func(constants[1], 0.0) else constants[84]+computed_constants[0]*(constants[85]-constants[84]) if eq_func(constants[1], 1.0) else constants[82]+computed_constants[0]*(constants[83]-constants[82]) + computed_constants[18] = constants[86]+computed_constants[0]*(constants[87]-constants[86]) if eq_func(constants[1], 0.0) else constants[90]+computed_constants[0]*(constants[91]-constants[90]) if eq_func(constants[1], 1.0) else constants[88]+computed_constants[0]*(constants[89]-constants[88]) + computed_constants[19] = 0.002 if eq_func(constants[1], 0.0) else 0.002 if eq_func(constants[1], 1.0) else 0.006 + computed_constants[20] = constants[92]+computed_constants[0]*(constants[93]-constants[92]) if eq_func(constants[1], 0.0) else constants[96]+computed_constants[0]*(constants[97]-constants[96]) if eq_func(constants[1], 1.0) else constants[94]+computed_constants[0]*(constants[95]-constants[94]) + computed_constants[21] = constants[98]+computed_constants[0]*(constants[99]-constants[98]) if eq_func(constants[1], 0.0) else constants[102]+computed_constants[0]*(constants[103]-constants[102]) if eq_func(constants[1], 1.0) else constants[100]+computed_constants[0]*(constants[101]-constants[100]) + computed_constants[22] = constants[104]+computed_constants[0]*(constants[105]-constants[104]) if eq_func(constants[1], 0.0) else constants[108]+computed_constants[0]*(constants[109]-constants[108]) if eq_func(constants[1], 1.0) else constants[106]+computed_constants[0]*(constants[107]-constants[106]) def compute_rates(voi, states, rates, constants, computed_constants, algebraic): - algebraic[9] = computed_constants[62]*pow(constants[56]/(constants[71]+constants[56]), 3.0)*pow(constants[69]/(constants[70]+constants[69]), 2.0)*1.6/(1.5+exp(-(states[0]+60.0)/40.0)) - algebraic[10] = computed_constants[49]*(pow(constants[56], 3.0)*constants[58]*exp(0.03743*states[0]*constants[57])-pow(constants[59], 3.0)*constants[60]*exp(0.0374*states[0]*(constants[57]-1.0)))/(1.0+constants[61]*(constants[60]*pow(constants[59], 3.0)+constants[58]*pow(constants[56], 3.0))) if eq_func(constants[2], 0.0) else computed_constants[49]*(pow(constants[56], 3.0)*constants[58]*exp(0.03743*states[0]*constants[57])-pow(constants[59], 3.0)*constants[60]*exp(0.03743*states[0]*(constants[57]-1.0)))/(1.0+constants[61]*(constants[60]*pow(constants[59], 3.0)+constants[58]*pow(constants[56], 3.0))) - algebraic[14] = computed_constants[176]*states[14]*(states[0]-computed_constants[40]) if neq_func(constants[2], 2.0) else computed_constants[176]*states[14]*(states[0]+102.0) - algebraic[15] = computed_constants[169]*states[14]*(states[0]-computed_constants[32]) if neq_func(constants[2], 2.0) else computed_constants[169]*states[14]*(states[0]-77.6) - algebraic[16] = computed_constants[160]*pow(states[13], 2.0)*(states[0]-computed_constants[80]) - algebraic[18] = computed_constants[135]*states[8]*(states[0]-computed_constants[40]) - algebraic[19] = computed_constants[128]*states[9]*states[8]*(states[0]-computed_constants[40]) - algebraic[20] = computed_constants[112]*states[7]*states[6]*(states[0]-constants[119]) - algebraic[21] = computed_constants[96]*(states[4]*states[5]+0.006/(1.0+exp(-(states[0]+14.1)/6.0)))*(states[0]-constants[103]) - algebraic[91] = 0.0952*exp(-0.063*(states[0]+34.4))/(1.0+1.66*exp(-0.225*(states[0]+63.7)))+0.0869 if eq_func(constants[2], 0.0) else 0.09518*exp(-0.06306*(states[0]+34.4))/(1.0+1.662*exp(-0.2251*(states[0]+63.7)))+0.08693 - algebraic[88] = (1.0-algebraic[91])*states[2]+algebraic[91]*states[3] - algebraic[7] = computed_constants[81]*pow(states[1], 3.0)*algebraic[88]*constants[59]*pow(constants[24], 2.0)/(constants[22]*constants[23])*(exp((states[0]-computed_constants[32])*constants[24]/(constants[22]*constants[23]))-1.0)/(exp(states[0]*constants[24]/(constants[22]*constants[23]))-1.0)*states[0] - algebraic[11] = computed_constants[33]*(states[0]-computed_constants[40]) - algebraic[12] = computed_constants[41]*(states[0]-computed_constants[48]) - algebraic[13] = computed_constants[25]*(states[0]-computed_constants[32]) - algebraic[153] = 0.6*states[11]+0.4*states[12] - algebraic[17] = computed_constants[146]*algebraic[153]*states[10]*(states[0]-computed_constants[40]) - rates[0] = -1.0/computed_constants[4]*(algebraic[7]+algebraic[21]+algebraic[20]+algebraic[19]+algebraic[18]+algebraic[17]+algebraic[16]+algebraic[15]+algebraic[14]+algebraic[13]+algebraic[12]+algebraic[11]+algebraic[10]+algebraic[9]+computed_constants[8]) - algebraic[89] = pow(1.0/(1.0+exp(-states[0]/5.46)), 1.0/3.0) if eq_func(constants[2], 0.0) else pow(1.0/(1.0+exp(-(states[0]+30.32)/5.46)), 1.0/3.0) - algebraic[90] = 0.0006247/(0.832*exp(-0.335*(states[0]+56.7))+0.627*exp(0.082*(states[0]+65.01)))+4.0e-5 if eq_func(constants[2], 0.0) else 0.0006247/(0.8322166*exp(-0.33566*(states[0]+56.7062))+0.6274*exp(0.0823*(states[0]+65.0131)))+4.569e-5 - rates[1] = (algebraic[89]-states[1])/algebraic[90] - algebraic[92] = 1.0/(1.0+exp((states[0]+66.1)/6.4)) - algebraic[93] = 3.717e-6*exp(-0.2815*(states[0]+17.11))/(1.0+0.003732*exp(-0.3426*(states[0]+37.76)))+0.0005977 - rates[2] = (algebraic[92]-states[2])/algebraic[93] - algebraic[94] = algebraic[92] - algebraic[95] = 3.186e-8*exp(-0.6219*(states[0]+18.8))/(1.0+7.189e-5*exp(-0.6683*(states[0]+34.07)))+0.003556 - rates[3] = (algebraic[94]-states[3])/algebraic[95] - algebraic[104] = 1.0/(1.0+exp(-(states[0]+23.1)/6.0)) if eq_func(constants[2], 0.0) else 1.0/(1.0+exp(-(states[0]+22.3+0.8*computed_constants[0])/6.0)) if eq_func(constants[2], 1.0) else 1.0/(1.0+exp(-(states[0]+22.2)/6.0)) - algebraic[106] = -28.38*(states[0]+35.0)/(exp(-(states[0]+35.0)/2.5)-1.0)-84.9*states[0]/(exp(-0.208*states[0])-1.0) if eq_func(constants[2], 0.0) else -28.39*(states[0]+35.0)/(exp(-(states[0]+35.0)/2.5)-1.0)-84.9*states[0]/(exp(-0.208*states[0])-1.0) if eq_func(constants[2], 1.0) else -28.4*(states[0]+35.0)/(exp(-(states[0]+35.0)/2.5)-1.0)-84.9*states[0]/(exp(-0.208*states[0])-1.0) - algebraic[107] = 11.43*(states[0]-5.0)/(exp(0.4*(states[0]-5.0))-1.0) if eq_func(constants[2], 1.0) else 11.42*(states[0]-5.0)/(exp(0.4*(states[0]-5.0))-1.0) - algebraic[105] = 2.0/(algebraic[106]+algebraic[107]) - rates[5] = (algebraic[104]-states[5])/algebraic[105] - algebraic[108] = 1.0/(1.0+exp((states[0]+45.0)/5.0)) - algebraic[110] = 3.75*(states[0]+28.0)/(exp((states[0]+28.0)/4.0)-1.0) if eq_func(constants[2], 1.0) else 3.12*(states[0]+28.0)/(exp((states[0]+28.0)/4.0)-1.0) - algebraic[111] = 30.0/(1.0+exp(-(states[0]+28.0)/4.0)) if eq_func(constants[2], 1.0) else 25.0/(1.0+exp(-(states[0]+28.0)/4.0)) - algebraic[109] = (1.2-0.2*computed_constants[0])/(algebraic[110]+algebraic[111]) if eq_func(constants[2], 1.0) else 1.0/(algebraic[110]+algebraic[111]) - rates[4] = (algebraic[108]-states[4])/algebraic[109] - algebraic[120] = 1.0/(1.0+exp(-(states[0]+37.0)/6.8)) - algebraic[122] = 1068.0*exp((states[0]+26.3)/30.0) - algebraic[123] = 1068.0*exp(-(states[0]+26.3)/30.0) - algebraic[121] = 1.0/(algebraic[122]+algebraic[123]) - rates[7] = (algebraic[120]-states[7])/algebraic[121] - algebraic[124] = 1.0/(1.0+exp((states[0]+71.0)/9.0)) - algebraic[126] = 15.3*exp(-(states[0]+71.0+0.7*computed_constants[0])/83.3) if eq_func(constants[2], 1.0) else 15.3*exp(-(states[0]+71.7)/83.3) - algebraic[127] = 15.0*exp((states[0]+71.0)/15.38) if eq_func(constants[2], 1.0) else 15.0*exp((states[0]+71.7)/15.38) - algebraic[125] = 1.0/(algebraic[126]+algebraic[127]) - rates[6] = (algebraic[124]-states[6])/algebraic[125] - algebraic[142] = 1.0/(1.0+exp((states[0]+59.37)/13.1)) - algebraic[143] = 0.0101+0.06517/(0.57*exp(-0.08*(states[0]+49.0)))+2.4e-5*exp(0.1*(states[0]+50.93)) if eq_func(constants[2], 0.0) else 0.001/3.0*(30.31+195.5/(0.5686*exp(-0.08161*(states[0]+39.0+10.0*computed_constants[0]))+0.7174*exp((0.2719-0.1719*computed_constants[0])*1.0*(states[0]+40.93+10.0*computed_constants[0])))) if eq_func(constants[2], 1.0) else 0.0101+0.06517/(0.5686*exp(-0.08161*(states[0]+39.0))+0.7174*exp(0.2719*(states[0]+40.93))) - rates[9] = (algebraic[142]-states[9])/algebraic[143] - algebraic[144] = 1.0/(1.0+exp(-(states[0]-10.93)/19.7)) - algebraic[145] = 0.001*(2.98+15.59/(1.037*exp(0.09*(states[0]+30.61))+0.369*exp(-0.12*(states[0]+23.84)))) if eq_func(constants[2], 0.0) else 0.0025*(1.191+7.838/(1.037*exp(0.09012*(states[0]+30.61))+0.369*exp(-0.119*(states[0]+23.84)))) if eq_func(constants[2], 1.0) else 0.001*(2.98+19.59/(1.037*exp(0.09012*(states[0]+30.61))+0.369*exp(-0.119*(states[0]+23.84)))) - rates[8] = (algebraic[144]-states[8])/algebraic[145] - algebraic[154] = 1.0/(1.0+exp(-(states[0]+14.2)/10.6)) if neq_func(constants[2], 2.0) else 1.0/(1.0+exp(-(states[0]+13.2)/10.6)) - algebraic[155] = 1.0/(37.2*exp((states[0]-9.0)/15.9)+0.96*exp(-(states[0]-9.0)/22.5)) if neq_func(constants[2], 2.0) else 1.0/(37.2*exp((states[0]-10.0)/15.9)+0.96*exp(-(states[0]-10.0)/22.5)) - rates[11] = (algebraic[154]-states[11])/algebraic[155] - algebraic[156] = algebraic[154] - algebraic[157] = 1.0/(4.2*exp((states[0]-9.0)/17.0)+0.15*exp(-(states[0]-9.0)/21.6)) if neq_func(constants[2], 2.0) else 1.0/(4.2*exp((states[0]-10.0)/17.0)+0.15*exp(-(states[0]-10.0)/21.6)) - rates[12] = (algebraic[156]-states[12])/algebraic[157] - algebraic[159] = 1.0/(1.0+exp((states[0]+18.6)/10.1)) - rates[10] = (algebraic[159]-states[10])/computed_constants[158] - algebraic[167] = 14.0/(1.0+exp(-(states[0]-40.0)/9.0)) - algebraic[168] = 1.0*exp(-states[0]/45.0) - rates[13] = algebraic[167]*(1.0-states[13])-algebraic[168]*states[13] - algebraic[183] = 1.0*exp(-(states[0]+78.91)/26.62) if eq_func(constants[2], 0.0) else 1.0*exp(-(states[0]+78.91)/26.63) - algebraic[184] = 1.0*exp((states[0]+75.13)/21.25) - rates[14] = algebraic[183]*(1.0-states[14])-algebraic[184]*states[14] + algebraic[1] = computed_constants[10]*pow(constants[32]/(constants[46]+constants[32]), 3.0)*pow(constants[44]/(constants[45]+constants[44]), 2.0)*1.6/(1.5+exp(-(states[0]+60.0)/40.0)) + algebraic[2] = computed_constants[9]*(pow(constants[32], 3.0)*constants[34]*exp(0.03743*states[0]*constants[33])-pow(constants[35], 3.0)*constants[36]*exp(0.0374*states[0]*(constants[33]-1.0)))/(1.0+constants[37]*(constants[36]*pow(constants[35], 3.0)+constants[34]*pow(constants[32], 3.0))) if eq_func(constants[1], 0.0) else computed_constants[9]*(pow(constants[32], 3.0)*constants[34]*exp(0.03743*states[0]*constants[33])-pow(constants[35], 3.0)*constants[36]*exp(0.03743*states[0]*(constants[33]-1.0)))/(1.0+constants[37]*(constants[36]*pow(constants[35], 3.0)+constants[34]*pow(constants[32], 3.0))) + algebraic[6] = computed_constants[22]*states[14]*(states[0]-computed_constants[6]) if neq_func(constants[1], 2.0) else computed_constants[22]*states[14]*(states[0]+102.0) + algebraic[7] = computed_constants[21]*states[14]*(states[0]-computed_constants[4]) if neq_func(constants[1], 2.0) else computed_constants[21]*states[14]*(states[0]-77.6) + algebraic[8] = computed_constants[20]*pow(states[13], 2.0)*(states[0]-computed_constants[12]) + algebraic[10] = computed_constants[17]*states[8]*(states[0]-computed_constants[6]) + algebraic[11] = computed_constants[16]*states[9]*states[8]*(states[0]-computed_constants[6]) + algebraic[12] = computed_constants[15]*states[7]*states[6]*(states[0]-constants[73]) + algebraic[13] = computed_constants[14]*(states[4]*states[5]+0.006/(1.0+exp(-(states[0]+14.1)/6.0)))*(states[0]-constants[66]) + algebraic[17] = 0.0952*exp(-0.063*(states[0]+34.4))/(1.0+1.66*exp(-0.225*(states[0]+63.7)))+0.0869 if eq_func(constants[1], 0.0) else 0.09518*exp(-0.06306*(states[0]+34.4))/(1.0+1.662*exp(-0.2251*(states[0]+63.7)))+0.08693 + algebraic[14] = (1.0-algebraic[17])*states[2]+algebraic[17]*states[3] + algebraic[0] = computed_constants[13]*pow(states[1], 3.0)*algebraic[14]*constants[35]*pow(constants[7], 2.0)/(constants[5]*constants[6])*(exp((states[0]-computed_constants[4])*constants[7]/(constants[5]*constants[6]))-1.0)/(exp(states[0]*constants[7]/(constants[5]*constants[6]))-1.0)*states[0] + algebraic[3] = computed_constants[5]*(states[0]-computed_constants[6]) + algebraic[4] = computed_constants[7]*(states[0]-computed_constants[8]) + algebraic[5] = computed_constants[3]*(states[0]-computed_constants[4]) + algebraic[42] = 0.6*states[11]+0.4*states[12] + algebraic[9] = computed_constants[18]*algebraic[42]*states[10]*(states[0]-computed_constants[6]) + rates[0] = -1.0/computed_constants[1]*(algebraic[0]+algebraic[13]+algebraic[12]+algebraic[11]+algebraic[10]+algebraic[9]+algebraic[8]+algebraic[7]+algebraic[6]+algebraic[5]+algebraic[4]+algebraic[3]+algebraic[2]+algebraic[1]+computed_constants[2]) + algebraic[15] = pow(1.0/(1.0+exp(-states[0]/5.46)), 1.0/3.0) if eq_func(constants[1], 0.0) else pow(1.0/(1.0+exp(-(states[0]+30.32)/5.46)), 1.0/3.0) + algebraic[16] = 0.0006247/(0.832*exp(-0.335*(states[0]+56.7))+0.627*exp(0.082*(states[0]+65.01)))+4.0e-5 if eq_func(constants[1], 0.0) else 0.0006247/(0.8322166*exp(-0.33566*(states[0]+56.7062))+0.6274*exp(0.0823*(states[0]+65.0131)))+4.569e-5 + rates[1] = (algebraic[15]-states[1])/algebraic[16] + algebraic[18] = 1.0/(1.0+exp((states[0]+66.1)/6.4)) + algebraic[19] = 3.717e-6*exp(-0.2815*(states[0]+17.11))/(1.0+0.003732*exp(-0.3426*(states[0]+37.76)))+0.0005977 + rates[2] = (algebraic[18]-states[2])/algebraic[19] + algebraic[20] = algebraic[18] + algebraic[21] = 3.186e-8*exp(-0.6219*(states[0]+18.8))/(1.0+7.189e-5*exp(-0.6683*(states[0]+34.07)))+0.003556 + rates[3] = (algebraic[20]-states[3])/algebraic[21] + algebraic[22] = 1.0/(1.0+exp(-(states[0]+23.1)/6.0)) if eq_func(constants[1], 0.0) else 1.0/(1.0+exp(-(states[0]+22.3+0.8*computed_constants[0])/6.0)) if eq_func(constants[1], 1.0) else 1.0/(1.0+exp(-(states[0]+22.2)/6.0)) + algebraic[24] = -28.38*(states[0]+35.0)/(exp(-(states[0]+35.0)/2.5)-1.0)-84.9*states[0]/(exp(-0.208*states[0])-1.0) if eq_func(constants[1], 0.0) else -28.39*(states[0]+35.0)/(exp(-(states[0]+35.0)/2.5)-1.0)-84.9*states[0]/(exp(-0.208*states[0])-1.0) if eq_func(constants[1], 1.0) else -28.4*(states[0]+35.0)/(exp(-(states[0]+35.0)/2.5)-1.0)-84.9*states[0]/(exp(-0.208*states[0])-1.0) + algebraic[25] = 11.43*(states[0]-5.0)/(exp(0.4*(states[0]-5.0))-1.0) if eq_func(constants[1], 1.0) else 11.42*(states[0]-5.0)/(exp(0.4*(states[0]-5.0))-1.0) + algebraic[23] = 2.0/(algebraic[24]+algebraic[25]) + rates[5] = (algebraic[22]-states[5])/algebraic[23] + algebraic[26] = 1.0/(1.0+exp((states[0]+45.0)/5.0)) + algebraic[28] = 3.75*(states[0]+28.0)/(exp((states[0]+28.0)/4.0)-1.0) if eq_func(constants[1], 1.0) else 3.12*(states[0]+28.0)/(exp((states[0]+28.0)/4.0)-1.0) + algebraic[29] = 30.0/(1.0+exp(-(states[0]+28.0)/4.0)) if eq_func(constants[1], 1.0) else 25.0/(1.0+exp(-(states[0]+28.0)/4.0)) + algebraic[27] = (1.2-0.2*computed_constants[0])/(algebraic[28]+algebraic[29]) if eq_func(constants[1], 1.0) else 1.0/(algebraic[28]+algebraic[29]) + rates[4] = (algebraic[26]-states[4])/algebraic[27] + algebraic[30] = 1.0/(1.0+exp(-(states[0]+37.0)/6.8)) + algebraic[32] = 1068.0*exp((states[0]+26.3)/30.0) + algebraic[33] = 1068.0*exp(-(states[0]+26.3)/30.0) + algebraic[31] = 1.0/(algebraic[32]+algebraic[33]) + rates[7] = (algebraic[30]-states[7])/algebraic[31] + algebraic[34] = 1.0/(1.0+exp((states[0]+71.0)/9.0)) + algebraic[36] = 15.3*exp(-(states[0]+71.0+0.7*computed_constants[0])/83.3) if eq_func(constants[1], 1.0) else 15.3*exp(-(states[0]+71.7)/83.3) + algebraic[37] = 15.0*exp((states[0]+71.0)/15.38) if eq_func(constants[1], 1.0) else 15.0*exp((states[0]+71.7)/15.38) + algebraic[35] = 1.0/(algebraic[36]+algebraic[37]) + rates[6] = (algebraic[34]-states[6])/algebraic[35] + algebraic[38] = 1.0/(1.0+exp((states[0]+59.37)/13.1)) + algebraic[39] = 0.0101+0.06517/(0.57*exp(-0.08*(states[0]+49.0)))+2.4e-5*exp(0.1*(states[0]+50.93)) if eq_func(constants[1], 0.0) else 0.001/3.0*(30.31+195.5/(0.5686*exp(-0.08161*(states[0]+39.0+10.0*computed_constants[0]))+0.7174*exp((0.2719-0.1719*computed_constants[0])*1.0*(states[0]+40.93+10.0*computed_constants[0])))) if eq_func(constants[1], 1.0) else 0.0101+0.06517/(0.5686*exp(-0.08161*(states[0]+39.0))+0.7174*exp(0.2719*(states[0]+40.93))) + rates[9] = (algebraic[38]-states[9])/algebraic[39] + algebraic[40] = 1.0/(1.0+exp(-(states[0]-10.93)/19.7)) + algebraic[41] = 0.001*(2.98+15.59/(1.037*exp(0.09*(states[0]+30.61))+0.369*exp(-0.12*(states[0]+23.84)))) if eq_func(constants[1], 0.0) else 0.0025*(1.191+7.838/(1.037*exp(0.09012*(states[0]+30.61))+0.369*exp(-0.119*(states[0]+23.84)))) if eq_func(constants[1], 1.0) else 0.001*(2.98+19.59/(1.037*exp(0.09012*(states[0]+30.61))+0.369*exp(-0.119*(states[0]+23.84)))) + rates[8] = (algebraic[40]-states[8])/algebraic[41] + algebraic[43] = 1.0/(1.0+exp(-(states[0]+14.2)/10.6)) if neq_func(constants[1], 2.0) else 1.0/(1.0+exp(-(states[0]+13.2)/10.6)) + algebraic[44] = 1.0/(37.2*exp((states[0]-9.0)/15.9)+0.96*exp(-(states[0]-9.0)/22.5)) if neq_func(constants[1], 2.0) else 1.0/(37.2*exp((states[0]-10.0)/15.9)+0.96*exp(-(states[0]-10.0)/22.5)) + rates[11] = (algebraic[43]-states[11])/algebraic[44] + algebraic[45] = algebraic[43] + algebraic[46] = 1.0/(4.2*exp((states[0]-9.0)/17.0)+0.15*exp(-(states[0]-9.0)/21.6)) if neq_func(constants[1], 2.0) else 1.0/(4.2*exp((states[0]-10.0)/17.0)+0.15*exp(-(states[0]-10.0)/21.6)) + rates[12] = (algebraic[45]-states[12])/algebraic[46] + algebraic[47] = 1.0/(1.0+exp((states[0]+18.6)/10.1)) + rates[10] = (algebraic[47]-states[10])/computed_constants[19] + algebraic[48] = 14.0/(1.0+exp(-(states[0]-40.0)/9.0)) + algebraic[49] = 1.0*exp(-states[0]/45.0) + rates[13] = algebraic[48]*(1.0-states[13])-algebraic[49]*states[13] + algebraic[50] = 1.0*exp(-(states[0]+78.91)/26.62) if eq_func(constants[1], 0.0) else 1.0*exp(-(states[0]+78.91)/26.63) + algebraic[51] = 1.0*exp((states[0]+75.13)/21.25) + rates[14] = algebraic[50]*(1.0-states[14])-algebraic[51]*states[14] def compute_variables(voi, states, rates, constants, computed_constants, algebraic): - algebraic[13] = computed_constants[25]*(states[0]-computed_constants[32]) - algebraic[11] = computed_constants[33]*(states[0]-computed_constants[40]) - algebraic[12] = computed_constants[41]*(states[0]-computed_constants[48]) - algebraic[10] = computed_constants[49]*(pow(constants[56], 3.0)*constants[58]*exp(0.03743*states[0]*constants[57])-pow(constants[59], 3.0)*constants[60]*exp(0.0374*states[0]*(constants[57]-1.0)))/(1.0+constants[61]*(constants[60]*pow(constants[59], 3.0)+constants[58]*pow(constants[56], 3.0))) if eq_func(constants[2], 0.0) else computed_constants[49]*(pow(constants[56], 3.0)*constants[58]*exp(0.03743*states[0]*constants[57])-pow(constants[59], 3.0)*constants[60]*exp(0.03743*states[0]*(constants[57]-1.0)))/(1.0+constants[61]*(constants[60]*pow(constants[59], 3.0)+constants[58]*pow(constants[56], 3.0))) - algebraic[9] = computed_constants[62]*pow(constants[56]/(constants[71]+constants[56]), 3.0)*pow(constants[69]/(constants[70]+constants[69]), 2.0)*1.6/(1.5+exp(-(states[0]+60.0)/40.0)) - algebraic[91] = 0.0952*exp(-0.063*(states[0]+34.4))/(1.0+1.66*exp(-0.225*(states[0]+63.7)))+0.0869 if eq_func(constants[2], 0.0) else 0.09518*exp(-0.06306*(states[0]+34.4))/(1.0+1.662*exp(-0.2251*(states[0]+63.7)))+0.08693 - algebraic[88] = (1.0-algebraic[91])*states[2]+algebraic[91]*states[3] - algebraic[7] = computed_constants[81]*pow(states[1], 3.0)*algebraic[88]*constants[59]*pow(constants[24], 2.0)/(constants[22]*constants[23])*(exp((states[0]-computed_constants[32])*constants[24]/(constants[22]*constants[23]))-1.0)/(exp(states[0]*constants[24]/(constants[22]*constants[23]))-1.0)*states[0] - algebraic[89] = pow(1.0/(1.0+exp(-states[0]/5.46)), 1.0/3.0) if eq_func(constants[2], 0.0) else pow(1.0/(1.0+exp(-(states[0]+30.32)/5.46)), 1.0/3.0) - algebraic[90] = 0.0006247/(0.832*exp(-0.335*(states[0]+56.7))+0.627*exp(0.082*(states[0]+65.01)))+4.0e-5 if eq_func(constants[2], 0.0) else 0.0006247/(0.8322166*exp(-0.33566*(states[0]+56.7062))+0.6274*exp(0.0823*(states[0]+65.0131)))+4.569e-5 - algebraic[92] = 1.0/(1.0+exp((states[0]+66.1)/6.4)) - algebraic[94] = algebraic[92] - algebraic[93] = 3.717e-6*exp(-0.2815*(states[0]+17.11))/(1.0+0.003732*exp(-0.3426*(states[0]+37.76)))+0.0005977 - algebraic[95] = 3.186e-8*exp(-0.6219*(states[0]+18.8))/(1.0+7.189e-5*exp(-0.6683*(states[0]+34.07)))+0.003556 - algebraic[21] = computed_constants[96]*(states[4]*states[5]+0.006/(1.0+exp(-(states[0]+14.1)/6.0)))*(states[0]-constants[103]) - algebraic[106] = -28.38*(states[0]+35.0)/(exp(-(states[0]+35.0)/2.5)-1.0)-84.9*states[0]/(exp(-0.208*states[0])-1.0) if eq_func(constants[2], 0.0) else -28.39*(states[0]+35.0)/(exp(-(states[0]+35.0)/2.5)-1.0)-84.9*states[0]/(exp(-0.208*states[0])-1.0) if eq_func(constants[2], 1.0) else -28.4*(states[0]+35.0)/(exp(-(states[0]+35.0)/2.5)-1.0)-84.9*states[0]/(exp(-0.208*states[0])-1.0) - algebraic[107] = 11.43*(states[0]-5.0)/(exp(0.4*(states[0]-5.0))-1.0) if eq_func(constants[2], 1.0) else 11.42*(states[0]-5.0)/(exp(0.4*(states[0]-5.0))-1.0) - algebraic[105] = 2.0/(algebraic[106]+algebraic[107]) - algebraic[104] = 1.0/(1.0+exp(-(states[0]+23.1)/6.0)) if eq_func(constants[2], 0.0) else 1.0/(1.0+exp(-(states[0]+22.3+0.8*computed_constants[0])/6.0)) if eq_func(constants[2], 1.0) else 1.0/(1.0+exp(-(states[0]+22.2)/6.0)) - algebraic[110] = 3.75*(states[0]+28.0)/(exp((states[0]+28.0)/4.0)-1.0) if eq_func(constants[2], 1.0) else 3.12*(states[0]+28.0)/(exp((states[0]+28.0)/4.0)-1.0) - algebraic[111] = 30.0/(1.0+exp(-(states[0]+28.0)/4.0)) if eq_func(constants[2], 1.0) else 25.0/(1.0+exp(-(states[0]+28.0)/4.0)) - algebraic[109] = (1.2-0.2*computed_constants[0])/(algebraic[110]+algebraic[111]) if eq_func(constants[2], 1.0) else 1.0/(algebraic[110]+algebraic[111]) - algebraic[108] = 1.0/(1.0+exp((states[0]+45.0)/5.0)) - algebraic[20] = computed_constants[112]*states[7]*states[6]*(states[0]-constants[119]) - algebraic[122] = 1068.0*exp((states[0]+26.3)/30.0) - algebraic[123] = 1068.0*exp(-(states[0]+26.3)/30.0) - algebraic[121] = 1.0/(algebraic[122]+algebraic[123]) - algebraic[120] = 1.0/(1.0+exp(-(states[0]+37.0)/6.8)) - algebraic[126] = 15.3*exp(-(states[0]+71.0+0.7*computed_constants[0])/83.3) if eq_func(constants[2], 1.0) else 15.3*exp(-(states[0]+71.7)/83.3) - algebraic[127] = 15.0*exp((states[0]+71.0)/15.38) if eq_func(constants[2], 1.0) else 15.0*exp((states[0]+71.7)/15.38) - algebraic[125] = 1.0/(algebraic[126]+algebraic[127]) - algebraic[124] = 1.0/(1.0+exp((states[0]+71.0)/9.0)) - algebraic[19] = computed_constants[128]*states[9]*states[8]*(states[0]-computed_constants[40]) - algebraic[18] = computed_constants[135]*states[8]*(states[0]-computed_constants[40]) - algebraic[142] = 1.0/(1.0+exp((states[0]+59.37)/13.1)) - algebraic[143] = 0.0101+0.06517/(0.57*exp(-0.08*(states[0]+49.0)))+2.4e-5*exp(0.1*(states[0]+50.93)) if eq_func(constants[2], 0.0) else 0.001/3.0*(30.31+195.5/(0.5686*exp(-0.08161*(states[0]+39.0+10.0*computed_constants[0]))+0.7174*exp((0.2719-0.1719*computed_constants[0])*1.0*(states[0]+40.93+10.0*computed_constants[0])))) if eq_func(constants[2], 1.0) else 0.0101+0.06517/(0.5686*exp(-0.08161*(states[0]+39.0))+0.7174*exp(0.2719*(states[0]+40.93))) - algebraic[144] = 1.0/(1.0+exp(-(states[0]-10.93)/19.7)) - algebraic[145] = 0.001*(2.98+15.59/(1.037*exp(0.09*(states[0]+30.61))+0.369*exp(-0.12*(states[0]+23.84)))) if eq_func(constants[2], 0.0) else 0.0025*(1.191+7.838/(1.037*exp(0.09012*(states[0]+30.61))+0.369*exp(-0.119*(states[0]+23.84)))) if eq_func(constants[2], 1.0) else 0.001*(2.98+19.59/(1.037*exp(0.09012*(states[0]+30.61))+0.369*exp(-0.119*(states[0]+23.84)))) - algebraic[153] = 0.6*states[11]+0.4*states[12] - algebraic[17] = computed_constants[146]*algebraic[153]*states[10]*(states[0]-computed_constants[40]) - algebraic[154] = 1.0/(1.0+exp(-(states[0]+14.2)/10.6)) if neq_func(constants[2], 2.0) else 1.0/(1.0+exp(-(states[0]+13.2)/10.6)) - algebraic[155] = 1.0/(37.2*exp((states[0]-9.0)/15.9)+0.96*exp(-(states[0]-9.0)/22.5)) if neq_func(constants[2], 2.0) else 1.0/(37.2*exp((states[0]-10.0)/15.9)+0.96*exp(-(states[0]-10.0)/22.5)) - algebraic[156] = algebraic[154] - algebraic[157] = 1.0/(4.2*exp((states[0]-9.0)/17.0)+0.15*exp(-(states[0]-9.0)/21.6)) if neq_func(constants[2], 2.0) else 1.0/(4.2*exp((states[0]-10.0)/17.0)+0.15*exp(-(states[0]-10.0)/21.6)) - algebraic[159] = 1.0/(1.0+exp((states[0]+18.6)/10.1)) - algebraic[16] = computed_constants[160]*pow(states[13], 2.0)*(states[0]-computed_constants[80]) - algebraic[167] = 14.0/(1.0+exp(-(states[0]-40.0)/9.0)) - algebraic[168] = 1.0*exp(-states[0]/45.0) - algebraic[15] = computed_constants[169]*states[14]*(states[0]-computed_constants[32]) if neq_func(constants[2], 2.0) else computed_constants[169]*states[14]*(states[0]-77.6) - algebraic[14] = computed_constants[176]*states[14]*(states[0]-computed_constants[40]) if neq_func(constants[2], 2.0) else computed_constants[176]*states[14]*(states[0]+102.0) - algebraic[183] = 1.0*exp(-(states[0]+78.91)/26.62) if eq_func(constants[2], 0.0) else 1.0*exp(-(states[0]+78.91)/26.63) - algebraic[184] = 1.0*exp((states[0]+75.13)/21.25) + algebraic[5] = computed_constants[3]*(states[0]-computed_constants[4]) + algebraic[3] = computed_constants[5]*(states[0]-computed_constants[6]) + algebraic[4] = computed_constants[7]*(states[0]-computed_constants[8]) + algebraic[2] = computed_constants[9]*(pow(constants[32], 3.0)*constants[34]*exp(0.03743*states[0]*constants[33])-pow(constants[35], 3.0)*constants[36]*exp(0.0374*states[0]*(constants[33]-1.0)))/(1.0+constants[37]*(constants[36]*pow(constants[35], 3.0)+constants[34]*pow(constants[32], 3.0))) if eq_func(constants[1], 0.0) else computed_constants[9]*(pow(constants[32], 3.0)*constants[34]*exp(0.03743*states[0]*constants[33])-pow(constants[35], 3.0)*constants[36]*exp(0.03743*states[0]*(constants[33]-1.0)))/(1.0+constants[37]*(constants[36]*pow(constants[35], 3.0)+constants[34]*pow(constants[32], 3.0))) + algebraic[1] = computed_constants[10]*pow(constants[32]/(constants[46]+constants[32]), 3.0)*pow(constants[44]/(constants[45]+constants[44]), 2.0)*1.6/(1.5+exp(-(states[0]+60.0)/40.0)) + algebraic[17] = 0.0952*exp(-0.063*(states[0]+34.4))/(1.0+1.66*exp(-0.225*(states[0]+63.7)))+0.0869 if eq_func(constants[1], 0.0) else 0.09518*exp(-0.06306*(states[0]+34.4))/(1.0+1.662*exp(-0.2251*(states[0]+63.7)))+0.08693 + algebraic[14] = (1.0-algebraic[17])*states[2]+algebraic[17]*states[3] + algebraic[0] = computed_constants[13]*pow(states[1], 3.0)*algebraic[14]*constants[35]*pow(constants[7], 2.0)/(constants[5]*constants[6])*(exp((states[0]-computed_constants[4])*constants[7]/(constants[5]*constants[6]))-1.0)/(exp(states[0]*constants[7]/(constants[5]*constants[6]))-1.0)*states[0] + algebraic[15] = pow(1.0/(1.0+exp(-states[0]/5.46)), 1.0/3.0) if eq_func(constants[1], 0.0) else pow(1.0/(1.0+exp(-(states[0]+30.32)/5.46)), 1.0/3.0) + algebraic[16] = 0.0006247/(0.832*exp(-0.335*(states[0]+56.7))+0.627*exp(0.082*(states[0]+65.01)))+4.0e-5 if eq_func(constants[1], 0.0) else 0.0006247/(0.8322166*exp(-0.33566*(states[0]+56.7062))+0.6274*exp(0.0823*(states[0]+65.0131)))+4.569e-5 + algebraic[18] = 1.0/(1.0+exp((states[0]+66.1)/6.4)) + algebraic[20] = algebraic[18] + algebraic[19] = 3.717e-6*exp(-0.2815*(states[0]+17.11))/(1.0+0.003732*exp(-0.3426*(states[0]+37.76)))+0.0005977 + algebraic[21] = 3.186e-8*exp(-0.6219*(states[0]+18.8))/(1.0+7.189e-5*exp(-0.6683*(states[0]+34.07)))+0.003556 + algebraic[13] = computed_constants[14]*(states[4]*states[5]+0.006/(1.0+exp(-(states[0]+14.1)/6.0)))*(states[0]-constants[66]) + algebraic[24] = -28.38*(states[0]+35.0)/(exp(-(states[0]+35.0)/2.5)-1.0)-84.9*states[0]/(exp(-0.208*states[0])-1.0) if eq_func(constants[1], 0.0) else -28.39*(states[0]+35.0)/(exp(-(states[0]+35.0)/2.5)-1.0)-84.9*states[0]/(exp(-0.208*states[0])-1.0) if eq_func(constants[1], 1.0) else -28.4*(states[0]+35.0)/(exp(-(states[0]+35.0)/2.5)-1.0)-84.9*states[0]/(exp(-0.208*states[0])-1.0) + algebraic[25] = 11.43*(states[0]-5.0)/(exp(0.4*(states[0]-5.0))-1.0) if eq_func(constants[1], 1.0) else 11.42*(states[0]-5.0)/(exp(0.4*(states[0]-5.0))-1.0) + algebraic[23] = 2.0/(algebraic[24]+algebraic[25]) + algebraic[22] = 1.0/(1.0+exp(-(states[0]+23.1)/6.0)) if eq_func(constants[1], 0.0) else 1.0/(1.0+exp(-(states[0]+22.3+0.8*computed_constants[0])/6.0)) if eq_func(constants[1], 1.0) else 1.0/(1.0+exp(-(states[0]+22.2)/6.0)) + algebraic[28] = 3.75*(states[0]+28.0)/(exp((states[0]+28.0)/4.0)-1.0) if eq_func(constants[1], 1.0) else 3.12*(states[0]+28.0)/(exp((states[0]+28.0)/4.0)-1.0) + algebraic[29] = 30.0/(1.0+exp(-(states[0]+28.0)/4.0)) if eq_func(constants[1], 1.0) else 25.0/(1.0+exp(-(states[0]+28.0)/4.0)) + algebraic[27] = (1.2-0.2*computed_constants[0])/(algebraic[28]+algebraic[29]) if eq_func(constants[1], 1.0) else 1.0/(algebraic[28]+algebraic[29]) + algebraic[26] = 1.0/(1.0+exp((states[0]+45.0)/5.0)) + algebraic[12] = computed_constants[15]*states[7]*states[6]*(states[0]-constants[73]) + algebraic[32] = 1068.0*exp((states[0]+26.3)/30.0) + algebraic[33] = 1068.0*exp(-(states[0]+26.3)/30.0) + algebraic[31] = 1.0/(algebraic[32]+algebraic[33]) + algebraic[30] = 1.0/(1.0+exp(-(states[0]+37.0)/6.8)) + algebraic[36] = 15.3*exp(-(states[0]+71.0+0.7*computed_constants[0])/83.3) if eq_func(constants[1], 1.0) else 15.3*exp(-(states[0]+71.7)/83.3) + algebraic[37] = 15.0*exp((states[0]+71.0)/15.38) if eq_func(constants[1], 1.0) else 15.0*exp((states[0]+71.7)/15.38) + algebraic[35] = 1.0/(algebraic[36]+algebraic[37]) + algebraic[34] = 1.0/(1.0+exp((states[0]+71.0)/9.0)) + algebraic[11] = computed_constants[16]*states[9]*states[8]*(states[0]-computed_constants[6]) + algebraic[10] = computed_constants[17]*states[8]*(states[0]-computed_constants[6]) + algebraic[38] = 1.0/(1.0+exp((states[0]+59.37)/13.1)) + algebraic[39] = 0.0101+0.06517/(0.57*exp(-0.08*(states[0]+49.0)))+2.4e-5*exp(0.1*(states[0]+50.93)) if eq_func(constants[1], 0.0) else 0.001/3.0*(30.31+195.5/(0.5686*exp(-0.08161*(states[0]+39.0+10.0*computed_constants[0]))+0.7174*exp((0.2719-0.1719*computed_constants[0])*1.0*(states[0]+40.93+10.0*computed_constants[0])))) if eq_func(constants[1], 1.0) else 0.0101+0.06517/(0.5686*exp(-0.08161*(states[0]+39.0))+0.7174*exp(0.2719*(states[0]+40.93))) + algebraic[40] = 1.0/(1.0+exp(-(states[0]-10.93)/19.7)) + algebraic[41] = 0.001*(2.98+15.59/(1.037*exp(0.09*(states[0]+30.61))+0.369*exp(-0.12*(states[0]+23.84)))) if eq_func(constants[1], 0.0) else 0.0025*(1.191+7.838/(1.037*exp(0.09012*(states[0]+30.61))+0.369*exp(-0.119*(states[0]+23.84)))) if eq_func(constants[1], 1.0) else 0.001*(2.98+19.59/(1.037*exp(0.09012*(states[0]+30.61))+0.369*exp(-0.119*(states[0]+23.84)))) + algebraic[42] = 0.6*states[11]+0.4*states[12] + algebraic[9] = computed_constants[18]*algebraic[42]*states[10]*(states[0]-computed_constants[6]) + algebraic[43] = 1.0/(1.0+exp(-(states[0]+14.2)/10.6)) if neq_func(constants[1], 2.0) else 1.0/(1.0+exp(-(states[0]+13.2)/10.6)) + algebraic[44] = 1.0/(37.2*exp((states[0]-9.0)/15.9)+0.96*exp(-(states[0]-9.0)/22.5)) if neq_func(constants[1], 2.0) else 1.0/(37.2*exp((states[0]-10.0)/15.9)+0.96*exp(-(states[0]-10.0)/22.5)) + algebraic[45] = algebraic[43] + algebraic[46] = 1.0/(4.2*exp((states[0]-9.0)/17.0)+0.15*exp(-(states[0]-9.0)/21.6)) if neq_func(constants[1], 2.0) else 1.0/(4.2*exp((states[0]-10.0)/17.0)+0.15*exp(-(states[0]-10.0)/21.6)) + algebraic[47] = 1.0/(1.0+exp((states[0]+18.6)/10.1)) + algebraic[8] = computed_constants[20]*pow(states[13], 2.0)*(states[0]-computed_constants[12]) + algebraic[48] = 14.0/(1.0+exp(-(states[0]-40.0)/9.0)) + algebraic[49] = 1.0*exp(-states[0]/45.0) + algebraic[7] = computed_constants[21]*states[14]*(states[0]-computed_constants[4]) if neq_func(constants[1], 2.0) else computed_constants[21]*states[14]*(states[0]-77.6) + algebraic[6] = computed_constants[22]*states[14]*(states[0]-computed_constants[6]) if neq_func(constants[1], 2.0) else computed_constants[22]*states[14]*(states[0]+102.0) + algebraic[50] = 1.0*exp(-(states[0]+78.91)/26.62) if eq_func(constants[1], 0.0) else 1.0*exp(-(states[0]+78.91)/26.63) + algebraic[51] = 1.0*exp((states[0]+75.13)/21.25) diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.c index df6f7da7ae..fd4eb1dfc8 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.c @@ -72,11 +72,11 @@ void deleteArray(double *array) void initialiseVariables(double voi, double *states, double *rates, double *constants, ExternalVariable externalVariable) { - constants[4] = 1.0; - constants[5] = 0.0; - constants[7] = 0.3; - constants[9] = 120.0; - constants[15] = 36.0; + constants[0] = 1.0; + constants[1] = 0.0; + constants[2] = 0.3; + constants[3] = 120.0; + constants[4] = 36.0; states[0] = 0.0; states[1] = 0.6; states[2] = 0.05; @@ -86,39 +86,39 @@ void initialiseVariables(double voi, double *states, double *rates, double *cons void computeComputedConstants(double *constants, double *computedConstants) { - computedConstants[6] = constants[5]-10.613; - computedConstants[8] = constants[5]-115.0; - computedConstants[14] = constants[5]+12.0; + computedConstants[0] = constants[1]-10.613; + computedConstants[1] = constants[1]-115.0; + computedConstants[2] = constants[1]+12.0; } void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) { algebraic[0] = externalVariable(voi, states, rates, variables, 0); - algebraic[1] = constants[7]*(states[0]-computedConstants[6]); - algebraic[2] = constants[15]*pow(states[3], 4.0)*(states[0]-computedConstants[14]); - algebraic[3] = constants[9]*pow(states[2], 3.0)*states[1]*(states[0]-computedConstants[8]); - rates[0] = -(-algebraic[0]+algebraic[3]+algebraic[2]+algebraic[1])/constants[4]; - algebraic[10] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0); - algebraic[11] = 4.0*exp(states[0]/18.0); - rates[2] = algebraic[10]*(1.0-states[2])-algebraic[11]*states[2]; - algebraic[12] = 0.07*exp(states[0]/20.0); - algebraic[13] = 1.0/(exp((states[0]+30.0)/10.0)+1.0); - rates[1] = algebraic[12]*(1.0-states[1])-algebraic[13]*states[1]; - algebraic[16] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0); - algebraic[17] = 0.125*exp(states[0]/80.0); - rates[3] = algebraic[16]*(1.0-states[3])-algebraic[17]*states[3]; + algebraic[1] = constants[2]*(states[0]-computedConstants[0]); + algebraic[2] = constants[4]*pow(states[3], 4.0)*(states[0]-computedConstants[2]); + algebraic[3] = constants[3]*pow(states[2], 3.0)*states[1]*(states[0]-computedConstants[1]); + rates[0] = -(-algebraic[0]+algebraic[3]+algebraic[2]+algebraic[1])/constants[0]; + algebraic[4] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0); + algebraic[5] = 4.0*exp(states[0]/18.0); + rates[2] = algebraic[4]*(1.0-states[2])-algebraic[5]*states[2]; + algebraic[6] = 0.07*exp(states[0]/20.0); + algebraic[7] = 1.0/(exp((states[0]+30.0)/10.0)+1.0); + rates[1] = algebraic[6]*(1.0-states[1])-algebraic[7]*states[1]; + algebraic[8] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0); + algebraic[9] = 0.125*exp(states[0]/80.0); + rates[3] = algebraic[8]*(1.0-states[3])-algebraic[9]*states[3]; } void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) { algebraic[0] = externalVariable(voi, states, rates, variables, 0); - algebraic[1] = constants[7]*(states[0]-computedConstants[6]); - algebraic[3] = constants[9]*pow(states[2], 3.0)*states[1]*(states[0]-computedConstants[8]); - algebraic[10] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0); - algebraic[11] = 4.0*exp(states[0]/18.0); - algebraic[12] = 0.07*exp(states[0]/20.0); - algebraic[13] = 1.0/(exp((states[0]+30.0)/10.0)+1.0); - algebraic[2] = constants[15]*pow(states[3], 4.0)*(states[0]-computedConstants[14]); - algebraic[16] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0); - algebraic[17] = 0.125*exp(states[0]/80.0); + algebraic[1] = constants[2]*(states[0]-computedConstants[0]); + algebraic[3] = constants[3]*pow(states[2], 3.0)*states[1]*(states[0]-computedConstants[1]); + algebraic[4] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0); + algebraic[5] = 4.0*exp(states[0]/18.0); + algebraic[6] = 0.07*exp(states[0]/20.0); + algebraic[7] = 1.0/(exp((states[0]+30.0)/10.0)+1.0); + algebraic[2] = constants[4]*pow(states[3], 4.0)*(states[0]-computedConstants[2]); + algebraic[8] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0); + algebraic[9] = 0.125*exp(states[0]/80.0); } diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.py index e287d4bc52..9b752f340f 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.py @@ -74,11 +74,11 @@ def create_variables_array(): def initialise_variables(voi, states, rates, constants, external_variable): - constants[4] = 1.0 - constants[5] = 0.0 - constants[7] = 0.3 - constants[9] = 120.0 - constants[15] = 36.0 + constants[0] = 1.0 + constants[1] = 0.0 + constants[2] = 0.3 + constants[3] = 120.0 + constants[4] = 36.0 states[0] = 0.0 states[1] = 0.6 states[2] = 0.05 @@ -87,36 +87,36 @@ def initialise_variables(voi, states, rates, constants, external_variable): def compute_computed_constants(constants, computed_constants): - computed_constants[6] = constants[5]-10.613 - computed_constants[8] = constants[5]-115.0 - computed_constants[14] = constants[5]+12.0 + computed_constants[0] = constants[1]-10.613 + computed_constants[1] = constants[1]-115.0 + computed_constants[2] = constants[1]+12.0 def compute_rates(voi, states, rates, constants, computed_constants, algebraic, external_variable): algebraic[0] = external_variable(voi, states, rates, variables, 0) - algebraic[1] = constants[7]*(states[0]-computed_constants[6]) - algebraic[2] = constants[15]*pow(states[3], 4.0)*(states[0]-computed_constants[14]) - algebraic[3] = constants[9]*pow(states[2], 3.0)*states[1]*(states[0]-computed_constants[8]) - rates[0] = -(-algebraic[0]+algebraic[3]+algebraic[2]+algebraic[1])/constants[4] - algebraic[10] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0) - algebraic[11] = 4.0*exp(states[0]/18.0) - rates[2] = algebraic[10]*(1.0-states[2])-algebraic[11]*states[2] - algebraic[12] = 0.07*exp(states[0]/20.0) - algebraic[13] = 1.0/(exp((states[0]+30.0)/10.0)+1.0) - rates[1] = algebraic[12]*(1.0-states[1])-algebraic[13]*states[1] - algebraic[16] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0) - algebraic[17] = 0.125*exp(states[0]/80.0) - rates[3] = algebraic[16]*(1.0-states[3])-algebraic[17]*states[3] + algebraic[1] = constants[2]*(states[0]-computed_constants[0]) + algebraic[2] = constants[4]*pow(states[3], 4.0)*(states[0]-computed_constants[2]) + algebraic[3] = constants[3]*pow(states[2], 3.0)*states[1]*(states[0]-computed_constants[1]) + rates[0] = -(-algebraic[0]+algebraic[3]+algebraic[2]+algebraic[1])/constants[0] + algebraic[4] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0) + algebraic[5] = 4.0*exp(states[0]/18.0) + rates[2] = algebraic[4]*(1.0-states[2])-algebraic[5]*states[2] + algebraic[6] = 0.07*exp(states[0]/20.0) + algebraic[7] = 1.0/(exp((states[0]+30.0)/10.0)+1.0) + rates[1] = algebraic[6]*(1.0-states[1])-algebraic[7]*states[1] + algebraic[8] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0) + algebraic[9] = 0.125*exp(states[0]/80.0) + rates[3] = algebraic[8]*(1.0-states[3])-algebraic[9]*states[3] def compute_variables(voi, states, rates, constants, computed_constants, algebraic, external_variable): algebraic[0] = external_variable(voi, states, rates, variables, 0) - algebraic[1] = constants[7]*(states[0]-computed_constants[6]) - algebraic[3] = constants[9]*pow(states[2], 3.0)*states[1]*(states[0]-computed_constants[8]) - algebraic[10] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0) - algebraic[11] = 4.0*exp(states[0]/18.0) - algebraic[12] = 0.07*exp(states[0]/20.0) - algebraic[13] = 1.0/(exp((states[0]+30.0)/10.0)+1.0) - algebraic[2] = constants[15]*pow(states[3], 4.0)*(states[0]-computed_constants[14]) - algebraic[16] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0) - algebraic[17] = 0.125*exp(states[0]/80.0) + algebraic[1] = constants[2]*(states[0]-computed_constants[0]) + algebraic[3] = constants[3]*pow(states[2], 3.0)*states[1]*(states[0]-computed_constants[1]) + algebraic[4] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0) + algebraic[5] = 4.0*exp(states[0]/18.0) + algebraic[6] = 0.07*exp(states[0]/20.0) + algebraic[7] = 1.0/(exp((states[0]+30.0)/10.0)+1.0) + algebraic[2] = constants[4]*pow(states[3], 4.0)*(states[0]-computed_constants[2]) + algebraic[8] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0) + algebraic[9] = 0.125*exp(states[0]/80.0) diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.c index 0c24c18ef4..33d70c70cc 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.c @@ -72,11 +72,11 @@ void deleteArray(double *array) void initialiseVariables(double *states, double *rates, double *constants) { - constants[4] = 1.0; - constants[5] = 0.0; - constants[7] = 0.3; - constants[9] = 120.0; - constants[15] = 36.0; + constants[0] = 1.0; + constants[1] = 0.0; + constants[2] = 0.3; + constants[3] = 120.0; + constants[4] = 36.0; states[0] = 0.0; states[1] = 0.6; states[2] = 0.05; @@ -85,38 +85,38 @@ void initialiseVariables(double *states, double *rates, double *constants) void computeComputedConstants(double *constants, double *computedConstants) { - computedConstants[6] = constants[5]-10.613; - computedConstants[8] = constants[5]-115.0; - computedConstants[14] = constants[5]+12.0; + computedConstants[0] = constants[1]-10.613; + computedConstants[1] = constants[1]-115.0; + computedConstants[2] = constants[1]+12.0; } void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { algebraic[0] = ((voi >= 10.0) && (voi <= 10.5))?-20.0:0.0; - algebraic[1] = constants[7]*(states[0]-computedConstants[6]); - algebraic[2] = constants[15]*pow(states[3], 4.0)*(states[0]-computedConstants[14]); - algebraic[3] = constants[9]*pow(states[2], 3.0)*states[1]*(states[0]-computedConstants[8]); - rates[0] = -(-algebraic[0]+algebraic[3]+algebraic[2]+algebraic[1])/constants[4]; - algebraic[10] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0); - algebraic[11] = 4.0*exp(states[0]/18.0); - rates[2] = algebraic[10]*(1.0-states[2])-algebraic[11]*states[2]; - algebraic[12] = 0.07*exp(states[0]/20.0); - algebraic[13] = 1.0/(exp((states[0]+30.0)/10.0)+1.0); - rates[1] = algebraic[12]*(1.0-states[1])-algebraic[13]*states[1]; - algebraic[16] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0); - algebraic[17] = 0.125*exp(states[0]/80.0); - rates[3] = algebraic[16]*(1.0-states[3])-algebraic[17]*states[3]; + algebraic[1] = constants[2]*(states[0]-computedConstants[0]); + algebraic[2] = constants[4]*pow(states[3], 4.0)*(states[0]-computedConstants[2]); + algebraic[3] = constants[3]*pow(states[2], 3.0)*states[1]*(states[0]-computedConstants[1]); + rates[0] = -(-algebraic[0]+algebraic[3]+algebraic[2]+algebraic[1])/constants[0]; + algebraic[4] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0); + algebraic[5] = 4.0*exp(states[0]/18.0); + rates[2] = algebraic[4]*(1.0-states[2])-algebraic[5]*states[2]; + algebraic[6] = 0.07*exp(states[0]/20.0); + algebraic[7] = 1.0/(exp((states[0]+30.0)/10.0)+1.0); + rates[1] = algebraic[6]*(1.0-states[1])-algebraic[7]*states[1]; + algebraic[8] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0); + algebraic[9] = 0.125*exp(states[0]/80.0); + rates[3] = algebraic[8]*(1.0-states[3])-algebraic[9]*states[3]; } void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { - algebraic[1] = constants[7]*(states[0]-computedConstants[6]); - algebraic[3] = constants[9]*pow(states[2], 3.0)*states[1]*(states[0]-computedConstants[8]); - algebraic[10] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0); - algebraic[11] = 4.0*exp(states[0]/18.0); - algebraic[12] = 0.07*exp(states[0]/20.0); - algebraic[13] = 1.0/(exp((states[0]+30.0)/10.0)+1.0); - algebraic[2] = constants[15]*pow(states[3], 4.0)*(states[0]-computedConstants[14]); - algebraic[16] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0); - algebraic[17] = 0.125*exp(states[0]/80.0); + algebraic[1] = constants[2]*(states[0]-computedConstants[0]); + algebraic[3] = constants[3]*pow(states[2], 3.0)*states[1]*(states[0]-computedConstants[1]); + algebraic[4] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0); + algebraic[5] = 4.0*exp(states[0]/18.0); + algebraic[6] = 0.07*exp(states[0]/20.0); + algebraic[7] = 1.0/(exp((states[0]+30.0)/10.0)+1.0); + algebraic[2] = constants[4]*pow(states[3], 4.0)*(states[0]-computedConstants[2]); + algebraic[8] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0); + algebraic[9] = 0.125*exp(states[0]/80.0); } diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.c index bf291e2fb4..4dd1a09a6e 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.c @@ -72,53 +72,53 @@ void deleteArray(double *array) void initialiseVariables(double voi, double *states, double *rates, double *constants, ExternalVariable externalVariable) { - constants[4] = 1.0; - constants[5] = 0.0; - constants[7] = 0.3; - constants[9] = 120.0; - constants[15] = 36.0; + constants[0] = 1.0; + constants[1] = 0.0; + constants[2] = 0.3; + constants[3] = 120.0; + constants[4] = 36.0; states[0] = 0.0; states[1] = 0.6; states[2] = 0.05; states[3] = 0.325; - algebraic[6] = externalVariable(voi, states, rates, variables, 6); + algebraic[4] = externalVariable(voi, states, rates, variables, 4); } void computeComputedConstants(double *constants, double *computedConstants) { - computedConstants[8] = constants[5]-115.0; - computedConstants[14] = constants[5]+12.0; + computedConstants[0] = constants[1]-115.0; + computedConstants[1] = constants[1]+12.0; } void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) { algebraic[0] = ((voi >= 10.0) && (voi <= 10.5))?-20.0:0.0; - algebraic[6] = externalVariable(voi, states, rates, variables, 6); - algebraic[1] = constants[7]*(states[0]-algebraic[6]); - algebraic[2] = constants[15]*pow(states[3], 4.0)*(states[0]-computedConstants[14]); - algebraic[3] = constants[9]*pow(states[2], 3.0)*states[1]*(states[0]-computedConstants[8]); - rates[0] = -(-algebraic[0]+algebraic[3]+algebraic[2]+algebraic[1])/constants[4]; - algebraic[10] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0); - algebraic[11] = 4.0*exp(states[0]/18.0); - rates[2] = algebraic[10]*(1.0-states[2])-algebraic[11]*states[2]; - algebraic[12] = 0.07*exp(states[0]/20.0); - algebraic[13] = 1.0/(exp((states[0]+30.0)/10.0)+1.0); - rates[1] = algebraic[12]*(1.0-states[1])-algebraic[13]*states[1]; - algebraic[16] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0); - algebraic[17] = 0.125*exp(states[0]/80.0); - rates[3] = algebraic[16]*(1.0-states[3])-algebraic[17]*states[3]; + algebraic[4] = externalVariable(voi, states, rates, variables, 4); + algebraic[1] = constants[2]*(states[0]-algebraic[4]); + algebraic[2] = constants[4]*pow(states[3], 4.0)*(states[0]-computedConstants[1]); + algebraic[3] = constants[3]*pow(states[2], 3.0)*states[1]*(states[0]-computedConstants[0]); + rates[0] = -(-algebraic[0]+algebraic[3]+algebraic[2]+algebraic[1])/constants[0]; + algebraic[5] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0); + algebraic[6] = 4.0*exp(states[0]/18.0); + rates[2] = algebraic[5]*(1.0-states[2])-algebraic[6]*states[2]; + algebraic[7] = 0.07*exp(states[0]/20.0); + algebraic[8] = 1.0/(exp((states[0]+30.0)/10.0)+1.0); + rates[1] = algebraic[7]*(1.0-states[1])-algebraic[8]*states[1]; + algebraic[9] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0); + algebraic[10] = 0.125*exp(states[0]/80.0); + rates[3] = algebraic[9]*(1.0-states[3])-algebraic[10]*states[3]; } void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) { - algebraic[6] = externalVariable(voi, states, rates, variables, 6); - algebraic[1] = constants[7]*(states[0]-algebraic[6]); - algebraic[3] = constants[9]*pow(states[2], 3.0)*states[1]*(states[0]-computedConstants[8]); - algebraic[10] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0); - algebraic[11] = 4.0*exp(states[0]/18.0); - algebraic[12] = 0.07*exp(states[0]/20.0); - algebraic[13] = 1.0/(exp((states[0]+30.0)/10.0)+1.0); - algebraic[2] = constants[15]*pow(states[3], 4.0)*(states[0]-computedConstants[14]); - algebraic[16] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0); - algebraic[17] = 0.125*exp(states[0]/80.0); + algebraic[4] = externalVariable(voi, states, rates, variables, 4); + algebraic[1] = constants[2]*(states[0]-algebraic[4]); + algebraic[3] = constants[3]*pow(states[2], 3.0)*states[1]*(states[0]-computedConstants[0]); + algebraic[5] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0); + algebraic[6] = 4.0*exp(states[0]/18.0); + algebraic[7] = 0.07*exp(states[0]/20.0); + algebraic[8] = 1.0/(exp((states[0]+30.0)/10.0)+1.0); + algebraic[2] = constants[4]*pow(states[3], 4.0)*(states[0]-computedConstants[1]); + algebraic[9] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0); + algebraic[10] = 0.125*exp(states[0]/80.0); } diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.py index 2a928ef7fa..4d8a09531e 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.py @@ -74,49 +74,49 @@ def create_variables_array(): def initialise_variables(voi, states, rates, constants, external_variable): - constants[4] = 1.0 - constants[5] = 0.0 - constants[7] = 0.3 - constants[9] = 120.0 - constants[15] = 36.0 + constants[0] = 1.0 + constants[1] = 0.0 + constants[2] = 0.3 + constants[3] = 120.0 + constants[4] = 36.0 states[0] = 0.0 states[1] = 0.6 states[2] = 0.05 states[3] = 0.325 - algebraic[6] = external_variable(voi, states, rates, variables, 6) + algebraic[4] = external_variable(voi, states, rates, variables, 4) def compute_computed_constants(constants, computed_constants): - computed_constants[8] = constants[5]-115.0 - computed_constants[14] = constants[5]+12.0 + computed_constants[0] = constants[1]-115.0 + computed_constants[1] = constants[1]+12.0 def compute_rates(voi, states, rates, constants, computed_constants, algebraic, external_variable): algebraic[0] = -20.0 if and_func(geq_func(voi, 10.0), leq_func(voi, 10.5)) else 0.0 - algebraic[6] = external_variable(voi, states, rates, variables, 6) - algebraic[1] = constants[7]*(states[0]-algebraic[6]) - algebraic[2] = constants[15]*pow(states[3], 4.0)*(states[0]-computed_constants[14]) - algebraic[3] = constants[9]*pow(states[2], 3.0)*states[1]*(states[0]-computed_constants[8]) - rates[0] = -(-algebraic[0]+algebraic[3]+algebraic[2]+algebraic[1])/constants[4] - algebraic[10] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0) - algebraic[11] = 4.0*exp(states[0]/18.0) - rates[2] = algebraic[10]*(1.0-states[2])-algebraic[11]*states[2] - algebraic[12] = 0.07*exp(states[0]/20.0) - algebraic[13] = 1.0/(exp((states[0]+30.0)/10.0)+1.0) - rates[1] = algebraic[12]*(1.0-states[1])-algebraic[13]*states[1] - algebraic[16] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0) - algebraic[17] = 0.125*exp(states[0]/80.0) - rates[3] = algebraic[16]*(1.0-states[3])-algebraic[17]*states[3] + algebraic[4] = external_variable(voi, states, rates, variables, 4) + algebraic[1] = constants[2]*(states[0]-algebraic[4]) + algebraic[2] = constants[4]*pow(states[3], 4.0)*(states[0]-computed_constants[1]) + algebraic[3] = constants[3]*pow(states[2], 3.0)*states[1]*(states[0]-computed_constants[0]) + rates[0] = -(-algebraic[0]+algebraic[3]+algebraic[2]+algebraic[1])/constants[0] + algebraic[5] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0) + algebraic[6] = 4.0*exp(states[0]/18.0) + rates[2] = algebraic[5]*(1.0-states[2])-algebraic[6]*states[2] + algebraic[7] = 0.07*exp(states[0]/20.0) + algebraic[8] = 1.0/(exp((states[0]+30.0)/10.0)+1.0) + rates[1] = algebraic[7]*(1.0-states[1])-algebraic[8]*states[1] + algebraic[9] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0) + algebraic[10] = 0.125*exp(states[0]/80.0) + rates[3] = algebraic[9]*(1.0-states[3])-algebraic[10]*states[3] def compute_variables(voi, states, rates, constants, computed_constants, algebraic, external_variable): - algebraic[6] = external_variable(voi, states, rates, variables, 6) - algebraic[1] = constants[7]*(states[0]-algebraic[6]) - algebraic[3] = constants[9]*pow(states[2], 3.0)*states[1]*(states[0]-computed_constants[8]) - algebraic[10] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0) - algebraic[11] = 4.0*exp(states[0]/18.0) - algebraic[12] = 0.07*exp(states[0]/20.0) - algebraic[13] = 1.0/(exp((states[0]+30.0)/10.0)+1.0) - algebraic[2] = constants[15]*pow(states[3], 4.0)*(states[0]-computed_constants[14]) - algebraic[16] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0) - algebraic[17] = 0.125*exp(states[0]/80.0) + algebraic[4] = external_variable(voi, states, rates, variables, 4) + algebraic[1] = constants[2]*(states[0]-algebraic[4]) + algebraic[3] = constants[3]*pow(states[2], 3.0)*states[1]*(states[0]-computed_constants[0]) + algebraic[5] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0) + algebraic[6] = 4.0*exp(states[0]/18.0) + algebraic[7] = 0.07*exp(states[0]/20.0) + algebraic[8] = 1.0/(exp((states[0]+30.0)/10.0)+1.0) + algebraic[2] = constants[4]*pow(states[3], 4.0)*(states[0]-computed_constants[1]) + algebraic[9] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0) + algebraic[10] = 0.125*exp(states[0]/80.0) diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.c index f3d7255142..b38a8dde50 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.c @@ -72,10 +72,10 @@ void deleteArray(double *array) void initialiseVariables(double voi, double *states, double *rates, double *constants, ExternalVariable externalVariable) { - constants[5] = 0.0; - constants[7] = 0.3; - constants[9] = 120.0; - constants[15] = 36.0; + constants[0] = 0.0; + constants[1] = 0.3; + constants[2] = 120.0; + constants[3] = 36.0; states[0] = 0.0; states[1] = 0.6; states[2] = 0.05; @@ -85,40 +85,40 @@ void initialiseVariables(double voi, double *states, double *rates, double *cons void computeComputedConstants(double *constants, double *computedConstants) { - computedConstants[6] = constants[5]-10.613; - computedConstants[8] = constants[5]-115.0; - computedConstants[14] = constants[5]+12.0; + computedConstants[0] = constants[0]-10.613; + computedConstants[1] = constants[0]-115.0; + computedConstants[2] = constants[0]+12.0; } void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) { algebraic[0] = ((voi >= 10.0) && (voi <= 10.5))?-20.0:0.0; algebraic[4] = externalVariable(voi, states, rates, variables, 4); - algebraic[1] = constants[7]*(states[0]-computedConstants[6]); - algebraic[2] = constants[15]*pow(states[3], 4.0)*(states[0]-computedConstants[14]); - algebraic[3] = constants[9]*pow(states[2], 3.0)*states[1]*(states[0]-computedConstants[8]); + algebraic[1] = constants[1]*(states[0]-computedConstants[0]); + algebraic[2] = constants[3]*pow(states[3], 4.0)*(states[0]-computedConstants[2]); + algebraic[3] = constants[2]*pow(states[2], 3.0)*states[1]*(states[0]-computedConstants[1]); rates[0] = -(-algebraic[0]+algebraic[3]+algebraic[2]+algebraic[1])/algebraic[4]; - algebraic[10] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0); - algebraic[11] = 4.0*exp(states[0]/18.0); - rates[2] = algebraic[10]*(1.0-states[2])-algebraic[11]*states[2]; - algebraic[12] = 0.07*exp(states[0]/20.0); - algebraic[13] = 1.0/(exp((states[0]+30.0)/10.0)+1.0); - rates[1] = algebraic[12]*(1.0-states[1])-algebraic[13]*states[1]; - algebraic[16] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0); - algebraic[17] = 0.125*exp(states[0]/80.0); - rates[3] = algebraic[16]*(1.0-states[3])-algebraic[17]*states[3]; + algebraic[5] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0); + algebraic[6] = 4.0*exp(states[0]/18.0); + rates[2] = algebraic[5]*(1.0-states[2])-algebraic[6]*states[2]; + algebraic[7] = 0.07*exp(states[0]/20.0); + algebraic[8] = 1.0/(exp((states[0]+30.0)/10.0)+1.0); + rates[1] = algebraic[7]*(1.0-states[1])-algebraic[8]*states[1]; + algebraic[9] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0); + algebraic[10] = 0.125*exp(states[0]/80.0); + rates[3] = algebraic[9]*(1.0-states[3])-algebraic[10]*states[3]; } void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) { - algebraic[1] = constants[7]*(states[0]-computedConstants[6]); - algebraic[3] = constants[9]*pow(states[2], 3.0)*states[1]*(states[0]-computedConstants[8]); - algebraic[10] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0); - algebraic[11] = 4.0*exp(states[0]/18.0); - algebraic[12] = 0.07*exp(states[0]/20.0); - algebraic[13] = 1.0/(exp((states[0]+30.0)/10.0)+1.0); - algebraic[2] = constants[15]*pow(states[3], 4.0)*(states[0]-computedConstants[14]); - algebraic[16] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0); - algebraic[17] = 0.125*exp(states[0]/80.0); + algebraic[1] = constants[1]*(states[0]-computedConstants[0]); + algebraic[3] = constants[2]*pow(states[2], 3.0)*states[1]*(states[0]-computedConstants[1]); + algebraic[5] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0); + algebraic[6] = 4.0*exp(states[0]/18.0); + algebraic[7] = 0.07*exp(states[0]/20.0); + algebraic[8] = 1.0/(exp((states[0]+30.0)/10.0)+1.0); + algebraic[2] = constants[3]*pow(states[3], 4.0)*(states[0]-computedConstants[2]); + algebraic[9] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0); + algebraic[10] = 0.125*exp(states[0]/80.0); algebraic[4] = externalVariable(voi, states, rates, variables, 4); } diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.py index 99304a266e..9a8335d0d7 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.py @@ -74,10 +74,10 @@ def create_variables_array(): def initialise_variables(voi, states, rates, constants, external_variable): - constants[5] = 0.0 - constants[7] = 0.3 - constants[9] = 120.0 - constants[15] = 36.0 + constants[0] = 0.0 + constants[1] = 0.3 + constants[2] = 120.0 + constants[3] = 36.0 states[0] = 0.0 states[1] = 0.6 states[2] = 0.05 @@ -86,37 +86,37 @@ def initialise_variables(voi, states, rates, constants, external_variable): def compute_computed_constants(constants, computed_constants): - computed_constants[6] = constants[5]-10.613 - computed_constants[8] = constants[5]-115.0 - computed_constants[14] = constants[5]+12.0 + computed_constants[0] = constants[0]-10.613 + computed_constants[1] = constants[0]-115.0 + computed_constants[2] = constants[0]+12.0 def compute_rates(voi, states, rates, constants, computed_constants, algebraic, external_variable): algebraic[0] = -20.0 if and_func(geq_func(voi, 10.0), leq_func(voi, 10.5)) else 0.0 algebraic[4] = external_variable(voi, states, rates, variables, 4) - algebraic[1] = constants[7]*(states[0]-computed_constants[6]) - algebraic[2] = constants[15]*pow(states[3], 4.0)*(states[0]-computed_constants[14]) - algebraic[3] = constants[9]*pow(states[2], 3.0)*states[1]*(states[0]-computed_constants[8]) + algebraic[1] = constants[1]*(states[0]-computed_constants[0]) + algebraic[2] = constants[3]*pow(states[3], 4.0)*(states[0]-computed_constants[2]) + algebraic[3] = constants[2]*pow(states[2], 3.0)*states[1]*(states[0]-computed_constants[1]) rates[0] = -(-algebraic[0]+algebraic[3]+algebraic[2]+algebraic[1])/algebraic[4] - algebraic[10] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0) - algebraic[11] = 4.0*exp(states[0]/18.0) - rates[2] = algebraic[10]*(1.0-states[2])-algebraic[11]*states[2] - algebraic[12] = 0.07*exp(states[0]/20.0) - algebraic[13] = 1.0/(exp((states[0]+30.0)/10.0)+1.0) - rates[1] = algebraic[12]*(1.0-states[1])-algebraic[13]*states[1] - algebraic[16] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0) - algebraic[17] = 0.125*exp(states[0]/80.0) - rates[3] = algebraic[16]*(1.0-states[3])-algebraic[17]*states[3] + algebraic[5] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0) + algebraic[6] = 4.0*exp(states[0]/18.0) + rates[2] = algebraic[5]*(1.0-states[2])-algebraic[6]*states[2] + algebraic[7] = 0.07*exp(states[0]/20.0) + algebraic[8] = 1.0/(exp((states[0]+30.0)/10.0)+1.0) + rates[1] = algebraic[7]*(1.0-states[1])-algebraic[8]*states[1] + algebraic[9] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0) + algebraic[10] = 0.125*exp(states[0]/80.0) + rates[3] = algebraic[9]*(1.0-states[3])-algebraic[10]*states[3] def compute_variables(voi, states, rates, constants, computed_constants, algebraic, external_variable): - algebraic[1] = constants[7]*(states[0]-computed_constants[6]) - algebraic[3] = constants[9]*pow(states[2], 3.0)*states[1]*(states[0]-computed_constants[8]) - algebraic[10] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0) - algebraic[11] = 4.0*exp(states[0]/18.0) - algebraic[12] = 0.07*exp(states[0]/20.0) - algebraic[13] = 1.0/(exp((states[0]+30.0)/10.0)+1.0) - algebraic[2] = constants[15]*pow(states[3], 4.0)*(states[0]-computed_constants[14]) - algebraic[16] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0) - algebraic[17] = 0.125*exp(states[0]/80.0) + algebraic[1] = constants[1]*(states[0]-computed_constants[0]) + algebraic[3] = constants[2]*pow(states[2], 3.0)*states[1]*(states[0]-computed_constants[1]) + algebraic[5] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0) + algebraic[6] = 4.0*exp(states[0]/18.0) + algebraic[7] = 0.07*exp(states[0]/20.0) + algebraic[8] = 1.0/(exp((states[0]+30.0)/10.0)+1.0) + algebraic[2] = constants[3]*pow(states[3], 4.0)*(states[0]-computed_constants[2]) + algebraic[9] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0) + algebraic[10] = 0.125*exp(states[0]/80.0) algebraic[4] = external_variable(voi, states, rates, variables, 4) diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.c index 79d7df0822..228073aca6 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.c @@ -113,7 +113,7 @@ void objectiveFunction1(double *u, double *f, void *data) rates[0] = u[0]; - f[0] = rates[0]-(-(-algebraic[0]+algebraic[3]+algebraic[2]+algebraic[1])/constants[4])-0.0; + f[0] = rates[0]-(-(-algebraic[0]+algebraic[3]+algebraic[2]+algebraic[1])/constants[0])-0.0; } void findRoot1(double voi, double *states, double *rates, double *variables) @@ -135,9 +135,9 @@ void objectiveFunction2(double *u, double *f, void *data) double *rates = ((RootFindingInfo *) data)->rates; double *variables = ((RootFindingInfo *) data)->variables; - computedConstants[6] = u[0]; + computedConstants[0] = u[0]; - f[0] = computedConstants[6]-(constants[5]-10.613)-0.0; + f[0] = computedConstants[0]-(constants[1]-10.613)-0.0; } void findRoot2(double voi, double *states, double *rates, double *variables) @@ -145,11 +145,11 @@ void findRoot2(double voi, double *states, double *rates, double *variables) RootFindingInfo rfi = { voi, states, rates, variables }; double u[1]; - u[0] = algebraic[6]; + u[0] = algebraic[0]; nlaSolve(objectiveFunction2, u, 1, &rfi); - algebraic[6] = u[0]; + algebraic[0] = u[0]; } void objectiveFunction3(double *u, double *f, void *data) @@ -161,7 +161,7 @@ void objectiveFunction3(double *u, double *f, void *data) algebraic[1] = u[0]; - f[0] = algebraic[1]-constants[7]*(states[0]-computedConstants[6])-0.0; + f[0] = algebraic[1]-constants[2]*(states[0]-computedConstants[0])-0.0; } void findRoot3(double voi, double *states, double *rates, double *variables) @@ -183,9 +183,9 @@ void objectiveFunction4(double *u, double *f, void *data) double *rates = ((RootFindingInfo *) data)->rates; double *variables = ((RootFindingInfo *) data)->variables; - computedConstants[8] = u[0]; + computedConstants[1] = u[0]; - f[0] = computedConstants[8]-(constants[5]-115.0)-0.0; + f[0] = computedConstants[1]-(constants[1]-115.0)-0.0; } void findRoot4(double voi, double *states, double *rates, double *variables) @@ -193,11 +193,11 @@ void findRoot4(double voi, double *states, double *rates, double *variables) RootFindingInfo rfi = { voi, states, rates, variables }; double u[1]; - u[0] = algebraic[8]; + u[0] = algebraic[1]; nlaSolve(objectiveFunction4, u, 1, &rfi); - algebraic[8] = u[0]; + algebraic[1] = u[0]; } void objectiveFunction5(double *u, double *f, void *data) @@ -209,7 +209,7 @@ void objectiveFunction5(double *u, double *f, void *data) algebraic[3] = u[0]; - f[0] = algebraic[3]-constants[9]*pow(states[2], 3.0)*states[1]*(states[0]-computedConstants[8])-0.0; + f[0] = algebraic[3]-constants[3]*pow(states[2], 3.0)*states[1]*(states[0]-computedConstants[1])-0.0; } void findRoot5(double voi, double *states, double *rates, double *variables) @@ -231,9 +231,9 @@ void objectiveFunction6(double *u, double *f, void *data) double *rates = ((RootFindingInfo *) data)->rates; double *variables = ((RootFindingInfo *) data)->variables; - algebraic[10] = u[0]; + algebraic[4] = u[0]; - f[0] = algebraic[10]-0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0)-0.0; + f[0] = algebraic[4]-0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0)-0.0; } void findRoot6(double voi, double *states, double *rates, double *variables) @@ -241,11 +241,11 @@ void findRoot6(double voi, double *states, double *rates, double *variables) RootFindingInfo rfi = { voi, states, rates, variables }; double u[1]; - u[0] = algebraic[10]; + u[0] = algebraic[4]; nlaSolve(objectiveFunction6, u, 1, &rfi); - algebraic[10] = u[0]; + algebraic[4] = u[0]; } void objectiveFunction7(double *u, double *f, void *data) @@ -255,9 +255,9 @@ void objectiveFunction7(double *u, double *f, void *data) double *rates = ((RootFindingInfo *) data)->rates; double *variables = ((RootFindingInfo *) data)->variables; - algebraic[11] = u[0]; + algebraic[5] = u[0]; - f[0] = algebraic[11]-4.0*exp(states[0]/18.0)-0.0; + f[0] = algebraic[5]-4.0*exp(states[0]/18.0)-0.0; } void findRoot7(double voi, double *states, double *rates, double *variables) @@ -265,11 +265,11 @@ void findRoot7(double voi, double *states, double *rates, double *variables) RootFindingInfo rfi = { voi, states, rates, variables }; double u[1]; - u[0] = algebraic[11]; + u[0] = algebraic[5]; nlaSolve(objectiveFunction7, u, 1, &rfi); - algebraic[11] = u[0]; + algebraic[5] = u[0]; } void objectiveFunction8(double *u, double *f, void *data) @@ -281,7 +281,7 @@ void objectiveFunction8(double *u, double *f, void *data) rates[2] = u[0]; - f[0] = rates[2]-(algebraic[10]*(1.0-states[2])-algebraic[11]*states[2])-0.0; + f[0] = rates[2]-(algebraic[4]*(1.0-states[2])-algebraic[5]*states[2])-0.0; } void findRoot8(double voi, double *states, double *rates, double *variables) @@ -303,9 +303,9 @@ void objectiveFunction9(double *u, double *f, void *data) double *rates = ((RootFindingInfo *) data)->rates; double *variables = ((RootFindingInfo *) data)->variables; - algebraic[12] = u[0]; + algebraic[6] = u[0]; - f[0] = algebraic[12]-0.07*exp(states[0]/20.0)-0.0; + f[0] = algebraic[6]-0.07*exp(states[0]/20.0)-0.0; } void findRoot9(double voi, double *states, double *rates, double *variables) @@ -313,11 +313,11 @@ void findRoot9(double voi, double *states, double *rates, double *variables) RootFindingInfo rfi = { voi, states, rates, variables }; double u[1]; - u[0] = algebraic[12]; + u[0] = algebraic[6]; nlaSolve(objectiveFunction9, u, 1, &rfi); - algebraic[12] = u[0]; + algebraic[6] = u[0]; } void objectiveFunction10(double *u, double *f, void *data) @@ -327,9 +327,9 @@ void objectiveFunction10(double *u, double *f, void *data) double *rates = ((RootFindingInfo *) data)->rates; double *variables = ((RootFindingInfo *) data)->variables; - algebraic[13] = u[0]; + algebraic[7] = u[0]; - f[0] = algebraic[13]-1.0/(exp((states[0]+30.0)/10.0)+1.0)-0.0; + f[0] = algebraic[7]-1.0/(exp((states[0]+30.0)/10.0)+1.0)-0.0; } void findRoot10(double voi, double *states, double *rates, double *variables) @@ -337,11 +337,11 @@ void findRoot10(double voi, double *states, double *rates, double *variables) RootFindingInfo rfi = { voi, states, rates, variables }; double u[1]; - u[0] = algebraic[13]; + u[0] = algebraic[7]; nlaSolve(objectiveFunction10, u, 1, &rfi); - algebraic[13] = u[0]; + algebraic[7] = u[0]; } void objectiveFunction11(double *u, double *f, void *data) @@ -353,7 +353,7 @@ void objectiveFunction11(double *u, double *f, void *data) rates[1] = u[0]; - f[0] = rates[1]-(algebraic[12]*(1.0-states[1])-algebraic[13]*states[1])-0.0; + f[0] = rates[1]-(algebraic[6]*(1.0-states[1])-algebraic[7]*states[1])-0.0; } void findRoot11(double voi, double *states, double *rates, double *variables) @@ -375,9 +375,9 @@ void objectiveFunction12(double *u, double *f, void *data) double *rates = ((RootFindingInfo *) data)->rates; double *variables = ((RootFindingInfo *) data)->variables; - computedConstants[14] = u[0]; + computedConstants[2] = u[0]; - f[0] = computedConstants[14]-(constants[5]+12.0)-0.0; + f[0] = computedConstants[2]-(constants[1]+12.0)-0.0; } void findRoot12(double voi, double *states, double *rates, double *variables) @@ -385,11 +385,11 @@ void findRoot12(double voi, double *states, double *rates, double *variables) RootFindingInfo rfi = { voi, states, rates, variables }; double u[1]; - u[0] = algebraic[14]; + u[0] = algebraic[2]; nlaSolve(objectiveFunction12, u, 1, &rfi); - algebraic[14] = u[0]; + algebraic[2] = u[0]; } void objectiveFunction13(double *u, double *f, void *data) @@ -401,7 +401,7 @@ void objectiveFunction13(double *u, double *f, void *data) algebraic[2] = u[0]; - f[0] = algebraic[2]-constants[15]*pow(states[3], 4.0)*(states[0]-computedConstants[14])-0.0; + f[0] = algebraic[2]-constants[4]*pow(states[3], 4.0)*(states[0]-computedConstants[2])-0.0; } void findRoot13(double voi, double *states, double *rates, double *variables) @@ -423,9 +423,9 @@ void objectiveFunction14(double *u, double *f, void *data) double *rates = ((RootFindingInfo *) data)->rates; double *variables = ((RootFindingInfo *) data)->variables; - algebraic[16] = u[0]; + algebraic[8] = u[0]; - f[0] = algebraic[16]-0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0)-0.0; + f[0] = algebraic[8]-0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0)-0.0; } void findRoot14(double voi, double *states, double *rates, double *variables) @@ -433,11 +433,11 @@ void findRoot14(double voi, double *states, double *rates, double *variables) RootFindingInfo rfi = { voi, states, rates, variables }; double u[1]; - u[0] = algebraic[16]; + u[0] = algebraic[8]; nlaSolve(objectiveFunction14, u, 1, &rfi); - algebraic[16] = u[0]; + algebraic[8] = u[0]; } void objectiveFunction15(double *u, double *f, void *data) @@ -447,9 +447,9 @@ void objectiveFunction15(double *u, double *f, void *data) double *rates = ((RootFindingInfo *) data)->rates; double *variables = ((RootFindingInfo *) data)->variables; - algebraic[17] = u[0]; + algebraic[9] = u[0]; - f[0] = algebraic[17]-0.125*exp(states[0]/80.0)-0.0; + f[0] = algebraic[9]-0.125*exp(states[0]/80.0)-0.0; } void findRoot15(double voi, double *states, double *rates, double *variables) @@ -457,11 +457,11 @@ void findRoot15(double voi, double *states, double *rates, double *variables) RootFindingInfo rfi = { voi, states, rates, variables }; double u[1]; - u[0] = algebraic[17]; + u[0] = algebraic[9]; nlaSolve(objectiveFunction15, u, 1, &rfi); - algebraic[17] = u[0]; + algebraic[9] = u[0]; } void objectiveFunction16(double *u, double *f, void *data) @@ -473,7 +473,7 @@ void objectiveFunction16(double *u, double *f, void *data) rates[3] = u[0]; - f[0] = rates[3]-(algebraic[16]*(1.0-states[3])-algebraic[17]*states[3])-0.0; + f[0] = rates[3]-(algebraic[8]*(1.0-states[3])-algebraic[9]*states[3])-0.0; } void findRoot16(double voi, double *states, double *rates, double *variables) @@ -494,20 +494,20 @@ void initialiseVariables(double *states, double *rates, double *constants) algebraic[1] = 0.0; algebraic[2] = 0.0; algebraic[3] = 0.0; - constants[4] = 1.0; - constants[5] = 0.0; - computedConstants[6] = 0.0; - constants[7] = 0.3; - computedConstants[8] = 0.0; - constants[9] = 120.0; - algebraic[10] = 0.0; - algebraic[11] = 0.0; - algebraic[12] = 0.0; - algebraic[13] = 0.0; - computedConstants[14] = 0.0; - constants[15] = 36.0; - algebraic[16] = 0.0; - algebraic[17] = 0.0; + constants[0] = 1.0; + constants[1] = 0.0; + computedConstants[0] = 0.0; + constants[2] = 0.3; + computedConstants[1] = 0.0; + constants[3] = 120.0; + algebraic[4] = 0.0; + algebraic[5] = 0.0; + algebraic[6] = 0.0; + algebraic[7] = 0.0; + computedConstants[2] = 0.0; + constants[4] = 36.0; + algebraic[8] = 0.0; + algebraic[9] = 0.0; states[0] = 0.0; states[1] = 0.6; states[2] = 0.05; diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.py index 068073cbd5..e9fe6851dd 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.py @@ -104,7 +104,7 @@ def objective_function_1(u, f, data): rates[0] = u[0] - f[0] = rates[0]-(-(-algebraic[0]+algebraic[3]+algebraic[2]+algebraic[1])/constants[4])-0.0 + f[0] = rates[0]-(-(-algebraic[0]+algebraic[3]+algebraic[2]+algebraic[1])/constants[0])-0.0 def find_root_1(voi, states, rates, variables): @@ -123,19 +123,19 @@ def objective_function_2(u, f, data): rates = data[2] variables = data[3] - computed_constants[6] = u[0] + computed_constants[0] = u[0] - f[0] = computed_constants[6]-(constants[5]-10.613)-0.0 + f[0] = computed_constants[0]-(constants[1]-10.613)-0.0 def find_root_2(voi, states, rates, variables): u = [nan]*1 - u[0] = algebraic[6] + u[0] = algebraic[0] u = nla_solve(objective_function_2, u, 1, [voi, states, rates, variables]) - algebraic[6] = u[0] + algebraic[0] = u[0] def objective_function_3(u, f, data): @@ -146,7 +146,7 @@ def objective_function_3(u, f, data): algebraic[1] = u[0] - f[0] = algebraic[1]-constants[7]*(states[0]-computed_constants[6])-0.0 + f[0] = algebraic[1]-constants[2]*(states[0]-computed_constants[0])-0.0 def find_root_3(voi, states, rates, variables): @@ -165,19 +165,19 @@ def objective_function_4(u, f, data): rates = data[2] variables = data[3] - computed_constants[8] = u[0] + computed_constants[1] = u[0] - f[0] = computed_constants[8]-(constants[5]-115.0)-0.0 + f[0] = computed_constants[1]-(constants[1]-115.0)-0.0 def find_root_4(voi, states, rates, variables): u = [nan]*1 - u[0] = algebraic[8] + u[0] = algebraic[1] u = nla_solve(objective_function_4, u, 1, [voi, states, rates, variables]) - algebraic[8] = u[0] + algebraic[1] = u[0] def objective_function_5(u, f, data): @@ -188,7 +188,7 @@ def objective_function_5(u, f, data): algebraic[3] = u[0] - f[0] = algebraic[3]-constants[9]*pow(states[2], 3.0)*states[1]*(states[0]-computed_constants[8])-0.0 + f[0] = algebraic[3]-constants[3]*pow(states[2], 3.0)*states[1]*(states[0]-computed_constants[1])-0.0 def find_root_5(voi, states, rates, variables): @@ -207,19 +207,19 @@ def objective_function_6(u, f, data): rates = data[2] variables = data[3] - algebraic[10] = u[0] + algebraic[4] = u[0] - f[0] = algebraic[10]-0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0)-0.0 + f[0] = algebraic[4]-0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0)-0.0 def find_root_6(voi, states, rates, variables): u = [nan]*1 - u[0] = algebraic[10] + u[0] = algebraic[4] u = nla_solve(objective_function_6, u, 1, [voi, states, rates, variables]) - algebraic[10] = u[0] + algebraic[4] = u[0] def objective_function_7(u, f, data): @@ -228,19 +228,19 @@ def objective_function_7(u, f, data): rates = data[2] variables = data[3] - algebraic[11] = u[0] + algebraic[5] = u[0] - f[0] = algebraic[11]-4.0*exp(states[0]/18.0)-0.0 + f[0] = algebraic[5]-4.0*exp(states[0]/18.0)-0.0 def find_root_7(voi, states, rates, variables): u = [nan]*1 - u[0] = algebraic[11] + u[0] = algebraic[5] u = nla_solve(objective_function_7, u, 1, [voi, states, rates, variables]) - algebraic[11] = u[0] + algebraic[5] = u[0] def objective_function_8(u, f, data): @@ -251,7 +251,7 @@ def objective_function_8(u, f, data): rates[2] = u[0] - f[0] = rates[2]-(algebraic[10]*(1.0-states[2])-algebraic[11]*states[2])-0.0 + f[0] = rates[2]-(algebraic[4]*(1.0-states[2])-algebraic[5]*states[2])-0.0 def find_root_8(voi, states, rates, variables): @@ -270,19 +270,19 @@ def objective_function_9(u, f, data): rates = data[2] variables = data[3] - algebraic[12] = u[0] + algebraic[6] = u[0] - f[0] = algebraic[12]-0.07*exp(states[0]/20.0)-0.0 + f[0] = algebraic[6]-0.07*exp(states[0]/20.0)-0.0 def find_root_9(voi, states, rates, variables): u = [nan]*1 - u[0] = algebraic[12] + u[0] = algebraic[6] u = nla_solve(objective_function_9, u, 1, [voi, states, rates, variables]) - algebraic[12] = u[0] + algebraic[6] = u[0] def objective_function_10(u, f, data): @@ -291,19 +291,19 @@ def objective_function_10(u, f, data): rates = data[2] variables = data[3] - algebraic[13] = u[0] + algebraic[7] = u[0] - f[0] = algebraic[13]-1.0/(exp((states[0]+30.0)/10.0)+1.0)-0.0 + f[0] = algebraic[7]-1.0/(exp((states[0]+30.0)/10.0)+1.0)-0.0 def find_root_10(voi, states, rates, variables): u = [nan]*1 - u[0] = algebraic[13] + u[0] = algebraic[7] u = nla_solve(objective_function_10, u, 1, [voi, states, rates, variables]) - algebraic[13] = u[0] + algebraic[7] = u[0] def objective_function_11(u, f, data): @@ -314,7 +314,7 @@ def objective_function_11(u, f, data): rates[1] = u[0] - f[0] = rates[1]-(algebraic[12]*(1.0-states[1])-algebraic[13]*states[1])-0.0 + f[0] = rates[1]-(algebraic[6]*(1.0-states[1])-algebraic[7]*states[1])-0.0 def find_root_11(voi, states, rates, variables): @@ -333,19 +333,19 @@ def objective_function_12(u, f, data): rates = data[2] variables = data[3] - computed_constants[14] = u[0] + computed_constants[2] = u[0] - f[0] = computed_constants[14]-(constants[5]+12.0)-0.0 + f[0] = computed_constants[2]-(constants[1]+12.0)-0.0 def find_root_12(voi, states, rates, variables): u = [nan]*1 - u[0] = algebraic[14] + u[0] = algebraic[2] u = nla_solve(objective_function_12, u, 1, [voi, states, rates, variables]) - algebraic[14] = u[0] + algebraic[2] = u[0] def objective_function_13(u, f, data): @@ -356,7 +356,7 @@ def objective_function_13(u, f, data): algebraic[2] = u[0] - f[0] = algebraic[2]-constants[15]*pow(states[3], 4.0)*(states[0]-computed_constants[14])-0.0 + f[0] = algebraic[2]-constants[4]*pow(states[3], 4.0)*(states[0]-computed_constants[2])-0.0 def find_root_13(voi, states, rates, variables): @@ -375,19 +375,19 @@ def objective_function_14(u, f, data): rates = data[2] variables = data[3] - algebraic[16] = u[0] + algebraic[8] = u[0] - f[0] = algebraic[16]-0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0)-0.0 + f[0] = algebraic[8]-0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0)-0.0 def find_root_14(voi, states, rates, variables): u = [nan]*1 - u[0] = algebraic[16] + u[0] = algebraic[8] u = nla_solve(objective_function_14, u, 1, [voi, states, rates, variables]) - algebraic[16] = u[0] + algebraic[8] = u[0] def objective_function_15(u, f, data): @@ -396,19 +396,19 @@ def objective_function_15(u, f, data): rates = data[2] variables = data[3] - algebraic[17] = u[0] + algebraic[9] = u[0] - f[0] = algebraic[17]-0.125*exp(states[0]/80.0)-0.0 + f[0] = algebraic[9]-0.125*exp(states[0]/80.0)-0.0 def find_root_15(voi, states, rates, variables): u = [nan]*1 - u[0] = algebraic[17] + u[0] = algebraic[9] u = nla_solve(objective_function_15, u, 1, [voi, states, rates, variables]) - algebraic[17] = u[0] + algebraic[9] = u[0] def objective_function_16(u, f, data): @@ -419,7 +419,7 @@ def objective_function_16(u, f, data): rates[3] = u[0] - f[0] = rates[3]-(algebraic[16]*(1.0-states[3])-algebraic[17]*states[3])-0.0 + f[0] = rates[3]-(algebraic[8]*(1.0-states[3])-algebraic[9]*states[3])-0.0 def find_root_16(voi, states, rates, variables): @@ -437,20 +437,20 @@ def initialise_variables(states, rates, constants): algebraic[1] = 0.0 algebraic[2] = 0.0 algebraic[3] = 0.0 - constants[4] = 1.0 - constants[5] = 0.0 - computed_constants[6] = 0.0 - constants[7] = 0.3 - computed_constants[8] = 0.0 - constants[9] = 120.0 - algebraic[10] = 0.0 - algebraic[11] = 0.0 - algebraic[12] = 0.0 - algebraic[13] = 0.0 - computed_constants[14] = 0.0 - constants[15] = 36.0 - algebraic[16] = 0.0 - algebraic[17] = 0.0 + constants[0] = 1.0 + constants[1] = 0.0 + computed_constants[0] = 0.0 + constants[2] = 0.3 + computed_constants[1] = 0.0 + constants[3] = 120.0 + algebraic[4] = 0.0 + algebraic[5] = 0.0 + algebraic[6] = 0.0 + algebraic[7] = 0.0 + computed_constants[2] = 0.0 + constants[4] = 36.0 + algebraic[8] = 0.0 + algebraic[9] = 0.0 states[0] = 0.0 states[1] = 0.6 states[2] = 0.05 diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.c index 9533f72f59..1967097424 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.c @@ -72,54 +72,54 @@ void deleteArray(double *array) void initialiseVariables(double voi, double *states, double *rates, double *constants, ExternalVariable externalVariable) { - constants[4] = 1.0; - constants[5] = 0.0; - constants[7] = 0.3; - constants[9] = 120.0; - constants[15] = 36.0; + constants[0] = 1.0; + constants[1] = 0.0; + constants[2] = 0.3; + constants[3] = 120.0; + constants[4] = 36.0; states[0] = 0.0; states[1] = 0.6; states[2] = 0.05; states[3] = 0.325; - algebraic[17] = externalVariable(voi, states, rates, variables, 17); + algebraic[9] = externalVariable(voi, states, rates, variables, 9); algebraic[0] = externalVariable(voi, states, rates, variables, 0); } void computeComputedConstants(double *constants, double *computedConstants) { - computedConstants[6] = constants[5]-10.613; - computedConstants[8] = constants[5]-115.0; - computedConstants[14] = constants[5]+12.0; + computedConstants[0] = constants[1]-10.613; + computedConstants[1] = constants[1]-115.0; + computedConstants[2] = constants[1]+12.0; } void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) { - algebraic[17] = externalVariable(voi, states, rates, variables, 17); + algebraic[9] = externalVariable(voi, states, rates, variables, 9); algebraic[0] = externalVariable(voi, states, rates, variables, 0); - algebraic[1] = constants[7]*(states[0]-computedConstants[6]); - algebraic[2] = constants[15]*pow(states[3], 4.0)*(states[0]-computedConstants[14]); - algebraic[3] = constants[9]*pow(states[2], 3.0)*states[1]*(states[0]-computedConstants[8]); - rates[0] = -(-algebraic[0]+algebraic[3]+algebraic[2]+algebraic[1])/constants[4]; - algebraic[10] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0); - algebraic[11] = 4.0*exp(states[0]/18.0); - rates[2] = algebraic[10]*(1.0-states[2])-algebraic[11]*states[2]; - algebraic[12] = 0.07*exp(states[0]/20.0); - algebraic[13] = 1.0/(exp((states[0]+30.0)/10.0)+1.0); - rates[1] = algebraic[12]*(1.0-states[1])-algebraic[13]*states[1]; - algebraic[16] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0); - rates[3] = algebraic[16]*(1.0-states[3])-algebraic[17]*states[3]; + algebraic[1] = constants[2]*(states[0]-computedConstants[0]); + algebraic[2] = constants[4]*pow(states[3], 4.0)*(states[0]-computedConstants[2]); + algebraic[3] = constants[3]*pow(states[2], 3.0)*states[1]*(states[0]-computedConstants[1]); + rates[0] = -(-algebraic[0]+algebraic[3]+algebraic[2]+algebraic[1])/constants[0]; + algebraic[4] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0); + algebraic[5] = 4.0*exp(states[0]/18.0); + rates[2] = algebraic[4]*(1.0-states[2])-algebraic[5]*states[2]; + algebraic[6] = 0.07*exp(states[0]/20.0); + algebraic[7] = 1.0/(exp((states[0]+30.0)/10.0)+1.0); + rates[1] = algebraic[6]*(1.0-states[1])-algebraic[7]*states[1]; + algebraic[8] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0); + rates[3] = algebraic[8]*(1.0-states[3])-algebraic[9]*states[3]; } void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) { - algebraic[17] = externalVariable(voi, states, rates, variables, 17); + algebraic[9] = externalVariable(voi, states, rates, variables, 9); algebraic[0] = externalVariable(voi, states, rates, variables, 0); - algebraic[1] = constants[7]*(states[0]-computedConstants[6]); - algebraic[3] = constants[9]*pow(states[2], 3.0)*states[1]*(states[0]-computedConstants[8]); - algebraic[10] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0); - algebraic[11] = 4.0*exp(states[0]/18.0); - algebraic[12] = 0.07*exp(states[0]/20.0); - algebraic[13] = 1.0/(exp((states[0]+30.0)/10.0)+1.0); - algebraic[2] = constants[15]*pow(states[3], 4.0)*(states[0]-computedConstants[14]); - algebraic[16] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0); + algebraic[1] = constants[2]*(states[0]-computedConstants[0]); + algebraic[3] = constants[3]*pow(states[2], 3.0)*states[1]*(states[0]-computedConstants[1]); + algebraic[4] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0); + algebraic[5] = 4.0*exp(states[0]/18.0); + algebraic[6] = 0.07*exp(states[0]/20.0); + algebraic[7] = 1.0/(exp((states[0]+30.0)/10.0)+1.0); + algebraic[2] = constants[4]*pow(states[3], 4.0)*(states[0]-computedConstants[2]); + algebraic[8] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0); } diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.py index 381f0a24f7..006bf3b125 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.py @@ -74,50 +74,50 @@ def create_variables_array(): def initialise_variables(voi, states, rates, constants, external_variable): - constants[4] = 1.0 - constants[5] = 0.0 - constants[7] = 0.3 - constants[9] = 120.0 - constants[15] = 36.0 + constants[0] = 1.0 + constants[1] = 0.0 + constants[2] = 0.3 + constants[3] = 120.0 + constants[4] = 36.0 states[0] = 0.0 states[1] = 0.6 states[2] = 0.05 states[3] = 0.325 - algebraic[17] = external_variable(voi, states, rates, variables, 17) + algebraic[9] = external_variable(voi, states, rates, variables, 9) algebraic[0] = external_variable(voi, states, rates, variables, 0) def compute_computed_constants(constants, computed_constants): - computed_constants[6] = constants[5]-10.613 - computed_constants[8] = constants[5]-115.0 - computed_constants[14] = constants[5]+12.0 + computed_constants[0] = constants[1]-10.613 + computed_constants[1] = constants[1]-115.0 + computed_constants[2] = constants[1]+12.0 def compute_rates(voi, states, rates, constants, computed_constants, algebraic, external_variable): - algebraic[17] = external_variable(voi, states, rates, variables, 17) + algebraic[9] = external_variable(voi, states, rates, variables, 9) algebraic[0] = external_variable(voi, states, rates, variables, 0) - algebraic[1] = constants[7]*(states[0]-computed_constants[6]) - algebraic[2] = constants[15]*pow(states[3], 4.0)*(states[0]-computed_constants[14]) - algebraic[3] = constants[9]*pow(states[2], 3.0)*states[1]*(states[0]-computed_constants[8]) - rates[0] = -(-algebraic[0]+algebraic[3]+algebraic[2]+algebraic[1])/constants[4] - algebraic[10] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0) - algebraic[11] = 4.0*exp(states[0]/18.0) - rates[2] = algebraic[10]*(1.0-states[2])-algebraic[11]*states[2] - algebraic[12] = 0.07*exp(states[0]/20.0) - algebraic[13] = 1.0/(exp((states[0]+30.0)/10.0)+1.0) - rates[1] = algebraic[12]*(1.0-states[1])-algebraic[13]*states[1] - algebraic[16] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0) - rates[3] = algebraic[16]*(1.0-states[3])-algebraic[17]*states[3] + algebraic[1] = constants[2]*(states[0]-computed_constants[0]) + algebraic[2] = constants[4]*pow(states[3], 4.0)*(states[0]-computed_constants[2]) + algebraic[3] = constants[3]*pow(states[2], 3.0)*states[1]*(states[0]-computed_constants[1]) + rates[0] = -(-algebraic[0]+algebraic[3]+algebraic[2]+algebraic[1])/constants[0] + algebraic[4] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0) + algebraic[5] = 4.0*exp(states[0]/18.0) + rates[2] = algebraic[4]*(1.0-states[2])-algebraic[5]*states[2] + algebraic[6] = 0.07*exp(states[0]/20.0) + algebraic[7] = 1.0/(exp((states[0]+30.0)/10.0)+1.0) + rates[1] = algebraic[6]*(1.0-states[1])-algebraic[7]*states[1] + algebraic[8] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0) + rates[3] = algebraic[8]*(1.0-states[3])-algebraic[9]*states[3] def compute_variables(voi, states, rates, constants, computed_constants, algebraic, external_variable): - algebraic[17] = external_variable(voi, states, rates, variables, 17) + algebraic[9] = external_variable(voi, states, rates, variables, 9) algebraic[0] = external_variable(voi, states, rates, variables, 0) - algebraic[1] = constants[7]*(states[0]-computed_constants[6]) - algebraic[3] = constants[9]*pow(states[2], 3.0)*states[1]*(states[0]-computed_constants[8]) - algebraic[10] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0) - algebraic[11] = 4.0*exp(states[0]/18.0) - algebraic[12] = 0.07*exp(states[0]/20.0) - algebraic[13] = 1.0/(exp((states[0]+30.0)/10.0)+1.0) - algebraic[2] = constants[15]*pow(states[3], 4.0)*(states[0]-computed_constants[14]) - algebraic[16] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0) + algebraic[1] = constants[2]*(states[0]-computed_constants[0]) + algebraic[3] = constants[3]*pow(states[2], 3.0)*states[1]*(states[0]-computed_constants[1]) + algebraic[4] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0) + algebraic[5] = 4.0*exp(states[0]/18.0) + algebraic[6] = 0.07*exp(states[0]/20.0) + algebraic[7] = 1.0/(exp((states[0]+30.0)/10.0)+1.0) + algebraic[2] = constants[4]*pow(states[3], 4.0)*(states[0]-computed_constants[2]) + algebraic[8] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0) diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.c index 4a61f2b747..96ead04c70 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.c @@ -72,16 +72,16 @@ void deleteArray(double *array) void initialiseVariables(double voi, double *states, double *rates, double *constants, ExternalVariable externalVariable) { - constants[4] = 1.0; - constants[7] = 0.3; - constants[9] = 120.0; - constants[15] = 36.0; + constants[0] = 1.0; + constants[1] = 0.3; + constants[2] = 120.0; + constants[3] = 36.0; states[0] = 0.0; states[1] = 0.6; states[2] = 0.05; states[3] = 0.325; - algebraic[14] = externalVariable(voi, states, rates, variables, 14); - algebraic[5] = externalVariable(voi, states, rates, variables, 5); + algebraic[11] = externalVariable(voi, states, rates, variables, 11); + algebraic[4] = externalVariable(voi, states, rates, variables, 4); } void computeComputedConstants(double *constants, double *computedConstants) @@ -91,38 +91,38 @@ void computeComputedConstants(double *constants, double *computedConstants) void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) { algebraic[0] = ((voi >= 10.0) && (voi <= 10.5))?-20.0:0.0; - algebraic[14] = externalVariable(voi, states, rates, variables, 14); - algebraic[5] = externalVariable(voi, states, rates, variables, 5); - algebraic[6] = algebraic[5]-10.613; - algebraic[1] = constants[7]*(states[0]-algebraic[6]); - algebraic[2] = constants[15]*pow(states[3], 4.0)*(states[0]-algebraic[14]); - algebraic[8] = algebraic[5]-115.0; - algebraic[3] = constants[9]*pow(states[2], 3.0)*states[1]*(states[0]-algebraic[8]); - rates[0] = -(-algebraic[0]+algebraic[3]+algebraic[2]+algebraic[1])/constants[4]; - algebraic[10] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0); - algebraic[11] = 4.0*exp(states[0]/18.0); - rates[2] = algebraic[10]*(1.0-states[2])-algebraic[11]*states[2]; - algebraic[12] = 0.07*exp(states[0]/20.0); - algebraic[13] = 1.0/(exp((states[0]+30.0)/10.0)+1.0); - rates[1] = algebraic[12]*(1.0-states[1])-algebraic[13]*states[1]; - algebraic[16] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0); - algebraic[17] = 0.125*exp(states[0]/80.0); - rates[3] = algebraic[16]*(1.0-states[3])-algebraic[17]*states[3]; + algebraic[11] = externalVariable(voi, states, rates, variables, 11); + algebraic[4] = externalVariable(voi, states, rates, variables, 4); + algebraic[5] = algebraic[4]-10.613; + algebraic[1] = constants[1]*(states[0]-algebraic[5]); + algebraic[2] = constants[3]*pow(states[3], 4.0)*(states[0]-algebraic[11]); + algebraic[6] = algebraic[4]-115.0; + algebraic[3] = constants[2]*pow(states[2], 3.0)*states[1]*(states[0]-algebraic[6]); + rates[0] = -(-algebraic[0]+algebraic[3]+algebraic[2]+algebraic[1])/constants[0]; + algebraic[7] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0); + algebraic[8] = 4.0*exp(states[0]/18.0); + rates[2] = algebraic[7]*(1.0-states[2])-algebraic[8]*states[2]; + algebraic[9] = 0.07*exp(states[0]/20.0); + algebraic[10] = 1.0/(exp((states[0]+30.0)/10.0)+1.0); + rates[1] = algebraic[9]*(1.0-states[1])-algebraic[10]*states[1]; + algebraic[12] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0); + algebraic[13] = 0.125*exp(states[0]/80.0); + rates[3] = algebraic[12]*(1.0-states[3])-algebraic[13]*states[3]; } void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) { - algebraic[14] = externalVariable(voi, states, rates, variables, 14); - algebraic[5] = externalVariable(voi, states, rates, variables, 5); - algebraic[6] = algebraic[5]-10.613; - algebraic[1] = constants[7]*(states[0]-algebraic[6]); - algebraic[8] = algebraic[5]-115.0; - algebraic[3] = constants[9]*pow(states[2], 3.0)*states[1]*(states[0]-algebraic[8]); - algebraic[10] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0); - algebraic[11] = 4.0*exp(states[0]/18.0); - algebraic[12] = 0.07*exp(states[0]/20.0); - algebraic[13] = 1.0/(exp((states[0]+30.0)/10.0)+1.0); - algebraic[2] = constants[15]*pow(states[3], 4.0)*(states[0]-algebraic[14]); - algebraic[16] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0); - algebraic[17] = 0.125*exp(states[0]/80.0); + algebraic[11] = externalVariable(voi, states, rates, variables, 11); + algebraic[4] = externalVariable(voi, states, rates, variables, 4); + algebraic[5] = algebraic[4]-10.613; + algebraic[1] = constants[1]*(states[0]-algebraic[5]); + algebraic[6] = algebraic[4]-115.0; + algebraic[3] = constants[2]*pow(states[2], 3.0)*states[1]*(states[0]-algebraic[6]); + algebraic[7] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0); + algebraic[8] = 4.0*exp(states[0]/18.0); + algebraic[9] = 0.07*exp(states[0]/20.0); + algebraic[10] = 1.0/(exp((states[0]+30.0)/10.0)+1.0); + algebraic[2] = constants[3]*pow(states[3], 4.0)*(states[0]-algebraic[11]); + algebraic[12] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0); + algebraic[13] = 0.125*exp(states[0]/80.0); } diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.py index 53027ad4cb..c3a219727a 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.py @@ -74,16 +74,16 @@ def create_variables_array(): def initialise_variables(voi, states, rates, constants, external_variable): - constants[4] = 1.0 - constants[7] = 0.3 - constants[9] = 120.0 - constants[15] = 36.0 + constants[0] = 1.0 + constants[1] = 0.3 + constants[2] = 120.0 + constants[3] = 36.0 states[0] = 0.0 states[1] = 0.6 states[2] = 0.05 states[3] = 0.325 - algebraic[14] = external_variable(voi, states, rates, variables, 14) - algebraic[5] = external_variable(voi, states, rates, variables, 5) + algebraic[11] = external_variable(voi, states, rates, variables, 11) + algebraic[4] = external_variable(voi, states, rates, variables, 4) def compute_computed_constants(constants, computed_constants): @@ -92,36 +92,36 @@ def compute_computed_constants(constants, computed_constants): def compute_rates(voi, states, rates, constants, computed_constants, algebraic, external_variable): algebraic[0] = -20.0 if and_func(geq_func(voi, 10.0), leq_func(voi, 10.5)) else 0.0 - algebraic[14] = external_variable(voi, states, rates, variables, 14) - algebraic[5] = external_variable(voi, states, rates, variables, 5) - algebraic[6] = algebraic[5]-10.613 - algebraic[1] = constants[7]*(states[0]-algebraic[6]) - algebraic[2] = constants[15]*pow(states[3], 4.0)*(states[0]-algebraic[14]) - algebraic[8] = algebraic[5]-115.0 - algebraic[3] = constants[9]*pow(states[2], 3.0)*states[1]*(states[0]-algebraic[8]) - rates[0] = -(-algebraic[0]+algebraic[3]+algebraic[2]+algebraic[1])/constants[4] - algebraic[10] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0) - algebraic[11] = 4.0*exp(states[0]/18.0) - rates[2] = algebraic[10]*(1.0-states[2])-algebraic[11]*states[2] - algebraic[12] = 0.07*exp(states[0]/20.0) - algebraic[13] = 1.0/(exp((states[0]+30.0)/10.0)+1.0) - rates[1] = algebraic[12]*(1.0-states[1])-algebraic[13]*states[1] - algebraic[16] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0) - algebraic[17] = 0.125*exp(states[0]/80.0) - rates[3] = algebraic[16]*(1.0-states[3])-algebraic[17]*states[3] + algebraic[11] = external_variable(voi, states, rates, variables, 11) + algebraic[4] = external_variable(voi, states, rates, variables, 4) + algebraic[5] = algebraic[4]-10.613 + algebraic[1] = constants[1]*(states[0]-algebraic[5]) + algebraic[2] = constants[3]*pow(states[3], 4.0)*(states[0]-algebraic[11]) + algebraic[6] = algebraic[4]-115.0 + algebraic[3] = constants[2]*pow(states[2], 3.0)*states[1]*(states[0]-algebraic[6]) + rates[0] = -(-algebraic[0]+algebraic[3]+algebraic[2]+algebraic[1])/constants[0] + algebraic[7] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0) + algebraic[8] = 4.0*exp(states[0]/18.0) + rates[2] = algebraic[7]*(1.0-states[2])-algebraic[8]*states[2] + algebraic[9] = 0.07*exp(states[0]/20.0) + algebraic[10] = 1.0/(exp((states[0]+30.0)/10.0)+1.0) + rates[1] = algebraic[9]*(1.0-states[1])-algebraic[10]*states[1] + algebraic[12] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0) + algebraic[13] = 0.125*exp(states[0]/80.0) + rates[3] = algebraic[12]*(1.0-states[3])-algebraic[13]*states[3] def compute_variables(voi, states, rates, constants, computed_constants, algebraic, external_variable): - algebraic[14] = external_variable(voi, states, rates, variables, 14) - algebraic[5] = external_variable(voi, states, rates, variables, 5) - algebraic[6] = algebraic[5]-10.613 - algebraic[1] = constants[7]*(states[0]-algebraic[6]) - algebraic[8] = algebraic[5]-115.0 - algebraic[3] = constants[9]*pow(states[2], 3.0)*states[1]*(states[0]-algebraic[8]) - algebraic[10] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0) - algebraic[11] = 4.0*exp(states[0]/18.0) - algebraic[12] = 0.07*exp(states[0]/20.0) - algebraic[13] = 1.0/(exp((states[0]+30.0)/10.0)+1.0) - algebraic[2] = constants[15]*pow(states[3], 4.0)*(states[0]-algebraic[14]) - algebraic[16] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0) - algebraic[17] = 0.125*exp(states[0]/80.0) + algebraic[11] = external_variable(voi, states, rates, variables, 11) + algebraic[4] = external_variable(voi, states, rates, variables, 4) + algebraic[5] = algebraic[4]-10.613 + algebraic[1] = constants[1]*(states[0]-algebraic[5]) + algebraic[6] = algebraic[4]-115.0 + algebraic[3] = constants[2]*pow(states[2], 3.0)*states[1]*(states[0]-algebraic[6]) + algebraic[7] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0) + algebraic[8] = 4.0*exp(states[0]/18.0) + algebraic[9] = 0.07*exp(states[0]/20.0) + algebraic[10] = 1.0/(exp((states[0]+30.0)/10.0)+1.0) + algebraic[2] = constants[3]*pow(states[3], 4.0)*(states[0]-algebraic[11]) + algebraic[12] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0) + algebraic[13] = 0.125*exp(states[0]/80.0) diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.c index be516f51bd..e78468a05c 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.c @@ -72,55 +72,55 @@ void deleteArray(double *array) void initialiseVariables(double voi, double *states, double *rates, double *constants, ExternalVariable externalVariable) { - constants[5] = 0.0; - constants[7] = 0.3; - constants[15] = 36.0; + constants[0] = 0.0; + constants[1] = 0.3; + constants[2] = 36.0; states[0] = 0.0; states[1] = 0.6; states[2] = 0.05; states[3] = 0.325; - algebraic[9] = externalVariable(voi, states, rates, variables, 9); + algebraic[5] = externalVariable(voi, states, rates, variables, 5); algebraic[4] = externalVariable(voi, states, rates, variables, 4); } void computeComputedConstants(double *constants, double *computedConstants) { - computedConstants[6] = constants[5]-10.613; - computedConstants[8] = constants[5]-115.0; - computedConstants[14] = constants[5]+12.0; + computedConstants[0] = constants[0]-10.613; + computedConstants[1] = constants[0]-115.0; + computedConstants[2] = constants[0]+12.0; } void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) { algebraic[0] = ((voi >= 10.0) && (voi <= 10.5))?-20.0:0.0; - algebraic[9] = externalVariable(voi, states, rates, variables, 9); + algebraic[5] = externalVariable(voi, states, rates, variables, 5); algebraic[4] = externalVariable(voi, states, rates, variables, 4); - algebraic[1] = constants[7]*(states[0]-computedConstants[6]); - algebraic[2] = constants[15]*pow(states[3], 4.0)*(states[0]-computedConstants[14]); - algebraic[3] = algebraic[9]*pow(states[2], 3.0)*states[1]*(states[0]-computedConstants[8]); + algebraic[1] = constants[1]*(states[0]-computedConstants[0]); + algebraic[2] = constants[2]*pow(states[3], 4.0)*(states[0]-computedConstants[2]); + algebraic[3] = algebraic[5]*pow(states[2], 3.0)*states[1]*(states[0]-computedConstants[1]); rates[0] = -(-algebraic[0]+algebraic[3]+algebraic[2]+algebraic[1])/algebraic[4]; - algebraic[10] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0); - algebraic[11] = 4.0*exp(states[0]/18.0); - rates[2] = algebraic[10]*(1.0-states[2])-algebraic[11]*states[2]; - algebraic[12] = 0.07*exp(states[0]/20.0); - algebraic[13] = 1.0/(exp((states[0]+30.0)/10.0)+1.0); - rates[1] = algebraic[12]*(1.0-states[1])-algebraic[13]*states[1]; - algebraic[16] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0); - algebraic[17] = 0.125*exp(states[0]/80.0); - rates[3] = algebraic[16]*(1.0-states[3])-algebraic[17]*states[3]; + algebraic[6] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0); + algebraic[7] = 4.0*exp(states[0]/18.0); + rates[2] = algebraic[6]*(1.0-states[2])-algebraic[7]*states[2]; + algebraic[8] = 0.07*exp(states[0]/20.0); + algebraic[9] = 1.0/(exp((states[0]+30.0)/10.0)+1.0); + rates[1] = algebraic[8]*(1.0-states[1])-algebraic[9]*states[1]; + algebraic[10] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0); + algebraic[11] = 0.125*exp(states[0]/80.0); + rates[3] = algebraic[10]*(1.0-states[3])-algebraic[11]*states[3]; } void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) { - algebraic[1] = constants[7]*(states[0]-computedConstants[6]); - algebraic[9] = externalVariable(voi, states, rates, variables, 9); - algebraic[3] = algebraic[9]*pow(states[2], 3.0)*states[1]*(states[0]-computedConstants[8]); - algebraic[10] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0); - algebraic[11] = 4.0*exp(states[0]/18.0); - algebraic[12] = 0.07*exp(states[0]/20.0); - algebraic[13] = 1.0/(exp((states[0]+30.0)/10.0)+1.0); - algebraic[2] = constants[15]*pow(states[3], 4.0)*(states[0]-computedConstants[14]); - algebraic[16] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0); - algebraic[17] = 0.125*exp(states[0]/80.0); + algebraic[1] = constants[1]*(states[0]-computedConstants[0]); + algebraic[5] = externalVariable(voi, states, rates, variables, 5); + algebraic[3] = algebraic[5]*pow(states[2], 3.0)*states[1]*(states[0]-computedConstants[1]); + algebraic[6] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0); + algebraic[7] = 4.0*exp(states[0]/18.0); + algebraic[8] = 0.07*exp(states[0]/20.0); + algebraic[9] = 1.0/(exp((states[0]+30.0)/10.0)+1.0); + algebraic[2] = constants[2]*pow(states[3], 4.0)*(states[0]-computedConstants[2]); + algebraic[10] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0); + algebraic[11] = 0.125*exp(states[0]/80.0); algebraic[4] = externalVariable(voi, states, rates, variables, 4); } diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.py index e518a203f6..fb7c5c7ffc 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.py @@ -74,51 +74,51 @@ def create_variables_array(): def initialise_variables(voi, states, rates, constants, external_variable): - constants[5] = 0.0 - constants[7] = 0.3 - constants[15] = 36.0 + constants[0] = 0.0 + constants[1] = 0.3 + constants[2] = 36.0 states[0] = 0.0 states[1] = 0.6 states[2] = 0.05 states[3] = 0.325 - algebraic[9] = external_variable(voi, states, rates, variables, 9) + algebraic[5] = external_variable(voi, states, rates, variables, 5) algebraic[4] = external_variable(voi, states, rates, variables, 4) def compute_computed_constants(constants, computed_constants): - computed_constants[6] = constants[5]-10.613 - computed_constants[8] = constants[5]-115.0 - computed_constants[14] = constants[5]+12.0 + computed_constants[0] = constants[0]-10.613 + computed_constants[1] = constants[0]-115.0 + computed_constants[2] = constants[0]+12.0 def compute_rates(voi, states, rates, constants, computed_constants, algebraic, external_variable): algebraic[0] = -20.0 if and_func(geq_func(voi, 10.0), leq_func(voi, 10.5)) else 0.0 - algebraic[9] = external_variable(voi, states, rates, variables, 9) + algebraic[5] = external_variable(voi, states, rates, variables, 5) algebraic[4] = external_variable(voi, states, rates, variables, 4) - algebraic[1] = constants[7]*(states[0]-computed_constants[6]) - algebraic[2] = constants[15]*pow(states[3], 4.0)*(states[0]-computed_constants[14]) - algebraic[3] = algebraic[9]*pow(states[2], 3.0)*states[1]*(states[0]-computed_constants[8]) + algebraic[1] = constants[1]*(states[0]-computed_constants[0]) + algebraic[2] = constants[2]*pow(states[3], 4.0)*(states[0]-computed_constants[2]) + algebraic[3] = algebraic[5]*pow(states[2], 3.0)*states[1]*(states[0]-computed_constants[1]) rates[0] = -(-algebraic[0]+algebraic[3]+algebraic[2]+algebraic[1])/algebraic[4] - algebraic[10] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0) - algebraic[11] = 4.0*exp(states[0]/18.0) - rates[2] = algebraic[10]*(1.0-states[2])-algebraic[11]*states[2] - algebraic[12] = 0.07*exp(states[0]/20.0) - algebraic[13] = 1.0/(exp((states[0]+30.0)/10.0)+1.0) - rates[1] = algebraic[12]*(1.0-states[1])-algebraic[13]*states[1] - algebraic[16] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0) - algebraic[17] = 0.125*exp(states[0]/80.0) - rates[3] = algebraic[16]*(1.0-states[3])-algebraic[17]*states[3] + algebraic[6] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0) + algebraic[7] = 4.0*exp(states[0]/18.0) + rates[2] = algebraic[6]*(1.0-states[2])-algebraic[7]*states[2] + algebraic[8] = 0.07*exp(states[0]/20.0) + algebraic[9] = 1.0/(exp((states[0]+30.0)/10.0)+1.0) + rates[1] = algebraic[8]*(1.0-states[1])-algebraic[9]*states[1] + algebraic[10] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0) + algebraic[11] = 0.125*exp(states[0]/80.0) + rates[3] = algebraic[10]*(1.0-states[3])-algebraic[11]*states[3] def compute_variables(voi, states, rates, constants, computed_constants, algebraic, external_variable): - algebraic[1] = constants[7]*(states[0]-computed_constants[6]) - algebraic[9] = external_variable(voi, states, rates, variables, 9) - algebraic[3] = algebraic[9]*pow(states[2], 3.0)*states[1]*(states[0]-computed_constants[8]) - algebraic[10] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0) - algebraic[11] = 4.0*exp(states[0]/18.0) - algebraic[12] = 0.07*exp(states[0]/20.0) - algebraic[13] = 1.0/(exp((states[0]+30.0)/10.0)+1.0) - algebraic[2] = constants[15]*pow(states[3], 4.0)*(states[0]-computed_constants[14]) - algebraic[16] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0) - algebraic[17] = 0.125*exp(states[0]/80.0) + algebraic[1] = constants[1]*(states[0]-computed_constants[0]) + algebraic[5] = external_variable(voi, states, rates, variables, 5) + algebraic[3] = algebraic[5]*pow(states[2], 3.0)*states[1]*(states[0]-computed_constants[1]) + algebraic[6] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0) + algebraic[7] = 4.0*exp(states[0]/18.0) + algebraic[8] = 0.07*exp(states[0]/20.0) + algebraic[9] = 1.0/(exp((states[0]+30.0)/10.0)+1.0) + algebraic[2] = constants[2]*pow(states[3], 4.0)*(states[0]-computed_constants[2]) + algebraic[10] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0) + algebraic[11] = 0.125*exp(states[0]/80.0) algebraic[4] = external_variable(voi, states, rates, variables, 4) diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.c index a8baed030d..daca5bba88 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.c @@ -72,43 +72,43 @@ void deleteArray(double *array) void initialiseVariables(double voi, double *states, double *rates, double *constants, ExternalVariable externalVariable) { - constants[5] = 1.0; - constants[6] = 0.0; - constants[8] = 0.3; - constants[10] = 120.0; - constants[17] = 36.0; + constants[0] = 1.0; + constants[1] = 0.0; + constants[2] = 0.3; + constants[3] = 120.0; + constants[4] = 36.0; states[0] = 0.6; states[1] = 0.325; algebraic[1] = externalVariable(voi, states, rates, variables, 1); - algebraic[11] = externalVariable(voi, states, rates, variables, 11); + algebraic[5] = externalVariable(voi, states, rates, variables, 5); } void computeComputedConstants(double *constants, double *computedConstants) { - computedConstants[7] = constants[6]-10.613; - computedConstants[9] = constants[6]-115.0; - computedConstants[16] = constants[6]+12.0; + computedConstants[0] = constants[1]-10.613; + computedConstants[1] = constants[1]-115.0; + computedConstants[2] = constants[1]+12.0; } void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) { algebraic[1] = externalVariable(voi, states, rates, variables, 1); - algebraic[14] = 0.07*exp(algebraic[1]/20.0); - algebraic[15] = 1.0/(exp((algebraic[1]+30.0)/10.0)+1.0); - rates[0] = algebraic[14]*(1.0-states[0])-algebraic[15]*states[0]; - algebraic[18] = 0.01*(algebraic[1]+10.0)/(exp((algebraic[1]+10.0)/10.0)-1.0); - algebraic[19] = 0.125*exp(algebraic[1]/80.0); - rates[1] = algebraic[18]*(1.0-states[1])-algebraic[19]*states[1]; + algebraic[8] = 0.07*exp(algebraic[1]/20.0); + algebraic[9] = 1.0/(exp((algebraic[1]+30.0)/10.0)+1.0); + rates[0] = algebraic[8]*(1.0-states[0])-algebraic[9]*states[0]; + algebraic[10] = 0.01*(algebraic[1]+10.0)/(exp((algebraic[1]+10.0)/10.0)-1.0); + algebraic[11] = 0.125*exp(algebraic[1]/80.0); + rates[1] = algebraic[10]*(1.0-states[1])-algebraic[11]*states[1]; } void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) { algebraic[0] = ((voi >= 10.0) && (voi <= 10.5))?-20.0:0.0; algebraic[1] = externalVariable(voi, states, rates, variables, 1); - algebraic[2] = constants[8]*(algebraic[1]-computedConstants[7]); - algebraic[11] = externalVariable(voi, states, rates, variables, 11); - algebraic[4] = constants[10]*pow(algebraic[11], 3.0)*states[0]*(algebraic[1]-computedConstants[9]); - algebraic[12] = 0.1*(algebraic[1]+25.0)/(exp((algebraic[1]+25.0)/10.0)-1.0); - algebraic[13] = 4.0*exp(algebraic[1]/18.0); - algebraic[3] = constants[17]*pow(states[1], 4.0)*(algebraic[1]-computedConstants[16]); + algebraic[2] = constants[2]*(algebraic[1]-computedConstants[0]); + algebraic[5] = externalVariable(voi, states, rates, variables, 5); + algebraic[4] = constants[3]*pow(algebraic[5], 3.0)*states[0]*(algebraic[1]-computedConstants[1]); + algebraic[6] = 0.1*(algebraic[1]+25.0)/(exp((algebraic[1]+25.0)/10.0)-1.0); + algebraic[7] = 4.0*exp(algebraic[1]/18.0); + algebraic[3] = constants[4]*pow(states[1], 4.0)*(algebraic[1]-computedConstants[2]); } diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.py index 914194e7fb..02be0961dc 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.py @@ -74,39 +74,39 @@ def create_variables_array(): def initialise_variables(voi, states, rates, constants, external_variable): - constants[5] = 1.0 - constants[6] = 0.0 - constants[8] = 0.3 - constants[10] = 120.0 - constants[17] = 36.0 + constants[0] = 1.0 + constants[1] = 0.0 + constants[2] = 0.3 + constants[3] = 120.0 + constants[4] = 36.0 states[0] = 0.6 states[1] = 0.325 algebraic[1] = external_variable(voi, states, rates, variables, 1) - algebraic[11] = external_variable(voi, states, rates, variables, 11) + algebraic[5] = external_variable(voi, states, rates, variables, 5) def compute_computed_constants(constants, computed_constants): - computed_constants[7] = constants[6]-10.613 - computed_constants[9] = constants[6]-115.0 - computed_constants[16] = constants[6]+12.0 + computed_constants[0] = constants[1]-10.613 + computed_constants[1] = constants[1]-115.0 + computed_constants[2] = constants[1]+12.0 def compute_rates(voi, states, rates, constants, computed_constants, algebraic, external_variable): algebraic[1] = external_variable(voi, states, rates, variables, 1) - algebraic[14] = 0.07*exp(algebraic[1]/20.0) - algebraic[15] = 1.0/(exp((algebraic[1]+30.0)/10.0)+1.0) - rates[0] = algebraic[14]*(1.0-states[0])-algebraic[15]*states[0] - algebraic[18] = 0.01*(algebraic[1]+10.0)/(exp((algebraic[1]+10.0)/10.0)-1.0) - algebraic[19] = 0.125*exp(algebraic[1]/80.0) - rates[1] = algebraic[18]*(1.0-states[1])-algebraic[19]*states[1] + algebraic[8] = 0.07*exp(algebraic[1]/20.0) + algebraic[9] = 1.0/(exp((algebraic[1]+30.0)/10.0)+1.0) + rates[0] = algebraic[8]*(1.0-states[0])-algebraic[9]*states[0] + algebraic[10] = 0.01*(algebraic[1]+10.0)/(exp((algebraic[1]+10.0)/10.0)-1.0) + algebraic[11] = 0.125*exp(algebraic[1]/80.0) + rates[1] = algebraic[10]*(1.0-states[1])-algebraic[11]*states[1] def compute_variables(voi, states, rates, constants, computed_constants, algebraic, external_variable): algebraic[0] = -20.0 if and_func(geq_func(voi, 10.0), leq_func(voi, 10.5)) else 0.0 algebraic[1] = external_variable(voi, states, rates, variables, 1) - algebraic[2] = constants[8]*(algebraic[1]-computed_constants[7]) - algebraic[11] = external_variable(voi, states, rates, variables, 11) - algebraic[4] = constants[10]*pow(algebraic[11], 3.0)*states[0]*(algebraic[1]-computed_constants[9]) - algebraic[12] = 0.1*(algebraic[1]+25.0)/(exp((algebraic[1]+25.0)/10.0)-1.0) - algebraic[13] = 4.0*exp(algebraic[1]/18.0) - algebraic[3] = constants[17]*pow(states[1], 4.0)*(algebraic[1]-computed_constants[16]) + algebraic[2] = constants[2]*(algebraic[1]-computed_constants[0]) + algebraic[5] = external_variable(voi, states, rates, variables, 5) + algebraic[4] = constants[3]*pow(algebraic[5], 3.0)*states[0]*(algebraic[1]-computed_constants[1]) + algebraic[6] = 0.1*(algebraic[1]+25.0)/(exp((algebraic[1]+25.0)/10.0)-1.0) + algebraic[7] = 4.0*exp(algebraic[1]/18.0) + algebraic[3] = constants[4]*pow(states[1], 4.0)*(algebraic[1]-computed_constants[2]) diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.c index b21ab1d041..6daaf81cff 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.c @@ -72,46 +72,46 @@ void deleteArray(double *array) void initialiseVariables(double voi, double *states, double *rates, double *constants, ExternalVariable externalVariable) { - constants[5] = 1.0; - constants[6] = 0.0; - constants[8] = 0.3; - constants[10] = 120.0; - constants[16] = 36.0; + constants[0] = 1.0; + constants[1] = 0.0; + constants[2] = 0.3; + constants[3] = 120.0; + constants[4] = 36.0; states[0] = 0.6; states[1] = 0.05; states[2] = 0.325; algebraic[1] = externalVariable(voi, states, rates, variables, 1); - algebraic[17] = externalVariable(voi, states, rates, variables, 17); + algebraic[9] = externalVariable(voi, states, rates, variables, 9); algebraic[4] = externalVariable(voi, states, rates, variables, 4); } void computeComputedConstants(double *constants, double *computedConstants) { - computedConstants[7] = constants[6]-10.613; - computedConstants[9] = constants[6]-115.0; - computedConstants[15] = constants[6]+12.0; + computedConstants[0] = constants[1]-10.613; + computedConstants[1] = constants[1]-115.0; + computedConstants[2] = constants[1]+12.0; } void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) { algebraic[1] = externalVariable(voi, states, rates, variables, 1); - algebraic[11] = 0.1*(algebraic[1]+25.0)/(exp((algebraic[1]+25.0)/10.0)-1.0); - algebraic[12] = 4.0*exp(algebraic[1]/18.0); - rates[1] = algebraic[11]*(1.0-states[1])-algebraic[12]*states[1]; - algebraic[13] = 0.07*exp(algebraic[1]/20.0); - algebraic[14] = 1.0/(exp((algebraic[1]+30.0)/10.0)+1.0); - rates[0] = algebraic[13]*(1.0-states[0])-algebraic[14]*states[0]; - algebraic[17] = externalVariable(voi, states, rates, variables, 17); - algebraic[18] = 0.125*exp(algebraic[1]/80.0); - rates[2] = algebraic[17]*(1.0-states[2])-algebraic[18]*states[2]; + algebraic[5] = 0.1*(algebraic[1]+25.0)/(exp((algebraic[1]+25.0)/10.0)-1.0); + algebraic[6] = 4.0*exp(algebraic[1]/18.0); + rates[1] = algebraic[5]*(1.0-states[1])-algebraic[6]*states[1]; + algebraic[7] = 0.07*exp(algebraic[1]/20.0); + algebraic[8] = 1.0/(exp((algebraic[1]+30.0)/10.0)+1.0); + rates[0] = algebraic[7]*(1.0-states[0])-algebraic[8]*states[0]; + algebraic[9] = externalVariable(voi, states, rates, variables, 9); + algebraic[10] = 0.125*exp(algebraic[1]/80.0); + rates[2] = algebraic[9]*(1.0-states[2])-algebraic[10]*states[2]; } void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) { algebraic[0] = ((voi >= 10.0) && (voi <= 10.5))?-20.0:0.0; algebraic[1] = externalVariable(voi, states, rates, variables, 1); - algebraic[2] = constants[8]*(algebraic[1]-computedConstants[7]); - algebraic[17] = externalVariable(voi, states, rates, variables, 17); + algebraic[2] = constants[2]*(algebraic[1]-computedConstants[0]); + algebraic[9] = externalVariable(voi, states, rates, variables, 9); algebraic[4] = externalVariable(voi, states, rates, variables, 4); - algebraic[3] = constants[16]*pow(states[2], 4.0)*(algebraic[1]-computedConstants[15]); + algebraic[3] = constants[4]*pow(states[2], 4.0)*(algebraic[1]-computedConstants[2]); } diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.py index d64291b4a8..0cbe773e17 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.py @@ -74,42 +74,42 @@ def create_variables_array(): def initialise_variables(voi, states, rates, constants, external_variable): - constants[5] = 1.0 - constants[6] = 0.0 - constants[8] = 0.3 - constants[10] = 120.0 - constants[16] = 36.0 + constants[0] = 1.0 + constants[1] = 0.0 + constants[2] = 0.3 + constants[3] = 120.0 + constants[4] = 36.0 states[0] = 0.6 states[1] = 0.05 states[2] = 0.325 algebraic[1] = external_variable(voi, states, rates, variables, 1) - algebraic[17] = external_variable(voi, states, rates, variables, 17) + algebraic[9] = external_variable(voi, states, rates, variables, 9) algebraic[4] = external_variable(voi, states, rates, variables, 4) def compute_computed_constants(constants, computed_constants): - computed_constants[7] = constants[6]-10.613 - computed_constants[9] = constants[6]-115.0 - computed_constants[15] = constants[6]+12.0 + computed_constants[0] = constants[1]-10.613 + computed_constants[1] = constants[1]-115.0 + computed_constants[2] = constants[1]+12.0 def compute_rates(voi, states, rates, constants, computed_constants, algebraic, external_variable): algebraic[1] = external_variable(voi, states, rates, variables, 1) - algebraic[11] = 0.1*(algebraic[1]+25.0)/(exp((algebraic[1]+25.0)/10.0)-1.0) - algebraic[12] = 4.0*exp(algebraic[1]/18.0) - rates[1] = algebraic[11]*(1.0-states[1])-algebraic[12]*states[1] - algebraic[13] = 0.07*exp(algebraic[1]/20.0) - algebraic[14] = 1.0/(exp((algebraic[1]+30.0)/10.0)+1.0) - rates[0] = algebraic[13]*(1.0-states[0])-algebraic[14]*states[0] - algebraic[17] = external_variable(voi, states, rates, variables, 17) - algebraic[18] = 0.125*exp(algebraic[1]/80.0) - rates[2] = algebraic[17]*(1.0-states[2])-algebraic[18]*states[2] + algebraic[5] = 0.1*(algebraic[1]+25.0)/(exp((algebraic[1]+25.0)/10.0)-1.0) + algebraic[6] = 4.0*exp(algebraic[1]/18.0) + rates[1] = algebraic[5]*(1.0-states[1])-algebraic[6]*states[1] + algebraic[7] = 0.07*exp(algebraic[1]/20.0) + algebraic[8] = 1.0/(exp((algebraic[1]+30.0)/10.0)+1.0) + rates[0] = algebraic[7]*(1.0-states[0])-algebraic[8]*states[0] + algebraic[9] = external_variable(voi, states, rates, variables, 9) + algebraic[10] = 0.125*exp(algebraic[1]/80.0) + rates[2] = algebraic[9]*(1.0-states[2])-algebraic[10]*states[2] def compute_variables(voi, states, rates, constants, computed_constants, algebraic, external_variable): algebraic[0] = -20.0 if and_func(geq_func(voi, 10.0), leq_func(voi, 10.5)) else 0.0 algebraic[1] = external_variable(voi, states, rates, variables, 1) - algebraic[2] = constants[8]*(algebraic[1]-computed_constants[7]) - algebraic[17] = external_variable(voi, states, rates, variables, 17) + algebraic[2] = constants[2]*(algebraic[1]-computed_constants[0]) + algebraic[9] = external_variable(voi, states, rates, variables, 9) algebraic[4] = external_variable(voi, states, rates, variables, 4) - algebraic[3] = constants[16]*pow(states[2], 4.0)*(algebraic[1]-computed_constants[15]) + algebraic[3] = constants[4]*pow(states[2], 4.0)*(algebraic[1]-computed_constants[2]) diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.py index 87eb31f08e..68e90fdd0d 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.py @@ -73,11 +73,11 @@ def create_variables_array(): def initialise_variables(states, rates, constants): - constants[4] = 1.0 - constants[5] = 0.0 - constants[7] = 0.3 - constants[9] = 120.0 - constants[15] = 36.0 + constants[0] = 1.0 + constants[1] = 0.0 + constants[2] = 0.3 + constants[3] = 120.0 + constants[4] = 36.0 states[0] = 0.0 states[1] = 0.6 states[2] = 0.05 @@ -85,35 +85,35 @@ def initialise_variables(states, rates, constants): def compute_computed_constants(constants, computed_constants): - computed_constants[6] = constants[5]-10.613 - computed_constants[8] = constants[5]-115.0 - computed_constants[14] = constants[5]+12.0 + computed_constants[0] = constants[1]-10.613 + computed_constants[1] = constants[1]-115.0 + computed_constants[2] = constants[1]+12.0 def compute_rates(voi, states, rates, constants, computed_constants, algebraic): algebraic[0] = -20.0 if and_func(geq_func(voi, 10.0), leq_func(voi, 10.5)) else 0.0 - algebraic[1] = constants[7]*(states[0]-computed_constants[6]) - algebraic[2] = constants[15]*pow(states[3], 4.0)*(states[0]-computed_constants[14]) - algebraic[3] = constants[9]*pow(states[2], 3.0)*states[1]*(states[0]-computed_constants[8]) - rates[0] = -(-algebraic[0]+algebraic[3]+algebraic[2]+algebraic[1])/constants[4] - algebraic[10] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0) - algebraic[11] = 4.0*exp(states[0]/18.0) - rates[2] = algebraic[10]*(1.0-states[2])-algebraic[11]*states[2] - algebraic[12] = 0.07*exp(states[0]/20.0) - algebraic[13] = 1.0/(exp((states[0]+30.0)/10.0)+1.0) - rates[1] = algebraic[12]*(1.0-states[1])-algebraic[13]*states[1] - algebraic[16] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0) - algebraic[17] = 0.125*exp(states[0]/80.0) - rates[3] = algebraic[16]*(1.0-states[3])-algebraic[17]*states[3] + algebraic[1] = constants[2]*(states[0]-computed_constants[0]) + algebraic[2] = constants[4]*pow(states[3], 4.0)*(states[0]-computed_constants[2]) + algebraic[3] = constants[3]*pow(states[2], 3.0)*states[1]*(states[0]-computed_constants[1]) + rates[0] = -(-algebraic[0]+algebraic[3]+algebraic[2]+algebraic[1])/constants[0] + algebraic[4] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0) + algebraic[5] = 4.0*exp(states[0]/18.0) + rates[2] = algebraic[4]*(1.0-states[2])-algebraic[5]*states[2] + algebraic[6] = 0.07*exp(states[0]/20.0) + algebraic[7] = 1.0/(exp((states[0]+30.0)/10.0)+1.0) + rates[1] = algebraic[6]*(1.0-states[1])-algebraic[7]*states[1] + algebraic[8] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0) + algebraic[9] = 0.125*exp(states[0]/80.0) + rates[3] = algebraic[8]*(1.0-states[3])-algebraic[9]*states[3] def compute_variables(voi, states, rates, constants, computed_constants, algebraic): - algebraic[1] = constants[7]*(states[0]-computed_constants[6]) - algebraic[3] = constants[9]*pow(states[2], 3.0)*states[1]*(states[0]-computed_constants[8]) - algebraic[10] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0) - algebraic[11] = 4.0*exp(states[0]/18.0) - algebraic[12] = 0.07*exp(states[0]/20.0) - algebraic[13] = 1.0/(exp((states[0]+30.0)/10.0)+1.0) - algebraic[2] = constants[15]*pow(states[3], 4.0)*(states[0]-computed_constants[14]) - algebraic[16] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0) - algebraic[17] = 0.125*exp(states[0]/80.0) + algebraic[1] = constants[2]*(states[0]-computed_constants[0]) + algebraic[3] = constants[3]*pow(states[2], 3.0)*states[1]*(states[0]-computed_constants[1]) + algebraic[4] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0) + algebraic[5] = 4.0*exp(states[0]/18.0) + algebraic[6] = 0.07*exp(states[0]/20.0) + algebraic[7] = 1.0/(exp((states[0]+30.0)/10.0)+1.0) + algebraic[2] = constants[4]*pow(states[3], 4.0)*(states[0]-computed_constants[2]) + algebraic[8] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0) + algebraic[9] = 0.125*exp(states[0]/80.0) diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.c index 083b39125e..fa7028471e 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.c @@ -72,50 +72,50 @@ void deleteArray(double *array) void initialiseVariables(double voi, double *states, double *rates, double *constants, ExternalVariable externalVariable) { - constants[4] = 1.0; - constants[5] = 0.0; - constants[7] = 0.3; - constants[9] = 120.0; - constants[16] = 36.0; + constants[0] = 1.0; + constants[1] = 0.0; + constants[2] = 0.3; + constants[3] = 120.0; + constants[4] = 36.0; states[0] = 0.0; states[1] = 0.6; states[2] = 0.325; - algebraic[10] = externalVariable(voi, states, rates, variables, 10); + algebraic[4] = externalVariable(voi, states, rates, variables, 4); } void computeComputedConstants(double *constants, double *computedConstants) { - computedConstants[6] = constants[5]-10.613; - computedConstants[8] = constants[5]-115.0; - computedConstants[15] = constants[5]+12.0; + computedConstants[0] = constants[1]-10.613; + computedConstants[1] = constants[1]-115.0; + computedConstants[2] = constants[1]+12.0; } void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) { algebraic[0] = ((voi >= 10.0) && (voi <= 10.5))?-20.0:0.0; - algebraic[1] = constants[7]*(states[0]-computedConstants[6]); - algebraic[2] = constants[16]*pow(states[2], 4.0)*(states[0]-computedConstants[15]); - algebraic[10] = externalVariable(voi, states, rates, variables, 10); - algebraic[3] = constants[9]*pow(algebraic[10], 3.0)*states[1]*(states[0]-computedConstants[8]); - rates[0] = -(-algebraic[0]+algebraic[3]+algebraic[2]+algebraic[1])/constants[4]; - algebraic[13] = 0.07*exp(states[0]/20.0); - algebraic[14] = 1.0/(exp((states[0]+30.0)/10.0)+1.0); - rates[1] = algebraic[13]*(1.0-states[1])-algebraic[14]*states[1]; - algebraic[17] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0); - algebraic[18] = 0.125*exp(states[0]/80.0); - rates[2] = algebraic[17]*(1.0-states[2])-algebraic[18]*states[2]; + algebraic[1] = constants[2]*(states[0]-computedConstants[0]); + algebraic[2] = constants[4]*pow(states[2], 4.0)*(states[0]-computedConstants[2]); + algebraic[4] = externalVariable(voi, states, rates, variables, 4); + algebraic[3] = constants[3]*pow(algebraic[4], 3.0)*states[1]*(states[0]-computedConstants[1]); + rates[0] = -(-algebraic[0]+algebraic[3]+algebraic[2]+algebraic[1])/constants[0]; + algebraic[7] = 0.07*exp(states[0]/20.0); + algebraic[8] = 1.0/(exp((states[0]+30.0)/10.0)+1.0); + rates[1] = algebraic[7]*(1.0-states[1])-algebraic[8]*states[1]; + algebraic[9] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0); + algebraic[10] = 0.125*exp(states[0]/80.0); + rates[2] = algebraic[9]*(1.0-states[2])-algebraic[10]*states[2]; } void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) { - algebraic[1] = constants[7]*(states[0]-computedConstants[6]); - algebraic[10] = externalVariable(voi, states, rates, variables, 10); - algebraic[3] = constants[9]*pow(algebraic[10], 3.0)*states[1]*(states[0]-computedConstants[8]); - algebraic[11] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0); - algebraic[12] = 4.0*exp(states[0]/18.0); - algebraic[13] = 0.07*exp(states[0]/20.0); - algebraic[14] = 1.0/(exp((states[0]+30.0)/10.0)+1.0); - algebraic[2] = constants[16]*pow(states[2], 4.0)*(states[0]-computedConstants[15]); - algebraic[17] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0); - algebraic[18] = 0.125*exp(states[0]/80.0); + algebraic[1] = constants[2]*(states[0]-computedConstants[0]); + algebraic[4] = externalVariable(voi, states, rates, variables, 4); + algebraic[3] = constants[3]*pow(algebraic[4], 3.0)*states[1]*(states[0]-computedConstants[1]); + algebraic[5] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0); + algebraic[6] = 4.0*exp(states[0]/18.0); + algebraic[7] = 0.07*exp(states[0]/20.0); + algebraic[8] = 1.0/(exp((states[0]+30.0)/10.0)+1.0); + algebraic[2] = constants[4]*pow(states[2], 4.0)*(states[0]-computedConstants[2]); + algebraic[9] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0); + algebraic[10] = 0.125*exp(states[0]/80.0); } diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.py index bee8d59e4f..d1748c002e 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.py @@ -74,46 +74,46 @@ def create_variables_array(): def initialise_variables(voi, states, rates, constants, external_variable): - constants[4] = 1.0 - constants[5] = 0.0 - constants[7] = 0.3 - constants[9] = 120.0 - constants[16] = 36.0 + constants[0] = 1.0 + constants[1] = 0.0 + constants[2] = 0.3 + constants[3] = 120.0 + constants[4] = 36.0 states[0] = 0.0 states[1] = 0.6 states[2] = 0.325 - algebraic[10] = external_variable(voi, states, rates, variables, 10) + algebraic[4] = external_variable(voi, states, rates, variables, 4) def compute_computed_constants(constants, computed_constants): - computed_constants[6] = constants[5]-10.613 - computed_constants[8] = constants[5]-115.0 - computed_constants[15] = constants[5]+12.0 + computed_constants[0] = constants[1]-10.613 + computed_constants[1] = constants[1]-115.0 + computed_constants[2] = constants[1]+12.0 def compute_rates(voi, states, rates, constants, computed_constants, algebraic, external_variable): algebraic[0] = -20.0 if and_func(geq_func(voi, 10.0), leq_func(voi, 10.5)) else 0.0 - algebraic[1] = constants[7]*(states[0]-computed_constants[6]) - algebraic[2] = constants[16]*pow(states[2], 4.0)*(states[0]-computed_constants[15]) - algebraic[10] = external_variable(voi, states, rates, variables, 10) - algebraic[3] = constants[9]*pow(algebraic[10], 3.0)*states[1]*(states[0]-computed_constants[8]) - rates[0] = -(-algebraic[0]+algebraic[3]+algebraic[2]+algebraic[1])/constants[4] - algebraic[13] = 0.07*exp(states[0]/20.0) - algebraic[14] = 1.0/(exp((states[0]+30.0)/10.0)+1.0) - rates[1] = algebraic[13]*(1.0-states[1])-algebraic[14]*states[1] - algebraic[17] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0) - algebraic[18] = 0.125*exp(states[0]/80.0) - rates[2] = algebraic[17]*(1.0-states[2])-algebraic[18]*states[2] + algebraic[1] = constants[2]*(states[0]-computed_constants[0]) + algebraic[2] = constants[4]*pow(states[2], 4.0)*(states[0]-computed_constants[2]) + algebraic[4] = external_variable(voi, states, rates, variables, 4) + algebraic[3] = constants[3]*pow(algebraic[4], 3.0)*states[1]*(states[0]-computed_constants[1]) + rates[0] = -(-algebraic[0]+algebraic[3]+algebraic[2]+algebraic[1])/constants[0] + algebraic[7] = 0.07*exp(states[0]/20.0) + algebraic[8] = 1.0/(exp((states[0]+30.0)/10.0)+1.0) + rates[1] = algebraic[7]*(1.0-states[1])-algebraic[8]*states[1] + algebraic[9] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0) + algebraic[10] = 0.125*exp(states[0]/80.0) + rates[2] = algebraic[9]*(1.0-states[2])-algebraic[10]*states[2] def compute_variables(voi, states, rates, constants, computed_constants, algebraic, external_variable): - algebraic[1] = constants[7]*(states[0]-computed_constants[6]) - algebraic[10] = external_variable(voi, states, rates, variables, 10) - algebraic[3] = constants[9]*pow(algebraic[10], 3.0)*states[1]*(states[0]-computed_constants[8]) - algebraic[11] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0) - algebraic[12] = 4.0*exp(states[0]/18.0) - algebraic[13] = 0.07*exp(states[0]/20.0) - algebraic[14] = 1.0/(exp((states[0]+30.0)/10.0)+1.0) - algebraic[2] = constants[16]*pow(states[2], 4.0)*(states[0]-computed_constants[15]) - algebraic[17] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0) - algebraic[18] = 0.125*exp(states[0]/80.0) + algebraic[1] = constants[2]*(states[0]-computed_constants[0]) + algebraic[4] = external_variable(voi, states, rates, variables, 4) + algebraic[3] = constants[3]*pow(algebraic[4], 3.0)*states[1]*(states[0]-computed_constants[1]) + algebraic[5] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0) + algebraic[6] = 4.0*exp(states[0]/18.0) + algebraic[7] = 0.07*exp(states[0]/20.0) + algebraic[8] = 1.0/(exp((states[0]+30.0)/10.0)+1.0) + algebraic[2] = constants[4]*pow(states[2], 4.0)*(states[0]-computed_constants[2]) + algebraic[9] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0) + algebraic[10] = 0.125*exp(states[0]/80.0) diff --git a/tests/resources/generator/noble_model_1962/model.c b/tests/resources/generator/noble_model_1962/model.c index e8a1804744..d0434bbc61 100644 --- a/tests/resources/generator/noble_model_1962/model.c +++ b/tests/resources/generator/noble_model_1962/model.c @@ -71,11 +71,11 @@ void deleteArray(double *array) void initialiseVariables(double *states, double *rates, double *constants) { - constants[3] = 12.0; - constants[4] = 0.075; - constants[5] = -60.0; - constants[7] = 400.0; - constants[8] = 40.0; + constants[0] = 12.0; + constants[1] = 0.075; + constants[2] = -60.0; + constants[3] = 400.0; + constants[4] = 40.0; states[0] = -87.0; states[1] = 0.01; states[2] = 0.8; @@ -88,36 +88,36 @@ void computeComputedConstants(double *constants, double *computedConstants) void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { - algebraic[6] = pow(states[1], 3.0)*states[2]*constants[7]; - algebraic[0] = (algebraic[6]+0.14)*(states[0]-constants[8]); - algebraic[1] = constants[4]*(states[0]-constants[5]); - algebraic[13] = 1.2*exp((-states[0]-90.0)/50.0)+0.015*exp((states[0]+90.0)/60.0); - algebraic[14] = 1.2*pow(states[3], 4.0); - algebraic[2] = (algebraic[13]+algebraic[14])*(states[0]+100.0); - rates[0] = -(algebraic[0]+algebraic[2]+algebraic[1])/constants[3]; - algebraic[9] = 0.1*(-states[0]-48.0)/(exp((-states[0]-48.0)/15.0)-1.0); - algebraic[10] = 0.12*(states[0]+8.0)/(exp((states[0]+8.0)/5.0)-1.0); - rates[1] = algebraic[9]*(1.0-states[1])-algebraic[10]*states[1]; - algebraic[11] = 0.17*exp((-states[0]-90.0)/20.0); - algebraic[12] = 1.0/(1.0+exp((-states[0]-42.0)/10.0)); - rates[2] = algebraic[11]*(1.0-states[2])-algebraic[12]*states[2]; - algebraic[15] = 0.0001*(-states[0]-50.0)/(exp((-states[0]-50.0)/10.0)-1.0); - algebraic[16] = 0.002*exp((-states[0]-90.0)/80.0); - rates[3] = algebraic[15]*(1.0-states[3])-algebraic[16]*states[3]; + algebraic[3] = pow(states[1], 3.0)*states[2]*constants[3]; + algebraic[0] = (algebraic[3]+0.14)*(states[0]-constants[4]); + algebraic[1] = constants[1]*(states[0]-constants[2]); + algebraic[8] = 1.2*exp((-states[0]-90.0)/50.0)+0.015*exp((states[0]+90.0)/60.0); + algebraic[9] = 1.2*pow(states[3], 4.0); + algebraic[2] = (algebraic[8]+algebraic[9])*(states[0]+100.0); + rates[0] = -(algebraic[0]+algebraic[2]+algebraic[1])/constants[0]; + algebraic[4] = 0.1*(-states[0]-48.0)/(exp((-states[0]-48.0)/15.0)-1.0); + algebraic[5] = 0.12*(states[0]+8.0)/(exp((states[0]+8.0)/5.0)-1.0); + rates[1] = algebraic[4]*(1.0-states[1])-algebraic[5]*states[1]; + algebraic[6] = 0.17*exp((-states[0]-90.0)/20.0); + algebraic[7] = 1.0/(1.0+exp((-states[0]-42.0)/10.0)); + rates[2] = algebraic[6]*(1.0-states[2])-algebraic[7]*states[2]; + algebraic[10] = 0.0001*(-states[0]-50.0)/(exp((-states[0]-50.0)/10.0)-1.0); + algebraic[11] = 0.002*exp((-states[0]-90.0)/80.0); + rates[3] = algebraic[10]*(1.0-states[3])-algebraic[11]*states[3]; } void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { - algebraic[1] = constants[4]*(states[0]-constants[5]); - algebraic[6] = pow(states[1], 3.0)*states[2]*constants[7]; - algebraic[0] = (algebraic[6]+0.14)*(states[0]-constants[8]); - algebraic[9] = 0.1*(-states[0]-48.0)/(exp((-states[0]-48.0)/15.0)-1.0); - algebraic[10] = 0.12*(states[0]+8.0)/(exp((states[0]+8.0)/5.0)-1.0); - algebraic[11] = 0.17*exp((-states[0]-90.0)/20.0); - algebraic[12] = 1.0/(1.0+exp((-states[0]-42.0)/10.0)); - algebraic[13] = 1.2*exp((-states[0]-90.0)/50.0)+0.015*exp((states[0]+90.0)/60.0); - algebraic[14] = 1.2*pow(states[3], 4.0); - algebraic[2] = (algebraic[13]+algebraic[14])*(states[0]+100.0); - algebraic[15] = 0.0001*(-states[0]-50.0)/(exp((-states[0]-50.0)/10.0)-1.0); - algebraic[16] = 0.002*exp((-states[0]-90.0)/80.0); + algebraic[1] = constants[1]*(states[0]-constants[2]); + algebraic[3] = pow(states[1], 3.0)*states[2]*constants[3]; + algebraic[0] = (algebraic[3]+0.14)*(states[0]-constants[4]); + algebraic[4] = 0.1*(-states[0]-48.0)/(exp((-states[0]-48.0)/15.0)-1.0); + algebraic[5] = 0.12*(states[0]+8.0)/(exp((states[0]+8.0)/5.0)-1.0); + algebraic[6] = 0.17*exp((-states[0]-90.0)/20.0); + algebraic[7] = 1.0/(1.0+exp((-states[0]-42.0)/10.0)); + algebraic[8] = 1.2*exp((-states[0]-90.0)/50.0)+0.015*exp((states[0]+90.0)/60.0); + algebraic[9] = 1.2*pow(states[3], 4.0); + algebraic[2] = (algebraic[8]+algebraic[9])*(states[0]+100.0); + algebraic[10] = 0.0001*(-states[0]-50.0)/(exp((-states[0]-50.0)/10.0)-1.0); + algebraic[11] = 0.002*exp((-states[0]-90.0)/80.0); } diff --git a/tests/resources/generator/noble_model_1962/model.py b/tests/resources/generator/noble_model_1962/model.py index d9672b95f4..04b3307a0c 100644 --- a/tests/resources/generator/noble_model_1962/model.py +++ b/tests/resources/generator/noble_model_1962/model.py @@ -60,11 +60,11 @@ def create_variables_array(): def initialise_variables(states, rates, constants): - constants[3] = 12.0 - constants[4] = 0.075 - constants[5] = -60.0 - constants[7] = 400.0 - constants[8] = 40.0 + constants[0] = 12.0 + constants[1] = 0.075 + constants[2] = -60.0 + constants[3] = 400.0 + constants[4] = 40.0 states[0] = -87.0 states[1] = 0.01 states[2] = 0.8 @@ -76,34 +76,34 @@ def compute_computed_constants(constants, computed_constants): def compute_rates(voi, states, rates, constants, computed_constants, algebraic): - algebraic[6] = pow(states[1], 3.0)*states[2]*constants[7] - algebraic[0] = (algebraic[6]+0.14)*(states[0]-constants[8]) - algebraic[1] = constants[4]*(states[0]-constants[5]) - algebraic[13] = 1.2*exp((-states[0]-90.0)/50.0)+0.015*exp((states[0]+90.0)/60.0) - algebraic[14] = 1.2*pow(states[3], 4.0) - algebraic[2] = (algebraic[13]+algebraic[14])*(states[0]+100.0) - rates[0] = -(algebraic[0]+algebraic[2]+algebraic[1])/constants[3] - algebraic[9] = 0.1*(-states[0]-48.0)/(exp((-states[0]-48.0)/15.0)-1.0) - algebraic[10] = 0.12*(states[0]+8.0)/(exp((states[0]+8.0)/5.0)-1.0) - rates[1] = algebraic[9]*(1.0-states[1])-algebraic[10]*states[1] - algebraic[11] = 0.17*exp((-states[0]-90.0)/20.0) - algebraic[12] = 1.0/(1.0+exp((-states[0]-42.0)/10.0)) - rates[2] = algebraic[11]*(1.0-states[2])-algebraic[12]*states[2] - algebraic[15] = 0.0001*(-states[0]-50.0)/(exp((-states[0]-50.0)/10.0)-1.0) - algebraic[16] = 0.002*exp((-states[0]-90.0)/80.0) - rates[3] = algebraic[15]*(1.0-states[3])-algebraic[16]*states[3] + algebraic[3] = pow(states[1], 3.0)*states[2]*constants[3] + algebraic[0] = (algebraic[3]+0.14)*(states[0]-constants[4]) + algebraic[1] = constants[1]*(states[0]-constants[2]) + algebraic[8] = 1.2*exp((-states[0]-90.0)/50.0)+0.015*exp((states[0]+90.0)/60.0) + algebraic[9] = 1.2*pow(states[3], 4.0) + algebraic[2] = (algebraic[8]+algebraic[9])*(states[0]+100.0) + rates[0] = -(algebraic[0]+algebraic[2]+algebraic[1])/constants[0] + algebraic[4] = 0.1*(-states[0]-48.0)/(exp((-states[0]-48.0)/15.0)-1.0) + algebraic[5] = 0.12*(states[0]+8.0)/(exp((states[0]+8.0)/5.0)-1.0) + rates[1] = algebraic[4]*(1.0-states[1])-algebraic[5]*states[1] + algebraic[6] = 0.17*exp((-states[0]-90.0)/20.0) + algebraic[7] = 1.0/(1.0+exp((-states[0]-42.0)/10.0)) + rates[2] = algebraic[6]*(1.0-states[2])-algebraic[7]*states[2] + algebraic[10] = 0.0001*(-states[0]-50.0)/(exp((-states[0]-50.0)/10.0)-1.0) + algebraic[11] = 0.002*exp((-states[0]-90.0)/80.0) + rates[3] = algebraic[10]*(1.0-states[3])-algebraic[11]*states[3] def compute_variables(voi, states, rates, constants, computed_constants, algebraic): - algebraic[1] = constants[4]*(states[0]-constants[5]) - algebraic[6] = pow(states[1], 3.0)*states[2]*constants[7] - algebraic[0] = (algebraic[6]+0.14)*(states[0]-constants[8]) - algebraic[9] = 0.1*(-states[0]-48.0)/(exp((-states[0]-48.0)/15.0)-1.0) - algebraic[10] = 0.12*(states[0]+8.0)/(exp((states[0]+8.0)/5.0)-1.0) - algebraic[11] = 0.17*exp((-states[0]-90.0)/20.0) - algebraic[12] = 1.0/(1.0+exp((-states[0]-42.0)/10.0)) - algebraic[13] = 1.2*exp((-states[0]-90.0)/50.0)+0.015*exp((states[0]+90.0)/60.0) - algebraic[14] = 1.2*pow(states[3], 4.0) - algebraic[2] = (algebraic[13]+algebraic[14])*(states[0]+100.0) - algebraic[15] = 0.0001*(-states[0]-50.0)/(exp((-states[0]-50.0)/10.0)-1.0) - algebraic[16] = 0.002*exp((-states[0]-90.0)/80.0) + algebraic[1] = constants[1]*(states[0]-constants[2]) + algebraic[3] = pow(states[1], 3.0)*states[2]*constants[3] + algebraic[0] = (algebraic[3]+0.14)*(states[0]-constants[4]) + algebraic[4] = 0.1*(-states[0]-48.0)/(exp((-states[0]-48.0)/15.0)-1.0) + algebraic[5] = 0.12*(states[0]+8.0)/(exp((states[0]+8.0)/5.0)-1.0) + algebraic[6] = 0.17*exp((-states[0]-90.0)/20.0) + algebraic[7] = 1.0/(1.0+exp((-states[0]-42.0)/10.0)) + algebraic[8] = 1.2*exp((-states[0]-90.0)/50.0)+0.015*exp((states[0]+90.0)/60.0) + algebraic[9] = 1.2*pow(states[3], 4.0) + algebraic[2] = (algebraic[8]+algebraic[9])*(states[0]+100.0) + algebraic[10] = 0.0001*(-states[0]-50.0)/(exp((-states[0]-50.0)/10.0)-1.0) + algebraic[11] = 0.002*exp((-states[0]-90.0)/80.0) diff --git a/tests/resources/generator/robertson_model_1966/model.dae.c b/tests/resources/generator/robertson_model_1966/model.dae.c index d25ae1df36..90bfcb5131 100644 --- a/tests/resources/generator/robertson_model_1966/model.dae.c +++ b/tests/resources/generator/robertson_model_1966/model.dae.c @@ -72,9 +72,9 @@ void objectiveFunction0(double *u, double *f, void *data) double *rates = ((RootFindingInfo *) data)->rates; double *variables = ((RootFindingInfo *) data)->variables; - algebraic[2] = u[0]; + algebraic[0] = u[0]; - f[0] = 1.0-(states[0]+states[1]+algebraic[2]); + f[0] = 1.0-(states[0]+states[1]+algebraic[0]); } void findRoot0(double voi, double *states, double *rates, double *variables) @@ -82,19 +82,19 @@ void findRoot0(double voi, double *states, double *rates, double *variables) RootFindingInfo rfi = { voi, states, rates, variables }; double u[1]; - u[0] = algebraic[2]; + u[0] = algebraic[0]; nlaSolve(objectiveFunction0, u, 1, &rfi); - algebraic[2] = u[0]; + algebraic[0] = u[0]; } void initialiseVariables(double *states, double *rates, double *constants) { constants[0] = 0.04; constants[1] = 1.0e4; - algebraic[2] = 0.0; - constants[3] = 3.0e7; + algebraic[0] = 0.0; + constants[2] = 3.0e7; states[0] = 1.0; states[1] = 0.0; } @@ -106,12 +106,12 @@ void computeComputedConstants(double *constants, double *computedConstants) void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { findRoot0(voi, states, rates, variables); - rates[0] = -constants[0]*states[0]+constants[1]*states[1]*algebraic[2]; - rates[1] = constants[0]*states[0]-constants[3]*pow(states[1], 2.0)-constants[1]*states[1]*algebraic[2]; + rates[0] = -constants[0]*states[0]+constants[1]*states[1]*algebraic[0]; + rates[1] = constants[0]*states[0]-constants[2]*pow(states[1], 2.0)-constants[1]*states[1]*algebraic[0]; } void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { findRoot0(voi, states, rates, variables); - algebraic[4] = 10000.0*states[1]; + algebraic[1] = 10000.0*states[1]; } diff --git a/tests/resources/generator/robertson_model_1966/model.dae.py b/tests/resources/generator/robertson_model_1966/model.dae.py index a01a61531f..034f6a13c4 100644 --- a/tests/resources/generator/robertson_model_1966/model.dae.py +++ b/tests/resources/generator/robertson_model_1966/model.dae.py @@ -54,26 +54,26 @@ def objective_function_0(u, f, data): rates = data[2] variables = data[3] - algebraic[2] = u[0] + algebraic[0] = u[0] - f[0] = 1.0-(states[0]+states[1]+algebraic[2]) + f[0] = 1.0-(states[0]+states[1]+algebraic[0]) def find_root_0(voi, states, rates, variables): u = [nan]*1 - u[0] = algebraic[2] + u[0] = algebraic[0] u = nla_solve(objective_function_0, u, 1, [voi, states, rates, variables]) - algebraic[2] = u[0] + algebraic[0] = u[0] def initialise_variables(states, rates, constants): constants[0] = 0.04 constants[1] = 1.0e4 - algebraic[2] = 0.0 - constants[3] = 3.0e7 + algebraic[0] = 0.0 + constants[2] = 3.0e7 states[0] = 1.0 states[1] = 0.0 @@ -84,10 +84,10 @@ def compute_computed_constants(constants, computed_constants): def compute_rates(voi, states, rates, constants, computed_constants, algebraic): find_root_0(voi, states, rates, variables) - rates[0] = -constants[0]*states[0]+constants[1]*states[1]*algebraic[2] - rates[1] = constants[0]*states[0]-constants[3]*pow(states[1], 2.0)-constants[1]*states[1]*algebraic[2] + rates[0] = -constants[0]*states[0]+constants[1]*states[1]*algebraic[0] + rates[1] = constants[0]*states[0]-constants[2]*pow(states[1], 2.0)-constants[1]*states[1]*algebraic[0] def compute_variables(voi, states, rates, constants, computed_constants, algebraic): find_root_0(voi, states, rates, variables) - algebraic[4] = 10000.0*states[1] + algebraic[1] = 10000.0*states[1] diff --git a/tests/resources/generator/robertson_model_1966/model.ode.c b/tests/resources/generator/robertson_model_1966/model.ode.c index c513ea1bd3..51c94697bc 100644 --- a/tests/resources/generator/robertson_model_1966/model.ode.c +++ b/tests/resources/generator/robertson_model_1966/model.ode.c @@ -78,5 +78,5 @@ void computeRates(double voi, double *states, double *rates, double *constants, void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { - algebraic[3] = 10000.0*states[2]; + algebraic[0] = 10000.0*states[2]; } diff --git a/tests/resources/generator/robertson_model_1966/model.ode.py b/tests/resources/generator/robertson_model_1966/model.ode.py index 5724071fcd..f702e804d8 100644 --- a/tests/resources/generator/robertson_model_1966/model.ode.py +++ b/tests/resources/generator/robertson_model_1966/model.ode.py @@ -65,4 +65,4 @@ def compute_rates(voi, states, rates, constants, computed_constants, algebraic): def compute_variables(voi, states, rates, constants, computed_constants, algebraic): - algebraic[3] = 10000.0*states[2] + algebraic[0] = 10000.0*states[2] diff --git a/tests/resources/generator/sine_model_imports/model.c b/tests/resources/generator/sine_model_imports/model.c index 6dfb92f02b..0f52edcd58 100644 --- a/tests/resources/generator/sine_model_imports/model.c +++ b/tests/resources/generator/sine_model_imports/model.c @@ -61,14 +61,14 @@ void deleteArray(double *array) void initialiseVariables(double *states, double *rates, double *constants) { - constants[1] = 0.0; - constants[3] = 0.75; - computedConstants[4] = 2.0/3.14159265358979; - computedConstants[5] = 2.0*3.14159265358979; - computedConstants[6] = 3.14159265358979/2.0; - computedConstants[7] = 3.14159265358979; - computedConstants[8] = 3.0*3.14159265358979/2.0; - states[0] = constants[1]; + constants[0] = 0.0; + constants[1] = 0.75; + computedConstants[0] = 2.0/3.14159265358979; + computedConstants[1] = 2.0*3.14159265358979; + computedConstants[2] = 3.14159265358979/2.0; + computedConstants[3] = 3.14159265358979; + computedConstants[4] = 3.0*3.14159265358979/2.0; + states[0] = constants[0]; } void computeComputedConstants(double *constants, double *computedConstants) @@ -83,6 +83,6 @@ void computeRates(double voi, double *states, double *rates, double *constants, void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { algebraic[0] = sin(voi); - algebraic[9] = (voi < computedConstants[6])?voi*computedConstants[4]-0.5:(voi < computedConstants[7])?(3.14159265358979-voi)*computedConstants[4]-0.5:(voi < computedConstants[8])?(voi-3.14159265358979)*computedConstants[4]-0.5:(computedConstants[5]-voi)*computedConstants[4]-0.5; - algebraic[2] = (voi < computedConstants[6])?-algebraic[9]*algebraic[9]+constants[3]+algebraic[9]:(voi < computedConstants[7])?-algebraic[9]*algebraic[9]+constants[3]+algebraic[9]:(voi < computedConstants[8])?algebraic[9]*algebraic[9]-constants[3]-algebraic[9]:algebraic[9]*algebraic[9]-constants[3]-algebraic[9]; + algebraic[2] = (voi < computedConstants[2])?voi*computedConstants[0]-0.5:(voi < computedConstants[3])?(3.14159265358979-voi)*computedConstants[0]-0.5:(voi < computedConstants[4])?(voi-3.14159265358979)*computedConstants[0]-0.5:(computedConstants[1]-voi)*computedConstants[0]-0.5; + algebraic[1] = (voi < computedConstants[2])?-algebraic[2]*algebraic[2]+constants[1]+algebraic[2]:(voi < computedConstants[3])?-algebraic[2]*algebraic[2]+constants[1]+algebraic[2]:(voi < computedConstants[4])?algebraic[2]*algebraic[2]-constants[1]-algebraic[2]:algebraic[2]*algebraic[2]-constants[1]-algebraic[2]; } diff --git a/tests/resources/generator/sine_model_imports/model.py b/tests/resources/generator/sine_model_imports/model.py index 2c2c463977..065f85ab7c 100644 --- a/tests/resources/generator/sine_model_imports/model.py +++ b/tests/resources/generator/sine_model_imports/model.py @@ -54,14 +54,14 @@ def create_variables_array(): def initialise_variables(states, rates, constants): - constants[1] = 0.0 - constants[3] = 0.75 - computed_constants[4] = 2.0/3.14159265358979 - computed_constants[5] = 2.0*3.14159265358979 - computed_constants[6] = 3.14159265358979/2.0 - computed_constants[7] = 3.14159265358979 - computed_constants[8] = 3.0*3.14159265358979/2.0 - states[0] = constants[1] + constants[0] = 0.0 + constants[1] = 0.75 + computed_constants[0] = 2.0/3.14159265358979 + computed_constants[1] = 2.0*3.14159265358979 + computed_constants[2] = 3.14159265358979/2.0 + computed_constants[3] = 3.14159265358979 + computed_constants[4] = 3.0*3.14159265358979/2.0 + states[0] = constants[0] def compute_computed_constants(constants, computed_constants): @@ -74,5 +74,5 @@ def compute_rates(voi, states, rates, constants, computed_constants, algebraic): def compute_variables(voi, states, rates, constants, computed_constants, algebraic): algebraic[0] = sin(voi) - algebraic[9] = voi*computed_constants[4]-0.5 if lt_func(voi, computed_constants[6]) else (3.14159265358979-voi)*computed_constants[4]-0.5 if lt_func(voi, computed_constants[7]) else (voi-3.14159265358979)*computed_constants[4]-0.5 if lt_func(voi, computed_constants[8]) else (computed_constants[5]-voi)*computed_constants[4]-0.5 - algebraic[2] = -algebraic[9]*algebraic[9]+constants[3]+algebraic[9] if lt_func(voi, computed_constants[6]) else -algebraic[9]*algebraic[9]+constants[3]+algebraic[9] if lt_func(voi, computed_constants[7]) else algebraic[9]*algebraic[9]-constants[3]-algebraic[9] if lt_func(voi, computed_constants[8]) else algebraic[9]*algebraic[9]-constants[3]-algebraic[9] + algebraic[2] = voi*computed_constants[0]-0.5 if lt_func(voi, computed_constants[2]) else (3.14159265358979-voi)*computed_constants[0]-0.5 if lt_func(voi, computed_constants[3]) else (voi-3.14159265358979)*computed_constants[0]-0.5 if lt_func(voi, computed_constants[4]) else (computed_constants[1]-voi)*computed_constants[0]-0.5 + algebraic[1] = -algebraic[2]*algebraic[2]+constants[1]+algebraic[2] if lt_func(voi, computed_constants[2]) else -algebraic[2]*algebraic[2]+constants[1]+algebraic[2] if lt_func(voi, computed_constants[3]) else algebraic[2]*algebraic[2]-constants[1]-algebraic[2] if lt_func(voi, computed_constants[4]) else algebraic[2]*algebraic[2]-constants[1]-algebraic[2] diff --git a/tests/resources/generator/unknown_variable_as_external_variable/model.c b/tests/resources/generator/unknown_variable_as_external_variable/model.c index 8167206cd0..db7744dbb3 100644 --- a/tests/resources/generator/unknown_variable_as_external_variable/model.c +++ b/tests/resources/generator/unknown_variable_as_external_variable/model.c @@ -43,15 +43,15 @@ void deleteArray(double *array) void initialiseVariables(double *constants, ExternalVariable externalVariable) { - constants[1] = 1.1; - constants[2] = 21262500.0; - constants[3] = 150.0; - constants[4] = 3402000.0; - constants[5] = 2.0; - constants[6] = 2902500.0; - constants[7] = 810000.0; - constants[8] = 247140.0; - algebraic[9] = externalVariable(variables, 9); + constants[0] = 1.1; + constants[1] = 21262500.0; + constants[2] = 150.0; + constants[3] = 3402000.0; + constants[4] = 2.0; + constants[5] = 2902500.0; + constants[6] = 810000.0; + constants[7] = 247140.0; + algebraic[1] = externalVariable(variables, 1); } void computeComputedConstants(double *constants, double *computedConstants) @@ -60,6 +60,6 @@ void computeComputedConstants(double *constants, double *computedConstants) void computeVariables(double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) { - algebraic[9] = externalVariable(variables, 9); - algebraic[0] = constants[1]*(constants[2]*constants[3]-constants[4]*constants[5])/(constants[6]*constants[5]+algebraic[9]*constants[3]+constants[8]*constants[5]*constants[3]+constants[7]); + algebraic[1] = externalVariable(variables, 1); + algebraic[0] = constants[0]*(constants[1]*constants[2]-constants[3]*constants[4])/(constants[5]*constants[4]+algebraic[1]*constants[2]+constants[7]*constants[4]*constants[2]+constants[6]); } diff --git a/tests/resources/generator/unknown_variable_as_external_variable/model.py b/tests/resources/generator/unknown_variable_as_external_variable/model.py index 3c5f0470c2..f07ad2cca3 100644 --- a/tests/resources/generator/unknown_variable_as_external_variable/model.py +++ b/tests/resources/generator/unknown_variable_as_external_variable/model.py @@ -38,15 +38,15 @@ def create_variables_array(): def initialise_variables(constants, external_variable): - constants[1] = 1.1 - constants[2] = 21262500.0 - constants[3] = 150.0 - constants[4] = 3402000.0 - constants[5] = 2.0 - constants[6] = 2902500.0 - constants[7] = 810000.0 - constants[8] = 247140.0 - algebraic[9] = external_variable(variables, 9) + constants[0] = 1.1 + constants[1] = 21262500.0 + constants[2] = 150.0 + constants[3] = 3402000.0 + constants[4] = 2.0 + constants[5] = 2902500.0 + constants[6] = 810000.0 + constants[7] = 247140.0 + algebraic[1] = external_variable(variables, 1) def compute_computed_constants(constants, computed_constants): @@ -54,5 +54,5 @@ def compute_computed_constants(constants, computed_constants): def compute_variables(constants, computed_constants, algebraic, external_variable): - algebraic[9] = external_variable(variables, 9) - algebraic[0] = constants[1]*(constants[2]*constants[3]-constants[4]*constants[5])/(constants[6]*constants[5]+algebraic[9]*constants[3]+constants[8]*constants[5]*constants[3]+constants[7]) + algebraic[1] = external_variable(variables, 1) + algebraic[0] = constants[0]*(constants[1]*constants[2]-constants[3]*constants[4])/(constants[5]*constants[4]+algebraic[1]*constants[2]+constants[7]*constants[4]*constants[2]+constants[6]) From 09fcc1fb41e25663e46ab7ef60c4674a23e6c731 Mon Sep 17 00:00:00 2001 From: Alan Garny Date: Thu, 8 Aug 2024 13:23:05 +0200 Subject: [PATCH 12/85] Some minor cleaning up. --- src/generator.cpp | 48 +++++++++++++++++++++++------------------------ 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/src/generator.cpp b/src/generator.cpp index 5532344305..f6130eb74e 100644 --- a/src/generator.cpp +++ b/src/generator.cpp @@ -514,9 +514,8 @@ void Generator::GeneratorImpl::addImplementationVariableInfoCode() && !mProfile->algebraicVariableTypeString().empty() && !mProfile->externalVariableTypeString().empty()) { std::string infoElementsCode; - auto variables = libcellml::variables(mModel); - for (const auto &variable : variables) { + for (const auto &variable : variables(mModel)) { if (!infoElementsCode.empty()) { infoElementsCode += mProfile->arrayElementSeparatorString() + "\n"; } @@ -805,21 +804,20 @@ void Generator::GeneratorImpl::addNlaSystemsCode() std::string methodBody; auto i = MAX_SIZE_T; auto variables = libcellml::variables(equation); - auto variablesCount = variables.size(); - for (i = 0; i < variablesCount; ++i) { - auto arrayString = (variables[i]->type() == AnalyserVariable::Type::STATE) ? + for (const auto &variable : variables) { + auto arrayString = (variable->type() == AnalyserVariable::Type::STATE) ? mProfile->ratesArrayString() : - (variables[i]->type() == AnalyserVariable::Type::CONSTANT) ? + (variable->type() == AnalyserVariable::Type::CONSTANT) ? mProfile->constantsArrayString() : - (variables[i]->type() == AnalyserVariable::Type::COMPUTED_CONSTANT) ? + (variable->type() == AnalyserVariable::Type::COMPUTED_CONSTANT) ? mProfile->computedConstantsArrayString() : mProfile->algebraicArrayString(); methodBody += mProfile->indentString() - + arrayString + mProfile->openArrayString() + convertToString(variables[i]->index()) + mProfile->closeArrayString() + + arrayString + mProfile->openArrayString() + convertToString(variable->index()) + mProfile->closeArrayString() + mProfile->equalityString() - + mProfile->uArrayString() + mProfile->openArrayString() + convertToString(i) + mProfile->closeArrayString() + + mProfile->uArrayString() + mProfile->openArrayString() + convertToString(++i) + mProfile->closeArrayString() + mProfile->commandSeparatorString() + "\n"; } @@ -852,18 +850,22 @@ void Generator::GeneratorImpl::addNlaSystemsCode() methodBody = {}; - for (i = 0; i < variablesCount; ++i) { - auto arrayString = (variables[i]->type() == AnalyserVariable::Type::STATE) ? + i = MAX_SIZE_T; + + for (const auto &variable : variables) { + auto arrayString = (variable->type() == AnalyserVariable::Type::STATE) ? mProfile->ratesArrayString() : mProfile->algebraicArrayString(); methodBody += mProfile->indentString() - + mProfile->uArrayString() + mProfile->openArrayString() + convertToString(i) + mProfile->closeArrayString() + + mProfile->uArrayString() + mProfile->openArrayString() + convertToString(++i) + mProfile->closeArrayString() + mProfile->equalityString() - + arrayString + mProfile->openArrayString() + convertToString(variables[i]->index()) + mProfile->closeArrayString() + + arrayString + mProfile->openArrayString() + convertToString(variable->index()) + mProfile->closeArrayString() + mProfile->commandSeparatorString() + "\n"; } + auto variablesCount = variables.size(); + methodBody += newLineIfNeeded() + mProfile->indentString() + replace(replace(mProfile->nlaSolveCallString(modelHasOdes()), @@ -872,15 +874,17 @@ void Generator::GeneratorImpl::addNlaSystemsCode() methodBody += newLineIfNeeded(); - for (i = 0; i < variablesCount; ++i) { - auto arrayString = (variables[i]->type() == AnalyserVariable::Type::STATE) ? + i = MAX_SIZE_T; + + for (const auto &variable : variables) { + auto arrayString = (variable->type() == AnalyserVariable::Type::STATE) ? mProfile->ratesArrayString() : mProfile->algebraicArrayString(); methodBody += mProfile->indentString() - + arrayString + mProfile->openArrayString() + convertToString(variables[i]->index()) + mProfile->closeArrayString() + + arrayString + mProfile->openArrayString() + convertToString(variable->index()) + mProfile->closeArrayString() + mProfile->equalityString() - + mProfile->uArrayString() + mProfile->openArrayString() + convertToString(i) + mProfile->closeArrayString() + + mProfile->uArrayString() + mProfile->openArrayString() + convertToString(++i) + mProfile->closeArrayString() + mProfile->commandSeparatorString() + "\n"; } @@ -1772,11 +1776,9 @@ std::string Generator::GeneratorImpl::generateEquationCode(const AnalyserEquatio // Generate the equation code itself, based on the equation type. - auto variables = libcellml::variables(equation); - switch (equation->type()) { case AnalyserEquation::Type::EXTERNAL: - for (const auto &variable : variables) { + for (const auto &variable : variables(equation)) { res += mProfile->indentString() + generateVariableNameCode(variable->variable()) + mProfile->equalityString() @@ -1864,9 +1866,8 @@ void Generator::GeneratorImpl::addImplementationInitialiseVariablesMethodCode(st // such an NLA system has only one solution. std::string methodBody; - auto variables = libcellml::variables(mModel); - for (const auto &variable : variables) { + for (const auto &variable : variables(mModel)) { switch (variable->type()) { case AnalyserVariable::Type::CONSTANT: methodBody += generateInitialisationCode(variable); @@ -1963,11 +1964,10 @@ void Generator::GeneratorImpl::addImplementationComputeRatesMethodCode(std::vect // or RHS of the equation. auto variables = libcellml::variables(equation); - auto variablesCount = variables.size(); if ((equation->type() == AnalyserEquation::Type::ODE) || ((equation->type() == AnalyserEquation::Type::NLA) - && (variablesCount == 1) + && (variables.size() == 1) && (variables[0]->type() == AnalyserVariable::Type::STATE))) { methodBody += generateEquationCode(equation, remainingEquations); } From a7c7774d1e256a71ded87c495adb1034602bd7d8 Mon Sep 17 00:00:00 2001 From: Alan Garny Date: Thu, 8 Aug 2024 14:27:24 +0200 Subject: [PATCH 13/85] Generator: added an external array. --- src/analyser.cpp | 3 +- src/analyserequation.cpp | 29 ++++++++++- src/analyserequation_p.h | 4 +- src/analysermodel.cpp | 27 +++++++++++ src/analysermodel_p.h | 1 + src/api/libcellml/analyserequation.h | 29 +++++++++++ src/api/libcellml/analysermodel.h | 30 ++++++++++++ src/api/libcellml/generatorprofile.h | 48 +++++++++++++++++++ src/bindings/interface/analyserequation.i | 9 ++++ src/bindings/interface/analysermodel.i | 9 ++++ src/bindings/interface/generatorprofile.i | 13 +++++ src/bindings/javascript/analyserequation.cpp | 3 ++ src/bindings/javascript/analysermodel.cpp | 3 ++ src/bindings/javascript/generatorprofile.cpp | 4 ++ src/generator.cpp | 8 ++++ src/generatorprofile.cpp | 29 +++++++++++ src/generatorprofilesha1values.h | 4 +- src/generatorprofiletools.cpp | 3 ++ .../javascript/analyserequation.test.js | 9 ++++ .../javascript/generatorprofile.test.js | 12 +++++ tests/bindings/python/test_analyser.py | 3 ++ .../bindings/python/test_generator_profile.py | 18 +++++++ tests/coverage/coverage.cpp | 20 ++++++++ tests/generator/generatorprofile.cpp | 9 ++++ tests/resources/coverage/generator/model.c | 1 + tests/resources/coverage/generator/model.h | 1 + .../generator/model.modified.profile.c | 1 + .../generator/model.modified.profile.h | 1 + .../generator/model.modified.profile.py | 1 + tests/resources/coverage/generator/model.py | 1 + .../algebraic_eqn_computed_var_on_rhs/model.c | 1 + .../model.external.c | 1 + .../model.external.h | 1 + .../model.external.py | 1 + .../algebraic_eqn_computed_var_on_rhs/model.h | 1 + .../model.py | 1 + .../algebraic_eqn_const_var_on_rhs/model.c | 1 + .../algebraic_eqn_const_var_on_rhs/model.h | 1 + .../algebraic_eqn_const_var_on_rhs/model.py | 1 + .../algebraic_eqn_constant_on_rhs/model.c | 1 + .../algebraic_eqn_constant_on_rhs/model.h | 1 + .../algebraic_eqn_constant_on_rhs/model.py | 1 + .../algebraic_eqn_derivative_on_rhs/model.c | 1 + .../algebraic_eqn_derivative_on_rhs/model.h | 1 + .../algebraic_eqn_derivative_on_rhs/model.py | 1 + .../model.c | 1 + .../model.h | 1 + .../model.py | 1 + .../algebraic_eqn_state_var_on_rhs/model.c | 1 + .../algebraic_eqn_state_var_on_rhs/model.h | 1 + .../algebraic_eqn_state_var_on_rhs/model.py | 1 + .../model.c | 1 + .../model.h | 1 + .../model.py | 1 + .../model.c | 1 + .../model.external.c | 1 + .../model.external.h | 1 + .../model.external.py | 1 + .../model.h | 1 + .../model.py | 1 + .../model.c | 1 + .../model.h | 1 + .../model.py | 1 + .../model.three.externals.c | 1 + .../model.three.externals.h | 1 + .../model.three.externals.py | 1 + .../model.not.ordered.c | 1 + .../model.not.ordered.h | 1 + .../model.not.ordered.py | 1 + .../model.ordered.c | 1 + .../model.ordered.h | 1 + .../model.ordered.py | 1 + .../algebraic_unknown_var_on_rhs/model.c | 1 + .../algebraic_unknown_var_on_rhs/model.h | 1 + .../algebraic_unknown_var_on_rhs/model.py | 1 + .../generator/cell_geometry_model/model.c | 1 + .../cell_geometry_model/model.external.c | 1 + .../cell_geometry_model/model.external.h | 1 + .../cell_geometry_model/model.external.py | 1 + .../generator/cell_geometry_model/model.h | 1 + .../generator/cell_geometry_model/model.py | 1 + .../model.c | 1 + .../model.h | 1 + .../model.py | 1 + .../generator/cellml_slc_example/model.py | 1 + .../model.c | 1 + .../model.h | 1 + .../model.py | 1 + .../cellml_unit_scaling_constant/model.c | 1 + .../cellml_unit_scaling_constant/model.h | 1 + .../cellml_unit_scaling_constant/model.py | 1 + .../cellml_unit_scaling_rate/model.c | 1 + .../cellml_unit_scaling_rate/model.h | 1 + .../cellml_unit_scaling_rate/model.py | 1 + .../cellml_unit_scaling_state/model.c | 1 + .../cellml_unit_scaling_state/model.h | 1 + .../cellml_unit_scaling_state/model.py | 1 + .../model.c | 1 + .../model.h | 1 + .../model.py | 1 + .../model.c | 1 + .../model.h | 1 + .../model.py | 1 + .../cellml_unit_scaling_voi_direct/model.c | 1 + .../cellml_unit_scaling_voi_direct/model.h | 1 + .../cellml_unit_scaling_voi_direct/model.py | 1 + .../cellml_unit_scaling_voi_indirect/model.c | 1 + .../cellml_unit_scaling_voi_indirect/model.h | 1 + .../cellml_unit_scaling_voi_indirect/model.py | 1 + .../generator/dae_cellml_1_1_model/model.c | 1 + .../generator/dae_cellml_1_1_model/model.h | 1 + .../generator/dae_cellml_1_1_model/model.py | 1 + .../generator/dependent_eqns/model.c | 1 + .../generator/dependent_eqns/model.h | 1 + .../generator/dependent_eqns/model.py | 1 + .../model.c | 1 + .../model.h | 1 + .../model.py | 1 + .../model.c | 1 + .../model.h | 1 + .../model.py | 1 + .../model.algebraic.c | 1 + .../model.algebraic.h | 1 + .../model.algebraic.py | 1 + .../model.c | 1 + .../model.computed.constant.c | 1 + .../model.computed.constant.h | 1 + .../model.computed.constant.py | 1 + .../model.constant.c | 1 + .../model.constant.h | 1 + .../model.constant.py | 1 + .../model.dae.c | 1 + .../model.dae.h | 1 + .../model.dae.py | 1 + .../model.dependent.algebraic.c | 1 + .../model.dependent.algebraic.h | 1 + .../model.dependent.algebraic.py | 1 + .../model.dependent.computed.constant.c | 1 + .../model.dependent.computed.constant.h | 1 + .../model.dependent.computed.constant.py | 1 + .../model.dependent.constant.c | 1 + .../model.dependent.constant.h | 1 + .../model.dependent.constant.py | 1 + .../model.dependent.state.c | 1 + .../model.dependent.state.h | 1 + .../model.dependent.state.py | 1 + .../model.external.c | 1 + .../model.external.h | 1 + .../model.external.py | 1 + .../model.h | 1 + .../model.py | 1 + .../model.state.c | 1 + .../model.state.h | 1 + .../model.state.py | 1 + .../generator/noble_model_1962/model.c | 1 + .../generator/noble_model_1962/model.h | 1 + .../generator/noble_model_1962/model.py | 1 + .../generator/ode_computed_var_on_rhs/model.c | 1 + .../generator/ode_computed_var_on_rhs/model.h | 1 + .../ode_computed_var_on_rhs/model.py | 1 + .../model.c | 1 + .../model.h | 1 + .../model.py | 1 + .../generator/ode_const_var_on_rhs/model.c | 1 + .../generator/ode_const_var_on_rhs/model.h | 1 + .../generator/ode_const_var_on_rhs/model.py | 1 + .../model.c | 1 + .../model.h | 1 + .../model.py | 1 + .../generator/ode_constant_on_rhs/model.c | 1 + .../generator/ode_constant_on_rhs/model.h | 1 + .../generator/ode_constant_on_rhs/model.py | 1 + .../ode_constant_on_rhs_one_component/model.c | 1 + .../ode_constant_on_rhs_one_component/model.h | 1 + .../model.py | 1 + .../ode_multiple_dependent_odes/model.c | 1 + .../ode_multiple_dependent_odes/model.h | 1 + .../ode_multiple_dependent_odes/model.py | 1 + .../model.c | 1 + .../model.h | 1 + .../model.py | 1 + .../ode_multiple_odes_with_same_name/model.c | 1 + .../ode_multiple_odes_with_same_name/model.h | 1 + .../ode_multiple_odes_with_same_name/model.py | 1 + .../generator/ode_unknown_var_on_rhs/model.c | 1 + .../generator/ode_unknown_var_on_rhs/model.h | 1 + .../generator/ode_unknown_var_on_rhs/model.py | 1 + .../robertson_model_1966/model.dae.c | 1 + .../robertson_model_1966/model.dae.h | 1 + .../robertson_model_1966/model.dae.py | 1 + .../robertson_model_1966/model.ode.c | 1 + .../robertson_model_1966/model.ode.h | 1 + .../robertson_model_1966/model.ode.py | 1 + .../generator/sine_model_imports/model.c | 1 + .../generator/sine_model_imports/model.h | 1 + .../generator/sine_model_imports/model.py | 1 + .../model.c | 1 + .../model.h | 1 + .../model.py | 1 + .../model.c | 1 + .../model.h | 1 + .../model.py | 1 + 202 files changed, 500 insertions(+), 5 deletions(-) diff --git a/src/analyser.cpp b/src/analyser.cpp index d9a48da5da..3f52be0ef7 100644 --- a/src/analyser.cpp +++ b/src/analyser.cpp @@ -3281,7 +3281,8 @@ void Analyser::AnalyserImpl::analyseModel(const ModelPtr &model) internalEquation->mNlaSystemIndex, equationNlaSiblings, {}, - algebraic); + algebraic, + {}); mModel->mPimpl->mEquations.push_back(equation); } diff --git a/src/analyserequation.cpp b/src/analyserequation.cpp index 7869e910d1..b124f0e6ce 100644 --- a/src/analyserequation.cpp +++ b/src/analyserequation.cpp @@ -34,7 +34,8 @@ void AnalyserEquation::AnalyserEquationImpl::populate(AnalyserEquation::Type typ size_t nlaSystemIndex, const std::vector &nlaSiblings, const std::vector &computedConstants, - const std::vector &algebraic) + const std::vector &algebraic, + const std::vector &externals) { mType = type; mAst = ast; @@ -44,6 +45,7 @@ void AnalyserEquation::AnalyserEquationImpl::populate(AnalyserEquation::Type typ std::copy(nlaSiblings.begin(), nlaSiblings.end(), back_inserter(mNlaSiblings)); std::copy(computedConstants.begin(), computedConstants.end(), back_inserter(mComputedConstants)); std::copy(algebraic.begin(), algebraic.end(), back_inserter(mAlgebraic)); + std::copy(externals.begin(), externals.end(), back_inserter(mExternals)); } bool AnalyserEquation::AnalyserEquationImpl::isEmptyDependency(const AnalyserEquationWeakPtr &dependency) @@ -60,6 +62,12 @@ bool AnalyserEquation::AnalyserEquationImpl::isEmptyDependency(const AnalyserEqu return false; } + auto externals = dependency.lock()->externals(); + + if (std::any_of(externals.begin(), externals.end(), [](const auto &v) { return v != nullptr; })) { + return false; + } + return true; } @@ -199,4 +207,23 @@ AnalyserVariablePtr AnalyserEquation::algebraic(size_t index) const return mPimpl->mAlgebraic[index]; } +size_t AnalyserEquation::externalCount() const +{ + return mPimpl->mExternals.size(); +} + +std::vector AnalyserEquation::externals() const +{ + return mPimpl->mExternals; +} + +AnalyserVariablePtr AnalyserEquation::external(size_t index) const +{ + if (index >= mPimpl->mExternals.size()) { + return {}; + } + + return mPimpl->mExternals[index]; +} + } // namespace libcellml diff --git a/src/analyserequation_p.h b/src/analyserequation_p.h index ae3e576afb..75c2aed94b 100644 --- a/src/analyserequation_p.h +++ b/src/analyserequation_p.h @@ -37,6 +37,7 @@ struct AnalyserEquation::AnalyserEquationImpl bool mIsStateRateBased = false; std::vector mComputedConstants; std::vector mAlgebraic; + std::vector mExternals; static AnalyserEquationPtr create(); @@ -46,7 +47,8 @@ struct AnalyserEquation::AnalyserEquationImpl size_t nlaSystemIndex, const std::vector &nlaSiblings, const std::vector &computedConstants, - const std::vector &algebraic); + const std::vector &algebraic, + const std::vector &externals); static bool isEmptyDependency(const AnalyserEquationWeakPtr &dependency); diff --git a/src/analysermodel.cpp b/src/analysermodel.cpp index 459b4795b1..9b783f1648 100644 --- a/src/analysermodel.cpp +++ b/src/analysermodel.cpp @@ -202,6 +202,33 @@ AnalyserVariablePtr AnalyserModel::algebraic(size_t index) const return mPimpl->mAlgebraic[index]; } +size_t AnalyserModel::externalCount() const +{ + if (!isValid()) { + return 0; + } + + return mPimpl->mExternals.size(); +} + +std::vector AnalyserModel::externals() const +{ + if (!isValid()) { + return {}; + } + + return mPimpl->mExternals; +} + +AnalyserVariablePtr AnalyserModel::external(size_t index) const +{ + if (!isValid() || (index >= mPimpl->mExternals.size())) { + return {}; + } + + return mPimpl->mExternals[index]; +} + size_t AnalyserModel::equationCount() const { if (!isValid()) { diff --git a/src/analysermodel_p.h b/src/analysermodel_p.h index ae7d9709c8..7480584fba 100644 --- a/src/analysermodel_p.h +++ b/src/analysermodel_p.h @@ -38,6 +38,7 @@ struct AnalyserModel::AnalyserModelImpl std::vector mConstants; std::vector mComputedConstants; std::vector mAlgebraic; + std::vector mExternals; std::vector mEquations; bool mNeedEqFunction = false; diff --git a/src/api/libcellml/analyserequation.h b/src/api/libcellml/analyserequation.h index b2ca20ca01..22d7d50674 100644 --- a/src/api/libcellml/analyserequation.h +++ b/src/api/libcellml/analyserequation.h @@ -223,6 +223,35 @@ class LIBCELLML_EXPORT AnalyserEquation */ AnalyserVariablePtr algebraic(size_t index) const; + /** + * @brief Get the number of external variables computed by this @ref AnalyserEquation. + * + * Return the number of external variables computed by this @ref AnalyserEquation. + * + * @return The number of external variables. + */ + size_t externalCount() const; + + /** + * @brief Get the external variables computed by this @ref AnalyserEquation. + * + * Return the external variables computed by this @ref AnalyserEquation. + * + * @return The external variables as a @c std::vector. + */ + std::vector externals() const; + + /** + * @brief Get the external variable, at @p index, computed by this @ref AnalyserEquation. + * + * Return the external variable, at @p index, computed by this @ref AnalyserEquation. + * + * @param index The index of the external variable to return. + * + * @return The external variable, at @p index, on success, @c nullptr on failure. + */ + AnalyserVariablePtr external(size_t index) const; + private: AnalyserEquation(); /**< Constructor, @private. */ diff --git a/src/api/libcellml/analysermodel.h b/src/api/libcellml/analysermodel.h index d8e075bd78..f5d745d150 100644 --- a/src/api/libcellml/analysermodel.h +++ b/src/api/libcellml/analysermodel.h @@ -231,6 +231,36 @@ class LIBCELLML_EXPORT AnalyserModel */ AnalyserVariablePtr algebraic(size_t index) const; + /** + * @brief Get the number of external variables. + * + * Return the number of external variables in the @ref AnalyserModel. + * + * @return The number of external variables. + */ + size_t externalCount() const; + + /** + * @brief Get the external variables. + * + * Return the external variables in the @ref AnalyserModel. + * + * @return The external variables as a @c std::vector. + */ + std::vector externals() const; + + /** + * @brief Get the external variable at @p index. + * + * Return the external variable at the index @p index for the @ref AnalyserModel. + * + * @param index The index of the external variable to return. + * + * @return The external variable at the given @p index on success, @c nullptr on + * failure. + */ + AnalyserVariablePtr external(size_t index) const; + /** * @brief Get the number of equations. * diff --git a/src/api/libcellml/generatorprofile.h b/src/api/libcellml/generatorprofile.h index cbbb42f1a2..4cefa11f2d 100644 --- a/src/api/libcellml/generatorprofile.h +++ b/src/api/libcellml/generatorprofile.h @@ -2605,6 +2605,54 @@ class LIBCELLML_EXPORT GeneratorProfile */ void setImplementationAlgebraicCountString(const std::string &implementationAlgebraicCountString); + /** + * @brief Get the @c std::string for the interface of the external count + * constant. + * + * Return the @c std::string for the interface of the external count + * constant. + * + * @return The @c std::string for the interface of the external count + * constant. + */ + std::string interfaceExternalCountString() const; + + /** + * @brief Set the @c std::string for the interface of the external count + * constant. + * + * Set the @c std::string for the interface of the external count constant. + * + * @param interfaceExternalCountString The @c std::string to use for the + * interface of the external count constant. + */ + void setInterfaceExternalCountString(const std::string &interfaceExternalCountString); + + /** + * @brief Get the @c std::string for the implementation of the external + * count constant. + * + * Return the @c std::string for the implementation of the external count + * constant. + * + * @return The @c std::string for the implementation of the external count + * constant. + */ + std::string implementationExternalCountString() const; + + /** + * @brief Set the @c std::string for the implementation of the external + * count constant. + * + * Set the @c std::string for the implementation of the external count + * constant. To be useful, the string should contain the [EXTERNAL_COUNT] + * tag, which will be replaced with the number of states in the model. + * + * @param implementationExternalCountString The @c std::string to use for + * the implementation of the external count constant. + */ + void setImplementationExternalCountString(const std::string &implementationExternalCountString); + /** * @brief Get the @c std::string for the data structure for the variable * type object. diff --git a/src/bindings/interface/analyserequation.i b/src/bindings/interface/analyserequation.i index 8cdce8a0d8..8749557bb4 100644 --- a/src/bindings/interface/analyserequation.i +++ b/src/bindings/interface/analyserequation.i @@ -61,6 +61,15 @@ %feature("docstring") libcellml::AnalyserEquation::algebraic "Returns the algebraic variable, at the given index, computed by this :class:`AnalyserEquation` object."; +%feature("docstring") libcellml::AnalyserEquation::externalCount +"Returns the number of external variables computed by this :class:`AnalyserEquation` object."; + +%feature("docstring") libcellml::AnalyserEquation::externals +"Returns the external variables computed by this :class:`AnalyserEquation` object."; + +%feature("docstring") libcellml::AnalyserEquation::external +"Returns the external variable, at the given index, computed by this :class:`AnalyserEquation` object."; + %{ #include "libcellml/analyserequation.h" %} diff --git a/src/bindings/interface/analysermodel.i b/src/bindings/interface/analysermodel.i index 8933692ddd..692a9d789a 100644 --- a/src/bindings/interface/analysermodel.i +++ b/src/bindings/interface/analysermodel.i @@ -61,6 +61,15 @@ %feature("docstring") libcellml::AnalyserModel::algebraic "Returns the algebraic variable, specified by index, contained by this :class:`AnalyserModel` object."; +%feature("docstring") libcellml::AnalyserModel::externalCount +"Returns the number of external variables contained by this :class:`AnalyserModel` object."; + +%feature("docstring") libcellml::AnalyserModel::externals +"Returns the external variables contained by this :class:`AnalyserModel` object."; + +%feature("docstring") libcellml::AnalyserModel::external +"Returns the external variable, specified by index, contained by this :class:`AnalyserModel` object."; + %feature("docstring") libcellml::AnalyserModel::equationCount "Returns the number of equations contained by this :class:`AnalyserModel` object."; diff --git a/src/bindings/interface/generatorprofile.i b/src/bindings/interface/generatorprofile.i index 8c694e9f5f..51e227c134 100644 --- a/src/bindings/interface/generatorprofile.i +++ b/src/bindings/interface/generatorprofile.i @@ -716,6 +716,19 @@ the tag, which will be replaced with the number of sta "Sets the string for the implementation of the algebraic count constant. To be useful, the string should contain the tag, which will be replaced with the number of states in the model."; +%feature("docstring") libcellml::GeneratorProfile::interfaceExternalCountString +"Returns the string for the interface of the external count constant."; + +%feature("docstring") libcellml::GeneratorProfile::setInterfaceExternalCountString +"Sets the string for the interface of the external count constant."; + +%feature("docstring") libcellml::GeneratorProfile::implementationExternalCountString +"Returns the string for the implementation of the external count constant."; + +%feature("docstring") libcellml::GeneratorProfile::setImplementationExternalCountString +"Sets the string for the implementation of the external count constant. To be useful, the string should contain +the tag, which will be replaced with the number of states in the model."; + %feature("docstring") libcellml::GeneratorProfile::variableTypeObjectString "Returns the string for the data structure for the variable type object."; diff --git a/src/bindings/javascript/analyserequation.cpp b/src/bindings/javascript/analyserequation.cpp index c7a9daf695..3b1bf0a464 100644 --- a/src/bindings/javascript/analyserequation.cpp +++ b/src/bindings/javascript/analyserequation.cpp @@ -51,6 +51,9 @@ EMSCRIPTEN_BINDINGS(libcellml_analyserequation) .function("algebraicCount", &libcellml::AnalyserEquation::algebraicCount) .function("algebraicVariables", select_overload() const>(&libcellml::AnalyserEquation::algebraic)) .function("algebraicVariable", select_overload(&libcellml::AnalyserEquation::algebraic)) + .function("externalCount", &libcellml::AnalyserEquation::externalCount) + .function("externals", select_overload() const>(&libcellml::AnalyserEquation::externals)) + .function("external", select_overload(&libcellml::AnalyserEquation::external)) ; EM_ASM( diff --git a/src/bindings/javascript/analysermodel.cpp b/src/bindings/javascript/analysermodel.cpp index 3103e413a7..5182aa89bc 100644 --- a/src/bindings/javascript/analysermodel.cpp +++ b/src/bindings/javascript/analysermodel.cpp @@ -54,6 +54,9 @@ EMSCRIPTEN_BINDINGS(libcellml_analysermodel) .function("algebraicCount", &libcellml::AnalyserModel::algebraicCount) .function("algebraicVariables", select_overload() const>(&libcellml::AnalyserModel::algebraic)) .function("algebraicVariable", select_overload(&libcellml::AnalyserModel::algebraic)) + .function("externalCount", &libcellml::AnalyserModel::externalCount) + .function("externals", select_overload() const>(&libcellml::AnalyserModel::externals)) + .function("external", select_overload(&libcellml::AnalyserModel::external)) .function("equationCount", &libcellml::AnalyserModel::equationCount) .function("equations", &libcellml::AnalyserModel::equations) .function("equation", &libcellml::AnalyserModel::equation) diff --git a/src/bindings/javascript/generatorprofile.cpp b/src/bindings/javascript/generatorprofile.cpp index e9fc6b420b..8bb3e36c1a 100644 --- a/src/bindings/javascript/generatorprofile.cpp +++ b/src/bindings/javascript/generatorprofile.cpp @@ -263,6 +263,10 @@ EMSCRIPTEN_BINDINGS(libcellml_generatorprofile) .function("setInterfaceAlgebraicCountString", &libcellml::GeneratorProfile::setInterfaceAlgebraicCountString) .function("implementationAlgebraicCountString", &libcellml::GeneratorProfile::implementationAlgebraicCountString) .function("setImplementationAlgebraicCountString", &libcellml::GeneratorProfile::setImplementationAlgebraicCountString) + .function("interfaceExternalCountString", &libcellml::GeneratorProfile::interfaceExternalCountString) + .function("setInterfaceExternalCountString", &libcellml::GeneratorProfile::setInterfaceExternalCountString) + .function("implementationExternalCountString", &libcellml::GeneratorProfile::implementationExternalCountString) + .function("setImplementationExternalCountString", &libcellml::GeneratorProfile::setImplementationExternalCountString) .function("variableTypeObjectString", &libcellml::GeneratorProfile::variableTypeObjectString) .function("setVariableTypeObjectString", &libcellml::GeneratorProfile::setVariableTypeObjectString) .function("variableOfIntegrationVariableTypeString", &libcellml::GeneratorProfile::variableOfIntegrationVariableTypeString) diff --git a/src/generator.cpp b/src/generator.cpp index f6130eb74e..d715e45b19 100644 --- a/src/generator.cpp +++ b/src/generator.cpp @@ -357,6 +357,14 @@ void Generator::GeneratorImpl::addStateAndVariableCountCode(bool interface) "[ALGEBRAIC_COUNT]", std::to_string(mModel->algebraicCount())); } + if ((interface && !mProfile->interfaceExternalCountString().empty()) + || (!interface && !mProfile->implementationExternalCountString().empty())) { + code += interface ? + mProfile->interfaceExternalCountString() : + replace(mProfile->implementationExternalCountString(), + "[EXTERNAL_COUNT]", std::to_string(mModel->externalCount())); + } + if (!code.empty()) { mCode += "\n"; } diff --git a/src/generatorprofile.cpp b/src/generatorprofile.cpp index 67dd5160d9..ca8c24d907 100644 --- a/src/generatorprofile.cpp +++ b/src/generatorprofile.cpp @@ -193,6 +193,9 @@ struct GeneratorProfile::GeneratorProfileImpl std::string mInterfaceAlgebraicCountString; std::string mImplementationAlgebraicCountString; + std::string mInterfaceExternalCountString; + std::string mImplementationExternalCountString; + std::string mVariableTypeObjectFamWoevString; std::string mVariableTypeObjectFamWevString; std::string mVariableTypeObjectFdmWoevString; @@ -522,6 +525,9 @@ void GeneratorProfile::GeneratorProfileImpl::loadProfile(GeneratorProfile::Profi mInterfaceAlgebraicCountString = "extern const size_t ALGEBRAIC_COUNT;\n"; mImplementationAlgebraicCountString = "const size_t ALGEBRAIC_COUNT = [ALGEBRAIC_COUNT];\n"; + mInterfaceExternalCountString = "extern const size_t EXTERNAL_COUNT;\n"; + mImplementationExternalCountString = "const size_t EXTERNAL_COUNT = [EXTERNAL_COUNT];\n"; + mVariableTypeObjectFamWoevString = "typedef enum {\n" " CONSTANT,\n" " COMPUTED_CONSTANT,\n" @@ -959,6 +965,9 @@ void GeneratorProfile::GeneratorProfileImpl::loadProfile(GeneratorProfile::Profi mInterfaceAlgebraicCountString = ""; mImplementationAlgebraicCountString = "ALGEBRAIC_COUNT = [ALGEBRAIC_COUNT]\n"; + mInterfaceExternalCountString = ""; + mImplementationExternalCountString = "EXTERNAL_COUNT = [EXTERNAL_COUNT]\n"; + mVariableTypeObjectFamWoevString = "\n" "class VariableType(Enum):\n" " CONSTANT = 0\n" @@ -2334,6 +2343,26 @@ void GeneratorProfile::setImplementationAlgebraicCountString(const std::string & mPimpl->mImplementationAlgebraicCountString = implementationAlgebraicCountString; } +std::string GeneratorProfile::interfaceExternalCountString() const +{ + return mPimpl->mInterfaceExternalCountString; +} + +void GeneratorProfile::setInterfaceExternalCountString(const std::string &interfaceExternalCountString) +{ + mPimpl->mInterfaceExternalCountString = interfaceExternalCountString; +} + +std::string GeneratorProfile::implementationExternalCountString() const +{ + return mPimpl->mImplementationExternalCountString; +} + +void GeneratorProfile::setImplementationExternalCountString(const std::string &implementationExternalCountString) +{ + mPimpl->mImplementationExternalCountString = implementationExternalCountString; +} + std::string GeneratorProfile::variableTypeObjectString(bool forDifferentialModel, bool withExternalVariables) const { diff --git a/src/generatorprofilesha1values.h b/src/generatorprofilesha1values.h index 69f2ae4d93..17c92162ad 100644 --- a/src/generatorprofilesha1values.h +++ b/src/generatorprofilesha1values.h @@ -24,7 +24,7 @@ namespace libcellml { * The content of this file is generated, do not edit this file directly. * See docs/dev_utilities.rst for further information. */ -static const char C_GENERATOR_PROFILE_SHA1[] = "f36d3c679b030a09095376711d4dc9a638a5c7b3"; -static const char PYTHON_GENERATOR_PROFILE_SHA1[] = "bb03c147d17a9741667957068ef629058846d2e4"; +static const char C_GENERATOR_PROFILE_SHA1[] = "d81a3e718069fa9628dccbda291fb3cf017a4cee"; +static const char PYTHON_GENERATOR_PROFILE_SHA1[] = "b23d6ef4b54a76f94812b78da59c2bae319bdf8d"; } // namespace libcellml diff --git a/src/generatorprofiletools.cpp b/src/generatorprofiletools.cpp index 6293fd1201..3410a81023 100644 --- a/src/generatorprofiletools.cpp +++ b/src/generatorprofiletools.cpp @@ -451,6 +451,9 @@ std::string generatorProfileAsString(const GeneratorProfilePtr &generatorProfile profileContents += generatorProfile->interfaceAlgebraicCountString() + generatorProfile->implementationAlgebraicCountString(); + profileContents += generatorProfile->interfaceExternalCountString() + + generatorProfile->implementationExternalCountString(); + profileContents += generatorProfile->variableTypeObjectString(false, false); profileContents += generatorProfile->variableTypeObjectString(false, true); profileContents += generatorProfile->variableTypeObjectString(true, false); diff --git a/tests/bindings/javascript/analyserequation.test.js b/tests/bindings/javascript/analyserequation.test.js index 7619bdebdc..b16f7def05 100644 --- a/tests/bindings/javascript/analyserequation.test.js +++ b/tests/bindings/javascript/analyserequation.test.js @@ -88,6 +88,15 @@ describe("Analyser Equation tests", () => { test('Checking Analyser Equation algebraicVariable.', () => { expect(eqn.algebraicVariable(0).variable().name()).toBe("x") }); + test('Checking Analyser Equation externalCount.', () => { + expect(eqn.externalCount()).toBe(0) + }); + test('Checking Analyser Equation externals.', () => { + expect(eqn.externals().size()).toBe(0) + }); + test('Checking Analyser Equation external.', () => { + expect(eqn.external(0)).toBeNull() + }); test('Checking Analyser Equation AST.', () => { expect(eqn.ast().value()).toBe("") }); diff --git a/tests/bindings/javascript/generatorprofile.test.js b/tests/bindings/javascript/generatorprofile.test.js index 92fe3b5868..aa00a0e370 100644 --- a/tests/bindings/javascript/generatorprofile.test.js +++ b/tests/bindings/javascript/generatorprofile.test.js @@ -720,6 +720,18 @@ describe("GeneratorProfile tests", () => { x.setImplementationAlgebraicCountString("something") expect(x.implementationAlgebraicCountString()).toBe("something") }); + test("Checking GeneratorProfile.interfaceExternalCountString.", () => { + const x = new libcellml.GeneratorProfile(libcellml.GeneratorProfile.Profile.C) + + x.setInterfaceExternalCountString("something") + expect(x.interfaceExternalCountString()).toBe("something") + }); + test("Checking GeneratorProfile.implementationExternalCountString.", () => { + const x = new libcellml.GeneratorProfile(libcellml.GeneratorProfile.Profile.C) + + x.setImplementationExternalCountString("something") + expect(x.implementationExternalCountString()).toBe("something") + }); test("Checking GeneratorProfile.variableTypeObjectString.", () => { const x = new libcellml.GeneratorProfile(libcellml.GeneratorProfile.Profile.C) diff --git a/tests/bindings/python/test_analyser.py b/tests/bindings/python/test_analyser.py index ca3d36b0e6..856ea709d5 100644 --- a/tests/bindings/python/test_analyser.py +++ b/tests/bindings/python/test_analyser.py @@ -192,6 +192,9 @@ def test_coverage(self): self.assertEqual(1, ae.algebraicCount()) self.assertIsNotNone(ae.algebraic()) self.assertIsNotNone(ae.algebraic(0)) + self.assertEqual(0, ae.externalCount()) + self.assertIsNotNone(ae.externals()) + self.assertIsNone(ae.external(0)) # Check Analyser Equation type with invalid values. diff --git a/tests/bindings/python/test_generator_profile.py b/tests/bindings/python/test_generator_profile.py index aaa7e3271d..7b3cbddb1b 100644 --- a/tests/bindings/python/test_generator_profile.py +++ b/tests/bindings/python/test_generator_profile.py @@ -934,6 +934,15 @@ def test_implementation_algebraic_count_string(self): g.setImplementationAlgebraicCountString(GeneratorProfileTestCase.VALUE) self.assertEqual(GeneratorProfileTestCase.VALUE, g.implementationAlgebraicCountString()) + def test_implementation_external_count_string(self): + from libcellml import GeneratorProfile + + g = GeneratorProfile() + + self.assertEqual('const size_t EXTERNAL_COUNT = [EXTERNAL_COUNT];\n', g.implementationExternalCountString()) + g.setImplementationExternalCountString(GeneratorProfileTestCase.VALUE) + self.assertEqual(GeneratorProfileTestCase.VALUE, g.implementationExternalCountString()) + def test_implementation_variable_info_string(self): from libcellml import GeneratorProfile @@ -1160,6 +1169,15 @@ def test_interface_algebraic_count_string(self): g.setInterfaceAlgebraicCountString(GeneratorProfileTestCase.VALUE) self.assertEqual(GeneratorProfileTestCase.VALUE, g.interfaceAlgebraicCountString()) + def test_interface_external_count_string(self): + from libcellml import GeneratorProfile + + g = GeneratorProfile() + + self.assertEqual('extern const size_t EXTERNAL_COUNT;\n', g.interfaceExternalCountString()) + g.setInterfaceExternalCountString(GeneratorProfileTestCase.VALUE) + self.assertEqual(GeneratorProfileTestCase.VALUE, g.interfaceExternalCountString()) + def test_interface_variable_info_string(self): from libcellml import GeneratorProfile diff --git a/tests/coverage/coverage.cpp b/tests/coverage/coverage.cpp index ab5aac84b9..83ce6b317d 100644 --- a/tests/coverage/coverage.cpp +++ b/tests/coverage/coverage.cpp @@ -464,6 +464,10 @@ TEST(Coverage, analyser) EXPECT_EQ(size_t(0), analyserModel->algebraic().size()); EXPECT_EQ(nullptr, analyserModel->algebraic(0)); + EXPECT_EQ(size_t(0), analyserModel->externalCount()); + EXPECT_EQ(size_t(0), analyserModel->externals().size()); + EXPECT_EQ(nullptr, analyserModel->external(0)); + EXPECT_EQ(size_t(0), analyserModel->equationCount()); EXPECT_EQ(size_t(0), analyserModel->equations().size()); EXPECT_EQ(nullptr, analyserModel->equation(0)); @@ -610,6 +614,8 @@ TEST(Coverage, generator) EXPECT_EQ(nullptr, analyserModel->computedConstant(analyserModel->computedConstantCount())); EXPECT_NE(nullptr, analyserModel->algebraic(0)); EXPECT_EQ(nullptr, analyserModel->algebraic(analyserModel->algebraicCount())); + EXPECT_EQ(nullptr, analyserModel->external(0)); + EXPECT_EQ(nullptr, analyserModel->external(analyserModel->algebraicCount())); EXPECT_NE(nullptr, analyserModel->equation(199)); EXPECT_NE(size_t(0), analyserModel->equation(199)->dependencyCount()); EXPECT_NE(size_t(0), analyserModel->equation(199)->dependencies().size()); @@ -627,6 +633,10 @@ TEST(Coverage, generator) EXPECT_NE(size_t(0), analyserModel->equation(199)->algebraic().size()); EXPECT_NE(nullptr, analyserModel->equation(199)->algebraic(0)); EXPECT_EQ(nullptr, analyserModel->equation(199)->algebraic(analyserModel->equation(199)->algebraicCount())); + EXPECT_EQ(size_t(0), analyserModel->equation(199)->externalCount()); + EXPECT_EQ(size_t(0), analyserModel->equation(199)->externals().size()); + EXPECT_EQ(nullptr, analyserModel->equation(199)->external(0)); + EXPECT_EQ(nullptr, analyserModel->equation(199)->external(analyserModel->equation(199)->externalCount())); EXPECT_EQ(nullptr, analyserModel->equation(analyserModel->equationCount())); for (const auto &equation : analyserModel->equations()) { @@ -659,6 +669,12 @@ TEST(Coverage, generator) } } + for (size_t i = 0; i < analyserModel->externalCount(); ++i) { + if ((i == 1) || (i == 2) || (i == 6) || (i == 18) || (i == 179) || (i == 180) || (i == 182) || (i == 205) || (i == 206)) { + EXPECT_TRUE(analyserModel->external(i)->initialisingVariable() != nullptr); + } + } + EXPECT_EQ(nullptr, generator->model()); EXPECT_EQ(EMPTY_STRING, generator->interfaceCode()); EXPECT_EQ(EMPTY_STRING, generator->implementationCode()); @@ -716,6 +732,7 @@ TEST(Coverage, generator) profile->setImplementationConstantCountString(""); profile->setImplementationComputedConstantCountString(""); profile->setImplementationAlgebraicCountString(""); + profile->setImplementationExternalCountString(""); profile->setVariableTypeObjectString(false, false, ""); profile->setVariableTypeObjectString(false, true, ""); @@ -799,6 +816,9 @@ TEST(Coverage, generator) profile->setInterfaceAlgebraicCountString(""); profile->setImplementationAlgebraicCountString(""); + profile->setInterfaceExternalCountString(""); + profile->setImplementationExternalCountString(""); + profile->setVariableTypeObjectString(false, false, ""); profile->setVariableTypeObjectString(false, true, ""); profile->setVariableTypeObjectString(true, false, ""); diff --git a/tests/generator/generatorprofile.cpp b/tests/generator/generatorprofile.cpp index 539e28a063..a055f922bb 100644 --- a/tests/generator/generatorprofile.cpp +++ b/tests/generator/generatorprofile.cpp @@ -288,6 +288,9 @@ TEST(GeneratorProfile, defaultMiscellaneousValues) EXPECT_EQ("extern const size_t ALGEBRAIC_COUNT;\n", generatorProfile->interfaceAlgebraicCountString()); EXPECT_EQ("const size_t ALGEBRAIC_COUNT = [ALGEBRAIC_COUNT];\n", generatorProfile->implementationAlgebraicCountString()); + EXPECT_EQ("extern const size_t EXTERNAL_COUNT;\n", generatorProfile->interfaceExternalCountString()); + EXPECT_EQ("const size_t EXTERNAL_COUNT = [EXTERNAL_COUNT];\n", generatorProfile->implementationExternalCountString()); + EXPECT_EQ("typedef enum {\n" " CONSTANT,\n" " COMPUTED_CONSTANT,\n" @@ -882,6 +885,9 @@ TEST(GeneratorProfile, miscellaneous) generatorProfile->setInterfaceAlgebraicCountString(value); generatorProfile->setImplementationAlgebraicCountString(value); + generatorProfile->setInterfaceExternalCountString(value); + generatorProfile->setImplementationExternalCountString(value); + generatorProfile->setVariableTypeObjectString(false, false, value); generatorProfile->setVariableTypeObjectString(false, true, value); generatorProfile->setVariableTypeObjectString(true, false, value); @@ -1019,6 +1025,9 @@ TEST(GeneratorProfile, miscellaneous) EXPECT_EQ(value, generatorProfile->interfaceAlgebraicCountString()); EXPECT_EQ(value, generatorProfile->implementationAlgebraicCountString()); + EXPECT_EQ(value, generatorProfile->interfaceExternalCountString()); + EXPECT_EQ(value, generatorProfile->implementationExternalCountString()); + EXPECT_EQ(value, generatorProfile->variableTypeObjectString(false, false)); EXPECT_EQ(value, generatorProfile->variableTypeObjectString(false, true)); EXPECT_EQ(value, generatorProfile->variableTypeObjectString(true, false)); diff --git a/tests/resources/coverage/generator/model.c b/tests/resources/coverage/generator/model.c index 0918ab6d4c..c6142792ce 100644 --- a/tests/resources/coverage/generator/model.c +++ b/tests/resources/coverage/generator/model.c @@ -12,6 +12,7 @@ const size_t STATE_COUNT = 1; const size_t CONSTANT_COUNT = 0; const size_t COMPUTED_CONSTANT_COUNT = 0; const size_t ALGEBRAIC_COUNT = 209; +const size_t EXTERNAL_COUNT = 0; const VariableInfo VOI_INFO = {"t", "second", "my_component", VARIABLE_OF_INTEGRATION}; diff --git a/tests/resources/coverage/generator/model.h b/tests/resources/coverage/generator/model.h index e05872689b..c4835137aa 100644 --- a/tests/resources/coverage/generator/model.h +++ b/tests/resources/coverage/generator/model.h @@ -11,6 +11,7 @@ extern const size_t STATE_COUNT; extern const size_t CONSTANT_COUNT; extern const size_t COMPUTED_CONSTANT_COUNT; extern const size_t ALGEBRAIC_COUNT; +extern const size_t EXTERNAL_COUNT; typedef enum { VARIABLE_OF_INTEGRATION, diff --git a/tests/resources/coverage/generator/model.modified.profile.c b/tests/resources/coverage/generator/model.modified.profile.c index 986e598213..808684ff94 100644 --- a/tests/resources/coverage/generator/model.modified.profile.c +++ b/tests/resources/coverage/generator/model.modified.profile.c @@ -12,6 +12,7 @@ const size_t STATE_COUNT = 1; const size_t CONSTANT_COUNT = 0; const size_t COMPUTED_CONSTANT_COUNT = 0; const size_t ALGEBRAIC_COUNT = 209; +const size_t EXTERNAL_COUNT = 0; const VariableInfo VOI_INFO = {"t", "second", "my_component", VARIABLE_OF_INTEGRATION}; diff --git a/tests/resources/coverage/generator/model.modified.profile.h b/tests/resources/coverage/generator/model.modified.profile.h index ef3a093e68..08fc9fc5d1 100644 --- a/tests/resources/coverage/generator/model.modified.profile.h +++ b/tests/resources/coverage/generator/model.modified.profile.h @@ -11,6 +11,7 @@ extern const size_t STATE_COUNT; extern const size_t CONSTANT_COUNT; extern const size_t COMPUTED_CONSTANT_COUNT; extern const size_t ALGEBRAIC_COUNT; +extern const size_t EXTERNAL_COUNT; typedef enum { VARIABLE_OF_INTEGRATION, diff --git a/tests/resources/coverage/generator/model.modified.profile.py b/tests/resources/coverage/generator/model.modified.profile.py index 4f4499cf7e..67d01e5cf9 100644 --- a/tests/resources/coverage/generator/model.modified.profile.py +++ b/tests/resources/coverage/generator/model.modified.profile.py @@ -11,6 +11,7 @@ CONSTANT_COUNT = 0 COMPUTED_CONSTANT_COUNT = 0 ALGEBRAIC_COUNT = 209 +EXTERNAL_COUNT = 0 class VariableType(Enum): diff --git a/tests/resources/coverage/generator/model.py b/tests/resources/coverage/generator/model.py index b945c4eb06..ccf8c67060 100644 --- a/tests/resources/coverage/generator/model.py +++ b/tests/resources/coverage/generator/model.py @@ -11,6 +11,7 @@ CONSTANT_COUNT = 0 COMPUTED_CONSTANT_COUNT = 0 ALGEBRAIC_COUNT = 209 +EXTERNAL_COUNT = 0 class VariableType(Enum): diff --git a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.c b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.c index 8eee3cf3ad..7ad5b190a0 100644 --- a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.c +++ b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.c @@ -11,6 +11,7 @@ const char LIBCELLML_VERSION[] = "0.5.0"; const size_t CONSTANT_COUNT = 0; const size_t COMPUTED_CONSTANT_COUNT = 0; const size_t ALGEBRAIC_COUNT = 2; +const size_t EXTERNAL_COUNT = 0; const VariableInfo VARIABLE_INFO[] = { {"x", "dimensionless", "my_algebraic_eqn", COMPUTED_CONSTANT}, diff --git a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.c b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.c index e3f909a3fd..665df96680 100644 --- a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.c +++ b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.c @@ -11,6 +11,7 @@ const char LIBCELLML_VERSION[] = "0.5.0"; const size_t CONSTANT_COUNT = 0; const size_t COMPUTED_CONSTANT_COUNT = 0; const size_t ALGEBRAIC_COUNT = 2; +const size_t EXTERNAL_COUNT = 0; const VariableInfo VARIABLE_INFO[] = { {"x", "dimensionless", "my_algebraic_eqn", ALGEBRAIC}, diff --git a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.h b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.h index 8b56d9b9f6..9763338779 100644 --- a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.h +++ b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.h @@ -10,6 +10,7 @@ extern const char LIBCELLML_VERSION[]; extern const size_t CONSTANT_COUNT; extern const size_t COMPUTED_CONSTANT_COUNT; extern const size_t ALGEBRAIC_COUNT; +extern const size_t EXTERNAL_COUNT; typedef enum { CONSTANT, diff --git a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.py b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.py index 830a7dbcc4..1d135a8d6b 100644 --- a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.py +++ b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.py @@ -10,6 +10,7 @@ CONSTANT_COUNT = 0 COMPUTED_CONSTANT_COUNT = 0 ALGEBRAIC_COUNT = 2 +EXTERNAL_COUNT = 0 class VariableType(Enum): diff --git a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.h b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.h index 8b9a1fb666..ffa08d4179 100644 --- a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.h +++ b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.h @@ -10,6 +10,7 @@ extern const char LIBCELLML_VERSION[]; extern const size_t CONSTANT_COUNT; extern const size_t COMPUTED_CONSTANT_COUNT; extern const size_t ALGEBRAIC_COUNT; +extern const size_t EXTERNAL_COUNT; typedef enum { CONSTANT, diff --git a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.py b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.py index abbf71111a..a89a1f8728 100644 --- a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.py +++ b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.py @@ -10,6 +10,7 @@ CONSTANT_COUNT = 0 COMPUTED_CONSTANT_COUNT = 0 ALGEBRAIC_COUNT = 2 +EXTERNAL_COUNT = 0 class VariableType(Enum): diff --git a/tests/resources/generator/algebraic_eqn_const_var_on_rhs/model.c b/tests/resources/generator/algebraic_eqn_const_var_on_rhs/model.c index 332ca74062..a907301925 100644 --- a/tests/resources/generator/algebraic_eqn_const_var_on_rhs/model.c +++ b/tests/resources/generator/algebraic_eqn_const_var_on_rhs/model.c @@ -11,6 +11,7 @@ const char LIBCELLML_VERSION[] = "0.5.0"; const size_t CONSTANT_COUNT = 0; const size_t COMPUTED_CONSTANT_COUNT = 0; const size_t ALGEBRAIC_COUNT = 2; +const size_t EXTERNAL_COUNT = 0; const VariableInfo VARIABLE_INFO[] = { {"x", "dimensionless", "my_algebraic_eqn", COMPUTED_CONSTANT}, diff --git a/tests/resources/generator/algebraic_eqn_const_var_on_rhs/model.h b/tests/resources/generator/algebraic_eqn_const_var_on_rhs/model.h index 8b9a1fb666..ffa08d4179 100644 --- a/tests/resources/generator/algebraic_eqn_const_var_on_rhs/model.h +++ b/tests/resources/generator/algebraic_eqn_const_var_on_rhs/model.h @@ -10,6 +10,7 @@ extern const char LIBCELLML_VERSION[]; extern const size_t CONSTANT_COUNT; extern const size_t COMPUTED_CONSTANT_COUNT; extern const size_t ALGEBRAIC_COUNT; +extern const size_t EXTERNAL_COUNT; typedef enum { CONSTANT, diff --git a/tests/resources/generator/algebraic_eqn_const_var_on_rhs/model.py b/tests/resources/generator/algebraic_eqn_const_var_on_rhs/model.py index 491cd5db6c..cac3a4142d 100644 --- a/tests/resources/generator/algebraic_eqn_const_var_on_rhs/model.py +++ b/tests/resources/generator/algebraic_eqn_const_var_on_rhs/model.py @@ -10,6 +10,7 @@ CONSTANT_COUNT = 0 COMPUTED_CONSTANT_COUNT = 0 ALGEBRAIC_COUNT = 2 +EXTERNAL_COUNT = 0 class VariableType(Enum): diff --git a/tests/resources/generator/algebraic_eqn_constant_on_rhs/model.c b/tests/resources/generator/algebraic_eqn_constant_on_rhs/model.c index 89a7cc42a4..b2142ca770 100644 --- a/tests/resources/generator/algebraic_eqn_constant_on_rhs/model.c +++ b/tests/resources/generator/algebraic_eqn_constant_on_rhs/model.c @@ -11,6 +11,7 @@ const char LIBCELLML_VERSION[] = "0.5.0"; const size_t CONSTANT_COUNT = 0; const size_t COMPUTED_CONSTANT_COUNT = 0; const size_t ALGEBRAIC_COUNT = 1; +const size_t EXTERNAL_COUNT = 0; const VariableInfo VARIABLE_INFO[] = { {"x", "dimensionless", "my_component", COMPUTED_CONSTANT} diff --git a/tests/resources/generator/algebraic_eqn_constant_on_rhs/model.h b/tests/resources/generator/algebraic_eqn_constant_on_rhs/model.h index d26413c671..e5928a2fe5 100644 --- a/tests/resources/generator/algebraic_eqn_constant_on_rhs/model.h +++ b/tests/resources/generator/algebraic_eqn_constant_on_rhs/model.h @@ -10,6 +10,7 @@ extern const char LIBCELLML_VERSION[]; extern const size_t CONSTANT_COUNT; extern const size_t COMPUTED_CONSTANT_COUNT; extern const size_t ALGEBRAIC_COUNT; +extern const size_t EXTERNAL_COUNT; typedef enum { CONSTANT, diff --git a/tests/resources/generator/algebraic_eqn_constant_on_rhs/model.py b/tests/resources/generator/algebraic_eqn_constant_on_rhs/model.py index bbee078792..e5238d296c 100644 --- a/tests/resources/generator/algebraic_eqn_constant_on_rhs/model.py +++ b/tests/resources/generator/algebraic_eqn_constant_on_rhs/model.py @@ -10,6 +10,7 @@ CONSTANT_COUNT = 0 COMPUTED_CONSTANT_COUNT = 0 ALGEBRAIC_COUNT = 1 +EXTERNAL_COUNT = 0 class VariableType(Enum): diff --git a/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.c b/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.c index 3dad3588b0..9cb7a3000a 100644 --- a/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.c +++ b/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.c @@ -12,6 +12,7 @@ const size_t STATE_COUNT = 1; const size_t CONSTANT_COUNT = 0; const size_t COMPUTED_CONSTANT_COUNT = 0; const size_t ALGEBRAIC_COUNT = 2; +const size_t EXTERNAL_COUNT = 0; const VariableInfo VOI_INFO = {"t", "second", "environment", VARIABLE_OF_INTEGRATION}; diff --git a/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.h b/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.h index 1eeee2f1e3..02e634a295 100644 --- a/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.h +++ b/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.h @@ -11,6 +11,7 @@ extern const size_t STATE_COUNT; extern const size_t CONSTANT_COUNT; extern const size_t COMPUTED_CONSTANT_COUNT; extern const size_t ALGEBRAIC_COUNT; +extern const size_t EXTERNAL_COUNT; typedef enum { VARIABLE_OF_INTEGRATION, diff --git a/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.py b/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.py index 636d498ebc..ed4157ad3c 100644 --- a/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.py +++ b/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.py @@ -11,6 +11,7 @@ CONSTANT_COUNT = 0 COMPUTED_CONSTANT_COUNT = 0 ALGEBRAIC_COUNT = 2 +EXTERNAL_COUNT = 0 class VariableType(Enum): diff --git a/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.c b/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.c index 7c848f4303..75a65fe9c5 100644 --- a/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.c +++ b/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.c @@ -12,6 +12,7 @@ const size_t STATE_COUNT = 1; const size_t CONSTANT_COUNT = 0; const size_t COMPUTED_CONSTANT_COUNT = 0; const size_t ALGEBRAIC_COUNT = 2; +const size_t EXTERNAL_COUNT = 0; const VariableInfo VOI_INFO = {"t", "second", "my_component", VARIABLE_OF_INTEGRATION}; diff --git a/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.h b/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.h index ca79cc5f25..89890cfa68 100644 --- a/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.h +++ b/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.h @@ -11,6 +11,7 @@ extern const size_t STATE_COUNT; extern const size_t CONSTANT_COUNT; extern const size_t COMPUTED_CONSTANT_COUNT; extern const size_t ALGEBRAIC_COUNT; +extern const size_t EXTERNAL_COUNT; typedef enum { VARIABLE_OF_INTEGRATION, diff --git a/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.py b/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.py index 1b1a4ab6e7..2e6d45e10f 100644 --- a/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.py +++ b/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.py @@ -11,6 +11,7 @@ CONSTANT_COUNT = 0 COMPUTED_CONSTANT_COUNT = 0 ALGEBRAIC_COUNT = 2 +EXTERNAL_COUNT = 0 class VariableType(Enum): diff --git a/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.c b/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.c index 42c4bd5eb7..c6a0f3adf8 100644 --- a/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.c +++ b/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.c @@ -12,6 +12,7 @@ const size_t STATE_COUNT = 1; const size_t CONSTANT_COUNT = 0; const size_t COMPUTED_CONSTANT_COUNT = 0; const size_t ALGEBRAIC_COUNT = 2; +const size_t EXTERNAL_COUNT = 0; const VariableInfo VOI_INFO = {"t", "second", "environment", VARIABLE_OF_INTEGRATION}; diff --git a/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.h b/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.h index d2a3025e39..60658293a0 100644 --- a/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.h +++ b/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.h @@ -11,6 +11,7 @@ extern const size_t STATE_COUNT; extern const size_t CONSTANT_COUNT; extern const size_t COMPUTED_CONSTANT_COUNT; extern const size_t ALGEBRAIC_COUNT; +extern const size_t EXTERNAL_COUNT; typedef enum { VARIABLE_OF_INTEGRATION, diff --git a/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.py b/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.py index 1515ba7746..fe2cececb1 100644 --- a/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.py +++ b/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.py @@ -11,6 +11,7 @@ CONSTANT_COUNT = 0 COMPUTED_CONSTANT_COUNT = 0 ALGEBRAIC_COUNT = 2 +EXTERNAL_COUNT = 0 class VariableType(Enum): diff --git a/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.c b/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.c index 02fe6c001b..2a8dbbed53 100644 --- a/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.c +++ b/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.c @@ -12,6 +12,7 @@ const size_t STATE_COUNT = 1; const size_t CONSTANT_COUNT = 0; const size_t COMPUTED_CONSTANT_COUNT = 0; const size_t ALGEBRAIC_COUNT = 2; +const size_t EXTERNAL_COUNT = 0; const VariableInfo VOI_INFO = {"t", "second", "my_model", VARIABLE_OF_INTEGRATION}; diff --git a/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.h b/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.h index cfae2b1d2f..e98ffacdf3 100644 --- a/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.h +++ b/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.h @@ -11,6 +11,7 @@ extern const size_t STATE_COUNT; extern const size_t CONSTANT_COUNT; extern const size_t COMPUTED_CONSTANT_COUNT; extern const size_t ALGEBRAIC_COUNT; +extern const size_t EXTERNAL_COUNT; typedef enum { VARIABLE_OF_INTEGRATION, diff --git a/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.py b/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.py index 25de4def2c..a91cadb067 100644 --- a/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.py +++ b/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.py @@ -11,6 +11,7 @@ CONSTANT_COUNT = 0 COMPUTED_CONSTANT_COUNT = 0 ALGEBRAIC_COUNT = 2 +EXTERNAL_COUNT = 0 class VariableType(Enum): diff --git a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.c b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.c index 76b2c4760b..75c1d28aed 100644 --- a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.c +++ b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.c @@ -11,6 +11,7 @@ const char LIBCELLML_VERSION[] = "0.5.0"; const size_t CONSTANT_COUNT = 0; const size_t COMPUTED_CONSTANT_COUNT = 0; const size_t ALGEBRAIC_COUNT = 4; +const size_t EXTERNAL_COUNT = 0; const VariableInfo VARIABLE_INFO[] = { {"b", "dimensionless", "my_algebraic_eqn", COMPUTED_CONSTANT}, diff --git a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.c b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.c index 060991c4c8..ce37e089b2 100644 --- a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.c +++ b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.c @@ -11,6 +11,7 @@ const char LIBCELLML_VERSION[] = "0.5.0"; const size_t CONSTANT_COUNT = 0; const size_t COMPUTED_CONSTANT_COUNT = 0; const size_t ALGEBRAIC_COUNT = 4; +const size_t EXTERNAL_COUNT = 0; const VariableInfo VARIABLE_INFO[] = { {"b", "dimensionless", "my_algebraic_eqn", COMPUTED_CONSTANT}, diff --git a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.h b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.h index 8b56d9b9f6..9763338779 100644 --- a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.h +++ b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.h @@ -10,6 +10,7 @@ extern const char LIBCELLML_VERSION[]; extern const size_t CONSTANT_COUNT; extern const size_t COMPUTED_CONSTANT_COUNT; extern const size_t ALGEBRAIC_COUNT; +extern const size_t EXTERNAL_COUNT; typedef enum { CONSTANT, diff --git a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.py b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.py index 136bed0a66..3998dee561 100644 --- a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.py +++ b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.py @@ -10,6 +10,7 @@ CONSTANT_COUNT = 0 COMPUTED_CONSTANT_COUNT = 0 ALGEBRAIC_COUNT = 4 +EXTERNAL_COUNT = 0 class VariableType(Enum): diff --git a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.h b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.h index 8b9a1fb666..ffa08d4179 100644 --- a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.h +++ b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.h @@ -10,6 +10,7 @@ extern const char LIBCELLML_VERSION[]; extern const size_t CONSTANT_COUNT; extern const size_t COMPUTED_CONSTANT_COUNT; extern const size_t ALGEBRAIC_COUNT; +extern const size_t EXTERNAL_COUNT; typedef enum { CONSTANT, diff --git a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.py b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.py index c84ffdf6af..e823ec04ac 100644 --- a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.py +++ b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.py @@ -10,6 +10,7 @@ CONSTANT_COUNT = 0 COMPUTED_CONSTANT_COUNT = 0 ALGEBRAIC_COUNT = 4 +EXTERNAL_COUNT = 0 class VariableType(Enum): diff --git a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.c b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.c index eb6d409ade..3fed4a9e13 100644 --- a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.c +++ b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.c @@ -11,6 +11,7 @@ const char LIBCELLML_VERSION[] = "0.5.0"; const size_t CONSTANT_COUNT = 0; const size_t COMPUTED_CONSTANT_COUNT = 0; const size_t ALGEBRAIC_COUNT = 3; +const size_t EXTERNAL_COUNT = 0; const VariableInfo VARIABLE_INFO[] = { {"x", "dimensionless", "my_algebraic_system", ALGEBRAIC}, diff --git a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.h b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.h index 69ce3f6763..fee170f4b2 100644 --- a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.h +++ b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.h @@ -10,6 +10,7 @@ extern const char LIBCELLML_VERSION[]; extern const size_t CONSTANT_COUNT; extern const size_t COMPUTED_CONSTANT_COUNT; extern const size_t ALGEBRAIC_COUNT; +extern const size_t EXTERNAL_COUNT; typedef enum { CONSTANT, diff --git a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.py b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.py index de50e042ec..16bd44fe49 100644 --- a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.py +++ b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.py @@ -10,6 +10,7 @@ CONSTANT_COUNT = 0 COMPUTED_CONSTANT_COUNT = 0 ALGEBRAIC_COUNT = 3 +EXTERNAL_COUNT = 0 class VariableType(Enum): diff --git a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.c b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.c index db8bace3dd..827f341f93 100644 --- a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.c +++ b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.c @@ -11,6 +11,7 @@ const char LIBCELLML_VERSION[] = "0.5.0"; const size_t CONSTANT_COUNT = 0; const size_t COMPUTED_CONSTANT_COUNT = 0; const size_t ALGEBRAIC_COUNT = 3; +const size_t EXTERNAL_COUNT = 0; const VariableInfo VARIABLE_INFO[] = { {"x", "dimensionless", "my_algebraic_system", EXTERNAL}, diff --git a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.h b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.h index f8cc4af0bb..0c3b6b4a50 100644 --- a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.h +++ b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.h @@ -10,6 +10,7 @@ extern const char LIBCELLML_VERSION[]; extern const size_t CONSTANT_COUNT; extern const size_t COMPUTED_CONSTANT_COUNT; extern const size_t ALGEBRAIC_COUNT; +extern const size_t EXTERNAL_COUNT; typedef enum { CONSTANT, diff --git a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.py b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.py index 0e99da2824..bdb2fe0fe1 100644 --- a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.py +++ b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.py @@ -10,6 +10,7 @@ CONSTANT_COUNT = 0 COMPUTED_CONSTANT_COUNT = 0 ALGEBRAIC_COUNT = 3 +EXTERNAL_COUNT = 0 class VariableType(Enum): diff --git a/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.c b/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.c index c628b10acd..c1b94c1827 100644 --- a/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.c +++ b/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.c @@ -11,6 +11,7 @@ const char LIBCELLML_VERSION[] = "0.5.0"; const size_t CONSTANT_COUNT = 0; const size_t COMPUTED_CONSTANT_COUNT = 0; const size_t ALGEBRAIC_COUNT = 6; +const size_t EXTERNAL_COUNT = 0; const VariableInfo VARIABLE_INFO[] = { {"d", "dimensionless", "my_algebraic_system", ALGEBRAIC}, diff --git a/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.h b/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.h index 69ce3f6763..fee170f4b2 100644 --- a/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.h +++ b/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.h @@ -10,6 +10,7 @@ extern const char LIBCELLML_VERSION[]; extern const size_t CONSTANT_COUNT; extern const size_t COMPUTED_CONSTANT_COUNT; extern const size_t ALGEBRAIC_COUNT; +extern const size_t EXTERNAL_COUNT; typedef enum { CONSTANT, diff --git a/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.py b/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.py index 083873c38c..8a734a9a37 100644 --- a/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.py +++ b/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.py @@ -10,6 +10,7 @@ CONSTANT_COUNT = 0 COMPUTED_CONSTANT_COUNT = 0 ALGEBRAIC_COUNT = 6 +EXTERNAL_COUNT = 0 class VariableType(Enum): diff --git a/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.c b/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.c index c7e93bd95d..15de97b498 100644 --- a/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.c +++ b/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.c @@ -11,6 +11,7 @@ const char LIBCELLML_VERSION[] = "0.5.0"; const size_t CONSTANT_COUNT = 0; const size_t COMPUTED_CONSTANT_COUNT = 0; const size_t ALGEBRAIC_COUNT = 6; +const size_t EXTERNAL_COUNT = 0; const VariableInfo VARIABLE_INFO[] = { {"a", "dimensionless", "my_algebraic_system", COMPUTED_CONSTANT}, diff --git a/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.h b/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.h index 69ce3f6763..fee170f4b2 100644 --- a/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.h +++ b/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.h @@ -10,6 +10,7 @@ extern const char LIBCELLML_VERSION[]; extern const size_t CONSTANT_COUNT; extern const size_t COMPUTED_CONSTANT_COUNT; extern const size_t ALGEBRAIC_COUNT; +extern const size_t EXTERNAL_COUNT; typedef enum { CONSTANT, diff --git a/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.py b/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.py index 8b965af0b9..e842a7e565 100644 --- a/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.py +++ b/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.py @@ -10,6 +10,7 @@ CONSTANT_COUNT = 0 COMPUTED_CONSTANT_COUNT = 0 ALGEBRAIC_COUNT = 6 +EXTERNAL_COUNT = 0 class VariableType(Enum): diff --git a/tests/resources/generator/algebraic_unknown_var_on_rhs/model.c b/tests/resources/generator/algebraic_unknown_var_on_rhs/model.c index 16b90c3882..0fab3f892e 100644 --- a/tests/resources/generator/algebraic_unknown_var_on_rhs/model.c +++ b/tests/resources/generator/algebraic_unknown_var_on_rhs/model.c @@ -11,6 +11,7 @@ const char LIBCELLML_VERSION[] = "0.5.0"; const size_t CONSTANT_COUNT = 0; const size_t COMPUTED_CONSTANT_COUNT = 0; const size_t ALGEBRAIC_COUNT = 2; +const size_t EXTERNAL_COUNT = 0; const VariableInfo VARIABLE_INFO[] = { {"x", "dimensionless", "my_component", COMPUTED_CONSTANT}, diff --git a/tests/resources/generator/algebraic_unknown_var_on_rhs/model.h b/tests/resources/generator/algebraic_unknown_var_on_rhs/model.h index d26413c671..e5928a2fe5 100644 --- a/tests/resources/generator/algebraic_unknown_var_on_rhs/model.h +++ b/tests/resources/generator/algebraic_unknown_var_on_rhs/model.h @@ -10,6 +10,7 @@ extern const char LIBCELLML_VERSION[]; extern const size_t CONSTANT_COUNT; extern const size_t COMPUTED_CONSTANT_COUNT; extern const size_t ALGEBRAIC_COUNT; +extern const size_t EXTERNAL_COUNT; typedef enum { CONSTANT, diff --git a/tests/resources/generator/algebraic_unknown_var_on_rhs/model.py b/tests/resources/generator/algebraic_unknown_var_on_rhs/model.py index 3edee3eadc..53f8993bf6 100644 --- a/tests/resources/generator/algebraic_unknown_var_on_rhs/model.py +++ b/tests/resources/generator/algebraic_unknown_var_on_rhs/model.py @@ -10,6 +10,7 @@ CONSTANT_COUNT = 0 COMPUTED_CONSTANT_COUNT = 0 ALGEBRAIC_COUNT = 2 +EXTERNAL_COUNT = 0 class VariableType(Enum): diff --git a/tests/resources/generator/cell_geometry_model/model.c b/tests/resources/generator/cell_geometry_model/model.c index a5db4ad9c7..e6391bb731 100644 --- a/tests/resources/generator/cell_geometry_model/model.c +++ b/tests/resources/generator/cell_geometry_model/model.c @@ -11,6 +11,7 @@ const char LIBCELLML_VERSION[] = "0.5.0"; const size_t CONSTANT_COUNT = 0; const size_t COMPUTED_CONSTANT_COUNT = 0; const size_t ALGEBRAIC_COUNT = 4; +const size_t EXTERNAL_COUNT = 0; const VariableInfo VARIABLE_INFO[] = { {"vcell", "microlitre", "cell_geometry", COMPUTED_CONSTANT}, diff --git a/tests/resources/generator/cell_geometry_model/model.external.c b/tests/resources/generator/cell_geometry_model/model.external.c index ed88fb63df..8ecb305e9a 100644 --- a/tests/resources/generator/cell_geometry_model/model.external.c +++ b/tests/resources/generator/cell_geometry_model/model.external.c @@ -11,6 +11,7 @@ const char LIBCELLML_VERSION[] = "0.5.0"; const size_t CONSTANT_COUNT = 0; const size_t COMPUTED_CONSTANT_COUNT = 0; const size_t ALGEBRAIC_COUNT = 4; +const size_t EXTERNAL_COUNT = 0; const VariableInfo VARIABLE_INFO[] = { {"vcell", "microlitre", "cell_geometry", ALGEBRAIC}, diff --git a/tests/resources/generator/cell_geometry_model/model.external.h b/tests/resources/generator/cell_geometry_model/model.external.h index 6974bd6469..4138452982 100644 --- a/tests/resources/generator/cell_geometry_model/model.external.h +++ b/tests/resources/generator/cell_geometry_model/model.external.h @@ -10,6 +10,7 @@ extern const char LIBCELLML_VERSION[]; extern const size_t CONSTANT_COUNT; extern const size_t COMPUTED_CONSTANT_COUNT; extern const size_t ALGEBRAIC_COUNT; +extern const size_t EXTERNAL_COUNT; typedef enum { CONSTANT, diff --git a/tests/resources/generator/cell_geometry_model/model.external.py b/tests/resources/generator/cell_geometry_model/model.external.py index 752da86d55..2bf7fb6137 100644 --- a/tests/resources/generator/cell_geometry_model/model.external.py +++ b/tests/resources/generator/cell_geometry_model/model.external.py @@ -10,6 +10,7 @@ CONSTANT_COUNT = 0 COMPUTED_CONSTANT_COUNT = 0 ALGEBRAIC_COUNT = 4 +EXTERNAL_COUNT = 0 class VariableType(Enum): diff --git a/tests/resources/generator/cell_geometry_model/model.h b/tests/resources/generator/cell_geometry_model/model.h index d291cbc391..ef37e5ea59 100644 --- a/tests/resources/generator/cell_geometry_model/model.h +++ b/tests/resources/generator/cell_geometry_model/model.h @@ -10,6 +10,7 @@ extern const char LIBCELLML_VERSION[]; extern const size_t CONSTANT_COUNT; extern const size_t COMPUTED_CONSTANT_COUNT; extern const size_t ALGEBRAIC_COUNT; +extern const size_t EXTERNAL_COUNT; typedef enum { CONSTANT, diff --git a/tests/resources/generator/cell_geometry_model/model.py b/tests/resources/generator/cell_geometry_model/model.py index 6c941fc867..eb269347e4 100644 --- a/tests/resources/generator/cell_geometry_model/model.py +++ b/tests/resources/generator/cell_geometry_model/model.py @@ -10,6 +10,7 @@ CONSTANT_COUNT = 0 COMPUTED_CONSTANT_COUNT = 0 ALGEBRAIC_COUNT = 4 +EXTERNAL_COUNT = 0 class VariableType(Enum): diff --git a/tests/resources/generator/cellml_mappings_and_encapsulations/model.c b/tests/resources/generator/cellml_mappings_and_encapsulations/model.c index 3f59baaf87..92bf0a4fb9 100644 --- a/tests/resources/generator/cellml_mappings_and_encapsulations/model.c +++ b/tests/resources/generator/cellml_mappings_and_encapsulations/model.c @@ -12,6 +12,7 @@ const size_t STATE_COUNT = 2; const size_t CONSTANT_COUNT = 0; const size_t COMPUTED_CONSTANT_COUNT = 0; const size_t ALGEBRAIC_COUNT = 2; +const size_t EXTERNAL_COUNT = 0; const VariableInfo VOI_INFO = {"t", "ms", "environment", VARIABLE_OF_INTEGRATION}; diff --git a/tests/resources/generator/cellml_mappings_and_encapsulations/model.h b/tests/resources/generator/cellml_mappings_and_encapsulations/model.h index 91a2bbdb90..2aab41a47f 100644 --- a/tests/resources/generator/cellml_mappings_and_encapsulations/model.h +++ b/tests/resources/generator/cellml_mappings_and_encapsulations/model.h @@ -11,6 +11,7 @@ extern const size_t STATE_COUNT; extern const size_t CONSTANT_COUNT; extern const size_t COMPUTED_CONSTANT_COUNT; extern const size_t ALGEBRAIC_COUNT; +extern const size_t EXTERNAL_COUNT; typedef enum { VARIABLE_OF_INTEGRATION, diff --git a/tests/resources/generator/cellml_mappings_and_encapsulations/model.py b/tests/resources/generator/cellml_mappings_and_encapsulations/model.py index 42799d8118..8ecaaaaa46 100644 --- a/tests/resources/generator/cellml_mappings_and_encapsulations/model.py +++ b/tests/resources/generator/cellml_mappings_and_encapsulations/model.py @@ -11,6 +11,7 @@ CONSTANT_COUNT = 0 COMPUTED_CONSTANT_COUNT = 0 ALGEBRAIC_COUNT = 2 +EXTERNAL_COUNT = 0 class VariableType(Enum): diff --git a/tests/resources/generator/cellml_slc_example/model.py b/tests/resources/generator/cellml_slc_example/model.py index f13fcec596..5ffe3d04ef 100644 --- a/tests/resources/generator/cellml_slc_example/model.py +++ b/tests/resources/generator/cellml_slc_example/model.py @@ -10,6 +10,7 @@ CONSTANT_COUNT = 0 COMPUTED_CONSTANT_COUNT = 0 ALGEBRAIC_COUNT = 10 +EXTERNAL_COUNT = 0 class VariableType(Enum): diff --git a/tests/resources/generator/cellml_state_initialised_using_variable/model.c b/tests/resources/generator/cellml_state_initialised_using_variable/model.c index 3bb1425bc5..88193e176a 100644 --- a/tests/resources/generator/cellml_state_initialised_using_variable/model.c +++ b/tests/resources/generator/cellml_state_initialised_using_variable/model.c @@ -12,6 +12,7 @@ const size_t STATE_COUNT = 1; const size_t CONSTANT_COUNT = 0; const size_t COMPUTED_CONSTANT_COUNT = 0; const size_t ALGEBRAIC_COUNT = 1; +const size_t EXTERNAL_COUNT = 0; const VariableInfo VOI_INFO = {"t", "ms", "environment", VARIABLE_OF_INTEGRATION}; diff --git a/tests/resources/generator/cellml_state_initialised_using_variable/model.h b/tests/resources/generator/cellml_state_initialised_using_variable/model.h index e95d12eb15..1a5d4ce25e 100644 --- a/tests/resources/generator/cellml_state_initialised_using_variable/model.h +++ b/tests/resources/generator/cellml_state_initialised_using_variable/model.h @@ -11,6 +11,7 @@ extern const size_t STATE_COUNT; extern const size_t CONSTANT_COUNT; extern const size_t COMPUTED_CONSTANT_COUNT; extern const size_t ALGEBRAIC_COUNT; +extern const size_t EXTERNAL_COUNT; typedef enum { VARIABLE_OF_INTEGRATION, diff --git a/tests/resources/generator/cellml_state_initialised_using_variable/model.py b/tests/resources/generator/cellml_state_initialised_using_variable/model.py index 2ae891fe37..ff1defc395 100644 --- a/tests/resources/generator/cellml_state_initialised_using_variable/model.py +++ b/tests/resources/generator/cellml_state_initialised_using_variable/model.py @@ -11,6 +11,7 @@ CONSTANT_COUNT = 0 COMPUTED_CONSTANT_COUNT = 0 ALGEBRAIC_COUNT = 1 +EXTERNAL_COUNT = 0 class VariableType(Enum): diff --git a/tests/resources/generator/cellml_unit_scaling_constant/model.c b/tests/resources/generator/cellml_unit_scaling_constant/model.c index dea2a68eaa..616edc4038 100644 --- a/tests/resources/generator/cellml_unit_scaling_constant/model.c +++ b/tests/resources/generator/cellml_unit_scaling_constant/model.c @@ -11,6 +11,7 @@ const char LIBCELLML_VERSION[] = "0.5.0"; const size_t CONSTANT_COUNT = 0; const size_t COMPUTED_CONSTANT_COUNT = 0; const size_t ALGEBRAIC_COUNT = 3; +const size_t EXTERNAL_COUNT = 0; const VariableInfo VARIABLE_INFO[] = { {"k", "mM", "constants", CONSTANT}, diff --git a/tests/resources/generator/cellml_unit_scaling_constant/model.h b/tests/resources/generator/cellml_unit_scaling_constant/model.h index 435deb74f0..ed21d64734 100644 --- a/tests/resources/generator/cellml_unit_scaling_constant/model.h +++ b/tests/resources/generator/cellml_unit_scaling_constant/model.h @@ -10,6 +10,7 @@ extern const char LIBCELLML_VERSION[]; extern const size_t CONSTANT_COUNT; extern const size_t COMPUTED_CONSTANT_COUNT; extern const size_t ALGEBRAIC_COUNT; +extern const size_t EXTERNAL_COUNT; typedef enum { CONSTANT, diff --git a/tests/resources/generator/cellml_unit_scaling_constant/model.py b/tests/resources/generator/cellml_unit_scaling_constant/model.py index ec8df9c839..6cd14b1a99 100644 --- a/tests/resources/generator/cellml_unit_scaling_constant/model.py +++ b/tests/resources/generator/cellml_unit_scaling_constant/model.py @@ -10,6 +10,7 @@ CONSTANT_COUNT = 0 COMPUTED_CONSTANT_COUNT = 0 ALGEBRAIC_COUNT = 3 +EXTERNAL_COUNT = 0 class VariableType(Enum): diff --git a/tests/resources/generator/cellml_unit_scaling_rate/model.c b/tests/resources/generator/cellml_unit_scaling_rate/model.c index 603a1eab39..87f36e81d0 100644 --- a/tests/resources/generator/cellml_unit_scaling_rate/model.c +++ b/tests/resources/generator/cellml_unit_scaling_rate/model.c @@ -12,6 +12,7 @@ const size_t STATE_COUNT = 1; const size_t CONSTANT_COUNT = 0; const size_t COMPUTED_CONSTANT_COUNT = 0; const size_t ALGEBRAIC_COUNT = 2; +const size_t EXTERNAL_COUNT = 0; const VariableInfo VOI_INFO = {"t", "ms", "environment", VARIABLE_OF_INTEGRATION}; diff --git a/tests/resources/generator/cellml_unit_scaling_rate/model.h b/tests/resources/generator/cellml_unit_scaling_rate/model.h index e95d12eb15..1a5d4ce25e 100644 --- a/tests/resources/generator/cellml_unit_scaling_rate/model.h +++ b/tests/resources/generator/cellml_unit_scaling_rate/model.h @@ -11,6 +11,7 @@ extern const size_t STATE_COUNT; extern const size_t CONSTANT_COUNT; extern const size_t COMPUTED_CONSTANT_COUNT; extern const size_t ALGEBRAIC_COUNT; +extern const size_t EXTERNAL_COUNT; typedef enum { VARIABLE_OF_INTEGRATION, diff --git a/tests/resources/generator/cellml_unit_scaling_rate/model.py b/tests/resources/generator/cellml_unit_scaling_rate/model.py index f74588e123..572138bfca 100644 --- a/tests/resources/generator/cellml_unit_scaling_rate/model.py +++ b/tests/resources/generator/cellml_unit_scaling_rate/model.py @@ -11,6 +11,7 @@ CONSTANT_COUNT = 0 COMPUTED_CONSTANT_COUNT = 0 ALGEBRAIC_COUNT = 2 +EXTERNAL_COUNT = 0 class VariableType(Enum): diff --git a/tests/resources/generator/cellml_unit_scaling_state/model.c b/tests/resources/generator/cellml_unit_scaling_state/model.c index 34c1bca1f3..0e28895151 100644 --- a/tests/resources/generator/cellml_unit_scaling_state/model.c +++ b/tests/resources/generator/cellml_unit_scaling_state/model.c @@ -12,6 +12,7 @@ const size_t STATE_COUNT = 1; const size_t CONSTANT_COUNT = 0; const size_t COMPUTED_CONSTANT_COUNT = 0; const size_t ALGEBRAIC_COUNT = 2; +const size_t EXTERNAL_COUNT = 0; const VariableInfo VOI_INFO = {"t", "ms", "environment", VARIABLE_OF_INTEGRATION}; diff --git a/tests/resources/generator/cellml_unit_scaling_state/model.h b/tests/resources/generator/cellml_unit_scaling_state/model.h index e95d12eb15..1a5d4ce25e 100644 --- a/tests/resources/generator/cellml_unit_scaling_state/model.h +++ b/tests/resources/generator/cellml_unit_scaling_state/model.h @@ -11,6 +11,7 @@ extern const size_t STATE_COUNT; extern const size_t CONSTANT_COUNT; extern const size_t COMPUTED_CONSTANT_COUNT; extern const size_t ALGEBRAIC_COUNT; +extern const size_t EXTERNAL_COUNT; typedef enum { VARIABLE_OF_INTEGRATION, diff --git a/tests/resources/generator/cellml_unit_scaling_state/model.py b/tests/resources/generator/cellml_unit_scaling_state/model.py index ec43146e3c..ea1dd2f48c 100644 --- a/tests/resources/generator/cellml_unit_scaling_state/model.py +++ b/tests/resources/generator/cellml_unit_scaling_state/model.py @@ -11,6 +11,7 @@ CONSTANT_COUNT = 0 COMPUTED_CONSTANT_COUNT = 0 ALGEBRAIC_COUNT = 2 +EXTERNAL_COUNT = 0 class VariableType(Enum): diff --git a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.c b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.c index c0db3b3a33..9689d4fc95 100644 --- a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.c +++ b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.c @@ -12,6 +12,7 @@ const size_t STATE_COUNT = 2; const size_t CONSTANT_COUNT = 0; const size_t COMPUTED_CONSTANT_COUNT = 0; const size_t ALGEBRAIC_COUNT = 0; +const size_t EXTERNAL_COUNT = 0; const VariableInfo VOI_INFO = {"t", "ms", "environment", VARIABLE_OF_INTEGRATION}; diff --git a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.h b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.h index bd4dd923ef..fe37713823 100644 --- a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.h +++ b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.h @@ -11,6 +11,7 @@ extern const size_t STATE_COUNT; extern const size_t CONSTANT_COUNT; extern const size_t COMPUTED_CONSTANT_COUNT; extern const size_t ALGEBRAIC_COUNT; +extern const size_t EXTERNAL_COUNT; typedef enum { VARIABLE_OF_INTEGRATION, diff --git a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.py b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.py index 86e48a995e..214d36e3ff 100644 --- a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.py +++ b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.py @@ -11,6 +11,7 @@ CONSTANT_COUNT = 0 COMPUTED_CONSTANT_COUNT = 0 ALGEBRAIC_COUNT = 0 +EXTERNAL_COUNT = 0 class VariableType(Enum): diff --git a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.c b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.c index ba05a38f2c..cf6cc56198 100644 --- a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.c +++ b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.c @@ -12,6 +12,7 @@ const size_t STATE_COUNT = 2; const size_t CONSTANT_COUNT = 0; const size_t COMPUTED_CONSTANT_COUNT = 0; const size_t ALGEBRAIC_COUNT = 2; +const size_t EXTERNAL_COUNT = 0; const VariableInfo VOI_INFO = {"t", "ms", "environment", VARIABLE_OF_INTEGRATION}; diff --git a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.h b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.h index fc9911e7e4..4806062496 100644 --- a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.h +++ b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.h @@ -11,6 +11,7 @@ extern const size_t STATE_COUNT; extern const size_t CONSTANT_COUNT; extern const size_t COMPUTED_CONSTANT_COUNT; extern const size_t ALGEBRAIC_COUNT; +extern const size_t EXTERNAL_COUNT; typedef enum { VARIABLE_OF_INTEGRATION, diff --git a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.py b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.py index ce584f1b07..084fde5b22 100644 --- a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.py +++ b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.py @@ -11,6 +11,7 @@ CONSTANT_COUNT = 0 COMPUTED_CONSTANT_COUNT = 0 ALGEBRAIC_COUNT = 2 +EXTERNAL_COUNT = 0 class VariableType(Enum): diff --git a/tests/resources/generator/cellml_unit_scaling_voi_direct/model.c b/tests/resources/generator/cellml_unit_scaling_voi_direct/model.c index f0e1d42ba4..022b4ee5ae 100644 --- a/tests/resources/generator/cellml_unit_scaling_voi_direct/model.c +++ b/tests/resources/generator/cellml_unit_scaling_voi_direct/model.c @@ -12,6 +12,7 @@ const size_t STATE_COUNT = 2; const size_t CONSTANT_COUNT = 0; const size_t COMPUTED_CONSTANT_COUNT = 0; const size_t ALGEBRAIC_COUNT = 0; +const size_t EXTERNAL_COUNT = 0; const VariableInfo VOI_INFO = {"t", "ms", "environment", VARIABLE_OF_INTEGRATION}; diff --git a/tests/resources/generator/cellml_unit_scaling_voi_direct/model.h b/tests/resources/generator/cellml_unit_scaling_voi_direct/model.h index 3f1fb63fd2..cc72c5b3a4 100644 --- a/tests/resources/generator/cellml_unit_scaling_voi_direct/model.h +++ b/tests/resources/generator/cellml_unit_scaling_voi_direct/model.h @@ -11,6 +11,7 @@ extern const size_t STATE_COUNT; extern const size_t CONSTANT_COUNT; extern const size_t COMPUTED_CONSTANT_COUNT; extern const size_t ALGEBRAIC_COUNT; +extern const size_t EXTERNAL_COUNT; typedef enum { VARIABLE_OF_INTEGRATION, diff --git a/tests/resources/generator/cellml_unit_scaling_voi_direct/model.py b/tests/resources/generator/cellml_unit_scaling_voi_direct/model.py index e14df017f1..8f5a9954fc 100644 --- a/tests/resources/generator/cellml_unit_scaling_voi_direct/model.py +++ b/tests/resources/generator/cellml_unit_scaling_voi_direct/model.py @@ -11,6 +11,7 @@ CONSTANT_COUNT = 0 COMPUTED_CONSTANT_COUNT = 0 ALGEBRAIC_COUNT = 0 +EXTERNAL_COUNT = 0 class VariableType(Enum): diff --git a/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.c b/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.c index cd6840c595..37a9e4aa41 100644 --- a/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.c +++ b/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.c @@ -12,6 +12,7 @@ const size_t STATE_COUNT = 3; const size_t CONSTANT_COUNT = 0; const size_t COMPUTED_CONSTANT_COUNT = 0; const size_t ALGEBRAIC_COUNT = 0; +const size_t EXTERNAL_COUNT = 0; const VariableInfo VOI_INFO = {"t", "second", "environment", VARIABLE_OF_INTEGRATION}; diff --git a/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.h b/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.h index 123e68564c..2c159313cf 100644 --- a/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.h +++ b/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.h @@ -11,6 +11,7 @@ extern const size_t STATE_COUNT; extern const size_t CONSTANT_COUNT; extern const size_t COMPUTED_CONSTANT_COUNT; extern const size_t ALGEBRAIC_COUNT; +extern const size_t EXTERNAL_COUNT; typedef enum { VARIABLE_OF_INTEGRATION, diff --git a/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.py b/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.py index ac4a5b3097..fbb32f6afc 100644 --- a/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.py +++ b/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.py @@ -11,6 +11,7 @@ CONSTANT_COUNT = 0 COMPUTED_CONSTANT_COUNT = 0 ALGEBRAIC_COUNT = 0 +EXTERNAL_COUNT = 0 class VariableType(Enum): diff --git a/tests/resources/generator/dae_cellml_1_1_model/model.c b/tests/resources/generator/dae_cellml_1_1_model/model.c index 89c29978dd..91a85192ac 100644 --- a/tests/resources/generator/dae_cellml_1_1_model/model.c +++ b/tests/resources/generator/dae_cellml_1_1_model/model.c @@ -12,6 +12,7 @@ const size_t STATE_COUNT = 2; const size_t CONSTANT_COUNT = 0; const size_t COMPUTED_CONSTANT_COUNT = 0; const size_t ALGEBRAIC_COUNT = 10; +const size_t EXTERNAL_COUNT = 0; const VariableInfo VOI_INFO = {"t", "second", "main", VARIABLE_OF_INTEGRATION}; diff --git a/tests/resources/generator/dae_cellml_1_1_model/model.h b/tests/resources/generator/dae_cellml_1_1_model/model.h index 2bcb43579c..12391c8480 100644 --- a/tests/resources/generator/dae_cellml_1_1_model/model.h +++ b/tests/resources/generator/dae_cellml_1_1_model/model.h @@ -11,6 +11,7 @@ extern const size_t STATE_COUNT; extern const size_t CONSTANT_COUNT; extern const size_t COMPUTED_CONSTANT_COUNT; extern const size_t ALGEBRAIC_COUNT; +extern const size_t EXTERNAL_COUNT; typedef enum { VARIABLE_OF_INTEGRATION, diff --git a/tests/resources/generator/dae_cellml_1_1_model/model.py b/tests/resources/generator/dae_cellml_1_1_model/model.py index c1147dd4ff..c08f819906 100644 --- a/tests/resources/generator/dae_cellml_1_1_model/model.py +++ b/tests/resources/generator/dae_cellml_1_1_model/model.py @@ -11,6 +11,7 @@ CONSTANT_COUNT = 0 COMPUTED_CONSTANT_COUNT = 0 ALGEBRAIC_COUNT = 10 +EXTERNAL_COUNT = 0 class VariableType(Enum): diff --git a/tests/resources/generator/dependent_eqns/model.c b/tests/resources/generator/dependent_eqns/model.c index 7bbb981447..8afaa994e1 100644 --- a/tests/resources/generator/dependent_eqns/model.c +++ b/tests/resources/generator/dependent_eqns/model.c @@ -12,6 +12,7 @@ const size_t STATE_COUNT = 1; const size_t CONSTANT_COUNT = 0; const size_t COMPUTED_CONSTANT_COUNT = 0; const size_t ALGEBRAIC_COUNT = 2; +const size_t EXTERNAL_COUNT = 0; const VariableInfo VOI_INFO = {"time", "second", "my_component", VARIABLE_OF_INTEGRATION}; diff --git a/tests/resources/generator/dependent_eqns/model.h b/tests/resources/generator/dependent_eqns/model.h index 676c75fecd..bfb9e72345 100644 --- a/tests/resources/generator/dependent_eqns/model.h +++ b/tests/resources/generator/dependent_eqns/model.h @@ -11,6 +11,7 @@ extern const size_t STATE_COUNT; extern const size_t CONSTANT_COUNT; extern const size_t COMPUTED_CONSTANT_COUNT; extern const size_t ALGEBRAIC_COUNT; +extern const size_t EXTERNAL_COUNT; typedef enum { VARIABLE_OF_INTEGRATION, diff --git a/tests/resources/generator/dependent_eqns/model.py b/tests/resources/generator/dependent_eqns/model.py index 5ed89e9102..9f92687321 100644 --- a/tests/resources/generator/dependent_eqns/model.py +++ b/tests/resources/generator/dependent_eqns/model.py @@ -11,6 +11,7 @@ CONSTANT_COUNT = 0 COMPUTED_CONSTANT_COUNT = 0 ALGEBRAIC_COUNT = 2 +EXTERNAL_COUNT = 0 class VariableType(Enum): diff --git a/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.c b/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.c index bfbc945a46..839f568740 100644 --- a/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.c +++ b/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.c @@ -12,6 +12,7 @@ const size_t STATE_COUNT = 33; const size_t CONSTANT_COUNT = 0; const size_t COMPUTED_CONSTANT_COUNT = 0; const size_t ALGEBRAIC_COUNT = 217; +const size_t EXTERNAL_COUNT = 0; const VariableInfo VOI_INFO = {"time", "second", "environment", VARIABLE_OF_INTEGRATION}; diff --git a/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.h b/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.h index e94e9dec00..72e65f5642 100644 --- a/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.h +++ b/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.h @@ -11,6 +11,7 @@ extern const size_t STATE_COUNT; extern const size_t CONSTANT_COUNT; extern const size_t COMPUTED_CONSTANT_COUNT; extern const size_t ALGEBRAIC_COUNT; +extern const size_t EXTERNAL_COUNT; typedef enum { VARIABLE_OF_INTEGRATION, diff --git a/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.py b/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.py index 3141afa7a2..bf46049b2b 100644 --- a/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.py +++ b/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.py @@ -11,6 +11,7 @@ CONSTANT_COUNT = 0 COMPUTED_CONSTANT_COUNT = 0 ALGEBRAIC_COUNT = 217 +EXTERNAL_COUNT = 0 class VariableType(Enum): diff --git a/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.c b/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.c index 05de7d9e69..19a61164cc 100644 --- a/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.c +++ b/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.c @@ -12,6 +12,7 @@ const size_t STATE_COUNT = 15; const size_t CONSTANT_COUNT = 0; const size_t COMPUTED_CONSTANT_COUNT = 0; const size_t ALGEBRAIC_COUNT = 185; +const size_t EXTERNAL_COUNT = 0; const VariableInfo VOI_INFO = {"time", "second", "environment", VARIABLE_OF_INTEGRATION}; diff --git a/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.h b/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.h index 2715ae2d90..7ce78ee1d9 100644 --- a/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.h +++ b/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.h @@ -11,6 +11,7 @@ extern const size_t STATE_COUNT; extern const size_t CONSTANT_COUNT; extern const size_t COMPUTED_CONSTANT_COUNT; extern const size_t ALGEBRAIC_COUNT; +extern const size_t EXTERNAL_COUNT; typedef enum { VARIABLE_OF_INTEGRATION, diff --git a/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.py b/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.py index b07aec10ec..c62e1982cd 100644 --- a/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.py +++ b/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.py @@ -11,6 +11,7 @@ CONSTANT_COUNT = 0 COMPUTED_CONSTANT_COUNT = 0 ALGEBRAIC_COUNT = 185 +EXTERNAL_COUNT = 0 class VariableType(Enum): diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.c index fd4eb1dfc8..cd52f74514 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.c @@ -12,6 +12,7 @@ const size_t STATE_COUNT = 4; const size_t CONSTANT_COUNT = 0; const size_t COMPUTED_CONSTANT_COUNT = 0; const size_t ALGEBRAIC_COUNT = 18; +const size_t EXTERNAL_COUNT = 0; const VariableInfo VOI_INFO = {"time", "millisecond", "environment", VARIABLE_OF_INTEGRATION}; diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.h index 3435c028a3..8ae5a3e5dd 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.h +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.h @@ -11,6 +11,7 @@ extern const size_t STATE_COUNT; extern const size_t CONSTANT_COUNT; extern const size_t COMPUTED_CONSTANT_COUNT; extern const size_t ALGEBRAIC_COUNT; +extern const size_t EXTERNAL_COUNT; typedef enum { VARIABLE_OF_INTEGRATION, diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.py index 9b752f340f..a741566be0 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.py @@ -11,6 +11,7 @@ CONSTANT_COUNT = 0 COMPUTED_CONSTANT_COUNT = 0 ALGEBRAIC_COUNT = 18 +EXTERNAL_COUNT = 0 class VariableType(Enum): diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.c index 33d70c70cc..f687edd86f 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.c @@ -12,6 +12,7 @@ const size_t STATE_COUNT = 4; const size_t CONSTANT_COUNT = 0; const size_t COMPUTED_CONSTANT_COUNT = 0; const size_t ALGEBRAIC_COUNT = 18; +const size_t EXTERNAL_COUNT = 0; const VariableInfo VOI_INFO = {"time", "millisecond", "environment", VARIABLE_OF_INTEGRATION}; diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.c index 4dd1a09a6e..c56e1e8f48 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.c @@ -12,6 +12,7 @@ const size_t STATE_COUNT = 4; const size_t CONSTANT_COUNT = 0; const size_t COMPUTED_CONSTANT_COUNT = 0; const size_t ALGEBRAIC_COUNT = 18; +const size_t EXTERNAL_COUNT = 0; const VariableInfo VOI_INFO = {"time", "millisecond", "environment", VARIABLE_OF_INTEGRATION}; diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.h index 3435c028a3..8ae5a3e5dd 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.h +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.h @@ -11,6 +11,7 @@ extern const size_t STATE_COUNT; extern const size_t CONSTANT_COUNT; extern const size_t COMPUTED_CONSTANT_COUNT; extern const size_t ALGEBRAIC_COUNT; +extern const size_t EXTERNAL_COUNT; typedef enum { VARIABLE_OF_INTEGRATION, diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.py index 4d8a09531e..796983378f 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.py @@ -11,6 +11,7 @@ CONSTANT_COUNT = 0 COMPUTED_CONSTANT_COUNT = 0 ALGEBRAIC_COUNT = 18 +EXTERNAL_COUNT = 0 class VariableType(Enum): diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.c index b38a8dde50..1cc4901fd0 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.c @@ -12,6 +12,7 @@ const size_t STATE_COUNT = 4; const size_t CONSTANT_COUNT = 0; const size_t COMPUTED_CONSTANT_COUNT = 0; const size_t ALGEBRAIC_COUNT = 18; +const size_t EXTERNAL_COUNT = 0; const VariableInfo VOI_INFO = {"time", "millisecond", "environment", VARIABLE_OF_INTEGRATION}; diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.h index 3435c028a3..8ae5a3e5dd 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.h +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.h @@ -11,6 +11,7 @@ extern const size_t STATE_COUNT; extern const size_t CONSTANT_COUNT; extern const size_t COMPUTED_CONSTANT_COUNT; extern const size_t ALGEBRAIC_COUNT; +extern const size_t EXTERNAL_COUNT; typedef enum { VARIABLE_OF_INTEGRATION, diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.py index 9a8335d0d7..b78d3d5880 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.py @@ -11,6 +11,7 @@ CONSTANT_COUNT = 0 COMPUTED_CONSTANT_COUNT = 0 ALGEBRAIC_COUNT = 18 +EXTERNAL_COUNT = 0 class VariableType(Enum): diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.c index 228073aca6..cfcaf93f2c 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.c @@ -12,6 +12,7 @@ const size_t STATE_COUNT = 4; const size_t CONSTANT_COUNT = 0; const size_t COMPUTED_CONSTANT_COUNT = 0; const size_t ALGEBRAIC_COUNT = 18; +const size_t EXTERNAL_COUNT = 0; const VariableInfo VOI_INFO = {"time", "millisecond", "environment", VARIABLE_OF_INTEGRATION}; diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.h index 2379ada7dc..be76c88f61 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.h +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.h @@ -11,6 +11,7 @@ extern const size_t STATE_COUNT; extern const size_t CONSTANT_COUNT; extern const size_t COMPUTED_CONSTANT_COUNT; extern const size_t ALGEBRAIC_COUNT; +extern const size_t EXTERNAL_COUNT; typedef enum { VARIABLE_OF_INTEGRATION, diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.py index e9fe6851dd..fbc3704f87 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.py @@ -11,6 +11,7 @@ CONSTANT_COUNT = 0 COMPUTED_CONSTANT_COUNT = 0 ALGEBRAIC_COUNT = 18 +EXTERNAL_COUNT = 0 class VariableType(Enum): diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.c index 1967097424..2da76b8e8d 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.c @@ -12,6 +12,7 @@ const size_t STATE_COUNT = 4; const size_t CONSTANT_COUNT = 0; const size_t COMPUTED_CONSTANT_COUNT = 0; const size_t ALGEBRAIC_COUNT = 18; +const size_t EXTERNAL_COUNT = 0; const VariableInfo VOI_INFO = {"time", "millisecond", "environment", VARIABLE_OF_INTEGRATION}; diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.h index 3435c028a3..8ae5a3e5dd 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.h +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.h @@ -11,6 +11,7 @@ extern const size_t STATE_COUNT; extern const size_t CONSTANT_COUNT; extern const size_t COMPUTED_CONSTANT_COUNT; extern const size_t ALGEBRAIC_COUNT; +extern const size_t EXTERNAL_COUNT; typedef enum { VARIABLE_OF_INTEGRATION, diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.py index 006bf3b125..4a645f0713 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.py @@ -11,6 +11,7 @@ CONSTANT_COUNT = 0 COMPUTED_CONSTANT_COUNT = 0 ALGEBRAIC_COUNT = 18 +EXTERNAL_COUNT = 0 class VariableType(Enum): diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.c index 96ead04c70..50798a7967 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.c @@ -12,6 +12,7 @@ const size_t STATE_COUNT = 4; const size_t CONSTANT_COUNT = 0; const size_t COMPUTED_CONSTANT_COUNT = 0; const size_t ALGEBRAIC_COUNT = 18; +const size_t EXTERNAL_COUNT = 0; const VariableInfo VOI_INFO = {"time", "millisecond", "environment", VARIABLE_OF_INTEGRATION}; diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.h index 3435c028a3..8ae5a3e5dd 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.h +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.h @@ -11,6 +11,7 @@ extern const size_t STATE_COUNT; extern const size_t CONSTANT_COUNT; extern const size_t COMPUTED_CONSTANT_COUNT; extern const size_t ALGEBRAIC_COUNT; +extern const size_t EXTERNAL_COUNT; typedef enum { VARIABLE_OF_INTEGRATION, diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.py index c3a219727a..e83d4154ec 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.py @@ -11,6 +11,7 @@ CONSTANT_COUNT = 0 COMPUTED_CONSTANT_COUNT = 0 ALGEBRAIC_COUNT = 18 +EXTERNAL_COUNT = 0 class VariableType(Enum): diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.c index e78468a05c..c608b0c7f5 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.c @@ -12,6 +12,7 @@ const size_t STATE_COUNT = 4; const size_t CONSTANT_COUNT = 0; const size_t COMPUTED_CONSTANT_COUNT = 0; const size_t ALGEBRAIC_COUNT = 18; +const size_t EXTERNAL_COUNT = 0; const VariableInfo VOI_INFO = {"time", "millisecond", "environment", VARIABLE_OF_INTEGRATION}; diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.h index 3435c028a3..8ae5a3e5dd 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.h +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.h @@ -11,6 +11,7 @@ extern const size_t STATE_COUNT; extern const size_t CONSTANT_COUNT; extern const size_t COMPUTED_CONSTANT_COUNT; extern const size_t ALGEBRAIC_COUNT; +extern const size_t EXTERNAL_COUNT; typedef enum { VARIABLE_OF_INTEGRATION, diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.py index fb7c5c7ffc..81364cfcb3 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.py @@ -11,6 +11,7 @@ CONSTANT_COUNT = 0 COMPUTED_CONSTANT_COUNT = 0 ALGEBRAIC_COUNT = 18 +EXTERNAL_COUNT = 0 class VariableType(Enum): diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.c index daca5bba88..5627364ba8 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.c @@ -12,6 +12,7 @@ const size_t STATE_COUNT = 2; const size_t CONSTANT_COUNT = 0; const size_t COMPUTED_CONSTANT_COUNT = 0; const size_t ALGEBRAIC_COUNT = 20; +const size_t EXTERNAL_COUNT = 0; const VariableInfo VOI_INFO = {"time", "millisecond", "environment", VARIABLE_OF_INTEGRATION}; diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.h index 3435c028a3..8ae5a3e5dd 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.h +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.h @@ -11,6 +11,7 @@ extern const size_t STATE_COUNT; extern const size_t CONSTANT_COUNT; extern const size_t COMPUTED_CONSTANT_COUNT; extern const size_t ALGEBRAIC_COUNT; +extern const size_t EXTERNAL_COUNT; typedef enum { VARIABLE_OF_INTEGRATION, diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.py index 02be0961dc..d887340c1b 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.py @@ -11,6 +11,7 @@ CONSTANT_COUNT = 0 COMPUTED_CONSTANT_COUNT = 0 ALGEBRAIC_COUNT = 20 +EXTERNAL_COUNT = 0 class VariableType(Enum): diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.c index 6daaf81cff..329a24f94a 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.c @@ -12,6 +12,7 @@ const size_t STATE_COUNT = 3; const size_t CONSTANT_COUNT = 0; const size_t COMPUTED_CONSTANT_COUNT = 0; const size_t ALGEBRAIC_COUNT = 19; +const size_t EXTERNAL_COUNT = 0; const VariableInfo VOI_INFO = {"time", "millisecond", "environment", VARIABLE_OF_INTEGRATION}; diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.h index 3435c028a3..8ae5a3e5dd 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.h +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.h @@ -11,6 +11,7 @@ extern const size_t STATE_COUNT; extern const size_t CONSTANT_COUNT; extern const size_t COMPUTED_CONSTANT_COUNT; extern const size_t ALGEBRAIC_COUNT; +extern const size_t EXTERNAL_COUNT; typedef enum { VARIABLE_OF_INTEGRATION, diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.py index 0cbe773e17..019a0c8577 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.py @@ -11,6 +11,7 @@ CONSTANT_COUNT = 0 COMPUTED_CONSTANT_COUNT = 0 ALGEBRAIC_COUNT = 19 +EXTERNAL_COUNT = 0 class VariableType(Enum): diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.h index 2379ada7dc..be76c88f61 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.h +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.h @@ -11,6 +11,7 @@ extern const size_t STATE_COUNT; extern const size_t CONSTANT_COUNT; extern const size_t COMPUTED_CONSTANT_COUNT; extern const size_t ALGEBRAIC_COUNT; +extern const size_t EXTERNAL_COUNT; typedef enum { VARIABLE_OF_INTEGRATION, diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.py index 68e90fdd0d..b37f2884e9 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.py @@ -11,6 +11,7 @@ CONSTANT_COUNT = 0 COMPUTED_CONSTANT_COUNT = 0 ALGEBRAIC_COUNT = 18 +EXTERNAL_COUNT = 0 class VariableType(Enum): diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.c index fa7028471e..1f5098cc59 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.c @@ -12,6 +12,7 @@ const size_t STATE_COUNT = 3; const size_t CONSTANT_COUNT = 0; const size_t COMPUTED_CONSTANT_COUNT = 0; const size_t ALGEBRAIC_COUNT = 19; +const size_t EXTERNAL_COUNT = 0; const VariableInfo VOI_INFO = {"time", "millisecond", "environment", VARIABLE_OF_INTEGRATION}; diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.h index 3435c028a3..8ae5a3e5dd 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.h +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.h @@ -11,6 +11,7 @@ extern const size_t STATE_COUNT; extern const size_t CONSTANT_COUNT; extern const size_t COMPUTED_CONSTANT_COUNT; extern const size_t ALGEBRAIC_COUNT; +extern const size_t EXTERNAL_COUNT; typedef enum { VARIABLE_OF_INTEGRATION, diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.py index d1748c002e..b68a159ffe 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.py @@ -11,6 +11,7 @@ CONSTANT_COUNT = 0 COMPUTED_CONSTANT_COUNT = 0 ALGEBRAIC_COUNT = 19 +EXTERNAL_COUNT = 0 class VariableType(Enum): diff --git a/tests/resources/generator/noble_model_1962/model.c b/tests/resources/generator/noble_model_1962/model.c index d0434bbc61..b2b3956e7f 100644 --- a/tests/resources/generator/noble_model_1962/model.c +++ b/tests/resources/generator/noble_model_1962/model.c @@ -12,6 +12,7 @@ const size_t STATE_COUNT = 4; const size_t CONSTANT_COUNT = 0; const size_t COMPUTED_CONSTANT_COUNT = 0; const size_t ALGEBRAIC_COUNT = 17; +const size_t EXTERNAL_COUNT = 0; const VariableInfo VOI_INFO = {"time", "millisecond", "environment", VARIABLE_OF_INTEGRATION}; diff --git a/tests/resources/generator/noble_model_1962/model.h b/tests/resources/generator/noble_model_1962/model.h index a4c365da25..8149205d0d 100644 --- a/tests/resources/generator/noble_model_1962/model.h +++ b/tests/resources/generator/noble_model_1962/model.h @@ -11,6 +11,7 @@ extern const size_t STATE_COUNT; extern const size_t CONSTANT_COUNT; extern const size_t COMPUTED_CONSTANT_COUNT; extern const size_t ALGEBRAIC_COUNT; +extern const size_t EXTERNAL_COUNT; typedef enum { VARIABLE_OF_INTEGRATION, diff --git a/tests/resources/generator/noble_model_1962/model.py b/tests/resources/generator/noble_model_1962/model.py index 04b3307a0c..8fb96500a0 100644 --- a/tests/resources/generator/noble_model_1962/model.py +++ b/tests/resources/generator/noble_model_1962/model.py @@ -11,6 +11,7 @@ CONSTANT_COUNT = 0 COMPUTED_CONSTANT_COUNT = 0 ALGEBRAIC_COUNT = 17 +EXTERNAL_COUNT = 0 class VariableType(Enum): diff --git a/tests/resources/generator/ode_computed_var_on_rhs/model.c b/tests/resources/generator/ode_computed_var_on_rhs/model.c index 1bf89a3b88..4e94793685 100644 --- a/tests/resources/generator/ode_computed_var_on_rhs/model.c +++ b/tests/resources/generator/ode_computed_var_on_rhs/model.c @@ -12,6 +12,7 @@ const size_t STATE_COUNT = 1; const size_t CONSTANT_COUNT = 0; const size_t COMPUTED_CONSTANT_COUNT = 0; const size_t ALGEBRAIC_COUNT = 1; +const size_t EXTERNAL_COUNT = 0; const VariableInfo VOI_INFO = {"t", "second", "environment", VARIABLE_OF_INTEGRATION}; diff --git a/tests/resources/generator/ode_computed_var_on_rhs/model.h b/tests/resources/generator/ode_computed_var_on_rhs/model.h index 3f1fb63fd2..cc72c5b3a4 100644 --- a/tests/resources/generator/ode_computed_var_on_rhs/model.h +++ b/tests/resources/generator/ode_computed_var_on_rhs/model.h @@ -11,6 +11,7 @@ extern const size_t STATE_COUNT; extern const size_t CONSTANT_COUNT; extern const size_t COMPUTED_CONSTANT_COUNT; extern const size_t ALGEBRAIC_COUNT; +extern const size_t EXTERNAL_COUNT; typedef enum { VARIABLE_OF_INTEGRATION, diff --git a/tests/resources/generator/ode_computed_var_on_rhs/model.py b/tests/resources/generator/ode_computed_var_on_rhs/model.py index e60d2476d8..4c7b0bfdfa 100644 --- a/tests/resources/generator/ode_computed_var_on_rhs/model.py +++ b/tests/resources/generator/ode_computed_var_on_rhs/model.py @@ -11,6 +11,7 @@ CONSTANT_COUNT = 0 COMPUTED_CONSTANT_COUNT = 0 ALGEBRAIC_COUNT = 1 +EXTERNAL_COUNT = 0 class VariableType(Enum): diff --git a/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.c b/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.c index cf371f670a..9462cd1ded 100644 --- a/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.c +++ b/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.c @@ -12,6 +12,7 @@ const size_t STATE_COUNT = 1; const size_t CONSTANT_COUNT = 0; const size_t COMPUTED_CONSTANT_COUNT = 0; const size_t ALGEBRAIC_COUNT = 1; +const size_t EXTERNAL_COUNT = 0; const VariableInfo VOI_INFO = {"t", "second", "my_component", VARIABLE_OF_INTEGRATION}; diff --git a/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.h b/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.h index ca79cc5f25..89890cfa68 100644 --- a/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.h +++ b/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.h @@ -11,6 +11,7 @@ extern const size_t STATE_COUNT; extern const size_t CONSTANT_COUNT; extern const size_t COMPUTED_CONSTANT_COUNT; extern const size_t ALGEBRAIC_COUNT; +extern const size_t EXTERNAL_COUNT; typedef enum { VARIABLE_OF_INTEGRATION, diff --git a/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.py b/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.py index 847ad0446a..ff803cc8f1 100644 --- a/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.py +++ b/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.py @@ -11,6 +11,7 @@ CONSTANT_COUNT = 0 COMPUTED_CONSTANT_COUNT = 0 ALGEBRAIC_COUNT = 1 +EXTERNAL_COUNT = 0 class VariableType(Enum): diff --git a/tests/resources/generator/ode_const_var_on_rhs/model.c b/tests/resources/generator/ode_const_var_on_rhs/model.c index da29f52f60..6c6342e787 100644 --- a/tests/resources/generator/ode_const_var_on_rhs/model.c +++ b/tests/resources/generator/ode_const_var_on_rhs/model.c @@ -12,6 +12,7 @@ const size_t STATE_COUNT = 1; const size_t CONSTANT_COUNT = 0; const size_t COMPUTED_CONSTANT_COUNT = 0; const size_t ALGEBRAIC_COUNT = 1; +const size_t EXTERNAL_COUNT = 0; const VariableInfo VOI_INFO = {"t", "second", "environment", VARIABLE_OF_INTEGRATION}; diff --git a/tests/resources/generator/ode_const_var_on_rhs/model.h b/tests/resources/generator/ode_const_var_on_rhs/model.h index 3f1fb63fd2..cc72c5b3a4 100644 --- a/tests/resources/generator/ode_const_var_on_rhs/model.h +++ b/tests/resources/generator/ode_const_var_on_rhs/model.h @@ -11,6 +11,7 @@ extern const size_t STATE_COUNT; extern const size_t CONSTANT_COUNT; extern const size_t COMPUTED_CONSTANT_COUNT; extern const size_t ALGEBRAIC_COUNT; +extern const size_t EXTERNAL_COUNT; typedef enum { VARIABLE_OF_INTEGRATION, diff --git a/tests/resources/generator/ode_const_var_on_rhs/model.py b/tests/resources/generator/ode_const_var_on_rhs/model.py index 351e628e47..283bdd003b 100644 --- a/tests/resources/generator/ode_const_var_on_rhs/model.py +++ b/tests/resources/generator/ode_const_var_on_rhs/model.py @@ -11,6 +11,7 @@ CONSTANT_COUNT = 0 COMPUTED_CONSTANT_COUNT = 0 ALGEBRAIC_COUNT = 1 +EXTERNAL_COUNT = 0 class VariableType(Enum): diff --git a/tests/resources/generator/ode_const_var_on_rhs_one_component/model.c b/tests/resources/generator/ode_const_var_on_rhs_one_component/model.c index 9f18d3d5e9..0b0fb3bb34 100644 --- a/tests/resources/generator/ode_const_var_on_rhs_one_component/model.c +++ b/tests/resources/generator/ode_const_var_on_rhs_one_component/model.c @@ -12,6 +12,7 @@ const size_t STATE_COUNT = 1; const size_t CONSTANT_COUNT = 0; const size_t COMPUTED_CONSTANT_COUNT = 0; const size_t ALGEBRAIC_COUNT = 1; +const size_t EXTERNAL_COUNT = 0; const VariableInfo VOI_INFO = {"t", "second", "my_component", VARIABLE_OF_INTEGRATION}; diff --git a/tests/resources/generator/ode_const_var_on_rhs_one_component/model.h b/tests/resources/generator/ode_const_var_on_rhs_one_component/model.h index ca79cc5f25..89890cfa68 100644 --- a/tests/resources/generator/ode_const_var_on_rhs_one_component/model.h +++ b/tests/resources/generator/ode_const_var_on_rhs_one_component/model.h @@ -11,6 +11,7 @@ extern const size_t STATE_COUNT; extern const size_t CONSTANT_COUNT; extern const size_t COMPUTED_CONSTANT_COUNT; extern const size_t ALGEBRAIC_COUNT; +extern const size_t EXTERNAL_COUNT; typedef enum { VARIABLE_OF_INTEGRATION, diff --git a/tests/resources/generator/ode_const_var_on_rhs_one_component/model.py b/tests/resources/generator/ode_const_var_on_rhs_one_component/model.py index 0ed240fa53..986a9feb16 100644 --- a/tests/resources/generator/ode_const_var_on_rhs_one_component/model.py +++ b/tests/resources/generator/ode_const_var_on_rhs_one_component/model.py @@ -11,6 +11,7 @@ CONSTANT_COUNT = 0 COMPUTED_CONSTANT_COUNT = 0 ALGEBRAIC_COUNT = 1 +EXTERNAL_COUNT = 0 class VariableType(Enum): diff --git a/tests/resources/generator/ode_constant_on_rhs/model.c b/tests/resources/generator/ode_constant_on_rhs/model.c index 71e7ea5a8a..83124f7ed9 100644 --- a/tests/resources/generator/ode_constant_on_rhs/model.c +++ b/tests/resources/generator/ode_constant_on_rhs/model.c @@ -12,6 +12,7 @@ const size_t STATE_COUNT = 1; const size_t CONSTANT_COUNT = 0; const size_t COMPUTED_CONSTANT_COUNT = 0; const size_t ALGEBRAIC_COUNT = 0; +const size_t EXTERNAL_COUNT = 0; const VariableInfo VOI_INFO = {"t", "second", "environment", VARIABLE_OF_INTEGRATION}; diff --git a/tests/resources/generator/ode_constant_on_rhs/model.h b/tests/resources/generator/ode_constant_on_rhs/model.h index 3f1fb63fd2..cc72c5b3a4 100644 --- a/tests/resources/generator/ode_constant_on_rhs/model.h +++ b/tests/resources/generator/ode_constant_on_rhs/model.h @@ -11,6 +11,7 @@ extern const size_t STATE_COUNT; extern const size_t CONSTANT_COUNT; extern const size_t COMPUTED_CONSTANT_COUNT; extern const size_t ALGEBRAIC_COUNT; +extern const size_t EXTERNAL_COUNT; typedef enum { VARIABLE_OF_INTEGRATION, diff --git a/tests/resources/generator/ode_constant_on_rhs/model.py b/tests/resources/generator/ode_constant_on_rhs/model.py index bc525feb58..00b49ef0fe 100644 --- a/tests/resources/generator/ode_constant_on_rhs/model.py +++ b/tests/resources/generator/ode_constant_on_rhs/model.py @@ -11,6 +11,7 @@ CONSTANT_COUNT = 0 COMPUTED_CONSTANT_COUNT = 0 ALGEBRAIC_COUNT = 0 +EXTERNAL_COUNT = 0 class VariableType(Enum): diff --git a/tests/resources/generator/ode_constant_on_rhs_one_component/model.c b/tests/resources/generator/ode_constant_on_rhs_one_component/model.c index a37c8889b6..997ae718f5 100644 --- a/tests/resources/generator/ode_constant_on_rhs_one_component/model.c +++ b/tests/resources/generator/ode_constant_on_rhs_one_component/model.c @@ -12,6 +12,7 @@ const size_t STATE_COUNT = 1; const size_t CONSTANT_COUNT = 0; const size_t COMPUTED_CONSTANT_COUNT = 0; const size_t ALGEBRAIC_COUNT = 0; +const size_t EXTERNAL_COUNT = 0; const VariableInfo VOI_INFO = {"t", "second", "my_component", VARIABLE_OF_INTEGRATION}; diff --git a/tests/resources/generator/ode_constant_on_rhs_one_component/model.h b/tests/resources/generator/ode_constant_on_rhs_one_component/model.h index ca79cc5f25..89890cfa68 100644 --- a/tests/resources/generator/ode_constant_on_rhs_one_component/model.h +++ b/tests/resources/generator/ode_constant_on_rhs_one_component/model.h @@ -11,6 +11,7 @@ extern const size_t STATE_COUNT; extern const size_t CONSTANT_COUNT; extern const size_t COMPUTED_CONSTANT_COUNT; extern const size_t ALGEBRAIC_COUNT; +extern const size_t EXTERNAL_COUNT; typedef enum { VARIABLE_OF_INTEGRATION, diff --git a/tests/resources/generator/ode_constant_on_rhs_one_component/model.py b/tests/resources/generator/ode_constant_on_rhs_one_component/model.py index 22311d1da6..72fd031fc9 100644 --- a/tests/resources/generator/ode_constant_on_rhs_one_component/model.py +++ b/tests/resources/generator/ode_constant_on_rhs_one_component/model.py @@ -11,6 +11,7 @@ CONSTANT_COUNT = 0 COMPUTED_CONSTANT_COUNT = 0 ALGEBRAIC_COUNT = 0 +EXTERNAL_COUNT = 0 class VariableType(Enum): diff --git a/tests/resources/generator/ode_multiple_dependent_odes/model.c b/tests/resources/generator/ode_multiple_dependent_odes/model.c index 89cfc22b72..6d83c015ca 100644 --- a/tests/resources/generator/ode_multiple_dependent_odes/model.c +++ b/tests/resources/generator/ode_multiple_dependent_odes/model.c @@ -12,6 +12,7 @@ const size_t STATE_COUNT = 2; const size_t CONSTANT_COUNT = 0; const size_t COMPUTED_CONSTANT_COUNT = 0; const size_t ALGEBRAIC_COUNT = 1; +const size_t EXTERNAL_COUNT = 0; const VariableInfo VOI_INFO = {"t", "second", "environment", VARIABLE_OF_INTEGRATION}; diff --git a/tests/resources/generator/ode_multiple_dependent_odes/model.h b/tests/resources/generator/ode_multiple_dependent_odes/model.h index cc74aaa0bd..14013eaefa 100644 --- a/tests/resources/generator/ode_multiple_dependent_odes/model.h +++ b/tests/resources/generator/ode_multiple_dependent_odes/model.h @@ -11,6 +11,7 @@ extern const size_t STATE_COUNT; extern const size_t CONSTANT_COUNT; extern const size_t COMPUTED_CONSTANT_COUNT; extern const size_t ALGEBRAIC_COUNT; +extern const size_t EXTERNAL_COUNT; typedef enum { VARIABLE_OF_INTEGRATION, diff --git a/tests/resources/generator/ode_multiple_dependent_odes/model.py b/tests/resources/generator/ode_multiple_dependent_odes/model.py index 34b35116b6..9f9df39e8b 100644 --- a/tests/resources/generator/ode_multiple_dependent_odes/model.py +++ b/tests/resources/generator/ode_multiple_dependent_odes/model.py @@ -11,6 +11,7 @@ CONSTANT_COUNT = 0 COMPUTED_CONSTANT_COUNT = 0 ALGEBRAIC_COUNT = 1 +EXTERNAL_COUNT = 0 class VariableType(Enum): diff --git a/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.c b/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.c index 00d0e6e7a7..21f46b37f5 100644 --- a/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.c +++ b/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.c @@ -12,6 +12,7 @@ const size_t STATE_COUNT = 2; const size_t CONSTANT_COUNT = 0; const size_t COMPUTED_CONSTANT_COUNT = 0; const size_t ALGEBRAIC_COUNT = 1; +const size_t EXTERNAL_COUNT = 0; const VariableInfo VOI_INFO = {"t", "second", "my_component", VARIABLE_OF_INTEGRATION}; diff --git a/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.h b/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.h index f0d48d38d5..2c7d5a183c 100644 --- a/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.h +++ b/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.h @@ -11,6 +11,7 @@ extern const size_t STATE_COUNT; extern const size_t CONSTANT_COUNT; extern const size_t COMPUTED_CONSTANT_COUNT; extern const size_t ALGEBRAIC_COUNT; +extern const size_t EXTERNAL_COUNT; typedef enum { VARIABLE_OF_INTEGRATION, diff --git a/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.py b/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.py index 59377dde9e..b4fff77d2c 100644 --- a/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.py +++ b/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.py @@ -11,6 +11,7 @@ CONSTANT_COUNT = 0 COMPUTED_CONSTANT_COUNT = 0 ALGEBRAIC_COUNT = 1 +EXTERNAL_COUNT = 0 class VariableType(Enum): diff --git a/tests/resources/generator/ode_multiple_odes_with_same_name/model.c b/tests/resources/generator/ode_multiple_odes_with_same_name/model.c index b3c86f5bbf..4612882189 100644 --- a/tests/resources/generator/ode_multiple_odes_with_same_name/model.c +++ b/tests/resources/generator/ode_multiple_odes_with_same_name/model.c @@ -12,6 +12,7 @@ const size_t STATE_COUNT = 2; const size_t CONSTANT_COUNT = 0; const size_t COMPUTED_CONSTANT_COUNT = 0; const size_t ALGEBRAIC_COUNT = 1; +const size_t EXTERNAL_COUNT = 0; const VariableInfo VOI_INFO = {"t", "second", "environment", VARIABLE_OF_INTEGRATION}; diff --git a/tests/resources/generator/ode_multiple_odes_with_same_name/model.h b/tests/resources/generator/ode_multiple_odes_with_same_name/model.h index 0b0953abe2..d4cb731d44 100644 --- a/tests/resources/generator/ode_multiple_odes_with_same_name/model.h +++ b/tests/resources/generator/ode_multiple_odes_with_same_name/model.h @@ -11,6 +11,7 @@ extern const size_t STATE_COUNT; extern const size_t CONSTANT_COUNT; extern const size_t COMPUTED_CONSTANT_COUNT; extern const size_t ALGEBRAIC_COUNT; +extern const size_t EXTERNAL_COUNT; typedef enum { VARIABLE_OF_INTEGRATION, diff --git a/tests/resources/generator/ode_multiple_odes_with_same_name/model.py b/tests/resources/generator/ode_multiple_odes_with_same_name/model.py index 93bd5d2fd4..67babcba79 100644 --- a/tests/resources/generator/ode_multiple_odes_with_same_name/model.py +++ b/tests/resources/generator/ode_multiple_odes_with_same_name/model.py @@ -11,6 +11,7 @@ CONSTANT_COUNT = 0 COMPUTED_CONSTANT_COUNT = 0 ALGEBRAIC_COUNT = 1 +EXTERNAL_COUNT = 0 class VariableType(Enum): diff --git a/tests/resources/generator/ode_unknown_var_on_rhs/model.c b/tests/resources/generator/ode_unknown_var_on_rhs/model.c index 0b29e548b4..e464292324 100644 --- a/tests/resources/generator/ode_unknown_var_on_rhs/model.c +++ b/tests/resources/generator/ode_unknown_var_on_rhs/model.c @@ -12,6 +12,7 @@ const size_t STATE_COUNT = 2; const size_t CONSTANT_COUNT = 0; const size_t COMPUTED_CONSTANT_COUNT = 0; const size_t ALGEBRAIC_COUNT = 0; +const size_t EXTERNAL_COUNT = 0; const VariableInfo VOI_INFO = {"t", "second", "environment", VARIABLE_OF_INTEGRATION}; diff --git a/tests/resources/generator/ode_unknown_var_on_rhs/model.h b/tests/resources/generator/ode_unknown_var_on_rhs/model.h index 3f1fb63fd2..cc72c5b3a4 100644 --- a/tests/resources/generator/ode_unknown_var_on_rhs/model.h +++ b/tests/resources/generator/ode_unknown_var_on_rhs/model.h @@ -11,6 +11,7 @@ extern const size_t STATE_COUNT; extern const size_t CONSTANT_COUNT; extern const size_t COMPUTED_CONSTANT_COUNT; extern const size_t ALGEBRAIC_COUNT; +extern const size_t EXTERNAL_COUNT; typedef enum { VARIABLE_OF_INTEGRATION, diff --git a/tests/resources/generator/ode_unknown_var_on_rhs/model.py b/tests/resources/generator/ode_unknown_var_on_rhs/model.py index 2f19ddc26b..a19fdebbf8 100644 --- a/tests/resources/generator/ode_unknown_var_on_rhs/model.py +++ b/tests/resources/generator/ode_unknown_var_on_rhs/model.py @@ -11,6 +11,7 @@ CONSTANT_COUNT = 0 COMPUTED_CONSTANT_COUNT = 0 ALGEBRAIC_COUNT = 0 +EXTERNAL_COUNT = 0 class VariableType(Enum): diff --git a/tests/resources/generator/robertson_model_1966/model.dae.c b/tests/resources/generator/robertson_model_1966/model.dae.c index 90bfcb5131..63de63a9fc 100644 --- a/tests/resources/generator/robertson_model_1966/model.dae.c +++ b/tests/resources/generator/robertson_model_1966/model.dae.c @@ -12,6 +12,7 @@ const size_t STATE_COUNT = 2; const size_t CONSTANT_COUNT = 0; const size_t COMPUTED_CONSTANT_COUNT = 0; const size_t ALGEBRAIC_COUNT = 5; +const size_t EXTERNAL_COUNT = 0; const VariableInfo VOI_INFO = {"t", "dimensionless", "main", VARIABLE_OF_INTEGRATION}; diff --git a/tests/resources/generator/robertson_model_1966/model.dae.h b/tests/resources/generator/robertson_model_1966/model.dae.h index bca2cef3a4..653f64a637 100644 --- a/tests/resources/generator/robertson_model_1966/model.dae.h +++ b/tests/resources/generator/robertson_model_1966/model.dae.h @@ -11,6 +11,7 @@ extern const size_t STATE_COUNT; extern const size_t CONSTANT_COUNT; extern const size_t COMPUTED_CONSTANT_COUNT; extern const size_t ALGEBRAIC_COUNT; +extern const size_t EXTERNAL_COUNT; typedef enum { VARIABLE_OF_INTEGRATION, diff --git a/tests/resources/generator/robertson_model_1966/model.dae.py b/tests/resources/generator/robertson_model_1966/model.dae.py index 034f6a13c4..b5f40fc30a 100644 --- a/tests/resources/generator/robertson_model_1966/model.dae.py +++ b/tests/resources/generator/robertson_model_1966/model.dae.py @@ -11,6 +11,7 @@ CONSTANT_COUNT = 0 COMPUTED_CONSTANT_COUNT = 0 ALGEBRAIC_COUNT = 5 +EXTERNAL_COUNT = 0 class VariableType(Enum): diff --git a/tests/resources/generator/robertson_model_1966/model.ode.c b/tests/resources/generator/robertson_model_1966/model.ode.c index 51c94697bc..0bc157d926 100644 --- a/tests/resources/generator/robertson_model_1966/model.ode.c +++ b/tests/resources/generator/robertson_model_1966/model.ode.c @@ -12,6 +12,7 @@ const size_t STATE_COUNT = 3; const size_t CONSTANT_COUNT = 0; const size_t COMPUTED_CONSTANT_COUNT = 0; const size_t ALGEBRAIC_COUNT = 4; +const size_t EXTERNAL_COUNT = 0; const VariableInfo VOI_INFO = {"t", "dimensionless", "main", VARIABLE_OF_INTEGRATION}; diff --git a/tests/resources/generator/robertson_model_1966/model.ode.h b/tests/resources/generator/robertson_model_1966/model.ode.h index bca2cef3a4..653f64a637 100644 --- a/tests/resources/generator/robertson_model_1966/model.ode.h +++ b/tests/resources/generator/robertson_model_1966/model.ode.h @@ -11,6 +11,7 @@ extern const size_t STATE_COUNT; extern const size_t CONSTANT_COUNT; extern const size_t COMPUTED_CONSTANT_COUNT; extern const size_t ALGEBRAIC_COUNT; +extern const size_t EXTERNAL_COUNT; typedef enum { VARIABLE_OF_INTEGRATION, diff --git a/tests/resources/generator/robertson_model_1966/model.ode.py b/tests/resources/generator/robertson_model_1966/model.ode.py index f702e804d8..f96e5d8786 100644 --- a/tests/resources/generator/robertson_model_1966/model.ode.py +++ b/tests/resources/generator/robertson_model_1966/model.ode.py @@ -11,6 +11,7 @@ CONSTANT_COUNT = 0 COMPUTED_CONSTANT_COUNT = 0 ALGEBRAIC_COUNT = 4 +EXTERNAL_COUNT = 0 class VariableType(Enum): diff --git a/tests/resources/generator/sine_model_imports/model.c b/tests/resources/generator/sine_model_imports/model.c index 0f52edcd58..02fb665ff0 100644 --- a/tests/resources/generator/sine_model_imports/model.c +++ b/tests/resources/generator/sine_model_imports/model.c @@ -12,6 +12,7 @@ const size_t STATE_COUNT = 1; const size_t CONSTANT_COUNT = 0; const size_t COMPUTED_CONSTANT_COUNT = 0; const size_t ALGEBRAIC_COUNT = 10; +const size_t EXTERNAL_COUNT = 0; const VariableInfo VOI_INFO = {"x", "dimensionless", "main", VARIABLE_OF_INTEGRATION}; diff --git a/tests/resources/generator/sine_model_imports/model.h b/tests/resources/generator/sine_model_imports/model.h index 93c965f336..ad2862fae3 100644 --- a/tests/resources/generator/sine_model_imports/model.h +++ b/tests/resources/generator/sine_model_imports/model.h @@ -11,6 +11,7 @@ extern const size_t STATE_COUNT; extern const size_t CONSTANT_COUNT; extern const size_t COMPUTED_CONSTANT_COUNT; extern const size_t ALGEBRAIC_COUNT; +extern const size_t EXTERNAL_COUNT; typedef enum { VARIABLE_OF_INTEGRATION, diff --git a/tests/resources/generator/sine_model_imports/model.py b/tests/resources/generator/sine_model_imports/model.py index 065f85ab7c..4c559e5e17 100644 --- a/tests/resources/generator/sine_model_imports/model.py +++ b/tests/resources/generator/sine_model_imports/model.py @@ -11,6 +11,7 @@ CONSTANT_COUNT = 0 COMPUTED_CONSTANT_COUNT = 0 ALGEBRAIC_COUNT = 10 +EXTERNAL_COUNT = 0 class VariableType(Enum): diff --git a/tests/resources/generator/unknown_variable_as_external_variable/model.c b/tests/resources/generator/unknown_variable_as_external_variable/model.c index db7744dbb3..015da83af5 100644 --- a/tests/resources/generator/unknown_variable_as_external_variable/model.c +++ b/tests/resources/generator/unknown_variable_as_external_variable/model.c @@ -11,6 +11,7 @@ const char LIBCELLML_VERSION[] = "0.5.0"; const size_t CONSTANT_COUNT = 0; const size_t COMPUTED_CONSTANT_COUNT = 0; const size_t ALGEBRAIC_COUNT = 10; +const size_t EXTERNAL_COUNT = 0; const VariableInfo VARIABLE_INFO[] = { {"v", "fmol_per_sec", "SLC_template3_ss", ALGEBRAIC}, diff --git a/tests/resources/generator/unknown_variable_as_external_variable/model.h b/tests/resources/generator/unknown_variable_as_external_variable/model.h index 774d637533..92576c047d 100644 --- a/tests/resources/generator/unknown_variable_as_external_variable/model.h +++ b/tests/resources/generator/unknown_variable_as_external_variable/model.h @@ -10,6 +10,7 @@ extern const char LIBCELLML_VERSION[]; extern const size_t CONSTANT_COUNT; extern const size_t COMPUTED_CONSTANT_COUNT; extern const size_t ALGEBRAIC_COUNT; +extern const size_t EXTERNAL_COUNT; typedef enum { CONSTANT, diff --git a/tests/resources/generator/unknown_variable_as_external_variable/model.py b/tests/resources/generator/unknown_variable_as_external_variable/model.py index f07ad2cca3..e09f76a957 100644 --- a/tests/resources/generator/unknown_variable_as_external_variable/model.py +++ b/tests/resources/generator/unknown_variable_as_external_variable/model.py @@ -10,6 +10,7 @@ CONSTANT_COUNT = 0 COMPUTED_CONSTANT_COUNT = 0 ALGEBRAIC_COUNT = 10 +EXTERNAL_COUNT = 0 class VariableType(Enum): diff --git a/tests/resources/generator/variable_initialised_using_a_constant/model.c b/tests/resources/generator/variable_initialised_using_a_constant/model.c index 79800b918a..004fa4ce55 100644 --- a/tests/resources/generator/variable_initialised_using_a_constant/model.c +++ b/tests/resources/generator/variable_initialised_using_a_constant/model.c @@ -12,6 +12,7 @@ const size_t STATE_COUNT = 1; const size_t CONSTANT_COUNT = 0; const size_t COMPUTED_CONSTANT_COUNT = 0; const size_t ALGEBRAIC_COUNT = 1; +const size_t EXTERNAL_COUNT = 0; const VariableInfo VOI_INFO = {"t", "second", "component_1", VARIABLE_OF_INTEGRATION}; diff --git a/tests/resources/generator/variable_initialised_using_a_constant/model.h b/tests/resources/generator/variable_initialised_using_a_constant/model.h index 340f578dd8..890a583bb2 100644 --- a/tests/resources/generator/variable_initialised_using_a_constant/model.h +++ b/tests/resources/generator/variable_initialised_using_a_constant/model.h @@ -11,6 +11,7 @@ extern const size_t STATE_COUNT; extern const size_t CONSTANT_COUNT; extern const size_t COMPUTED_CONSTANT_COUNT; extern const size_t ALGEBRAIC_COUNT; +extern const size_t EXTERNAL_COUNT; typedef enum { VARIABLE_OF_INTEGRATION, diff --git a/tests/resources/generator/variable_initialised_using_a_constant/model.py b/tests/resources/generator/variable_initialised_using_a_constant/model.py index 54a1159391..0c4afd7307 100644 --- a/tests/resources/generator/variable_initialised_using_a_constant/model.py +++ b/tests/resources/generator/variable_initialised_using_a_constant/model.py @@ -11,6 +11,7 @@ CONSTANT_COUNT = 0 COMPUTED_CONSTANT_COUNT = 0 ALGEBRAIC_COUNT = 1 +EXTERNAL_COUNT = 0 class VariableType(Enum): From ef864477c757bc634d6229d77df6f22b17823c7b Mon Sep 17 00:00:00 2001 From: Alan Garny Date: Thu, 8 Aug 2024 17:30:16 +0200 Subject: [PATCH 14/85] Updated JavaScript tests. --- tests/bindings/javascript/analyservariable.test.js | 2 +- tests/bindings/javascript/generator.test.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/bindings/javascript/analyservariable.test.js b/tests/bindings/javascript/analyservariable.test.js index 6aa1f4f8d1..733684b5dd 100644 --- a/tests/bindings/javascript/analyservariable.test.js +++ b/tests/bindings/javascript/analyservariable.test.js @@ -48,7 +48,7 @@ describe("Analyser Variable tests", () => { }); test('Checking Analyser Variable index.', () => { const av = am.algebraicVariable(7) - expect(av.index()).toBe(7) + expect(av.index()).toBe(2) }); test('Checking Analyser Variable initialising variable.', () => { const av = am.algebraicVariable(15) diff --git a/tests/bindings/javascript/generator.test.js b/tests/bindings/javascript/generator.test.js index bd854e65f8..be7e04ebd2 100644 --- a/tests/bindings/javascript/generator.test.js +++ b/tests/bindings/javascript/generator.test.js @@ -62,10 +62,10 @@ describe("Generator tests", () => { g.setModel(a.model()) const interface_lines = g.interfaceCode().split('\n') - expect(interface_lines.length).toBe(42) + expect(interface_lines.length).toBe(43) const implementation_lines = g.implementationCode().split('\n') - expect(implementation_lines.length).toBe(69) + expect(implementation_lines.length).toBe(70) const equation_line_1 = libcellml.Generator.equationCode(a.model().equation(0).ast()) expect(equation_line_1.length).toBe(14) From 9d7174dd735290df0162aac6e30035fd86bc5ac4 Mon Sep 17 00:00:00 2001 From: Alan Garny Date: Thu, 8 Aug 2024 18:12:56 +0200 Subject: [PATCH 15/85] Analyser: keep track of computed constants and external variables for an equation. We will also need to keep track of states and constants. --- src/analyser.cpp | 33 ++++++++++++++++++++++++++++++--- src/utilities.cpp | 6 ++++++ 2 files changed, 36 insertions(+), 3 deletions(-) diff --git a/src/analyser.cpp b/src/analyser.cpp index 3f52be0ef7..ee0663f966 100644 --- a/src/analyser.cpp +++ b/src/analyser.cpp @@ -3147,13 +3147,40 @@ void Analyser::AnalyserImpl::analyseModel(const ModelPtr &model) // Determine all the variables computed by the equation, as well as // whether the equation is an external one. + AnalyserVariablePtrs computedConstants; AnalyserVariablePtrs algebraic; + AnalyserVariablePtrs externals; auto externalEquation = true; for (const auto &unknownVariable : internalEquation->mUnknownVariables) { auto variable = aiv2avMappings[unknownVariable]; - algebraic.push_back(variable); + switch (variable->type()) { + case AnalyserVariable::Type::STATE: + algebraic.push_back(variable); //---GRY--- states.push_back(variable); + + break; + case AnalyserVariable::Type::CONSTANT: + algebraic.push_back(variable); //---GRY--- constants.push_back(variable); + + break; + case AnalyserVariable::Type::COMPUTED_CONSTANT: + computedConstants.push_back(variable); + + break; + case AnalyserVariable::Type::ALGEBRAIC: + algebraic.push_back(variable); + + break; + case AnalyserVariable::Type::EXTERNAL: + externals.push_back(variable); + + break; + default: // AnalyserVariable::Type::VARIABLE_OF_INTEGRATION. + // This is the variable of integration, which cannot be computed. + + break; + } if (variable->type() != AnalyserVariable::Type::EXTERNAL) { externalEquation = false; @@ -3280,9 +3307,9 @@ void Analyser::AnalyserImpl::analyseModel(const ModelPtr &model) equationDependencies, internalEquation->mNlaSystemIndex, equationNlaSiblings, - {}, + computedConstants, algebraic, - {}); + externals); mModel->mPimpl->mEquations.push_back(equation); } diff --git a/src/utilities.cpp b/src/utilities.cpp index f59b00d29a..ff478630ab 100644 --- a/src/utilities.cpp +++ b/src/utilities.cpp @@ -1344,6 +1344,12 @@ std::vector variables(const AnalyserEquationPtr &equation) res.insert(res.end(), algebraic.begin(), algebraic.end()); } + auto externals = equation->externals(); + + if (!externals.empty()) { + res.insert(res.end(), externals.begin(), externals.end()); + } + return res; } From 60b26bc14ab55e114ba6136534608190fbc33ba5 Mon Sep 17 00:00:00 2001 From: Alan Garny Date: Thu, 8 Aug 2024 18:42:30 +0200 Subject: [PATCH 16/85] Analyser: some minor cleaning up. --- src/analyser.cpp | 86 ++++++++++++++++++++-------------------- src/analyserequation.cpp | 20 ---------- src/analyserequation_p.h | 15 ++----- src/analysermodel_p.h | 2 + src/generator.cpp | 7 ++-- 5 files changed, 52 insertions(+), 78 deletions(-) diff --git a/src/analyser.cpp b/src/analyser.cpp index ee0663f966..28584fb800 100644 --- a/src/analyser.cpp +++ b/src/analyser.cpp @@ -3144,47 +3144,16 @@ void Analyser::AnalyserImpl::analyseModel(const ModelPtr &model) // Make our internal equations available through our API. for (const auto &internalEquation : mInternalEquations) { - // Determine all the variables computed by the equation, as well as - // whether the equation is an external one. + // Determine whether the equation is an external one. - AnalyserVariablePtrs computedConstants; - AnalyserVariablePtrs algebraic; - AnalyserVariablePtrs externals; auto externalEquation = true; for (const auto &unknownVariable : internalEquation->mUnknownVariables) { - auto variable = aiv2avMappings[unknownVariable]; - - switch (variable->type()) { - case AnalyserVariable::Type::STATE: - algebraic.push_back(variable); //---GRY--- states.push_back(variable); - - break; - case AnalyserVariable::Type::CONSTANT: - algebraic.push_back(variable); //---GRY--- constants.push_back(variable); - - break; - case AnalyserVariable::Type::COMPUTED_CONSTANT: - computedConstants.push_back(variable); - - break; - case AnalyserVariable::Type::ALGEBRAIC: - algebraic.push_back(variable); - - break; - case AnalyserVariable::Type::EXTERNAL: - externals.push_back(variable); - - break; - default: // AnalyserVariable::Type::VARIABLE_OF_INTEGRATION. - // This is the variable of integration, which cannot be computed. + if (aiv2avMappings[unknownVariable]->type() != AnalyserVariable::Type::EXTERNAL) { + externalEquation = false; break; } - - if (variable->type() != AnalyserVariable::Type::EXTERNAL) { - externalEquation = false; - } } // Determine the type of the equation. @@ -3300,16 +3269,45 @@ void Analyser::AnalyserImpl::analyseModel(const ModelPtr &model) auto equation = aie2aeMappings[internalEquation]; - equation->mPimpl->populate(type, - (type == AnalyserEquation::Type::EXTERNAL) ? - nullptr : - internalEquation->mAst, - equationDependencies, - internalEquation->mNlaSystemIndex, - equationNlaSiblings, - computedConstants, - algebraic, - externals); + equation->mPimpl->mType = type; + equation->mPimpl->mAst = (type == AnalyserEquation::Type::EXTERNAL) ? + nullptr : + internalEquation->mAst; + equation->mPimpl->mNlaSystemIndex = internalEquation->mNlaSystemIndex; + + for (const auto &unknownVariable : internalEquation->mUnknownVariables) { + auto variable = aiv2avMappings[unknownVariable]; + + switch (variable->type()) { + case AnalyserVariable::Type::STATE: + equation->mPimpl->mAlgebraic.push_back(variable); //---GRY--- equation->mPimpl->mStates.push_back(variable); + + break; + case AnalyserVariable::Type::CONSTANT: + equation->mPimpl->mAlgebraic.push_back(variable); //---GRY--- equation->mPimpl->mConstants.push_back(variable); + + break; + case AnalyserVariable::Type::COMPUTED_CONSTANT: + equation->mPimpl->mComputedConstants.push_back(variable); + + break; + case AnalyserVariable::Type::ALGEBRAIC: + equation->mPimpl->mAlgebraic.push_back(variable); + + break; + case AnalyserVariable::Type::EXTERNAL: + equation->mPimpl->mExternals.push_back(variable); + + break; + default: // AnalyserVariable::Type::VARIABLE_OF_INTEGRATION. + // This is the variable of integration, which cannot be computed. + + break; + } + } + + std::copy(equationDependencies.begin(), equationDependencies.end(), back_inserter(equation->mPimpl->mDependencies)); + std::copy(equationNlaSiblings.begin(), equationNlaSiblings.end(), back_inserter(equation->mPimpl->mNlaSiblings)); mModel->mPimpl->mEquations.push_back(equation); } diff --git a/src/analyserequation.cpp b/src/analyserequation.cpp index b124f0e6ce..7caf807cef 100644 --- a/src/analyserequation.cpp +++ b/src/analyserequation.cpp @@ -28,26 +28,6 @@ AnalyserEquationPtr AnalyserEquation::AnalyserEquationImpl::create() return std::shared_ptr {new AnalyserEquation {}}; } -void AnalyserEquation::AnalyserEquationImpl::populate(AnalyserEquation::Type type, - const AnalyserEquationAstPtr &ast, - const std::vector &dependencies, - size_t nlaSystemIndex, - const std::vector &nlaSiblings, - const std::vector &computedConstants, - const std::vector &algebraic, - const std::vector &externals) -{ - mType = type; - mAst = ast; - mNlaSystemIndex = nlaSystemIndex; - - std::copy(dependencies.begin(), dependencies.end(), back_inserter(mDependencies)); - std::copy(nlaSiblings.begin(), nlaSiblings.end(), back_inserter(mNlaSiblings)); - std::copy(computedConstants.begin(), computedConstants.end(), back_inserter(mComputedConstants)); - std::copy(algebraic.begin(), algebraic.end(), back_inserter(mAlgebraic)); - std::copy(externals.begin(), externals.end(), back_inserter(mExternals)); -} - bool AnalyserEquation::AnalyserEquationImpl::isEmptyDependency(const AnalyserEquationWeakPtr &dependency) { auto computedConstants = dependency.lock()->computedConstants(); diff --git a/src/analyserequation_p.h b/src/analyserequation_p.h index 75c2aed94b..471fd9b97b 100644 --- a/src/analyserequation_p.h +++ b/src/analyserequation_p.h @@ -31,24 +31,17 @@ struct AnalyserEquation::AnalyserEquationImpl { AnalyserEquation::Type mType = AnalyserEquation::Type::ALGEBRAIC; AnalyserEquationAstPtr mAst; - std::vector mDependencies; size_t mNlaSystemIndex; - std::vector mNlaSiblings; bool mIsStateRateBased = false; + std::vector mComputedConstants; std::vector mAlgebraic; std::vector mExternals; - static AnalyserEquationPtr create(); + std::vector mDependencies; + std::vector mNlaSiblings; - void populate(AnalyserEquation::Type type, - const AnalyserEquationAstPtr &ast, - const std::vector &dependencies, - size_t nlaSystemIndex, - const std::vector &nlaSiblings, - const std::vector &computedConstants, - const std::vector &algebraic, - const std::vector &externals); + static AnalyserEquationPtr create(); static bool isEmptyDependency(const AnalyserEquationWeakPtr &dependency); diff --git a/src/analysermodel_p.h b/src/analysermodel_p.h index 7480584fba..24cb80e580 100644 --- a/src/analysermodel_p.h +++ b/src/analysermodel_p.h @@ -34,11 +34,13 @@ struct AnalyserModel::AnalyserModelImpl bool mHasExternalVariables = false; AnalyserVariablePtr mVoi; + std::vector mStates; std::vector mConstants; std::vector mComputedConstants; std::vector mAlgebraic; std::vector mExternals; + std::vector mEquations; bool mNeedEqFunction = false; diff --git a/src/generator.cpp b/src/generator.cpp index d715e45b19..e0e316a2e4 100644 --- a/src/generator.cpp +++ b/src/generator.cpp @@ -1897,7 +1897,9 @@ void Generator::GeneratorImpl::addImplementationInitialiseVariablesMethodCode(st // Initialise our true constants. - for (const auto &equation : mModel->equations()) { + auto equations = mModel->equations(); + + for (const auto &equation : equations) { if (equation->type() == AnalyserEquation::Type::TRUE_CONSTANT) { methodBody += generateEquationCode(equation, remainingEquations); } @@ -1921,14 +1923,13 @@ void Generator::GeneratorImpl::addImplementationInitialiseVariablesMethodCode(st // Initialise our external variables. if (mModel->hasExternalVariables()) { - auto equations = mModel->equations(); std::vector remainingExternalEquations; std::copy_if(equations.begin(), equations.end(), std::back_inserter(remainingExternalEquations), [](const AnalyserEquationPtr &equation) { return equation->type() == AnalyserEquation::Type::EXTERNAL; }); - for (const auto &equation : mModel->equations()) { + for (const auto &equation : equations) { if (equation->type() == AnalyserEquation::Type::EXTERNAL) { methodBody += generateEquationCode(equation, remainingExternalEquations); } From 05aa33897ec9da53c6ab32a2a1de10f7fa746ed0 Mon Sep 17 00:00:00 2001 From: Alan Garny Date: Thu, 8 Aug 2024 21:50:19 +0200 Subject: [PATCH 17/85] AnalyserModel: keep track of the constants, computed constants, and external variables. --- src/analyser.cpp | 25 ++- src/generator.cpp | 15 +- src/utilities.cpp | 6 + .../bindings/javascript/analysermodel.test.js | 16 +- .../javascript/analyservariable.test.js | 22 +-- tests/bindings/javascript/generator.test.js | 4 +- tests/bindings/python/test_analyser.py | 18 +- tests/coverage/coverage.cpp | 30 +-- tests/resources/coverage/generator/model.c | 25 ++- tests/resources/coverage/generator/model.h | 1 - .../generator/model.modified.profile.c | 25 ++- .../generator/model.modified.profile.h | 1 - .../generator/model.modified.profile.py | 25 ++- tests/resources/coverage/generator/model.py | 25 ++- .../algebraic_eqn_computed_var_on_rhs/model.c | 5 +- .../model.external.c | 4 +- .../model.external.py | 4 +- .../algebraic_eqn_computed_var_on_rhs/model.h | 1 - .../model.py | 5 +- .../algebraic_eqn_const_var_on_rhs/model.c | 11 +- .../algebraic_eqn_const_var_on_rhs/model.h | 1 - .../algebraic_eqn_const_var_on_rhs/model.py | 11 +- .../algebraic_eqn_constant_on_rhs/model.c | 5 +- .../algebraic_eqn_constant_on_rhs/model.h | 1 - .../algebraic_eqn_constant_on_rhs/model.py | 5 +- .../algebraic_eqn_derivative_on_rhs/model.c | 5 +- .../algebraic_eqn_derivative_on_rhs/model.h | 1 - .../algebraic_eqn_derivative_on_rhs/model.py | 5 +- .../model.c | 5 +- .../model.h | 1 - .../model.py | 5 +- .../algebraic_eqn_state_var_on_rhs/model.c | 5 +- .../algebraic_eqn_state_var_on_rhs/model.h | 1 - .../algebraic_eqn_state_var_on_rhs/model.py | 5 +- .../model.c | 5 +- .../model.h | 1 - .../model.py | 5 +- .../model.c | 5 +- .../model.external.c | 6 +- .../model.external.py | 6 +- .../model.h | 1 - .../model.py | 5 +- .../model.c | 1 - .../model.h | 1 - .../model.py | 1 - .../model.three.externals.c | 4 +- .../model.three.externals.h | 6 +- .../model.three.externals.py | 4 +- .../model.not.ordered.c | 19 +- .../model.not.ordered.h | 1 - .../model.not.ordered.py | 19 +- .../model.ordered.c | 9 +- .../model.ordered.h | 1 - .../model.ordered.py | 9 +- .../algebraic_unknown_var_on_rhs/model.c | 5 +- .../algebraic_unknown_var_on_rhs/model.h | 1 - .../algebraic_unknown_var_on_rhs/model.py | 5 +- .../generator/cell_geometry_model/model.c | 9 +- .../cell_geometry_model/model.external.c | 8 +- .../cell_geometry_model/model.external.py | 8 +- .../generator/cell_geometry_model/model.h | 1 - .../generator/cell_geometry_model/model.py | 9 +- .../model.c | 1 - .../model.h | 1 - .../model.py | 1 - .../generator/cellml_slc_example/model.py | 11 +- .../model.c | 5 +- .../model.h | 1 - .../model.py | 5 +- .../cellml_unit_scaling_constant/model.c | 7 +- .../cellml_unit_scaling_constant/model.h | 1 - .../cellml_unit_scaling_constant/model.py | 7 +- .../cellml_unit_scaling_rate/model.c | 1 - .../cellml_unit_scaling_rate/model.h | 1 - .../cellml_unit_scaling_rate/model.py | 1 - .../cellml_unit_scaling_state/model.c | 1 - .../cellml_unit_scaling_state/model.h | 1 - .../cellml_unit_scaling_state/model.py | 1 - .../model.c | 1 - .../model.h | 1 - .../model.py | 1 - .../model.c | 5 +- .../model.h | 1 - .../model.py | 5 +- .../cellml_unit_scaling_voi_direct/model.c | 1 - .../cellml_unit_scaling_voi_direct/model.h | 1 - .../cellml_unit_scaling_voi_direct/model.py | 1 - .../cellml_unit_scaling_voi_indirect/model.c | 1 - .../cellml_unit_scaling_voi_indirect/model.h | 1 - .../cellml_unit_scaling_voi_indirect/model.py | 1 - .../generator/dae_cellml_1_1_model/model.c | 21 +- .../generator/dae_cellml_1_1_model/model.h | 1 - .../generator/dae_cellml_1_1_model/model.py | 21 +- .../generator/dependent_eqns/model.c | 1 - .../generator/dependent_eqns/model.h | 1 - .../generator/dependent_eqns/model.py | 1 - .../model.c | 185 +++++++++--------- .../model.h | 1 - .../model.py | 185 +++++++++--------- .../model.c | 153 +++++++-------- .../model.h | 1 - .../model.py | 153 +++++++-------- .../model.algebraic.c | 26 +-- .../model.algebraic.py | 26 +-- .../model.c | 23 ++- .../model.computed.constant.c | 26 +-- .../model.computed.constant.py | 26 +-- .../model.constant.c | 26 +-- .../model.constant.py | 26 +-- .../model.dae.c | 39 ++-- .../model.dae.h | 1 - .../model.dae.py | 39 ++-- .../model.dependent.algebraic.c | 24 +-- .../model.dependent.algebraic.py | 24 +-- .../model.dependent.computed.constant.c | 20 +- .../model.dependent.computed.constant.py | 20 +- .../model.dependent.constant.c | 26 +-- .../model.dependent.constant.py | 26 +-- .../model.dependent.state.c | 30 +-- .../model.dependent.state.py | 30 +-- .../model.external.c | 30 +-- .../model.external.py | 30 +-- .../model.h | 1 - .../model.py | 23 ++- .../model.state.c | 28 +-- .../model.state.py | 28 +-- .../generator/noble_model_1962/model.c | 13 +- .../generator/noble_model_1962/model.h | 1 - .../generator/noble_model_1962/model.py | 13 +- .../generator/ode_computed_var_on_rhs/model.c | 5 +- .../generator/ode_computed_var_on_rhs/model.h | 1 - .../ode_computed_var_on_rhs/model.py | 5 +- .../model.c | 5 +- .../model.h | 1 - .../model.py | 5 +- .../generator/ode_const_var_on_rhs/model.c | 5 +- .../generator/ode_const_var_on_rhs/model.h | 1 - .../generator/ode_const_var_on_rhs/model.py | 5 +- .../model.c | 5 +- .../model.h | 1 - .../model.py | 5 +- .../generator/ode_constant_on_rhs/model.c | 1 - .../generator/ode_constant_on_rhs/model.h | 1 - .../generator/ode_constant_on_rhs/model.py | 1 - .../ode_constant_on_rhs_one_component/model.c | 1 - .../ode_constant_on_rhs_one_component/model.h | 1 - .../model.py | 1 - .../ode_multiple_dependent_odes/model.c | 5 +- .../ode_multiple_dependent_odes/model.h | 1 - .../ode_multiple_dependent_odes/model.py | 5 +- .../model.c | 5 +- .../model.h | 1 - .../model.py | 5 +- .../ode_multiple_odes_with_same_name/model.c | 5 +- .../ode_multiple_odes_with_same_name/model.h | 1 - .../ode_multiple_odes_with_same_name/model.py | 5 +- .../generator/ode_unknown_var_on_rhs/model.c | 1 - .../generator/ode_unknown_var_on_rhs/model.h | 1 - .../generator/ode_unknown_var_on_rhs/model.py | 1 - .../robertson_model_1966/model.dae.c | 9 +- .../robertson_model_1966/model.dae.h | 1 - .../robertson_model_1966/model.dae.py | 9 +- .../robertson_model_1966/model.ode.c | 5 +- .../robertson_model_1966/model.ode.h | 1 - .../robertson_model_1966/model.ode.py | 5 +- .../generator/sine_model_imports/model.c | 11 +- .../generator/sine_model_imports/model.h | 1 - .../generator/sine_model_imports/model.py | 11 +- .../model.c | 8 +- .../model.py | 8 +- .../model.c | 5 +- .../model.h | 1 - .../model.py | 5 +- 173 files changed, 964 insertions(+), 1096 deletions(-) diff --git a/src/analyser.cpp b/src/analyser.cpp index 28584fb800..f0caa7b86d 100644 --- a/src/analyser.cpp +++ b/src/analyser.cpp @@ -3134,10 +3134,31 @@ void Analyser::AnalyserImpl::analyseModel(const ModelPtr &model) aiv2avMappings.emplace(internalVariable, variable); v2avMappings.emplace(internalVariable->mVariable, variable); - if (type == AnalyserVariable::Type::STATE) { + switch (type) { + case AnalyserVariable::Type::STATE: mModel->mPimpl->mStates.push_back(variable); - } else { + + break; + case AnalyserVariable::Type::CONSTANT: + mModel->mPimpl->mConstants.push_back(variable); + + break; + case AnalyserVariable::Type::COMPUTED_CONSTANT: + mModel->mPimpl->mComputedConstants.push_back(variable); + + break; + case AnalyserVariable::Type::ALGEBRAIC: mModel->mPimpl->mAlgebraic.push_back(variable); + + break; + case AnalyserVariable::Type::EXTERNAL: + mModel->mPimpl->mExternals.push_back(variable); + + break; + default: // AnalyserVariable::Type::VARIABLE_OF_INTEGRATION. + // This is the variable of integration, so skip it. + + break; } } diff --git a/src/generator.cpp b/src/generator.cpp index e0e316a2e4..44671415e9 100644 --- a/src/generator.cpp +++ b/src/generator.cpp @@ -95,15 +95,7 @@ AnalyserVariablePtr Generator::GeneratorImpl::analyserVariable(const VariablePtr res = doAnalyserVariable(variable, mModel->states()); if (res == nullptr) { - res = doAnalyserVariable(variable, mModel->constants()); - } - - if (res == nullptr) { - res = doAnalyserVariable(variable, mModel->computedConstants()); - } - - if (res == nullptr) { - res = doAnalyserVariable(variable, mModel->algebraic()); + res = doAnalyserVariable(variable, variables(mModel)); } } @@ -357,8 +349,9 @@ void Generator::GeneratorImpl::addStateAndVariableCountCode(bool interface) "[ALGEBRAIC_COUNT]", std::to_string(mModel->algebraicCount())); } - if ((interface && !mProfile->interfaceExternalCountString().empty()) - || (!interface && !mProfile->implementationExternalCountString().empty())) { + if ((mModel->externalCount() != 0) + && ((interface && !mProfile->interfaceExternalCountString().empty()) + || (!interface && !mProfile->implementationExternalCountString().empty()))) { code += interface ? mProfile->interfaceExternalCountString() : replace(mProfile->implementationExternalCountString(), diff --git a/src/utilities.cpp b/src/utilities.cpp index ff478630ab..77815b38bf 100644 --- a/src/utilities.cpp +++ b/src/utilities.cpp @@ -1332,6 +1332,12 @@ std::vector variables(const AnalyserModelPtr &model) res.insert(res.end(), algebraic.begin(), algebraic.end()); } + auto externals = model->externals(); + + if (!externals.empty()) { + res.insert(res.end(), externals.begin(), externals.end()); + } + return res; } diff --git a/tests/bindings/javascript/analysermodel.test.js b/tests/bindings/javascript/analysermodel.test.js index c709d93684..7c5ea9ada0 100644 --- a/tests/bindings/javascript/analysermodel.test.js +++ b/tests/bindings/javascript/analysermodel.test.js @@ -62,18 +62,18 @@ describe("Analyser Model tests", () => { expect(am.state(2).variable().name()).toBe("m") }); test('Checking Analyser Model constants related API.', () => { - expect(am.constantCount()).toBe(0) - expect(am.constants().size()).toBe(0) - expect(am.constant(2)).toBeNull() + expect(am.constantCount()).toBe(5) + expect(am.constants().size()).toBe(5) + expect(am.constant(2).variable().name()).toBe("g_L") }); test('Checking Analyser Model computed constants related API.', () => { - expect(am.computedConstantCount()).toBe(0) - expect(am.computedConstants().size()).toBe(0) - expect(am.computedConstant(2)).toBeNull() + expect(am.computedConstantCount()).toBe(3) + expect(am.computedConstants().size()).toBe(3) + expect(am.computedConstant(2).variable().name()).toBe("E_K") }); test('Checking Analyser Model algebraic variables related API.', () => { - expect(am.algebraicCount()).toBe(18) - expect(am.algebraicVariables().size()).toBe(18) + expect(am.algebraicCount()).toBe(10) + expect(am.algebraicVariables().size()).toBe(10) expect(am.algebraicVariable(2).variable().name()).toBe("i_K") }); test('Checking Analyser Model need* API.', () => { diff --git a/tests/bindings/javascript/analyservariable.test.js b/tests/bindings/javascript/analyservariable.test.js index 733684b5dd..8026126561 100644 --- a/tests/bindings/javascript/analyservariable.test.js +++ b/tests/bindings/javascript/analyservariable.test.js @@ -37,9 +37,9 @@ describe("Analyser Variable tests", () => { am = a.model() - expect(am.constantCount()).toBe(0) - expect(am.computedConstantCount()).toBe(0) - expect(am.algebraicCount()).toBe(18) + expect(am.constantCount()).toBe(5) + expect(am.computedConstantCount()).toBe(3) + expect(am.algebraicCount()).toBe(10) }); test('Checking Analyser Variable type.', () => { const av = am.algebraicVariable(0) @@ -48,26 +48,26 @@ describe("Analyser Variable tests", () => { }); test('Checking Analyser Variable index.', () => { const av = am.algebraicVariable(7) - expect(av.index()).toBe(2) + expect(av.index()).toBe(7) }); test('Checking Analyser Variable initialising variable.', () => { - const av = am.algebraicVariable(15) - expect(av.initialisingVariable().name()).toBe("g_K") + const av = am.constant(3) + expect(av.initialisingVariable().name()).toBe("g_Na") }); test('Checking Analyser Variable variable.', () => { - const av = am.algebraicVariable(10) - expect(av.variable().name()).toBe("alpha_m") + const av = am.algebraicVariable(3) + expect(av.variable().name()).toBe("i_Na") }); test('Checking Analyser Equation equationCount.', () => { - const av = am.algebraicVariable(14) + const av = am.computedConstant(1) expect(av.equationCount()).toBe(1) }); test('Checking Analyser Variable equations.', () => { - const av = am.algebraicVariable(14) + const av = am.computedConstant(1) expect(av.equations().size()).toBe(1) }); test('Checking Analyser Variable equation.', () => { - const av = am.algebraicVariable(14) + const av = am.computedConstant(1) expect(av.equation(0).type().value).toBe(libcellml.AnalyserEquation.Type.VARIABLE_BASED_CONSTANT.value) }); }) diff --git a/tests/bindings/javascript/generator.test.js b/tests/bindings/javascript/generator.test.js index be7e04ebd2..bd854e65f8 100644 --- a/tests/bindings/javascript/generator.test.js +++ b/tests/bindings/javascript/generator.test.js @@ -62,10 +62,10 @@ describe("Generator tests", () => { g.setModel(a.model()) const interface_lines = g.interfaceCode().split('\n') - expect(interface_lines.length).toBe(43) + expect(interface_lines.length).toBe(42) const implementation_lines = g.implementationCode().split('\n') - expect(implementation_lines.length).toBe(70) + expect(implementation_lines.length).toBe(69) const equation_line_1 = libcellml.Generator.equationCode(a.model().equation(0).ast()) expect(equation_line_1.length).toBe(14) diff --git a/tests/bindings/python/test_analyser.py b/tests/bindings/python/test_analyser.py index 856ea709d5..4871b3e145 100644 --- a/tests/bindings/python/test_analyser.py +++ b/tests/bindings/python/test_analyser.py @@ -115,13 +115,13 @@ def test_coverage(self): self.assertIsNotNone(am.states()) self.assertIsNotNone(am.state(3)) - self.assertEqual(0, am.constantCount()) + self.assertEqual(5, am.constantCount()) self.assertIsNotNone(am.constants()) - self.assertIsNone(am.constant(3)) + self.assertIsNotNone(am.constant(3)) self.assertEqual(0, am.computedConstantCount()) self.assertIsNotNone(am.computedConstants()) self.assertIsNone(am.computedConstant(3)) - self.assertEqual(17, am.algebraicCount()) + self.assertEqual(12, am.algebraicCount()) self.assertIsNotNone(am.algebraic()) self.assertIsNotNone(am.algebraic(3)) @@ -160,15 +160,15 @@ def test_coverage(self): av = am.algebraic(3) - self.assertEqual(AnalyserVariable.Type.CONSTANT, av.type()) - self.assertEqual("constant", AnalyserVariable.typeAsString(av.type())) - self.assertEqual("constant", AnalyserVariable_typeAsString(av.type())) - self.assertEqual(0, av.index()) - self.assertIsNotNone(av.initialisingVariable()) + self.assertEqual(AnalyserVariable.Type.ALGEBRAIC, av.type()) + self.assertEqual("algebraic", AnalyserVariable.typeAsString(av.type())) + self.assertEqual("algebraic", AnalyserVariable_typeAsString(av.type())) + self.assertEqual(3, av.index()) + self.assertIsNone(av.initialisingVariable()) self.assertIsNotNone(av.variable()) self.assertEqual(1, av.equationCount()) self.assertIsNotNone(av.equations()) - self.assertIsNone(av.equation(0)) + self.assertIsNotNone(av.equation(0)) # Ensure coverage for AnalyserEquation. diff --git a/tests/coverage/coverage.cpp b/tests/coverage/coverage.cpp index 83ce6b317d..096e40b79c 100644 --- a/tests/coverage/coverage.cpp +++ b/tests/coverage/coverage.cpp @@ -594,9 +594,9 @@ TEST(Coverage, generator) EXPECT_EQ("dae", libcellml::AnalyserModel::typeAsString(analyserModel->type())); EXPECT_EQ(size_t(1), analyserModel->stateCount()); - EXPECT_EQ(size_t(0), analyserModel->constantCount()); - EXPECT_EQ(size_t(0), analyserModel->computedConstantCount()); - EXPECT_EQ(size_t(209), analyserModel->algebraicCount()); + EXPECT_EQ(size_t(7), analyserModel->constantCount()); + EXPECT_EQ(size_t(200), analyserModel->computedConstantCount()); + EXPECT_EQ(size_t(2), analyserModel->algebraicCount()); EXPECT_EQ(size_t(203), analyserModel->equationCount()); EXPECT_NE(nullptr, analyserModel->voi()); @@ -608,9 +608,9 @@ TEST(Coverage, generator) EXPECT_NE(size_t(0), analyserModel->state(0)->equations().size()); EXPECT_NE(nullptr, analyserModel->state(0)->equation(0)); EXPECT_EQ(nullptr, analyserModel->state(analyserModel->stateCount())); - EXPECT_EQ(nullptr, analyserModel->constant(0)); + EXPECT_NE(nullptr, analyserModel->constant(0)); EXPECT_EQ(nullptr, analyserModel->constant(analyserModel->constantCount())); - EXPECT_EQ(nullptr, analyserModel->computedConstant(0)); + EXPECT_NE(nullptr, analyserModel->computedConstant(0)); EXPECT_EQ(nullptr, analyserModel->computedConstant(analyserModel->computedConstantCount())); EXPECT_NE(nullptr, analyserModel->algebraic(0)); EXPECT_EQ(nullptr, analyserModel->algebraic(analyserModel->algebraicCount())); @@ -652,27 +652,11 @@ TEST(Coverage, generator) } for (size_t i = 0; i < analyserModel->constantCount(); ++i) { - if ((i == 1) || (i == 2) || (i == 6) || (i == 18) || (i == 179) || (i == 180) || (i == 182) || (i == 205) || (i == 206)) { - EXPECT_TRUE(analyserModel->constant(i)->initialisingVariable() != nullptr); - } - } - - for (size_t i = 0; i < analyserModel->computedConstantCount(); ++i) { - if ((i == 1) || (i == 2) || (i == 6) || (i == 18) || (i == 179) || (i == 180) || (i == 182) || (i == 205) || (i == 206)) { - EXPECT_TRUE(analyserModel->computedConstant(i)->initialisingVariable() != nullptr); - } + EXPECT_NE(nullptr, analyserModel->constant(i)->initialisingVariable()); } for (size_t i = 0; i < analyserModel->algebraicCount(); ++i) { - if ((i == 1) || (i == 2) || (i == 6) || (i == 18) || (i == 179) || (i == 180) || (i == 182) || (i == 205) || (i == 206)) { - EXPECT_TRUE(analyserModel->algebraic(i)->initialisingVariable() != nullptr); - } - } - - for (size_t i = 0; i < analyserModel->externalCount(); ++i) { - if ((i == 1) || (i == 2) || (i == 6) || (i == 18) || (i == 179) || (i == 180) || (i == 182) || (i == 205) || (i == 206)) { - EXPECT_TRUE(analyserModel->external(i)->initialisingVariable() != nullptr); - } + EXPECT_NE(nullptr, analyserModel->algebraic(i)->initialisingVariable()); } EXPECT_EQ(nullptr, generator->model()); diff --git a/tests/resources/coverage/generator/model.c b/tests/resources/coverage/generator/model.c index c6142792ce..aa1b69f193 100644 --- a/tests/resources/coverage/generator/model.c +++ b/tests/resources/coverage/generator/model.c @@ -9,10 +9,9 @@ const char VERSION[] = "0.6.0"; const char LIBCELLML_VERSION[] = "0.5.0"; const size_t STATE_COUNT = 1; -const size_t CONSTANT_COUNT = 0; -const size_t COMPUTED_CONSTANT_COUNT = 0; -const size_t ALGEBRAIC_COUNT = 209; -const size_t EXTERNAL_COUNT = 0; +const size_t CONSTANT_COUNT = 7; +const size_t COMPUTED_CONSTANT_COUNT = 200; +const size_t ALGEBRAIC_COUNT = 2; const VariableInfo VOI_INFO = {"t", "second", "my_component", VARIABLE_OF_INTEGRATION}; @@ -21,13 +20,17 @@ const VariableInfo STATE_INFO[] = { }; const VariableInfo VARIABLE_INFO[] = { - {"eqnEq", "dimensionless", "my_component", COMPUTED_CONSTANT}, {"m", "dimensionless", "my_component", CONSTANT}, {"n", "dimensionless", "my_component", CONSTANT}, + {"o", "dimensionless", "my_component", CONSTANT}, + {"p", "dimensionless", "my_component", CONSTANT}, + {"q", "dimensionless", "my_component", CONSTANT}, + {"r", "dimensionless", "my_component", CONSTANT}, + {"s", "dimensionless", "my_component", CONSTANT}, + {"eqnEq", "dimensionless", "my_component", COMPUTED_CONSTANT}, {"eqnEqCoverageParentheses", "dimensionless", "my_component", COMPUTED_CONSTANT}, {"eqnNeq", "dimensionless", "my_component", COMPUTED_CONSTANT}, {"eqnNeqCoverageParentheses", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"o", "dimensionless", "my_component", CONSTANT}, {"eqnLt", "dimensionless", "my_component", COMPUTED_CONSTANT}, {"eqnLtCoverageParentheses", "dimensionless", "my_component", COMPUTED_CONSTANT}, {"eqnLeq", "dimensionless", "my_component", COMPUTED_CONSTANT}, @@ -39,7 +42,6 @@ const VariableInfo VARIABLE_INFO[] = { {"eqnAnd", "dimensionless", "my_component", COMPUTED_CONSTANT}, {"eqnAndMultiple", "dimensionless", "my_component", COMPUTED_CONSTANT}, {"eqnAndParentheses", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"p", "dimensionless", "my_component", CONSTANT}, {"eqnAndParenthesesLeftPlusWith", "dimensionless", "my_component", COMPUTED_CONSTANT}, {"eqnAndParenthesesLeftPlusWithout", "dimensionless", "my_component", COMPUTED_CONSTANT}, {"eqnAndParenthesesLeftMinusWith", "dimensionless", "my_component", COMPUTED_CONSTANT}, @@ -200,10 +202,7 @@ const VariableInfo VARIABLE_INFO[] = { {"eqnPiecewisePiece", "dimensionless", "my_component", COMPUTED_CONSTANT}, {"eqnPiecewisePieceOtherwise", "dimensionless", "my_component", COMPUTED_CONSTANT}, {"eqnPiecewisePiecePiecePiece", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"q", "dimensionless", "my_component", CONSTANT}, - {"r", "dimensionless", "my_component", CONSTANT}, {"eqnPiecewisePiecePiecePieceOtherwise", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"s", "dimensionless", "my_component", CONSTANT}, {"eqnWithPiecewise", "dimensionless", "my_component", COMPUTED_CONSTANT}, {"eqnCnInteger", "dimensionless", "my_component", COMPUTED_CONSTANT}, {"eqnCnDouble", "dimensionless", "my_component", COMPUTED_CONSTANT}, @@ -226,10 +225,10 @@ const VariableInfo VARIABLE_INFO[] = { {"eqnCoverageForPowerOperator", "dimensionless", "my_component", COMPUTED_CONSTANT}, {"eqnCoverageForRootOperator", "dimensionless", "my_component", COMPUTED_CONSTANT}, {"eqnCoverageForMinusUnary", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnNlaVariable1", "dimensionless", "my_component", ALGEBRAIC}, - {"eqnNlaVariable2", "dimensionless", "my_component", ALGEBRAIC}, {"eqnComputedConstant1", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnComputedConstant2", "dimensionless", "my_component", COMPUTED_CONSTANT} + {"eqnComputedConstant2", "dimensionless", "my_component", COMPUTED_CONSTANT}, + {"eqnNlaVariable1", "dimensionless", "my_component", ALGEBRAIC}, + {"eqnNlaVariable2", "dimensionless", "my_component", ALGEBRAIC} }; double xor(double x, double y) diff --git a/tests/resources/coverage/generator/model.h b/tests/resources/coverage/generator/model.h index c4835137aa..e05872689b 100644 --- a/tests/resources/coverage/generator/model.h +++ b/tests/resources/coverage/generator/model.h @@ -11,7 +11,6 @@ extern const size_t STATE_COUNT; extern const size_t CONSTANT_COUNT; extern const size_t COMPUTED_CONSTANT_COUNT; extern const size_t ALGEBRAIC_COUNT; -extern const size_t EXTERNAL_COUNT; typedef enum { VARIABLE_OF_INTEGRATION, diff --git a/tests/resources/coverage/generator/model.modified.profile.c b/tests/resources/coverage/generator/model.modified.profile.c index 808684ff94..01e2454c30 100644 --- a/tests/resources/coverage/generator/model.modified.profile.c +++ b/tests/resources/coverage/generator/model.modified.profile.c @@ -9,10 +9,9 @@ const char VERSION[] = "0.6.0.post0"; const char LIBCELLML_VERSION[] = "0.5.0"; const size_t STATE_COUNT = 1; -const size_t CONSTANT_COUNT = 0; -const size_t COMPUTED_CONSTANT_COUNT = 0; -const size_t ALGEBRAIC_COUNT = 209; -const size_t EXTERNAL_COUNT = 0; +const size_t CONSTANT_COUNT = 7; +const size_t COMPUTED_CONSTANT_COUNT = 200; +const size_t ALGEBRAIC_COUNT = 2; const VariableInfo VOI_INFO = {"t", "second", "my_component", VARIABLE_OF_INTEGRATION}; @@ -21,13 +20,17 @@ const VariableInfo STATE_INFO[] = { }; const VariableInfo VARIABLE_INFO[] = { - {"eqnEq", "dimensionless", "my_component", COMPUTED_CONSTANT}, {"m", "dimensionless", "my_component", CONSTANT}, {"n", "dimensionless", "my_component", CONSTANT}, + {"o", "dimensionless", "my_component", CONSTANT}, + {"p", "dimensionless", "my_component", CONSTANT}, + {"q", "dimensionless", "my_component", CONSTANT}, + {"r", "dimensionless", "my_component", CONSTANT}, + {"s", "dimensionless", "my_component", CONSTANT}, + {"eqnEq", "dimensionless", "my_component", COMPUTED_CONSTANT}, {"eqnEqCoverageParentheses", "dimensionless", "my_component", COMPUTED_CONSTANT}, {"eqnNeq", "dimensionless", "my_component", COMPUTED_CONSTANT}, {"eqnNeqCoverageParentheses", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"o", "dimensionless", "my_component", CONSTANT}, {"eqnLt", "dimensionless", "my_component", COMPUTED_CONSTANT}, {"eqnLtCoverageParentheses", "dimensionless", "my_component", COMPUTED_CONSTANT}, {"eqnLeq", "dimensionless", "my_component", COMPUTED_CONSTANT}, @@ -39,7 +42,6 @@ const VariableInfo VARIABLE_INFO[] = { {"eqnAnd", "dimensionless", "my_component", COMPUTED_CONSTANT}, {"eqnAndMultiple", "dimensionless", "my_component", COMPUTED_CONSTANT}, {"eqnAndParentheses", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"p", "dimensionless", "my_component", CONSTANT}, {"eqnAndParenthesesLeftPlusWith", "dimensionless", "my_component", COMPUTED_CONSTANT}, {"eqnAndParenthesesLeftPlusWithout", "dimensionless", "my_component", COMPUTED_CONSTANT}, {"eqnAndParenthesesLeftMinusWith", "dimensionless", "my_component", COMPUTED_CONSTANT}, @@ -200,10 +202,7 @@ const VariableInfo VARIABLE_INFO[] = { {"eqnPiecewisePiece", "dimensionless", "my_component", COMPUTED_CONSTANT}, {"eqnPiecewisePieceOtherwise", "dimensionless", "my_component", COMPUTED_CONSTANT}, {"eqnPiecewisePiecePiecePiece", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"q", "dimensionless", "my_component", CONSTANT}, - {"r", "dimensionless", "my_component", CONSTANT}, {"eqnPiecewisePiecePiecePieceOtherwise", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"s", "dimensionless", "my_component", CONSTANT}, {"eqnWithPiecewise", "dimensionless", "my_component", COMPUTED_CONSTANT}, {"eqnCnInteger", "dimensionless", "my_component", COMPUTED_CONSTANT}, {"eqnCnDouble", "dimensionless", "my_component", COMPUTED_CONSTANT}, @@ -226,10 +225,10 @@ const VariableInfo VARIABLE_INFO[] = { {"eqnCoverageForPowerOperator", "dimensionless", "my_component", COMPUTED_CONSTANT}, {"eqnCoverageForRootOperator", "dimensionless", "my_component", COMPUTED_CONSTANT}, {"eqnCoverageForMinusUnary", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnNlaVariable1", "dimensionless", "my_component", ALGEBRAIC}, - {"eqnNlaVariable2", "dimensionless", "my_component", ALGEBRAIC}, {"eqnComputedConstant1", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnComputedConstant2", "dimensionless", "my_component", COMPUTED_CONSTANT} + {"eqnComputedConstant2", "dimensionless", "my_component", COMPUTED_CONSTANT}, + {"eqnNlaVariable1", "dimensionless", "my_component", ALGEBRAIC}, + {"eqnNlaVariable2", "dimensionless", "my_component", ALGEBRAIC} }; double xor(double x, double y) diff --git a/tests/resources/coverage/generator/model.modified.profile.h b/tests/resources/coverage/generator/model.modified.profile.h index 08fc9fc5d1..ef3a093e68 100644 --- a/tests/resources/coverage/generator/model.modified.profile.h +++ b/tests/resources/coverage/generator/model.modified.profile.h @@ -11,7 +11,6 @@ extern const size_t STATE_COUNT; extern const size_t CONSTANT_COUNT; extern const size_t COMPUTED_CONSTANT_COUNT; extern const size_t ALGEBRAIC_COUNT; -extern const size_t EXTERNAL_COUNT; typedef enum { VARIABLE_OF_INTEGRATION, diff --git a/tests/resources/coverage/generator/model.modified.profile.py b/tests/resources/coverage/generator/model.modified.profile.py index 67d01e5cf9..cd37464781 100644 --- a/tests/resources/coverage/generator/model.modified.profile.py +++ b/tests/resources/coverage/generator/model.modified.profile.py @@ -8,10 +8,9 @@ LIBCELLML_VERSION = "0.5.0" STATE_COUNT = 1 -CONSTANT_COUNT = 0 -COMPUTED_CONSTANT_COUNT = 0 -ALGEBRAIC_COUNT = 209 -EXTERNAL_COUNT = 0 +CONSTANT_COUNT = 7 +COMPUTED_CONSTANT_COUNT = 200 +ALGEBRAIC_COUNT = 2 class VariableType(Enum): @@ -29,13 +28,17 @@ class VariableType(Enum): ] VARIABLE_INFO = [ - {"name": "eqnEq", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, {"name": "m", "units": "dimensionless", "component": "my_component", "type": VariableType.CONSTANT}, {"name": "n", "units": "dimensionless", "component": "my_component", "type": VariableType.CONSTANT}, + {"name": "o", "units": "dimensionless", "component": "my_component", "type": VariableType.CONSTANT}, + {"name": "p", "units": "dimensionless", "component": "my_component", "type": VariableType.CONSTANT}, + {"name": "q", "units": "dimensionless", "component": "my_component", "type": VariableType.CONSTANT}, + {"name": "r", "units": "dimensionless", "component": "my_component", "type": VariableType.CONSTANT}, + {"name": "s", "units": "dimensionless", "component": "my_component", "type": VariableType.CONSTANT}, + {"name": "eqnEq", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, {"name": "eqnEqCoverageParentheses", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, {"name": "eqnNeq", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, {"name": "eqnNeqCoverageParentheses", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "o", "units": "dimensionless", "component": "my_component", "type": VariableType.CONSTANT}, {"name": "eqnLt", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, {"name": "eqnLtCoverageParentheses", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, {"name": "eqnLeq", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, @@ -47,7 +50,6 @@ class VariableType(Enum): {"name": "eqnAnd", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, {"name": "eqnAndMultiple", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, {"name": "eqnAndParentheses", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "p", "units": "dimensionless", "component": "my_component", "type": VariableType.CONSTANT}, {"name": "eqnAndParenthesesLeftPlusWith", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, {"name": "eqnAndParenthesesLeftPlusWithout", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, {"name": "eqnAndParenthesesLeftMinusWith", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, @@ -208,10 +210,7 @@ class VariableType(Enum): {"name": "eqnPiecewisePiece", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, {"name": "eqnPiecewisePieceOtherwise", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, {"name": "eqnPiecewisePiecePiecePiece", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "q", "units": "dimensionless", "component": "my_component", "type": VariableType.CONSTANT}, - {"name": "r", "units": "dimensionless", "component": "my_component", "type": VariableType.CONSTANT}, {"name": "eqnPiecewisePiecePiecePieceOtherwise", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "s", "units": "dimensionless", "component": "my_component", "type": VariableType.CONSTANT}, {"name": "eqnWithPiecewise", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, {"name": "eqnCnInteger", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, {"name": "eqnCnDouble", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, @@ -234,10 +233,10 @@ class VariableType(Enum): {"name": "eqnCoverageForPowerOperator", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, {"name": "eqnCoverageForRootOperator", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, {"name": "eqnCoverageForMinusUnary", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnNlaVariable1", "units": "dimensionless", "component": "my_component", "type": VariableType.ALGEBRAIC}, - {"name": "eqnNlaVariable2", "units": "dimensionless", "component": "my_component", "type": VariableType.ALGEBRAIC}, {"name": "eqnComputedConstant1", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnComputedConstant2", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT} + {"name": "eqnComputedConstant2", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, + {"name": "eqnNlaVariable1", "units": "dimensionless", "component": "my_component", "type": VariableType.ALGEBRAIC}, + {"name": "eqnNlaVariable2", "units": "dimensionless", "component": "my_component", "type": VariableType.ALGEBRAIC} ] diff --git a/tests/resources/coverage/generator/model.py b/tests/resources/coverage/generator/model.py index ccf8c67060..07afa2a6b5 100644 --- a/tests/resources/coverage/generator/model.py +++ b/tests/resources/coverage/generator/model.py @@ -8,10 +8,9 @@ LIBCELLML_VERSION = "0.5.0" STATE_COUNT = 1 -CONSTANT_COUNT = 0 -COMPUTED_CONSTANT_COUNT = 0 -ALGEBRAIC_COUNT = 209 -EXTERNAL_COUNT = 0 +CONSTANT_COUNT = 7 +COMPUTED_CONSTANT_COUNT = 200 +ALGEBRAIC_COUNT = 2 class VariableType(Enum): @@ -29,13 +28,17 @@ class VariableType(Enum): ] VARIABLE_INFO = [ - {"name": "eqnEq", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, {"name": "m", "units": "dimensionless", "component": "my_component", "type": VariableType.CONSTANT}, {"name": "n", "units": "dimensionless", "component": "my_component", "type": VariableType.CONSTANT}, + {"name": "o", "units": "dimensionless", "component": "my_component", "type": VariableType.CONSTANT}, + {"name": "p", "units": "dimensionless", "component": "my_component", "type": VariableType.CONSTANT}, + {"name": "q", "units": "dimensionless", "component": "my_component", "type": VariableType.CONSTANT}, + {"name": "r", "units": "dimensionless", "component": "my_component", "type": VariableType.CONSTANT}, + {"name": "s", "units": "dimensionless", "component": "my_component", "type": VariableType.CONSTANT}, + {"name": "eqnEq", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, {"name": "eqnEqCoverageParentheses", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, {"name": "eqnNeq", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, {"name": "eqnNeqCoverageParentheses", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "o", "units": "dimensionless", "component": "my_component", "type": VariableType.CONSTANT}, {"name": "eqnLt", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, {"name": "eqnLtCoverageParentheses", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, {"name": "eqnLeq", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, @@ -47,7 +50,6 @@ class VariableType(Enum): {"name": "eqnAnd", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, {"name": "eqnAndMultiple", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, {"name": "eqnAndParentheses", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "p", "units": "dimensionless", "component": "my_component", "type": VariableType.CONSTANT}, {"name": "eqnAndParenthesesLeftPlusWith", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, {"name": "eqnAndParenthesesLeftPlusWithout", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, {"name": "eqnAndParenthesesLeftMinusWith", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, @@ -208,10 +210,7 @@ class VariableType(Enum): {"name": "eqnPiecewisePiece", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, {"name": "eqnPiecewisePieceOtherwise", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, {"name": "eqnPiecewisePiecePiecePiece", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "q", "units": "dimensionless", "component": "my_component", "type": VariableType.CONSTANT}, - {"name": "r", "units": "dimensionless", "component": "my_component", "type": VariableType.CONSTANT}, {"name": "eqnPiecewisePiecePiecePieceOtherwise", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "s", "units": "dimensionless", "component": "my_component", "type": VariableType.CONSTANT}, {"name": "eqnWithPiecewise", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, {"name": "eqnCnInteger", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, {"name": "eqnCnDouble", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, @@ -234,10 +233,10 @@ class VariableType(Enum): {"name": "eqnCoverageForPowerOperator", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, {"name": "eqnCoverageForRootOperator", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, {"name": "eqnCoverageForMinusUnary", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnNlaVariable1", "units": "dimensionless", "component": "my_component", "type": VariableType.ALGEBRAIC}, - {"name": "eqnNlaVariable2", "units": "dimensionless", "component": "my_component", "type": VariableType.ALGEBRAIC}, {"name": "eqnComputedConstant1", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnComputedConstant2", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT} + {"name": "eqnComputedConstant2", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, + {"name": "eqnNlaVariable1", "units": "dimensionless", "component": "my_component", "type": VariableType.ALGEBRAIC}, + {"name": "eqnNlaVariable2", "units": "dimensionless", "component": "my_component", "type": VariableType.ALGEBRAIC} ] diff --git a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.c b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.c index 7ad5b190a0..ef4da021e4 100644 --- a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.c +++ b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.c @@ -9,9 +9,8 @@ const char VERSION[] = "0.6.0"; const char LIBCELLML_VERSION[] = "0.5.0"; const size_t CONSTANT_COUNT = 0; -const size_t COMPUTED_CONSTANT_COUNT = 0; -const size_t ALGEBRAIC_COUNT = 2; -const size_t EXTERNAL_COUNT = 0; +const size_t COMPUTED_CONSTANT_COUNT = 2; +const size_t ALGEBRAIC_COUNT = 0; const VariableInfo VARIABLE_INFO[] = { {"x", "dimensionless", "my_algebraic_eqn", COMPUTED_CONSTANT}, diff --git a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.c b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.c index 665df96680..37cec86d32 100644 --- a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.c +++ b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.c @@ -10,8 +10,8 @@ const char LIBCELLML_VERSION[] = "0.5.0"; const size_t CONSTANT_COUNT = 0; const size_t COMPUTED_CONSTANT_COUNT = 0; -const size_t ALGEBRAIC_COUNT = 2; -const size_t EXTERNAL_COUNT = 0; +const size_t ALGEBRAIC_COUNT = 1; +const size_t EXTERNAL_COUNT = 1; const VariableInfo VARIABLE_INFO[] = { {"x", "dimensionless", "my_algebraic_eqn", ALGEBRAIC}, diff --git a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.py b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.py index 1d135a8d6b..7168da1a35 100644 --- a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.py +++ b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.py @@ -9,8 +9,8 @@ CONSTANT_COUNT = 0 COMPUTED_CONSTANT_COUNT = 0 -ALGEBRAIC_COUNT = 2 -EXTERNAL_COUNT = 0 +ALGEBRAIC_COUNT = 1 +EXTERNAL_COUNT = 1 class VariableType(Enum): diff --git a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.h b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.h index ffa08d4179..8b9a1fb666 100644 --- a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.h +++ b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.h @@ -10,7 +10,6 @@ extern const char LIBCELLML_VERSION[]; extern const size_t CONSTANT_COUNT; extern const size_t COMPUTED_CONSTANT_COUNT; extern const size_t ALGEBRAIC_COUNT; -extern const size_t EXTERNAL_COUNT; typedef enum { CONSTANT, diff --git a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.py b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.py index a89a1f8728..c3b91e3df4 100644 --- a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.py +++ b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.py @@ -8,9 +8,8 @@ LIBCELLML_VERSION = "0.5.0" CONSTANT_COUNT = 0 -COMPUTED_CONSTANT_COUNT = 0 -ALGEBRAIC_COUNT = 2 -EXTERNAL_COUNT = 0 +COMPUTED_CONSTANT_COUNT = 2 +ALGEBRAIC_COUNT = 0 class VariableType(Enum): diff --git a/tests/resources/generator/algebraic_eqn_const_var_on_rhs/model.c b/tests/resources/generator/algebraic_eqn_const_var_on_rhs/model.c index a907301925..b9b36994d3 100644 --- a/tests/resources/generator/algebraic_eqn_const_var_on_rhs/model.c +++ b/tests/resources/generator/algebraic_eqn_const_var_on_rhs/model.c @@ -8,14 +8,13 @@ const char VERSION[] = "0.6.0"; const char LIBCELLML_VERSION[] = "0.5.0"; -const size_t CONSTANT_COUNT = 0; -const size_t COMPUTED_CONSTANT_COUNT = 0; -const size_t ALGEBRAIC_COUNT = 2; -const size_t EXTERNAL_COUNT = 0; +const size_t CONSTANT_COUNT = 1; +const size_t COMPUTED_CONSTANT_COUNT = 1; +const size_t ALGEBRAIC_COUNT = 0; const VariableInfo VARIABLE_INFO[] = { - {"x", "dimensionless", "my_algebraic_eqn", COMPUTED_CONSTANT}, - {"a", "dimensionless", "my_algebraic_eqn", CONSTANT} + {"a", "dimensionless", "my_algebraic_eqn", CONSTANT}, + {"x", "dimensionless", "my_algebraic_eqn", COMPUTED_CONSTANT} }; double * createVariablesArray() diff --git a/tests/resources/generator/algebraic_eqn_const_var_on_rhs/model.h b/tests/resources/generator/algebraic_eqn_const_var_on_rhs/model.h index ffa08d4179..8b9a1fb666 100644 --- a/tests/resources/generator/algebraic_eqn_const_var_on_rhs/model.h +++ b/tests/resources/generator/algebraic_eqn_const_var_on_rhs/model.h @@ -10,7 +10,6 @@ extern const char LIBCELLML_VERSION[]; extern const size_t CONSTANT_COUNT; extern const size_t COMPUTED_CONSTANT_COUNT; extern const size_t ALGEBRAIC_COUNT; -extern const size_t EXTERNAL_COUNT; typedef enum { CONSTANT, diff --git a/tests/resources/generator/algebraic_eqn_const_var_on_rhs/model.py b/tests/resources/generator/algebraic_eqn_const_var_on_rhs/model.py index cac3a4142d..034cacb34e 100644 --- a/tests/resources/generator/algebraic_eqn_const_var_on_rhs/model.py +++ b/tests/resources/generator/algebraic_eqn_const_var_on_rhs/model.py @@ -7,10 +7,9 @@ __version__ = "0.5.0" LIBCELLML_VERSION = "0.5.0" -CONSTANT_COUNT = 0 -COMPUTED_CONSTANT_COUNT = 0 -ALGEBRAIC_COUNT = 2 -EXTERNAL_COUNT = 0 +CONSTANT_COUNT = 1 +COMPUTED_CONSTANT_COUNT = 1 +ALGEBRAIC_COUNT = 0 class VariableType(Enum): @@ -20,8 +19,8 @@ class VariableType(Enum): VARIABLE_INFO = [ - {"name": "x", "units": "dimensionless", "component": "my_algebraic_eqn", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "a", "units": "dimensionless", "component": "my_algebraic_eqn", "type": VariableType.CONSTANT} + {"name": "a", "units": "dimensionless", "component": "my_algebraic_eqn", "type": VariableType.CONSTANT}, + {"name": "x", "units": "dimensionless", "component": "my_algebraic_eqn", "type": VariableType.COMPUTED_CONSTANT} ] diff --git a/tests/resources/generator/algebraic_eqn_constant_on_rhs/model.c b/tests/resources/generator/algebraic_eqn_constant_on_rhs/model.c index b2142ca770..5e25719055 100644 --- a/tests/resources/generator/algebraic_eqn_constant_on_rhs/model.c +++ b/tests/resources/generator/algebraic_eqn_constant_on_rhs/model.c @@ -9,9 +9,8 @@ const char VERSION[] = "0.6.0"; const char LIBCELLML_VERSION[] = "0.5.0"; const size_t CONSTANT_COUNT = 0; -const size_t COMPUTED_CONSTANT_COUNT = 0; -const size_t ALGEBRAIC_COUNT = 1; -const size_t EXTERNAL_COUNT = 0; +const size_t COMPUTED_CONSTANT_COUNT = 1; +const size_t ALGEBRAIC_COUNT = 0; const VariableInfo VARIABLE_INFO[] = { {"x", "dimensionless", "my_component", COMPUTED_CONSTANT} diff --git a/tests/resources/generator/algebraic_eqn_constant_on_rhs/model.h b/tests/resources/generator/algebraic_eqn_constant_on_rhs/model.h index e5928a2fe5..d26413c671 100644 --- a/tests/resources/generator/algebraic_eqn_constant_on_rhs/model.h +++ b/tests/resources/generator/algebraic_eqn_constant_on_rhs/model.h @@ -10,7 +10,6 @@ extern const char LIBCELLML_VERSION[]; extern const size_t CONSTANT_COUNT; extern const size_t COMPUTED_CONSTANT_COUNT; extern const size_t ALGEBRAIC_COUNT; -extern const size_t EXTERNAL_COUNT; typedef enum { CONSTANT, diff --git a/tests/resources/generator/algebraic_eqn_constant_on_rhs/model.py b/tests/resources/generator/algebraic_eqn_constant_on_rhs/model.py index e5238d296c..b36b39ca8b 100644 --- a/tests/resources/generator/algebraic_eqn_constant_on_rhs/model.py +++ b/tests/resources/generator/algebraic_eqn_constant_on_rhs/model.py @@ -8,9 +8,8 @@ LIBCELLML_VERSION = "0.5.0" CONSTANT_COUNT = 0 -COMPUTED_CONSTANT_COUNT = 0 -ALGEBRAIC_COUNT = 1 -EXTERNAL_COUNT = 0 +COMPUTED_CONSTANT_COUNT = 1 +ALGEBRAIC_COUNT = 0 class VariableType(Enum): diff --git a/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.c b/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.c index 9cb7a3000a..5f56854dda 100644 --- a/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.c +++ b/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.c @@ -10,9 +10,8 @@ const char LIBCELLML_VERSION[] = "0.5.0"; const size_t STATE_COUNT = 1; const size_t CONSTANT_COUNT = 0; -const size_t COMPUTED_CONSTANT_COUNT = 0; -const size_t ALGEBRAIC_COUNT = 2; -const size_t EXTERNAL_COUNT = 0; +const size_t COMPUTED_CONSTANT_COUNT = 1; +const size_t ALGEBRAIC_COUNT = 1; const VariableInfo VOI_INFO = {"t", "second", "environment", VARIABLE_OF_INTEGRATION}; diff --git a/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.h b/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.h index 02e634a295..1eeee2f1e3 100644 --- a/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.h +++ b/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.h @@ -11,7 +11,6 @@ extern const size_t STATE_COUNT; extern const size_t CONSTANT_COUNT; extern const size_t COMPUTED_CONSTANT_COUNT; extern const size_t ALGEBRAIC_COUNT; -extern const size_t EXTERNAL_COUNT; typedef enum { VARIABLE_OF_INTEGRATION, diff --git a/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.py b/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.py index ed4157ad3c..b68e0ff042 100644 --- a/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.py +++ b/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.py @@ -9,9 +9,8 @@ STATE_COUNT = 1 CONSTANT_COUNT = 0 -COMPUTED_CONSTANT_COUNT = 0 -ALGEBRAIC_COUNT = 2 -EXTERNAL_COUNT = 0 +COMPUTED_CONSTANT_COUNT = 1 +ALGEBRAIC_COUNT = 1 class VariableType(Enum): diff --git a/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.c b/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.c index 75a65fe9c5..4449ebc701 100644 --- a/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.c +++ b/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.c @@ -10,9 +10,8 @@ const char LIBCELLML_VERSION[] = "0.5.0"; const size_t STATE_COUNT = 1; const size_t CONSTANT_COUNT = 0; -const size_t COMPUTED_CONSTANT_COUNT = 0; -const size_t ALGEBRAIC_COUNT = 2; -const size_t EXTERNAL_COUNT = 0; +const size_t COMPUTED_CONSTANT_COUNT = 1; +const size_t ALGEBRAIC_COUNT = 1; const VariableInfo VOI_INFO = {"t", "second", "my_component", VARIABLE_OF_INTEGRATION}; diff --git a/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.h b/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.h index 89890cfa68..ca79cc5f25 100644 --- a/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.h +++ b/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.h @@ -11,7 +11,6 @@ extern const size_t STATE_COUNT; extern const size_t CONSTANT_COUNT; extern const size_t COMPUTED_CONSTANT_COUNT; extern const size_t ALGEBRAIC_COUNT; -extern const size_t EXTERNAL_COUNT; typedef enum { VARIABLE_OF_INTEGRATION, diff --git a/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.py b/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.py index 2e6d45e10f..3228a39f5b 100644 --- a/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.py +++ b/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.py @@ -9,9 +9,8 @@ STATE_COUNT = 1 CONSTANT_COUNT = 0 -COMPUTED_CONSTANT_COUNT = 0 -ALGEBRAIC_COUNT = 2 -EXTERNAL_COUNT = 0 +COMPUTED_CONSTANT_COUNT = 1 +ALGEBRAIC_COUNT = 1 class VariableType(Enum): diff --git a/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.c b/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.c index c6a0f3adf8..32f1de15fa 100644 --- a/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.c +++ b/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.c @@ -10,9 +10,8 @@ const char LIBCELLML_VERSION[] = "0.5.0"; const size_t STATE_COUNT = 1; const size_t CONSTANT_COUNT = 0; -const size_t COMPUTED_CONSTANT_COUNT = 0; -const size_t ALGEBRAIC_COUNT = 2; -const size_t EXTERNAL_COUNT = 0; +const size_t COMPUTED_CONSTANT_COUNT = 1; +const size_t ALGEBRAIC_COUNT = 1; const VariableInfo VOI_INFO = {"t", "second", "environment", VARIABLE_OF_INTEGRATION}; diff --git a/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.h b/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.h index 60658293a0..d2a3025e39 100644 --- a/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.h +++ b/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.h @@ -11,7 +11,6 @@ extern const size_t STATE_COUNT; extern const size_t CONSTANT_COUNT; extern const size_t COMPUTED_CONSTANT_COUNT; extern const size_t ALGEBRAIC_COUNT; -extern const size_t EXTERNAL_COUNT; typedef enum { VARIABLE_OF_INTEGRATION, diff --git a/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.py b/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.py index fe2cececb1..44baf1642b 100644 --- a/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.py +++ b/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.py @@ -9,9 +9,8 @@ STATE_COUNT = 1 CONSTANT_COUNT = 0 -COMPUTED_CONSTANT_COUNT = 0 -ALGEBRAIC_COUNT = 2 -EXTERNAL_COUNT = 0 +COMPUTED_CONSTANT_COUNT = 1 +ALGEBRAIC_COUNT = 1 class VariableType(Enum): diff --git a/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.c b/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.c index 2a8dbbed53..352e5bd87c 100644 --- a/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.c +++ b/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.c @@ -10,9 +10,8 @@ const char LIBCELLML_VERSION[] = "0.5.0"; const size_t STATE_COUNT = 1; const size_t CONSTANT_COUNT = 0; -const size_t COMPUTED_CONSTANT_COUNT = 0; -const size_t ALGEBRAIC_COUNT = 2; -const size_t EXTERNAL_COUNT = 0; +const size_t COMPUTED_CONSTANT_COUNT = 1; +const size_t ALGEBRAIC_COUNT = 1; const VariableInfo VOI_INFO = {"t", "second", "my_model", VARIABLE_OF_INTEGRATION}; diff --git a/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.h b/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.h index e98ffacdf3..cfae2b1d2f 100644 --- a/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.h +++ b/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.h @@ -11,7 +11,6 @@ extern const size_t STATE_COUNT; extern const size_t CONSTANT_COUNT; extern const size_t COMPUTED_CONSTANT_COUNT; extern const size_t ALGEBRAIC_COUNT; -extern const size_t EXTERNAL_COUNT; typedef enum { VARIABLE_OF_INTEGRATION, diff --git a/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.py b/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.py index a91cadb067..1a8d75e50b 100644 --- a/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.py +++ b/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.py @@ -9,9 +9,8 @@ STATE_COUNT = 1 CONSTANT_COUNT = 0 -COMPUTED_CONSTANT_COUNT = 0 -ALGEBRAIC_COUNT = 2 -EXTERNAL_COUNT = 0 +COMPUTED_CONSTANT_COUNT = 1 +ALGEBRAIC_COUNT = 1 class VariableType(Enum): diff --git a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.c b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.c index 75c1d28aed..78af0f1c1f 100644 --- a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.c +++ b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.c @@ -9,9 +9,8 @@ const char VERSION[] = "0.6.0"; const char LIBCELLML_VERSION[] = "0.5.0"; const size_t CONSTANT_COUNT = 0; -const size_t COMPUTED_CONSTANT_COUNT = 0; -const size_t ALGEBRAIC_COUNT = 4; -const size_t EXTERNAL_COUNT = 0; +const size_t COMPUTED_CONSTANT_COUNT = 3; +const size_t ALGEBRAIC_COUNT = 1; const VariableInfo VARIABLE_INFO[] = { {"b", "dimensionless", "my_algebraic_eqn", COMPUTED_CONSTANT}, diff --git a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.c b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.c index ce37e089b2..5e1f7d6b8c 100644 --- a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.c +++ b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.c @@ -9,9 +9,9 @@ const char VERSION[] = "0.6.0"; const char LIBCELLML_VERSION[] = "0.5.0"; const size_t CONSTANT_COUNT = 0; -const size_t COMPUTED_CONSTANT_COUNT = 0; -const size_t ALGEBRAIC_COUNT = 4; -const size_t EXTERNAL_COUNT = 0; +const size_t COMPUTED_CONSTANT_COUNT = 3; +const size_t ALGEBRAIC_COUNT = 0; +const size_t EXTERNAL_COUNT = 1; const VariableInfo VARIABLE_INFO[] = { {"b", "dimensionless", "my_algebraic_eqn", COMPUTED_CONSTANT}, diff --git a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.py b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.py index 3998dee561..ed3205098b 100644 --- a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.py +++ b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.py @@ -8,9 +8,9 @@ LIBCELLML_VERSION = "0.5.0" CONSTANT_COUNT = 0 -COMPUTED_CONSTANT_COUNT = 0 -ALGEBRAIC_COUNT = 4 -EXTERNAL_COUNT = 0 +COMPUTED_CONSTANT_COUNT = 3 +ALGEBRAIC_COUNT = 0 +EXTERNAL_COUNT = 1 class VariableType(Enum): diff --git a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.h b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.h index ffa08d4179..8b9a1fb666 100644 --- a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.h +++ b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.h @@ -10,7 +10,6 @@ extern const char LIBCELLML_VERSION[]; extern const size_t CONSTANT_COUNT; extern const size_t COMPUTED_CONSTANT_COUNT; extern const size_t ALGEBRAIC_COUNT; -extern const size_t EXTERNAL_COUNT; typedef enum { CONSTANT, diff --git a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.py b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.py index e823ec04ac..1f349758b7 100644 --- a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.py +++ b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.py @@ -8,9 +8,8 @@ LIBCELLML_VERSION = "0.5.0" CONSTANT_COUNT = 0 -COMPUTED_CONSTANT_COUNT = 0 -ALGEBRAIC_COUNT = 4 -EXTERNAL_COUNT = 0 +COMPUTED_CONSTANT_COUNT = 3 +ALGEBRAIC_COUNT = 1 class VariableType(Enum): diff --git a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.c b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.c index 3fed4a9e13..eb6d409ade 100644 --- a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.c +++ b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.c @@ -11,7 +11,6 @@ const char LIBCELLML_VERSION[] = "0.5.0"; const size_t CONSTANT_COUNT = 0; const size_t COMPUTED_CONSTANT_COUNT = 0; const size_t ALGEBRAIC_COUNT = 3; -const size_t EXTERNAL_COUNT = 0; const VariableInfo VARIABLE_INFO[] = { {"x", "dimensionless", "my_algebraic_system", ALGEBRAIC}, diff --git a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.h b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.h index fee170f4b2..69ce3f6763 100644 --- a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.h +++ b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.h @@ -10,7 +10,6 @@ extern const char LIBCELLML_VERSION[]; extern const size_t CONSTANT_COUNT; extern const size_t COMPUTED_CONSTANT_COUNT; extern const size_t ALGEBRAIC_COUNT; -extern const size_t EXTERNAL_COUNT; typedef enum { CONSTANT, diff --git a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.py b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.py index 16bd44fe49..de50e042ec 100644 --- a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.py +++ b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.py @@ -10,7 +10,6 @@ CONSTANT_COUNT = 0 COMPUTED_CONSTANT_COUNT = 0 ALGEBRAIC_COUNT = 3 -EXTERNAL_COUNT = 0 class VariableType(Enum): diff --git a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.c b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.c index 827f341f93..a22f00fad6 100644 --- a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.c +++ b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.c @@ -10,8 +10,8 @@ const char LIBCELLML_VERSION[] = "0.5.0"; const size_t CONSTANT_COUNT = 0; const size_t COMPUTED_CONSTANT_COUNT = 0; -const size_t ALGEBRAIC_COUNT = 3; -const size_t EXTERNAL_COUNT = 0; +const size_t ALGEBRAIC_COUNT = 0; +const size_t EXTERNAL_COUNT = 3; const VariableInfo VARIABLE_INFO[] = { {"x", "dimensionless", "my_algebraic_system", EXTERNAL}, diff --git a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.h b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.h index 0c3b6b4a50..7650d5f48b 100644 --- a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.h +++ b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.h @@ -20,9 +20,9 @@ typedef enum { } VariableType; typedef struct { - char name[2]; - char units[14]; - char component[20]; + char name[0]; + char units[0]; + char component[0]; VariableType type; } VariableInfo; diff --git a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.py b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.py index bdb2fe0fe1..c79c816133 100644 --- a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.py +++ b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.py @@ -9,8 +9,8 @@ CONSTANT_COUNT = 0 COMPUTED_CONSTANT_COUNT = 0 -ALGEBRAIC_COUNT = 3 -EXTERNAL_COUNT = 0 +ALGEBRAIC_COUNT = 0 +EXTERNAL_COUNT = 3 class VariableType(Enum): diff --git a/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.c b/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.c index c1b94c1827..be81938b4f 100644 --- a/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.c +++ b/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.c @@ -8,18 +8,17 @@ const char VERSION[] = "0.6.0"; const char LIBCELLML_VERSION[] = "0.5.0"; -const size_t CONSTANT_COUNT = 0; -const size_t COMPUTED_CONSTANT_COUNT = 0; -const size_t ALGEBRAIC_COUNT = 6; -const size_t EXTERNAL_COUNT = 0; +const size_t CONSTANT_COUNT = 2; +const size_t COMPUTED_CONSTANT_COUNT = 1; +const size_t ALGEBRAIC_COUNT = 3; const VariableInfo VARIABLE_INFO[] = { + {"x", "dimensionless", "my_algebraic_system", CONSTANT}, + {"y", "dimensionless", "my_algebraic_system", CONSTANT}, + {"a", "dimensionless", "my_algebraic_system", COMPUTED_CONSTANT}, {"d", "dimensionless", "my_algebraic_system", ALGEBRAIC}, {"b", "dimensionless", "my_algebraic_system", ALGEBRAIC}, - {"c", "dimensionless", "my_algebraic_system", ALGEBRAIC}, - {"a", "dimensionless", "my_algebraic_system", COMPUTED_CONSTANT}, - {"x", "dimensionless", "my_algebraic_system", CONSTANT}, - {"y", "dimensionless", "my_algebraic_system", CONSTANT} + {"c", "dimensionless", "my_algebraic_system", ALGEBRAIC} }; double * createVariablesArray() @@ -72,10 +71,10 @@ void findRoot0(double *variables) void initialiseVariables(double *constants) { - algebraic[1] = 1.0; - algebraic[2] = 1.0; constants[0] = 3.0; constants[1] = 5.0; + algebraic[1] = 1.0; + algebraic[2] = 1.0; } void computeComputedConstants(double *constants, double *computedConstants) diff --git a/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.h b/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.h index fee170f4b2..69ce3f6763 100644 --- a/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.h +++ b/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.h @@ -10,7 +10,6 @@ extern const char LIBCELLML_VERSION[]; extern const size_t CONSTANT_COUNT; extern const size_t COMPUTED_CONSTANT_COUNT; extern const size_t ALGEBRAIC_COUNT; -extern const size_t EXTERNAL_COUNT; typedef enum { CONSTANT, diff --git a/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.py b/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.py index 8a734a9a37..a10c6ed591 100644 --- a/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.py +++ b/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.py @@ -7,10 +7,9 @@ __version__ = "0.5.0" LIBCELLML_VERSION = "0.5.0" -CONSTANT_COUNT = 0 -COMPUTED_CONSTANT_COUNT = 0 -ALGEBRAIC_COUNT = 6 -EXTERNAL_COUNT = 0 +CONSTANT_COUNT = 2 +COMPUTED_CONSTANT_COUNT = 1 +ALGEBRAIC_COUNT = 3 class VariableType(Enum): @@ -20,12 +19,12 @@ class VariableType(Enum): VARIABLE_INFO = [ + {"name": "x", "units": "dimensionless", "component": "my_algebraic_system", "type": VariableType.CONSTANT}, + {"name": "y", "units": "dimensionless", "component": "my_algebraic_system", "type": VariableType.CONSTANT}, + {"name": "a", "units": "dimensionless", "component": "my_algebraic_system", "type": VariableType.COMPUTED_CONSTANT}, {"name": "d", "units": "dimensionless", "component": "my_algebraic_system", "type": VariableType.ALGEBRAIC}, {"name": "b", "units": "dimensionless", "component": "my_algebraic_system", "type": VariableType.ALGEBRAIC}, - {"name": "c", "units": "dimensionless", "component": "my_algebraic_system", "type": VariableType.ALGEBRAIC}, - {"name": "a", "units": "dimensionless", "component": "my_algebraic_system", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "x", "units": "dimensionless", "component": "my_algebraic_system", "type": VariableType.CONSTANT}, - {"name": "y", "units": "dimensionless", "component": "my_algebraic_system", "type": VariableType.CONSTANT} + {"name": "c", "units": "dimensionless", "component": "my_algebraic_system", "type": VariableType.ALGEBRAIC} ] @@ -59,10 +58,10 @@ def find_root_0(variables): def initialise_variables(constants): - algebraic[1] = 1.0 - algebraic[2] = 1.0 constants[0] = 3.0 constants[1] = 5.0 + algebraic[1] = 1.0 + algebraic[2] = 1.0 def compute_computed_constants(constants, computed_constants): diff --git a/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.c b/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.c index 15de97b498..df91e1567d 100644 --- a/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.c +++ b/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.c @@ -8,15 +8,14 @@ const char VERSION[] = "0.6.0"; const char LIBCELLML_VERSION[] = "0.5.0"; -const size_t CONSTANT_COUNT = 0; -const size_t COMPUTED_CONSTANT_COUNT = 0; -const size_t ALGEBRAIC_COUNT = 6; -const size_t EXTERNAL_COUNT = 0; +const size_t CONSTANT_COUNT = 2; +const size_t COMPUTED_CONSTANT_COUNT = 1; +const size_t ALGEBRAIC_COUNT = 3; const VariableInfo VARIABLE_INFO[] = { - {"a", "dimensionless", "my_algebraic_system", COMPUTED_CONSTANT}, {"x", "dimensionless", "my_algebraic_system", CONSTANT}, {"y", "dimensionless", "my_algebraic_system", CONSTANT}, + {"a", "dimensionless", "my_algebraic_system", COMPUTED_CONSTANT}, {"c", "dimensionless", "my_algebraic_system", ALGEBRAIC}, {"b", "dimensionless", "my_algebraic_system", ALGEBRAIC}, {"d", "dimensionless", "my_algebraic_system", ALGEBRAIC} diff --git a/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.h b/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.h index fee170f4b2..69ce3f6763 100644 --- a/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.h +++ b/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.h @@ -10,7 +10,6 @@ extern const char LIBCELLML_VERSION[]; extern const size_t CONSTANT_COUNT; extern const size_t COMPUTED_CONSTANT_COUNT; extern const size_t ALGEBRAIC_COUNT; -extern const size_t EXTERNAL_COUNT; typedef enum { CONSTANT, diff --git a/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.py b/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.py index e842a7e565..3272ba8398 100644 --- a/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.py +++ b/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.py @@ -7,10 +7,9 @@ __version__ = "0.5.0" LIBCELLML_VERSION = "0.5.0" -CONSTANT_COUNT = 0 -COMPUTED_CONSTANT_COUNT = 0 -ALGEBRAIC_COUNT = 6 -EXTERNAL_COUNT = 0 +CONSTANT_COUNT = 2 +COMPUTED_CONSTANT_COUNT = 1 +ALGEBRAIC_COUNT = 3 class VariableType(Enum): @@ -20,9 +19,9 @@ class VariableType(Enum): VARIABLE_INFO = [ - {"name": "a", "units": "dimensionless", "component": "my_algebraic_system", "type": VariableType.COMPUTED_CONSTANT}, {"name": "x", "units": "dimensionless", "component": "my_algebraic_system", "type": VariableType.CONSTANT}, {"name": "y", "units": "dimensionless", "component": "my_algebraic_system", "type": VariableType.CONSTANT}, + {"name": "a", "units": "dimensionless", "component": "my_algebraic_system", "type": VariableType.COMPUTED_CONSTANT}, {"name": "c", "units": "dimensionless", "component": "my_algebraic_system", "type": VariableType.ALGEBRAIC}, {"name": "b", "units": "dimensionless", "component": "my_algebraic_system", "type": VariableType.ALGEBRAIC}, {"name": "d", "units": "dimensionless", "component": "my_algebraic_system", "type": VariableType.ALGEBRAIC} diff --git a/tests/resources/generator/algebraic_unknown_var_on_rhs/model.c b/tests/resources/generator/algebraic_unknown_var_on_rhs/model.c index 0fab3f892e..bfdee7fae6 100644 --- a/tests/resources/generator/algebraic_unknown_var_on_rhs/model.c +++ b/tests/resources/generator/algebraic_unknown_var_on_rhs/model.c @@ -9,9 +9,8 @@ const char VERSION[] = "0.6.0"; const char LIBCELLML_VERSION[] = "0.5.0"; const size_t CONSTANT_COUNT = 0; -const size_t COMPUTED_CONSTANT_COUNT = 0; -const size_t ALGEBRAIC_COUNT = 2; -const size_t EXTERNAL_COUNT = 0; +const size_t COMPUTED_CONSTANT_COUNT = 2; +const size_t ALGEBRAIC_COUNT = 0; const VariableInfo VARIABLE_INFO[] = { {"x", "dimensionless", "my_component", COMPUTED_CONSTANT}, diff --git a/tests/resources/generator/algebraic_unknown_var_on_rhs/model.h b/tests/resources/generator/algebraic_unknown_var_on_rhs/model.h index e5928a2fe5..d26413c671 100644 --- a/tests/resources/generator/algebraic_unknown_var_on_rhs/model.h +++ b/tests/resources/generator/algebraic_unknown_var_on_rhs/model.h @@ -10,7 +10,6 @@ extern const char LIBCELLML_VERSION[]; extern const size_t CONSTANT_COUNT; extern const size_t COMPUTED_CONSTANT_COUNT; extern const size_t ALGEBRAIC_COUNT; -extern const size_t EXTERNAL_COUNT; typedef enum { CONSTANT, diff --git a/tests/resources/generator/algebraic_unknown_var_on_rhs/model.py b/tests/resources/generator/algebraic_unknown_var_on_rhs/model.py index 53f8993bf6..020c15fc01 100644 --- a/tests/resources/generator/algebraic_unknown_var_on_rhs/model.py +++ b/tests/resources/generator/algebraic_unknown_var_on_rhs/model.py @@ -8,9 +8,8 @@ LIBCELLML_VERSION = "0.5.0" CONSTANT_COUNT = 0 -COMPUTED_CONSTANT_COUNT = 0 -ALGEBRAIC_COUNT = 2 -EXTERNAL_COUNT = 0 +COMPUTED_CONSTANT_COUNT = 2 +ALGEBRAIC_COUNT = 0 class VariableType(Enum): diff --git a/tests/resources/generator/cell_geometry_model/model.c b/tests/resources/generator/cell_geometry_model/model.c index e6391bb731..1d2073048e 100644 --- a/tests/resources/generator/cell_geometry_model/model.c +++ b/tests/resources/generator/cell_geometry_model/model.c @@ -8,15 +8,14 @@ const char VERSION[] = "0.6.0"; const char LIBCELLML_VERSION[] = "0.5.0"; -const size_t CONSTANT_COUNT = 0; -const size_t COMPUTED_CONSTANT_COUNT = 0; -const size_t ALGEBRAIC_COUNT = 4; -const size_t EXTERNAL_COUNT = 0; +const size_t CONSTANT_COUNT = 2; +const size_t COMPUTED_CONSTANT_COUNT = 2; +const size_t ALGEBRAIC_COUNT = 0; const VariableInfo VARIABLE_INFO[] = { - {"vcell", "microlitre", "cell_geometry", COMPUTED_CONSTANT}, {"L", "centimeter", "cell_geometry", CONSTANT}, {"rad", "centimeter", "cell_geometry", CONSTANT}, + {"vcell", "microlitre", "cell_geometry", COMPUTED_CONSTANT}, {"vss", "microlitre", "cell_geometry", COMPUTED_CONSTANT} }; diff --git a/tests/resources/generator/cell_geometry_model/model.external.c b/tests/resources/generator/cell_geometry_model/model.external.c index 8ecb305e9a..4fe760dd4a 100644 --- a/tests/resources/generator/cell_geometry_model/model.external.c +++ b/tests/resources/generator/cell_geometry_model/model.external.c @@ -10,14 +10,14 @@ const char LIBCELLML_VERSION[] = "0.5.0"; const size_t CONSTANT_COUNT = 0; const size_t COMPUTED_CONSTANT_COUNT = 0; -const size_t ALGEBRAIC_COUNT = 4; -const size_t EXTERNAL_COUNT = 0; +const size_t ALGEBRAIC_COUNT = 2; +const size_t EXTERNAL_COUNT = 2; const VariableInfo VARIABLE_INFO[] = { {"vcell", "microlitre", "cell_geometry", ALGEBRAIC}, + {"vss", "microlitre", "cell_geometry", ALGEBRAIC}, {"L", "centimeter", "cell_geometry", EXTERNAL}, - {"rad", "centimeter", "cell_geometry", EXTERNAL}, - {"vss", "microlitre", "cell_geometry", ALGEBRAIC} + {"rad", "centimeter", "cell_geometry", EXTERNAL} }; double * createVariablesArray() diff --git a/tests/resources/generator/cell_geometry_model/model.external.py b/tests/resources/generator/cell_geometry_model/model.external.py index 2bf7fb6137..4c1af8bb9f 100644 --- a/tests/resources/generator/cell_geometry_model/model.external.py +++ b/tests/resources/generator/cell_geometry_model/model.external.py @@ -9,8 +9,8 @@ CONSTANT_COUNT = 0 COMPUTED_CONSTANT_COUNT = 0 -ALGEBRAIC_COUNT = 4 -EXTERNAL_COUNT = 0 +ALGEBRAIC_COUNT = 2 +EXTERNAL_COUNT = 2 class VariableType(Enum): @@ -22,9 +22,9 @@ class VariableType(Enum): VARIABLE_INFO = [ {"name": "vcell", "units": "microlitre", "component": "cell_geometry", "type": VariableType.ALGEBRAIC}, + {"name": "vss", "units": "microlitre", "component": "cell_geometry", "type": VariableType.ALGEBRAIC}, {"name": "L", "units": "centimeter", "component": "cell_geometry", "type": VariableType.EXTERNAL}, - {"name": "rad", "units": "centimeter", "component": "cell_geometry", "type": VariableType.EXTERNAL}, - {"name": "vss", "units": "microlitre", "component": "cell_geometry", "type": VariableType.ALGEBRAIC} + {"name": "rad", "units": "centimeter", "component": "cell_geometry", "type": VariableType.EXTERNAL} ] diff --git a/tests/resources/generator/cell_geometry_model/model.h b/tests/resources/generator/cell_geometry_model/model.h index ef37e5ea59..d291cbc391 100644 --- a/tests/resources/generator/cell_geometry_model/model.h +++ b/tests/resources/generator/cell_geometry_model/model.h @@ -10,7 +10,6 @@ extern const char LIBCELLML_VERSION[]; extern const size_t CONSTANT_COUNT; extern const size_t COMPUTED_CONSTANT_COUNT; extern const size_t ALGEBRAIC_COUNT; -extern const size_t EXTERNAL_COUNT; typedef enum { CONSTANT, diff --git a/tests/resources/generator/cell_geometry_model/model.py b/tests/resources/generator/cell_geometry_model/model.py index eb269347e4..b25e428a56 100644 --- a/tests/resources/generator/cell_geometry_model/model.py +++ b/tests/resources/generator/cell_geometry_model/model.py @@ -7,10 +7,9 @@ __version__ = "0.5.0" LIBCELLML_VERSION = "0.5.0" -CONSTANT_COUNT = 0 -COMPUTED_CONSTANT_COUNT = 0 -ALGEBRAIC_COUNT = 4 -EXTERNAL_COUNT = 0 +CONSTANT_COUNT = 2 +COMPUTED_CONSTANT_COUNT = 2 +ALGEBRAIC_COUNT = 0 class VariableType(Enum): @@ -20,9 +19,9 @@ class VariableType(Enum): VARIABLE_INFO = [ - {"name": "vcell", "units": "microlitre", "component": "cell_geometry", "type": VariableType.COMPUTED_CONSTANT}, {"name": "L", "units": "centimeter", "component": "cell_geometry", "type": VariableType.CONSTANT}, {"name": "rad", "units": "centimeter", "component": "cell_geometry", "type": VariableType.CONSTANT}, + {"name": "vcell", "units": "microlitre", "component": "cell_geometry", "type": VariableType.COMPUTED_CONSTANT}, {"name": "vss", "units": "microlitre", "component": "cell_geometry", "type": VariableType.COMPUTED_CONSTANT} ] diff --git a/tests/resources/generator/cellml_mappings_and_encapsulations/model.c b/tests/resources/generator/cellml_mappings_and_encapsulations/model.c index 92bf0a4fb9..3f59baaf87 100644 --- a/tests/resources/generator/cellml_mappings_and_encapsulations/model.c +++ b/tests/resources/generator/cellml_mappings_and_encapsulations/model.c @@ -12,7 +12,6 @@ const size_t STATE_COUNT = 2; const size_t CONSTANT_COUNT = 0; const size_t COMPUTED_CONSTANT_COUNT = 0; const size_t ALGEBRAIC_COUNT = 2; -const size_t EXTERNAL_COUNT = 0; const VariableInfo VOI_INFO = {"t", "ms", "environment", VARIABLE_OF_INTEGRATION}; diff --git a/tests/resources/generator/cellml_mappings_and_encapsulations/model.h b/tests/resources/generator/cellml_mappings_and_encapsulations/model.h index 2aab41a47f..91a2bbdb90 100644 --- a/tests/resources/generator/cellml_mappings_and_encapsulations/model.h +++ b/tests/resources/generator/cellml_mappings_and_encapsulations/model.h @@ -11,7 +11,6 @@ extern const size_t STATE_COUNT; extern const size_t CONSTANT_COUNT; extern const size_t COMPUTED_CONSTANT_COUNT; extern const size_t ALGEBRAIC_COUNT; -extern const size_t EXTERNAL_COUNT; typedef enum { VARIABLE_OF_INTEGRATION, diff --git a/tests/resources/generator/cellml_mappings_and_encapsulations/model.py b/tests/resources/generator/cellml_mappings_and_encapsulations/model.py index 8ecaaaaa46..42799d8118 100644 --- a/tests/resources/generator/cellml_mappings_and_encapsulations/model.py +++ b/tests/resources/generator/cellml_mappings_and_encapsulations/model.py @@ -11,7 +11,6 @@ CONSTANT_COUNT = 0 COMPUTED_CONSTANT_COUNT = 0 ALGEBRAIC_COUNT = 2 -EXTERNAL_COUNT = 0 class VariableType(Enum): diff --git a/tests/resources/generator/cellml_slc_example/model.py b/tests/resources/generator/cellml_slc_example/model.py index 5ffe3d04ef..b03cf86487 100644 --- a/tests/resources/generator/cellml_slc_example/model.py +++ b/tests/resources/generator/cellml_slc_example/model.py @@ -7,10 +7,9 @@ __version__ = "0.5.0" LIBCELLML_VERSION = "0.5.0" -CONSTANT_COUNT = 0 -COMPUTED_CONSTANT_COUNT = 0 -ALGEBRAIC_COUNT = 10 -EXTERNAL_COUNT = 0 +CONSTANT_COUNT = 9 +COMPUTED_CONSTANT_COUNT = 1 +ALGEBRAIC_COUNT = 0 class VariableType(Enum): @@ -20,7 +19,6 @@ class VariableType(Enum): VARIABLE_INFO = [ - {"name": "v", "units": "fmol_per_sec", "component": "SLC_template3_ss", "type": VariableType.COMPUTED_CONSTANT}, {"name": "E", "units": "fmol", "component": "SLC_template3_ss", "type": VariableType.CONSTANT}, {"name": "P_0", "units": "per_fmol_sec4", "component": "SLC_template3_ss", "type": VariableType.CONSTANT}, {"name": "q_Ao", "units": "fmol", "component": "SLC_template3_ss", "type": VariableType.CONSTANT}, @@ -29,7 +27,8 @@ class VariableType(Enum): {"name": "P_2", "units": "per_fmol_sec3", "component": "SLC_template3_ss", "type": VariableType.CONSTANT}, {"name": "P_5", "units": "per_sec3", "component": "SLC_template3_ss", "type": VariableType.CONSTANT}, {"name": "P_4", "units": "per_fmol2_sec3", "component": "SLC_template3_ss", "type": VariableType.CONSTANT}, - {"name": "P_3", "units": "per_fmol_sec3", "component": "SLC_template3_ss", "type": VariableType.CONSTANT} + {"name": "P_3", "units": "per_fmol_sec3", "component": "SLC_template3_ss", "type": VariableType.CONSTANT}, + {"name": "v", "units": "fmol_per_sec", "component": "SLC_template3_ss", "type": VariableType.COMPUTED_CONSTANT} ] diff --git a/tests/resources/generator/cellml_state_initialised_using_variable/model.c b/tests/resources/generator/cellml_state_initialised_using_variable/model.c index 88193e176a..e8e13541c2 100644 --- a/tests/resources/generator/cellml_state_initialised_using_variable/model.c +++ b/tests/resources/generator/cellml_state_initialised_using_variable/model.c @@ -9,10 +9,9 @@ const char VERSION[] = "0.6.0"; const char LIBCELLML_VERSION[] = "0.5.0"; const size_t STATE_COUNT = 1; -const size_t CONSTANT_COUNT = 0; +const size_t CONSTANT_COUNT = 1; const size_t COMPUTED_CONSTANT_COUNT = 0; -const size_t ALGEBRAIC_COUNT = 1; -const size_t EXTERNAL_COUNT = 0; +const size_t ALGEBRAIC_COUNT = 0; const VariableInfo VOI_INFO = {"t", "ms", "environment", VARIABLE_OF_INTEGRATION}; diff --git a/tests/resources/generator/cellml_state_initialised_using_variable/model.h b/tests/resources/generator/cellml_state_initialised_using_variable/model.h index 1a5d4ce25e..e95d12eb15 100644 --- a/tests/resources/generator/cellml_state_initialised_using_variable/model.h +++ b/tests/resources/generator/cellml_state_initialised_using_variable/model.h @@ -11,7 +11,6 @@ extern const size_t STATE_COUNT; extern const size_t CONSTANT_COUNT; extern const size_t COMPUTED_CONSTANT_COUNT; extern const size_t ALGEBRAIC_COUNT; -extern const size_t EXTERNAL_COUNT; typedef enum { VARIABLE_OF_INTEGRATION, diff --git a/tests/resources/generator/cellml_state_initialised_using_variable/model.py b/tests/resources/generator/cellml_state_initialised_using_variable/model.py index ff1defc395..5aae09a47d 100644 --- a/tests/resources/generator/cellml_state_initialised_using_variable/model.py +++ b/tests/resources/generator/cellml_state_initialised_using_variable/model.py @@ -8,10 +8,9 @@ LIBCELLML_VERSION = "0.5.0" STATE_COUNT = 1 -CONSTANT_COUNT = 0 +CONSTANT_COUNT = 1 COMPUTED_CONSTANT_COUNT = 0 -ALGEBRAIC_COUNT = 1 -EXTERNAL_COUNT = 0 +ALGEBRAIC_COUNT = 0 class VariableType(Enum): diff --git a/tests/resources/generator/cellml_unit_scaling_constant/model.c b/tests/resources/generator/cellml_unit_scaling_constant/model.c index 616edc4038..21638fba96 100644 --- a/tests/resources/generator/cellml_unit_scaling_constant/model.c +++ b/tests/resources/generator/cellml_unit_scaling_constant/model.c @@ -8,10 +8,9 @@ const char VERSION[] = "0.6.0"; const char LIBCELLML_VERSION[] = "0.5.0"; -const size_t CONSTANT_COUNT = 0; -const size_t COMPUTED_CONSTANT_COUNT = 0; -const size_t ALGEBRAIC_COUNT = 3; -const size_t EXTERNAL_COUNT = 0; +const size_t CONSTANT_COUNT = 1; +const size_t COMPUTED_CONSTANT_COUNT = 2; +const size_t ALGEBRAIC_COUNT = 0; const VariableInfo VARIABLE_INFO[] = { {"k", "mM", "constants", CONSTANT}, diff --git a/tests/resources/generator/cellml_unit_scaling_constant/model.h b/tests/resources/generator/cellml_unit_scaling_constant/model.h index ed21d64734..435deb74f0 100644 --- a/tests/resources/generator/cellml_unit_scaling_constant/model.h +++ b/tests/resources/generator/cellml_unit_scaling_constant/model.h @@ -10,7 +10,6 @@ extern const char LIBCELLML_VERSION[]; extern const size_t CONSTANT_COUNT; extern const size_t COMPUTED_CONSTANT_COUNT; extern const size_t ALGEBRAIC_COUNT; -extern const size_t EXTERNAL_COUNT; typedef enum { CONSTANT, diff --git a/tests/resources/generator/cellml_unit_scaling_constant/model.py b/tests/resources/generator/cellml_unit_scaling_constant/model.py index 6cd14b1a99..d2ee195c50 100644 --- a/tests/resources/generator/cellml_unit_scaling_constant/model.py +++ b/tests/resources/generator/cellml_unit_scaling_constant/model.py @@ -7,10 +7,9 @@ __version__ = "0.5.0" LIBCELLML_VERSION = "0.5.0" -CONSTANT_COUNT = 0 -COMPUTED_CONSTANT_COUNT = 0 -ALGEBRAIC_COUNT = 3 -EXTERNAL_COUNT = 0 +CONSTANT_COUNT = 1 +COMPUTED_CONSTANT_COUNT = 2 +ALGEBRAIC_COUNT = 0 class VariableType(Enum): diff --git a/tests/resources/generator/cellml_unit_scaling_rate/model.c b/tests/resources/generator/cellml_unit_scaling_rate/model.c index 87f36e81d0..603a1eab39 100644 --- a/tests/resources/generator/cellml_unit_scaling_rate/model.c +++ b/tests/resources/generator/cellml_unit_scaling_rate/model.c @@ -12,7 +12,6 @@ const size_t STATE_COUNT = 1; const size_t CONSTANT_COUNT = 0; const size_t COMPUTED_CONSTANT_COUNT = 0; const size_t ALGEBRAIC_COUNT = 2; -const size_t EXTERNAL_COUNT = 0; const VariableInfo VOI_INFO = {"t", "ms", "environment", VARIABLE_OF_INTEGRATION}; diff --git a/tests/resources/generator/cellml_unit_scaling_rate/model.h b/tests/resources/generator/cellml_unit_scaling_rate/model.h index 1a5d4ce25e..e95d12eb15 100644 --- a/tests/resources/generator/cellml_unit_scaling_rate/model.h +++ b/tests/resources/generator/cellml_unit_scaling_rate/model.h @@ -11,7 +11,6 @@ extern const size_t STATE_COUNT; extern const size_t CONSTANT_COUNT; extern const size_t COMPUTED_CONSTANT_COUNT; extern const size_t ALGEBRAIC_COUNT; -extern const size_t EXTERNAL_COUNT; typedef enum { VARIABLE_OF_INTEGRATION, diff --git a/tests/resources/generator/cellml_unit_scaling_rate/model.py b/tests/resources/generator/cellml_unit_scaling_rate/model.py index 572138bfca..f74588e123 100644 --- a/tests/resources/generator/cellml_unit_scaling_rate/model.py +++ b/tests/resources/generator/cellml_unit_scaling_rate/model.py @@ -11,7 +11,6 @@ CONSTANT_COUNT = 0 COMPUTED_CONSTANT_COUNT = 0 ALGEBRAIC_COUNT = 2 -EXTERNAL_COUNT = 0 class VariableType(Enum): diff --git a/tests/resources/generator/cellml_unit_scaling_state/model.c b/tests/resources/generator/cellml_unit_scaling_state/model.c index 0e28895151..34c1bca1f3 100644 --- a/tests/resources/generator/cellml_unit_scaling_state/model.c +++ b/tests/resources/generator/cellml_unit_scaling_state/model.c @@ -12,7 +12,6 @@ const size_t STATE_COUNT = 1; const size_t CONSTANT_COUNT = 0; const size_t COMPUTED_CONSTANT_COUNT = 0; const size_t ALGEBRAIC_COUNT = 2; -const size_t EXTERNAL_COUNT = 0; const VariableInfo VOI_INFO = {"t", "ms", "environment", VARIABLE_OF_INTEGRATION}; diff --git a/tests/resources/generator/cellml_unit_scaling_state/model.h b/tests/resources/generator/cellml_unit_scaling_state/model.h index 1a5d4ce25e..e95d12eb15 100644 --- a/tests/resources/generator/cellml_unit_scaling_state/model.h +++ b/tests/resources/generator/cellml_unit_scaling_state/model.h @@ -11,7 +11,6 @@ extern const size_t STATE_COUNT; extern const size_t CONSTANT_COUNT; extern const size_t COMPUTED_CONSTANT_COUNT; extern const size_t ALGEBRAIC_COUNT; -extern const size_t EXTERNAL_COUNT; typedef enum { VARIABLE_OF_INTEGRATION, diff --git a/tests/resources/generator/cellml_unit_scaling_state/model.py b/tests/resources/generator/cellml_unit_scaling_state/model.py index ea1dd2f48c..ec43146e3c 100644 --- a/tests/resources/generator/cellml_unit_scaling_state/model.py +++ b/tests/resources/generator/cellml_unit_scaling_state/model.py @@ -11,7 +11,6 @@ CONSTANT_COUNT = 0 COMPUTED_CONSTANT_COUNT = 0 ALGEBRAIC_COUNT = 2 -EXTERNAL_COUNT = 0 class VariableType(Enum): diff --git a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.c b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.c index 9689d4fc95..c0db3b3a33 100644 --- a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.c +++ b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.c @@ -12,7 +12,6 @@ const size_t STATE_COUNT = 2; const size_t CONSTANT_COUNT = 0; const size_t COMPUTED_CONSTANT_COUNT = 0; const size_t ALGEBRAIC_COUNT = 0; -const size_t EXTERNAL_COUNT = 0; const VariableInfo VOI_INFO = {"t", "ms", "environment", VARIABLE_OF_INTEGRATION}; diff --git a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.h b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.h index fe37713823..bd4dd923ef 100644 --- a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.h +++ b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.h @@ -11,7 +11,6 @@ extern const size_t STATE_COUNT; extern const size_t CONSTANT_COUNT; extern const size_t COMPUTED_CONSTANT_COUNT; extern const size_t ALGEBRAIC_COUNT; -extern const size_t EXTERNAL_COUNT; typedef enum { VARIABLE_OF_INTEGRATION, diff --git a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.py b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.py index 214d36e3ff..86e48a995e 100644 --- a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.py +++ b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.py @@ -11,7 +11,6 @@ CONSTANT_COUNT = 0 COMPUTED_CONSTANT_COUNT = 0 ALGEBRAIC_COUNT = 0 -EXTERNAL_COUNT = 0 class VariableType(Enum): diff --git a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.c b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.c index cf6cc56198..27bf38fab2 100644 --- a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.c +++ b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.c @@ -9,10 +9,9 @@ const char VERSION[] = "0.6.0"; const char LIBCELLML_VERSION[] = "0.5.0"; const size_t STATE_COUNT = 2; -const size_t CONSTANT_COUNT = 0; +const size_t CONSTANT_COUNT = 2; const size_t COMPUTED_CONSTANT_COUNT = 0; -const size_t ALGEBRAIC_COUNT = 2; -const size_t EXTERNAL_COUNT = 0; +const size_t ALGEBRAIC_COUNT = 0; const VariableInfo VOI_INFO = {"t", "ms", "environment", VARIABLE_OF_INTEGRATION}; diff --git a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.h b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.h index 4806062496..fc9911e7e4 100644 --- a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.h +++ b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.h @@ -11,7 +11,6 @@ extern const size_t STATE_COUNT; extern const size_t CONSTANT_COUNT; extern const size_t COMPUTED_CONSTANT_COUNT; extern const size_t ALGEBRAIC_COUNT; -extern const size_t EXTERNAL_COUNT; typedef enum { VARIABLE_OF_INTEGRATION, diff --git a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.py b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.py index 084fde5b22..9e1edd3c46 100644 --- a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.py +++ b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.py @@ -8,10 +8,9 @@ LIBCELLML_VERSION = "0.5.0" STATE_COUNT = 2 -CONSTANT_COUNT = 0 +CONSTANT_COUNT = 2 COMPUTED_CONSTANT_COUNT = 0 -ALGEBRAIC_COUNT = 2 -EXTERNAL_COUNT = 0 +ALGEBRAIC_COUNT = 0 class VariableType(Enum): diff --git a/tests/resources/generator/cellml_unit_scaling_voi_direct/model.c b/tests/resources/generator/cellml_unit_scaling_voi_direct/model.c index 022b4ee5ae..f0e1d42ba4 100644 --- a/tests/resources/generator/cellml_unit_scaling_voi_direct/model.c +++ b/tests/resources/generator/cellml_unit_scaling_voi_direct/model.c @@ -12,7 +12,6 @@ const size_t STATE_COUNT = 2; const size_t CONSTANT_COUNT = 0; const size_t COMPUTED_CONSTANT_COUNT = 0; const size_t ALGEBRAIC_COUNT = 0; -const size_t EXTERNAL_COUNT = 0; const VariableInfo VOI_INFO = {"t", "ms", "environment", VARIABLE_OF_INTEGRATION}; diff --git a/tests/resources/generator/cellml_unit_scaling_voi_direct/model.h b/tests/resources/generator/cellml_unit_scaling_voi_direct/model.h index cc72c5b3a4..3f1fb63fd2 100644 --- a/tests/resources/generator/cellml_unit_scaling_voi_direct/model.h +++ b/tests/resources/generator/cellml_unit_scaling_voi_direct/model.h @@ -11,7 +11,6 @@ extern const size_t STATE_COUNT; extern const size_t CONSTANT_COUNT; extern const size_t COMPUTED_CONSTANT_COUNT; extern const size_t ALGEBRAIC_COUNT; -extern const size_t EXTERNAL_COUNT; typedef enum { VARIABLE_OF_INTEGRATION, diff --git a/tests/resources/generator/cellml_unit_scaling_voi_direct/model.py b/tests/resources/generator/cellml_unit_scaling_voi_direct/model.py index 8f5a9954fc..e14df017f1 100644 --- a/tests/resources/generator/cellml_unit_scaling_voi_direct/model.py +++ b/tests/resources/generator/cellml_unit_scaling_voi_direct/model.py @@ -11,7 +11,6 @@ CONSTANT_COUNT = 0 COMPUTED_CONSTANT_COUNT = 0 ALGEBRAIC_COUNT = 0 -EXTERNAL_COUNT = 0 class VariableType(Enum): diff --git a/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.c b/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.c index 37a9e4aa41..cd6840c595 100644 --- a/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.c +++ b/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.c @@ -12,7 +12,6 @@ const size_t STATE_COUNT = 3; const size_t CONSTANT_COUNT = 0; const size_t COMPUTED_CONSTANT_COUNT = 0; const size_t ALGEBRAIC_COUNT = 0; -const size_t EXTERNAL_COUNT = 0; const VariableInfo VOI_INFO = {"t", "second", "environment", VARIABLE_OF_INTEGRATION}; diff --git a/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.h b/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.h index 2c159313cf..123e68564c 100644 --- a/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.h +++ b/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.h @@ -11,7 +11,6 @@ extern const size_t STATE_COUNT; extern const size_t CONSTANT_COUNT; extern const size_t COMPUTED_CONSTANT_COUNT; extern const size_t ALGEBRAIC_COUNT; -extern const size_t EXTERNAL_COUNT; typedef enum { VARIABLE_OF_INTEGRATION, diff --git a/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.py b/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.py index fbb32f6afc..ac4a5b3097 100644 --- a/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.py +++ b/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.py @@ -11,7 +11,6 @@ CONSTANT_COUNT = 0 COMPUTED_CONSTANT_COUNT = 0 ALGEBRAIC_COUNT = 0 -EXTERNAL_COUNT = 0 class VariableType(Enum): diff --git a/tests/resources/generator/dae_cellml_1_1_model/model.c b/tests/resources/generator/dae_cellml_1_1_model/model.c index 91a85192ac..3b8e5e3bc3 100644 --- a/tests/resources/generator/dae_cellml_1_1_model/model.c +++ b/tests/resources/generator/dae_cellml_1_1_model/model.c @@ -9,10 +9,9 @@ const char VERSION[] = "0.6.0"; const char LIBCELLML_VERSION[] = "0.5.0"; const size_t STATE_COUNT = 2; -const size_t CONSTANT_COUNT = 0; +const size_t CONSTANT_COUNT = 5; const size_t COMPUTED_CONSTANT_COUNT = 0; -const size_t ALGEBRAIC_COUNT = 10; -const size_t EXTERNAL_COUNT = 0; +const size_t ALGEBRAIC_COUNT = 5; const VariableInfo VOI_INFO = {"t", "second", "main", VARIABLE_OF_INTEGRATION}; @@ -22,16 +21,16 @@ const VariableInfo STATE_INFO[] = { }; const VariableInfo VARIABLE_INFO[] = { - {"v_1", "C_per_s", "main", ALGEBRAIC}, {"v_in", "C_per_s", "main", CONSTANT}, - {"v_2", "C_per_s", "main", ALGEBRAIC}, {"v_out", "C_per_s", "main", CONSTANT}, - {"u_1", "J_per_C", "main", ALGEBRAIC}, - {"u_2", "J_per_C", "main", ALGEBRAIC}, - {"u_3", "J_per_C", "main", ALGEBRAIC}, {"C", "C2_per_J", "main", CONSTANT}, {"R", "Js_per_C2", "main", CONSTANT}, - {"L", "Js2_per_C2", "main", CONSTANT} + {"L", "Js2_per_C2", "main", CONSTANT}, + {"v_1", "C_per_s", "main", ALGEBRAIC}, + {"v_2", "C_per_s", "main", ALGEBRAIC}, + {"u_1", "J_per_C", "main", ALGEBRAIC}, + {"u_2", "J_per_C", "main", ALGEBRAIC}, + {"u_3", "J_per_C", "main", ALGEBRAIC} }; double * createStatesArray() @@ -121,13 +120,13 @@ void findRoot1(double voi, double *states, double *rates, double *variables) void initialiseVariables(double *states, double *rates, double *constants) { - algebraic[0] = 0.0; constants[0] = 1.0; constants[1] = 1.0; - algebraic[4] = 0.0; constants[2] = 20.0; constants[3] = 2.0; constants[4] = 10.0; + algebraic[0] = 0.0; + algebraic[4] = 0.0; states[0] = 1.0; states[1] = 0.0; } diff --git a/tests/resources/generator/dae_cellml_1_1_model/model.h b/tests/resources/generator/dae_cellml_1_1_model/model.h index 12391c8480..2bcb43579c 100644 --- a/tests/resources/generator/dae_cellml_1_1_model/model.h +++ b/tests/resources/generator/dae_cellml_1_1_model/model.h @@ -11,7 +11,6 @@ extern const size_t STATE_COUNT; extern const size_t CONSTANT_COUNT; extern const size_t COMPUTED_CONSTANT_COUNT; extern const size_t ALGEBRAIC_COUNT; -extern const size_t EXTERNAL_COUNT; typedef enum { VARIABLE_OF_INTEGRATION, diff --git a/tests/resources/generator/dae_cellml_1_1_model/model.py b/tests/resources/generator/dae_cellml_1_1_model/model.py index c08f819906..50658a4dbf 100644 --- a/tests/resources/generator/dae_cellml_1_1_model/model.py +++ b/tests/resources/generator/dae_cellml_1_1_model/model.py @@ -8,10 +8,9 @@ LIBCELLML_VERSION = "0.5.0" STATE_COUNT = 2 -CONSTANT_COUNT = 0 +CONSTANT_COUNT = 5 COMPUTED_CONSTANT_COUNT = 0 -ALGEBRAIC_COUNT = 10 -EXTERNAL_COUNT = 0 +ALGEBRAIC_COUNT = 5 class VariableType(Enum): @@ -30,16 +29,16 @@ class VariableType(Enum): ] VARIABLE_INFO = [ - {"name": "v_1", "units": "C_per_s", "component": "main", "type": VariableType.ALGEBRAIC}, {"name": "v_in", "units": "C_per_s", "component": "main", "type": VariableType.CONSTANT}, - {"name": "v_2", "units": "C_per_s", "component": "main", "type": VariableType.ALGEBRAIC}, {"name": "v_out", "units": "C_per_s", "component": "main", "type": VariableType.CONSTANT}, - {"name": "u_1", "units": "J_per_C", "component": "main", "type": VariableType.ALGEBRAIC}, - {"name": "u_2", "units": "J_per_C", "component": "main", "type": VariableType.ALGEBRAIC}, - {"name": "u_3", "units": "J_per_C", "component": "main", "type": VariableType.ALGEBRAIC}, {"name": "C", "units": "C2_per_J", "component": "main", "type": VariableType.CONSTANT}, {"name": "R", "units": "Js_per_C2", "component": "main", "type": VariableType.CONSTANT}, - {"name": "L", "units": "Js2_per_C2", "component": "main", "type": VariableType.CONSTANT} + {"name": "L", "units": "Js2_per_C2", "component": "main", "type": VariableType.CONSTANT}, + {"name": "v_1", "units": "C_per_s", "component": "main", "type": VariableType.ALGEBRAIC}, + {"name": "v_2", "units": "C_per_s", "component": "main", "type": VariableType.ALGEBRAIC}, + {"name": "u_1", "units": "J_per_C", "component": "main", "type": VariableType.ALGEBRAIC}, + {"name": "u_2", "units": "J_per_C", "component": "main", "type": VariableType.ALGEBRAIC}, + {"name": "u_3", "units": "J_per_C", "component": "main", "type": VariableType.ALGEBRAIC} ] @@ -97,13 +96,13 @@ def find_root_1(voi, states, rates, variables): def initialise_variables(states, rates, constants): - algebraic[0] = 0.0 constants[0] = 1.0 constants[1] = 1.0 - algebraic[4] = 0.0 constants[2] = 20.0 constants[3] = 2.0 constants[4] = 10.0 + algebraic[0] = 0.0 + algebraic[4] = 0.0 states[0] = 1.0 states[1] = 0.0 diff --git a/tests/resources/generator/dependent_eqns/model.c b/tests/resources/generator/dependent_eqns/model.c index 8afaa994e1..7bbb981447 100644 --- a/tests/resources/generator/dependent_eqns/model.c +++ b/tests/resources/generator/dependent_eqns/model.c @@ -12,7 +12,6 @@ const size_t STATE_COUNT = 1; const size_t CONSTANT_COUNT = 0; const size_t COMPUTED_CONSTANT_COUNT = 0; const size_t ALGEBRAIC_COUNT = 2; -const size_t EXTERNAL_COUNT = 0; const VariableInfo VOI_INFO = {"time", "second", "my_component", VARIABLE_OF_INTEGRATION}; diff --git a/tests/resources/generator/dependent_eqns/model.h b/tests/resources/generator/dependent_eqns/model.h index bfb9e72345..676c75fecd 100644 --- a/tests/resources/generator/dependent_eqns/model.h +++ b/tests/resources/generator/dependent_eqns/model.h @@ -11,7 +11,6 @@ extern const size_t STATE_COUNT; extern const size_t CONSTANT_COUNT; extern const size_t COMPUTED_CONSTANT_COUNT; extern const size_t ALGEBRAIC_COUNT; -extern const size_t EXTERNAL_COUNT; typedef enum { VARIABLE_OF_INTEGRATION, diff --git a/tests/resources/generator/dependent_eqns/model.py b/tests/resources/generator/dependent_eqns/model.py index 9f92687321..5ed89e9102 100644 --- a/tests/resources/generator/dependent_eqns/model.py +++ b/tests/resources/generator/dependent_eqns/model.py @@ -11,7 +11,6 @@ CONSTANT_COUNT = 0 COMPUTED_CONSTANT_COUNT = 0 ALGEBRAIC_COUNT = 2 -EXTERNAL_COUNT = 0 class VariableType(Enum): diff --git a/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.c b/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.c index 839f568740..0e25bc096d 100644 --- a/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.c +++ b/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.c @@ -9,10 +9,9 @@ const char VERSION[] = "0.6.0"; const char LIBCELLML_VERSION[] = "0.5.0"; const size_t STATE_COUNT = 33; -const size_t CONSTANT_COUNT = 0; -const size_t COMPUTED_CONSTANT_COUNT = 0; -const size_t ALGEBRAIC_COUNT = 217; -const size_t EXTERNAL_COUNT = 0; +const size_t CONSTANT_COUNT = 91; +const size_t COMPUTED_CONSTANT_COUNT = 25; +const size_t ALGEBRAIC_COUNT = 101; const VariableInfo VOI_INFO = {"time", "second", "environment", VARIABLE_OF_INTEGRATION}; @@ -55,47 +54,20 @@ const VariableInfo STATE_INFO[] = { const VariableInfo VARIABLE_INFO[] = { {"ACh", "millimolar", "Rate_modulation_experiments", CONSTANT}, {"Iso_1_uM", "dimensionless", "Rate_modulation_experiments", CONSTANT}, - {"E_Na", "millivolt", "Ionic_values", ALGEBRAIC}, - {"RTONF", "millivolt", "Membrane", COMPUTED_CONSTANT}, {"Nao", "millimolar", "Ionic_values", CONSTANT}, - {"Nai", "millimolar", "Nai_concentration", ALGEBRAIC}, - {"E_K", "millivolt", "Ionic_values", COMPUTED_CONSTANT}, {"Ko", "millimolar", "Ionic_values", CONSTANT}, {"Ki", "millimolar", "Ionic_values", CONSTANT}, - {"E_Ca", "millivolt", "Ionic_values", ALGEBRAIC}, {"Cao", "millimolar", "Ionic_values", CONSTANT}, {"Nai_clamp", "dimensionless", "Nai_concentration", CONSTANT}, - {"i_Na", "nanoA", "i_Na", ALGEBRAIC}, - {"i_NaCa", "nanoA", "i_NaCa", ALGEBRAIC}, - {"i_NaK", "nanoA", "i_NaK", ALGEBRAIC}, - {"i_siNa", "nanoA", "i_CaL", ALGEBRAIC}, - {"i_fNa", "nanoA", "i_f", ALGEBRAIC}, {"F", "coulomb_per_mole", "Membrane", CONSTANT}, - {"V_i", "millimetre3", "Cell_parameters", COMPUTED_CONSTANT}, - {"V_sub", "millimetre3", "Cell_parameters", COMPUTED_CONSTANT}, - {"Iso_increase", "dimensionless", "i_NaK", COMPUTED_CONSTANT}, - {"V", "millivolt", "Membrane", ALGEBRAIC}, {"Km_Nap", "millimolar", "i_NaK", CONSTANT}, {"Km_Kp", "millimolar", "i_NaK", CONSTANT}, {"i_NaK_max", "nanoA", "i_NaK", CONSTANT}, {"blockade_NaCa", "dimensionless", "i_NaCa", CONSTANT}, - {"x2", "dimensionless", "i_NaCa", ALGEBRAIC}, - {"k21", "dimensionless", "i_NaCa", ALGEBRAIC}, - {"x1", "dimensionless", "i_NaCa", ALGEBRAIC}, - {"k12", "dimensionless", "i_NaCa", ALGEBRAIC}, {"K_NaCa", "nanoA", "i_NaCa", CONSTANT}, - {"x4", "dimensionless", "i_NaCa", ALGEBRAIC}, - {"x3", "dimensionless", "i_NaCa", ALGEBRAIC}, - {"k41", "dimensionless", "i_NaCa", ALGEBRAIC}, - {"k23", "dimensionless", "i_NaCa", ALGEBRAIC}, - {"k34", "dimensionless", "i_NaCa", COMPUTED_CONSTANT}, - {"k43", "dimensionless", "i_NaCa", ALGEBRAIC}, - {"k32", "dimensionless", "i_NaCa", ALGEBRAIC}, - {"k14", "dimensionless", "i_NaCa", ALGEBRAIC}, {"K3ni", "millimolar", "i_NaCa", CONSTANT}, {"Kci", "millimolar", "i_NaCa", CONSTANT}, {"Qci", "dimensionless", "i_NaCa", CONSTANT}, - {"di", "dimensionless", "i_NaCa", ALGEBRAIC}, {"K1ni", "millimolar", "i_NaCa", CONSTANT}, {"K2ni", "millimolar", "i_NaCa", CONSTANT}, {"Qn", "dimensionless", "i_NaCa", CONSTANT}, @@ -103,152 +75,185 @@ const VariableInfo VARIABLE_INFO[] = { {"K3no", "millimolar", "i_NaCa", CONSTANT}, {"Kco", "millimolar", "i_NaCa", CONSTANT}, {"Qco", "dimensionless", "i_NaCa", CONSTANT}, - {"do", "dimensionless", "i_NaCa", ALGEBRAIC}, {"K1no", "millimolar", "i_NaCa", CONSTANT}, {"K2no", "millimolar", "i_NaCa", CONSTANT}, - {"j_SRCarel", "millimolar_per_second", "Ca_SR_release", ALGEBRAIC}, {"ks", "per_second", "Ca_SR_release", CONSTANT}, - {"diff", "millimolar", "Ca_SR_release", ALGEBRAIC}, - {"kCaSR", "dimensionless", "Ca_SR_release", ALGEBRAIC}, {"MaxSR", "dimensionless", "Ca_SR_release", CONSTANT}, {"MinSR", "dimensionless", "Ca_SR_release", CONSTANT}, {"EC50_SR", "millimolar", "Ca_SR_release", CONSTANT}, {"HSR", "dimensionless", "Ca_SR_release", CONSTANT}, - {"koSRCa", "per_millimolar2_second", "Ca_SR_release", ALGEBRAIC}, {"koCa", "per_millimolar2_second", "Ca_SR_release", CONSTANT}, - {"kiSRCa", "per_millimolar_second", "Ca_SR_release", ALGEBRAIC}, {"kiCa", "per_millimolar_second", "Ca_SR_release", CONSTANT}, {"kim", "per_second", "Ca_SR_release", CONSTANT}, {"kom", "per_second", "Ca_SR_release", CONSTANT}, - {"P_tot", "dimensionless", "Ca_SR_release", ALGEBRAIC}, - {"b_up", "dimensionless", "Ca_intracellular_fluxes", COMPUTED_CONSTANT}, - {"P_up", "millimolar_per_second", "Ca_intracellular_fluxes", COMPUTED_CONSTANT}, {"P_up_basal", "millimolar_per_second", "Ca_intracellular_fluxes", CONSTANT}, - {"j_Ca_dif", "millimolar_per_second", "Ca_intracellular_fluxes", ALGEBRAIC}, {"tau_dif_Ca", "second", "Ca_intracellular_fluxes", CONSTANT}, - {"j_up", "millimolar_per_second", "Ca_intracellular_fluxes", ALGEBRAIC}, {"K_up", "millimolar", "Ca_intracellular_fluxes", CONSTANT}, {"slope_up", "millimolar", "Ca_intracellular_fluxes", CONSTANT}, - {"j_tr", "millimolar_per_second", "Ca_intracellular_fluxes", ALGEBRAIC}, {"tau_tr", "second", "Ca_intracellular_fluxes", CONSTANT}, - {"delta_fTC", "per_second", "Ca_buffering", ALGEBRAIC}, {"kf_TC", "per_millimolar_second", "Ca_buffering", CONSTANT}, {"kb_TC", "per_second", "Ca_buffering", CONSTANT}, - {"delta_fTMC", "per_second", "Ca_buffering", ALGEBRAIC}, {"kf_TMC", "per_millimolar_second", "Ca_buffering", CONSTANT}, {"kb_TMC", "per_second", "Ca_buffering", CONSTANT}, - {"delta_fTMM", "per_second", "Ca_buffering", ALGEBRAIC}, {"kf_TMM", "per_millimolar_second", "Ca_buffering", CONSTANT}, {"Mgi", "millimolar", "Ca_buffering", CONSTANT}, {"kb_TMM", "per_second", "Ca_buffering", CONSTANT}, - {"delta_fCMi", "per_second", "Ca_buffering", ALGEBRAIC}, {"kf_CM", "per_millimolar_second", "Ca_buffering", CONSTANT}, {"kb_CM", "per_second", "Ca_buffering", CONSTANT}, - {"delta_fCMs", "per_second", "Ca_buffering", ALGEBRAIC}, - {"delta_fCQ", "per_second", "Ca_buffering", ALGEBRAIC}, {"kf_CQ", "per_millimolar_second", "Ca_buffering", CONSTANT}, {"kb_CQ", "per_second", "Ca_buffering", CONSTANT}, {"TC_tot", "millimolar", "Ca_buffering", CONSTANT}, {"TMC_tot", "millimolar", "Ca_buffering", CONSTANT}, {"CM_tot", "millimolar", "Ca_buffering", CONSTANT}, {"CQ_tot", "millimolar", "Ca_buffering", CONSTANT}, - {"V_nsr", "millimetre3", "Cell_parameters", COMPUTED_CONSTANT}, - {"V_jsr", "millimetre3", "Cell_parameters", COMPUTED_CONSTANT}, - {"i_siCa", "nanoA", "i_CaL", ALGEBRAIC}, - {"i_CaT", "nanoA", "i_CaT", ALGEBRAIC}, - {"V_cell", "millimetre3", "Cell_parameters", COMPUTED_CONSTANT}, {"L_cell", "micrometre", "Cell_parameters", CONSTANT}, {"R_cell", "micrometre", "Cell_parameters", CONSTANT}, {"L_sub", "micrometre", "Cell_parameters", CONSTANT}, {"V_jsr_part", "dimensionless", "Cell_parameters", CONSTANT}, {"V_i_part", "dimensionless", "Cell_parameters", CONSTANT}, {"V_nsr_part", "dimensionless", "Cell_parameters", CONSTANT}, - {"i_tot", "nanoA", "Membrane", ALGEBRAIC}, - {"i_f", "nanoA", "i_f", ALGEBRAIC}, - {"i_Kur", "nanoA", "i_Kur", ALGEBRAIC}, - {"i_KACh", "nanoA", "i_KACh", ALGEBRAIC}, - {"i_CaL", "nanoA", "i_CaL", ALGEBRAIC}, - {"i_to", "nanoA", "i_to", ALGEBRAIC}, - {"i_Ks", "nanoA", "i_Ks", ALGEBRAIC}, - {"i_Kr", "nanoA", "i_Kr", ALGEBRAIC}, {"C", "microF", "Membrane", CONSTANT}, {"R", "joule_per_kilomole_kelvin", "Membrane", CONSTANT}, {"T", "kelvin", "Membrane", CONSTANT}, - {"V_clamp", "millivolt", "Voltage_clamp", ALGEBRAIC}, {"clamp_mode", "dimensionless", "Membrane", CONSTANT}, {"V_test", "millivolt", "Voltage_clamp", CONSTANT}, {"t_holding", "second", "Voltage_clamp", CONSTANT}, {"t_test", "second", "Voltage_clamp", CONSTANT}, {"V_holding", "millivolt", "Voltage_clamp", CONSTANT}, - {"G_f", "microS", "i_f", COMPUTED_CONSTANT}, {"g_f", "microS", "i_f", CONSTANT}, {"Km_f", "millimolar", "i_f", CONSTANT}, - {"G_f_K", "microS", "i_f", COMPUTED_CONSTANT}, {"alpha", "dimensionless", "i_f", CONSTANT}, + {"blockade", "dimensionless", "i_f", CONSTANT}, + {"y_shift", "millivolt", "i_f_y_gate", CONSTANT}, + {"g_Na", "microS", "i_Na", CONSTANT}, + {"g_Na_L", "microS", "i_Na", CONSTANT}, + {"delta_m", "millivolt", "i_Na_m_gate", CONSTANT}, + {"g_Kur", "microS", "i_Kur", CONSTANT}, + {"P_CaL", "nanoA_per_millimolar", "i_CaL", CONSTANT}, + {"V_dL", "millivolt", "i_CaL_dL_gate", CONSTANT}, + {"k_dL", "millivolt", "i_CaL_dL_gate", CONSTANT}, + {"shift_fL", "millivolt", "i_CaL_fL_gate", CONSTANT}, + {"k_fL", "millivolt", "i_CaL_fL_gate", CONSTANT}, + {"Km_fCa", "millimolar", "i_CaL_fCa_gate", CONSTANT}, + {"alpha_fCa", "per_second", "i_CaL_fCa_gate", CONSTANT}, + {"P_CaT", "nanoA_per_millimolar", "i_CaT", CONSTANT}, + {"offset_fT", "second", "i_CaT_fT_gate", CONSTANT}, + {"g_to", "microS", "i_to", CONSTANT}, + {"g_Kr", "microS", "i_Kr", CONSTANT}, + {"g_Ks_", "microS", "i_Ks", CONSTANT}, + {"ACh_on", "dimensionless", "i_KACh", CONSTANT}, + {"g_KACh", "microS", "i_KACh", CONSTANT}, + {"RTONF", "millivolt", "Membrane", COMPUTED_CONSTANT}, + {"E_K", "millivolt", "Ionic_values", COMPUTED_CONSTANT}, + {"V_i", "millimetre3", "Cell_parameters", COMPUTED_CONSTANT}, + {"V_sub", "millimetre3", "Cell_parameters", COMPUTED_CONSTANT}, + {"Iso_increase", "dimensionless", "i_NaK", COMPUTED_CONSTANT}, + {"k34", "dimensionless", "i_NaCa", COMPUTED_CONSTANT}, + {"b_up", "dimensionless", "Ca_intracellular_fluxes", COMPUTED_CONSTANT}, + {"P_up", "millimolar_per_second", "Ca_intracellular_fluxes", COMPUTED_CONSTANT}, + {"V_nsr", "millimetre3", "Cell_parameters", COMPUTED_CONSTANT}, + {"V_jsr", "millimetre3", "Cell_parameters", COMPUTED_CONSTANT}, + {"V_cell", "millimetre3", "Cell_parameters", COMPUTED_CONSTANT}, + {"G_f", "microS", "i_f", COMPUTED_CONSTANT}, + {"G_f_K", "microS", "i_f", COMPUTED_CONSTANT}, {"G_f_Na", "microS", "i_f", COMPUTED_CONSTANT}, {"g_f_Na", "microS", "i_f", COMPUTED_CONSTANT}, {"g_f_K", "microS", "i_f", COMPUTED_CONSTANT}, - {"blockade", "dimensionless", "i_f", CONSTANT}, - {"i_fK", "nanoA", "i_f", ALGEBRAIC}, {"ACh_shift", "millivolt", "i_f_y_gate", COMPUTED_CONSTANT}, {"Iso_shift", "millivolt", "i_f_y_gate", COMPUTED_CONSTANT}, + {"Iso_increase", "dimensionless", "i_CaL", COMPUTED_CONSTANT}, + {"ACh_block", "dimensionless", "i_CaL", COMPUTED_CONSTANT}, + {"Iso_shift_dL", "millivolt", "i_CaL_dL_gate", COMPUTED_CONSTANT}, + {"Iso_slope_dL", "dimensionless", "i_CaL_dL_gate", COMPUTED_CONSTANT}, + {"g_Ks", "microS", "i_Ks", COMPUTED_CONSTANT}, + {"Iso_shift", "millivolt", "i_Ks_n_gate", COMPUTED_CONSTANT}, + {"alpha_a", "per_second", "i_KACh_a_gate", COMPUTED_CONSTANT}, + {"E_Na", "millivolt", "Ionic_values", ALGEBRAIC}, + {"Nai", "millimolar", "Nai_concentration", ALGEBRAIC}, + {"E_Ca", "millivolt", "Ionic_values", ALGEBRAIC}, + {"i_Na", "nanoA", "i_Na", ALGEBRAIC}, + {"i_NaCa", "nanoA", "i_NaCa", ALGEBRAIC}, + {"i_NaK", "nanoA", "i_NaK", ALGEBRAIC}, + {"i_siNa", "nanoA", "i_CaL", ALGEBRAIC}, + {"i_fNa", "nanoA", "i_f", ALGEBRAIC}, + {"V", "millivolt", "Membrane", ALGEBRAIC}, + {"x2", "dimensionless", "i_NaCa", ALGEBRAIC}, + {"k21", "dimensionless", "i_NaCa", ALGEBRAIC}, + {"x1", "dimensionless", "i_NaCa", ALGEBRAIC}, + {"k12", "dimensionless", "i_NaCa", ALGEBRAIC}, + {"x4", "dimensionless", "i_NaCa", ALGEBRAIC}, + {"x3", "dimensionless", "i_NaCa", ALGEBRAIC}, + {"k41", "dimensionless", "i_NaCa", ALGEBRAIC}, + {"k23", "dimensionless", "i_NaCa", ALGEBRAIC}, + {"k43", "dimensionless", "i_NaCa", ALGEBRAIC}, + {"k32", "dimensionless", "i_NaCa", ALGEBRAIC}, + {"k14", "dimensionless", "i_NaCa", ALGEBRAIC}, + {"di", "dimensionless", "i_NaCa", ALGEBRAIC}, + {"do", "dimensionless", "i_NaCa", ALGEBRAIC}, + {"j_SRCarel", "millimolar_per_second", "Ca_SR_release", ALGEBRAIC}, + {"diff", "millimolar", "Ca_SR_release", ALGEBRAIC}, + {"kCaSR", "dimensionless", "Ca_SR_release", ALGEBRAIC}, + {"koSRCa", "per_millimolar2_second", "Ca_SR_release", ALGEBRAIC}, + {"kiSRCa", "per_millimolar_second", "Ca_SR_release", ALGEBRAIC}, + {"P_tot", "dimensionless", "Ca_SR_release", ALGEBRAIC}, + {"j_Ca_dif", "millimolar_per_second", "Ca_intracellular_fluxes", ALGEBRAIC}, + {"j_up", "millimolar_per_second", "Ca_intracellular_fluxes", ALGEBRAIC}, + {"j_tr", "millimolar_per_second", "Ca_intracellular_fluxes", ALGEBRAIC}, + {"delta_fTC", "per_second", "Ca_buffering", ALGEBRAIC}, + {"delta_fTMC", "per_second", "Ca_buffering", ALGEBRAIC}, + {"delta_fTMM", "per_second", "Ca_buffering", ALGEBRAIC}, + {"delta_fCMi", "per_second", "Ca_buffering", ALGEBRAIC}, + {"delta_fCMs", "per_second", "Ca_buffering", ALGEBRAIC}, + {"delta_fCQ", "per_second", "Ca_buffering", ALGEBRAIC}, + {"i_siCa", "nanoA", "i_CaL", ALGEBRAIC}, + {"i_CaT", "nanoA", "i_CaT", ALGEBRAIC}, + {"i_tot", "nanoA", "Membrane", ALGEBRAIC}, + {"i_f", "nanoA", "i_f", ALGEBRAIC}, + {"i_Kur", "nanoA", "i_Kur", ALGEBRAIC}, + {"i_KACh", "nanoA", "i_KACh", ALGEBRAIC}, + {"i_CaL", "nanoA", "i_CaL", ALGEBRAIC}, + {"i_to", "nanoA", "i_to", ALGEBRAIC}, + {"i_Ks", "nanoA", "i_Ks", ALGEBRAIC}, + {"i_Kr", "nanoA", "i_Kr", ALGEBRAIC}, + {"V_clamp", "millivolt", "Voltage_clamp", ALGEBRAIC}, + {"i_fK", "nanoA", "i_f", ALGEBRAIC}, {"tau_y", "second", "i_f_y_gate", ALGEBRAIC}, {"y_infinity", "dimensionless", "i_f_y_gate", ALGEBRAIC}, - {"y_shift", "millivolt", "i_f_y_gate", CONSTANT}, {"E_mh", "millivolt", "i_Na", ALGEBRAIC}, {"i_Na_", "nanoA", "i_Na", ALGEBRAIC}, - {"g_Na", "microS", "i_Na", CONSTANT}, {"i_Na_L", "nanoA", "i_Na", ALGEBRAIC}, - {"g_Na_L", "microS", "i_Na", CONSTANT}, {"m_infinity", "dimensionless", "i_Na_m_gate", ALGEBRAIC}, {"E0_m", "millivolt", "i_Na_m_gate", ALGEBRAIC}, {"alpha_m", "per_second", "i_Na_m_gate", ALGEBRAIC}, - {"delta_m", "millivolt", "i_Na_m_gate", CONSTANT}, {"beta_m", "per_second", "i_Na_m_gate", ALGEBRAIC}, {"tau_m", "second", "i_Na_m_gate", ALGEBRAIC}, {"h_infinity", "dimensionless", "i_Na_h_gate", ALGEBRAIC}, {"alpha_h", "per_second", "i_Na_h_gate", ALGEBRAIC}, {"beta_h", "per_second", "i_Na_h_gate", ALGEBRAIC}, {"tau_h", "second", "i_Na_h_gate", ALGEBRAIC}, - {"g_Kur", "microS", "i_Kur", CONSTANT}, {"r_Kur_infinity", "dimensionless", "i_Kur_rKur_gate", ALGEBRAIC}, {"tau_r_Kur", "second", "i_Kur_rKur_gate", ALGEBRAIC}, {"s_Kur_infinity", "dimensionless", "i_Kur_sKur_gate", ALGEBRAIC}, {"tau_s_Kur", "second", "i_Kur_sKur_gate", ALGEBRAIC}, - {"Iso_increase", "dimensionless", "i_CaL", COMPUTED_CONSTANT}, - {"P_CaL", "nanoA_per_millimolar", "i_CaL", CONSTANT}, {"i_siK", "nanoA", "i_CaL", ALGEBRAIC}, - {"ACh_block", "dimensionless", "i_CaL", COMPUTED_CONSTANT}, - {"Iso_shift_dL", "millivolt", "i_CaL_dL_gate", COMPUTED_CONSTANT}, - {"Iso_slope_dL", "dimensionless", "i_CaL_dL_gate", COMPUTED_CONSTANT}, {"dL_infinity", "dimensionless", "i_CaL_dL_gate", ALGEBRAIC}, - {"V_dL", "millivolt", "i_CaL_dL_gate", CONSTANT}, - {"k_dL", "millivolt", "i_CaL_dL_gate", CONSTANT}, {"tau_dL", "second", "i_CaL_dL_gate", ALGEBRAIC}, {"alpha_dL", "per_second", "i_CaL_dL_gate", ALGEBRAIC}, {"beta_dL", "per_second", "i_CaL_dL_gate", ALGEBRAIC}, {"adVm", "millivolt", "i_CaL_dL_gate", ALGEBRAIC}, {"bdVm", "millivolt", "i_CaL_dL_gate", ALGEBRAIC}, {"fL_infinity", "dimensionless", "i_CaL_fL_gate", ALGEBRAIC}, - {"shift_fL", "millivolt", "i_CaL_fL_gate", CONSTANT}, - {"k_fL", "millivolt", "i_CaL_fL_gate", CONSTANT}, {"tau_fL", "second", "i_CaL_fL_gate", ALGEBRAIC}, {"fCa_infinity", "dimensionless", "i_CaL_fCa_gate", ALGEBRAIC}, - {"Km_fCa", "millimolar", "i_CaL_fCa_gate", CONSTANT}, {"tau_fCa", "second", "i_CaL_fCa_gate", ALGEBRAIC}, - {"alpha_fCa", "per_second", "i_CaL_fCa_gate", CONSTANT}, - {"P_CaT", "nanoA_per_millimolar", "i_CaT", CONSTANT}, {"dT_infinity", "dimensionless", "i_CaT_dT_gate", ALGEBRAIC}, {"tau_dT", "second", "i_CaT_dT_gate", ALGEBRAIC}, {"fT_infinity", "dimensionless", "i_CaT_fT_gate", ALGEBRAIC}, {"tau_fT", "second", "i_CaT_fT_gate", ALGEBRAIC}, - {"offset_fT", "second", "i_CaT_fT_gate", CONSTANT}, - {"g_to", "microS", "i_to", CONSTANT}, {"q_infinity", "dimensionless", "i_to_q_gate", ALGEBRAIC}, {"tau_q", "second", "i_to_q_gate", ALGEBRAIC}, {"r_infinity", "dimensionless", "i_to_r_gate", ALGEBRAIC}, {"tau_r", "second", "i_to_r_gate", ALGEBRAIC}, - {"g_Kr", "microS", "i_Kr", CONSTANT}, {"alfapaF", "per_second", "i_Kr_pa_gate", ALGEBRAIC}, {"betapaF", "per_second", "i_Kr_pa_gate", ALGEBRAIC}, {"pa_infinity", "dimensionless", "i_Kr_pa_gate", ALGEBRAIC}, @@ -256,17 +261,11 @@ const VariableInfo VARIABLE_INFO[] = { {"tau_paF", "second", "i_Kr_pa_gate", ALGEBRAIC}, {"tau_pi", "second", "i_Kr_pi_gate", ALGEBRAIC}, {"pi_infinity", "dimensionless", "i_Kr_pi_gate", ALGEBRAIC}, - {"g_Ks", "microS", "i_Ks", COMPUTED_CONSTANT}, - {"g_Ks_", "microS", "i_Ks", CONSTANT}, {"E_Ks", "millivolt", "i_Ks", ALGEBRAIC}, - {"Iso_shift", "millivolt", "i_Ks_n_gate", COMPUTED_CONSTANT}, {"n_infinity", "dimensionless", "i_Ks_n_gate", ALGEBRAIC}, {"tau_n", "second", "i_Ks_n_gate", ALGEBRAIC}, {"alpha_n", "per_second", "i_Ks_n_gate", ALGEBRAIC}, {"beta_n", "per_second", "i_Ks_n_gate", ALGEBRAIC}, - {"ACh_on", "dimensionless", "i_KACh", CONSTANT}, - {"g_KACh", "microS", "i_KACh", CONSTANT}, - {"alpha_a", "per_second", "i_KACh_a_gate", COMPUTED_CONSTANT}, {"beta_a", "per_second", "i_KACh_a_gate", ALGEBRAIC}, {"a_infinity", "dimensionless", "i_KACh_a_gate", ALGEBRAIC}, {"tau_a", "second", "i_KACh_a_gate", ALGEBRAIC} diff --git a/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.h b/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.h index 72e65f5642..e94e9dec00 100644 --- a/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.h +++ b/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.h @@ -11,7 +11,6 @@ extern const size_t STATE_COUNT; extern const size_t CONSTANT_COUNT; extern const size_t COMPUTED_CONSTANT_COUNT; extern const size_t ALGEBRAIC_COUNT; -extern const size_t EXTERNAL_COUNT; typedef enum { VARIABLE_OF_INTEGRATION, diff --git a/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.py b/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.py index bf46049b2b..413cd1d94d 100644 --- a/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.py +++ b/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.py @@ -8,10 +8,9 @@ LIBCELLML_VERSION = "0.5.0" STATE_COUNT = 33 -CONSTANT_COUNT = 0 -COMPUTED_CONSTANT_COUNT = 0 -ALGEBRAIC_COUNT = 217 -EXTERNAL_COUNT = 0 +CONSTANT_COUNT = 91 +COMPUTED_CONSTANT_COUNT = 25 +ALGEBRAIC_COUNT = 101 class VariableType(Enum): @@ -63,47 +62,20 @@ class VariableType(Enum): VARIABLE_INFO = [ {"name": "ACh", "units": "millimolar", "component": "Rate_modulation_experiments", "type": VariableType.CONSTANT}, {"name": "Iso_1_uM", "units": "dimensionless", "component": "Rate_modulation_experiments", "type": VariableType.CONSTANT}, - {"name": "E_Na", "units": "millivolt", "component": "Ionic_values", "type": VariableType.ALGEBRAIC}, - {"name": "RTONF", "units": "millivolt", "component": "Membrane", "type": VariableType.COMPUTED_CONSTANT}, {"name": "Nao", "units": "millimolar", "component": "Ionic_values", "type": VariableType.CONSTANT}, - {"name": "Nai", "units": "millimolar", "component": "Nai_concentration", "type": VariableType.ALGEBRAIC}, - {"name": "E_K", "units": "millivolt", "component": "Ionic_values", "type": VariableType.COMPUTED_CONSTANT}, {"name": "Ko", "units": "millimolar", "component": "Ionic_values", "type": VariableType.CONSTANT}, {"name": "Ki", "units": "millimolar", "component": "Ionic_values", "type": VariableType.CONSTANT}, - {"name": "E_Ca", "units": "millivolt", "component": "Ionic_values", "type": VariableType.ALGEBRAIC}, {"name": "Cao", "units": "millimolar", "component": "Ionic_values", "type": VariableType.CONSTANT}, {"name": "Nai_clamp", "units": "dimensionless", "component": "Nai_concentration", "type": VariableType.CONSTANT}, - {"name": "i_Na", "units": "nanoA", "component": "i_Na", "type": VariableType.ALGEBRAIC}, - {"name": "i_NaCa", "units": "nanoA", "component": "i_NaCa", "type": VariableType.ALGEBRAIC}, - {"name": "i_NaK", "units": "nanoA", "component": "i_NaK", "type": VariableType.ALGEBRAIC}, - {"name": "i_siNa", "units": "nanoA", "component": "i_CaL", "type": VariableType.ALGEBRAIC}, - {"name": "i_fNa", "units": "nanoA", "component": "i_f", "type": VariableType.ALGEBRAIC}, {"name": "F", "units": "coulomb_per_mole", "component": "Membrane", "type": VariableType.CONSTANT}, - {"name": "V_i", "units": "millimetre3", "component": "Cell_parameters", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "V_sub", "units": "millimetre3", "component": "Cell_parameters", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "Iso_increase", "units": "dimensionless", "component": "i_NaK", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "V", "units": "millivolt", "component": "Membrane", "type": VariableType.ALGEBRAIC}, {"name": "Km_Nap", "units": "millimolar", "component": "i_NaK", "type": VariableType.CONSTANT}, {"name": "Km_Kp", "units": "millimolar", "component": "i_NaK", "type": VariableType.CONSTANT}, {"name": "i_NaK_max", "units": "nanoA", "component": "i_NaK", "type": VariableType.CONSTANT}, {"name": "blockade_NaCa", "units": "dimensionless", "component": "i_NaCa", "type": VariableType.CONSTANT}, - {"name": "x2", "units": "dimensionless", "component": "i_NaCa", "type": VariableType.ALGEBRAIC}, - {"name": "k21", "units": "dimensionless", "component": "i_NaCa", "type": VariableType.ALGEBRAIC}, - {"name": "x1", "units": "dimensionless", "component": "i_NaCa", "type": VariableType.ALGEBRAIC}, - {"name": "k12", "units": "dimensionless", "component": "i_NaCa", "type": VariableType.ALGEBRAIC}, {"name": "K_NaCa", "units": "nanoA", "component": "i_NaCa", "type": VariableType.CONSTANT}, - {"name": "x4", "units": "dimensionless", "component": "i_NaCa", "type": VariableType.ALGEBRAIC}, - {"name": "x3", "units": "dimensionless", "component": "i_NaCa", "type": VariableType.ALGEBRAIC}, - {"name": "k41", "units": "dimensionless", "component": "i_NaCa", "type": VariableType.ALGEBRAIC}, - {"name": "k23", "units": "dimensionless", "component": "i_NaCa", "type": VariableType.ALGEBRAIC}, - {"name": "k34", "units": "dimensionless", "component": "i_NaCa", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "k43", "units": "dimensionless", "component": "i_NaCa", "type": VariableType.ALGEBRAIC}, - {"name": "k32", "units": "dimensionless", "component": "i_NaCa", "type": VariableType.ALGEBRAIC}, - {"name": "k14", "units": "dimensionless", "component": "i_NaCa", "type": VariableType.ALGEBRAIC}, {"name": "K3ni", "units": "millimolar", "component": "i_NaCa", "type": VariableType.CONSTANT}, {"name": "Kci", "units": "millimolar", "component": "i_NaCa", "type": VariableType.CONSTANT}, {"name": "Qci", "units": "dimensionless", "component": "i_NaCa", "type": VariableType.CONSTANT}, - {"name": "di", "units": "dimensionless", "component": "i_NaCa", "type": VariableType.ALGEBRAIC}, {"name": "K1ni", "units": "millimolar", "component": "i_NaCa", "type": VariableType.CONSTANT}, {"name": "K2ni", "units": "millimolar", "component": "i_NaCa", "type": VariableType.CONSTANT}, {"name": "Qn", "units": "dimensionless", "component": "i_NaCa", "type": VariableType.CONSTANT}, @@ -111,152 +83,185 @@ class VariableType(Enum): {"name": "K3no", "units": "millimolar", "component": "i_NaCa", "type": VariableType.CONSTANT}, {"name": "Kco", "units": "millimolar", "component": "i_NaCa", "type": VariableType.CONSTANT}, {"name": "Qco", "units": "dimensionless", "component": "i_NaCa", "type": VariableType.CONSTANT}, - {"name": "do", "units": "dimensionless", "component": "i_NaCa", "type": VariableType.ALGEBRAIC}, {"name": "K1no", "units": "millimolar", "component": "i_NaCa", "type": VariableType.CONSTANT}, {"name": "K2no", "units": "millimolar", "component": "i_NaCa", "type": VariableType.CONSTANT}, - {"name": "j_SRCarel", "units": "millimolar_per_second", "component": "Ca_SR_release", "type": VariableType.ALGEBRAIC}, {"name": "ks", "units": "per_second", "component": "Ca_SR_release", "type": VariableType.CONSTANT}, - {"name": "diff", "units": "millimolar", "component": "Ca_SR_release", "type": VariableType.ALGEBRAIC}, - {"name": "kCaSR", "units": "dimensionless", "component": "Ca_SR_release", "type": VariableType.ALGEBRAIC}, {"name": "MaxSR", "units": "dimensionless", "component": "Ca_SR_release", "type": VariableType.CONSTANT}, {"name": "MinSR", "units": "dimensionless", "component": "Ca_SR_release", "type": VariableType.CONSTANT}, {"name": "EC50_SR", "units": "millimolar", "component": "Ca_SR_release", "type": VariableType.CONSTANT}, {"name": "HSR", "units": "dimensionless", "component": "Ca_SR_release", "type": VariableType.CONSTANT}, - {"name": "koSRCa", "units": "per_millimolar2_second", "component": "Ca_SR_release", "type": VariableType.ALGEBRAIC}, {"name": "koCa", "units": "per_millimolar2_second", "component": "Ca_SR_release", "type": VariableType.CONSTANT}, - {"name": "kiSRCa", "units": "per_millimolar_second", "component": "Ca_SR_release", "type": VariableType.ALGEBRAIC}, {"name": "kiCa", "units": "per_millimolar_second", "component": "Ca_SR_release", "type": VariableType.CONSTANT}, {"name": "kim", "units": "per_second", "component": "Ca_SR_release", "type": VariableType.CONSTANT}, {"name": "kom", "units": "per_second", "component": "Ca_SR_release", "type": VariableType.CONSTANT}, - {"name": "P_tot", "units": "dimensionless", "component": "Ca_SR_release", "type": VariableType.ALGEBRAIC}, - {"name": "b_up", "units": "dimensionless", "component": "Ca_intracellular_fluxes", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "P_up", "units": "millimolar_per_second", "component": "Ca_intracellular_fluxes", "type": VariableType.COMPUTED_CONSTANT}, {"name": "P_up_basal", "units": "millimolar_per_second", "component": "Ca_intracellular_fluxes", "type": VariableType.CONSTANT}, - {"name": "j_Ca_dif", "units": "millimolar_per_second", "component": "Ca_intracellular_fluxes", "type": VariableType.ALGEBRAIC}, {"name": "tau_dif_Ca", "units": "second", "component": "Ca_intracellular_fluxes", "type": VariableType.CONSTANT}, - {"name": "j_up", "units": "millimolar_per_second", "component": "Ca_intracellular_fluxes", "type": VariableType.ALGEBRAIC}, {"name": "K_up", "units": "millimolar", "component": "Ca_intracellular_fluxes", "type": VariableType.CONSTANT}, {"name": "slope_up", "units": "millimolar", "component": "Ca_intracellular_fluxes", "type": VariableType.CONSTANT}, - {"name": "j_tr", "units": "millimolar_per_second", "component": "Ca_intracellular_fluxes", "type": VariableType.ALGEBRAIC}, {"name": "tau_tr", "units": "second", "component": "Ca_intracellular_fluxes", "type": VariableType.CONSTANT}, - {"name": "delta_fTC", "units": "per_second", "component": "Ca_buffering", "type": VariableType.ALGEBRAIC}, {"name": "kf_TC", "units": "per_millimolar_second", "component": "Ca_buffering", "type": VariableType.CONSTANT}, {"name": "kb_TC", "units": "per_second", "component": "Ca_buffering", "type": VariableType.CONSTANT}, - {"name": "delta_fTMC", "units": "per_second", "component": "Ca_buffering", "type": VariableType.ALGEBRAIC}, {"name": "kf_TMC", "units": "per_millimolar_second", "component": "Ca_buffering", "type": VariableType.CONSTANT}, {"name": "kb_TMC", "units": "per_second", "component": "Ca_buffering", "type": VariableType.CONSTANT}, - {"name": "delta_fTMM", "units": "per_second", "component": "Ca_buffering", "type": VariableType.ALGEBRAIC}, {"name": "kf_TMM", "units": "per_millimolar_second", "component": "Ca_buffering", "type": VariableType.CONSTANT}, {"name": "Mgi", "units": "millimolar", "component": "Ca_buffering", "type": VariableType.CONSTANT}, {"name": "kb_TMM", "units": "per_second", "component": "Ca_buffering", "type": VariableType.CONSTANT}, - {"name": "delta_fCMi", "units": "per_second", "component": "Ca_buffering", "type": VariableType.ALGEBRAIC}, {"name": "kf_CM", "units": "per_millimolar_second", "component": "Ca_buffering", "type": VariableType.CONSTANT}, {"name": "kb_CM", "units": "per_second", "component": "Ca_buffering", "type": VariableType.CONSTANT}, - {"name": "delta_fCMs", "units": "per_second", "component": "Ca_buffering", "type": VariableType.ALGEBRAIC}, - {"name": "delta_fCQ", "units": "per_second", "component": "Ca_buffering", "type": VariableType.ALGEBRAIC}, {"name": "kf_CQ", "units": "per_millimolar_second", "component": "Ca_buffering", "type": VariableType.CONSTANT}, {"name": "kb_CQ", "units": "per_second", "component": "Ca_buffering", "type": VariableType.CONSTANT}, {"name": "TC_tot", "units": "millimolar", "component": "Ca_buffering", "type": VariableType.CONSTANT}, {"name": "TMC_tot", "units": "millimolar", "component": "Ca_buffering", "type": VariableType.CONSTANT}, {"name": "CM_tot", "units": "millimolar", "component": "Ca_buffering", "type": VariableType.CONSTANT}, {"name": "CQ_tot", "units": "millimolar", "component": "Ca_buffering", "type": VariableType.CONSTANT}, - {"name": "V_nsr", "units": "millimetre3", "component": "Cell_parameters", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "V_jsr", "units": "millimetre3", "component": "Cell_parameters", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "i_siCa", "units": "nanoA", "component": "i_CaL", "type": VariableType.ALGEBRAIC}, - {"name": "i_CaT", "units": "nanoA", "component": "i_CaT", "type": VariableType.ALGEBRAIC}, - {"name": "V_cell", "units": "millimetre3", "component": "Cell_parameters", "type": VariableType.COMPUTED_CONSTANT}, {"name": "L_cell", "units": "micrometre", "component": "Cell_parameters", "type": VariableType.CONSTANT}, {"name": "R_cell", "units": "micrometre", "component": "Cell_parameters", "type": VariableType.CONSTANT}, {"name": "L_sub", "units": "micrometre", "component": "Cell_parameters", "type": VariableType.CONSTANT}, {"name": "V_jsr_part", "units": "dimensionless", "component": "Cell_parameters", "type": VariableType.CONSTANT}, {"name": "V_i_part", "units": "dimensionless", "component": "Cell_parameters", "type": VariableType.CONSTANT}, {"name": "V_nsr_part", "units": "dimensionless", "component": "Cell_parameters", "type": VariableType.CONSTANT}, - {"name": "i_tot", "units": "nanoA", "component": "Membrane", "type": VariableType.ALGEBRAIC}, - {"name": "i_f", "units": "nanoA", "component": "i_f", "type": VariableType.ALGEBRAIC}, - {"name": "i_Kur", "units": "nanoA", "component": "i_Kur", "type": VariableType.ALGEBRAIC}, - {"name": "i_KACh", "units": "nanoA", "component": "i_KACh", "type": VariableType.ALGEBRAIC}, - {"name": "i_CaL", "units": "nanoA", "component": "i_CaL", "type": VariableType.ALGEBRAIC}, - {"name": "i_to", "units": "nanoA", "component": "i_to", "type": VariableType.ALGEBRAIC}, - {"name": "i_Ks", "units": "nanoA", "component": "i_Ks", "type": VariableType.ALGEBRAIC}, - {"name": "i_Kr", "units": "nanoA", "component": "i_Kr", "type": VariableType.ALGEBRAIC}, {"name": "C", "units": "microF", "component": "Membrane", "type": VariableType.CONSTANT}, {"name": "R", "units": "joule_per_kilomole_kelvin", "component": "Membrane", "type": VariableType.CONSTANT}, {"name": "T", "units": "kelvin", "component": "Membrane", "type": VariableType.CONSTANT}, - {"name": "V_clamp", "units": "millivolt", "component": "Voltage_clamp", "type": VariableType.ALGEBRAIC}, {"name": "clamp_mode", "units": "dimensionless", "component": "Membrane", "type": VariableType.CONSTANT}, {"name": "V_test", "units": "millivolt", "component": "Voltage_clamp", "type": VariableType.CONSTANT}, {"name": "t_holding", "units": "second", "component": "Voltage_clamp", "type": VariableType.CONSTANT}, {"name": "t_test", "units": "second", "component": "Voltage_clamp", "type": VariableType.CONSTANT}, {"name": "V_holding", "units": "millivolt", "component": "Voltage_clamp", "type": VariableType.CONSTANT}, - {"name": "G_f", "units": "microS", "component": "i_f", "type": VariableType.COMPUTED_CONSTANT}, {"name": "g_f", "units": "microS", "component": "i_f", "type": VariableType.CONSTANT}, {"name": "Km_f", "units": "millimolar", "component": "i_f", "type": VariableType.CONSTANT}, - {"name": "G_f_K", "units": "microS", "component": "i_f", "type": VariableType.COMPUTED_CONSTANT}, {"name": "alpha", "units": "dimensionless", "component": "i_f", "type": VariableType.CONSTANT}, + {"name": "blockade", "units": "dimensionless", "component": "i_f", "type": VariableType.CONSTANT}, + {"name": "y_shift", "units": "millivolt", "component": "i_f_y_gate", "type": VariableType.CONSTANT}, + {"name": "g_Na", "units": "microS", "component": "i_Na", "type": VariableType.CONSTANT}, + {"name": "g_Na_L", "units": "microS", "component": "i_Na", "type": VariableType.CONSTANT}, + {"name": "delta_m", "units": "millivolt", "component": "i_Na_m_gate", "type": VariableType.CONSTANT}, + {"name": "g_Kur", "units": "microS", "component": "i_Kur", "type": VariableType.CONSTANT}, + {"name": "P_CaL", "units": "nanoA_per_millimolar", "component": "i_CaL", "type": VariableType.CONSTANT}, + {"name": "V_dL", "units": "millivolt", "component": "i_CaL_dL_gate", "type": VariableType.CONSTANT}, + {"name": "k_dL", "units": "millivolt", "component": "i_CaL_dL_gate", "type": VariableType.CONSTANT}, + {"name": "shift_fL", "units": "millivolt", "component": "i_CaL_fL_gate", "type": VariableType.CONSTANT}, + {"name": "k_fL", "units": "millivolt", "component": "i_CaL_fL_gate", "type": VariableType.CONSTANT}, + {"name": "Km_fCa", "units": "millimolar", "component": "i_CaL_fCa_gate", "type": VariableType.CONSTANT}, + {"name": "alpha_fCa", "units": "per_second", "component": "i_CaL_fCa_gate", "type": VariableType.CONSTANT}, + {"name": "P_CaT", "units": "nanoA_per_millimolar", "component": "i_CaT", "type": VariableType.CONSTANT}, + {"name": "offset_fT", "units": "second", "component": "i_CaT_fT_gate", "type": VariableType.CONSTANT}, + {"name": "g_to", "units": "microS", "component": "i_to", "type": VariableType.CONSTANT}, + {"name": "g_Kr", "units": "microS", "component": "i_Kr", "type": VariableType.CONSTANT}, + {"name": "g_Ks_", "units": "microS", "component": "i_Ks", "type": VariableType.CONSTANT}, + {"name": "ACh_on", "units": "dimensionless", "component": "i_KACh", "type": VariableType.CONSTANT}, + {"name": "g_KACh", "units": "microS", "component": "i_KACh", "type": VariableType.CONSTANT}, + {"name": "RTONF", "units": "millivolt", "component": "Membrane", "type": VariableType.COMPUTED_CONSTANT}, + {"name": "E_K", "units": "millivolt", "component": "Ionic_values", "type": VariableType.COMPUTED_CONSTANT}, + {"name": "V_i", "units": "millimetre3", "component": "Cell_parameters", "type": VariableType.COMPUTED_CONSTANT}, + {"name": "V_sub", "units": "millimetre3", "component": "Cell_parameters", "type": VariableType.COMPUTED_CONSTANT}, + {"name": "Iso_increase", "units": "dimensionless", "component": "i_NaK", "type": VariableType.COMPUTED_CONSTANT}, + {"name": "k34", "units": "dimensionless", "component": "i_NaCa", "type": VariableType.COMPUTED_CONSTANT}, + {"name": "b_up", "units": "dimensionless", "component": "Ca_intracellular_fluxes", "type": VariableType.COMPUTED_CONSTANT}, + {"name": "P_up", "units": "millimolar_per_second", "component": "Ca_intracellular_fluxes", "type": VariableType.COMPUTED_CONSTANT}, + {"name": "V_nsr", "units": "millimetre3", "component": "Cell_parameters", "type": VariableType.COMPUTED_CONSTANT}, + {"name": "V_jsr", "units": "millimetre3", "component": "Cell_parameters", "type": VariableType.COMPUTED_CONSTANT}, + {"name": "V_cell", "units": "millimetre3", "component": "Cell_parameters", "type": VariableType.COMPUTED_CONSTANT}, + {"name": "G_f", "units": "microS", "component": "i_f", "type": VariableType.COMPUTED_CONSTANT}, + {"name": "G_f_K", "units": "microS", "component": "i_f", "type": VariableType.COMPUTED_CONSTANT}, {"name": "G_f_Na", "units": "microS", "component": "i_f", "type": VariableType.COMPUTED_CONSTANT}, {"name": "g_f_Na", "units": "microS", "component": "i_f", "type": VariableType.COMPUTED_CONSTANT}, {"name": "g_f_K", "units": "microS", "component": "i_f", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "blockade", "units": "dimensionless", "component": "i_f", "type": VariableType.CONSTANT}, - {"name": "i_fK", "units": "nanoA", "component": "i_f", "type": VariableType.ALGEBRAIC}, {"name": "ACh_shift", "units": "millivolt", "component": "i_f_y_gate", "type": VariableType.COMPUTED_CONSTANT}, {"name": "Iso_shift", "units": "millivolt", "component": "i_f_y_gate", "type": VariableType.COMPUTED_CONSTANT}, + {"name": "Iso_increase", "units": "dimensionless", "component": "i_CaL", "type": VariableType.COMPUTED_CONSTANT}, + {"name": "ACh_block", "units": "dimensionless", "component": "i_CaL", "type": VariableType.COMPUTED_CONSTANT}, + {"name": "Iso_shift_dL", "units": "millivolt", "component": "i_CaL_dL_gate", "type": VariableType.COMPUTED_CONSTANT}, + {"name": "Iso_slope_dL", "units": "dimensionless", "component": "i_CaL_dL_gate", "type": VariableType.COMPUTED_CONSTANT}, + {"name": "g_Ks", "units": "microS", "component": "i_Ks", "type": VariableType.COMPUTED_CONSTANT}, + {"name": "Iso_shift", "units": "millivolt", "component": "i_Ks_n_gate", "type": VariableType.COMPUTED_CONSTANT}, + {"name": "alpha_a", "units": "per_second", "component": "i_KACh_a_gate", "type": VariableType.COMPUTED_CONSTANT}, + {"name": "E_Na", "units": "millivolt", "component": "Ionic_values", "type": VariableType.ALGEBRAIC}, + {"name": "Nai", "units": "millimolar", "component": "Nai_concentration", "type": VariableType.ALGEBRAIC}, + {"name": "E_Ca", "units": "millivolt", "component": "Ionic_values", "type": VariableType.ALGEBRAIC}, + {"name": "i_Na", "units": "nanoA", "component": "i_Na", "type": VariableType.ALGEBRAIC}, + {"name": "i_NaCa", "units": "nanoA", "component": "i_NaCa", "type": VariableType.ALGEBRAIC}, + {"name": "i_NaK", "units": "nanoA", "component": "i_NaK", "type": VariableType.ALGEBRAIC}, + {"name": "i_siNa", "units": "nanoA", "component": "i_CaL", "type": VariableType.ALGEBRAIC}, + {"name": "i_fNa", "units": "nanoA", "component": "i_f", "type": VariableType.ALGEBRAIC}, + {"name": "V", "units": "millivolt", "component": "Membrane", "type": VariableType.ALGEBRAIC}, + {"name": "x2", "units": "dimensionless", "component": "i_NaCa", "type": VariableType.ALGEBRAIC}, + {"name": "k21", "units": "dimensionless", "component": "i_NaCa", "type": VariableType.ALGEBRAIC}, + {"name": "x1", "units": "dimensionless", "component": "i_NaCa", "type": VariableType.ALGEBRAIC}, + {"name": "k12", "units": "dimensionless", "component": "i_NaCa", "type": VariableType.ALGEBRAIC}, + {"name": "x4", "units": "dimensionless", "component": "i_NaCa", "type": VariableType.ALGEBRAIC}, + {"name": "x3", "units": "dimensionless", "component": "i_NaCa", "type": VariableType.ALGEBRAIC}, + {"name": "k41", "units": "dimensionless", "component": "i_NaCa", "type": VariableType.ALGEBRAIC}, + {"name": "k23", "units": "dimensionless", "component": "i_NaCa", "type": VariableType.ALGEBRAIC}, + {"name": "k43", "units": "dimensionless", "component": "i_NaCa", "type": VariableType.ALGEBRAIC}, + {"name": "k32", "units": "dimensionless", "component": "i_NaCa", "type": VariableType.ALGEBRAIC}, + {"name": "k14", "units": "dimensionless", "component": "i_NaCa", "type": VariableType.ALGEBRAIC}, + {"name": "di", "units": "dimensionless", "component": "i_NaCa", "type": VariableType.ALGEBRAIC}, + {"name": "do", "units": "dimensionless", "component": "i_NaCa", "type": VariableType.ALGEBRAIC}, + {"name": "j_SRCarel", "units": "millimolar_per_second", "component": "Ca_SR_release", "type": VariableType.ALGEBRAIC}, + {"name": "diff", "units": "millimolar", "component": "Ca_SR_release", "type": VariableType.ALGEBRAIC}, + {"name": "kCaSR", "units": "dimensionless", "component": "Ca_SR_release", "type": VariableType.ALGEBRAIC}, + {"name": "koSRCa", "units": "per_millimolar2_second", "component": "Ca_SR_release", "type": VariableType.ALGEBRAIC}, + {"name": "kiSRCa", "units": "per_millimolar_second", "component": "Ca_SR_release", "type": VariableType.ALGEBRAIC}, + {"name": "P_tot", "units": "dimensionless", "component": "Ca_SR_release", "type": VariableType.ALGEBRAIC}, + {"name": "j_Ca_dif", "units": "millimolar_per_second", "component": "Ca_intracellular_fluxes", "type": VariableType.ALGEBRAIC}, + {"name": "j_up", "units": "millimolar_per_second", "component": "Ca_intracellular_fluxes", "type": VariableType.ALGEBRAIC}, + {"name": "j_tr", "units": "millimolar_per_second", "component": "Ca_intracellular_fluxes", "type": VariableType.ALGEBRAIC}, + {"name": "delta_fTC", "units": "per_second", "component": "Ca_buffering", "type": VariableType.ALGEBRAIC}, + {"name": "delta_fTMC", "units": "per_second", "component": "Ca_buffering", "type": VariableType.ALGEBRAIC}, + {"name": "delta_fTMM", "units": "per_second", "component": "Ca_buffering", "type": VariableType.ALGEBRAIC}, + {"name": "delta_fCMi", "units": "per_second", "component": "Ca_buffering", "type": VariableType.ALGEBRAIC}, + {"name": "delta_fCMs", "units": "per_second", "component": "Ca_buffering", "type": VariableType.ALGEBRAIC}, + {"name": "delta_fCQ", "units": "per_second", "component": "Ca_buffering", "type": VariableType.ALGEBRAIC}, + {"name": "i_siCa", "units": "nanoA", "component": "i_CaL", "type": VariableType.ALGEBRAIC}, + {"name": "i_CaT", "units": "nanoA", "component": "i_CaT", "type": VariableType.ALGEBRAIC}, + {"name": "i_tot", "units": "nanoA", "component": "Membrane", "type": VariableType.ALGEBRAIC}, + {"name": "i_f", "units": "nanoA", "component": "i_f", "type": VariableType.ALGEBRAIC}, + {"name": "i_Kur", "units": "nanoA", "component": "i_Kur", "type": VariableType.ALGEBRAIC}, + {"name": "i_KACh", "units": "nanoA", "component": "i_KACh", "type": VariableType.ALGEBRAIC}, + {"name": "i_CaL", "units": "nanoA", "component": "i_CaL", "type": VariableType.ALGEBRAIC}, + {"name": "i_to", "units": "nanoA", "component": "i_to", "type": VariableType.ALGEBRAIC}, + {"name": "i_Ks", "units": "nanoA", "component": "i_Ks", "type": VariableType.ALGEBRAIC}, + {"name": "i_Kr", "units": "nanoA", "component": "i_Kr", "type": VariableType.ALGEBRAIC}, + {"name": "V_clamp", "units": "millivolt", "component": "Voltage_clamp", "type": VariableType.ALGEBRAIC}, + {"name": "i_fK", "units": "nanoA", "component": "i_f", "type": VariableType.ALGEBRAIC}, {"name": "tau_y", "units": "second", "component": "i_f_y_gate", "type": VariableType.ALGEBRAIC}, {"name": "y_infinity", "units": "dimensionless", "component": "i_f_y_gate", "type": VariableType.ALGEBRAIC}, - {"name": "y_shift", "units": "millivolt", "component": "i_f_y_gate", "type": VariableType.CONSTANT}, {"name": "E_mh", "units": "millivolt", "component": "i_Na", "type": VariableType.ALGEBRAIC}, {"name": "i_Na_", "units": "nanoA", "component": "i_Na", "type": VariableType.ALGEBRAIC}, - {"name": "g_Na", "units": "microS", "component": "i_Na", "type": VariableType.CONSTANT}, {"name": "i_Na_L", "units": "nanoA", "component": "i_Na", "type": VariableType.ALGEBRAIC}, - {"name": "g_Na_L", "units": "microS", "component": "i_Na", "type": VariableType.CONSTANT}, {"name": "m_infinity", "units": "dimensionless", "component": "i_Na_m_gate", "type": VariableType.ALGEBRAIC}, {"name": "E0_m", "units": "millivolt", "component": "i_Na_m_gate", "type": VariableType.ALGEBRAIC}, {"name": "alpha_m", "units": "per_second", "component": "i_Na_m_gate", "type": VariableType.ALGEBRAIC}, - {"name": "delta_m", "units": "millivolt", "component": "i_Na_m_gate", "type": VariableType.CONSTANT}, {"name": "beta_m", "units": "per_second", "component": "i_Na_m_gate", "type": VariableType.ALGEBRAIC}, {"name": "tau_m", "units": "second", "component": "i_Na_m_gate", "type": VariableType.ALGEBRAIC}, {"name": "h_infinity", "units": "dimensionless", "component": "i_Na_h_gate", "type": VariableType.ALGEBRAIC}, {"name": "alpha_h", "units": "per_second", "component": "i_Na_h_gate", "type": VariableType.ALGEBRAIC}, {"name": "beta_h", "units": "per_second", "component": "i_Na_h_gate", "type": VariableType.ALGEBRAIC}, {"name": "tau_h", "units": "second", "component": "i_Na_h_gate", "type": VariableType.ALGEBRAIC}, - {"name": "g_Kur", "units": "microS", "component": "i_Kur", "type": VariableType.CONSTANT}, {"name": "r_Kur_infinity", "units": "dimensionless", "component": "i_Kur_rKur_gate", "type": VariableType.ALGEBRAIC}, {"name": "tau_r_Kur", "units": "second", "component": "i_Kur_rKur_gate", "type": VariableType.ALGEBRAIC}, {"name": "s_Kur_infinity", "units": "dimensionless", "component": "i_Kur_sKur_gate", "type": VariableType.ALGEBRAIC}, {"name": "tau_s_Kur", "units": "second", "component": "i_Kur_sKur_gate", "type": VariableType.ALGEBRAIC}, - {"name": "Iso_increase", "units": "dimensionless", "component": "i_CaL", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "P_CaL", "units": "nanoA_per_millimolar", "component": "i_CaL", "type": VariableType.CONSTANT}, {"name": "i_siK", "units": "nanoA", "component": "i_CaL", "type": VariableType.ALGEBRAIC}, - {"name": "ACh_block", "units": "dimensionless", "component": "i_CaL", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "Iso_shift_dL", "units": "millivolt", "component": "i_CaL_dL_gate", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "Iso_slope_dL", "units": "dimensionless", "component": "i_CaL_dL_gate", "type": VariableType.COMPUTED_CONSTANT}, {"name": "dL_infinity", "units": "dimensionless", "component": "i_CaL_dL_gate", "type": VariableType.ALGEBRAIC}, - {"name": "V_dL", "units": "millivolt", "component": "i_CaL_dL_gate", "type": VariableType.CONSTANT}, - {"name": "k_dL", "units": "millivolt", "component": "i_CaL_dL_gate", "type": VariableType.CONSTANT}, {"name": "tau_dL", "units": "second", "component": "i_CaL_dL_gate", "type": VariableType.ALGEBRAIC}, {"name": "alpha_dL", "units": "per_second", "component": "i_CaL_dL_gate", "type": VariableType.ALGEBRAIC}, {"name": "beta_dL", "units": "per_second", "component": "i_CaL_dL_gate", "type": VariableType.ALGEBRAIC}, {"name": "adVm", "units": "millivolt", "component": "i_CaL_dL_gate", "type": VariableType.ALGEBRAIC}, {"name": "bdVm", "units": "millivolt", "component": "i_CaL_dL_gate", "type": VariableType.ALGEBRAIC}, {"name": "fL_infinity", "units": "dimensionless", "component": "i_CaL_fL_gate", "type": VariableType.ALGEBRAIC}, - {"name": "shift_fL", "units": "millivolt", "component": "i_CaL_fL_gate", "type": VariableType.CONSTANT}, - {"name": "k_fL", "units": "millivolt", "component": "i_CaL_fL_gate", "type": VariableType.CONSTANT}, {"name": "tau_fL", "units": "second", "component": "i_CaL_fL_gate", "type": VariableType.ALGEBRAIC}, {"name": "fCa_infinity", "units": "dimensionless", "component": "i_CaL_fCa_gate", "type": VariableType.ALGEBRAIC}, - {"name": "Km_fCa", "units": "millimolar", "component": "i_CaL_fCa_gate", "type": VariableType.CONSTANT}, {"name": "tau_fCa", "units": "second", "component": "i_CaL_fCa_gate", "type": VariableType.ALGEBRAIC}, - {"name": "alpha_fCa", "units": "per_second", "component": "i_CaL_fCa_gate", "type": VariableType.CONSTANT}, - {"name": "P_CaT", "units": "nanoA_per_millimolar", "component": "i_CaT", "type": VariableType.CONSTANT}, {"name": "dT_infinity", "units": "dimensionless", "component": "i_CaT_dT_gate", "type": VariableType.ALGEBRAIC}, {"name": "tau_dT", "units": "second", "component": "i_CaT_dT_gate", "type": VariableType.ALGEBRAIC}, {"name": "fT_infinity", "units": "dimensionless", "component": "i_CaT_fT_gate", "type": VariableType.ALGEBRAIC}, {"name": "tau_fT", "units": "second", "component": "i_CaT_fT_gate", "type": VariableType.ALGEBRAIC}, - {"name": "offset_fT", "units": "second", "component": "i_CaT_fT_gate", "type": VariableType.CONSTANT}, - {"name": "g_to", "units": "microS", "component": "i_to", "type": VariableType.CONSTANT}, {"name": "q_infinity", "units": "dimensionless", "component": "i_to_q_gate", "type": VariableType.ALGEBRAIC}, {"name": "tau_q", "units": "second", "component": "i_to_q_gate", "type": VariableType.ALGEBRAIC}, {"name": "r_infinity", "units": "dimensionless", "component": "i_to_r_gate", "type": VariableType.ALGEBRAIC}, {"name": "tau_r", "units": "second", "component": "i_to_r_gate", "type": VariableType.ALGEBRAIC}, - {"name": "g_Kr", "units": "microS", "component": "i_Kr", "type": VariableType.CONSTANT}, {"name": "alfapaF", "units": "per_second", "component": "i_Kr_pa_gate", "type": VariableType.ALGEBRAIC}, {"name": "betapaF", "units": "per_second", "component": "i_Kr_pa_gate", "type": VariableType.ALGEBRAIC}, {"name": "pa_infinity", "units": "dimensionless", "component": "i_Kr_pa_gate", "type": VariableType.ALGEBRAIC}, @@ -264,17 +269,11 @@ class VariableType(Enum): {"name": "tau_paF", "units": "second", "component": "i_Kr_pa_gate", "type": VariableType.ALGEBRAIC}, {"name": "tau_pi", "units": "second", "component": "i_Kr_pi_gate", "type": VariableType.ALGEBRAIC}, {"name": "pi_infinity", "units": "dimensionless", "component": "i_Kr_pi_gate", "type": VariableType.ALGEBRAIC}, - {"name": "g_Ks", "units": "microS", "component": "i_Ks", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "g_Ks_", "units": "microS", "component": "i_Ks", "type": VariableType.CONSTANT}, {"name": "E_Ks", "units": "millivolt", "component": "i_Ks", "type": VariableType.ALGEBRAIC}, - {"name": "Iso_shift", "units": "millivolt", "component": "i_Ks_n_gate", "type": VariableType.COMPUTED_CONSTANT}, {"name": "n_infinity", "units": "dimensionless", "component": "i_Ks_n_gate", "type": VariableType.ALGEBRAIC}, {"name": "tau_n", "units": "second", "component": "i_Ks_n_gate", "type": VariableType.ALGEBRAIC}, {"name": "alpha_n", "units": "per_second", "component": "i_Ks_n_gate", "type": VariableType.ALGEBRAIC}, {"name": "beta_n", "units": "per_second", "component": "i_Ks_n_gate", "type": VariableType.ALGEBRAIC}, - {"name": "ACh_on", "units": "dimensionless", "component": "i_KACh", "type": VariableType.CONSTANT}, - {"name": "g_KACh", "units": "microS", "component": "i_KACh", "type": VariableType.CONSTANT}, - {"name": "alpha_a", "units": "per_second", "component": "i_KACh_a_gate", "type": VariableType.COMPUTED_CONSTANT}, {"name": "beta_a", "units": "per_second", "component": "i_KACh_a_gate", "type": VariableType.ALGEBRAIC}, {"name": "a_infinity", "units": "dimensionless", "component": "i_KACh_a_gate", "type": VariableType.ALGEBRAIC}, {"name": "tau_a", "units": "second", "component": "i_KACh_a_gate", "type": VariableType.ALGEBRAIC} diff --git a/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.c b/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.c index 19a61164cc..798a745cac 100644 --- a/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.c +++ b/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.c @@ -9,10 +9,9 @@ const char VERSION[] = "0.6.0"; const char LIBCELLML_VERSION[] = "0.5.0"; const size_t STATE_COUNT = 15; -const size_t CONSTANT_COUNT = 0; -const size_t COMPUTED_CONSTANT_COUNT = 0; -const size_t ALGEBRAIC_COUNT = 185; -const size_t EXTERNAL_COUNT = 0; +const size_t CONSTANT_COUNT = 110; +const size_t COMPUTED_CONSTANT_COUNT = 23; +const size_t ALGEBRAIC_COUNT = 52; const VariableInfo VOI_INFO = {"time", "second", "environment", VARIABLE_OF_INTEGRATION}; @@ -35,56 +34,32 @@ const VariableInfo STATE_INFO[] = { }; const VariableInfo VARIABLE_INFO[] = { - {"FCell", "dimensionless", "membrane", COMPUTED_CONSTANT}, {"dCell", "dimensionless", "membrane", CONSTANT}, {"Version", "dimensionless", "membrane", CONSTANT}, {"FCellConstant", "dimensionless", "membrane", CONSTANT}, - {"Cm", "microF", "membrane", COMPUTED_CONSTANT}, {"CmCentre", "microF", "membrane", CONSTANT}, {"CmPeriphery", "microF", "membrane", CONSTANT}, - {"i_Na", "nanoA", "sodium_current", ALGEBRAIC}, - {"i_Ca_p", "nanoA", "persistent_calcium_current", COMPUTED_CONSTANT}, - {"i_p", "nanoA", "sodium_potassium_pump", ALGEBRAIC}, - {"i_NaCa", "nanoA", "sodium_calcium_exchanger", ALGEBRAIC}, - {"i_b_K", "nanoA", "potassium_background_current", ALGEBRAIC}, - {"i_b_Ca", "nanoA", "calcium_background_current", ALGEBRAIC}, - {"i_b_Na", "nanoA", "sodium_background_current", ALGEBRAIC}, - {"i_f_K", "nanoA", "hyperpolarisation_activated_current", ALGEBRAIC}, - {"i_f_Na", "nanoA", "hyperpolarisation_activated_current", ALGEBRAIC}, - {"i_K_s", "nanoA", "slow_delayed_rectifying_potassium_current", ALGEBRAIC}, - {"i_K_r", "nanoA", "rapid_delayed_rectifying_potassium_current", ALGEBRAIC}, - {"i_sus", "nanoA", "four_AP_sensitive_currents", ALGEBRAIC}, - {"i_to", "nanoA", "four_AP_sensitive_currents", ALGEBRAIC}, - {"i_Ca_T", "nanoA", "T_type_Ca_channel", ALGEBRAIC}, - {"i_Ca_L", "nanoA", "L_type_Ca_channel", ALGEBRAIC}, {"R", "millijoule_per_mole_kelvin", "membrane", CONSTANT}, {"T", "kelvin", "membrane", CONSTANT}, {"F", "coulomb_per_mole", "membrane", CONSTANT}, - {"g_b_Na", "microS", "sodium_background_current", COMPUTED_CONSTANT}, {"g_b_Na_Centre_Published", "microS", "sodium_background_current", CONSTANT}, {"g_b_Na_Periphery_Published", "microS", "sodium_background_current", CONSTANT}, {"g_b_Na_Centre_1DCapable", "microS", "sodium_background_current", CONSTANT}, {"g_b_Na_Periphery_1DCapable", "microS", "sodium_background_current", CONSTANT}, {"g_b_Na_Centre_0DCapable", "microS", "sodium_background_current", CONSTANT}, {"g_b_Na_Periphery_0DCapable", "microS", "sodium_background_current", CONSTANT}, - {"E_Na", "millivolt", "reversal_and_equilibrium_potentials", COMPUTED_CONSTANT}, - {"g_b_K", "microS", "potassium_background_current", COMPUTED_CONSTANT}, {"g_b_K_Centre_Published", "microS", "potassium_background_current", CONSTANT}, {"g_b_K_Periphery_Published", "microS", "potassium_background_current", CONSTANT}, {"g_b_K_Centre_1DCapable", "microS", "potassium_background_current", CONSTANT}, {"g_b_K_Periphery_1DCapable", "microS", "potassium_background_current", CONSTANT}, {"g_b_K_Centre_0DCapable", "microS", "potassium_background_current", CONSTANT}, {"g_b_K_Periphery_0DCapable", "microS", "potassium_background_current", CONSTANT}, - {"E_K", "millivolt", "reversal_and_equilibrium_potentials", COMPUTED_CONSTANT}, - {"g_b_Ca", "microS", "calcium_background_current", COMPUTED_CONSTANT}, {"g_b_Ca_Centre_Published", "microS", "calcium_background_current", CONSTANT}, {"g_b_Ca_Periphery_Published", "microS", "calcium_background_current", CONSTANT}, {"g_b_Ca_Centre_1DCapable", "microS", "calcium_background_current", CONSTANT}, {"g_b_Ca_Periphery_1DCapable", "microS", "calcium_background_current", CONSTANT}, {"g_b_Ca_Centre_0DCapable", "microS", "calcium_background_current", CONSTANT}, {"g_b_Ca_Periphery_0DCapable", "microS", "calcium_background_current", CONSTANT}, - {"E_Ca", "millivolt", "reversal_and_equilibrium_potentials", COMPUTED_CONSTANT}, - {"k_NaCa", "nanoA", "sodium_calcium_exchanger", COMPUTED_CONSTANT}, {"k_NaCa_Centre_Published", "nanoA", "sodium_calcium_exchanger", CONSTANT}, {"k_NaCa_Periphery_Published", "nanoA", "sodium_calcium_exchanger", CONSTANT}, {"k_NaCa_Centre_1DCapable", "nanoA", "sodium_calcium_exchanger", CONSTANT}, @@ -97,7 +72,6 @@ const VariableInfo VARIABLE_INFO[] = { {"Na_o", "millimolar", "ionic_concentrations", CONSTANT}, {"Ca_i", "millimolar", "ionic_concentrations", CONSTANT}, {"d_NaCa", "dimensionless", "sodium_calcium_exchanger", CONSTANT}, - {"i_p_max", "nanoA", "sodium_potassium_pump", COMPUTED_CONSTANT}, {"i_p_max_Centre_Published", "nanoA", "sodium_potassium_pump", CONSTANT}, {"i_p_max_Periphery_Published", "nanoA", "sodium_potassium_pump", CONSTANT}, {"i_p_max_Centre_1DCapable", "nanoA", "sodium_potassium_pump", CONSTANT}, @@ -107,7 +81,6 @@ const VariableInfo VARIABLE_INFO[] = { {"K_o", "millimolar", "ionic_concentrations", CONSTANT}, {"K_m_K", "millimolar", "sodium_potassium_pump", CONSTANT}, {"K_m_Na", "millimolar", "sodium_potassium_pump", CONSTANT}, - {"i_Ca_p_max", "nanoA", "persistent_calcium_current", COMPUTED_CONSTANT}, {"i_Ca_p_max_Centre_Published", "nanoA", "persistent_calcium_current", CONSTANT}, {"i_Ca_p_max_Periphery_Published", "nanoA", "persistent_calcium_current", CONSTANT}, {"i_Ca_p_max_Centre_1DCapable", "nanoA", "persistent_calcium_current", CONSTANT}, @@ -115,23 +88,12 @@ const VariableInfo VARIABLE_INFO[] = { {"i_Ca_p_max_Centre_0DCapable", "nanoA", "persistent_calcium_current", CONSTANT}, {"i_Ca_p_max_Periphery_0DCapable", "nanoA", "persistent_calcium_current", CONSTANT}, {"K_i", "millimolar", "ionic_concentrations", CONSTANT}, - {"E_K_s", "millivolt", "reversal_and_equilibrium_potentials", COMPUTED_CONSTANT}, - {"g_Na", "microlitre_per_second", "sodium_current", COMPUTED_CONSTANT}, {"g_Na_Centre_Published", "microlitre_per_second", "sodium_current", CONSTANT}, {"g_Na_Periphery_Published", "microlitre_per_second", "sodium_current", CONSTANT}, {"g_Na_Centre_1DCapable", "microlitre_per_second", "sodium_current", CONSTANT}, {"g_Na_Periphery_1DCapable", "microlitre_per_second", "sodium_current", CONSTANT}, {"g_Na_Centre_0DCapable", "microlitre_per_second", "sodium_current", CONSTANT}, {"g_Na_Periphery_0DCapable", "microlitre_per_second", "sodium_current", CONSTANT}, - {"h", "dimensionless", "sodium_current_h_gate", ALGEBRAIC}, - {"m_infinity", "dimensionless", "sodium_current_m_gate", ALGEBRAIC}, - {"tau_m", "second", "sodium_current_m_gate", ALGEBRAIC}, - {"F_Na", "dimensionless", "sodium_current_h_gate", ALGEBRAIC}, - {"h1_infinity", "dimensionless", "sodium_current_h_gate", ALGEBRAIC}, - {"tau_h1", "second", "sodium_current_h_gate", ALGEBRAIC}, - {"h2_infinity", "dimensionless", "sodium_current_h_gate", ALGEBRAIC}, - {"tau_h2", "second", "sodium_current_h_gate", ALGEBRAIC}, - {"g_Ca_L", "microS", "L_type_Ca_channel", COMPUTED_CONSTANT}, {"g_Ca_L_Centre_Published", "microS", "L_type_Ca_channel", CONSTANT}, {"g_Ca_L_Periphery_Published", "microS", "L_type_Ca_channel", CONSTANT}, {"g_Ca_L_Centre_1DCapable", "microS", "L_type_Ca_channel", CONSTANT}, @@ -139,15 +101,6 @@ const VariableInfo VARIABLE_INFO[] = { {"g_Ca_L_Centre_0DCapable", "microS", "L_type_Ca_channel", CONSTANT}, {"g_Ca_L_Periphery_0DCapable", "microS", "L_type_Ca_channel", CONSTANT}, {"E_Ca_L", "millivolt", "L_type_Ca_channel", CONSTANT}, - {"d_L_infinity", "dimensionless", "L_type_Ca_channel_d_gate", ALGEBRAIC}, - {"tau_d_L", "second", "L_type_Ca_channel_d_gate", ALGEBRAIC}, - {"alpha_d_L", "per_second", "L_type_Ca_channel_d_gate", ALGEBRAIC}, - {"beta_d_L", "per_second", "L_type_Ca_channel_d_gate", ALGEBRAIC}, - {"f_L_infinity", "dimensionless", "L_type_Ca_channel_f_gate", ALGEBRAIC}, - {"tau_f_L", "second", "L_type_Ca_channel_f_gate", ALGEBRAIC}, - {"alpha_f_L", "per_second", "L_type_Ca_channel_f_gate", ALGEBRAIC}, - {"beta_f_L", "per_second", "L_type_Ca_channel_f_gate", ALGEBRAIC}, - {"g_Ca_T", "microS", "T_type_Ca_channel", COMPUTED_CONSTANT}, {"g_Ca_T_Centre_Published", "microS", "T_type_Ca_channel", CONSTANT}, {"g_Ca_T_Periphery_Published", "microS", "T_type_Ca_channel", CONSTANT}, {"g_Ca_T_Centre_1DCapable", "microS", "T_type_Ca_channel", CONSTANT}, @@ -155,69 +108,115 @@ const VariableInfo VARIABLE_INFO[] = { {"g_Ca_T_Centre_0DCapable", "microS", "T_type_Ca_channel", CONSTANT}, {"g_Ca_T_Periphery_0DCapable", "microS", "T_type_Ca_channel", CONSTANT}, {"E_Ca_T", "millivolt", "T_type_Ca_channel", CONSTANT}, - {"d_T_infinity", "dimensionless", "T_type_Ca_channel_d_gate", ALGEBRAIC}, - {"tau_d_T", "second", "T_type_Ca_channel_d_gate", ALGEBRAIC}, - {"alpha_d_T", "per_second", "T_type_Ca_channel_d_gate", ALGEBRAIC}, - {"beta_d_T", "per_second", "T_type_Ca_channel_d_gate", ALGEBRAIC}, - {"f_T_infinity", "dimensionless", "T_type_Ca_channel_f_gate", ALGEBRAIC}, - {"tau_f_T", "second", "T_type_Ca_channel_f_gate", ALGEBRAIC}, - {"alpha_f_T", "per_second", "T_type_Ca_channel_f_gate", ALGEBRAIC}, - {"beta_f_T", "per_second", "T_type_Ca_channel_f_gate", ALGEBRAIC}, - {"g_to", "microS", "four_AP_sensitive_currents", COMPUTED_CONSTANT}, {"g_to_Centre_Published", "microS", "four_AP_sensitive_currents", CONSTANT}, {"g_to_Periphery_Published", "microS", "four_AP_sensitive_currents", CONSTANT}, {"g_to_Centre_1DCapable", "microS", "four_AP_sensitive_currents", CONSTANT}, {"g_to_Periphery_1DCapable", "microS", "four_AP_sensitive_currents", CONSTANT}, {"g_to_Centre_0DCapable", "microS", "four_AP_sensitive_currents", CONSTANT}, {"g_to_Periphery_0DCapable", "microS", "four_AP_sensitive_currents", CONSTANT}, - {"g_sus", "microS", "four_AP_sensitive_currents", COMPUTED_CONSTANT}, {"g_sus_Centre_Published", "microS", "four_AP_sensitive_currents", CONSTANT}, {"g_sus_Periphery_Published", "microS", "four_AP_sensitive_currents", CONSTANT}, {"g_sus_Centre_1DCapable", "microS", "four_AP_sensitive_currents", CONSTANT}, {"g_sus_Periphery_1DCapable", "microS", "four_AP_sensitive_currents", CONSTANT}, {"g_sus_Centre_0DCapable", "microS", "four_AP_sensitive_currents", CONSTANT}, {"g_sus_Periphery_0DCapable", "microS", "four_AP_sensitive_currents", CONSTANT}, - {"q_infinity", "dimensionless", "four_AP_sensitive_currents_q_gate", ALGEBRAIC}, - {"tau_q", "second", "four_AP_sensitive_currents_q_gate", ALGEBRAIC}, - {"r_infinity", "dimensionless", "four_AP_sensitive_currents_r_gate", ALGEBRAIC}, - {"tau_r", "second", "four_AP_sensitive_currents_r_gate", ALGEBRAIC}, - {"g_K_r", "microS", "rapid_delayed_rectifying_potassium_current", COMPUTED_CONSTANT}, {"g_K_r_Centre_Published", "microS", "rapid_delayed_rectifying_potassium_current", CONSTANT}, {"g_K_r_Periphery_Published", "microS", "rapid_delayed_rectifying_potassium_current", CONSTANT}, {"g_K_r_Centre_1DCapable", "microS", "rapid_delayed_rectifying_potassium_current", CONSTANT}, {"g_K_r_Periphery_1DCapable", "microS", "rapid_delayed_rectifying_potassium_current", CONSTANT}, {"g_K_r_Centre_0DCapable", "microS", "rapid_delayed_rectifying_potassium_current", CONSTANT}, {"g_K_r_Periphery_0DCapable", "microS", "rapid_delayed_rectifying_potassium_current", CONSTANT}, - {"P_a", "dimensionless", "rapid_delayed_rectifying_potassium_current", ALGEBRAIC}, - {"P_af_infinity", "dimensionless", "rapid_delayed_rectifying_potassium_current_P_af_gate", ALGEBRAIC}, - {"tau_P_af", "second", "rapid_delayed_rectifying_potassium_current_P_af_gate", ALGEBRAIC}, - {"P_as_infinity", "dimensionless", "rapid_delayed_rectifying_potassium_current_P_as_gate", ALGEBRAIC}, - {"tau_P_as", "second", "rapid_delayed_rectifying_potassium_current_P_as_gate", ALGEBRAIC}, - {"tau_P_i", "second", "rapid_delayed_rectifying_potassium_current_P_i_gate", COMPUTED_CONSTANT}, - {"P_i_infinity", "dimensionless", "rapid_delayed_rectifying_potassium_current_P_i_gate", ALGEBRAIC}, - {"g_K_s", "microS", "slow_delayed_rectifying_potassium_current", COMPUTED_CONSTANT}, {"g_K_s_Centre_Published", "microS", "slow_delayed_rectifying_potassium_current", CONSTANT}, {"g_K_s_Periphery_Published", "microS", "slow_delayed_rectifying_potassium_current", CONSTANT}, {"g_K_s_Centre_1DCapable", "microS", "slow_delayed_rectifying_potassium_current", CONSTANT}, {"g_K_s_Periphery_1DCapable", "microS", "slow_delayed_rectifying_potassium_current", CONSTANT}, {"g_K_s_Centre_0DCapable", "microS", "slow_delayed_rectifying_potassium_current", CONSTANT}, {"g_K_s_Periphery_0DCapable", "microS", "slow_delayed_rectifying_potassium_current", CONSTANT}, - {"alpha_xs", "per_second", "slow_delayed_rectifying_potassium_current_xs_gate", ALGEBRAIC}, - {"beta_xs", "per_second", "slow_delayed_rectifying_potassium_current_xs_gate", ALGEBRAIC}, - {"g_f_Na", "microS", "hyperpolarisation_activated_current", COMPUTED_CONSTANT}, {"g_f_Na_Centre_Published", "microS", "hyperpolarisation_activated_current", CONSTANT}, {"g_f_Na_Periphery_Published", "microS", "hyperpolarisation_activated_current", CONSTANT}, {"g_f_Na_Centre_1DCapable", "microS", "hyperpolarisation_activated_current", CONSTANT}, {"g_f_Na_Periphery_1DCapable", "microS", "hyperpolarisation_activated_current", CONSTANT}, {"g_f_Na_Centre_0DCapable", "microS", "hyperpolarisation_activated_current", CONSTANT}, {"g_f_Na_Periphery_0DCapable", "microS", "hyperpolarisation_activated_current", CONSTANT}, - {"g_f_K", "microS", "hyperpolarisation_activated_current", COMPUTED_CONSTANT}, {"g_f_K_Centre_Published", "microS", "hyperpolarisation_activated_current", CONSTANT}, {"g_f_K_Periphery_Published", "microS", "hyperpolarisation_activated_current", CONSTANT}, {"g_f_K_Centre_1DCapable", "microS", "hyperpolarisation_activated_current", CONSTANT}, {"g_f_K_Periphery_1DCapable", "microS", "hyperpolarisation_activated_current", CONSTANT}, {"g_f_K_Centre_0DCapable", "microS", "hyperpolarisation_activated_current", CONSTANT}, {"g_f_K_Periphery_0DCapable", "microS", "hyperpolarisation_activated_current", CONSTANT}, + {"FCell", "dimensionless", "membrane", COMPUTED_CONSTANT}, + {"Cm", "microF", "membrane", COMPUTED_CONSTANT}, + {"i_Ca_p", "nanoA", "persistent_calcium_current", COMPUTED_CONSTANT}, + {"g_b_Na", "microS", "sodium_background_current", COMPUTED_CONSTANT}, + {"E_Na", "millivolt", "reversal_and_equilibrium_potentials", COMPUTED_CONSTANT}, + {"g_b_K", "microS", "potassium_background_current", COMPUTED_CONSTANT}, + {"E_K", "millivolt", "reversal_and_equilibrium_potentials", COMPUTED_CONSTANT}, + {"g_b_Ca", "microS", "calcium_background_current", COMPUTED_CONSTANT}, + {"E_Ca", "millivolt", "reversal_and_equilibrium_potentials", COMPUTED_CONSTANT}, + {"k_NaCa", "nanoA", "sodium_calcium_exchanger", COMPUTED_CONSTANT}, + {"i_p_max", "nanoA", "sodium_potassium_pump", COMPUTED_CONSTANT}, + {"i_Ca_p_max", "nanoA", "persistent_calcium_current", COMPUTED_CONSTANT}, + {"E_K_s", "millivolt", "reversal_and_equilibrium_potentials", COMPUTED_CONSTANT}, + {"g_Na", "microlitre_per_second", "sodium_current", COMPUTED_CONSTANT}, + {"g_Ca_L", "microS", "L_type_Ca_channel", COMPUTED_CONSTANT}, + {"g_Ca_T", "microS", "T_type_Ca_channel", COMPUTED_CONSTANT}, + {"g_to", "microS", "four_AP_sensitive_currents", COMPUTED_CONSTANT}, + {"g_sus", "microS", "four_AP_sensitive_currents", COMPUTED_CONSTANT}, + {"g_K_r", "microS", "rapid_delayed_rectifying_potassium_current", COMPUTED_CONSTANT}, + {"tau_P_i", "second", "rapid_delayed_rectifying_potassium_current_P_i_gate", COMPUTED_CONSTANT}, + {"g_K_s", "microS", "slow_delayed_rectifying_potassium_current", COMPUTED_CONSTANT}, + {"g_f_Na", "microS", "hyperpolarisation_activated_current", COMPUTED_CONSTANT}, + {"g_f_K", "microS", "hyperpolarisation_activated_current", COMPUTED_CONSTANT}, + {"i_Na", "nanoA", "sodium_current", ALGEBRAIC}, + {"i_p", "nanoA", "sodium_potassium_pump", ALGEBRAIC}, + {"i_NaCa", "nanoA", "sodium_calcium_exchanger", ALGEBRAIC}, + {"i_b_K", "nanoA", "potassium_background_current", ALGEBRAIC}, + {"i_b_Ca", "nanoA", "calcium_background_current", ALGEBRAIC}, + {"i_b_Na", "nanoA", "sodium_background_current", ALGEBRAIC}, + {"i_f_K", "nanoA", "hyperpolarisation_activated_current", ALGEBRAIC}, + {"i_f_Na", "nanoA", "hyperpolarisation_activated_current", ALGEBRAIC}, + {"i_K_s", "nanoA", "slow_delayed_rectifying_potassium_current", ALGEBRAIC}, + {"i_K_r", "nanoA", "rapid_delayed_rectifying_potassium_current", ALGEBRAIC}, + {"i_sus", "nanoA", "four_AP_sensitive_currents", ALGEBRAIC}, + {"i_to", "nanoA", "four_AP_sensitive_currents", ALGEBRAIC}, + {"i_Ca_T", "nanoA", "T_type_Ca_channel", ALGEBRAIC}, + {"i_Ca_L", "nanoA", "L_type_Ca_channel", ALGEBRAIC}, + {"h", "dimensionless", "sodium_current_h_gate", ALGEBRAIC}, + {"m_infinity", "dimensionless", "sodium_current_m_gate", ALGEBRAIC}, + {"tau_m", "second", "sodium_current_m_gate", ALGEBRAIC}, + {"F_Na", "dimensionless", "sodium_current_h_gate", ALGEBRAIC}, + {"h1_infinity", "dimensionless", "sodium_current_h_gate", ALGEBRAIC}, + {"tau_h1", "second", "sodium_current_h_gate", ALGEBRAIC}, + {"h2_infinity", "dimensionless", "sodium_current_h_gate", ALGEBRAIC}, + {"tau_h2", "second", "sodium_current_h_gate", ALGEBRAIC}, + {"d_L_infinity", "dimensionless", "L_type_Ca_channel_d_gate", ALGEBRAIC}, + {"tau_d_L", "second", "L_type_Ca_channel_d_gate", ALGEBRAIC}, + {"alpha_d_L", "per_second", "L_type_Ca_channel_d_gate", ALGEBRAIC}, + {"beta_d_L", "per_second", "L_type_Ca_channel_d_gate", ALGEBRAIC}, + {"f_L_infinity", "dimensionless", "L_type_Ca_channel_f_gate", ALGEBRAIC}, + {"tau_f_L", "second", "L_type_Ca_channel_f_gate", ALGEBRAIC}, + {"alpha_f_L", "per_second", "L_type_Ca_channel_f_gate", ALGEBRAIC}, + {"beta_f_L", "per_second", "L_type_Ca_channel_f_gate", ALGEBRAIC}, + {"d_T_infinity", "dimensionless", "T_type_Ca_channel_d_gate", ALGEBRAIC}, + {"tau_d_T", "second", "T_type_Ca_channel_d_gate", ALGEBRAIC}, + {"alpha_d_T", "per_second", "T_type_Ca_channel_d_gate", ALGEBRAIC}, + {"beta_d_T", "per_second", "T_type_Ca_channel_d_gate", ALGEBRAIC}, + {"f_T_infinity", "dimensionless", "T_type_Ca_channel_f_gate", ALGEBRAIC}, + {"tau_f_T", "second", "T_type_Ca_channel_f_gate", ALGEBRAIC}, + {"alpha_f_T", "per_second", "T_type_Ca_channel_f_gate", ALGEBRAIC}, + {"beta_f_T", "per_second", "T_type_Ca_channel_f_gate", ALGEBRAIC}, + {"q_infinity", "dimensionless", "four_AP_sensitive_currents_q_gate", ALGEBRAIC}, + {"tau_q", "second", "four_AP_sensitive_currents_q_gate", ALGEBRAIC}, + {"r_infinity", "dimensionless", "four_AP_sensitive_currents_r_gate", ALGEBRAIC}, + {"tau_r", "second", "four_AP_sensitive_currents_r_gate", ALGEBRAIC}, + {"P_a", "dimensionless", "rapid_delayed_rectifying_potassium_current", ALGEBRAIC}, + {"P_af_infinity", "dimensionless", "rapid_delayed_rectifying_potassium_current_P_af_gate", ALGEBRAIC}, + {"tau_P_af", "second", "rapid_delayed_rectifying_potassium_current_P_af_gate", ALGEBRAIC}, + {"P_as_infinity", "dimensionless", "rapid_delayed_rectifying_potassium_current_P_as_gate", ALGEBRAIC}, + {"tau_P_as", "second", "rapid_delayed_rectifying_potassium_current_P_as_gate", ALGEBRAIC}, + {"P_i_infinity", "dimensionless", "rapid_delayed_rectifying_potassium_current_P_i_gate", ALGEBRAIC}, + {"alpha_xs", "per_second", "slow_delayed_rectifying_potassium_current_xs_gate", ALGEBRAIC}, + {"beta_xs", "per_second", "slow_delayed_rectifying_potassium_current_xs_gate", ALGEBRAIC}, {"alpha_y", "per_second", "hyperpolarisation_activated_current_y_gate", ALGEBRAIC}, {"beta_y", "per_second", "hyperpolarisation_activated_current_y_gate", ALGEBRAIC} }; diff --git a/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.h b/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.h index 7ce78ee1d9..2715ae2d90 100644 --- a/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.h +++ b/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.h @@ -11,7 +11,6 @@ extern const size_t STATE_COUNT; extern const size_t CONSTANT_COUNT; extern const size_t COMPUTED_CONSTANT_COUNT; extern const size_t ALGEBRAIC_COUNT; -extern const size_t EXTERNAL_COUNT; typedef enum { VARIABLE_OF_INTEGRATION, diff --git a/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.py b/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.py index c62e1982cd..4c0443449d 100644 --- a/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.py +++ b/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.py @@ -8,10 +8,9 @@ LIBCELLML_VERSION = "0.5.0" STATE_COUNT = 15 -CONSTANT_COUNT = 0 -COMPUTED_CONSTANT_COUNT = 0 -ALGEBRAIC_COUNT = 185 -EXTERNAL_COUNT = 0 +CONSTANT_COUNT = 110 +COMPUTED_CONSTANT_COUNT = 23 +ALGEBRAIC_COUNT = 52 class VariableType(Enum): @@ -43,56 +42,32 @@ class VariableType(Enum): ] VARIABLE_INFO = [ - {"name": "FCell", "units": "dimensionless", "component": "membrane", "type": VariableType.COMPUTED_CONSTANT}, {"name": "dCell", "units": "dimensionless", "component": "membrane", "type": VariableType.CONSTANT}, {"name": "Version", "units": "dimensionless", "component": "membrane", "type": VariableType.CONSTANT}, {"name": "FCellConstant", "units": "dimensionless", "component": "membrane", "type": VariableType.CONSTANT}, - {"name": "Cm", "units": "microF", "component": "membrane", "type": VariableType.COMPUTED_CONSTANT}, {"name": "CmCentre", "units": "microF", "component": "membrane", "type": VariableType.CONSTANT}, {"name": "CmPeriphery", "units": "microF", "component": "membrane", "type": VariableType.CONSTANT}, - {"name": "i_Na", "units": "nanoA", "component": "sodium_current", "type": VariableType.ALGEBRAIC}, - {"name": "i_Ca_p", "units": "nanoA", "component": "persistent_calcium_current", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "i_p", "units": "nanoA", "component": "sodium_potassium_pump", "type": VariableType.ALGEBRAIC}, - {"name": "i_NaCa", "units": "nanoA", "component": "sodium_calcium_exchanger", "type": VariableType.ALGEBRAIC}, - {"name": "i_b_K", "units": "nanoA", "component": "potassium_background_current", "type": VariableType.ALGEBRAIC}, - {"name": "i_b_Ca", "units": "nanoA", "component": "calcium_background_current", "type": VariableType.ALGEBRAIC}, - {"name": "i_b_Na", "units": "nanoA", "component": "sodium_background_current", "type": VariableType.ALGEBRAIC}, - {"name": "i_f_K", "units": "nanoA", "component": "hyperpolarisation_activated_current", "type": VariableType.ALGEBRAIC}, - {"name": "i_f_Na", "units": "nanoA", "component": "hyperpolarisation_activated_current", "type": VariableType.ALGEBRAIC}, - {"name": "i_K_s", "units": "nanoA", "component": "slow_delayed_rectifying_potassium_current", "type": VariableType.ALGEBRAIC}, - {"name": "i_K_r", "units": "nanoA", "component": "rapid_delayed_rectifying_potassium_current", "type": VariableType.ALGEBRAIC}, - {"name": "i_sus", "units": "nanoA", "component": "four_AP_sensitive_currents", "type": VariableType.ALGEBRAIC}, - {"name": "i_to", "units": "nanoA", "component": "four_AP_sensitive_currents", "type": VariableType.ALGEBRAIC}, - {"name": "i_Ca_T", "units": "nanoA", "component": "T_type_Ca_channel", "type": VariableType.ALGEBRAIC}, - {"name": "i_Ca_L", "units": "nanoA", "component": "L_type_Ca_channel", "type": VariableType.ALGEBRAIC}, {"name": "R", "units": "millijoule_per_mole_kelvin", "component": "membrane", "type": VariableType.CONSTANT}, {"name": "T", "units": "kelvin", "component": "membrane", "type": VariableType.CONSTANT}, {"name": "F", "units": "coulomb_per_mole", "component": "membrane", "type": VariableType.CONSTANT}, - {"name": "g_b_Na", "units": "microS", "component": "sodium_background_current", "type": VariableType.COMPUTED_CONSTANT}, {"name": "g_b_Na_Centre_Published", "units": "microS", "component": "sodium_background_current", "type": VariableType.CONSTANT}, {"name": "g_b_Na_Periphery_Published", "units": "microS", "component": "sodium_background_current", "type": VariableType.CONSTANT}, {"name": "g_b_Na_Centre_1DCapable", "units": "microS", "component": "sodium_background_current", "type": VariableType.CONSTANT}, {"name": "g_b_Na_Periphery_1DCapable", "units": "microS", "component": "sodium_background_current", "type": VariableType.CONSTANT}, {"name": "g_b_Na_Centre_0DCapable", "units": "microS", "component": "sodium_background_current", "type": VariableType.CONSTANT}, {"name": "g_b_Na_Periphery_0DCapable", "units": "microS", "component": "sodium_background_current", "type": VariableType.CONSTANT}, - {"name": "E_Na", "units": "millivolt", "component": "reversal_and_equilibrium_potentials", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "g_b_K", "units": "microS", "component": "potassium_background_current", "type": VariableType.COMPUTED_CONSTANT}, {"name": "g_b_K_Centre_Published", "units": "microS", "component": "potassium_background_current", "type": VariableType.CONSTANT}, {"name": "g_b_K_Periphery_Published", "units": "microS", "component": "potassium_background_current", "type": VariableType.CONSTANT}, {"name": "g_b_K_Centre_1DCapable", "units": "microS", "component": "potassium_background_current", "type": VariableType.CONSTANT}, {"name": "g_b_K_Periphery_1DCapable", "units": "microS", "component": "potassium_background_current", "type": VariableType.CONSTANT}, {"name": "g_b_K_Centre_0DCapable", "units": "microS", "component": "potassium_background_current", "type": VariableType.CONSTANT}, {"name": "g_b_K_Periphery_0DCapable", "units": "microS", "component": "potassium_background_current", "type": VariableType.CONSTANT}, - {"name": "E_K", "units": "millivolt", "component": "reversal_and_equilibrium_potentials", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "g_b_Ca", "units": "microS", "component": "calcium_background_current", "type": VariableType.COMPUTED_CONSTANT}, {"name": "g_b_Ca_Centre_Published", "units": "microS", "component": "calcium_background_current", "type": VariableType.CONSTANT}, {"name": "g_b_Ca_Periphery_Published", "units": "microS", "component": "calcium_background_current", "type": VariableType.CONSTANT}, {"name": "g_b_Ca_Centre_1DCapable", "units": "microS", "component": "calcium_background_current", "type": VariableType.CONSTANT}, {"name": "g_b_Ca_Periphery_1DCapable", "units": "microS", "component": "calcium_background_current", "type": VariableType.CONSTANT}, {"name": "g_b_Ca_Centre_0DCapable", "units": "microS", "component": "calcium_background_current", "type": VariableType.CONSTANT}, {"name": "g_b_Ca_Periphery_0DCapable", "units": "microS", "component": "calcium_background_current", "type": VariableType.CONSTANT}, - {"name": "E_Ca", "units": "millivolt", "component": "reversal_and_equilibrium_potentials", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "k_NaCa", "units": "nanoA", "component": "sodium_calcium_exchanger", "type": VariableType.COMPUTED_CONSTANT}, {"name": "k_NaCa_Centre_Published", "units": "nanoA", "component": "sodium_calcium_exchanger", "type": VariableType.CONSTANT}, {"name": "k_NaCa_Periphery_Published", "units": "nanoA", "component": "sodium_calcium_exchanger", "type": VariableType.CONSTANT}, {"name": "k_NaCa_Centre_1DCapable", "units": "nanoA", "component": "sodium_calcium_exchanger", "type": VariableType.CONSTANT}, @@ -105,7 +80,6 @@ class VariableType(Enum): {"name": "Na_o", "units": "millimolar", "component": "ionic_concentrations", "type": VariableType.CONSTANT}, {"name": "Ca_i", "units": "millimolar", "component": "ionic_concentrations", "type": VariableType.CONSTANT}, {"name": "d_NaCa", "units": "dimensionless", "component": "sodium_calcium_exchanger", "type": VariableType.CONSTANT}, - {"name": "i_p_max", "units": "nanoA", "component": "sodium_potassium_pump", "type": VariableType.COMPUTED_CONSTANT}, {"name": "i_p_max_Centre_Published", "units": "nanoA", "component": "sodium_potassium_pump", "type": VariableType.CONSTANT}, {"name": "i_p_max_Periphery_Published", "units": "nanoA", "component": "sodium_potassium_pump", "type": VariableType.CONSTANT}, {"name": "i_p_max_Centre_1DCapable", "units": "nanoA", "component": "sodium_potassium_pump", "type": VariableType.CONSTANT}, @@ -115,7 +89,6 @@ class VariableType(Enum): {"name": "K_o", "units": "millimolar", "component": "ionic_concentrations", "type": VariableType.CONSTANT}, {"name": "K_m_K", "units": "millimolar", "component": "sodium_potassium_pump", "type": VariableType.CONSTANT}, {"name": "K_m_Na", "units": "millimolar", "component": "sodium_potassium_pump", "type": VariableType.CONSTANT}, - {"name": "i_Ca_p_max", "units": "nanoA", "component": "persistent_calcium_current", "type": VariableType.COMPUTED_CONSTANT}, {"name": "i_Ca_p_max_Centre_Published", "units": "nanoA", "component": "persistent_calcium_current", "type": VariableType.CONSTANT}, {"name": "i_Ca_p_max_Periphery_Published", "units": "nanoA", "component": "persistent_calcium_current", "type": VariableType.CONSTANT}, {"name": "i_Ca_p_max_Centre_1DCapable", "units": "nanoA", "component": "persistent_calcium_current", "type": VariableType.CONSTANT}, @@ -123,23 +96,12 @@ class VariableType(Enum): {"name": "i_Ca_p_max_Centre_0DCapable", "units": "nanoA", "component": "persistent_calcium_current", "type": VariableType.CONSTANT}, {"name": "i_Ca_p_max_Periphery_0DCapable", "units": "nanoA", "component": "persistent_calcium_current", "type": VariableType.CONSTANT}, {"name": "K_i", "units": "millimolar", "component": "ionic_concentrations", "type": VariableType.CONSTANT}, - {"name": "E_K_s", "units": "millivolt", "component": "reversal_and_equilibrium_potentials", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "g_Na", "units": "microlitre_per_second", "component": "sodium_current", "type": VariableType.COMPUTED_CONSTANT}, {"name": "g_Na_Centre_Published", "units": "microlitre_per_second", "component": "sodium_current", "type": VariableType.CONSTANT}, {"name": "g_Na_Periphery_Published", "units": "microlitre_per_second", "component": "sodium_current", "type": VariableType.CONSTANT}, {"name": "g_Na_Centre_1DCapable", "units": "microlitre_per_second", "component": "sodium_current", "type": VariableType.CONSTANT}, {"name": "g_Na_Periphery_1DCapable", "units": "microlitre_per_second", "component": "sodium_current", "type": VariableType.CONSTANT}, {"name": "g_Na_Centre_0DCapable", "units": "microlitre_per_second", "component": "sodium_current", "type": VariableType.CONSTANT}, {"name": "g_Na_Periphery_0DCapable", "units": "microlitre_per_second", "component": "sodium_current", "type": VariableType.CONSTANT}, - {"name": "h", "units": "dimensionless", "component": "sodium_current_h_gate", "type": VariableType.ALGEBRAIC}, - {"name": "m_infinity", "units": "dimensionless", "component": "sodium_current_m_gate", "type": VariableType.ALGEBRAIC}, - {"name": "tau_m", "units": "second", "component": "sodium_current_m_gate", "type": VariableType.ALGEBRAIC}, - {"name": "F_Na", "units": "dimensionless", "component": "sodium_current_h_gate", "type": VariableType.ALGEBRAIC}, - {"name": "h1_infinity", "units": "dimensionless", "component": "sodium_current_h_gate", "type": VariableType.ALGEBRAIC}, - {"name": "tau_h1", "units": "second", "component": "sodium_current_h_gate", "type": VariableType.ALGEBRAIC}, - {"name": "h2_infinity", "units": "dimensionless", "component": "sodium_current_h_gate", "type": VariableType.ALGEBRAIC}, - {"name": "tau_h2", "units": "second", "component": "sodium_current_h_gate", "type": VariableType.ALGEBRAIC}, - {"name": "g_Ca_L", "units": "microS", "component": "L_type_Ca_channel", "type": VariableType.COMPUTED_CONSTANT}, {"name": "g_Ca_L_Centre_Published", "units": "microS", "component": "L_type_Ca_channel", "type": VariableType.CONSTANT}, {"name": "g_Ca_L_Periphery_Published", "units": "microS", "component": "L_type_Ca_channel", "type": VariableType.CONSTANT}, {"name": "g_Ca_L_Centre_1DCapable", "units": "microS", "component": "L_type_Ca_channel", "type": VariableType.CONSTANT}, @@ -147,15 +109,6 @@ class VariableType(Enum): {"name": "g_Ca_L_Centre_0DCapable", "units": "microS", "component": "L_type_Ca_channel", "type": VariableType.CONSTANT}, {"name": "g_Ca_L_Periphery_0DCapable", "units": "microS", "component": "L_type_Ca_channel", "type": VariableType.CONSTANT}, {"name": "E_Ca_L", "units": "millivolt", "component": "L_type_Ca_channel", "type": VariableType.CONSTANT}, - {"name": "d_L_infinity", "units": "dimensionless", "component": "L_type_Ca_channel_d_gate", "type": VariableType.ALGEBRAIC}, - {"name": "tau_d_L", "units": "second", "component": "L_type_Ca_channel_d_gate", "type": VariableType.ALGEBRAIC}, - {"name": "alpha_d_L", "units": "per_second", "component": "L_type_Ca_channel_d_gate", "type": VariableType.ALGEBRAIC}, - {"name": "beta_d_L", "units": "per_second", "component": "L_type_Ca_channel_d_gate", "type": VariableType.ALGEBRAIC}, - {"name": "f_L_infinity", "units": "dimensionless", "component": "L_type_Ca_channel_f_gate", "type": VariableType.ALGEBRAIC}, - {"name": "tau_f_L", "units": "second", "component": "L_type_Ca_channel_f_gate", "type": VariableType.ALGEBRAIC}, - {"name": "alpha_f_L", "units": "per_second", "component": "L_type_Ca_channel_f_gate", "type": VariableType.ALGEBRAIC}, - {"name": "beta_f_L", "units": "per_second", "component": "L_type_Ca_channel_f_gate", "type": VariableType.ALGEBRAIC}, - {"name": "g_Ca_T", "units": "microS", "component": "T_type_Ca_channel", "type": VariableType.COMPUTED_CONSTANT}, {"name": "g_Ca_T_Centre_Published", "units": "microS", "component": "T_type_Ca_channel", "type": VariableType.CONSTANT}, {"name": "g_Ca_T_Periphery_Published", "units": "microS", "component": "T_type_Ca_channel", "type": VariableType.CONSTANT}, {"name": "g_Ca_T_Centre_1DCapable", "units": "microS", "component": "T_type_Ca_channel", "type": VariableType.CONSTANT}, @@ -163,69 +116,115 @@ class VariableType(Enum): {"name": "g_Ca_T_Centre_0DCapable", "units": "microS", "component": "T_type_Ca_channel", "type": VariableType.CONSTANT}, {"name": "g_Ca_T_Periphery_0DCapable", "units": "microS", "component": "T_type_Ca_channel", "type": VariableType.CONSTANT}, {"name": "E_Ca_T", "units": "millivolt", "component": "T_type_Ca_channel", "type": VariableType.CONSTANT}, - {"name": "d_T_infinity", "units": "dimensionless", "component": "T_type_Ca_channel_d_gate", "type": VariableType.ALGEBRAIC}, - {"name": "tau_d_T", "units": "second", "component": "T_type_Ca_channel_d_gate", "type": VariableType.ALGEBRAIC}, - {"name": "alpha_d_T", "units": "per_second", "component": "T_type_Ca_channel_d_gate", "type": VariableType.ALGEBRAIC}, - {"name": "beta_d_T", "units": "per_second", "component": "T_type_Ca_channel_d_gate", "type": VariableType.ALGEBRAIC}, - {"name": "f_T_infinity", "units": "dimensionless", "component": "T_type_Ca_channel_f_gate", "type": VariableType.ALGEBRAIC}, - {"name": "tau_f_T", "units": "second", "component": "T_type_Ca_channel_f_gate", "type": VariableType.ALGEBRAIC}, - {"name": "alpha_f_T", "units": "per_second", "component": "T_type_Ca_channel_f_gate", "type": VariableType.ALGEBRAIC}, - {"name": "beta_f_T", "units": "per_second", "component": "T_type_Ca_channel_f_gate", "type": VariableType.ALGEBRAIC}, - {"name": "g_to", "units": "microS", "component": "four_AP_sensitive_currents", "type": VariableType.COMPUTED_CONSTANT}, {"name": "g_to_Centre_Published", "units": "microS", "component": "four_AP_sensitive_currents", "type": VariableType.CONSTANT}, {"name": "g_to_Periphery_Published", "units": "microS", "component": "four_AP_sensitive_currents", "type": VariableType.CONSTANT}, {"name": "g_to_Centre_1DCapable", "units": "microS", "component": "four_AP_sensitive_currents", "type": VariableType.CONSTANT}, {"name": "g_to_Periphery_1DCapable", "units": "microS", "component": "four_AP_sensitive_currents", "type": VariableType.CONSTANT}, {"name": "g_to_Centre_0DCapable", "units": "microS", "component": "four_AP_sensitive_currents", "type": VariableType.CONSTANT}, {"name": "g_to_Periphery_0DCapable", "units": "microS", "component": "four_AP_sensitive_currents", "type": VariableType.CONSTANT}, - {"name": "g_sus", "units": "microS", "component": "four_AP_sensitive_currents", "type": VariableType.COMPUTED_CONSTANT}, {"name": "g_sus_Centre_Published", "units": "microS", "component": "four_AP_sensitive_currents", "type": VariableType.CONSTANT}, {"name": "g_sus_Periphery_Published", "units": "microS", "component": "four_AP_sensitive_currents", "type": VariableType.CONSTANT}, {"name": "g_sus_Centre_1DCapable", "units": "microS", "component": "four_AP_sensitive_currents", "type": VariableType.CONSTANT}, {"name": "g_sus_Periphery_1DCapable", "units": "microS", "component": "four_AP_sensitive_currents", "type": VariableType.CONSTANT}, {"name": "g_sus_Centre_0DCapable", "units": "microS", "component": "four_AP_sensitive_currents", "type": VariableType.CONSTANT}, {"name": "g_sus_Periphery_0DCapable", "units": "microS", "component": "four_AP_sensitive_currents", "type": VariableType.CONSTANT}, - {"name": "q_infinity", "units": "dimensionless", "component": "four_AP_sensitive_currents_q_gate", "type": VariableType.ALGEBRAIC}, - {"name": "tau_q", "units": "second", "component": "four_AP_sensitive_currents_q_gate", "type": VariableType.ALGEBRAIC}, - {"name": "r_infinity", "units": "dimensionless", "component": "four_AP_sensitive_currents_r_gate", "type": VariableType.ALGEBRAIC}, - {"name": "tau_r", "units": "second", "component": "four_AP_sensitive_currents_r_gate", "type": VariableType.ALGEBRAIC}, - {"name": "g_K_r", "units": "microS", "component": "rapid_delayed_rectifying_potassium_current", "type": VariableType.COMPUTED_CONSTANT}, {"name": "g_K_r_Centre_Published", "units": "microS", "component": "rapid_delayed_rectifying_potassium_current", "type": VariableType.CONSTANT}, {"name": "g_K_r_Periphery_Published", "units": "microS", "component": "rapid_delayed_rectifying_potassium_current", "type": VariableType.CONSTANT}, {"name": "g_K_r_Centre_1DCapable", "units": "microS", "component": "rapid_delayed_rectifying_potassium_current", "type": VariableType.CONSTANT}, {"name": "g_K_r_Periphery_1DCapable", "units": "microS", "component": "rapid_delayed_rectifying_potassium_current", "type": VariableType.CONSTANT}, {"name": "g_K_r_Centre_0DCapable", "units": "microS", "component": "rapid_delayed_rectifying_potassium_current", "type": VariableType.CONSTANT}, {"name": "g_K_r_Periphery_0DCapable", "units": "microS", "component": "rapid_delayed_rectifying_potassium_current", "type": VariableType.CONSTANT}, - {"name": "P_a", "units": "dimensionless", "component": "rapid_delayed_rectifying_potassium_current", "type": VariableType.ALGEBRAIC}, - {"name": "P_af_infinity", "units": "dimensionless", "component": "rapid_delayed_rectifying_potassium_current_P_af_gate", "type": VariableType.ALGEBRAIC}, - {"name": "tau_P_af", "units": "second", "component": "rapid_delayed_rectifying_potassium_current_P_af_gate", "type": VariableType.ALGEBRAIC}, - {"name": "P_as_infinity", "units": "dimensionless", "component": "rapid_delayed_rectifying_potassium_current_P_as_gate", "type": VariableType.ALGEBRAIC}, - {"name": "tau_P_as", "units": "second", "component": "rapid_delayed_rectifying_potassium_current_P_as_gate", "type": VariableType.ALGEBRAIC}, - {"name": "tau_P_i", "units": "second", "component": "rapid_delayed_rectifying_potassium_current_P_i_gate", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "P_i_infinity", "units": "dimensionless", "component": "rapid_delayed_rectifying_potassium_current_P_i_gate", "type": VariableType.ALGEBRAIC}, - {"name": "g_K_s", "units": "microS", "component": "slow_delayed_rectifying_potassium_current", "type": VariableType.COMPUTED_CONSTANT}, {"name": "g_K_s_Centre_Published", "units": "microS", "component": "slow_delayed_rectifying_potassium_current", "type": VariableType.CONSTANT}, {"name": "g_K_s_Periphery_Published", "units": "microS", "component": "slow_delayed_rectifying_potassium_current", "type": VariableType.CONSTANT}, {"name": "g_K_s_Centre_1DCapable", "units": "microS", "component": "slow_delayed_rectifying_potassium_current", "type": VariableType.CONSTANT}, {"name": "g_K_s_Periphery_1DCapable", "units": "microS", "component": "slow_delayed_rectifying_potassium_current", "type": VariableType.CONSTANT}, {"name": "g_K_s_Centre_0DCapable", "units": "microS", "component": "slow_delayed_rectifying_potassium_current", "type": VariableType.CONSTANT}, {"name": "g_K_s_Periphery_0DCapable", "units": "microS", "component": "slow_delayed_rectifying_potassium_current", "type": VariableType.CONSTANT}, - {"name": "alpha_xs", "units": "per_second", "component": "slow_delayed_rectifying_potassium_current_xs_gate", "type": VariableType.ALGEBRAIC}, - {"name": "beta_xs", "units": "per_second", "component": "slow_delayed_rectifying_potassium_current_xs_gate", "type": VariableType.ALGEBRAIC}, - {"name": "g_f_Na", "units": "microS", "component": "hyperpolarisation_activated_current", "type": VariableType.COMPUTED_CONSTANT}, {"name": "g_f_Na_Centre_Published", "units": "microS", "component": "hyperpolarisation_activated_current", "type": VariableType.CONSTANT}, {"name": "g_f_Na_Periphery_Published", "units": "microS", "component": "hyperpolarisation_activated_current", "type": VariableType.CONSTANT}, {"name": "g_f_Na_Centre_1DCapable", "units": "microS", "component": "hyperpolarisation_activated_current", "type": VariableType.CONSTANT}, {"name": "g_f_Na_Periphery_1DCapable", "units": "microS", "component": "hyperpolarisation_activated_current", "type": VariableType.CONSTANT}, {"name": "g_f_Na_Centre_0DCapable", "units": "microS", "component": "hyperpolarisation_activated_current", "type": VariableType.CONSTANT}, {"name": "g_f_Na_Periphery_0DCapable", "units": "microS", "component": "hyperpolarisation_activated_current", "type": VariableType.CONSTANT}, - {"name": "g_f_K", "units": "microS", "component": "hyperpolarisation_activated_current", "type": VariableType.COMPUTED_CONSTANT}, {"name": "g_f_K_Centre_Published", "units": "microS", "component": "hyperpolarisation_activated_current", "type": VariableType.CONSTANT}, {"name": "g_f_K_Periphery_Published", "units": "microS", "component": "hyperpolarisation_activated_current", "type": VariableType.CONSTANT}, {"name": "g_f_K_Centre_1DCapable", "units": "microS", "component": "hyperpolarisation_activated_current", "type": VariableType.CONSTANT}, {"name": "g_f_K_Periphery_1DCapable", "units": "microS", "component": "hyperpolarisation_activated_current", "type": VariableType.CONSTANT}, {"name": "g_f_K_Centre_0DCapable", "units": "microS", "component": "hyperpolarisation_activated_current", "type": VariableType.CONSTANT}, {"name": "g_f_K_Periphery_0DCapable", "units": "microS", "component": "hyperpolarisation_activated_current", "type": VariableType.CONSTANT}, + {"name": "FCell", "units": "dimensionless", "component": "membrane", "type": VariableType.COMPUTED_CONSTANT}, + {"name": "Cm", "units": "microF", "component": "membrane", "type": VariableType.COMPUTED_CONSTANT}, + {"name": "i_Ca_p", "units": "nanoA", "component": "persistent_calcium_current", "type": VariableType.COMPUTED_CONSTANT}, + {"name": "g_b_Na", "units": "microS", "component": "sodium_background_current", "type": VariableType.COMPUTED_CONSTANT}, + {"name": "E_Na", "units": "millivolt", "component": "reversal_and_equilibrium_potentials", "type": VariableType.COMPUTED_CONSTANT}, + {"name": "g_b_K", "units": "microS", "component": "potassium_background_current", "type": VariableType.COMPUTED_CONSTANT}, + {"name": "E_K", "units": "millivolt", "component": "reversal_and_equilibrium_potentials", "type": VariableType.COMPUTED_CONSTANT}, + {"name": "g_b_Ca", "units": "microS", "component": "calcium_background_current", "type": VariableType.COMPUTED_CONSTANT}, + {"name": "E_Ca", "units": "millivolt", "component": "reversal_and_equilibrium_potentials", "type": VariableType.COMPUTED_CONSTANT}, + {"name": "k_NaCa", "units": "nanoA", "component": "sodium_calcium_exchanger", "type": VariableType.COMPUTED_CONSTANT}, + {"name": "i_p_max", "units": "nanoA", "component": "sodium_potassium_pump", "type": VariableType.COMPUTED_CONSTANT}, + {"name": "i_Ca_p_max", "units": "nanoA", "component": "persistent_calcium_current", "type": VariableType.COMPUTED_CONSTANT}, + {"name": "E_K_s", "units": "millivolt", "component": "reversal_and_equilibrium_potentials", "type": VariableType.COMPUTED_CONSTANT}, + {"name": "g_Na", "units": "microlitre_per_second", "component": "sodium_current", "type": VariableType.COMPUTED_CONSTANT}, + {"name": "g_Ca_L", "units": "microS", "component": "L_type_Ca_channel", "type": VariableType.COMPUTED_CONSTANT}, + {"name": "g_Ca_T", "units": "microS", "component": "T_type_Ca_channel", "type": VariableType.COMPUTED_CONSTANT}, + {"name": "g_to", "units": "microS", "component": "four_AP_sensitive_currents", "type": VariableType.COMPUTED_CONSTANT}, + {"name": "g_sus", "units": "microS", "component": "four_AP_sensitive_currents", "type": VariableType.COMPUTED_CONSTANT}, + {"name": "g_K_r", "units": "microS", "component": "rapid_delayed_rectifying_potassium_current", "type": VariableType.COMPUTED_CONSTANT}, + {"name": "tau_P_i", "units": "second", "component": "rapid_delayed_rectifying_potassium_current_P_i_gate", "type": VariableType.COMPUTED_CONSTANT}, + {"name": "g_K_s", "units": "microS", "component": "slow_delayed_rectifying_potassium_current", "type": VariableType.COMPUTED_CONSTANT}, + {"name": "g_f_Na", "units": "microS", "component": "hyperpolarisation_activated_current", "type": VariableType.COMPUTED_CONSTANT}, + {"name": "g_f_K", "units": "microS", "component": "hyperpolarisation_activated_current", "type": VariableType.COMPUTED_CONSTANT}, + {"name": "i_Na", "units": "nanoA", "component": "sodium_current", "type": VariableType.ALGEBRAIC}, + {"name": "i_p", "units": "nanoA", "component": "sodium_potassium_pump", "type": VariableType.ALGEBRAIC}, + {"name": "i_NaCa", "units": "nanoA", "component": "sodium_calcium_exchanger", "type": VariableType.ALGEBRAIC}, + {"name": "i_b_K", "units": "nanoA", "component": "potassium_background_current", "type": VariableType.ALGEBRAIC}, + {"name": "i_b_Ca", "units": "nanoA", "component": "calcium_background_current", "type": VariableType.ALGEBRAIC}, + {"name": "i_b_Na", "units": "nanoA", "component": "sodium_background_current", "type": VariableType.ALGEBRAIC}, + {"name": "i_f_K", "units": "nanoA", "component": "hyperpolarisation_activated_current", "type": VariableType.ALGEBRAIC}, + {"name": "i_f_Na", "units": "nanoA", "component": "hyperpolarisation_activated_current", "type": VariableType.ALGEBRAIC}, + {"name": "i_K_s", "units": "nanoA", "component": "slow_delayed_rectifying_potassium_current", "type": VariableType.ALGEBRAIC}, + {"name": "i_K_r", "units": "nanoA", "component": "rapid_delayed_rectifying_potassium_current", "type": VariableType.ALGEBRAIC}, + {"name": "i_sus", "units": "nanoA", "component": "four_AP_sensitive_currents", "type": VariableType.ALGEBRAIC}, + {"name": "i_to", "units": "nanoA", "component": "four_AP_sensitive_currents", "type": VariableType.ALGEBRAIC}, + {"name": "i_Ca_T", "units": "nanoA", "component": "T_type_Ca_channel", "type": VariableType.ALGEBRAIC}, + {"name": "i_Ca_L", "units": "nanoA", "component": "L_type_Ca_channel", "type": VariableType.ALGEBRAIC}, + {"name": "h", "units": "dimensionless", "component": "sodium_current_h_gate", "type": VariableType.ALGEBRAIC}, + {"name": "m_infinity", "units": "dimensionless", "component": "sodium_current_m_gate", "type": VariableType.ALGEBRAIC}, + {"name": "tau_m", "units": "second", "component": "sodium_current_m_gate", "type": VariableType.ALGEBRAIC}, + {"name": "F_Na", "units": "dimensionless", "component": "sodium_current_h_gate", "type": VariableType.ALGEBRAIC}, + {"name": "h1_infinity", "units": "dimensionless", "component": "sodium_current_h_gate", "type": VariableType.ALGEBRAIC}, + {"name": "tau_h1", "units": "second", "component": "sodium_current_h_gate", "type": VariableType.ALGEBRAIC}, + {"name": "h2_infinity", "units": "dimensionless", "component": "sodium_current_h_gate", "type": VariableType.ALGEBRAIC}, + {"name": "tau_h2", "units": "second", "component": "sodium_current_h_gate", "type": VariableType.ALGEBRAIC}, + {"name": "d_L_infinity", "units": "dimensionless", "component": "L_type_Ca_channel_d_gate", "type": VariableType.ALGEBRAIC}, + {"name": "tau_d_L", "units": "second", "component": "L_type_Ca_channel_d_gate", "type": VariableType.ALGEBRAIC}, + {"name": "alpha_d_L", "units": "per_second", "component": "L_type_Ca_channel_d_gate", "type": VariableType.ALGEBRAIC}, + {"name": "beta_d_L", "units": "per_second", "component": "L_type_Ca_channel_d_gate", "type": VariableType.ALGEBRAIC}, + {"name": "f_L_infinity", "units": "dimensionless", "component": "L_type_Ca_channel_f_gate", "type": VariableType.ALGEBRAIC}, + {"name": "tau_f_L", "units": "second", "component": "L_type_Ca_channel_f_gate", "type": VariableType.ALGEBRAIC}, + {"name": "alpha_f_L", "units": "per_second", "component": "L_type_Ca_channel_f_gate", "type": VariableType.ALGEBRAIC}, + {"name": "beta_f_L", "units": "per_second", "component": "L_type_Ca_channel_f_gate", "type": VariableType.ALGEBRAIC}, + {"name": "d_T_infinity", "units": "dimensionless", "component": "T_type_Ca_channel_d_gate", "type": VariableType.ALGEBRAIC}, + {"name": "tau_d_T", "units": "second", "component": "T_type_Ca_channel_d_gate", "type": VariableType.ALGEBRAIC}, + {"name": "alpha_d_T", "units": "per_second", "component": "T_type_Ca_channel_d_gate", "type": VariableType.ALGEBRAIC}, + {"name": "beta_d_T", "units": "per_second", "component": "T_type_Ca_channel_d_gate", "type": VariableType.ALGEBRAIC}, + {"name": "f_T_infinity", "units": "dimensionless", "component": "T_type_Ca_channel_f_gate", "type": VariableType.ALGEBRAIC}, + {"name": "tau_f_T", "units": "second", "component": "T_type_Ca_channel_f_gate", "type": VariableType.ALGEBRAIC}, + {"name": "alpha_f_T", "units": "per_second", "component": "T_type_Ca_channel_f_gate", "type": VariableType.ALGEBRAIC}, + {"name": "beta_f_T", "units": "per_second", "component": "T_type_Ca_channel_f_gate", "type": VariableType.ALGEBRAIC}, + {"name": "q_infinity", "units": "dimensionless", "component": "four_AP_sensitive_currents_q_gate", "type": VariableType.ALGEBRAIC}, + {"name": "tau_q", "units": "second", "component": "four_AP_sensitive_currents_q_gate", "type": VariableType.ALGEBRAIC}, + {"name": "r_infinity", "units": "dimensionless", "component": "four_AP_sensitive_currents_r_gate", "type": VariableType.ALGEBRAIC}, + {"name": "tau_r", "units": "second", "component": "four_AP_sensitive_currents_r_gate", "type": VariableType.ALGEBRAIC}, + {"name": "P_a", "units": "dimensionless", "component": "rapid_delayed_rectifying_potassium_current", "type": VariableType.ALGEBRAIC}, + {"name": "P_af_infinity", "units": "dimensionless", "component": "rapid_delayed_rectifying_potassium_current_P_af_gate", "type": VariableType.ALGEBRAIC}, + {"name": "tau_P_af", "units": "second", "component": "rapid_delayed_rectifying_potassium_current_P_af_gate", "type": VariableType.ALGEBRAIC}, + {"name": "P_as_infinity", "units": "dimensionless", "component": "rapid_delayed_rectifying_potassium_current_P_as_gate", "type": VariableType.ALGEBRAIC}, + {"name": "tau_P_as", "units": "second", "component": "rapid_delayed_rectifying_potassium_current_P_as_gate", "type": VariableType.ALGEBRAIC}, + {"name": "P_i_infinity", "units": "dimensionless", "component": "rapid_delayed_rectifying_potassium_current_P_i_gate", "type": VariableType.ALGEBRAIC}, + {"name": "alpha_xs", "units": "per_second", "component": "slow_delayed_rectifying_potassium_current_xs_gate", "type": VariableType.ALGEBRAIC}, + {"name": "beta_xs", "units": "per_second", "component": "slow_delayed_rectifying_potassium_current_xs_gate", "type": VariableType.ALGEBRAIC}, {"name": "alpha_y", "units": "per_second", "component": "hyperpolarisation_activated_current_y_gate", "type": VariableType.ALGEBRAIC}, {"name": "beta_y", "units": "per_second", "component": "hyperpolarisation_activated_current_y_gate", "type": VariableType.ALGEBRAIC} ] diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.c index cd52f74514..1d4908a139 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.c @@ -9,10 +9,10 @@ const char VERSION[] = "0.6.0"; const char LIBCELLML_VERSION[] = "0.5.0"; const size_t STATE_COUNT = 4; -const size_t CONSTANT_COUNT = 0; -const size_t COMPUTED_CONSTANT_COUNT = 0; -const size_t ALGEBRAIC_COUNT = 18; -const size_t EXTERNAL_COUNT = 0; +const size_t CONSTANT_COUNT = 5; +const size_t COMPUTED_CONSTANT_COUNT = 3; +const size_t ALGEBRAIC_COUNT = 9; +const size_t EXTERNAL_COUNT = 1; const VariableInfo VOI_INFO = {"time", "millisecond", "environment", VARIABLE_OF_INTEGRATION}; @@ -24,24 +24,24 @@ const VariableInfo STATE_INFO[] = { }; const VariableInfo VARIABLE_INFO[] = { - {"i_Stim", "microA_per_cm2", "membrane", EXTERNAL}, - {"i_L", "microA_per_cm2", "leakage_current", ALGEBRAIC}, - {"i_K", "microA_per_cm2", "potassium_channel", ALGEBRAIC}, - {"i_Na", "microA_per_cm2", "sodium_channel", ALGEBRAIC}, {"Cm", "microF_per_cm2", "membrane", CONSTANT}, {"E_R", "millivolt", "membrane", CONSTANT}, - {"E_L", "millivolt", "leakage_current", COMPUTED_CONSTANT}, {"g_L", "milliS_per_cm2", "leakage_current", CONSTANT}, - {"E_Na", "millivolt", "sodium_channel", COMPUTED_CONSTANT}, {"g_Na", "milliS_per_cm2", "sodium_channel", CONSTANT}, + {"g_K", "milliS_per_cm2", "potassium_channel", CONSTANT}, + {"E_L", "millivolt", "leakage_current", COMPUTED_CONSTANT}, + {"E_Na", "millivolt", "sodium_channel", COMPUTED_CONSTANT}, + {"E_K", "millivolt", "potassium_channel", COMPUTED_CONSTANT}, + {"i_L", "microA_per_cm2", "leakage_current", ALGEBRAIC}, + {"i_K", "microA_per_cm2", "potassium_channel", ALGEBRAIC}, + {"i_Na", "microA_per_cm2", "sodium_channel", ALGEBRAIC}, {"alpha_m", "per_millisecond", "sodium_channel_m_gate", ALGEBRAIC}, {"beta_m", "per_millisecond", "sodium_channel_m_gate", ALGEBRAIC}, {"alpha_h", "per_millisecond", "sodium_channel_h_gate", ALGEBRAIC}, {"beta_h", "per_millisecond", "sodium_channel_h_gate", ALGEBRAIC}, - {"E_K", "millivolt", "potassium_channel", COMPUTED_CONSTANT}, - {"g_K", "milliS_per_cm2", "potassium_channel", CONSTANT}, {"alpha_n", "per_millisecond", "potassium_channel_n_gate", ALGEBRAIC}, - {"beta_n", "per_millisecond", "potassium_channel_n_gate", ALGEBRAIC} + {"beta_n", "per_millisecond", "potassium_channel_n_gate", ALGEBRAIC}, + {"i_Stim", "microA_per_cm2", "membrane", EXTERNAL} }; double * createStatesArray() diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.py index a741566be0..5a01f6f0a8 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.py @@ -8,10 +8,10 @@ LIBCELLML_VERSION = "0.5.0" STATE_COUNT = 4 -CONSTANT_COUNT = 0 -COMPUTED_CONSTANT_COUNT = 0 -ALGEBRAIC_COUNT = 18 -EXTERNAL_COUNT = 0 +CONSTANT_COUNT = 5 +COMPUTED_CONSTANT_COUNT = 3 +ALGEBRAIC_COUNT = 9 +EXTERNAL_COUNT = 1 class VariableType(Enum): @@ -33,24 +33,24 @@ class VariableType(Enum): ] VARIABLE_INFO = [ - {"name": "i_Stim", "units": "microA_per_cm2", "component": "membrane", "type": VariableType.EXTERNAL}, - {"name": "i_L", "units": "microA_per_cm2", "component": "leakage_current", "type": VariableType.ALGEBRAIC}, - {"name": "i_K", "units": "microA_per_cm2", "component": "potassium_channel", "type": VariableType.ALGEBRAIC}, - {"name": "i_Na", "units": "microA_per_cm2", "component": "sodium_channel", "type": VariableType.ALGEBRAIC}, {"name": "Cm", "units": "microF_per_cm2", "component": "membrane", "type": VariableType.CONSTANT}, {"name": "E_R", "units": "millivolt", "component": "membrane", "type": VariableType.CONSTANT}, - {"name": "E_L", "units": "millivolt", "component": "leakage_current", "type": VariableType.COMPUTED_CONSTANT}, {"name": "g_L", "units": "milliS_per_cm2", "component": "leakage_current", "type": VariableType.CONSTANT}, - {"name": "E_Na", "units": "millivolt", "component": "sodium_channel", "type": VariableType.COMPUTED_CONSTANT}, {"name": "g_Na", "units": "milliS_per_cm2", "component": "sodium_channel", "type": VariableType.CONSTANT}, + {"name": "g_K", "units": "milliS_per_cm2", "component": "potassium_channel", "type": VariableType.CONSTANT}, + {"name": "E_L", "units": "millivolt", "component": "leakage_current", "type": VariableType.COMPUTED_CONSTANT}, + {"name": "E_Na", "units": "millivolt", "component": "sodium_channel", "type": VariableType.COMPUTED_CONSTANT}, + {"name": "E_K", "units": "millivolt", "component": "potassium_channel", "type": VariableType.COMPUTED_CONSTANT}, + {"name": "i_L", "units": "microA_per_cm2", "component": "leakage_current", "type": VariableType.ALGEBRAIC}, + {"name": "i_K", "units": "microA_per_cm2", "component": "potassium_channel", "type": VariableType.ALGEBRAIC}, + {"name": "i_Na", "units": "microA_per_cm2", "component": "sodium_channel", "type": VariableType.ALGEBRAIC}, {"name": "alpha_m", "units": "per_millisecond", "component": "sodium_channel_m_gate", "type": VariableType.ALGEBRAIC}, {"name": "beta_m", "units": "per_millisecond", "component": "sodium_channel_m_gate", "type": VariableType.ALGEBRAIC}, {"name": "alpha_h", "units": "per_millisecond", "component": "sodium_channel_h_gate", "type": VariableType.ALGEBRAIC}, {"name": "beta_h", "units": "per_millisecond", "component": "sodium_channel_h_gate", "type": VariableType.ALGEBRAIC}, - {"name": "E_K", "units": "millivolt", "component": "potassium_channel", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "g_K", "units": "milliS_per_cm2", "component": "potassium_channel", "type": VariableType.CONSTANT}, {"name": "alpha_n", "units": "per_millisecond", "component": "potassium_channel_n_gate", "type": VariableType.ALGEBRAIC}, - {"name": "beta_n", "units": "per_millisecond", "component": "potassium_channel_n_gate", "type": VariableType.ALGEBRAIC} + {"name": "beta_n", "units": "per_millisecond", "component": "potassium_channel_n_gate", "type": VariableType.ALGEBRAIC}, + {"name": "i_Stim", "units": "microA_per_cm2", "component": "membrane", "type": VariableType.EXTERNAL} ] diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.c index f687edd86f..68474ef4fe 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.c @@ -9,10 +9,9 @@ const char VERSION[] = "0.6.0"; const char LIBCELLML_VERSION[] = "0.5.0"; const size_t STATE_COUNT = 4; -const size_t CONSTANT_COUNT = 0; -const size_t COMPUTED_CONSTANT_COUNT = 0; -const size_t ALGEBRAIC_COUNT = 18; -const size_t EXTERNAL_COUNT = 0; +const size_t CONSTANT_COUNT = 5; +const size_t COMPUTED_CONSTANT_COUNT = 3; +const size_t ALGEBRAIC_COUNT = 10; const VariableInfo VOI_INFO = {"time", "millisecond", "environment", VARIABLE_OF_INTEGRATION}; @@ -24,22 +23,22 @@ const VariableInfo STATE_INFO[] = { }; const VariableInfo VARIABLE_INFO[] = { - {"i_Stim", "microA_per_cm2", "membrane", ALGEBRAIC}, - {"i_L", "microA_per_cm2", "leakage_current", ALGEBRAIC}, - {"i_K", "microA_per_cm2", "potassium_channel", ALGEBRAIC}, - {"i_Na", "microA_per_cm2", "sodium_channel", ALGEBRAIC}, {"Cm", "microF_per_cm2", "membrane", CONSTANT}, {"E_R", "millivolt", "membrane", CONSTANT}, - {"E_L", "millivolt", "leakage_current", COMPUTED_CONSTANT}, {"g_L", "milliS_per_cm2", "leakage_current", CONSTANT}, - {"E_Na", "millivolt", "sodium_channel", COMPUTED_CONSTANT}, {"g_Na", "milliS_per_cm2", "sodium_channel", CONSTANT}, + {"g_K", "milliS_per_cm2", "potassium_channel", CONSTANT}, + {"E_L", "millivolt", "leakage_current", COMPUTED_CONSTANT}, + {"E_Na", "millivolt", "sodium_channel", COMPUTED_CONSTANT}, + {"E_K", "millivolt", "potassium_channel", COMPUTED_CONSTANT}, + {"i_Stim", "microA_per_cm2", "membrane", ALGEBRAIC}, + {"i_L", "microA_per_cm2", "leakage_current", ALGEBRAIC}, + {"i_K", "microA_per_cm2", "potassium_channel", ALGEBRAIC}, + {"i_Na", "microA_per_cm2", "sodium_channel", ALGEBRAIC}, {"alpha_m", "per_millisecond", "sodium_channel_m_gate", ALGEBRAIC}, {"beta_m", "per_millisecond", "sodium_channel_m_gate", ALGEBRAIC}, {"alpha_h", "per_millisecond", "sodium_channel_h_gate", ALGEBRAIC}, {"beta_h", "per_millisecond", "sodium_channel_h_gate", ALGEBRAIC}, - {"E_K", "millivolt", "potassium_channel", COMPUTED_CONSTANT}, - {"g_K", "milliS_per_cm2", "potassium_channel", CONSTANT}, {"alpha_n", "per_millisecond", "potassium_channel_n_gate", ALGEBRAIC}, {"beta_n", "per_millisecond", "potassium_channel_n_gate", ALGEBRAIC} }; diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.c index c56e1e8f48..69c72fb83b 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.c @@ -9,10 +9,10 @@ const char VERSION[] = "0.6.0"; const char LIBCELLML_VERSION[] = "0.5.0"; const size_t STATE_COUNT = 4; -const size_t CONSTANT_COUNT = 0; -const size_t COMPUTED_CONSTANT_COUNT = 0; -const size_t ALGEBRAIC_COUNT = 18; -const size_t EXTERNAL_COUNT = 0; +const size_t CONSTANT_COUNT = 5; +const size_t COMPUTED_CONSTANT_COUNT = 2; +const size_t ALGEBRAIC_COUNT = 10; +const size_t EXTERNAL_COUNT = 1; const VariableInfo VOI_INFO = {"time", "millisecond", "environment", VARIABLE_OF_INTEGRATION}; @@ -24,24 +24,24 @@ const VariableInfo STATE_INFO[] = { }; const VariableInfo VARIABLE_INFO[] = { - {"i_Stim", "microA_per_cm2", "membrane", ALGEBRAIC}, - {"i_L", "microA_per_cm2", "leakage_current", ALGEBRAIC}, - {"i_K", "microA_per_cm2", "potassium_channel", ALGEBRAIC}, - {"i_Na", "microA_per_cm2", "sodium_channel", ALGEBRAIC}, {"Cm", "microF_per_cm2", "membrane", CONSTANT}, {"E_R", "millivolt", "membrane", CONSTANT}, - {"E_L", "millivolt", "leakage_current", EXTERNAL}, {"g_L", "milliS_per_cm2", "leakage_current", CONSTANT}, - {"E_Na", "millivolt", "sodium_channel", COMPUTED_CONSTANT}, {"g_Na", "milliS_per_cm2", "sodium_channel", CONSTANT}, + {"g_K", "milliS_per_cm2", "potassium_channel", CONSTANT}, + {"E_Na", "millivolt", "sodium_channel", COMPUTED_CONSTANT}, + {"E_K", "millivolt", "potassium_channel", COMPUTED_CONSTANT}, + {"i_Stim", "microA_per_cm2", "membrane", ALGEBRAIC}, + {"i_L", "microA_per_cm2", "leakage_current", ALGEBRAIC}, + {"i_K", "microA_per_cm2", "potassium_channel", ALGEBRAIC}, + {"i_Na", "microA_per_cm2", "sodium_channel", ALGEBRAIC}, {"alpha_m", "per_millisecond", "sodium_channel_m_gate", ALGEBRAIC}, {"beta_m", "per_millisecond", "sodium_channel_m_gate", ALGEBRAIC}, {"alpha_h", "per_millisecond", "sodium_channel_h_gate", ALGEBRAIC}, {"beta_h", "per_millisecond", "sodium_channel_h_gate", ALGEBRAIC}, - {"E_K", "millivolt", "potassium_channel", COMPUTED_CONSTANT}, - {"g_K", "milliS_per_cm2", "potassium_channel", CONSTANT}, {"alpha_n", "per_millisecond", "potassium_channel_n_gate", ALGEBRAIC}, - {"beta_n", "per_millisecond", "potassium_channel_n_gate", ALGEBRAIC} + {"beta_n", "per_millisecond", "potassium_channel_n_gate", ALGEBRAIC}, + {"E_L", "millivolt", "leakage_current", EXTERNAL} }; double * createStatesArray() diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.py index 796983378f..39e9f1d653 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.py @@ -8,10 +8,10 @@ LIBCELLML_VERSION = "0.5.0" STATE_COUNT = 4 -CONSTANT_COUNT = 0 -COMPUTED_CONSTANT_COUNT = 0 -ALGEBRAIC_COUNT = 18 -EXTERNAL_COUNT = 0 +CONSTANT_COUNT = 5 +COMPUTED_CONSTANT_COUNT = 2 +ALGEBRAIC_COUNT = 10 +EXTERNAL_COUNT = 1 class VariableType(Enum): @@ -33,24 +33,24 @@ class VariableType(Enum): ] VARIABLE_INFO = [ - {"name": "i_Stim", "units": "microA_per_cm2", "component": "membrane", "type": VariableType.ALGEBRAIC}, - {"name": "i_L", "units": "microA_per_cm2", "component": "leakage_current", "type": VariableType.ALGEBRAIC}, - {"name": "i_K", "units": "microA_per_cm2", "component": "potassium_channel", "type": VariableType.ALGEBRAIC}, - {"name": "i_Na", "units": "microA_per_cm2", "component": "sodium_channel", "type": VariableType.ALGEBRAIC}, {"name": "Cm", "units": "microF_per_cm2", "component": "membrane", "type": VariableType.CONSTANT}, {"name": "E_R", "units": "millivolt", "component": "membrane", "type": VariableType.CONSTANT}, - {"name": "E_L", "units": "millivolt", "component": "leakage_current", "type": VariableType.EXTERNAL}, {"name": "g_L", "units": "milliS_per_cm2", "component": "leakage_current", "type": VariableType.CONSTANT}, - {"name": "E_Na", "units": "millivolt", "component": "sodium_channel", "type": VariableType.COMPUTED_CONSTANT}, {"name": "g_Na", "units": "milliS_per_cm2", "component": "sodium_channel", "type": VariableType.CONSTANT}, + {"name": "g_K", "units": "milliS_per_cm2", "component": "potassium_channel", "type": VariableType.CONSTANT}, + {"name": "E_Na", "units": "millivolt", "component": "sodium_channel", "type": VariableType.COMPUTED_CONSTANT}, + {"name": "E_K", "units": "millivolt", "component": "potassium_channel", "type": VariableType.COMPUTED_CONSTANT}, + {"name": "i_Stim", "units": "microA_per_cm2", "component": "membrane", "type": VariableType.ALGEBRAIC}, + {"name": "i_L", "units": "microA_per_cm2", "component": "leakage_current", "type": VariableType.ALGEBRAIC}, + {"name": "i_K", "units": "microA_per_cm2", "component": "potassium_channel", "type": VariableType.ALGEBRAIC}, + {"name": "i_Na", "units": "microA_per_cm2", "component": "sodium_channel", "type": VariableType.ALGEBRAIC}, {"name": "alpha_m", "units": "per_millisecond", "component": "sodium_channel_m_gate", "type": VariableType.ALGEBRAIC}, {"name": "beta_m", "units": "per_millisecond", "component": "sodium_channel_m_gate", "type": VariableType.ALGEBRAIC}, {"name": "alpha_h", "units": "per_millisecond", "component": "sodium_channel_h_gate", "type": VariableType.ALGEBRAIC}, {"name": "beta_h", "units": "per_millisecond", "component": "sodium_channel_h_gate", "type": VariableType.ALGEBRAIC}, - {"name": "E_K", "units": "millivolt", "component": "potassium_channel", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "g_K", "units": "milliS_per_cm2", "component": "potassium_channel", "type": VariableType.CONSTANT}, {"name": "alpha_n", "units": "per_millisecond", "component": "potassium_channel_n_gate", "type": VariableType.ALGEBRAIC}, - {"name": "beta_n", "units": "per_millisecond", "component": "potassium_channel_n_gate", "type": VariableType.ALGEBRAIC} + {"name": "beta_n", "units": "per_millisecond", "component": "potassium_channel_n_gate", "type": VariableType.ALGEBRAIC}, + {"name": "E_L", "units": "millivolt", "component": "leakage_current", "type": VariableType.EXTERNAL} ] diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.c index 1cc4901fd0..d9d05dbabc 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.c @@ -9,10 +9,10 @@ const char VERSION[] = "0.6.0"; const char LIBCELLML_VERSION[] = "0.5.0"; const size_t STATE_COUNT = 4; -const size_t CONSTANT_COUNT = 0; -const size_t COMPUTED_CONSTANT_COUNT = 0; -const size_t ALGEBRAIC_COUNT = 18; -const size_t EXTERNAL_COUNT = 0; +const size_t CONSTANT_COUNT = 4; +const size_t COMPUTED_CONSTANT_COUNT = 3; +const size_t ALGEBRAIC_COUNT = 10; +const size_t EXTERNAL_COUNT = 1; const VariableInfo VOI_INFO = {"time", "millisecond", "environment", VARIABLE_OF_INTEGRATION}; @@ -24,24 +24,24 @@ const VariableInfo STATE_INFO[] = { }; const VariableInfo VARIABLE_INFO[] = { + {"E_R", "millivolt", "membrane", CONSTANT}, + {"g_L", "milliS_per_cm2", "leakage_current", CONSTANT}, + {"g_Na", "milliS_per_cm2", "sodium_channel", CONSTANT}, + {"g_K", "milliS_per_cm2", "potassium_channel", CONSTANT}, + {"E_L", "millivolt", "leakage_current", COMPUTED_CONSTANT}, + {"E_Na", "millivolt", "sodium_channel", COMPUTED_CONSTANT}, + {"E_K", "millivolt", "potassium_channel", COMPUTED_CONSTANT}, {"i_Stim", "microA_per_cm2", "membrane", ALGEBRAIC}, {"i_L", "microA_per_cm2", "leakage_current", ALGEBRAIC}, {"i_K", "microA_per_cm2", "potassium_channel", ALGEBRAIC}, {"i_Na", "microA_per_cm2", "sodium_channel", ALGEBRAIC}, - {"Cm", "microF_per_cm2", "membrane", EXTERNAL}, - {"E_R", "millivolt", "membrane", CONSTANT}, - {"E_L", "millivolt", "leakage_current", COMPUTED_CONSTANT}, - {"g_L", "milliS_per_cm2", "leakage_current", CONSTANT}, - {"E_Na", "millivolt", "sodium_channel", COMPUTED_CONSTANT}, - {"g_Na", "milliS_per_cm2", "sodium_channel", CONSTANT}, {"alpha_m", "per_millisecond", "sodium_channel_m_gate", ALGEBRAIC}, {"beta_m", "per_millisecond", "sodium_channel_m_gate", ALGEBRAIC}, {"alpha_h", "per_millisecond", "sodium_channel_h_gate", ALGEBRAIC}, {"beta_h", "per_millisecond", "sodium_channel_h_gate", ALGEBRAIC}, - {"E_K", "millivolt", "potassium_channel", COMPUTED_CONSTANT}, - {"g_K", "milliS_per_cm2", "potassium_channel", CONSTANT}, {"alpha_n", "per_millisecond", "potassium_channel_n_gate", ALGEBRAIC}, - {"beta_n", "per_millisecond", "potassium_channel_n_gate", ALGEBRAIC} + {"beta_n", "per_millisecond", "potassium_channel_n_gate", ALGEBRAIC}, + {"Cm", "microF_per_cm2", "membrane", EXTERNAL} }; double * createStatesArray() diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.py index b78d3d5880..3749793d0d 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.py @@ -8,10 +8,10 @@ LIBCELLML_VERSION = "0.5.0" STATE_COUNT = 4 -CONSTANT_COUNT = 0 -COMPUTED_CONSTANT_COUNT = 0 -ALGEBRAIC_COUNT = 18 -EXTERNAL_COUNT = 0 +CONSTANT_COUNT = 4 +COMPUTED_CONSTANT_COUNT = 3 +ALGEBRAIC_COUNT = 10 +EXTERNAL_COUNT = 1 class VariableType(Enum): @@ -33,24 +33,24 @@ class VariableType(Enum): ] VARIABLE_INFO = [ + {"name": "E_R", "units": "millivolt", "component": "membrane", "type": VariableType.CONSTANT}, + {"name": "g_L", "units": "milliS_per_cm2", "component": "leakage_current", "type": VariableType.CONSTANT}, + {"name": "g_Na", "units": "milliS_per_cm2", "component": "sodium_channel", "type": VariableType.CONSTANT}, + {"name": "g_K", "units": "milliS_per_cm2", "component": "potassium_channel", "type": VariableType.CONSTANT}, + {"name": "E_L", "units": "millivolt", "component": "leakage_current", "type": VariableType.COMPUTED_CONSTANT}, + {"name": "E_Na", "units": "millivolt", "component": "sodium_channel", "type": VariableType.COMPUTED_CONSTANT}, + {"name": "E_K", "units": "millivolt", "component": "potassium_channel", "type": VariableType.COMPUTED_CONSTANT}, {"name": "i_Stim", "units": "microA_per_cm2", "component": "membrane", "type": VariableType.ALGEBRAIC}, {"name": "i_L", "units": "microA_per_cm2", "component": "leakage_current", "type": VariableType.ALGEBRAIC}, {"name": "i_K", "units": "microA_per_cm2", "component": "potassium_channel", "type": VariableType.ALGEBRAIC}, {"name": "i_Na", "units": "microA_per_cm2", "component": "sodium_channel", "type": VariableType.ALGEBRAIC}, - {"name": "Cm", "units": "microF_per_cm2", "component": "membrane", "type": VariableType.EXTERNAL}, - {"name": "E_R", "units": "millivolt", "component": "membrane", "type": VariableType.CONSTANT}, - {"name": "E_L", "units": "millivolt", "component": "leakage_current", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "g_L", "units": "milliS_per_cm2", "component": "leakage_current", "type": VariableType.CONSTANT}, - {"name": "E_Na", "units": "millivolt", "component": "sodium_channel", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "g_Na", "units": "milliS_per_cm2", "component": "sodium_channel", "type": VariableType.CONSTANT}, {"name": "alpha_m", "units": "per_millisecond", "component": "sodium_channel_m_gate", "type": VariableType.ALGEBRAIC}, {"name": "beta_m", "units": "per_millisecond", "component": "sodium_channel_m_gate", "type": VariableType.ALGEBRAIC}, {"name": "alpha_h", "units": "per_millisecond", "component": "sodium_channel_h_gate", "type": VariableType.ALGEBRAIC}, {"name": "beta_h", "units": "per_millisecond", "component": "sodium_channel_h_gate", "type": VariableType.ALGEBRAIC}, - {"name": "E_K", "units": "millivolt", "component": "potassium_channel", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "g_K", "units": "milliS_per_cm2", "component": "potassium_channel", "type": VariableType.CONSTANT}, {"name": "alpha_n", "units": "per_millisecond", "component": "potassium_channel_n_gate", "type": VariableType.ALGEBRAIC}, - {"name": "beta_n", "units": "per_millisecond", "component": "potassium_channel_n_gate", "type": VariableType.ALGEBRAIC} + {"name": "beta_n", "units": "per_millisecond", "component": "potassium_channel_n_gate", "type": VariableType.ALGEBRAIC}, + {"name": "Cm", "units": "microF_per_cm2", "component": "membrane", "type": VariableType.EXTERNAL} ] diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.c index cfcaf93f2c..4048ffd583 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.c @@ -9,10 +9,9 @@ const char VERSION[] = "0.6.0"; const char LIBCELLML_VERSION[] = "0.5.0"; const size_t STATE_COUNT = 4; -const size_t CONSTANT_COUNT = 0; -const size_t COMPUTED_CONSTANT_COUNT = 0; -const size_t ALGEBRAIC_COUNT = 18; -const size_t EXTERNAL_COUNT = 0; +const size_t CONSTANT_COUNT = 5; +const size_t COMPUTED_CONSTANT_COUNT = 3; +const size_t ALGEBRAIC_COUNT = 10; const VariableInfo VOI_INFO = {"time", "millisecond", "environment", VARIABLE_OF_INTEGRATION}; @@ -24,22 +23,22 @@ const VariableInfo STATE_INFO[] = { }; const VariableInfo VARIABLE_INFO[] = { - {"i_Stim", "microA_per_cm2", "membrane", ALGEBRAIC}, - {"i_L", "microA_per_cm2", "leakage_current", ALGEBRAIC}, - {"i_K", "microA_per_cm2", "potassium_channel", ALGEBRAIC}, - {"i_Na", "microA_per_cm2", "sodium_channel", ALGEBRAIC}, {"Cm", "microF_per_cm2", "membrane", CONSTANT}, {"E_R", "millivolt", "membrane", CONSTANT}, - {"E_L", "millivolt", "leakage_current", COMPUTED_CONSTANT}, {"g_L", "milliS_per_cm2", "leakage_current", CONSTANT}, - {"E_Na", "millivolt", "sodium_channel", COMPUTED_CONSTANT}, {"g_Na", "milliS_per_cm2", "sodium_channel", CONSTANT}, + {"g_K", "milliS_per_cm2", "potassium_channel", CONSTANT}, + {"E_L", "millivolt", "leakage_current", COMPUTED_CONSTANT}, + {"E_Na", "millivolt", "sodium_channel", COMPUTED_CONSTANT}, + {"E_K", "millivolt", "potassium_channel", COMPUTED_CONSTANT}, + {"i_Stim", "microA_per_cm2", "membrane", ALGEBRAIC}, + {"i_L", "microA_per_cm2", "leakage_current", ALGEBRAIC}, + {"i_K", "microA_per_cm2", "potassium_channel", ALGEBRAIC}, + {"i_Na", "microA_per_cm2", "sodium_channel", ALGEBRAIC}, {"alpha_m", "per_millisecond", "sodium_channel_m_gate", ALGEBRAIC}, {"beta_m", "per_millisecond", "sodium_channel_m_gate", ALGEBRAIC}, {"alpha_h", "per_millisecond", "sodium_channel_h_gate", ALGEBRAIC}, {"beta_h", "per_millisecond", "sodium_channel_h_gate", ALGEBRAIC}, - {"E_K", "millivolt", "potassium_channel", COMPUTED_CONSTANT}, - {"g_K", "milliS_per_cm2", "potassium_channel", CONSTANT}, {"alpha_n", "per_millisecond", "potassium_channel_n_gate", ALGEBRAIC}, {"beta_n", "per_millisecond", "potassium_channel_n_gate", ALGEBRAIC} }; @@ -491,22 +490,22 @@ void findRoot16(double voi, double *states, double *rates, double *variables) void initialiseVariables(double *states, double *rates, double *constants) { - algebraic[0] = 0.0; - algebraic[1] = 0.0; - algebraic[2] = 0.0; - algebraic[3] = 0.0; constants[0] = 1.0; constants[1] = 0.0; - computedConstants[0] = 0.0; constants[2] = 0.3; - computedConstants[1] = 0.0; constants[3] = 120.0; + constants[4] = 36.0; + computedConstants[0] = 0.0; + computedConstants[1] = 0.0; + computedConstants[2] = 0.0; + algebraic[0] = 0.0; + algebraic[1] = 0.0; + algebraic[2] = 0.0; + algebraic[3] = 0.0; algebraic[4] = 0.0; algebraic[5] = 0.0; algebraic[6] = 0.0; algebraic[7] = 0.0; - computedConstants[2] = 0.0; - constants[4] = 36.0; algebraic[8] = 0.0; algebraic[9] = 0.0; states[0] = 0.0; diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.h index be76c88f61..2379ada7dc 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.h +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.h @@ -11,7 +11,6 @@ extern const size_t STATE_COUNT; extern const size_t CONSTANT_COUNT; extern const size_t COMPUTED_CONSTANT_COUNT; extern const size_t ALGEBRAIC_COUNT; -extern const size_t EXTERNAL_COUNT; typedef enum { VARIABLE_OF_INTEGRATION, diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.py index fbc3704f87..cbeb56196a 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.py @@ -8,10 +8,9 @@ LIBCELLML_VERSION = "0.5.0" STATE_COUNT = 4 -CONSTANT_COUNT = 0 -COMPUTED_CONSTANT_COUNT = 0 -ALGEBRAIC_COUNT = 18 -EXTERNAL_COUNT = 0 +CONSTANT_COUNT = 5 +COMPUTED_CONSTANT_COUNT = 3 +ALGEBRAIC_COUNT = 10 class VariableType(Enum): @@ -32,22 +31,22 @@ class VariableType(Enum): ] VARIABLE_INFO = [ - {"name": "i_Stim", "units": "microA_per_cm2", "component": "membrane", "type": VariableType.ALGEBRAIC}, - {"name": "i_L", "units": "microA_per_cm2", "component": "leakage_current", "type": VariableType.ALGEBRAIC}, - {"name": "i_K", "units": "microA_per_cm2", "component": "potassium_channel", "type": VariableType.ALGEBRAIC}, - {"name": "i_Na", "units": "microA_per_cm2", "component": "sodium_channel", "type": VariableType.ALGEBRAIC}, {"name": "Cm", "units": "microF_per_cm2", "component": "membrane", "type": VariableType.CONSTANT}, {"name": "E_R", "units": "millivolt", "component": "membrane", "type": VariableType.CONSTANT}, - {"name": "E_L", "units": "millivolt", "component": "leakage_current", "type": VariableType.COMPUTED_CONSTANT}, {"name": "g_L", "units": "milliS_per_cm2", "component": "leakage_current", "type": VariableType.CONSTANT}, - {"name": "E_Na", "units": "millivolt", "component": "sodium_channel", "type": VariableType.COMPUTED_CONSTANT}, {"name": "g_Na", "units": "milliS_per_cm2", "component": "sodium_channel", "type": VariableType.CONSTANT}, + {"name": "g_K", "units": "milliS_per_cm2", "component": "potassium_channel", "type": VariableType.CONSTANT}, + {"name": "E_L", "units": "millivolt", "component": "leakage_current", "type": VariableType.COMPUTED_CONSTANT}, + {"name": "E_Na", "units": "millivolt", "component": "sodium_channel", "type": VariableType.COMPUTED_CONSTANT}, + {"name": "E_K", "units": "millivolt", "component": "potassium_channel", "type": VariableType.COMPUTED_CONSTANT}, + {"name": "i_Stim", "units": "microA_per_cm2", "component": "membrane", "type": VariableType.ALGEBRAIC}, + {"name": "i_L", "units": "microA_per_cm2", "component": "leakage_current", "type": VariableType.ALGEBRAIC}, + {"name": "i_K", "units": "microA_per_cm2", "component": "potassium_channel", "type": VariableType.ALGEBRAIC}, + {"name": "i_Na", "units": "microA_per_cm2", "component": "sodium_channel", "type": VariableType.ALGEBRAIC}, {"name": "alpha_m", "units": "per_millisecond", "component": "sodium_channel_m_gate", "type": VariableType.ALGEBRAIC}, {"name": "beta_m", "units": "per_millisecond", "component": "sodium_channel_m_gate", "type": VariableType.ALGEBRAIC}, {"name": "alpha_h", "units": "per_millisecond", "component": "sodium_channel_h_gate", "type": VariableType.ALGEBRAIC}, {"name": "beta_h", "units": "per_millisecond", "component": "sodium_channel_h_gate", "type": VariableType.ALGEBRAIC}, - {"name": "E_K", "units": "millivolt", "component": "potassium_channel", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "g_K", "units": "milliS_per_cm2", "component": "potassium_channel", "type": VariableType.CONSTANT}, {"name": "alpha_n", "units": "per_millisecond", "component": "potassium_channel_n_gate", "type": VariableType.ALGEBRAIC}, {"name": "beta_n", "units": "per_millisecond", "component": "potassium_channel_n_gate", "type": VariableType.ALGEBRAIC} ] @@ -434,22 +433,22 @@ def find_root_16(voi, states, rates, variables): def initialise_variables(states, rates, constants): - algebraic[0] = 0.0 - algebraic[1] = 0.0 - algebraic[2] = 0.0 - algebraic[3] = 0.0 constants[0] = 1.0 constants[1] = 0.0 - computed_constants[0] = 0.0 constants[2] = 0.3 - computed_constants[1] = 0.0 constants[3] = 120.0 + constants[4] = 36.0 + computed_constants[0] = 0.0 + computed_constants[1] = 0.0 + computed_constants[2] = 0.0 + algebraic[0] = 0.0 + algebraic[1] = 0.0 + algebraic[2] = 0.0 + algebraic[3] = 0.0 algebraic[4] = 0.0 algebraic[5] = 0.0 algebraic[6] = 0.0 algebraic[7] = 0.0 - computed_constants[2] = 0.0 - constants[4] = 36.0 algebraic[8] = 0.0 algebraic[9] = 0.0 states[0] = 0.0 diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.c index 2da76b8e8d..e38ef8855e 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.c @@ -9,10 +9,10 @@ const char VERSION[] = "0.6.0"; const char LIBCELLML_VERSION[] = "0.5.0"; const size_t STATE_COUNT = 4; -const size_t CONSTANT_COUNT = 0; -const size_t COMPUTED_CONSTANT_COUNT = 0; -const size_t ALGEBRAIC_COUNT = 18; -const size_t EXTERNAL_COUNT = 0; +const size_t CONSTANT_COUNT = 5; +const size_t COMPUTED_CONSTANT_COUNT = 3; +const size_t ALGEBRAIC_COUNT = 8; +const size_t EXTERNAL_COUNT = 2; const VariableInfo VOI_INFO = {"time", "millisecond", "environment", VARIABLE_OF_INTEGRATION}; @@ -24,23 +24,23 @@ const VariableInfo STATE_INFO[] = { }; const VariableInfo VARIABLE_INFO[] = { - {"i_Stim", "microA_per_cm2", "membrane", EXTERNAL}, - {"i_L", "microA_per_cm2", "leakage_current", ALGEBRAIC}, - {"i_K", "microA_per_cm2", "potassium_channel", ALGEBRAIC}, - {"i_Na", "microA_per_cm2", "sodium_channel", ALGEBRAIC}, {"Cm", "microF_per_cm2", "membrane", CONSTANT}, {"E_R", "millivolt", "membrane", CONSTANT}, - {"E_L", "millivolt", "leakage_current", COMPUTED_CONSTANT}, {"g_L", "milliS_per_cm2", "leakage_current", CONSTANT}, - {"E_Na", "millivolt", "sodium_channel", COMPUTED_CONSTANT}, {"g_Na", "milliS_per_cm2", "sodium_channel", CONSTANT}, + {"g_K", "milliS_per_cm2", "potassium_channel", CONSTANT}, + {"E_L", "millivolt", "leakage_current", COMPUTED_CONSTANT}, + {"E_Na", "millivolt", "sodium_channel", COMPUTED_CONSTANT}, + {"E_K", "millivolt", "potassium_channel", COMPUTED_CONSTANT}, + {"i_L", "microA_per_cm2", "leakage_current", ALGEBRAIC}, + {"i_K", "microA_per_cm2", "potassium_channel", ALGEBRAIC}, + {"i_Na", "microA_per_cm2", "sodium_channel", ALGEBRAIC}, {"alpha_m", "per_millisecond", "sodium_channel_m_gate", ALGEBRAIC}, {"beta_m", "per_millisecond", "sodium_channel_m_gate", ALGEBRAIC}, {"alpha_h", "per_millisecond", "sodium_channel_h_gate", ALGEBRAIC}, {"beta_h", "per_millisecond", "sodium_channel_h_gate", ALGEBRAIC}, - {"E_K", "millivolt", "potassium_channel", COMPUTED_CONSTANT}, - {"g_K", "milliS_per_cm2", "potassium_channel", CONSTANT}, {"alpha_n", "per_millisecond", "potassium_channel_n_gate", ALGEBRAIC}, + {"i_Stim", "microA_per_cm2", "membrane", EXTERNAL}, {"beta_n", "per_millisecond", "potassium_channel_n_gate", EXTERNAL} }; diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.py index 4a645f0713..98ab308f32 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.py @@ -8,10 +8,10 @@ LIBCELLML_VERSION = "0.5.0" STATE_COUNT = 4 -CONSTANT_COUNT = 0 -COMPUTED_CONSTANT_COUNT = 0 -ALGEBRAIC_COUNT = 18 -EXTERNAL_COUNT = 0 +CONSTANT_COUNT = 5 +COMPUTED_CONSTANT_COUNT = 3 +ALGEBRAIC_COUNT = 8 +EXTERNAL_COUNT = 2 class VariableType(Enum): @@ -33,23 +33,23 @@ class VariableType(Enum): ] VARIABLE_INFO = [ - {"name": "i_Stim", "units": "microA_per_cm2", "component": "membrane", "type": VariableType.EXTERNAL}, - {"name": "i_L", "units": "microA_per_cm2", "component": "leakage_current", "type": VariableType.ALGEBRAIC}, - {"name": "i_K", "units": "microA_per_cm2", "component": "potassium_channel", "type": VariableType.ALGEBRAIC}, - {"name": "i_Na", "units": "microA_per_cm2", "component": "sodium_channel", "type": VariableType.ALGEBRAIC}, {"name": "Cm", "units": "microF_per_cm2", "component": "membrane", "type": VariableType.CONSTANT}, {"name": "E_R", "units": "millivolt", "component": "membrane", "type": VariableType.CONSTANT}, - {"name": "E_L", "units": "millivolt", "component": "leakage_current", "type": VariableType.COMPUTED_CONSTANT}, {"name": "g_L", "units": "milliS_per_cm2", "component": "leakage_current", "type": VariableType.CONSTANT}, - {"name": "E_Na", "units": "millivolt", "component": "sodium_channel", "type": VariableType.COMPUTED_CONSTANT}, {"name": "g_Na", "units": "milliS_per_cm2", "component": "sodium_channel", "type": VariableType.CONSTANT}, + {"name": "g_K", "units": "milliS_per_cm2", "component": "potassium_channel", "type": VariableType.CONSTANT}, + {"name": "E_L", "units": "millivolt", "component": "leakage_current", "type": VariableType.COMPUTED_CONSTANT}, + {"name": "E_Na", "units": "millivolt", "component": "sodium_channel", "type": VariableType.COMPUTED_CONSTANT}, + {"name": "E_K", "units": "millivolt", "component": "potassium_channel", "type": VariableType.COMPUTED_CONSTANT}, + {"name": "i_L", "units": "microA_per_cm2", "component": "leakage_current", "type": VariableType.ALGEBRAIC}, + {"name": "i_K", "units": "microA_per_cm2", "component": "potassium_channel", "type": VariableType.ALGEBRAIC}, + {"name": "i_Na", "units": "microA_per_cm2", "component": "sodium_channel", "type": VariableType.ALGEBRAIC}, {"name": "alpha_m", "units": "per_millisecond", "component": "sodium_channel_m_gate", "type": VariableType.ALGEBRAIC}, {"name": "beta_m", "units": "per_millisecond", "component": "sodium_channel_m_gate", "type": VariableType.ALGEBRAIC}, {"name": "alpha_h", "units": "per_millisecond", "component": "sodium_channel_h_gate", "type": VariableType.ALGEBRAIC}, {"name": "beta_h", "units": "per_millisecond", "component": "sodium_channel_h_gate", "type": VariableType.ALGEBRAIC}, - {"name": "E_K", "units": "millivolt", "component": "potassium_channel", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "g_K", "units": "milliS_per_cm2", "component": "potassium_channel", "type": VariableType.CONSTANT}, {"name": "alpha_n", "units": "per_millisecond", "component": "potassium_channel_n_gate", "type": VariableType.ALGEBRAIC}, + {"name": "i_Stim", "units": "microA_per_cm2", "component": "membrane", "type": VariableType.EXTERNAL}, {"name": "beta_n", "units": "per_millisecond", "component": "potassium_channel_n_gate", "type": VariableType.EXTERNAL} ] diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.c index 50798a7967..91f595dd07 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.c @@ -9,10 +9,10 @@ const char VERSION[] = "0.6.0"; const char LIBCELLML_VERSION[] = "0.5.0"; const size_t STATE_COUNT = 4; -const size_t CONSTANT_COUNT = 0; +const size_t CONSTANT_COUNT = 4; const size_t COMPUTED_CONSTANT_COUNT = 0; -const size_t ALGEBRAIC_COUNT = 18; -const size_t EXTERNAL_COUNT = 0; +const size_t ALGEBRAIC_COUNT = 12; +const size_t EXTERNAL_COUNT = 2; const VariableInfo VOI_INFO = {"time", "millisecond", "environment", VARIABLE_OF_INTEGRATION}; @@ -24,24 +24,24 @@ const VariableInfo STATE_INFO[] = { }; const VariableInfo VARIABLE_INFO[] = { + {"Cm", "microF_per_cm2", "membrane", CONSTANT}, + {"g_L", "milliS_per_cm2", "leakage_current", CONSTANT}, + {"g_Na", "milliS_per_cm2", "sodium_channel", CONSTANT}, + {"g_K", "milliS_per_cm2", "potassium_channel", CONSTANT}, {"i_Stim", "microA_per_cm2", "membrane", ALGEBRAIC}, {"i_L", "microA_per_cm2", "leakage_current", ALGEBRAIC}, {"i_K", "microA_per_cm2", "potassium_channel", ALGEBRAIC}, {"i_Na", "microA_per_cm2", "sodium_channel", ALGEBRAIC}, - {"Cm", "microF_per_cm2", "membrane", CONSTANT}, - {"E_R", "millivolt", "membrane", EXTERNAL}, {"E_L", "millivolt", "leakage_current", ALGEBRAIC}, - {"g_L", "milliS_per_cm2", "leakage_current", CONSTANT}, {"E_Na", "millivolt", "sodium_channel", ALGEBRAIC}, - {"g_Na", "milliS_per_cm2", "sodium_channel", CONSTANT}, {"alpha_m", "per_millisecond", "sodium_channel_m_gate", ALGEBRAIC}, {"beta_m", "per_millisecond", "sodium_channel_m_gate", ALGEBRAIC}, {"alpha_h", "per_millisecond", "sodium_channel_h_gate", ALGEBRAIC}, {"beta_h", "per_millisecond", "sodium_channel_h_gate", ALGEBRAIC}, - {"E_K", "millivolt", "potassium_channel", EXTERNAL}, - {"g_K", "milliS_per_cm2", "potassium_channel", CONSTANT}, {"alpha_n", "per_millisecond", "potassium_channel_n_gate", ALGEBRAIC}, - {"beta_n", "per_millisecond", "potassium_channel_n_gate", ALGEBRAIC} + {"beta_n", "per_millisecond", "potassium_channel_n_gate", ALGEBRAIC}, + {"E_R", "millivolt", "membrane", EXTERNAL}, + {"E_K", "millivolt", "potassium_channel", EXTERNAL} }; double * createStatesArray() diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.py index e83d4154ec..7785dba580 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.py @@ -8,10 +8,10 @@ LIBCELLML_VERSION = "0.5.0" STATE_COUNT = 4 -CONSTANT_COUNT = 0 +CONSTANT_COUNT = 4 COMPUTED_CONSTANT_COUNT = 0 -ALGEBRAIC_COUNT = 18 -EXTERNAL_COUNT = 0 +ALGEBRAIC_COUNT = 12 +EXTERNAL_COUNT = 2 class VariableType(Enum): @@ -33,24 +33,24 @@ class VariableType(Enum): ] VARIABLE_INFO = [ + {"name": "Cm", "units": "microF_per_cm2", "component": "membrane", "type": VariableType.CONSTANT}, + {"name": "g_L", "units": "milliS_per_cm2", "component": "leakage_current", "type": VariableType.CONSTANT}, + {"name": "g_Na", "units": "milliS_per_cm2", "component": "sodium_channel", "type": VariableType.CONSTANT}, + {"name": "g_K", "units": "milliS_per_cm2", "component": "potassium_channel", "type": VariableType.CONSTANT}, {"name": "i_Stim", "units": "microA_per_cm2", "component": "membrane", "type": VariableType.ALGEBRAIC}, {"name": "i_L", "units": "microA_per_cm2", "component": "leakage_current", "type": VariableType.ALGEBRAIC}, {"name": "i_K", "units": "microA_per_cm2", "component": "potassium_channel", "type": VariableType.ALGEBRAIC}, {"name": "i_Na", "units": "microA_per_cm2", "component": "sodium_channel", "type": VariableType.ALGEBRAIC}, - {"name": "Cm", "units": "microF_per_cm2", "component": "membrane", "type": VariableType.CONSTANT}, - {"name": "E_R", "units": "millivolt", "component": "membrane", "type": VariableType.EXTERNAL}, {"name": "E_L", "units": "millivolt", "component": "leakage_current", "type": VariableType.ALGEBRAIC}, - {"name": "g_L", "units": "milliS_per_cm2", "component": "leakage_current", "type": VariableType.CONSTANT}, {"name": "E_Na", "units": "millivolt", "component": "sodium_channel", "type": VariableType.ALGEBRAIC}, - {"name": "g_Na", "units": "milliS_per_cm2", "component": "sodium_channel", "type": VariableType.CONSTANT}, {"name": "alpha_m", "units": "per_millisecond", "component": "sodium_channel_m_gate", "type": VariableType.ALGEBRAIC}, {"name": "beta_m", "units": "per_millisecond", "component": "sodium_channel_m_gate", "type": VariableType.ALGEBRAIC}, {"name": "alpha_h", "units": "per_millisecond", "component": "sodium_channel_h_gate", "type": VariableType.ALGEBRAIC}, {"name": "beta_h", "units": "per_millisecond", "component": "sodium_channel_h_gate", "type": VariableType.ALGEBRAIC}, - {"name": "E_K", "units": "millivolt", "component": "potassium_channel", "type": VariableType.EXTERNAL}, - {"name": "g_K", "units": "milliS_per_cm2", "component": "potassium_channel", "type": VariableType.CONSTANT}, {"name": "alpha_n", "units": "per_millisecond", "component": "potassium_channel_n_gate", "type": VariableType.ALGEBRAIC}, - {"name": "beta_n", "units": "per_millisecond", "component": "potassium_channel_n_gate", "type": VariableType.ALGEBRAIC} + {"name": "beta_n", "units": "per_millisecond", "component": "potassium_channel_n_gate", "type": VariableType.ALGEBRAIC}, + {"name": "E_R", "units": "millivolt", "component": "membrane", "type": VariableType.EXTERNAL}, + {"name": "E_K", "units": "millivolt", "component": "potassium_channel", "type": VariableType.EXTERNAL} ] diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.c index c608b0c7f5..3193041ba2 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.c @@ -9,10 +9,10 @@ const char VERSION[] = "0.6.0"; const char LIBCELLML_VERSION[] = "0.5.0"; const size_t STATE_COUNT = 4; -const size_t CONSTANT_COUNT = 0; -const size_t COMPUTED_CONSTANT_COUNT = 0; -const size_t ALGEBRAIC_COUNT = 18; -const size_t EXTERNAL_COUNT = 0; +const size_t CONSTANT_COUNT = 3; +const size_t COMPUTED_CONSTANT_COUNT = 3; +const size_t ALGEBRAIC_COUNT = 10; +const size_t EXTERNAL_COUNT = 2; const VariableInfo VOI_INFO = {"time", "millisecond", "environment", VARIABLE_OF_INTEGRATION}; @@ -24,24 +24,24 @@ const VariableInfo STATE_INFO[] = { }; const VariableInfo VARIABLE_INFO[] = { + {"E_R", "millivolt", "membrane", CONSTANT}, + {"g_L", "milliS_per_cm2", "leakage_current", CONSTANT}, + {"g_K", "milliS_per_cm2", "potassium_channel", CONSTANT}, + {"E_L", "millivolt", "leakage_current", COMPUTED_CONSTANT}, + {"E_Na", "millivolt", "sodium_channel", COMPUTED_CONSTANT}, + {"E_K", "millivolt", "potassium_channel", COMPUTED_CONSTANT}, {"i_Stim", "microA_per_cm2", "membrane", ALGEBRAIC}, {"i_L", "microA_per_cm2", "leakage_current", ALGEBRAIC}, {"i_K", "microA_per_cm2", "potassium_channel", ALGEBRAIC}, {"i_Na", "microA_per_cm2", "sodium_channel", ALGEBRAIC}, - {"Cm", "microF_per_cm2", "membrane", EXTERNAL}, - {"E_R", "millivolt", "membrane", CONSTANT}, - {"E_L", "millivolt", "leakage_current", COMPUTED_CONSTANT}, - {"g_L", "milliS_per_cm2", "leakage_current", CONSTANT}, - {"E_Na", "millivolt", "sodium_channel", COMPUTED_CONSTANT}, - {"g_Na", "milliS_per_cm2", "sodium_channel", EXTERNAL}, {"alpha_m", "per_millisecond", "sodium_channel_m_gate", ALGEBRAIC}, {"beta_m", "per_millisecond", "sodium_channel_m_gate", ALGEBRAIC}, {"alpha_h", "per_millisecond", "sodium_channel_h_gate", ALGEBRAIC}, {"beta_h", "per_millisecond", "sodium_channel_h_gate", ALGEBRAIC}, - {"E_K", "millivolt", "potassium_channel", COMPUTED_CONSTANT}, - {"g_K", "milliS_per_cm2", "potassium_channel", CONSTANT}, {"alpha_n", "per_millisecond", "potassium_channel_n_gate", ALGEBRAIC}, - {"beta_n", "per_millisecond", "potassium_channel_n_gate", ALGEBRAIC} + {"beta_n", "per_millisecond", "potassium_channel_n_gate", ALGEBRAIC}, + {"Cm", "microF_per_cm2", "membrane", EXTERNAL}, + {"g_Na", "milliS_per_cm2", "sodium_channel", EXTERNAL} }; double * createStatesArray() diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.py index 81364cfcb3..49f7f8bcb6 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.py @@ -8,10 +8,10 @@ LIBCELLML_VERSION = "0.5.0" STATE_COUNT = 4 -CONSTANT_COUNT = 0 -COMPUTED_CONSTANT_COUNT = 0 -ALGEBRAIC_COUNT = 18 -EXTERNAL_COUNT = 0 +CONSTANT_COUNT = 3 +COMPUTED_CONSTANT_COUNT = 3 +ALGEBRAIC_COUNT = 10 +EXTERNAL_COUNT = 2 class VariableType(Enum): @@ -33,24 +33,24 @@ class VariableType(Enum): ] VARIABLE_INFO = [ + {"name": "E_R", "units": "millivolt", "component": "membrane", "type": VariableType.CONSTANT}, + {"name": "g_L", "units": "milliS_per_cm2", "component": "leakage_current", "type": VariableType.CONSTANT}, + {"name": "g_K", "units": "milliS_per_cm2", "component": "potassium_channel", "type": VariableType.CONSTANT}, + {"name": "E_L", "units": "millivolt", "component": "leakage_current", "type": VariableType.COMPUTED_CONSTANT}, + {"name": "E_Na", "units": "millivolt", "component": "sodium_channel", "type": VariableType.COMPUTED_CONSTANT}, + {"name": "E_K", "units": "millivolt", "component": "potassium_channel", "type": VariableType.COMPUTED_CONSTANT}, {"name": "i_Stim", "units": "microA_per_cm2", "component": "membrane", "type": VariableType.ALGEBRAIC}, {"name": "i_L", "units": "microA_per_cm2", "component": "leakage_current", "type": VariableType.ALGEBRAIC}, {"name": "i_K", "units": "microA_per_cm2", "component": "potassium_channel", "type": VariableType.ALGEBRAIC}, {"name": "i_Na", "units": "microA_per_cm2", "component": "sodium_channel", "type": VariableType.ALGEBRAIC}, - {"name": "Cm", "units": "microF_per_cm2", "component": "membrane", "type": VariableType.EXTERNAL}, - {"name": "E_R", "units": "millivolt", "component": "membrane", "type": VariableType.CONSTANT}, - {"name": "E_L", "units": "millivolt", "component": "leakage_current", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "g_L", "units": "milliS_per_cm2", "component": "leakage_current", "type": VariableType.CONSTANT}, - {"name": "E_Na", "units": "millivolt", "component": "sodium_channel", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "g_Na", "units": "milliS_per_cm2", "component": "sodium_channel", "type": VariableType.EXTERNAL}, {"name": "alpha_m", "units": "per_millisecond", "component": "sodium_channel_m_gate", "type": VariableType.ALGEBRAIC}, {"name": "beta_m", "units": "per_millisecond", "component": "sodium_channel_m_gate", "type": VariableType.ALGEBRAIC}, {"name": "alpha_h", "units": "per_millisecond", "component": "sodium_channel_h_gate", "type": VariableType.ALGEBRAIC}, {"name": "beta_h", "units": "per_millisecond", "component": "sodium_channel_h_gate", "type": VariableType.ALGEBRAIC}, - {"name": "E_K", "units": "millivolt", "component": "potassium_channel", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "g_K", "units": "milliS_per_cm2", "component": "potassium_channel", "type": VariableType.CONSTANT}, {"name": "alpha_n", "units": "per_millisecond", "component": "potassium_channel_n_gate", "type": VariableType.ALGEBRAIC}, - {"name": "beta_n", "units": "per_millisecond", "component": "potassium_channel_n_gate", "type": VariableType.ALGEBRAIC} + {"name": "beta_n", "units": "per_millisecond", "component": "potassium_channel_n_gate", "type": VariableType.ALGEBRAIC}, + {"name": "Cm", "units": "microF_per_cm2", "component": "membrane", "type": VariableType.EXTERNAL}, + {"name": "g_Na", "units": "milliS_per_cm2", "component": "sodium_channel", "type": VariableType.EXTERNAL} ] diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.c index 5627364ba8..a36578b7b9 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.c @@ -9,10 +9,10 @@ const char VERSION[] = "0.6.0"; const char LIBCELLML_VERSION[] = "0.5.0"; const size_t STATE_COUNT = 2; -const size_t CONSTANT_COUNT = 0; -const size_t COMPUTED_CONSTANT_COUNT = 0; -const size_t ALGEBRAIC_COUNT = 20; -const size_t EXTERNAL_COUNT = 0; +const size_t CONSTANT_COUNT = 5; +const size_t COMPUTED_CONSTANT_COUNT = 3; +const size_t ALGEBRAIC_COUNT = 10; +const size_t EXTERNAL_COUNT = 2; const VariableInfo VOI_INFO = {"time", "millisecond", "environment", VARIABLE_OF_INTEGRATION}; @@ -22,26 +22,26 @@ const VariableInfo STATE_INFO[] = { }; const VariableInfo VARIABLE_INFO[] = { - {"i_Stim", "microA_per_cm2", "membrane", ALGEBRAIC}, - {"V", "millivolt", "membrane", EXTERNAL}, - {"i_L", "microA_per_cm2", "leakage_current", ALGEBRAIC}, - {"i_K", "microA_per_cm2", "potassium_channel", ALGEBRAIC}, - {"i_Na", "microA_per_cm2", "sodium_channel", ALGEBRAIC}, {"Cm", "microF_per_cm2", "membrane", CONSTANT}, {"E_R", "millivolt", "membrane", CONSTANT}, - {"E_L", "millivolt", "leakage_current", COMPUTED_CONSTANT}, {"g_L", "milliS_per_cm2", "leakage_current", CONSTANT}, - {"E_Na", "millivolt", "sodium_channel", COMPUTED_CONSTANT}, {"g_Na", "milliS_per_cm2", "sodium_channel", CONSTANT}, - {"m", "dimensionless", "sodium_channel_m_gate", EXTERNAL}, + {"g_K", "milliS_per_cm2", "potassium_channel", CONSTANT}, + {"E_L", "millivolt", "leakage_current", COMPUTED_CONSTANT}, + {"E_Na", "millivolt", "sodium_channel", COMPUTED_CONSTANT}, + {"E_K", "millivolt", "potassium_channel", COMPUTED_CONSTANT}, + {"i_Stim", "microA_per_cm2", "membrane", ALGEBRAIC}, + {"i_L", "microA_per_cm2", "leakage_current", ALGEBRAIC}, + {"i_K", "microA_per_cm2", "potassium_channel", ALGEBRAIC}, + {"i_Na", "microA_per_cm2", "sodium_channel", ALGEBRAIC}, {"alpha_m", "per_millisecond", "sodium_channel_m_gate", ALGEBRAIC}, {"beta_m", "per_millisecond", "sodium_channel_m_gate", ALGEBRAIC}, {"alpha_h", "per_millisecond", "sodium_channel_h_gate", ALGEBRAIC}, {"beta_h", "per_millisecond", "sodium_channel_h_gate", ALGEBRAIC}, - {"E_K", "millivolt", "potassium_channel", COMPUTED_CONSTANT}, - {"g_K", "milliS_per_cm2", "potassium_channel", CONSTANT}, {"alpha_n", "per_millisecond", "potassium_channel_n_gate", ALGEBRAIC}, - {"beta_n", "per_millisecond", "potassium_channel_n_gate", ALGEBRAIC} + {"beta_n", "per_millisecond", "potassium_channel_n_gate", ALGEBRAIC}, + {"V", "millivolt", "membrane", EXTERNAL}, + {"m", "dimensionless", "sodium_channel_m_gate", EXTERNAL} }; double * createStatesArray() diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.py index d887340c1b..10b92a843f 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.py @@ -8,10 +8,10 @@ LIBCELLML_VERSION = "0.5.0" STATE_COUNT = 2 -CONSTANT_COUNT = 0 -COMPUTED_CONSTANT_COUNT = 0 -ALGEBRAIC_COUNT = 20 -EXTERNAL_COUNT = 0 +CONSTANT_COUNT = 5 +COMPUTED_CONSTANT_COUNT = 3 +ALGEBRAIC_COUNT = 10 +EXTERNAL_COUNT = 2 class VariableType(Enum): @@ -31,26 +31,26 @@ class VariableType(Enum): ] VARIABLE_INFO = [ - {"name": "i_Stim", "units": "microA_per_cm2", "component": "membrane", "type": VariableType.ALGEBRAIC}, - {"name": "V", "units": "millivolt", "component": "membrane", "type": VariableType.EXTERNAL}, - {"name": "i_L", "units": "microA_per_cm2", "component": "leakage_current", "type": VariableType.ALGEBRAIC}, - {"name": "i_K", "units": "microA_per_cm2", "component": "potassium_channel", "type": VariableType.ALGEBRAIC}, - {"name": "i_Na", "units": "microA_per_cm2", "component": "sodium_channel", "type": VariableType.ALGEBRAIC}, {"name": "Cm", "units": "microF_per_cm2", "component": "membrane", "type": VariableType.CONSTANT}, {"name": "E_R", "units": "millivolt", "component": "membrane", "type": VariableType.CONSTANT}, - {"name": "E_L", "units": "millivolt", "component": "leakage_current", "type": VariableType.COMPUTED_CONSTANT}, {"name": "g_L", "units": "milliS_per_cm2", "component": "leakage_current", "type": VariableType.CONSTANT}, - {"name": "E_Na", "units": "millivolt", "component": "sodium_channel", "type": VariableType.COMPUTED_CONSTANT}, {"name": "g_Na", "units": "milliS_per_cm2", "component": "sodium_channel", "type": VariableType.CONSTANT}, - {"name": "m", "units": "dimensionless", "component": "sodium_channel_m_gate", "type": VariableType.EXTERNAL}, + {"name": "g_K", "units": "milliS_per_cm2", "component": "potassium_channel", "type": VariableType.CONSTANT}, + {"name": "E_L", "units": "millivolt", "component": "leakage_current", "type": VariableType.COMPUTED_CONSTANT}, + {"name": "E_Na", "units": "millivolt", "component": "sodium_channel", "type": VariableType.COMPUTED_CONSTANT}, + {"name": "E_K", "units": "millivolt", "component": "potassium_channel", "type": VariableType.COMPUTED_CONSTANT}, + {"name": "i_Stim", "units": "microA_per_cm2", "component": "membrane", "type": VariableType.ALGEBRAIC}, + {"name": "i_L", "units": "microA_per_cm2", "component": "leakage_current", "type": VariableType.ALGEBRAIC}, + {"name": "i_K", "units": "microA_per_cm2", "component": "potassium_channel", "type": VariableType.ALGEBRAIC}, + {"name": "i_Na", "units": "microA_per_cm2", "component": "sodium_channel", "type": VariableType.ALGEBRAIC}, {"name": "alpha_m", "units": "per_millisecond", "component": "sodium_channel_m_gate", "type": VariableType.ALGEBRAIC}, {"name": "beta_m", "units": "per_millisecond", "component": "sodium_channel_m_gate", "type": VariableType.ALGEBRAIC}, {"name": "alpha_h", "units": "per_millisecond", "component": "sodium_channel_h_gate", "type": VariableType.ALGEBRAIC}, {"name": "beta_h", "units": "per_millisecond", "component": "sodium_channel_h_gate", "type": VariableType.ALGEBRAIC}, - {"name": "E_K", "units": "millivolt", "component": "potassium_channel", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "g_K", "units": "milliS_per_cm2", "component": "potassium_channel", "type": VariableType.CONSTANT}, {"name": "alpha_n", "units": "per_millisecond", "component": "potassium_channel_n_gate", "type": VariableType.ALGEBRAIC}, - {"name": "beta_n", "units": "per_millisecond", "component": "potassium_channel_n_gate", "type": VariableType.ALGEBRAIC} + {"name": "beta_n", "units": "per_millisecond", "component": "potassium_channel_n_gate", "type": VariableType.ALGEBRAIC}, + {"name": "V", "units": "millivolt", "component": "membrane", "type": VariableType.EXTERNAL}, + {"name": "m", "units": "dimensionless", "component": "sodium_channel_m_gate", "type": VariableType.EXTERNAL} ] diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.c index 329a24f94a..3cb02dcd1c 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.c @@ -9,10 +9,10 @@ const char VERSION[] = "0.6.0"; const char LIBCELLML_VERSION[] = "0.5.0"; const size_t STATE_COUNT = 3; -const size_t CONSTANT_COUNT = 0; -const size_t COMPUTED_CONSTANT_COUNT = 0; -const size_t ALGEBRAIC_COUNT = 19; -const size_t EXTERNAL_COUNT = 0; +const size_t CONSTANT_COUNT = 5; +const size_t COMPUTED_CONSTANT_COUNT = 3; +const size_t ALGEBRAIC_COUNT = 8; +const size_t EXTERNAL_COUNT = 3; const VariableInfo VOI_INFO = {"time", "millisecond", "environment", VARIABLE_OF_INTEGRATION}; @@ -23,25 +23,25 @@ const VariableInfo STATE_INFO[] = { }; const VariableInfo VARIABLE_INFO[] = { - {"i_Stim", "microA_per_cm2", "membrane", ALGEBRAIC}, - {"V", "millivolt", "membrane", EXTERNAL}, - {"i_L", "microA_per_cm2", "leakage_current", ALGEBRAIC}, - {"i_K", "microA_per_cm2", "potassium_channel", ALGEBRAIC}, - {"i_Na", "microA_per_cm2", "sodium_channel", EXTERNAL}, {"Cm", "microF_per_cm2", "membrane", CONSTANT}, {"E_R", "millivolt", "membrane", CONSTANT}, - {"E_L", "millivolt", "leakage_current", COMPUTED_CONSTANT}, {"g_L", "milliS_per_cm2", "leakage_current", CONSTANT}, - {"E_Na", "millivolt", "sodium_channel", COMPUTED_CONSTANT}, {"g_Na", "milliS_per_cm2", "sodium_channel", CONSTANT}, + {"g_K", "milliS_per_cm2", "potassium_channel", CONSTANT}, + {"E_L", "millivolt", "leakage_current", COMPUTED_CONSTANT}, + {"E_Na", "millivolt", "sodium_channel", COMPUTED_CONSTANT}, + {"E_K", "millivolt", "potassium_channel", COMPUTED_CONSTANT}, + {"i_Stim", "microA_per_cm2", "membrane", ALGEBRAIC}, + {"i_L", "microA_per_cm2", "leakage_current", ALGEBRAIC}, + {"i_K", "microA_per_cm2", "potassium_channel", ALGEBRAIC}, {"alpha_m", "per_millisecond", "sodium_channel_m_gate", ALGEBRAIC}, {"beta_m", "per_millisecond", "sodium_channel_m_gate", ALGEBRAIC}, {"alpha_h", "per_millisecond", "sodium_channel_h_gate", ALGEBRAIC}, {"beta_h", "per_millisecond", "sodium_channel_h_gate", ALGEBRAIC}, - {"E_K", "millivolt", "potassium_channel", COMPUTED_CONSTANT}, - {"g_K", "milliS_per_cm2", "potassium_channel", CONSTANT}, - {"alpha_n", "per_millisecond", "potassium_channel_n_gate", EXTERNAL}, - {"beta_n", "per_millisecond", "potassium_channel_n_gate", ALGEBRAIC} + {"beta_n", "per_millisecond", "potassium_channel_n_gate", ALGEBRAIC}, + {"V", "millivolt", "membrane", EXTERNAL}, + {"i_Na", "microA_per_cm2", "sodium_channel", EXTERNAL}, + {"alpha_n", "per_millisecond", "potassium_channel_n_gate", EXTERNAL} }; double * createStatesArray() diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.py index 019a0c8577..1f15be90f4 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.py @@ -8,10 +8,10 @@ LIBCELLML_VERSION = "0.5.0" STATE_COUNT = 3 -CONSTANT_COUNT = 0 -COMPUTED_CONSTANT_COUNT = 0 -ALGEBRAIC_COUNT = 19 -EXTERNAL_COUNT = 0 +CONSTANT_COUNT = 5 +COMPUTED_CONSTANT_COUNT = 3 +ALGEBRAIC_COUNT = 8 +EXTERNAL_COUNT = 3 class VariableType(Enum): @@ -32,25 +32,25 @@ class VariableType(Enum): ] VARIABLE_INFO = [ - {"name": "i_Stim", "units": "microA_per_cm2", "component": "membrane", "type": VariableType.ALGEBRAIC}, - {"name": "V", "units": "millivolt", "component": "membrane", "type": VariableType.EXTERNAL}, - {"name": "i_L", "units": "microA_per_cm2", "component": "leakage_current", "type": VariableType.ALGEBRAIC}, - {"name": "i_K", "units": "microA_per_cm2", "component": "potassium_channel", "type": VariableType.ALGEBRAIC}, - {"name": "i_Na", "units": "microA_per_cm2", "component": "sodium_channel", "type": VariableType.EXTERNAL}, {"name": "Cm", "units": "microF_per_cm2", "component": "membrane", "type": VariableType.CONSTANT}, {"name": "E_R", "units": "millivolt", "component": "membrane", "type": VariableType.CONSTANT}, - {"name": "E_L", "units": "millivolt", "component": "leakage_current", "type": VariableType.COMPUTED_CONSTANT}, {"name": "g_L", "units": "milliS_per_cm2", "component": "leakage_current", "type": VariableType.CONSTANT}, - {"name": "E_Na", "units": "millivolt", "component": "sodium_channel", "type": VariableType.COMPUTED_CONSTANT}, {"name": "g_Na", "units": "milliS_per_cm2", "component": "sodium_channel", "type": VariableType.CONSTANT}, + {"name": "g_K", "units": "milliS_per_cm2", "component": "potassium_channel", "type": VariableType.CONSTANT}, + {"name": "E_L", "units": "millivolt", "component": "leakage_current", "type": VariableType.COMPUTED_CONSTANT}, + {"name": "E_Na", "units": "millivolt", "component": "sodium_channel", "type": VariableType.COMPUTED_CONSTANT}, + {"name": "E_K", "units": "millivolt", "component": "potassium_channel", "type": VariableType.COMPUTED_CONSTANT}, + {"name": "i_Stim", "units": "microA_per_cm2", "component": "membrane", "type": VariableType.ALGEBRAIC}, + {"name": "i_L", "units": "microA_per_cm2", "component": "leakage_current", "type": VariableType.ALGEBRAIC}, + {"name": "i_K", "units": "microA_per_cm2", "component": "potassium_channel", "type": VariableType.ALGEBRAIC}, {"name": "alpha_m", "units": "per_millisecond", "component": "sodium_channel_m_gate", "type": VariableType.ALGEBRAIC}, {"name": "beta_m", "units": "per_millisecond", "component": "sodium_channel_m_gate", "type": VariableType.ALGEBRAIC}, {"name": "alpha_h", "units": "per_millisecond", "component": "sodium_channel_h_gate", "type": VariableType.ALGEBRAIC}, {"name": "beta_h", "units": "per_millisecond", "component": "sodium_channel_h_gate", "type": VariableType.ALGEBRAIC}, - {"name": "E_K", "units": "millivolt", "component": "potassium_channel", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "g_K", "units": "milliS_per_cm2", "component": "potassium_channel", "type": VariableType.CONSTANT}, - {"name": "alpha_n", "units": "per_millisecond", "component": "potassium_channel_n_gate", "type": VariableType.EXTERNAL}, - {"name": "beta_n", "units": "per_millisecond", "component": "potassium_channel_n_gate", "type": VariableType.ALGEBRAIC} + {"name": "beta_n", "units": "per_millisecond", "component": "potassium_channel_n_gate", "type": VariableType.ALGEBRAIC}, + {"name": "V", "units": "millivolt", "component": "membrane", "type": VariableType.EXTERNAL}, + {"name": "i_Na", "units": "microA_per_cm2", "component": "sodium_channel", "type": VariableType.EXTERNAL}, + {"name": "alpha_n", "units": "per_millisecond", "component": "potassium_channel_n_gate", "type": VariableType.EXTERNAL} ] diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.h index be76c88f61..2379ada7dc 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.h +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.h @@ -11,7 +11,6 @@ extern const size_t STATE_COUNT; extern const size_t CONSTANT_COUNT; extern const size_t COMPUTED_CONSTANT_COUNT; extern const size_t ALGEBRAIC_COUNT; -extern const size_t EXTERNAL_COUNT; typedef enum { VARIABLE_OF_INTEGRATION, diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.py index b37f2884e9..de38477e32 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.py @@ -8,10 +8,9 @@ LIBCELLML_VERSION = "0.5.0" STATE_COUNT = 4 -CONSTANT_COUNT = 0 -COMPUTED_CONSTANT_COUNT = 0 -ALGEBRAIC_COUNT = 18 -EXTERNAL_COUNT = 0 +CONSTANT_COUNT = 5 +COMPUTED_CONSTANT_COUNT = 3 +ALGEBRAIC_COUNT = 10 class VariableType(Enum): @@ -32,22 +31,22 @@ class VariableType(Enum): ] VARIABLE_INFO = [ - {"name": "i_Stim", "units": "microA_per_cm2", "component": "membrane", "type": VariableType.ALGEBRAIC}, - {"name": "i_L", "units": "microA_per_cm2", "component": "leakage_current", "type": VariableType.ALGEBRAIC}, - {"name": "i_K", "units": "microA_per_cm2", "component": "potassium_channel", "type": VariableType.ALGEBRAIC}, - {"name": "i_Na", "units": "microA_per_cm2", "component": "sodium_channel", "type": VariableType.ALGEBRAIC}, {"name": "Cm", "units": "microF_per_cm2", "component": "membrane", "type": VariableType.CONSTANT}, {"name": "E_R", "units": "millivolt", "component": "membrane", "type": VariableType.CONSTANT}, - {"name": "E_L", "units": "millivolt", "component": "leakage_current", "type": VariableType.COMPUTED_CONSTANT}, {"name": "g_L", "units": "milliS_per_cm2", "component": "leakage_current", "type": VariableType.CONSTANT}, - {"name": "E_Na", "units": "millivolt", "component": "sodium_channel", "type": VariableType.COMPUTED_CONSTANT}, {"name": "g_Na", "units": "milliS_per_cm2", "component": "sodium_channel", "type": VariableType.CONSTANT}, + {"name": "g_K", "units": "milliS_per_cm2", "component": "potassium_channel", "type": VariableType.CONSTANT}, + {"name": "E_L", "units": "millivolt", "component": "leakage_current", "type": VariableType.COMPUTED_CONSTANT}, + {"name": "E_Na", "units": "millivolt", "component": "sodium_channel", "type": VariableType.COMPUTED_CONSTANT}, + {"name": "E_K", "units": "millivolt", "component": "potassium_channel", "type": VariableType.COMPUTED_CONSTANT}, + {"name": "i_Stim", "units": "microA_per_cm2", "component": "membrane", "type": VariableType.ALGEBRAIC}, + {"name": "i_L", "units": "microA_per_cm2", "component": "leakage_current", "type": VariableType.ALGEBRAIC}, + {"name": "i_K", "units": "microA_per_cm2", "component": "potassium_channel", "type": VariableType.ALGEBRAIC}, + {"name": "i_Na", "units": "microA_per_cm2", "component": "sodium_channel", "type": VariableType.ALGEBRAIC}, {"name": "alpha_m", "units": "per_millisecond", "component": "sodium_channel_m_gate", "type": VariableType.ALGEBRAIC}, {"name": "beta_m", "units": "per_millisecond", "component": "sodium_channel_m_gate", "type": VariableType.ALGEBRAIC}, {"name": "alpha_h", "units": "per_millisecond", "component": "sodium_channel_h_gate", "type": VariableType.ALGEBRAIC}, {"name": "beta_h", "units": "per_millisecond", "component": "sodium_channel_h_gate", "type": VariableType.ALGEBRAIC}, - {"name": "E_K", "units": "millivolt", "component": "potassium_channel", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "g_K", "units": "milliS_per_cm2", "component": "potassium_channel", "type": VariableType.CONSTANT}, {"name": "alpha_n", "units": "per_millisecond", "component": "potassium_channel_n_gate", "type": VariableType.ALGEBRAIC}, {"name": "beta_n", "units": "per_millisecond", "component": "potassium_channel_n_gate", "type": VariableType.ALGEBRAIC} ] diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.c index 1f5098cc59..a1ec41db71 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.c @@ -9,10 +9,10 @@ const char VERSION[] = "0.6.0"; const char LIBCELLML_VERSION[] = "0.5.0"; const size_t STATE_COUNT = 3; -const size_t CONSTANT_COUNT = 0; -const size_t COMPUTED_CONSTANT_COUNT = 0; -const size_t ALGEBRAIC_COUNT = 19; -const size_t EXTERNAL_COUNT = 0; +const size_t CONSTANT_COUNT = 5; +const size_t COMPUTED_CONSTANT_COUNT = 3; +const size_t ALGEBRAIC_COUNT = 10; +const size_t EXTERNAL_COUNT = 1; const VariableInfo VOI_INFO = {"time", "millisecond", "environment", VARIABLE_OF_INTEGRATION}; @@ -23,25 +23,25 @@ const VariableInfo STATE_INFO[] = { }; const VariableInfo VARIABLE_INFO[] = { - {"i_Stim", "microA_per_cm2", "membrane", ALGEBRAIC}, - {"i_L", "microA_per_cm2", "leakage_current", ALGEBRAIC}, - {"i_K", "microA_per_cm2", "potassium_channel", ALGEBRAIC}, - {"i_Na", "microA_per_cm2", "sodium_channel", ALGEBRAIC}, {"Cm", "microF_per_cm2", "membrane", CONSTANT}, {"E_R", "millivolt", "membrane", CONSTANT}, - {"E_L", "millivolt", "leakage_current", COMPUTED_CONSTANT}, {"g_L", "milliS_per_cm2", "leakage_current", CONSTANT}, - {"E_Na", "millivolt", "sodium_channel", COMPUTED_CONSTANT}, {"g_Na", "milliS_per_cm2", "sodium_channel", CONSTANT}, - {"m", "dimensionless", "sodium_channel_m_gate", EXTERNAL}, + {"g_K", "milliS_per_cm2", "potassium_channel", CONSTANT}, + {"E_L", "millivolt", "leakage_current", COMPUTED_CONSTANT}, + {"E_Na", "millivolt", "sodium_channel", COMPUTED_CONSTANT}, + {"E_K", "millivolt", "potassium_channel", COMPUTED_CONSTANT}, + {"i_Stim", "microA_per_cm2", "membrane", ALGEBRAIC}, + {"i_L", "microA_per_cm2", "leakage_current", ALGEBRAIC}, + {"i_K", "microA_per_cm2", "potassium_channel", ALGEBRAIC}, + {"i_Na", "microA_per_cm2", "sodium_channel", ALGEBRAIC}, {"alpha_m", "per_millisecond", "sodium_channel_m_gate", ALGEBRAIC}, {"beta_m", "per_millisecond", "sodium_channel_m_gate", ALGEBRAIC}, {"alpha_h", "per_millisecond", "sodium_channel_h_gate", ALGEBRAIC}, {"beta_h", "per_millisecond", "sodium_channel_h_gate", ALGEBRAIC}, - {"E_K", "millivolt", "potassium_channel", COMPUTED_CONSTANT}, - {"g_K", "milliS_per_cm2", "potassium_channel", CONSTANT}, {"alpha_n", "per_millisecond", "potassium_channel_n_gate", ALGEBRAIC}, - {"beta_n", "per_millisecond", "potassium_channel_n_gate", ALGEBRAIC} + {"beta_n", "per_millisecond", "potassium_channel_n_gate", ALGEBRAIC}, + {"m", "dimensionless", "sodium_channel_m_gate", EXTERNAL} }; double * createStatesArray() diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.py index b68a159ffe..2ed93ed11c 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.py @@ -8,10 +8,10 @@ LIBCELLML_VERSION = "0.5.0" STATE_COUNT = 3 -CONSTANT_COUNT = 0 -COMPUTED_CONSTANT_COUNT = 0 -ALGEBRAIC_COUNT = 19 -EXTERNAL_COUNT = 0 +CONSTANT_COUNT = 5 +COMPUTED_CONSTANT_COUNT = 3 +ALGEBRAIC_COUNT = 10 +EXTERNAL_COUNT = 1 class VariableType(Enum): @@ -32,25 +32,25 @@ class VariableType(Enum): ] VARIABLE_INFO = [ - {"name": "i_Stim", "units": "microA_per_cm2", "component": "membrane", "type": VariableType.ALGEBRAIC}, - {"name": "i_L", "units": "microA_per_cm2", "component": "leakage_current", "type": VariableType.ALGEBRAIC}, - {"name": "i_K", "units": "microA_per_cm2", "component": "potassium_channel", "type": VariableType.ALGEBRAIC}, - {"name": "i_Na", "units": "microA_per_cm2", "component": "sodium_channel", "type": VariableType.ALGEBRAIC}, {"name": "Cm", "units": "microF_per_cm2", "component": "membrane", "type": VariableType.CONSTANT}, {"name": "E_R", "units": "millivolt", "component": "membrane", "type": VariableType.CONSTANT}, - {"name": "E_L", "units": "millivolt", "component": "leakage_current", "type": VariableType.COMPUTED_CONSTANT}, {"name": "g_L", "units": "milliS_per_cm2", "component": "leakage_current", "type": VariableType.CONSTANT}, - {"name": "E_Na", "units": "millivolt", "component": "sodium_channel", "type": VariableType.COMPUTED_CONSTANT}, {"name": "g_Na", "units": "milliS_per_cm2", "component": "sodium_channel", "type": VariableType.CONSTANT}, - {"name": "m", "units": "dimensionless", "component": "sodium_channel_m_gate", "type": VariableType.EXTERNAL}, + {"name": "g_K", "units": "milliS_per_cm2", "component": "potassium_channel", "type": VariableType.CONSTANT}, + {"name": "E_L", "units": "millivolt", "component": "leakage_current", "type": VariableType.COMPUTED_CONSTANT}, + {"name": "E_Na", "units": "millivolt", "component": "sodium_channel", "type": VariableType.COMPUTED_CONSTANT}, + {"name": "E_K", "units": "millivolt", "component": "potassium_channel", "type": VariableType.COMPUTED_CONSTANT}, + {"name": "i_Stim", "units": "microA_per_cm2", "component": "membrane", "type": VariableType.ALGEBRAIC}, + {"name": "i_L", "units": "microA_per_cm2", "component": "leakage_current", "type": VariableType.ALGEBRAIC}, + {"name": "i_K", "units": "microA_per_cm2", "component": "potassium_channel", "type": VariableType.ALGEBRAIC}, + {"name": "i_Na", "units": "microA_per_cm2", "component": "sodium_channel", "type": VariableType.ALGEBRAIC}, {"name": "alpha_m", "units": "per_millisecond", "component": "sodium_channel_m_gate", "type": VariableType.ALGEBRAIC}, {"name": "beta_m", "units": "per_millisecond", "component": "sodium_channel_m_gate", "type": VariableType.ALGEBRAIC}, {"name": "alpha_h", "units": "per_millisecond", "component": "sodium_channel_h_gate", "type": VariableType.ALGEBRAIC}, {"name": "beta_h", "units": "per_millisecond", "component": "sodium_channel_h_gate", "type": VariableType.ALGEBRAIC}, - {"name": "E_K", "units": "millivolt", "component": "potassium_channel", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "g_K", "units": "milliS_per_cm2", "component": "potassium_channel", "type": VariableType.CONSTANT}, {"name": "alpha_n", "units": "per_millisecond", "component": "potassium_channel_n_gate", "type": VariableType.ALGEBRAIC}, - {"name": "beta_n", "units": "per_millisecond", "component": "potassium_channel_n_gate", "type": VariableType.ALGEBRAIC} + {"name": "beta_n", "units": "per_millisecond", "component": "potassium_channel_n_gate", "type": VariableType.ALGEBRAIC}, + {"name": "m", "units": "dimensionless", "component": "sodium_channel_m_gate", "type": VariableType.EXTERNAL} ] diff --git a/tests/resources/generator/noble_model_1962/model.c b/tests/resources/generator/noble_model_1962/model.c index b2b3956e7f..01b9013b68 100644 --- a/tests/resources/generator/noble_model_1962/model.c +++ b/tests/resources/generator/noble_model_1962/model.c @@ -9,10 +9,9 @@ const char VERSION[] = "0.6.0"; const char LIBCELLML_VERSION[] = "0.5.0"; const size_t STATE_COUNT = 4; -const size_t CONSTANT_COUNT = 0; +const size_t CONSTANT_COUNT = 5; const size_t COMPUTED_CONSTANT_COUNT = 0; -const size_t ALGEBRAIC_COUNT = 17; -const size_t EXTERNAL_COUNT = 0; +const size_t ALGEBRAIC_COUNT = 12; const VariableInfo VOI_INFO = {"time", "millisecond", "environment", VARIABLE_OF_INTEGRATION}; @@ -24,15 +23,15 @@ const VariableInfo STATE_INFO[] = { }; const VariableInfo VARIABLE_INFO[] = { - {"i_Na", "microA_per_cm2", "sodium_channel", ALGEBRAIC}, - {"i_Leak", "microA_per_cm2", "leakage_current", ALGEBRAIC}, - {"i_K", "microA_per_cm2", "potassium_channel", ALGEBRAIC}, {"Cm", "microF_per_cm2", "membrane", CONSTANT}, {"g_L", "milliS_per_cm2", "leakage_current", CONSTANT}, {"E_L", "millivolt", "leakage_current", CONSTANT}, - {"g_Na", "milliS_per_cm2", "sodium_channel", ALGEBRAIC}, {"g_Na_max", "milliS_per_cm2", "sodium_channel", CONSTANT}, {"E_Na", "millivolt", "sodium_channel", CONSTANT}, + {"i_Na", "microA_per_cm2", "sodium_channel", ALGEBRAIC}, + {"i_Leak", "microA_per_cm2", "leakage_current", ALGEBRAIC}, + {"i_K", "microA_per_cm2", "potassium_channel", ALGEBRAIC}, + {"g_Na", "milliS_per_cm2", "sodium_channel", ALGEBRAIC}, {"alpha_m", "per_millisecond", "sodium_channel_m_gate", ALGEBRAIC}, {"beta_m", "per_millisecond", "sodium_channel_m_gate", ALGEBRAIC}, {"alpha_h", "per_millisecond", "sodium_channel_h_gate", ALGEBRAIC}, diff --git a/tests/resources/generator/noble_model_1962/model.h b/tests/resources/generator/noble_model_1962/model.h index 8149205d0d..a4c365da25 100644 --- a/tests/resources/generator/noble_model_1962/model.h +++ b/tests/resources/generator/noble_model_1962/model.h @@ -11,7 +11,6 @@ extern const size_t STATE_COUNT; extern const size_t CONSTANT_COUNT; extern const size_t COMPUTED_CONSTANT_COUNT; extern const size_t ALGEBRAIC_COUNT; -extern const size_t EXTERNAL_COUNT; typedef enum { VARIABLE_OF_INTEGRATION, diff --git a/tests/resources/generator/noble_model_1962/model.py b/tests/resources/generator/noble_model_1962/model.py index 8fb96500a0..4eb81b090f 100644 --- a/tests/resources/generator/noble_model_1962/model.py +++ b/tests/resources/generator/noble_model_1962/model.py @@ -8,10 +8,9 @@ LIBCELLML_VERSION = "0.5.0" STATE_COUNT = 4 -CONSTANT_COUNT = 0 +CONSTANT_COUNT = 5 COMPUTED_CONSTANT_COUNT = 0 -ALGEBRAIC_COUNT = 17 -EXTERNAL_COUNT = 0 +ALGEBRAIC_COUNT = 12 class VariableType(Enum): @@ -32,15 +31,15 @@ class VariableType(Enum): ] VARIABLE_INFO = [ - {"name": "i_Na", "units": "microA_per_cm2", "component": "sodium_channel", "type": VariableType.ALGEBRAIC}, - {"name": "i_Leak", "units": "microA_per_cm2", "component": "leakage_current", "type": VariableType.ALGEBRAIC}, - {"name": "i_K", "units": "microA_per_cm2", "component": "potassium_channel", "type": VariableType.ALGEBRAIC}, {"name": "Cm", "units": "microF_per_cm2", "component": "membrane", "type": VariableType.CONSTANT}, {"name": "g_L", "units": "milliS_per_cm2", "component": "leakage_current", "type": VariableType.CONSTANT}, {"name": "E_L", "units": "millivolt", "component": "leakage_current", "type": VariableType.CONSTANT}, - {"name": "g_Na", "units": "milliS_per_cm2", "component": "sodium_channel", "type": VariableType.ALGEBRAIC}, {"name": "g_Na_max", "units": "milliS_per_cm2", "component": "sodium_channel", "type": VariableType.CONSTANT}, {"name": "E_Na", "units": "millivolt", "component": "sodium_channel", "type": VariableType.CONSTANT}, + {"name": "i_Na", "units": "microA_per_cm2", "component": "sodium_channel", "type": VariableType.ALGEBRAIC}, + {"name": "i_Leak", "units": "microA_per_cm2", "component": "leakage_current", "type": VariableType.ALGEBRAIC}, + {"name": "i_K", "units": "microA_per_cm2", "component": "potassium_channel", "type": VariableType.ALGEBRAIC}, + {"name": "g_Na", "units": "milliS_per_cm2", "component": "sodium_channel", "type": VariableType.ALGEBRAIC}, {"name": "alpha_m", "units": "per_millisecond", "component": "sodium_channel_m_gate", "type": VariableType.ALGEBRAIC}, {"name": "beta_m", "units": "per_millisecond", "component": "sodium_channel_m_gate", "type": VariableType.ALGEBRAIC}, {"name": "alpha_h", "units": "per_millisecond", "component": "sodium_channel_h_gate", "type": VariableType.ALGEBRAIC}, diff --git a/tests/resources/generator/ode_computed_var_on_rhs/model.c b/tests/resources/generator/ode_computed_var_on_rhs/model.c index 4e94793685..1eadd46729 100644 --- a/tests/resources/generator/ode_computed_var_on_rhs/model.c +++ b/tests/resources/generator/ode_computed_var_on_rhs/model.c @@ -10,9 +10,8 @@ const char LIBCELLML_VERSION[] = "0.5.0"; const size_t STATE_COUNT = 1; const size_t CONSTANT_COUNT = 0; -const size_t COMPUTED_CONSTANT_COUNT = 0; -const size_t ALGEBRAIC_COUNT = 1; -const size_t EXTERNAL_COUNT = 0; +const size_t COMPUTED_CONSTANT_COUNT = 1; +const size_t ALGEBRAIC_COUNT = 0; const VariableInfo VOI_INFO = {"t", "second", "environment", VARIABLE_OF_INTEGRATION}; diff --git a/tests/resources/generator/ode_computed_var_on_rhs/model.h b/tests/resources/generator/ode_computed_var_on_rhs/model.h index cc72c5b3a4..3f1fb63fd2 100644 --- a/tests/resources/generator/ode_computed_var_on_rhs/model.h +++ b/tests/resources/generator/ode_computed_var_on_rhs/model.h @@ -11,7 +11,6 @@ extern const size_t STATE_COUNT; extern const size_t CONSTANT_COUNT; extern const size_t COMPUTED_CONSTANT_COUNT; extern const size_t ALGEBRAIC_COUNT; -extern const size_t EXTERNAL_COUNT; typedef enum { VARIABLE_OF_INTEGRATION, diff --git a/tests/resources/generator/ode_computed_var_on_rhs/model.py b/tests/resources/generator/ode_computed_var_on_rhs/model.py index 4c7b0bfdfa..6de2a7b40a 100644 --- a/tests/resources/generator/ode_computed_var_on_rhs/model.py +++ b/tests/resources/generator/ode_computed_var_on_rhs/model.py @@ -9,9 +9,8 @@ STATE_COUNT = 1 CONSTANT_COUNT = 0 -COMPUTED_CONSTANT_COUNT = 0 -ALGEBRAIC_COUNT = 1 -EXTERNAL_COUNT = 0 +COMPUTED_CONSTANT_COUNT = 1 +ALGEBRAIC_COUNT = 0 class VariableType(Enum): diff --git a/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.c b/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.c index 9462cd1ded..35629691c5 100644 --- a/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.c +++ b/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.c @@ -10,9 +10,8 @@ const char LIBCELLML_VERSION[] = "0.5.0"; const size_t STATE_COUNT = 1; const size_t CONSTANT_COUNT = 0; -const size_t COMPUTED_CONSTANT_COUNT = 0; -const size_t ALGEBRAIC_COUNT = 1; -const size_t EXTERNAL_COUNT = 0; +const size_t COMPUTED_CONSTANT_COUNT = 1; +const size_t ALGEBRAIC_COUNT = 0; const VariableInfo VOI_INFO = {"t", "second", "my_component", VARIABLE_OF_INTEGRATION}; diff --git a/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.h b/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.h index 89890cfa68..ca79cc5f25 100644 --- a/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.h +++ b/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.h @@ -11,7 +11,6 @@ extern const size_t STATE_COUNT; extern const size_t CONSTANT_COUNT; extern const size_t COMPUTED_CONSTANT_COUNT; extern const size_t ALGEBRAIC_COUNT; -extern const size_t EXTERNAL_COUNT; typedef enum { VARIABLE_OF_INTEGRATION, diff --git a/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.py b/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.py index ff803cc8f1..48b38de074 100644 --- a/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.py +++ b/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.py @@ -9,9 +9,8 @@ STATE_COUNT = 1 CONSTANT_COUNT = 0 -COMPUTED_CONSTANT_COUNT = 0 -ALGEBRAIC_COUNT = 1 -EXTERNAL_COUNT = 0 +COMPUTED_CONSTANT_COUNT = 1 +ALGEBRAIC_COUNT = 0 class VariableType(Enum): diff --git a/tests/resources/generator/ode_const_var_on_rhs/model.c b/tests/resources/generator/ode_const_var_on_rhs/model.c index 6c6342e787..7324a50b7b 100644 --- a/tests/resources/generator/ode_const_var_on_rhs/model.c +++ b/tests/resources/generator/ode_const_var_on_rhs/model.c @@ -9,10 +9,9 @@ const char VERSION[] = "0.6.0"; const char LIBCELLML_VERSION[] = "0.5.0"; const size_t STATE_COUNT = 1; -const size_t CONSTANT_COUNT = 0; +const size_t CONSTANT_COUNT = 1; const size_t COMPUTED_CONSTANT_COUNT = 0; -const size_t ALGEBRAIC_COUNT = 1; -const size_t EXTERNAL_COUNT = 0; +const size_t ALGEBRAIC_COUNT = 0; const VariableInfo VOI_INFO = {"t", "second", "environment", VARIABLE_OF_INTEGRATION}; diff --git a/tests/resources/generator/ode_const_var_on_rhs/model.h b/tests/resources/generator/ode_const_var_on_rhs/model.h index cc72c5b3a4..3f1fb63fd2 100644 --- a/tests/resources/generator/ode_const_var_on_rhs/model.h +++ b/tests/resources/generator/ode_const_var_on_rhs/model.h @@ -11,7 +11,6 @@ extern const size_t STATE_COUNT; extern const size_t CONSTANT_COUNT; extern const size_t COMPUTED_CONSTANT_COUNT; extern const size_t ALGEBRAIC_COUNT; -extern const size_t EXTERNAL_COUNT; typedef enum { VARIABLE_OF_INTEGRATION, diff --git a/tests/resources/generator/ode_const_var_on_rhs/model.py b/tests/resources/generator/ode_const_var_on_rhs/model.py index 283bdd003b..913f34ea27 100644 --- a/tests/resources/generator/ode_const_var_on_rhs/model.py +++ b/tests/resources/generator/ode_const_var_on_rhs/model.py @@ -8,10 +8,9 @@ LIBCELLML_VERSION = "0.5.0" STATE_COUNT = 1 -CONSTANT_COUNT = 0 +CONSTANT_COUNT = 1 COMPUTED_CONSTANT_COUNT = 0 -ALGEBRAIC_COUNT = 1 -EXTERNAL_COUNT = 0 +ALGEBRAIC_COUNT = 0 class VariableType(Enum): diff --git a/tests/resources/generator/ode_const_var_on_rhs_one_component/model.c b/tests/resources/generator/ode_const_var_on_rhs_one_component/model.c index 0b0fb3bb34..2e3fe1c553 100644 --- a/tests/resources/generator/ode_const_var_on_rhs_one_component/model.c +++ b/tests/resources/generator/ode_const_var_on_rhs_one_component/model.c @@ -9,10 +9,9 @@ const char VERSION[] = "0.6.0"; const char LIBCELLML_VERSION[] = "0.5.0"; const size_t STATE_COUNT = 1; -const size_t CONSTANT_COUNT = 0; +const size_t CONSTANT_COUNT = 1; const size_t COMPUTED_CONSTANT_COUNT = 0; -const size_t ALGEBRAIC_COUNT = 1; -const size_t EXTERNAL_COUNT = 0; +const size_t ALGEBRAIC_COUNT = 0; const VariableInfo VOI_INFO = {"t", "second", "my_component", VARIABLE_OF_INTEGRATION}; diff --git a/tests/resources/generator/ode_const_var_on_rhs_one_component/model.h b/tests/resources/generator/ode_const_var_on_rhs_one_component/model.h index 89890cfa68..ca79cc5f25 100644 --- a/tests/resources/generator/ode_const_var_on_rhs_one_component/model.h +++ b/tests/resources/generator/ode_const_var_on_rhs_one_component/model.h @@ -11,7 +11,6 @@ extern const size_t STATE_COUNT; extern const size_t CONSTANT_COUNT; extern const size_t COMPUTED_CONSTANT_COUNT; extern const size_t ALGEBRAIC_COUNT; -extern const size_t EXTERNAL_COUNT; typedef enum { VARIABLE_OF_INTEGRATION, diff --git a/tests/resources/generator/ode_const_var_on_rhs_one_component/model.py b/tests/resources/generator/ode_const_var_on_rhs_one_component/model.py index 986a9feb16..65e03adfd4 100644 --- a/tests/resources/generator/ode_const_var_on_rhs_one_component/model.py +++ b/tests/resources/generator/ode_const_var_on_rhs_one_component/model.py @@ -8,10 +8,9 @@ LIBCELLML_VERSION = "0.5.0" STATE_COUNT = 1 -CONSTANT_COUNT = 0 +CONSTANT_COUNT = 1 COMPUTED_CONSTANT_COUNT = 0 -ALGEBRAIC_COUNT = 1 -EXTERNAL_COUNT = 0 +ALGEBRAIC_COUNT = 0 class VariableType(Enum): diff --git a/tests/resources/generator/ode_constant_on_rhs/model.c b/tests/resources/generator/ode_constant_on_rhs/model.c index 83124f7ed9..71e7ea5a8a 100644 --- a/tests/resources/generator/ode_constant_on_rhs/model.c +++ b/tests/resources/generator/ode_constant_on_rhs/model.c @@ -12,7 +12,6 @@ const size_t STATE_COUNT = 1; const size_t CONSTANT_COUNT = 0; const size_t COMPUTED_CONSTANT_COUNT = 0; const size_t ALGEBRAIC_COUNT = 0; -const size_t EXTERNAL_COUNT = 0; const VariableInfo VOI_INFO = {"t", "second", "environment", VARIABLE_OF_INTEGRATION}; diff --git a/tests/resources/generator/ode_constant_on_rhs/model.h b/tests/resources/generator/ode_constant_on_rhs/model.h index cc72c5b3a4..3f1fb63fd2 100644 --- a/tests/resources/generator/ode_constant_on_rhs/model.h +++ b/tests/resources/generator/ode_constant_on_rhs/model.h @@ -11,7 +11,6 @@ extern const size_t STATE_COUNT; extern const size_t CONSTANT_COUNT; extern const size_t COMPUTED_CONSTANT_COUNT; extern const size_t ALGEBRAIC_COUNT; -extern const size_t EXTERNAL_COUNT; typedef enum { VARIABLE_OF_INTEGRATION, diff --git a/tests/resources/generator/ode_constant_on_rhs/model.py b/tests/resources/generator/ode_constant_on_rhs/model.py index 00b49ef0fe..bc525feb58 100644 --- a/tests/resources/generator/ode_constant_on_rhs/model.py +++ b/tests/resources/generator/ode_constant_on_rhs/model.py @@ -11,7 +11,6 @@ CONSTANT_COUNT = 0 COMPUTED_CONSTANT_COUNT = 0 ALGEBRAIC_COUNT = 0 -EXTERNAL_COUNT = 0 class VariableType(Enum): diff --git a/tests/resources/generator/ode_constant_on_rhs_one_component/model.c b/tests/resources/generator/ode_constant_on_rhs_one_component/model.c index 997ae718f5..a37c8889b6 100644 --- a/tests/resources/generator/ode_constant_on_rhs_one_component/model.c +++ b/tests/resources/generator/ode_constant_on_rhs_one_component/model.c @@ -12,7 +12,6 @@ const size_t STATE_COUNT = 1; const size_t CONSTANT_COUNT = 0; const size_t COMPUTED_CONSTANT_COUNT = 0; const size_t ALGEBRAIC_COUNT = 0; -const size_t EXTERNAL_COUNT = 0; const VariableInfo VOI_INFO = {"t", "second", "my_component", VARIABLE_OF_INTEGRATION}; diff --git a/tests/resources/generator/ode_constant_on_rhs_one_component/model.h b/tests/resources/generator/ode_constant_on_rhs_one_component/model.h index 89890cfa68..ca79cc5f25 100644 --- a/tests/resources/generator/ode_constant_on_rhs_one_component/model.h +++ b/tests/resources/generator/ode_constant_on_rhs_one_component/model.h @@ -11,7 +11,6 @@ extern const size_t STATE_COUNT; extern const size_t CONSTANT_COUNT; extern const size_t COMPUTED_CONSTANT_COUNT; extern const size_t ALGEBRAIC_COUNT; -extern const size_t EXTERNAL_COUNT; typedef enum { VARIABLE_OF_INTEGRATION, diff --git a/tests/resources/generator/ode_constant_on_rhs_one_component/model.py b/tests/resources/generator/ode_constant_on_rhs_one_component/model.py index 72fd031fc9..22311d1da6 100644 --- a/tests/resources/generator/ode_constant_on_rhs_one_component/model.py +++ b/tests/resources/generator/ode_constant_on_rhs_one_component/model.py @@ -11,7 +11,6 @@ CONSTANT_COUNT = 0 COMPUTED_CONSTANT_COUNT = 0 ALGEBRAIC_COUNT = 0 -EXTERNAL_COUNT = 0 class VariableType(Enum): diff --git a/tests/resources/generator/ode_multiple_dependent_odes/model.c b/tests/resources/generator/ode_multiple_dependent_odes/model.c index 6d83c015ca..d8bbbf62ad 100644 --- a/tests/resources/generator/ode_multiple_dependent_odes/model.c +++ b/tests/resources/generator/ode_multiple_dependent_odes/model.c @@ -9,10 +9,9 @@ const char VERSION[] = "0.6.0"; const char LIBCELLML_VERSION[] = "0.5.0"; const size_t STATE_COUNT = 2; -const size_t CONSTANT_COUNT = 0; +const size_t CONSTANT_COUNT = 1; const size_t COMPUTED_CONSTANT_COUNT = 0; -const size_t ALGEBRAIC_COUNT = 1; -const size_t EXTERNAL_COUNT = 0; +const size_t ALGEBRAIC_COUNT = 0; const VariableInfo VOI_INFO = {"t", "second", "environment", VARIABLE_OF_INTEGRATION}; diff --git a/tests/resources/generator/ode_multiple_dependent_odes/model.h b/tests/resources/generator/ode_multiple_dependent_odes/model.h index 14013eaefa..cc74aaa0bd 100644 --- a/tests/resources/generator/ode_multiple_dependent_odes/model.h +++ b/tests/resources/generator/ode_multiple_dependent_odes/model.h @@ -11,7 +11,6 @@ extern const size_t STATE_COUNT; extern const size_t CONSTANT_COUNT; extern const size_t COMPUTED_CONSTANT_COUNT; extern const size_t ALGEBRAIC_COUNT; -extern const size_t EXTERNAL_COUNT; typedef enum { VARIABLE_OF_INTEGRATION, diff --git a/tests/resources/generator/ode_multiple_dependent_odes/model.py b/tests/resources/generator/ode_multiple_dependent_odes/model.py index 9f9df39e8b..a6af28cef0 100644 --- a/tests/resources/generator/ode_multiple_dependent_odes/model.py +++ b/tests/resources/generator/ode_multiple_dependent_odes/model.py @@ -8,10 +8,9 @@ LIBCELLML_VERSION = "0.5.0" STATE_COUNT = 2 -CONSTANT_COUNT = 0 +CONSTANT_COUNT = 1 COMPUTED_CONSTANT_COUNT = 0 -ALGEBRAIC_COUNT = 1 -EXTERNAL_COUNT = 0 +ALGEBRAIC_COUNT = 0 class VariableType(Enum): diff --git a/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.c b/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.c index 21f46b37f5..9ce2fe018f 100644 --- a/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.c +++ b/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.c @@ -9,10 +9,9 @@ const char VERSION[] = "0.6.0"; const char LIBCELLML_VERSION[] = "0.5.0"; const size_t STATE_COUNT = 2; -const size_t CONSTANT_COUNT = 0; +const size_t CONSTANT_COUNT = 1; const size_t COMPUTED_CONSTANT_COUNT = 0; -const size_t ALGEBRAIC_COUNT = 1; -const size_t EXTERNAL_COUNT = 0; +const size_t ALGEBRAIC_COUNT = 0; const VariableInfo VOI_INFO = {"t", "second", "my_component", VARIABLE_OF_INTEGRATION}; diff --git a/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.h b/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.h index 2c7d5a183c..f0d48d38d5 100644 --- a/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.h +++ b/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.h @@ -11,7 +11,6 @@ extern const size_t STATE_COUNT; extern const size_t CONSTANT_COUNT; extern const size_t COMPUTED_CONSTANT_COUNT; extern const size_t ALGEBRAIC_COUNT; -extern const size_t EXTERNAL_COUNT; typedef enum { VARIABLE_OF_INTEGRATION, diff --git a/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.py b/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.py index b4fff77d2c..faa79d3225 100644 --- a/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.py +++ b/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.py @@ -8,10 +8,9 @@ LIBCELLML_VERSION = "0.5.0" STATE_COUNT = 2 -CONSTANT_COUNT = 0 +CONSTANT_COUNT = 1 COMPUTED_CONSTANT_COUNT = 0 -ALGEBRAIC_COUNT = 1 -EXTERNAL_COUNT = 0 +ALGEBRAIC_COUNT = 0 class VariableType(Enum): diff --git a/tests/resources/generator/ode_multiple_odes_with_same_name/model.c b/tests/resources/generator/ode_multiple_odes_with_same_name/model.c index 4612882189..82e57fc2df 100644 --- a/tests/resources/generator/ode_multiple_odes_with_same_name/model.c +++ b/tests/resources/generator/ode_multiple_odes_with_same_name/model.c @@ -9,10 +9,9 @@ const char VERSION[] = "0.6.0"; const char LIBCELLML_VERSION[] = "0.5.0"; const size_t STATE_COUNT = 2; -const size_t CONSTANT_COUNT = 0; +const size_t CONSTANT_COUNT = 1; const size_t COMPUTED_CONSTANT_COUNT = 0; -const size_t ALGEBRAIC_COUNT = 1; -const size_t EXTERNAL_COUNT = 0; +const size_t ALGEBRAIC_COUNT = 0; const VariableInfo VOI_INFO = {"t", "second", "environment", VARIABLE_OF_INTEGRATION}; diff --git a/tests/resources/generator/ode_multiple_odes_with_same_name/model.h b/tests/resources/generator/ode_multiple_odes_with_same_name/model.h index d4cb731d44..0b0953abe2 100644 --- a/tests/resources/generator/ode_multiple_odes_with_same_name/model.h +++ b/tests/resources/generator/ode_multiple_odes_with_same_name/model.h @@ -11,7 +11,6 @@ extern const size_t STATE_COUNT; extern const size_t CONSTANT_COUNT; extern const size_t COMPUTED_CONSTANT_COUNT; extern const size_t ALGEBRAIC_COUNT; -extern const size_t EXTERNAL_COUNT; typedef enum { VARIABLE_OF_INTEGRATION, diff --git a/tests/resources/generator/ode_multiple_odes_with_same_name/model.py b/tests/resources/generator/ode_multiple_odes_with_same_name/model.py index 67babcba79..2a5ff0d6c8 100644 --- a/tests/resources/generator/ode_multiple_odes_with_same_name/model.py +++ b/tests/resources/generator/ode_multiple_odes_with_same_name/model.py @@ -8,10 +8,9 @@ LIBCELLML_VERSION = "0.5.0" STATE_COUNT = 2 -CONSTANT_COUNT = 0 +CONSTANT_COUNT = 1 COMPUTED_CONSTANT_COUNT = 0 -ALGEBRAIC_COUNT = 1 -EXTERNAL_COUNT = 0 +ALGEBRAIC_COUNT = 0 class VariableType(Enum): diff --git a/tests/resources/generator/ode_unknown_var_on_rhs/model.c b/tests/resources/generator/ode_unknown_var_on_rhs/model.c index e464292324..0b29e548b4 100644 --- a/tests/resources/generator/ode_unknown_var_on_rhs/model.c +++ b/tests/resources/generator/ode_unknown_var_on_rhs/model.c @@ -12,7 +12,6 @@ const size_t STATE_COUNT = 2; const size_t CONSTANT_COUNT = 0; const size_t COMPUTED_CONSTANT_COUNT = 0; const size_t ALGEBRAIC_COUNT = 0; -const size_t EXTERNAL_COUNT = 0; const VariableInfo VOI_INFO = {"t", "second", "environment", VARIABLE_OF_INTEGRATION}; diff --git a/tests/resources/generator/ode_unknown_var_on_rhs/model.h b/tests/resources/generator/ode_unknown_var_on_rhs/model.h index cc72c5b3a4..3f1fb63fd2 100644 --- a/tests/resources/generator/ode_unknown_var_on_rhs/model.h +++ b/tests/resources/generator/ode_unknown_var_on_rhs/model.h @@ -11,7 +11,6 @@ extern const size_t STATE_COUNT; extern const size_t CONSTANT_COUNT; extern const size_t COMPUTED_CONSTANT_COUNT; extern const size_t ALGEBRAIC_COUNT; -extern const size_t EXTERNAL_COUNT; typedef enum { VARIABLE_OF_INTEGRATION, diff --git a/tests/resources/generator/ode_unknown_var_on_rhs/model.py b/tests/resources/generator/ode_unknown_var_on_rhs/model.py index a19fdebbf8..2f19ddc26b 100644 --- a/tests/resources/generator/ode_unknown_var_on_rhs/model.py +++ b/tests/resources/generator/ode_unknown_var_on_rhs/model.py @@ -11,7 +11,6 @@ CONSTANT_COUNT = 0 COMPUTED_CONSTANT_COUNT = 0 ALGEBRAIC_COUNT = 0 -EXTERNAL_COUNT = 0 class VariableType(Enum): diff --git a/tests/resources/generator/robertson_model_1966/model.dae.c b/tests/resources/generator/robertson_model_1966/model.dae.c index 63de63a9fc..81baaa83cd 100644 --- a/tests/resources/generator/robertson_model_1966/model.dae.c +++ b/tests/resources/generator/robertson_model_1966/model.dae.c @@ -9,10 +9,9 @@ const char VERSION[] = "0.6.0"; const char LIBCELLML_VERSION[] = "0.5.0"; const size_t STATE_COUNT = 2; -const size_t CONSTANT_COUNT = 0; +const size_t CONSTANT_COUNT = 3; const size_t COMPUTED_CONSTANT_COUNT = 0; -const size_t ALGEBRAIC_COUNT = 5; -const size_t EXTERNAL_COUNT = 0; +const size_t ALGEBRAIC_COUNT = 2; const VariableInfo VOI_INFO = {"t", "dimensionless", "main", VARIABLE_OF_INTEGRATION}; @@ -24,8 +23,8 @@ const VariableInfo STATE_INFO[] = { const VariableInfo VARIABLE_INFO[] = { {"k1", "dimensionless", "main", CONSTANT}, {"k3", "dimensionless", "main", CONSTANT}, - {"y3", "dimensionless", "main", ALGEBRAIC}, {"k2", "dimensionless", "main", CONSTANT}, + {"y3", "dimensionless", "main", ALGEBRAIC}, {"y2_scaled", "dimensionless", "main", ALGEBRAIC} }; @@ -94,8 +93,8 @@ void initialiseVariables(double *states, double *rates, double *constants) { constants[0] = 0.04; constants[1] = 1.0e4; - algebraic[0] = 0.0; constants[2] = 3.0e7; + algebraic[0] = 0.0; states[0] = 1.0; states[1] = 0.0; } diff --git a/tests/resources/generator/robertson_model_1966/model.dae.h b/tests/resources/generator/robertson_model_1966/model.dae.h index 653f64a637..bca2cef3a4 100644 --- a/tests/resources/generator/robertson_model_1966/model.dae.h +++ b/tests/resources/generator/robertson_model_1966/model.dae.h @@ -11,7 +11,6 @@ extern const size_t STATE_COUNT; extern const size_t CONSTANT_COUNT; extern const size_t COMPUTED_CONSTANT_COUNT; extern const size_t ALGEBRAIC_COUNT; -extern const size_t EXTERNAL_COUNT; typedef enum { VARIABLE_OF_INTEGRATION, diff --git a/tests/resources/generator/robertson_model_1966/model.dae.py b/tests/resources/generator/robertson_model_1966/model.dae.py index b5f40fc30a..8a4f383de4 100644 --- a/tests/resources/generator/robertson_model_1966/model.dae.py +++ b/tests/resources/generator/robertson_model_1966/model.dae.py @@ -8,10 +8,9 @@ LIBCELLML_VERSION = "0.5.0" STATE_COUNT = 2 -CONSTANT_COUNT = 0 +CONSTANT_COUNT = 3 COMPUTED_CONSTANT_COUNT = 0 -ALGEBRAIC_COUNT = 5 -EXTERNAL_COUNT = 0 +ALGEBRAIC_COUNT = 2 class VariableType(Enum): @@ -32,8 +31,8 @@ class VariableType(Enum): VARIABLE_INFO = [ {"name": "k1", "units": "dimensionless", "component": "main", "type": VariableType.CONSTANT}, {"name": "k3", "units": "dimensionless", "component": "main", "type": VariableType.CONSTANT}, - {"name": "y3", "units": "dimensionless", "component": "main", "type": VariableType.ALGEBRAIC}, {"name": "k2", "units": "dimensionless", "component": "main", "type": VariableType.CONSTANT}, + {"name": "y3", "units": "dimensionless", "component": "main", "type": VariableType.ALGEBRAIC}, {"name": "y2_scaled", "units": "dimensionless", "component": "main", "type": VariableType.ALGEBRAIC} ] @@ -73,8 +72,8 @@ def find_root_0(voi, states, rates, variables): def initialise_variables(states, rates, constants): constants[0] = 0.04 constants[1] = 1.0e4 - algebraic[0] = 0.0 constants[2] = 3.0e7 + algebraic[0] = 0.0 states[0] = 1.0 states[1] = 0.0 diff --git a/tests/resources/generator/robertson_model_1966/model.ode.c b/tests/resources/generator/robertson_model_1966/model.ode.c index 0bc157d926..7bbd363e08 100644 --- a/tests/resources/generator/robertson_model_1966/model.ode.c +++ b/tests/resources/generator/robertson_model_1966/model.ode.c @@ -9,10 +9,9 @@ const char VERSION[] = "0.6.0"; const char LIBCELLML_VERSION[] = "0.5.0"; const size_t STATE_COUNT = 3; -const size_t CONSTANT_COUNT = 0; +const size_t CONSTANT_COUNT = 3; const size_t COMPUTED_CONSTANT_COUNT = 0; -const size_t ALGEBRAIC_COUNT = 4; -const size_t EXTERNAL_COUNT = 0; +const size_t ALGEBRAIC_COUNT = 1; const VariableInfo VOI_INFO = {"t", "dimensionless", "main", VARIABLE_OF_INTEGRATION}; diff --git a/tests/resources/generator/robertson_model_1966/model.ode.h b/tests/resources/generator/robertson_model_1966/model.ode.h index 653f64a637..bca2cef3a4 100644 --- a/tests/resources/generator/robertson_model_1966/model.ode.h +++ b/tests/resources/generator/robertson_model_1966/model.ode.h @@ -11,7 +11,6 @@ extern const size_t STATE_COUNT; extern const size_t CONSTANT_COUNT; extern const size_t COMPUTED_CONSTANT_COUNT; extern const size_t ALGEBRAIC_COUNT; -extern const size_t EXTERNAL_COUNT; typedef enum { VARIABLE_OF_INTEGRATION, diff --git a/tests/resources/generator/robertson_model_1966/model.ode.py b/tests/resources/generator/robertson_model_1966/model.ode.py index f96e5d8786..2aaab1f031 100644 --- a/tests/resources/generator/robertson_model_1966/model.ode.py +++ b/tests/resources/generator/robertson_model_1966/model.ode.py @@ -8,10 +8,9 @@ LIBCELLML_VERSION = "0.5.0" STATE_COUNT = 3 -CONSTANT_COUNT = 0 +CONSTANT_COUNT = 3 COMPUTED_CONSTANT_COUNT = 0 -ALGEBRAIC_COUNT = 4 -EXTERNAL_COUNT = 0 +ALGEBRAIC_COUNT = 1 class VariableType(Enum): diff --git a/tests/resources/generator/sine_model_imports/model.c b/tests/resources/generator/sine_model_imports/model.c index 02fb665ff0..0c1602c01f 100644 --- a/tests/resources/generator/sine_model_imports/model.c +++ b/tests/resources/generator/sine_model_imports/model.c @@ -9,10 +9,9 @@ const char VERSION[] = "0.6.0"; const char LIBCELLML_VERSION[] = "0.5.0"; const size_t STATE_COUNT = 1; -const size_t CONSTANT_COUNT = 0; -const size_t COMPUTED_CONSTANT_COUNT = 0; -const size_t ALGEBRAIC_COUNT = 10; -const size_t EXTERNAL_COUNT = 0; +const size_t CONSTANT_COUNT = 2; +const size_t COMPUTED_CONSTANT_COUNT = 5; +const size_t ALGEBRAIC_COUNT = 3; const VariableInfo VOI_INFO = {"x", "dimensionless", "main", VARIABLE_OF_INTEGRATION}; @@ -21,15 +20,15 @@ const VariableInfo STATE_INFO[] = { }; const VariableInfo VARIABLE_INFO[] = { - {"sin", "dimensionless", "actual_sin", ALGEBRAIC}, {"deriv_approx_initial_value", "dimensionless", "main", CONSTANT}, - {"sin", "dimensionless", "parabolic_approx_sin", ALGEBRAIC}, {"C", "dimensionless", "main", CONSTANT}, {"k2_oPi", "dimensionless", "parabolic_approx_sin", COMPUTED_CONSTANT}, {"k2Pi", "dimensionless", "parabolic_approx_sin", COMPUTED_CONSTANT}, {"kPi_2", "dimensionless", "parabolic_approx_sin", COMPUTED_CONSTANT}, {"kPi", "dimensionless", "parabolic_approx_sin", COMPUTED_CONSTANT}, {"kPi_32", "dimensionless", "parabolic_approx_sin", COMPUTED_CONSTANT}, + {"sin", "dimensionless", "actual_sin", ALGEBRAIC}, + {"sin", "dimensionless", "parabolic_approx_sin", ALGEBRAIC}, {"z", "dimensionless", "parabolic_approx_sin", ALGEBRAIC} }; diff --git a/tests/resources/generator/sine_model_imports/model.h b/tests/resources/generator/sine_model_imports/model.h index ad2862fae3..93c965f336 100644 --- a/tests/resources/generator/sine_model_imports/model.h +++ b/tests/resources/generator/sine_model_imports/model.h @@ -11,7 +11,6 @@ extern const size_t STATE_COUNT; extern const size_t CONSTANT_COUNT; extern const size_t COMPUTED_CONSTANT_COUNT; extern const size_t ALGEBRAIC_COUNT; -extern const size_t EXTERNAL_COUNT; typedef enum { VARIABLE_OF_INTEGRATION, diff --git a/tests/resources/generator/sine_model_imports/model.py b/tests/resources/generator/sine_model_imports/model.py index 4c559e5e17..8119f98058 100644 --- a/tests/resources/generator/sine_model_imports/model.py +++ b/tests/resources/generator/sine_model_imports/model.py @@ -8,10 +8,9 @@ LIBCELLML_VERSION = "0.5.0" STATE_COUNT = 1 -CONSTANT_COUNT = 0 -COMPUTED_CONSTANT_COUNT = 0 -ALGEBRAIC_COUNT = 10 -EXTERNAL_COUNT = 0 +CONSTANT_COUNT = 2 +COMPUTED_CONSTANT_COUNT = 5 +ALGEBRAIC_COUNT = 3 class VariableType(Enum): @@ -29,15 +28,15 @@ class VariableType(Enum): ] VARIABLE_INFO = [ - {"name": "sin", "units": "dimensionless", "component": "actual_sin", "type": VariableType.ALGEBRAIC}, {"name": "deriv_approx_initial_value", "units": "dimensionless", "component": "main", "type": VariableType.CONSTANT}, - {"name": "sin", "units": "dimensionless", "component": "parabolic_approx_sin", "type": VariableType.ALGEBRAIC}, {"name": "C", "units": "dimensionless", "component": "main", "type": VariableType.CONSTANT}, {"name": "k2_oPi", "units": "dimensionless", "component": "parabolic_approx_sin", "type": VariableType.COMPUTED_CONSTANT}, {"name": "k2Pi", "units": "dimensionless", "component": "parabolic_approx_sin", "type": VariableType.COMPUTED_CONSTANT}, {"name": "kPi_2", "units": "dimensionless", "component": "parabolic_approx_sin", "type": VariableType.COMPUTED_CONSTANT}, {"name": "kPi", "units": "dimensionless", "component": "parabolic_approx_sin", "type": VariableType.COMPUTED_CONSTANT}, {"name": "kPi_32", "units": "dimensionless", "component": "parabolic_approx_sin", "type": VariableType.COMPUTED_CONSTANT}, + {"name": "sin", "units": "dimensionless", "component": "actual_sin", "type": VariableType.ALGEBRAIC}, + {"name": "sin", "units": "dimensionless", "component": "parabolic_approx_sin", "type": VariableType.ALGEBRAIC}, {"name": "z", "units": "dimensionless", "component": "parabolic_approx_sin", "type": VariableType.ALGEBRAIC} ] diff --git a/tests/resources/generator/unknown_variable_as_external_variable/model.c b/tests/resources/generator/unknown_variable_as_external_variable/model.c index 015da83af5..9a6fb704d7 100644 --- a/tests/resources/generator/unknown_variable_as_external_variable/model.c +++ b/tests/resources/generator/unknown_variable_as_external_variable/model.c @@ -8,13 +8,12 @@ const char VERSION[] = "0.6.0"; const char LIBCELLML_VERSION[] = "0.5.0"; -const size_t CONSTANT_COUNT = 0; +const size_t CONSTANT_COUNT = 8; const size_t COMPUTED_CONSTANT_COUNT = 0; -const size_t ALGEBRAIC_COUNT = 10; -const size_t EXTERNAL_COUNT = 0; +const size_t ALGEBRAIC_COUNT = 1; +const size_t EXTERNAL_COUNT = 1; const VariableInfo VARIABLE_INFO[] = { - {"v", "fmol_per_sec", "SLC_template3_ss", ALGEBRAIC}, {"E", "fmol", "SLC_template3_ss", CONSTANT}, {"P_0", "per_fmol_sec4", "SLC_template3_ss", CONSTANT}, {"q_Ao", "fmol", "SLC_template3_ss", CONSTANT}, @@ -23,6 +22,7 @@ const VariableInfo VARIABLE_INFO[] = { {"P_2", "per_fmol_sec3", "SLC_template3_ss", CONSTANT}, {"P_5", "per_sec3", "SLC_template3_ss", CONSTANT}, {"P_4", "per_fmol2_sec3", "SLC_template3_ss", CONSTANT}, + {"v", "fmol_per_sec", "SLC_template3_ss", ALGEBRAIC}, {"P_3", "per_fmol_sec3", "SLC_template3_ss", EXTERNAL} }; diff --git a/tests/resources/generator/unknown_variable_as_external_variable/model.py b/tests/resources/generator/unknown_variable_as_external_variable/model.py index e09f76a957..67a0315a54 100644 --- a/tests/resources/generator/unknown_variable_as_external_variable/model.py +++ b/tests/resources/generator/unknown_variable_as_external_variable/model.py @@ -7,10 +7,10 @@ __version__ = "0.5.0" LIBCELLML_VERSION = "0.5.0" -CONSTANT_COUNT = 0 +CONSTANT_COUNT = 8 COMPUTED_CONSTANT_COUNT = 0 -ALGEBRAIC_COUNT = 10 -EXTERNAL_COUNT = 0 +ALGEBRAIC_COUNT = 1 +EXTERNAL_COUNT = 1 class VariableType(Enum): @@ -21,7 +21,6 @@ class VariableType(Enum): VARIABLE_INFO = [ - {"name": "v", "units": "fmol_per_sec", "component": "SLC_template3_ss", "type": VariableType.ALGEBRAIC}, {"name": "E", "units": "fmol", "component": "SLC_template3_ss", "type": VariableType.CONSTANT}, {"name": "P_0", "units": "per_fmol_sec4", "component": "SLC_template3_ss", "type": VariableType.CONSTANT}, {"name": "q_Ao", "units": "fmol", "component": "SLC_template3_ss", "type": VariableType.CONSTANT}, @@ -30,6 +29,7 @@ class VariableType(Enum): {"name": "P_2", "units": "per_fmol_sec3", "component": "SLC_template3_ss", "type": VariableType.CONSTANT}, {"name": "P_5", "units": "per_sec3", "component": "SLC_template3_ss", "type": VariableType.CONSTANT}, {"name": "P_4", "units": "per_fmol2_sec3", "component": "SLC_template3_ss", "type": VariableType.CONSTANT}, + {"name": "v", "units": "fmol_per_sec", "component": "SLC_template3_ss", "type": VariableType.ALGEBRAIC}, {"name": "P_3", "units": "per_fmol_sec3", "component": "SLC_template3_ss", "type": VariableType.EXTERNAL} ] diff --git a/tests/resources/generator/variable_initialised_using_a_constant/model.c b/tests/resources/generator/variable_initialised_using_a_constant/model.c index 004fa4ce55..bf4de6ab23 100644 --- a/tests/resources/generator/variable_initialised_using_a_constant/model.c +++ b/tests/resources/generator/variable_initialised_using_a_constant/model.c @@ -9,10 +9,9 @@ const char VERSION[] = "0.6.0"; const char LIBCELLML_VERSION[] = "0.5.0"; const size_t STATE_COUNT = 1; -const size_t CONSTANT_COUNT = 0; +const size_t CONSTANT_COUNT = 1; const size_t COMPUTED_CONSTANT_COUNT = 0; -const size_t ALGEBRAIC_COUNT = 1; -const size_t EXTERNAL_COUNT = 0; +const size_t ALGEBRAIC_COUNT = 0; const VariableInfo VOI_INFO = {"t", "second", "component_1", VARIABLE_OF_INTEGRATION}; diff --git a/tests/resources/generator/variable_initialised_using_a_constant/model.h b/tests/resources/generator/variable_initialised_using_a_constant/model.h index 890a583bb2..340f578dd8 100644 --- a/tests/resources/generator/variable_initialised_using_a_constant/model.h +++ b/tests/resources/generator/variable_initialised_using_a_constant/model.h @@ -11,7 +11,6 @@ extern const size_t STATE_COUNT; extern const size_t CONSTANT_COUNT; extern const size_t COMPUTED_CONSTANT_COUNT; extern const size_t ALGEBRAIC_COUNT; -extern const size_t EXTERNAL_COUNT; typedef enum { VARIABLE_OF_INTEGRATION, diff --git a/tests/resources/generator/variable_initialised_using_a_constant/model.py b/tests/resources/generator/variable_initialised_using_a_constant/model.py index 0c4afd7307..491332bdf0 100644 --- a/tests/resources/generator/variable_initialised_using_a_constant/model.py +++ b/tests/resources/generator/variable_initialised_using_a_constant/model.py @@ -8,10 +8,9 @@ LIBCELLML_VERSION = "0.5.0" STATE_COUNT = 1 -CONSTANT_COUNT = 0 +CONSTANT_COUNT = 1 COMPUTED_CONSTANT_COUNT = 0 -ALGEBRAIC_COUNT = 1 -EXTERNAL_COUNT = 0 +ALGEBRAIC_COUNT = 0 class VariableType(Enum): From 7c0d8a1e2b205449d0f9db80020cba24399f38e0 Mon Sep 17 00:00:00 2001 From: Alan Garny Date: Fri, 9 Aug 2024 16:05:57 +0200 Subject: [PATCH 18/85] AnalyserEquation: keep track of states and constants. --- cmake/common.cmake | 10 ++++ src/CMakeLists.txt | 10 +--- src/analyser.cpp | 8 +-- src/analyserequation.cpp | 55 +++++++++++++----- src/analyserequation_p.h | 2 + src/api/libcellml/analyserequation.h | 58 +++++++++++++++++++ src/bindings/interface/analyserequation.i | 18 ++++++ src/bindings/javascript/analyserequation.cpp | 6 ++ src/debug.cpp | 48 +++++++++++---- src/generator.cpp | 46 +++++---------- src/utilities.cpp | 33 ++++++++++- .../javascript/analyserequation.test.js | 6 +- .../model.three.externals.h | 6 +- 13 files changed, 230 insertions(+), 76 deletions(-) diff --git a/cmake/common.cmake b/cmake/common.cmake index 6939ca93b9..214be6d699 100644 --- a/cmake/common.cmake +++ b/cmake/common.cmake @@ -313,3 +313,13 @@ function(redhat_based _RESULT) endif() set(${_RESULT} ${_REDHAT_BASED} PARENT_SCOPE) endfunction() + +function(apply_libxml2_settings _TARGET) + if(HAVE_LIBXML2_CONFIG) + target_link_libraries(${_TARGET} PUBLIC ${LIBXML2_TARGET_NAME}) + else() + target_include_directories(${_TARGET} PUBLIC ${LIBXML2_INCLUDE_DIR} ${ZLIB_INCLUDE_DIRS}) + target_link_libraries(${_TARGET} PUBLIC ${LIBXML2_LIBRARIES} ${ZLIB_LIBRARIES}) + target_compile_definitions(${_TARGET} PUBLIC ${LIBXML2_DEFINITIONS}) + endif() +endfunction() diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 30a60d5bc6..eb748bf9aa 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -193,13 +193,7 @@ else() target_include_directories(cellml PUBLIC ${ZLIB_INCLUDE_DIRS}) endif() -if(HAVE_LIBXML2_CONFIG) - target_link_libraries(cellml PUBLIC ${LIBXML2_TARGET_NAME}) -else() - target_include_directories(cellml PUBLIC ${LIBXML2_INCLUDE_DIR} ${ZLIB_INCLUDE_DIRS}) - target_link_libraries(cellml PUBLIC ${LIBXML2_LIBRARIES} ${ZLIB_LIBRARIES}) - target_compile_definitions(cellml PUBLIC ${LIBXML2_DEFINITIONS}) -endif() +apply_libxml2_settings(cellml) # Use target compile features to propagate features to consuming projects. target_compile_features(cellml PUBLIC cxx_std_17) @@ -231,6 +225,8 @@ target_include_directories(cellml_debug_utilities $ ) +apply_libxml2_settings(cellml_debug_utilities) + set_target_properties(cellml_debug_utilities PROPERTIES CXX_VISIBILITY_PRESET hidden DEBUG_POSTFIX d diff --git a/src/analyser.cpp b/src/analyser.cpp index f0caa7b86d..592ef57305 100644 --- a/src/analyser.cpp +++ b/src/analyser.cpp @@ -2509,8 +2509,8 @@ bool Analyser::AnalyserImpl::isStateRateBased(const AnalyserEquationPtr &equatio if ((dependency->type() == AnalyserEquation::Type::ODE) || ((dependency->type() == AnalyserEquation::Type::NLA) - && (dependency->algebraicCount() == 1) - && (dependency->algebraic(0)->type() == AnalyserVariable::Type::STATE)) + && (dependency->stateCount() == 1) + && (dependency->state(0)->type() == AnalyserVariable::Type::STATE)) || isStateRateBased(dependency, checkedEquations)) { return true; } @@ -3301,11 +3301,11 @@ void Analyser::AnalyserImpl::analyseModel(const ModelPtr &model) switch (variable->type()) { case AnalyserVariable::Type::STATE: - equation->mPimpl->mAlgebraic.push_back(variable); //---GRY--- equation->mPimpl->mStates.push_back(variable); + equation->mPimpl->mStates.push_back(variable); break; case AnalyserVariable::Type::CONSTANT: - equation->mPimpl->mAlgebraic.push_back(variable); //---GRY--- equation->mPimpl->mConstants.push_back(variable); + equation->mPimpl->mConstants.push_back(variable); break; case AnalyserVariable::Type::COMPUTED_CONSTANT: diff --git a/src/analyserequation.cpp b/src/analyserequation.cpp index 7caf807cef..d5d13f9f31 100644 --- a/src/analyserequation.cpp +++ b/src/analyserequation.cpp @@ -20,6 +20,7 @@ limitations under the License. #include #include "analyserequation_p.h" +#include "utilities.h" namespace libcellml { @@ -30,21 +31,9 @@ AnalyserEquationPtr AnalyserEquation::AnalyserEquationImpl::create() bool AnalyserEquation::AnalyserEquationImpl::isEmptyDependency(const AnalyserEquationWeakPtr &dependency) { - auto computedConstants = dependency.lock()->computedConstants(); + auto variables = libcellml::variables(dependency.lock()); - if (std::any_of(computedConstants.begin(), computedConstants.end(), [](const auto &v) { return v != nullptr; })) { - return false; - } - - auto algebraic = dependency.lock()->algebraic(); - - if (std::any_of(algebraic.begin(), algebraic.end(), [](const auto &v) { return v != nullptr; })) { - return false; - } - - auto externals = dependency.lock()->externals(); - - if (std::any_of(externals.begin(), externals.end(), [](const auto &v) { return v != nullptr; })) { + if (std::any_of(variables.begin(), variables.end(), [](const auto &v) { return v != nullptr; })) { return false; } @@ -149,6 +138,44 @@ bool AnalyserEquation::isStateRateBased() const return mPimpl->mIsStateRateBased; } +size_t AnalyserEquation::stateCount() const +{ + return mPimpl->mStates.size(); +} + +std::vector AnalyserEquation::states() const +{ + return mPimpl->mStates; +} + +AnalyserVariablePtr AnalyserEquation::state(size_t index) const +{ + if (index >= mPimpl->mStates.size()) { + return {}; + } + + return mPimpl->mStates[index]; +} + +size_t AnalyserEquation::constantCount() const +{ + return mPimpl->mConstants.size(); +} + +std::vector AnalyserEquation::constants() const +{ + return mPimpl->mConstants; +} + +AnalyserVariablePtr AnalyserEquation::constant(size_t index) const +{ + if (index >= mPimpl->mConstants.size()) { + return {}; + } + + return mPimpl->mConstants[index]; +} + size_t AnalyserEquation::computedConstantCount() const { return mPimpl->mComputedConstants.size(); diff --git a/src/analyserequation_p.h b/src/analyserequation_p.h index 471fd9b97b..d0a167f4af 100644 --- a/src/analyserequation_p.h +++ b/src/analyserequation_p.h @@ -34,6 +34,8 @@ struct AnalyserEquation::AnalyserEquationImpl size_t mNlaSystemIndex; bool mIsStateRateBased = false; + std::vector mStates; + std::vector mConstants; std::vector mComputedConstants; std::vector mAlgebraic; std::vector mExternals; diff --git a/src/api/libcellml/analyserequation.h b/src/api/libcellml/analyserequation.h index 22d7d50674..9c83fa402a 100644 --- a/src/api/libcellml/analyserequation.h +++ b/src/api/libcellml/analyserequation.h @@ -165,6 +165,64 @@ class LIBCELLML_EXPORT AnalyserEquation */ bool isStateRateBased() const; + /** + * @brief Get the number of states computed by this @ref AnalyserEquation. + * + * Return the number of states computed by this @ref AnalyserEquation. + * + * @return The number of states. + */ + size_t stateCount() const; + + /** + * @brief Get the states computed by this @ref AnalyserEquation. + * + * Return the states computed by this @ref AnalyserEquation. + * + * @return The states as a @c std::vector. + */ + std::vector states() const; + + /** + * @brief Get the state, at @p index, computed by this @ref AnalyserEquation. + * + * Return the state, at @p index, computed by this @ref AnalyserEquation. + * + * @param index The index of the state to return. + * + * @return The state, at @p index, on success, @c nullptr on failure. + */ + AnalyserVariablePtr state(size_t index) const; + + /** + * @brief Get the number of constant computed by this @ref AnalyserEquation. + * + * Return the number of constants computed by this @ref AnalyserEquation. + * + * @return The number of constants. + */ + size_t constantCount() const; + + /** + * @brief Get the constants computed by this @ref AnalyserEquation. + * + * Return the constants computed by this @ref AnalyserEquation. + * + * @return The constants as a @c std::vector. + */ + std::vector constants() const; + + /** + * @brief Get the constant, at @p index, computed by this @ref AnalyserEquation. + * + * Return the constant, at @p index, computed by this @ref AnalyserEquation. + * + * @param index The index of the constant to return. + * + * @return The constant, at @p index, on success, @c nullptr on failure. + */ + AnalyserVariablePtr constant(size_t index) const; + /** * @brief Get the number of computed constants computed by this @ref AnalyserEquation. * diff --git a/src/bindings/interface/analyserequation.i b/src/bindings/interface/analyserequation.i index 8749557bb4..3e7f3345be 100644 --- a/src/bindings/interface/analyserequation.i +++ b/src/bindings/interface/analyserequation.i @@ -43,6 +43,24 @@ %feature("docstring") libcellml::AnalyserEquation::isStateRateBased "Tests if this :class:`AnalyserEquation` object relies on states and/or rates."; +%feature("docstring") libcellml::AnalyserEquation::stateCount +"Returns the number of states computed by this :class:`AnalyserEquation` object."; + +%feature("docstring") libcellml::AnalyserEquation::states +"Returns the states computed by this :class:`AnalyserEquation` object."; + +%feature("docstring") libcellml::AnalyserEquation::state +"Returns the state, at the given index, computed by this :class:`AnalyserEquation` object."; + +%feature("docstring") libcellml::AnalyserEquation::constantCount +"Returns the number of constants computed by this :class:`AnalyserEquation` object."; + +%feature("docstring") libcellml::AnalyserEquation::constants +"Returns the constants computed by this :class:`AnalyserEquation` object."; + +%feature("docstring") libcellml::AnalyserEquation::constant +"Returns the constant, at the given index, computed by this :class:`AnalyserEquation` object."; + %feature("docstring") libcellml::AnalyserEquation::computedConstantCount "Returns the number of computed constants computed by this :class:`AnalyserEquation` object."; diff --git a/src/bindings/javascript/analyserequation.cpp b/src/bindings/javascript/analyserequation.cpp index 3b1bf0a464..ed04c4c13c 100644 --- a/src/bindings/javascript/analyserequation.cpp +++ b/src/bindings/javascript/analyserequation.cpp @@ -45,6 +45,12 @@ EMSCRIPTEN_BINDINGS(libcellml_analyserequation) .function("nlaSiblings", &libcellml::AnalyserEquation::nlaSiblings) .function("nlaSibling", &libcellml::AnalyserEquation::nlaSibling) .function("isStateRateBased", &libcellml::AnalyserEquation::isStateRateBased) + .function("stateCount", &libcellml::AnalyserEquation::stateCount) + .function("states", select_overload() const>(&libcellml::AnalyserEquation::states)) + .function("state", select_overload(&libcellml::AnalyserEquation::state)) + .function("constantCount", &libcellml::AnalyserEquation::constantCount) + .function("constants", select_overload() const>(&libcellml::AnalyserEquation::constants)) + .function("constant", select_overload(&libcellml::AnalyserEquation::constant)) .function("computedConstantCount", &libcellml::AnalyserEquation::computedConstantCount) .function("computedConstants", &libcellml::AnalyserEquation::computedConstants) .function("computedConstant", &libcellml::AnalyserEquation::computedConstant) diff --git a/src/debug.cpp b/src/debug.cpp index 179a80935c..a1a92ac882 100644 --- a/src/debug.cpp +++ b/src/debug.cpp @@ -26,9 +26,10 @@ limitations under the License. #include "libcellml/model.h" #include "libcellml/variable.h" -#include "libcellml/undefines.h" - #include "commonutils.h" +#include "utilities.h" + +#include "libcellml/undefines.h" namespace libcellml { @@ -85,6 +86,26 @@ void printAnalyserModelEquations(const AnalyserModelPtr &model) Debug() << "\nType: " << AnalyserEquation::typeAsString(eqn->type()); + if (eqn->stateCount() != 0) { + Debug() << "\nStates:"; + + for (const auto &var : eqn->states()) { + Debug() << " - " << var->variable()->name(); + } + } else { + Debug() << "\nNo states"; + } + + if (eqn->constantCount() != 0) { + Debug() << "\nConstants:"; + + for (const auto &var : eqn->constants()) { + Debug() << " - " << var->variable()->name(); + } + } else { + Debug() << "\nNo constants"; + } + if (eqn->computedConstantCount() != 0) { Debug() << "\nComputed constants:"; @@ -105,6 +126,16 @@ void printAnalyserModelEquations(const AnalyserModelPtr &model) Debug() << "\nNo algebraic variables"; } + if (eqn->algebraicCount() != 0) { + Debug() << "\nExternal variables:"; + + for (const auto &var : eqn->externals()) { + Debug() << " - " << var->variable()->name(); + } + } else { + Debug() << "\nNo external variables"; + } + if (eqn->dependencyCount() != 0) { Debug() << "\nDependencies:"; @@ -112,7 +143,7 @@ void printAnalyserModelEquations(const AnalyserModelPtr &model) if (dep->ast() != nullptr) { Debug() << " - " << astAsCode(dep->ast()); } else if (dep->type() == AnalyserEquation::Type::EXTERNAL) { - Debug() << " - External equation for '" << dep->algebraic(0)->variable()->name() << "'"; + Debug() << " - External equation for '" << dep->external(0)->variable()->name() << "'"; } else { Debug() << " - ??? [" << AnalyserEquation::typeAsString(dep->type()) << "]"; } @@ -143,11 +174,11 @@ void printAnalyserModelEquations(const AnalyserModelPtr &model) Debug() << "\n---------------------------------------[END]\n"; } -void printAnalyserModelVariables(const std::vector &variables) +void printAnalyserModelVariables(const AnalyserModelPtr &model) { size_t varNb = 0; - for (const auto &var : variables) { + for (const auto &var : variables(model)) { Debug() << "\n---------------------------------------[API variable #" << ++varNb << "]"; Debug() << "\nName: " << var->variable()->name(); Debug() << "Type: " << AnalyserVariable::typeAsString(var->type()); @@ -170,13 +201,6 @@ void printAnalyserModelVariables(const std::vector &variabl } } -void printAnalyserModelVariables(const AnalyserModelPtr &model) -{ - printAnalyserModelVariables(model->constants()); - printAnalyserModelVariables(model->computedConstants()); - printAnalyserModelVariables(model->algebraic()); -} - void printHistory(const History &history) { for (const auto &h : history) { diff --git a/src/generator.cpp b/src/generator.cpp index 44671415e9..4a280ce434 100644 --- a/src/generator.cpp +++ b/src/generator.cpp @@ -92,11 +92,7 @@ AnalyserVariablePtr Generator::GeneratorImpl::analyserVariable(const VariablePtr && mModel->areEquivalentVariables(variable, modelVoiVariable)) { res = modelVoi; } else { - res = doAnalyserVariable(variable, mModel->states()); - - if (res == nullptr) { - res = doAnalyserVariable(variable, variables(mModel)); - } + res = doAnalyserVariable(variable, variables(mModel)); } return res; @@ -382,24 +378,8 @@ std::string Generator::GeneratorImpl::generateVariableInfoObjectCode(const std:: size_t nameSize = 0; size_t unitsSize = 0; - if (modelHasOdes()) { - updateVariableInfoSizes(componentSize, nameSize, unitsSize, mModel->voi()); - - for (const auto &state : mModel->states()) { - updateVariableInfoSizes(componentSize, nameSize, unitsSize, state); - } - } - - for (const auto &constant : mModel->constants()) { - updateVariableInfoSizes(componentSize, nameSize, unitsSize, constant); - } - - for (const auto &computedConstant : mModel->computedConstants()) { - updateVariableInfoSizes(componentSize, nameSize, unitsSize, computedConstant); - } - - for (const auto &algebraicVariable : mModel->algebraic()) { - updateVariableInfoSizes(componentSize, nameSize, unitsSize, algebraicVariable); + for (const auto &variable : variables(mModel)) { + updateVariableInfoSizes(componentSize, nameSize, unitsSize, variable); } return replace(replace(replace(objectString, @@ -536,20 +516,24 @@ void Generator::GeneratorImpl::addImplementationVariableInfoCode() variableType = mProfile->algebraicVariableTypeString(); break; - default: // AnalyserVariable::Type::EXTERNAL. + case AnalyserVariable::Type::EXTERNAL: variableType = mProfile->externalVariableTypeString(); + break; + default: // Other types we don't care about. break; } - auto variableVariable = variable->variable(); + if (!variableType.empty()) { + auto variableVariable = variable->variable(); - infoElementsCode += mProfile->indentString() - + replace(replace(replace(replace(mProfile->variableInfoEntryString(), - "[NAME]", variableVariable->name()), - "[UNITS]", variableVariable->units()->name()), - "[COMPONENT]", owningComponent(variableVariable)->name()), - "[TYPE]", variableType); + infoElementsCode += mProfile->indentString() + + replace(replace(replace(replace(mProfile->variableInfoEntryString(), + "[NAME]", variableVariable->name()), + "[UNITS]", variableVariable->units()->name()), + "[COMPONENT]", owningComponent(variableVariable)->name()), + "[TYPE]", variableType); + } } if (!infoElementsCode.empty()) { diff --git a/src/utilities.cpp b/src/utilities.cpp index 77815b38bf..73473b6739 100644 --- a/src/utilities.cpp +++ b/src/utilities.cpp @@ -1319,7 +1319,24 @@ XmlNodePtr mathmlChildNode(const XmlNodePtr &node, size_t index) std::vector variables(const AnalyserModelPtr &model) { - auto res = model->constants(); + std::vector res; + + if (model->voi() != nullptr) { + res.push_back(model->voi()); + } + + auto states = model->states(); + + if (!states.empty()) { + res.insert(res.end(), states.begin(), states.end()); + } + + auto constants = model->constants(); + + if (!constants.empty()) { + res.insert(res.end(), constants.begin(), constants.end()); + } + auto computedConstants = model->computedConstants(); if (!computedConstants.empty()) { @@ -1343,7 +1360,19 @@ std::vector variables(const AnalyserModelPtr &model) std::vector variables(const AnalyserEquationPtr &equation) { - auto res = equation->computedConstants(); + auto res = equation->states(); + auto constants = equation->constants(); + + if (!constants.empty()) { + res.insert(res.end(), constants.begin(), constants.end()); + } + + auto computedConstants = equation->computedConstants(); + + if (!computedConstants.empty()) { + res.insert(res.end(), computedConstants.begin(), computedConstants.end()); + } + auto algebraic = equation->algebraic(); if (!algebraic.empty()) { diff --git a/tests/bindings/javascript/analyserequation.test.js b/tests/bindings/javascript/analyserequation.test.js index b16f7def05..8269268994 100644 --- a/tests/bindings/javascript/analyserequation.test.js +++ b/tests/bindings/javascript/analyserequation.test.js @@ -80,13 +80,13 @@ describe("Analyser Equation tests", () => { expect(eqn.computedConstant(0)).toBeNull() }); test('Checking Analyser Equation algebraicCount.', () => { - expect(eqn.algebraicCount()).toBe(1) + expect(eqn.algebraicCount()).toBe(0) }); test('Checking Analyser Equation algebraicVariables.', () => { - expect(eqn.algebraicVariables().size()).toBe(1) + expect(eqn.algebraicVariables().size()).toBe(0) }); test('Checking Analyser Equation algebraicVariable.', () => { - expect(eqn.algebraicVariable(0).variable().name()).toBe("x") + expect(eqn.algebraicVariable(0)).toBeNull() }); test('Checking Analyser Equation externalCount.', () => { expect(eqn.externalCount()).toBe(0) diff --git a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.h b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.h index 7650d5f48b..0c3b6b4a50 100644 --- a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.h +++ b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.h @@ -20,9 +20,9 @@ typedef enum { } VariableType; typedef struct { - char name[0]; - char units[0]; - char component[0]; + char name[2]; + char units[14]; + char component[20]; VariableType type; } VariableInfo; From 9f8bf25d0230edd357a0ff7ed79971f048769d10 Mon Sep 17 00:00:00 2001 From: Alan Garny Date: Mon, 12 Aug 2024 18:29:31 +0200 Subject: [PATCH 19/85] Generator: generate the CONSTANT_INFO, COMPUTED_CONSTANT_INFO, ALGEBRAIC_INFO, and EXTERNAL_INFO arrays rather than just the VARIABLE_INFO array. --- src/api/libcellml/generatorprofile.h | 190 ++++++++++++++++-- src/bindings/interface/generatorprofile.i | 58 +++++- src/bindings/javascript/generatorprofile.cpp | 20 +- src/generator.cpp | 157 ++++++--------- src/generator_p.h | 7 +- src/generatorprofile.cpp | 131 ++++++++++-- src/generatorprofilesha1values.h | 4 +- src/generatorprofiletools.cpp | 13 +- tests/bindings/javascript/generator.test.js | 4 +- .../javascript/generatorprofile.test.js | 48 ++++- .../bindings/python/test_generator_profile.py | 91 +++++++-- tests/coverage/coverage.cpp | 21 +- tests/generator/generatorprofile.cpp | 50 ++++- tests/resources/coverage/generator/model.c | 12 +- tests/resources/coverage/generator/model.h | 4 +- .../generator/model.modified.profile.c | 12 +- .../generator/model.modified.profile.h | 4 +- .../generator/model.modified.profile.py | 17 +- tests/resources/coverage/generator/model.py | 17 +- .../algebraic_eqn_computed_var_on_rhs/model.c | 8 +- .../model.external.c | 13 +- .../model.external.h | 5 +- .../model.external.py | 13 +- .../algebraic_eqn_computed_var_on_rhs/model.h | 4 +- .../model.py | 8 +- .../algebraic_eqn_const_var_on_rhs/model.c | 10 +- .../algebraic_eqn_const_var_on_rhs/model.h | 4 +- .../algebraic_eqn_const_var_on_rhs/model.py | 10 +- .../algebraic_eqn_constant_on_rhs/model.c | 8 +- .../algebraic_eqn_constant_on_rhs/model.h | 4 +- .../algebraic_eqn_constant_on_rhs/model.py | 8 +- .../algebraic_eqn_derivative_on_rhs/model.c | 10 +- .../algebraic_eqn_derivative_on_rhs/model.h | 4 +- .../algebraic_eqn_derivative_on_rhs/model.py | 13 +- .../model.c | 10 +- .../model.h | 4 +- .../model.py | 13 +- .../algebraic_eqn_state_var_on_rhs/model.c | 10 +- .../algebraic_eqn_state_var_on_rhs/model.h | 4 +- .../algebraic_eqn_state_var_on_rhs/model.py | 13 +- .../model.c | 10 +- .../model.h | 4 +- .../model.py | 13 +- .../model.c | 10 +- .../model.external.c | 13 +- .../model.external.h | 5 +- .../model.external.py | 13 +- .../model.h | 4 +- .../model.py | 10 +- .../model.c | 8 +- .../model.h | 4 +- .../model.py | 8 +- .../model.three.externals.c | 11 +- .../model.three.externals.h | 5 +- .../model.three.externals.py | 11 +- .../model.not.ordered.c | 12 +- .../model.not.ordered.h | 4 +- .../model.not.ordered.py | 12 +- .../model.ordered.c | 12 +- .../model.ordered.h | 4 +- .../model.ordered.py | 12 +- .../algebraic_unknown_var_on_rhs/model.c | 8 +- .../algebraic_unknown_var_on_rhs/model.h | 4 +- .../algebraic_unknown_var_on_rhs/model.py | 8 +- .../generator/cell_geometry_model/model.c | 10 +- .../cell_geometry_model/model.external.c | 13 +- .../cell_geometry_model/model.external.h | 5 +- .../cell_geometry_model/model.external.py | 13 +- .../generator/cell_geometry_model/model.h | 4 +- .../generator/cell_geometry_model/model.py | 10 +- .../model.c | 8 +- .../model.h | 4 +- .../model.py | 11 +- .../generator/cellml_slc_example/model.py | 10 +- .../model.c | 8 +- .../model.h | 4 +- .../model.py | 13 +- .../cellml_unit_scaling_constant/model.c | 10 +- .../cellml_unit_scaling_constant/model.h | 4 +- .../cellml_unit_scaling_constant/model.py | 10 +- .../cellml_unit_scaling_rate/model.c | 8 +- .../cellml_unit_scaling_rate/model.h | 4 +- .../cellml_unit_scaling_rate/model.py | 11 +- .../cellml_unit_scaling_state/model.c | 8 +- .../cellml_unit_scaling_state/model.h | 4 +- .../cellml_unit_scaling_state/model.py | 11 +- .../model.c | 8 +- .../model.h | 4 +- .../model.py | 11 +- .../model.c | 8 +- .../model.h | 4 +- .../model.py | 13 +- .../cellml_unit_scaling_voi_direct/model.c | 8 +- .../cellml_unit_scaling_voi_direct/model.h | 4 +- .../cellml_unit_scaling_voi_direct/model.py | 11 +- .../cellml_unit_scaling_voi_indirect/model.c | 8 +- .../cellml_unit_scaling_voi_indirect/model.h | 4 +- .../cellml_unit_scaling_voi_indirect/model.py | 11 +- .../generator/dae_cellml_1_1_model/model.c | 10 +- .../generator/dae_cellml_1_1_model/model.h | 4 +- .../generator/dae_cellml_1_1_model/model.py | 15 +- .../generator/dependent_eqns/model.c | 8 +- .../generator/dependent_eqns/model.h | 4 +- .../generator/dependent_eqns/model.py | 11 +- .../model.c | 12 +- .../model.h | 4 +- .../model.py | 17 +- .../model.c | 12 +- .../model.h | 4 +- .../model.py | 17 +- .../model.algebraic.c | 17 +- .../model.algebraic.h | 5 +- .../model.algebraic.py | 22 +- .../model.c | 12 +- .../model.computed.constant.c | 17 +- .../model.computed.constant.h | 5 +- .../model.computed.constant.py | 22 +- .../model.constant.c | 17 +- .../model.constant.h | 5 +- .../model.constant.py | 22 +- .../model.dae.c | 12 +- .../model.dae.h | 4 +- .../model.dae.py | 17 +- .../model.dependent.algebraic.c | 17 +- .../model.dependent.algebraic.h | 5 +- .../model.dependent.algebraic.py | 22 +- .../model.dependent.computed.constant.c | 15 +- .../model.dependent.computed.constant.h | 5 +- .../model.dependent.computed.constant.py | 20 +- .../model.dependent.constant.c | 17 +- .../model.dependent.constant.h | 5 +- .../model.dependent.constant.py | 22 +- .../model.dependent.state.c | 17 +- .../model.dependent.state.h | 5 +- .../model.dependent.state.py | 22 +- .../model.external.c | 17 +- .../model.external.h | 5 +- .../model.external.py | 22 +- .../model.h | 4 +- .../model.py | 17 +- .../model.state.c | 17 +- .../model.state.h | 5 +- .../model.state.py | 22 +- .../generator/noble_model_1962/model.c | 10 +- .../generator/noble_model_1962/model.h | 4 +- .../generator/noble_model_1962/model.py | 15 +- .../generator/ode_computed_var_on_rhs/model.c | 8 +- .../generator/ode_computed_var_on_rhs/model.h | 4 +- .../ode_computed_var_on_rhs/model.py | 11 +- .../model.c | 8 +- .../model.h | 4 +- .../model.py | 11 +- .../generator/ode_const_var_on_rhs/model.c | 8 +- .../generator/ode_const_var_on_rhs/model.h | 4 +- .../generator/ode_const_var_on_rhs/model.py | 13 +- .../model.c | 8 +- .../model.h | 4 +- .../model.py | 13 +- .../generator/ode_constant_on_rhs/model.c | 8 +- .../generator/ode_constant_on_rhs/model.h | 4 +- .../generator/ode_constant_on_rhs/model.py | 11 +- .../ode_constant_on_rhs_one_component/model.c | 8 +- .../ode_constant_on_rhs_one_component/model.h | 4 +- .../model.py | 11 +- .../ode_multiple_dependent_odes/model.c | 8 +- .../ode_multiple_dependent_odes/model.h | 4 +- .../ode_multiple_dependent_odes/model.py | 13 +- .../model.c | 8 +- .../model.h | 4 +- .../model.py | 13 +- .../ode_multiple_odes_with_same_name/model.c | 8 +- .../ode_multiple_odes_with_same_name/model.h | 4 +- .../ode_multiple_odes_with_same_name/model.py | 13 +- .../generator/ode_unknown_var_on_rhs/model.c | 8 +- .../generator/ode_unknown_var_on_rhs/model.h | 4 +- .../generator/ode_unknown_var_on_rhs/model.py | 11 +- .../robertson_model_1966/model.dae.c | 10 +- .../robertson_model_1966/model.dae.h | 4 +- .../robertson_model_1966/model.dae.py | 15 +- .../robertson_model_1966/model.ode.c | 10 +- .../robertson_model_1966/model.ode.h | 4 +- .../robertson_model_1966/model.ode.py | 15 +- .../generator/sine_model_imports/model.c | 12 +- .../generator/sine_model_imports/model.h | 4 +- .../generator/sine_model_imports/model.py | 17 +- .../model.c | 15 +- .../model.h | 5 +- .../model.py | 15 +- .../model.c | 8 +- .../model.h | 4 +- .../model.py | 13 +- 191 files changed, 1908 insertions(+), 606 deletions(-) diff --git a/src/api/libcellml/generatorprofile.h b/src/api/libcellml/generatorprofile.h index 4cefa11f2d..b3ee8ec275 100644 --- a/src/api/libcellml/generatorprofile.h +++ b/src/api/libcellml/generatorprofile.h @@ -2948,53 +2948,203 @@ class LIBCELLML_EXPORT GeneratorProfile /** * @brief Get the @c std::string for the interface of some information about - * the different variables. + * the different constants. * * Return the @c std::string for the interface of some information about the - * different variables. + * different constants. * * @return The @c std::string for the interface of some information about - * the different variables. + * the different constants. */ - std::string interfaceVariableInfoString() const; + std::string interfaceConstantInfoString() const; /** * @brief Set the @c std::string for the interface of some information about - * the different variables. + * the different constants. * * Set the @c std::string for the interface of some information about the - * different variables. + * different constants. * - * @param interfaceVariableInfoString The @c std::string to use for the - * interface of some information about the different variables. + * @param interfaceConstantInfoString The @c std::string to use for the + * interface of some information about the different constants. */ - void setInterfaceVariableInfoString(const std::string &interfaceVariableInfoString); + void setInterfaceConstantInfoString(const std::string &interfaceConstantInfoString); /** * @brief Get the @c std::string for the implementation of some information - * about the different variables. + * about the different constants. * * Return the @c std::string for the implementation of some information - * about the different variables. + * about the different constants. * * @return The @c std::string for the implementation of some information - * about the different variables. + * about the different constants. */ - std::string implementationVariableInfoString() const; + std::string implementationConstantInfoString() const; /** * @brief Set the @c std::string for the implementation of some information - * about the different variables. + * about the different constants. * * Set the @c std::string for the implementation of some information about - * the different variables. To be useful, the string should contain the - * [CODE] tag, which will be replaced with some information about the - * different variables. + * the different constants. To be useful, the string should contain the [CODE] + * tag, which will be replaced with some information about the different + * constants. + * + * @param implementationConstantInfoString The @c std::string to use for the + * implementation of some information about the different constants. + */ + void setImplementationConstantInfoString(const std::string &implementationConstantInfoString); + + /** + * @brief Get the @c std::string for the interface of some information about + * the different computed constants. + * + * Return the @c std::string for the interface of some information about the + * different computed constants. + * + * @return The @c std::string for the interface of some information about + * the different computed constants. + */ + std::string interfaceComputedConstantInfoString() const; + + /** + * @brief Set the @c std::string for the interface of some information about + * the different computed constants. + * + * Set the @c std::string for the interface of some information about the + * different computed constants. + * + * @param interfaceComputedConstantInfoString The @c std::string to use for the + * interface of some information about the different computed constants. + */ + void setInterfaceComputedConstantInfoString(const std::string &interfaceComputedConstantInfoString); + + /** + * @brief Get the @c std::string for the implementation of some information + * about the different computed constants. + * + * Return the @c std::string for the implementation of some information + * about the different computed constants. + * + * @return The @c std::string for the implementation of some information + * about the different computed constants. + */ + std::string implementationComputedConstantInfoString() const; + + /** + * @brief Set the @c std::string for the implementation of some information + * about the different computed constants. + * + * Set the @c std::string for the implementation of some information about + * the different computed constants. To be useful, the string should contain the [CODE] + * tag, which will be replaced with some information about the different + * computed constants. + * + * @param implementationComputedConstantInfoString The @c std::string to use for the + * implementation of some information about the different computed constants. + */ + void setImplementationComputedConstantInfoString(const std::string &implementationComputedConstantInfoString); + + /** + * @brief Get the @c std::string for the interface of some information about + * the different algebraic variables. + * + * Return the @c std::string for the interface of some information about the + * different algebraic variables. + * + * @return The @c std::string for the interface of some information about + * the different algebraic variables. + */ + std::string interfaceAlgebraicInfoString() const; + + /** + * @brief Set the @c std::string for the interface of some information about + * the different algebraic variables. + * + * Set the @c std::string for the interface of some information about the + * different algebraic variables. + * + * @param interfaceAlgebraicInfoString The @c std::string to use for the + * interface of some information about the different algebraic variables. + */ + void setInterfaceAlgebraicInfoString(const std::string &interfaceAlgebraicInfoString); + + /** + * @brief Get the @c std::string for the implementation of some information + * about the different algebraic variables. + * + * Return the @c std::string for the implementation of some information + * about the different algebraic variables. + * + * @return The @c std::string for the implementation of some information + * about the different algebraic variables. + */ + std::string implementationAlgebraicInfoString() const; + + /** + * @brief Set the @c std::string for the implementation of some information + * about the different algebraic variables. + * + * Set the @c std::string for the implementation of some information about + * the different algebraic variables. To be useful, the string should contain the [CODE] + * tag, which will be replaced with some information about the different + * algebraic variables. + * + * @param implementationAlgebraicInfoString The @c std::string to use for the + * implementation of some information about the different algebraic variables. + */ + void setImplementationAlgebraicInfoString(const std::string &implementationAlgebraicInfoString); + + /** + * @brief Get the @c std::string for the interface of some information about + * the different external variables. + * + * Return the @c std::string for the interface of some information about the + * different external variables. + * + * @return The @c std::string for the interface of some information about + * the different external variables. + */ + std::string interfaceExternalInfoString() const; + + /** + * @brief Set the @c std::string for the interface of some information about + * the different external variables. + * + * Set the @c std::string for the interface of some information about the + * different external variables. + * + * @param interfaceExternalInfoString The @c std::string to use for the + * interface of some information about the different external variables. + */ + void setInterfaceExternalInfoString(const std::string &interfaceExternalInfoString); + + /** + * @brief Get the @c std::string for the implementation of some information + * about the different external variables. + * + * Return the @c std::string for the implementation of some information + * about the different external variables. + * + * @return The @c std::string for the implementation of some information + * about the different external variables. + */ + std::string implementationExternalInfoString() const; + + /** + * @brief Set the @c std::string for the implementation of some information + * about the different external variables. + * + * Set the @c std::string for the implementation of some information about + * the different external variables. To be useful, the string should contain the [CODE] + * tag, which will be replaced with some information about the different + * external variables. * - * @param implementationVariableInfoString The @c std::string to use for the - * implementation of some information about the different variables. + * @param implementationExternalInfoString The @c std::string to use for the + * implementation of some information about the different external variables. */ - void setImplementationVariableInfoString(const std::string &implementationVariableInfoString); + void setImplementationExternalInfoString(const std::string &implementationExternalInfoString); /** * @brief Get the @c std::string for an entry in an array for some diff --git a/src/bindings/interface/generatorprofile.i b/src/bindings/interface/generatorprofile.i index 51e227c134..b7e5c3cb6d 100644 --- a/src/bindings/interface/generatorprofile.i +++ b/src/bindings/interface/generatorprofile.i @@ -806,19 +806,57 @@ integration."; "Sets the string for the implementation of some information about the different states. To be useful, the string should contain the tag, which will be replaced with some information about the different states."; -%feature("docstring") libcellml::GeneratorProfile::interfaceVariableInfoString -"Returns the string for the interface of some information about the different variables."; +%feature("docstring") libcellml::GeneratorProfile::interfaceConstantInfoString +"Returns the string for the interface of some information about the different constants."; -%feature("docstring") libcellml::GeneratorProfile::setInterfaceVariableInfoString -"Sets the string for the interface of some information about the different variables."; +%feature("docstring") libcellml::GeneratorProfile::setInterfaceConstantInfoString +"Sets the string for the interface of some information about the different constants."; -%feature("docstring") libcellml::GeneratorProfile::implementationVariableInfoString -"Returns the string for the implementation of some information about the different variables."; +%feature("docstring") libcellml::GeneratorProfile::implementationConstantInfoString +"Returns the string for the implementation of some information about the different constants."; -%feature("docstring") libcellml::GeneratorProfile::setImplementationVariableInfoString -"Sets the string for the implementation of some information about the different variables. To be useful, the -string should contain the tag, which will be replaced with some information about the different -variables."; +%feature("docstring") libcellml::GeneratorProfile::setImplementationConstantInfoString +"Sets the string for the implementation of some information about the different constants. To be useful, the string +should contain the tag, which will be replaced with some information about the different constants."; + +%feature("docstring") libcellml::GeneratorProfile::interfaceComputedConstantInfoString +"Returns the string for the interface of some information about the different computed constants."; + +%feature("docstring") libcellml::GeneratorProfile::setInterfaceComputedConstantInfoString +"Sets the string for the interface of some information about the different computed constants."; + +%feature("docstring") libcellml::GeneratorProfile::implementationComputedConstantInfoString +"Returns the string for the implementation of some information about the different computed constants."; + +%feature("docstring") libcellml::GeneratorProfile::setImplementationComputedConstantInfoString +"Sets the string for the implementation of some information about the different computed constants. To be useful, the string +should contain the tag, which will be replaced with some information about the different computed constants."; + +%feature("docstring") libcellml::GeneratorProfile::interfaceAlgebraicInfoString +"Returns the string for the interface of some information about the different algebraic variables."; + +%feature("docstring") libcellml::GeneratorProfile::setInterfaceAlgebraicInfoString +"Sets the string for the interface of some information about the different algebraic variables."; + +%feature("docstring") libcellml::GeneratorProfile::implementationAlgebraicInfoString +"Returns the string for the implementation of some information about the different algebraic variables."; + +%feature("docstring") libcellml::GeneratorProfile::setImplementationAlgebraicInfoString +"Sets the string for the implementation of some information about the different algebraic variables. To be useful, the string +should contain the tag, which will be replaced with some information about the different algebraic variables."; + +%feature("docstring") libcellml::GeneratorProfile::interfaceExternalInfoString +"Returns the string for the interface of some information about the different external variables."; + +%feature("docstring") libcellml::GeneratorProfile::setInterfaceExternalInfoString +"Sets the string for the interface of some information about the different external variables."; + +%feature("docstring") libcellml::GeneratorProfile::implementationExternalInfoString +"Returns the string for the implementation of some information about the different external variables."; + +%feature("docstring") libcellml::GeneratorProfile::setImplementationExternalInfoString +"Sets the string for the implementation of some information about the different external variables. To be useful, the string +should contain the tag, which will be replaced with some information about the different external variables."; %feature("docstring") libcellml::GeneratorProfile::variableInfoEntryString "Returns the string for an entry in an array for some information about a variable."; diff --git a/src/bindings/javascript/generatorprofile.cpp b/src/bindings/javascript/generatorprofile.cpp index 8bb3e36c1a..b2fef805b6 100644 --- a/src/bindings/javascript/generatorprofile.cpp +++ b/src/bindings/javascript/generatorprofile.cpp @@ -291,10 +291,22 @@ EMSCRIPTEN_BINDINGS(libcellml_generatorprofile) .function("setInterfaceStateInfoString", &libcellml::GeneratorProfile::setInterfaceStateInfoString) .function("implementationStateInfoString", &libcellml::GeneratorProfile::implementationStateInfoString) .function("setImplementationStateInfoString", &libcellml::GeneratorProfile::setImplementationStateInfoString) - .function("interfaceVariableInfoString", &libcellml::GeneratorProfile::interfaceVariableInfoString) - .function("setInterfaceVariableInfoString", &libcellml::GeneratorProfile::setInterfaceVariableInfoString) - .function("implementationVariableInfoString", &libcellml::GeneratorProfile::implementationVariableInfoString) - .function("setImplementationVariableInfoString", &libcellml::GeneratorProfile::setImplementationVariableInfoString) + .function("interfaceConstantInfoString", &libcellml::GeneratorProfile::interfaceConstantInfoString) + .function("setInterfaceConstantInfoString", &libcellml::GeneratorProfile::setInterfaceConstantInfoString) + .function("implementationConstantInfoString", &libcellml::GeneratorProfile::implementationConstantInfoString) + .function("setImplementationConstantInfoString", &libcellml::GeneratorProfile::setImplementationConstantInfoString) + .function("interfaceComputedConstantInfoString", &libcellml::GeneratorProfile::interfaceComputedConstantInfoString) + .function("setInterfaceComputedConstantInfoString", &libcellml::GeneratorProfile::setInterfaceComputedConstantInfoString) + .function("implementationComputedConstantInfoString", &libcellml::GeneratorProfile::implementationComputedConstantInfoString) + .function("setImplementationComputedConstantInfoString", &libcellml::GeneratorProfile::setImplementationComputedConstantInfoString) + .function("interfaceAlgebraicInfoString", &libcellml::GeneratorProfile::interfaceAlgebraicInfoString) + .function("setInterfaceAlgebraicInfoString", &libcellml::GeneratorProfile::setInterfaceAlgebraicInfoString) + .function("implementationAlgebraicInfoString", &libcellml::GeneratorProfile::implementationAlgebraicInfoString) + .function("setImplementationAlgebraicInfoString", &libcellml::GeneratorProfile::setImplementationAlgebraicInfoString) + .function("interfaceExternalInfoString", &libcellml::GeneratorProfile::interfaceExternalInfoString) + .function("setInterfaceExternalInfoString", &libcellml::GeneratorProfile::setInterfaceExternalInfoString) + .function("implementationExternalInfoString", &libcellml::GeneratorProfile::implementationExternalInfoString) + .function("setImplementationExternalInfoString", &libcellml::GeneratorProfile::setImplementationExternalInfoString) .function("variableInfoEntryString", &libcellml::GeneratorProfile::variableInfoEntryString) .function("setVariableInfoEntryString", &libcellml::GeneratorProfile::setVariableInfoEntryString) .function("voiString", &libcellml::GeneratorProfile::voiString) diff --git a/src/generator.cpp b/src/generator.cpp index 4a280ce434..442fc9d1a8 100644 --- a/src/generator.cpp +++ b/src/generator.cpp @@ -408,7 +408,7 @@ std::string Generator::GeneratorImpl::generateVariableInfoEntryCode(const std::s "[TYPE]", type); } -void Generator::GeneratorImpl::addInterfaceVoiStateAndVariableInfoCode() +void Generator::GeneratorImpl::addInterfaceVariableInfoCode() { std::string code; @@ -422,127 +422,98 @@ void Generator::GeneratorImpl::addInterfaceVoiStateAndVariableInfoCode() code += mProfile->interfaceStateInfoString(); } - if (!mProfile->interfaceVariableInfoString().empty()) { - code += mProfile->interfaceVariableInfoString(); + if (!mProfile->interfaceConstantInfoString().empty()) { + code += mProfile->interfaceConstantInfoString(); } - if (!code.empty()) { - mCode += "\n"; + if (!mProfile->interfaceComputedConstantInfoString().empty()) { + code += mProfile->interfaceComputedConstantInfoString(); } - mCode += code; -} + if (!mProfile->interfaceAlgebraicInfoString().empty()) { + code += mProfile->interfaceAlgebraicInfoString(); + } -void Generator::GeneratorImpl::addImplementationVoiInfoCode() -{ - if (modelHasOdes() - && !mProfile->implementationVoiInfoString().empty() - && !mProfile->variableInfoEntryString().empty() - && !mProfile->variableOfIntegrationVariableTypeString().empty()) { - auto voiVariable = mModel->voi()->variable(); - auto name = voiVariable->name(); - auto units = voiVariable->units()->name(); - auto component = owningComponent(voiVariable)->name(); - auto type = mProfile->variableOfIntegrationVariableTypeString(); + if (mModel->hasExternalVariables() + && !mProfile->interfaceExternalInfoString().empty()) { + code += mProfile->interfaceExternalInfoString(); + } - mCode += newLineIfNeeded() - + replace(mProfile->implementationVoiInfoString(), - "[CODE]", generateVariableInfoEntryCode(name, units, component, type)); + if (!code.empty()) { + mCode += "\n"; } + + mCode += code; } -void Generator::GeneratorImpl::addImplementationStateInfoCode() +void Generator::GeneratorImpl::doAddImplementationVariableInfoCode(const std::string &variableInfoString, + const std::string &variableTypeString, + const std::vector &variables, + bool voiVariable) { - if (modelHasOdes() - && !mProfile->implementationStateInfoString().empty() + if (!variableInfoString.empty() && !mProfile->variableInfoEntryString().empty() - && !mProfile->stateVariableTypeString().empty() + && !variableTypeString.empty() && !mProfile->arrayElementSeparatorString().empty()) { std::string infoElementsCode; - auto type = mProfile->stateVariableTypeString(); - for (const auto &state : mModel->states()) { + for (const auto &variable : variables) { if (!infoElementsCode.empty()) { infoElementsCode += mProfile->arrayElementSeparatorString() + "\n"; } - auto stateVariable = state->variable(); + auto variableVariable = variable->variable(); - infoElementsCode += mProfile->indentString() - + generateVariableInfoEntryCode(stateVariable->name(), - stateVariable->units()->name(), - owningComponent(stateVariable)->name(), - type); + infoElementsCode += (voiVariable ? "" : mProfile->indentString()) + + generateVariableInfoEntryCode(variableVariable->name(), + variableVariable->units()->name(), + owningComponent(variableVariable)->name(), + variableTypeString); } - infoElementsCode += "\n"; + if (!voiVariable && !infoElementsCode.empty()) { + infoElementsCode += "\n"; + } mCode += newLineIfNeeded() - + replace(mProfile->implementationStateInfoString(), - "[CODE]", infoElementsCode); + + replace(variableInfoString, "[CODE]", infoElementsCode); } } void Generator::GeneratorImpl::addImplementationVariableInfoCode() { - if (!mProfile->implementationVariableInfoString().empty() - && !mProfile->variableInfoEntryString().empty() - && !mProfile->arrayElementSeparatorString().empty() - && !mProfile->variableOfIntegrationVariableTypeString().empty() - && !mProfile->stateVariableTypeString().empty() - && !mProfile->constantVariableTypeString().empty() - && !mProfile->computedConstantVariableTypeString().empty() - && !mProfile->algebraicVariableTypeString().empty() - && !mProfile->externalVariableTypeString().empty()) { - std::string infoElementsCode; + if (modelHasOdes()) { + std::vector variables; - for (const auto &variable : variables(mModel)) { - if (!infoElementsCode.empty()) { - infoElementsCode += mProfile->arrayElementSeparatorString() + "\n"; - } + variables.push_back(mModel->voi()); - std::string variableType; - - switch (variable->type()) { - case AnalyserVariable::Type::CONSTANT: - variableType = mProfile->constantVariableTypeString(); - - break; - case AnalyserVariable::Type::COMPUTED_CONSTANT: - variableType = mProfile->computedConstantVariableTypeString(); - - break; - case AnalyserVariable::Type::ALGEBRAIC: - variableType = mProfile->algebraicVariableTypeString(); - - break; - case AnalyserVariable::Type::EXTERNAL: - variableType = mProfile->externalVariableTypeString(); + doAddImplementationVariableInfoCode(mProfile->implementationVoiInfoString(), + mProfile->variableOfIntegrationVariableTypeString(), + variables, true); + } - break; - default: // Other types we don't care about. - break; - } + if (modelHasOdes()) { + doAddImplementationVariableInfoCode(mProfile->implementationStateInfoString(), + mProfile->stateVariableTypeString(), + mModel->states(), false); + } - if (!variableType.empty()) { - auto variableVariable = variable->variable(); + doAddImplementationVariableInfoCode(mProfile->implementationConstantInfoString(), + mProfile->constantVariableTypeString(), + mModel->constants(), false); - infoElementsCode += mProfile->indentString() - + replace(replace(replace(replace(mProfile->variableInfoEntryString(), - "[NAME]", variableVariable->name()), - "[UNITS]", variableVariable->units()->name()), - "[COMPONENT]", owningComponent(variableVariable)->name()), - "[TYPE]", variableType); - } - } + doAddImplementationVariableInfoCode(mProfile->implementationComputedConstantInfoString(), + mProfile->computedConstantVariableTypeString(), + mModel->computedConstants(), false); - if (!infoElementsCode.empty()) { - infoElementsCode += "\n"; - } + doAddImplementationVariableInfoCode(mProfile->implementationAlgebraicInfoString(), + mProfile->algebraicVariableTypeString(), + mModel->algebraic(), false); - mCode += newLineIfNeeded() - + replace(mProfile->implementationVariableInfoString(), - "[CODE]", infoElementsCode); + if (mModel->hasExternalVariables()) { + doAddImplementationVariableInfoCode(mProfile->implementationExternalInfoString(), + mProfile->externalVariableTypeString(), + mModel->externals(), false); } } @@ -2057,10 +2028,10 @@ std::string Generator::interfaceCode() const mPimpl->addVariableTypeObjectCode(); mPimpl->addVariableInfoObjectCode(); - // Add code for the interface of the information about the variable of - // integration, states and (other) variables. + // Add code for the interface of the information about the variable of integration, states, constants, computed + // constants, algebraic variables, and external variables. - mPimpl->addInterfaceVoiStateAndVariableInfoCode(); + mPimpl->addInterfaceVariableInfoCode(); // Add code for the interface to create and delete arrays. @@ -2113,11 +2084,9 @@ std::string Generator::implementationCode() const mPimpl->addVariableInfoObjectCode(); } - // Add code for the implementation of the information about the variable of - // integration, states and (other) variables. + // Add code for the implementation of the information about the variable of integration, states, constants, computed + // constants, algebraic variables, and external variables. - mPimpl->addImplementationVoiInfoCode(); - mPimpl->addImplementationStateInfoCode(); mPimpl->addImplementationVariableInfoCode(); // Add code for the arithmetic and trigonometric functions. diff --git a/src/generator_p.h b/src/generator_p.h index 4f9165da51..fd79ffbff8 100644 --- a/src/generator_p.h +++ b/src/generator_p.h @@ -93,9 +93,10 @@ struct Generator::GeneratorImpl const std::string &component, const std::string &type) const; - void addInterfaceVoiStateAndVariableInfoCode(); - void addImplementationVoiInfoCode(); - void addImplementationStateInfoCode(); + void addInterfaceVariableInfoCode(); + + void doAddImplementationVariableInfoCode(const std::string &variableInfoString, const std::string &variableTypeString, + const std::vector &variables, bool voiVariable); void addImplementationVariableInfoCode(); void addArithmeticFunctionsCode(); diff --git a/src/generatorprofile.cpp b/src/generatorprofile.cpp index ca8c24d907..4258948d4e 100644 --- a/src/generatorprofile.cpp +++ b/src/generatorprofile.cpp @@ -216,8 +216,17 @@ struct GeneratorProfile::GeneratorProfileImpl std::string mInterfaceStateInfoString; std::string mImplementationStateInfoString; - std::string mInterfaceVariableInfoString; - std::string mImplementationVariableInfoString; + std::string mInterfaceConstantInfoString; + std::string mImplementationConstantInfoString; + + std::string mInterfaceComputedConstantInfoString; + std::string mImplementationComputedConstantInfoString; + + std::string mInterfaceAlgebraicInfoString; + std::string mImplementationAlgebraicInfoString; + + std::string mInterfaceExternalInfoString; + std::string mImplementationExternalInfoString; std::string mVariableInfoEntryString; @@ -577,8 +586,23 @@ void GeneratorProfile::GeneratorProfileImpl::loadProfile(GeneratorProfile::Profi "[CODE]" "};\n"; - mInterfaceVariableInfoString = "extern const VariableInfo VARIABLE_INFO[];\n"; - mImplementationVariableInfoString = "const VariableInfo VARIABLE_INFO[] = {\n" + mInterfaceConstantInfoString = "extern const VariableInfo CONSTANT_INFO[];\n"; + mImplementationConstantInfoString = "const VariableInfo CONSTANT_INFO[] = {\n" + "[CODE]" + "};\n"; + + mInterfaceComputedConstantInfoString = "extern const VariableInfo COMPUTED_CONSTANT_INFO[];\n"; + mImplementationComputedConstantInfoString = "const VariableInfo COMPUTED_CONSTANT_INFO[] = {\n" + "[CODE]" + "};\n"; + + mInterfaceAlgebraicInfoString = "extern const VariableInfo ALGEBRAIC_INFO[];\n"; + mImplementationAlgebraicInfoString = "const VariableInfo ALGEBRAIC_INFO[] = {\n" + "[CODE]" + "};\n"; + + mInterfaceExternalInfoString = "extern const VariableInfo EXTERNAL_INFO[];\n"; + mImplementationExternalInfoString = "const VariableInfo EXTERNAL_INFO[] = {\n" "[CODE]" "};\n"; @@ -1012,12 +1036,25 @@ void GeneratorProfile::GeneratorProfileImpl::loadProfile(GeneratorProfile::Profi mImplementationVoiInfoString = "VOI_INFO = [CODE]\n"; mInterfaceStateInfoString = ""; - mImplementationStateInfoString = "STATE_INFO = [\n" - "[CODE]" - "]\n"; + mImplementationStateInfoString = "STATE_INFO = [CODE]\n"; - mInterfaceVariableInfoString = ""; - mImplementationVariableInfoString = "VARIABLE_INFO = [\n" + mInterfaceConstantInfoString = ""; + mImplementationConstantInfoString = "CONSTANT_INFO = [\n" + "[CODE]" + "]\n"; + + mInterfaceComputedConstantInfoString = ""; + mImplementationComputedConstantInfoString = "COMPUTED_CONSTANT_INFO = [\n" + "[CODE]" + "]\n"; + + mInterfaceAlgebraicInfoString = ""; + mImplementationAlgebraicInfoString = "ALGEBRAIC_INFO = [\n" + "[CODE]" + "]\n"; + + mInterfaceExternalInfoString = ""; + mImplementationExternalInfoString = "EXTERNAL_INFO = [\n" "[CODE]" "]\n"; @@ -2510,24 +2547,84 @@ void GeneratorProfile::setImplementationStateInfoString(const std::string &imple mPimpl->mImplementationStateInfoString = implementationStateInfoString; } -std::string GeneratorProfile::interfaceVariableInfoString() const +std::string GeneratorProfile::interfaceConstantInfoString() const +{ + return mPimpl->mInterfaceConstantInfoString; +} + +void GeneratorProfile::setInterfaceConstantInfoString(const std::string &interfaceConstantInfoString) +{ + mPimpl->mInterfaceConstantInfoString = interfaceConstantInfoString; +} + +std::string GeneratorProfile::implementationConstantInfoString() const +{ + return mPimpl->mImplementationConstantInfoString; +} + +void GeneratorProfile::setImplementationConstantInfoString(const std::string &implementationConstantInfoString) +{ + mPimpl->mImplementationConstantInfoString = implementationConstantInfoString; +} + +std::string GeneratorProfile::interfaceComputedConstantInfoString() const +{ + return mPimpl->mInterfaceComputedConstantInfoString; +} + +void GeneratorProfile::setInterfaceComputedConstantInfoString(const std::string &interfaceComputedConstantInfoString) +{ + mPimpl->mInterfaceComputedConstantInfoString = interfaceComputedConstantInfoString; +} + +std::string GeneratorProfile::implementationComputedConstantInfoString() const +{ + return mPimpl->mImplementationComputedConstantInfoString; +} + +void GeneratorProfile::setImplementationComputedConstantInfoString(const std::string &implementationComputedConstantInfoString) +{ + mPimpl->mImplementationComputedConstantInfoString = implementationComputedConstantInfoString; +} + +std::string GeneratorProfile::interfaceAlgebraicInfoString() const +{ + return mPimpl->mInterfaceAlgebraicInfoString; +} + +void GeneratorProfile::setInterfaceAlgebraicInfoString(const std::string &interfaceAlgebraicInfoString) +{ + mPimpl->mInterfaceAlgebraicInfoString = interfaceAlgebraicInfoString; +} + +std::string GeneratorProfile::implementationAlgebraicInfoString() const +{ + return mPimpl->mImplementationAlgebraicInfoString; +} + +void GeneratorProfile::setImplementationAlgebraicInfoString(const std::string &implementationAlgebraicInfoString) +{ + mPimpl->mImplementationAlgebraicInfoString = implementationAlgebraicInfoString; +} + +std::string GeneratorProfile::interfaceExternalInfoString() const { - return mPimpl->mInterfaceVariableInfoString; + return mPimpl->mInterfaceExternalInfoString; } -void GeneratorProfile::setInterfaceVariableInfoString(const std::string &interfaceVariableInfoString) +void GeneratorProfile::setInterfaceExternalInfoString(const std::string &interfaceExternalInfoString) { - mPimpl->mInterfaceVariableInfoString = interfaceVariableInfoString; + mPimpl->mInterfaceExternalInfoString = interfaceExternalInfoString; } -std::string GeneratorProfile::implementationVariableInfoString() const +std::string GeneratorProfile::implementationExternalInfoString() const { - return mPimpl->mImplementationVariableInfoString; + return mPimpl->mImplementationExternalInfoString; } -void GeneratorProfile::setImplementationVariableInfoString(const std::string &implementationVariableInfoString) +void GeneratorProfile::setImplementationExternalInfoString(const std::string &implementationExternalInfoString) { - mPimpl->mImplementationVariableInfoString = implementationVariableInfoString; + mPimpl->mImplementationExternalInfoString = implementationExternalInfoString; } std::string GeneratorProfile::variableInfoEntryString() const diff --git a/src/generatorprofilesha1values.h b/src/generatorprofilesha1values.h index 17c92162ad..5db086202d 100644 --- a/src/generatorprofilesha1values.h +++ b/src/generatorprofilesha1values.h @@ -24,7 +24,7 @@ namespace libcellml { * The content of this file is generated, do not edit this file directly. * See docs/dev_utilities.rst for further information. */ -static const char C_GENERATOR_PROFILE_SHA1[] = "d81a3e718069fa9628dccbda291fb3cf017a4cee"; -static const char PYTHON_GENERATOR_PROFILE_SHA1[] = "b23d6ef4b54a76f94812b78da59c2bae319bdf8d"; +static const char C_GENERATOR_PROFILE_SHA1[] = "51c71d6a06d1b6e38467cc3f333062d5be98fba1"; +static const char PYTHON_GENERATOR_PROFILE_SHA1[] = "710333a658fecca12a9ff0c6bf41dd45a12c0f35"; } // namespace libcellml diff --git a/src/generatorprofiletools.cpp b/src/generatorprofiletools.cpp index 3410a81023..f798af19dd 100644 --- a/src/generatorprofiletools.cpp +++ b/src/generatorprofiletools.cpp @@ -474,8 +474,17 @@ std::string generatorProfileAsString(const GeneratorProfilePtr &generatorProfile profileContents += generatorProfile->interfaceStateInfoString() + generatorProfile->implementationStateInfoString(); - profileContents += generatorProfile->interfaceVariableInfoString() - + generatorProfile->implementationVariableInfoString(); + profileContents += generatorProfile->interfaceConstantInfoString() + + generatorProfile->implementationConstantInfoString(); + + profileContents += generatorProfile->interfaceComputedConstantInfoString() + + generatorProfile->implementationComputedConstantInfoString(); + + profileContents += generatorProfile->interfaceAlgebraicInfoString() + + generatorProfile->implementationAlgebraicInfoString(); + + profileContents += generatorProfile->interfaceExternalInfoString() + + generatorProfile->implementationExternalInfoString(); profileContents += generatorProfile->variableInfoEntryString(); diff --git a/tests/bindings/javascript/generator.test.js b/tests/bindings/javascript/generator.test.js index bd854e65f8..112ca913e3 100644 --- a/tests/bindings/javascript/generator.test.js +++ b/tests/bindings/javascript/generator.test.js @@ -62,10 +62,10 @@ describe("Generator tests", () => { g.setModel(a.model()) const interface_lines = g.interfaceCode().split('\n') - expect(interface_lines.length).toBe(42) + expect(interface_lines.length).toBe(44) const implementation_lines = g.implementationCode().split('\n') - expect(implementation_lines.length).toBe(69) + expect(implementation_lines.length).toBe(66) const equation_line_1 = libcellml.Generator.equationCode(a.model().equation(0).ast()) expect(equation_line_1.length).toBe(14) diff --git a/tests/bindings/javascript/generatorprofile.test.js b/tests/bindings/javascript/generatorprofile.test.js index aa00a0e370..095d280520 100644 --- a/tests/bindings/javascript/generatorprofile.test.js +++ b/tests/bindings/javascript/generatorprofile.test.js @@ -810,17 +810,53 @@ describe("GeneratorProfile tests", () => { x.setImplementationStateInfoString("something") expect(x.implementationStateInfoString()).toBe("something") }); - test("Checking GeneratorProfile.interfaceVariableInfoString.", () => { + test("Checking GeneratorProfile.interfaceConstantInfoString.", () => { const x = new libcellml.GeneratorProfile(libcellml.GeneratorProfile.Profile.C) - x.setInterfaceVariableInfoString("something") - expect(x.interfaceVariableInfoString()).toBe("something") + x.setInterfaceConstantInfoString("something") + expect(x.interfaceConstantInfoString()).toBe("something") }); - test("Checking GeneratorProfile.implementationVariableInfoString.", () => { + test("Checking GeneratorProfile.implementationConstantInfoString.", () => { const x = new libcellml.GeneratorProfile(libcellml.GeneratorProfile.Profile.C) - x.setImplementationVariableInfoString("something") - expect(x.implementationVariableInfoString()).toBe("something") + x.setImplementationConstantInfoString("something") + expect(x.implementationConstantInfoString()).toBe("something") + }); + test("Checking GeneratorProfile.interfaceComputedConstantInfoString.", () => { + const x = new libcellml.GeneratorProfile(libcellml.GeneratorProfile.Profile.C) + + x.setInterfaceComputedConstantInfoString("something") + expect(x.interfaceComputedConstantInfoString()).toBe("something") + }); + test("Checking GeneratorProfile.implementationComputedConstantInfoString.", () => { + const x = new libcellml.GeneratorProfile(libcellml.GeneratorProfile.Profile.C) + + x.setImplementationComputedConstantInfoString("something") + expect(x.implementationComputedConstantInfoString()).toBe("something") + }); + test("Checking GeneratorProfile.interfaceAlgebraicInfoString.", () => { + const x = new libcellml.GeneratorProfile(libcellml.GeneratorProfile.Profile.C) + + x.setInterfaceAlgebraicInfoString("something") + expect(x.interfaceAlgebraicInfoString()).toBe("something") + }); + test("Checking GeneratorProfile.implementationAlgebraicInfoString.", () => { + const x = new libcellml.GeneratorProfile(libcellml.GeneratorProfile.Profile.C) + + x.setImplementationAlgebraicInfoString("something") + expect(x.implementationAlgebraicInfoString()).toBe("something") + }); + test("Checking GeneratorProfile.interfaceExternalInfoString.", () => { + const x = new libcellml.GeneratorProfile(libcellml.GeneratorProfile.Profile.C) + + x.setInterfaceExternalInfoString("something") + expect(x.interfaceExternalInfoString()).toBe("something") + }); + test("Checking GeneratorProfile.implementationExternalInfoString.", () => { + const x = new libcellml.GeneratorProfile(libcellml.GeneratorProfile.Profile.C) + + x.setImplementationExternalInfoString("something") + expect(x.implementationExternalInfoString()).toBe("something") }); test("Checking GeneratorProfile.variableInfoEntryString.", () => { const x = new libcellml.GeneratorProfile(libcellml.GeneratorProfile.Profile.C) diff --git a/tests/bindings/python/test_generator_profile.py b/tests/bindings/python/test_generator_profile.py index 7b3cbddb1b..ce31fc92c1 100644 --- a/tests/bindings/python/test_generator_profile.py +++ b/tests/bindings/python/test_generator_profile.py @@ -907,6 +907,42 @@ def test_implementation_state_info_string(self): g.setImplementationStateInfoString(GeneratorProfileTestCase.VALUE) self.assertEqual(GeneratorProfileTestCase.VALUE, g.implementationStateInfoString()) + def test_implementation_constant_info_string(self): + from libcellml import GeneratorProfile + + g = GeneratorProfile() + + self.assertEqual('const VariableInfo CONSTANT_INFO[] = {\n[CODE]};\n', g.implementationConstantInfoString()) + g.setImplementationConstantInfoString(GeneratorProfileTestCase.VALUE) + self.assertEqual(GeneratorProfileTestCase.VALUE, g.implementationConstantInfoString()) + + def test_implementation_computed_constant_info_string(self): + from libcellml import GeneratorProfile + + g = GeneratorProfile() + + self.assertEqual('const VariableInfo COMPUTED_CONSTANT_INFO[] = {\n[CODE]};\n', g.implementationComputedConstantInfoString()) + g.setImplementationComputedConstantInfoString(GeneratorProfileTestCase.VALUE) + self.assertEqual(GeneratorProfileTestCase.VALUE, g.implementationComputedConstantInfoString()) + + def test_implementation_algebraic_info_string(self): + from libcellml import GeneratorProfile + + g = GeneratorProfile() + + self.assertEqual('const VariableInfo ALGEBRAIC_INFO[] = {\n[CODE]};\n', g.implementationAlgebraicInfoString()) + g.setImplementationAlgebraicInfoString(GeneratorProfileTestCase.VALUE) + self.assertEqual(GeneratorProfileTestCase.VALUE, g.implementationAlgebraicInfoString()) + + def test_implementation_external_info_string(self): + from libcellml import GeneratorProfile + + g = GeneratorProfile() + + self.assertEqual('const VariableInfo EXTERNAL_INFO[] = {\n[CODE]};\n', g.implementationExternalInfoString()) + g.setImplementationExternalInfoString(GeneratorProfileTestCase.VALUE) + self.assertEqual(GeneratorProfileTestCase.VALUE, g.implementationExternalInfoString()) + def test_implementation_constant_count_string(self): from libcellml import GeneratorProfile @@ -943,16 +979,6 @@ def test_implementation_external_count_string(self): g.setImplementationExternalCountString(GeneratorProfileTestCase.VALUE) self.assertEqual(GeneratorProfileTestCase.VALUE, g.implementationExternalCountString()) - def test_implementation_variable_info_string(self): - from libcellml import GeneratorProfile - - g = GeneratorProfile() - - self.assertEqual('const VariableInfo VARIABLE_INFO[] = {\n[CODE]};\n', - g.implementationVariableInfoString()) - g.setImplementationVariableInfoString(GeneratorProfileTestCase.VALUE) - self.assertEqual(GeneratorProfileTestCase.VALUE, g.implementationVariableInfoString()) - def test_implementation_version_string(self): from libcellml import GeneratorProfile @@ -1142,6 +1168,42 @@ def test_interface_state_info_string(self): g.setInterfaceStateInfoString(GeneratorProfileTestCase.VALUE) self.assertEqual(GeneratorProfileTestCase.VALUE, g.interfaceStateInfoString()) + def test_interface_constant_info_string(self): + from libcellml import GeneratorProfile + + g = GeneratorProfile() + + self.assertEqual('extern const VariableInfo CONSTANT_INFO[];\n', g.interfaceConstantInfoString()) + g.setInterfaceConstantInfoString(GeneratorProfileTestCase.VALUE) + self.assertEqual(GeneratorProfileTestCase.VALUE, g.interfaceConstantInfoString()) + + def test_interface_computed_constant_info_string(self): + from libcellml import GeneratorProfile + + g = GeneratorProfile() + + self.assertEqual('extern const VariableInfo COMPUTED_CONSTANT_INFO[];\n', g.interfaceComputedConstantInfoString()) + g.setInterfaceComputedConstantInfoString(GeneratorProfileTestCase.VALUE) + self.assertEqual(GeneratorProfileTestCase.VALUE, g.interfaceComputedConstantInfoString()) + + def test_interface_algebraic_info_string(self): + from libcellml import GeneratorProfile + + g = GeneratorProfile() + + self.assertEqual('extern const VariableInfo ALGEBRAIC_INFO[];\n', g.interfaceAlgebraicInfoString()) + g.setInterfaceAlgebraicInfoString(GeneratorProfileTestCase.VALUE) + self.assertEqual(GeneratorProfileTestCase.VALUE, g.interfaceAlgebraicInfoString()) + + def test_interface_external_info_string(self): + from libcellml import GeneratorProfile + + g = GeneratorProfile() + + self.assertEqual('extern const VariableInfo EXTERNAL_INFO[];\n', g.interfaceExternalInfoString()) + g.setInterfaceExternalInfoString(GeneratorProfileTestCase.VALUE) + self.assertEqual(GeneratorProfileTestCase.VALUE, g.interfaceExternalInfoString()) + def test_interface_constant_count_string(self): from libcellml import GeneratorProfile @@ -1178,15 +1240,6 @@ def test_interface_external_count_string(self): g.setInterfaceExternalCountString(GeneratorProfileTestCase.VALUE) self.assertEqual(GeneratorProfileTestCase.VALUE, g.interfaceExternalCountString()) - def test_interface_variable_info_string(self): - from libcellml import GeneratorProfile - - g = GeneratorProfile() - - self.assertEqual('extern const VariableInfo VARIABLE_INFO[];\n', g.interfaceVariableInfoString()) - g.setInterfaceVariableInfoString(GeneratorProfileTestCase.VALUE) - self.assertEqual(GeneratorProfileTestCase.VALUE, g.interfaceVariableInfoString()) - def test_interface_version_string(self): from libcellml import GeneratorProfile diff --git a/tests/coverage/coverage.cpp b/tests/coverage/coverage.cpp index 096e40b79c..2a6a53ea78 100644 --- a/tests/coverage/coverage.cpp +++ b/tests/coverage/coverage.cpp @@ -736,7 +736,13 @@ TEST(Coverage, generator) profile->setImplementationStateInfoString(""); - profile->setImplementationVariableInfoString(""); + profile->setImplementationConstantInfoString(""); + + profile->setImplementationComputedConstantInfoString(""); + + profile->setImplementationAlgebraicInfoString(""); + + profile->setImplementationExternalInfoString(""); profile->setVariableInfoEntryString(""); @@ -823,8 +829,17 @@ TEST(Coverage, generator) profile->setInterfaceStateInfoString(""); profile->setImplementationStateInfoString(""); - profile->setInterfaceVariableInfoString(""); - profile->setImplementationVariableInfoString(""); + profile->setInterfaceConstantInfoString(""); + profile->setImplementationConstantInfoString(""); + + profile->setInterfaceComputedConstantInfoString(""); + profile->setImplementationComputedConstantInfoString(""); + + profile->setInterfaceAlgebraicInfoString(""); + profile->setImplementationAlgebraicInfoString(""); + + profile->setInterfaceExternalInfoString(""); + profile->setImplementationExternalInfoString(""); profile->setVariableInfoEntryString(""); diff --git a/tests/generator/generatorprofile.cpp b/tests/generator/generatorprofile.cpp index a055f922bb..7f079b5c0d 100644 --- a/tests/generator/generatorprofile.cpp +++ b/tests/generator/generatorprofile.cpp @@ -346,11 +346,29 @@ TEST(GeneratorProfile, defaultMiscellaneousValues) "};\n", generatorProfile->implementationStateInfoString()); - EXPECT_EQ("extern const VariableInfo VARIABLE_INFO[];\n", generatorProfile->interfaceVariableInfoString()); - EXPECT_EQ("const VariableInfo VARIABLE_INFO[] = {\n" + EXPECT_EQ("extern const VariableInfo CONSTANT_INFO[];\n", generatorProfile->interfaceConstantInfoString()); + EXPECT_EQ("const VariableInfo CONSTANT_INFO[] = {\n" "[CODE]" "};\n", - generatorProfile->implementationVariableInfoString()); + generatorProfile->implementationConstantInfoString()); + + EXPECT_EQ("extern const VariableInfo COMPUTED_CONSTANT_INFO[];\n", generatorProfile->interfaceComputedConstantInfoString()); + EXPECT_EQ("const VariableInfo COMPUTED_CONSTANT_INFO[] = {\n" + "[CODE]" + "};\n", + generatorProfile->implementationComputedConstantInfoString()); + + EXPECT_EQ("extern const VariableInfo ALGEBRAIC_INFO[];\n", generatorProfile->interfaceAlgebraicInfoString()); + EXPECT_EQ("const VariableInfo ALGEBRAIC_INFO[] = {\n" + "[CODE]" + "};\n", + generatorProfile->implementationAlgebraicInfoString()); + + EXPECT_EQ("extern const VariableInfo EXTERNAL_INFO[];\n", generatorProfile->interfaceExternalInfoString()); + EXPECT_EQ("const VariableInfo EXTERNAL_INFO[] = {\n" + "[CODE]" + "};\n", + generatorProfile->implementationExternalInfoString()); EXPECT_EQ("{\"[NAME]\", \"[UNITS]\", \"[COMPONENT]\", [TYPE]}", generatorProfile->variableInfoEntryString()); @@ -908,8 +926,17 @@ TEST(GeneratorProfile, miscellaneous) generatorProfile->setInterfaceStateInfoString(value); generatorProfile->setImplementationStateInfoString(value); - generatorProfile->setInterfaceVariableInfoString(value); - generatorProfile->setImplementationVariableInfoString(value); + generatorProfile->setInterfaceConstantInfoString(value); + generatorProfile->setImplementationConstantInfoString(value); + + generatorProfile->setInterfaceComputedConstantInfoString(value); + generatorProfile->setImplementationComputedConstantInfoString(value); + + generatorProfile->setInterfaceAlgebraicInfoString(value); + generatorProfile->setImplementationAlgebraicInfoString(value); + + generatorProfile->setInterfaceExternalInfoString(value); + generatorProfile->setImplementationExternalInfoString(value); generatorProfile->setVariableInfoEntryString(value); @@ -1048,8 +1075,17 @@ TEST(GeneratorProfile, miscellaneous) EXPECT_EQ(value, generatorProfile->interfaceStateInfoString()); EXPECT_EQ(value, generatorProfile->implementationStateInfoString()); - EXPECT_EQ(value, generatorProfile->interfaceVariableInfoString()); - EXPECT_EQ(value, generatorProfile->implementationVariableInfoString()); + EXPECT_EQ(value, generatorProfile->interfaceConstantInfoString()); + EXPECT_EQ(value, generatorProfile->implementationConstantInfoString()); + + EXPECT_EQ(value, generatorProfile->interfaceComputedConstantInfoString()); + EXPECT_EQ(value, generatorProfile->implementationComputedConstantInfoString()); + + EXPECT_EQ(value, generatorProfile->interfaceAlgebraicInfoString()); + EXPECT_EQ(value, generatorProfile->implementationAlgebraicInfoString()); + + EXPECT_EQ(value, generatorProfile->interfaceExternalInfoString()); + EXPECT_EQ(value, generatorProfile->implementationExternalInfoString()); EXPECT_EQ(value, generatorProfile->variableInfoEntryString()); diff --git a/tests/resources/coverage/generator/model.c b/tests/resources/coverage/generator/model.c index aa1b69f193..c354ffd2c6 100644 --- a/tests/resources/coverage/generator/model.c +++ b/tests/resources/coverage/generator/model.c @@ -19,14 +19,17 @@ const VariableInfo STATE_INFO[] = { {"x", "dimensionless", "my_component", STATE} }; -const VariableInfo VARIABLE_INFO[] = { +const VariableInfo CONSTANT_INFO[] = { {"m", "dimensionless", "my_component", CONSTANT}, {"n", "dimensionless", "my_component", CONSTANT}, {"o", "dimensionless", "my_component", CONSTANT}, {"p", "dimensionless", "my_component", CONSTANT}, {"q", "dimensionless", "my_component", CONSTANT}, {"r", "dimensionless", "my_component", CONSTANT}, - {"s", "dimensionless", "my_component", CONSTANT}, + {"s", "dimensionless", "my_component", CONSTANT} +}; + +const VariableInfo COMPUTED_CONSTANT_INFO[] = { {"eqnEq", "dimensionless", "my_component", COMPUTED_CONSTANT}, {"eqnEqCoverageParentheses", "dimensionless", "my_component", COMPUTED_CONSTANT}, {"eqnNeq", "dimensionless", "my_component", COMPUTED_CONSTANT}, @@ -226,7 +229,10 @@ const VariableInfo VARIABLE_INFO[] = { {"eqnCoverageForRootOperator", "dimensionless", "my_component", COMPUTED_CONSTANT}, {"eqnCoverageForMinusUnary", "dimensionless", "my_component", COMPUTED_CONSTANT}, {"eqnComputedConstant1", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnComputedConstant2", "dimensionless", "my_component", COMPUTED_CONSTANT}, + {"eqnComputedConstant2", "dimensionless", "my_component", COMPUTED_CONSTANT} +}; + +const VariableInfo ALGEBRAIC_INFO[] = { {"eqnNlaVariable1", "dimensionless", "my_component", ALGEBRAIC}, {"eqnNlaVariable2", "dimensionless", "my_component", ALGEBRAIC} }; diff --git a/tests/resources/coverage/generator/model.h b/tests/resources/coverage/generator/model.h index e05872689b..07d230338b 100644 --- a/tests/resources/coverage/generator/model.h +++ b/tests/resources/coverage/generator/model.h @@ -29,7 +29,9 @@ typedef struct { extern const VariableInfo VOI_INFO; extern const VariableInfo STATE_INFO[]; -extern const VariableInfo VARIABLE_INFO[]; +extern const VariableInfo CONSTANT_INFO[]; +extern const VariableInfo COMPUTED_CONSTANT_INFO[]; +extern const VariableInfo ALGEBRAIC_INFO[]; double * createStatesArray(); double * createVariablesArray(); diff --git a/tests/resources/coverage/generator/model.modified.profile.c b/tests/resources/coverage/generator/model.modified.profile.c index 01e2454c30..b81232df93 100644 --- a/tests/resources/coverage/generator/model.modified.profile.c +++ b/tests/resources/coverage/generator/model.modified.profile.c @@ -19,14 +19,17 @@ const VariableInfo STATE_INFO[] = { {"x", "dimensionless", "my_component", STATE} }; -const VariableInfo VARIABLE_INFO[] = { +const VariableInfo CONSTANT_INFO[] = { {"m", "dimensionless", "my_component", CONSTANT}, {"n", "dimensionless", "my_component", CONSTANT}, {"o", "dimensionless", "my_component", CONSTANT}, {"p", "dimensionless", "my_component", CONSTANT}, {"q", "dimensionless", "my_component", CONSTANT}, {"r", "dimensionless", "my_component", CONSTANT}, - {"s", "dimensionless", "my_component", CONSTANT}, + {"s", "dimensionless", "my_component", CONSTANT} +}; + +const VariableInfo COMPUTED_CONSTANT_INFO[] = { {"eqnEq", "dimensionless", "my_component", COMPUTED_CONSTANT}, {"eqnEqCoverageParentheses", "dimensionless", "my_component", COMPUTED_CONSTANT}, {"eqnNeq", "dimensionless", "my_component", COMPUTED_CONSTANT}, @@ -226,7 +229,10 @@ const VariableInfo VARIABLE_INFO[] = { {"eqnCoverageForRootOperator", "dimensionless", "my_component", COMPUTED_CONSTANT}, {"eqnCoverageForMinusUnary", "dimensionless", "my_component", COMPUTED_CONSTANT}, {"eqnComputedConstant1", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnComputedConstant2", "dimensionless", "my_component", COMPUTED_CONSTANT}, + {"eqnComputedConstant2", "dimensionless", "my_component", COMPUTED_CONSTANT} +}; + +const VariableInfo ALGEBRAIC_INFO[] = { {"eqnNlaVariable1", "dimensionless", "my_component", ALGEBRAIC}, {"eqnNlaVariable2", "dimensionless", "my_component", ALGEBRAIC} }; diff --git a/tests/resources/coverage/generator/model.modified.profile.h b/tests/resources/coverage/generator/model.modified.profile.h index ef3a093e68..7bb7462bec 100644 --- a/tests/resources/coverage/generator/model.modified.profile.h +++ b/tests/resources/coverage/generator/model.modified.profile.h @@ -29,7 +29,9 @@ typedef struct { extern const VariableInfo VOI_INFO; extern const VariableInfo STATE_INFO[]; -extern const VariableInfo VARIABLE_INFO[]; +extern const VariableInfo CONSTANT_INFO[]; +extern const VariableInfo COMPUTED_CONSTANT_INFO[]; +extern const VariableInfo ALGEBRAIC_INFO[]; double * createStatesVector(); double * createVariablesArray(); diff --git a/tests/resources/coverage/generator/model.modified.profile.py b/tests/resources/coverage/generator/model.modified.profile.py index cd37464781..c7b36b99de 100644 --- a/tests/resources/coverage/generator/model.modified.profile.py +++ b/tests/resources/coverage/generator/model.modified.profile.py @@ -23,18 +23,20 @@ class VariableType(Enum): VOI_INFO = {"name": "t", "units": "second", "component": "my_component", "type": VariableType.VARIABLE_OF_INTEGRATION} -STATE_INFO = [ - {"name": "x", "units": "dimensionless", "component": "my_component", "type": VariableType.STATE} -] +STATE_INFO = {"name": "x", "units": "dimensionless", "component": "my_component", "type": VariableType.STATE} + -VARIABLE_INFO = [ +CONSTANT_INFO = [ {"name": "m", "units": "dimensionless", "component": "my_component", "type": VariableType.CONSTANT}, {"name": "n", "units": "dimensionless", "component": "my_component", "type": VariableType.CONSTANT}, {"name": "o", "units": "dimensionless", "component": "my_component", "type": VariableType.CONSTANT}, {"name": "p", "units": "dimensionless", "component": "my_component", "type": VariableType.CONSTANT}, {"name": "q", "units": "dimensionless", "component": "my_component", "type": VariableType.CONSTANT}, {"name": "r", "units": "dimensionless", "component": "my_component", "type": VariableType.CONSTANT}, - {"name": "s", "units": "dimensionless", "component": "my_component", "type": VariableType.CONSTANT}, + {"name": "s", "units": "dimensionless", "component": "my_component", "type": VariableType.CONSTANT} +] + +COMPUTED_CONSTANT_INFO = [ {"name": "eqnEq", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, {"name": "eqnEqCoverageParentheses", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, {"name": "eqnNeq", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, @@ -234,7 +236,10 @@ class VariableType(Enum): {"name": "eqnCoverageForRootOperator", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, {"name": "eqnCoverageForMinusUnary", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, {"name": "eqnComputedConstant1", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnComputedConstant2", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, + {"name": "eqnComputedConstant2", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT} +] + +ALGEBRAIC_INFO = [ {"name": "eqnNlaVariable1", "units": "dimensionless", "component": "my_component", "type": VariableType.ALGEBRAIC}, {"name": "eqnNlaVariable2", "units": "dimensionless", "component": "my_component", "type": VariableType.ALGEBRAIC} ] diff --git a/tests/resources/coverage/generator/model.py b/tests/resources/coverage/generator/model.py index 07afa2a6b5..bea011a82b 100644 --- a/tests/resources/coverage/generator/model.py +++ b/tests/resources/coverage/generator/model.py @@ -23,18 +23,20 @@ class VariableType(Enum): VOI_INFO = {"name": "t", "units": "second", "component": "my_component", "type": VariableType.VARIABLE_OF_INTEGRATION} -STATE_INFO = [ - {"name": "x", "units": "dimensionless", "component": "my_component", "type": VariableType.STATE} -] +STATE_INFO = {"name": "x", "units": "dimensionless", "component": "my_component", "type": VariableType.STATE} + -VARIABLE_INFO = [ +CONSTANT_INFO = [ {"name": "m", "units": "dimensionless", "component": "my_component", "type": VariableType.CONSTANT}, {"name": "n", "units": "dimensionless", "component": "my_component", "type": VariableType.CONSTANT}, {"name": "o", "units": "dimensionless", "component": "my_component", "type": VariableType.CONSTANT}, {"name": "p", "units": "dimensionless", "component": "my_component", "type": VariableType.CONSTANT}, {"name": "q", "units": "dimensionless", "component": "my_component", "type": VariableType.CONSTANT}, {"name": "r", "units": "dimensionless", "component": "my_component", "type": VariableType.CONSTANT}, - {"name": "s", "units": "dimensionless", "component": "my_component", "type": VariableType.CONSTANT}, + {"name": "s", "units": "dimensionless", "component": "my_component", "type": VariableType.CONSTANT} +] + +COMPUTED_CONSTANT_INFO = [ {"name": "eqnEq", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, {"name": "eqnEqCoverageParentheses", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, {"name": "eqnNeq", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, @@ -234,7 +236,10 @@ class VariableType(Enum): {"name": "eqnCoverageForRootOperator", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, {"name": "eqnCoverageForMinusUnary", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, {"name": "eqnComputedConstant1", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnComputedConstant2", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, + {"name": "eqnComputedConstant2", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT} +] + +ALGEBRAIC_INFO = [ {"name": "eqnNlaVariable1", "units": "dimensionless", "component": "my_component", "type": VariableType.ALGEBRAIC}, {"name": "eqnNlaVariable2", "units": "dimensionless", "component": "my_component", "type": VariableType.ALGEBRAIC} ] diff --git a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.c b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.c index ef4da021e4..93b538b35d 100644 --- a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.c +++ b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.c @@ -12,11 +12,17 @@ const size_t CONSTANT_COUNT = 0; const size_t COMPUTED_CONSTANT_COUNT = 2; const size_t ALGEBRAIC_COUNT = 0; -const VariableInfo VARIABLE_INFO[] = { +const VariableInfo CONSTANT_INFO[] = { +}; + +const VariableInfo COMPUTED_CONSTANT_INFO[] = { {"x", "dimensionless", "my_algebraic_eqn", COMPUTED_CONSTANT}, {"a", "dimensionless", "my_algebraic_eqn", COMPUTED_CONSTANT} }; +const VariableInfo ALGEBRAIC_INFO[] = { +}; + double * createVariablesArray() { double *res = (double *) malloc(VARIABLE_COUNT*sizeof(double)); diff --git a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.c b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.c index 37cec86d32..4d448046df 100644 --- a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.c +++ b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.c @@ -13,8 +13,17 @@ const size_t COMPUTED_CONSTANT_COUNT = 0; const size_t ALGEBRAIC_COUNT = 1; const size_t EXTERNAL_COUNT = 1; -const VariableInfo VARIABLE_INFO[] = { - {"x", "dimensionless", "my_algebraic_eqn", ALGEBRAIC}, +const VariableInfo CONSTANT_INFO[] = { +}; + +const VariableInfo COMPUTED_CONSTANT_INFO[] = { +}; + +const VariableInfo ALGEBRAIC_INFO[] = { + {"x", "dimensionless", "my_algebraic_eqn", ALGEBRAIC} +}; + +const VariableInfo EXTERNAL_INFO[] = { {"a", "dimensionless", "my_algebraic_eqn", EXTERNAL} }; diff --git a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.h b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.h index 9763338779..da181acb28 100644 --- a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.h +++ b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.h @@ -26,7 +26,10 @@ typedef struct { VariableType type; } VariableInfo; -extern const VariableInfo VARIABLE_INFO[]; +extern const VariableInfo CONSTANT_INFO[]; +extern const VariableInfo COMPUTED_CONSTANT_INFO[]; +extern const VariableInfo ALGEBRAIC_INFO[]; +extern const VariableInfo EXTERNAL_INFO[]; double * createVariablesArray(); void deleteArray(double *array); diff --git a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.py b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.py index 7168da1a35..267f46df4f 100644 --- a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.py +++ b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.py @@ -20,8 +20,17 @@ class VariableType(Enum): EXTERNAL = 3 -VARIABLE_INFO = [ - {"name": "x", "units": "dimensionless", "component": "my_algebraic_eqn", "type": VariableType.ALGEBRAIC}, +CONSTANT_INFO = [ +] + +COMPUTED_CONSTANT_INFO = [ +] + +ALGEBRAIC_INFO = [ + {"name": "x", "units": "dimensionless", "component": "my_algebraic_eqn", "type": VariableType.ALGEBRAIC} +] + +EXTERNAL_INFO = [ {"name": "a", "units": "dimensionless", "component": "my_algebraic_eqn", "type": VariableType.EXTERNAL} ] diff --git a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.h b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.h index 8b9a1fb666..a14bcb3994 100644 --- a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.h +++ b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.h @@ -24,7 +24,9 @@ typedef struct { VariableType type; } VariableInfo; -extern const VariableInfo VARIABLE_INFO[]; +extern const VariableInfo CONSTANT_INFO[]; +extern const VariableInfo COMPUTED_CONSTANT_INFO[]; +extern const VariableInfo ALGEBRAIC_INFO[]; double * createVariablesArray(); void deleteArray(double *array); diff --git a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.py b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.py index c3b91e3df4..f4989919ea 100644 --- a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.py +++ b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.py @@ -18,11 +18,17 @@ class VariableType(Enum): ALGEBRAIC = 2 -VARIABLE_INFO = [ +CONSTANT_INFO = [ +] + +COMPUTED_CONSTANT_INFO = [ {"name": "x", "units": "dimensionless", "component": "my_algebraic_eqn", "type": VariableType.COMPUTED_CONSTANT}, {"name": "a", "units": "dimensionless", "component": "my_algebraic_eqn", "type": VariableType.COMPUTED_CONSTANT} ] +ALGEBRAIC_INFO = [ +] + def create_variables_array(): return [nan]*VARIABLE_COUNT diff --git a/tests/resources/generator/algebraic_eqn_const_var_on_rhs/model.c b/tests/resources/generator/algebraic_eqn_const_var_on_rhs/model.c index b9b36994d3..55fb1236ad 100644 --- a/tests/resources/generator/algebraic_eqn_const_var_on_rhs/model.c +++ b/tests/resources/generator/algebraic_eqn_const_var_on_rhs/model.c @@ -12,11 +12,17 @@ const size_t CONSTANT_COUNT = 1; const size_t COMPUTED_CONSTANT_COUNT = 1; const size_t ALGEBRAIC_COUNT = 0; -const VariableInfo VARIABLE_INFO[] = { - {"a", "dimensionless", "my_algebraic_eqn", CONSTANT}, +const VariableInfo CONSTANT_INFO[] = { + {"a", "dimensionless", "my_algebraic_eqn", CONSTANT} +}; + +const VariableInfo COMPUTED_CONSTANT_INFO[] = { {"x", "dimensionless", "my_algebraic_eqn", COMPUTED_CONSTANT} }; +const VariableInfo ALGEBRAIC_INFO[] = { +}; + double * createVariablesArray() { double *res = (double *) malloc(VARIABLE_COUNT*sizeof(double)); diff --git a/tests/resources/generator/algebraic_eqn_const_var_on_rhs/model.h b/tests/resources/generator/algebraic_eqn_const_var_on_rhs/model.h index 8b9a1fb666..a14bcb3994 100644 --- a/tests/resources/generator/algebraic_eqn_const_var_on_rhs/model.h +++ b/tests/resources/generator/algebraic_eqn_const_var_on_rhs/model.h @@ -24,7 +24,9 @@ typedef struct { VariableType type; } VariableInfo; -extern const VariableInfo VARIABLE_INFO[]; +extern const VariableInfo CONSTANT_INFO[]; +extern const VariableInfo COMPUTED_CONSTANT_INFO[]; +extern const VariableInfo ALGEBRAIC_INFO[]; double * createVariablesArray(); void deleteArray(double *array); diff --git a/tests/resources/generator/algebraic_eqn_const_var_on_rhs/model.py b/tests/resources/generator/algebraic_eqn_const_var_on_rhs/model.py index 034cacb34e..a6562fdf52 100644 --- a/tests/resources/generator/algebraic_eqn_const_var_on_rhs/model.py +++ b/tests/resources/generator/algebraic_eqn_const_var_on_rhs/model.py @@ -18,11 +18,17 @@ class VariableType(Enum): ALGEBRAIC = 2 -VARIABLE_INFO = [ - {"name": "a", "units": "dimensionless", "component": "my_algebraic_eqn", "type": VariableType.CONSTANT}, +CONSTANT_INFO = [ + {"name": "a", "units": "dimensionless", "component": "my_algebraic_eqn", "type": VariableType.CONSTANT} +] + +COMPUTED_CONSTANT_INFO = [ {"name": "x", "units": "dimensionless", "component": "my_algebraic_eqn", "type": VariableType.COMPUTED_CONSTANT} ] +ALGEBRAIC_INFO = [ +] + def create_variables_array(): return [nan]*VARIABLE_COUNT diff --git a/tests/resources/generator/algebraic_eqn_constant_on_rhs/model.c b/tests/resources/generator/algebraic_eqn_constant_on_rhs/model.c index 5e25719055..0c647741fb 100644 --- a/tests/resources/generator/algebraic_eqn_constant_on_rhs/model.c +++ b/tests/resources/generator/algebraic_eqn_constant_on_rhs/model.c @@ -12,10 +12,16 @@ const size_t CONSTANT_COUNT = 0; const size_t COMPUTED_CONSTANT_COUNT = 1; const size_t ALGEBRAIC_COUNT = 0; -const VariableInfo VARIABLE_INFO[] = { +const VariableInfo CONSTANT_INFO[] = { +}; + +const VariableInfo COMPUTED_CONSTANT_INFO[] = { {"x", "dimensionless", "my_component", COMPUTED_CONSTANT} }; +const VariableInfo ALGEBRAIC_INFO[] = { +}; + double * createVariablesArray() { double *res = (double *) malloc(VARIABLE_COUNT*sizeof(double)); diff --git a/tests/resources/generator/algebraic_eqn_constant_on_rhs/model.h b/tests/resources/generator/algebraic_eqn_constant_on_rhs/model.h index d26413c671..2e7b0dd0b1 100644 --- a/tests/resources/generator/algebraic_eqn_constant_on_rhs/model.h +++ b/tests/resources/generator/algebraic_eqn_constant_on_rhs/model.h @@ -24,7 +24,9 @@ typedef struct { VariableType type; } VariableInfo; -extern const VariableInfo VARIABLE_INFO[]; +extern const VariableInfo CONSTANT_INFO[]; +extern const VariableInfo COMPUTED_CONSTANT_INFO[]; +extern const VariableInfo ALGEBRAIC_INFO[]; double * createVariablesArray(); void deleteArray(double *array); diff --git a/tests/resources/generator/algebraic_eqn_constant_on_rhs/model.py b/tests/resources/generator/algebraic_eqn_constant_on_rhs/model.py index b36b39ca8b..8c32d995f3 100644 --- a/tests/resources/generator/algebraic_eqn_constant_on_rhs/model.py +++ b/tests/resources/generator/algebraic_eqn_constant_on_rhs/model.py @@ -18,10 +18,16 @@ class VariableType(Enum): ALGEBRAIC = 2 -VARIABLE_INFO = [ +CONSTANT_INFO = [ +] + +COMPUTED_CONSTANT_INFO = [ {"name": "x", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT} ] +ALGEBRAIC_INFO = [ +] + def create_variables_array(): return [nan]*VARIABLE_COUNT diff --git a/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.c b/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.c index 5f56854dda..ec215a064d 100644 --- a/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.c +++ b/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.c @@ -19,8 +19,14 @@ const VariableInfo STATE_INFO[] = { {"v", "dimensionless", "my_ode", STATE} }; -const VariableInfo VARIABLE_INFO[] = { - {"a", "per_s", "my_ode", COMPUTED_CONSTANT}, +const VariableInfo CONSTANT_INFO[] = { +}; + +const VariableInfo COMPUTED_CONSTANT_INFO[] = { + {"a", "per_s", "my_ode", COMPUTED_CONSTANT} +}; + +const VariableInfo ALGEBRAIC_INFO[] = { {"x", "per_s", "my_algebraic_eqn", ALGEBRAIC} }; diff --git a/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.h b/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.h index 1eeee2f1e3..bb606064c9 100644 --- a/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.h +++ b/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.h @@ -29,7 +29,9 @@ typedef struct { extern const VariableInfo VOI_INFO; extern const VariableInfo STATE_INFO[]; -extern const VariableInfo VARIABLE_INFO[]; +extern const VariableInfo CONSTANT_INFO[]; +extern const VariableInfo COMPUTED_CONSTANT_INFO[]; +extern const VariableInfo ALGEBRAIC_INFO[]; double * createStatesArray(); double * createVariablesArray(); diff --git a/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.py b/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.py index b68e0ff042..9a708f2353 100644 --- a/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.py +++ b/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.py @@ -23,12 +23,17 @@ class VariableType(Enum): VOI_INFO = {"name": "t", "units": "second", "component": "environment", "type": VariableType.VARIABLE_OF_INTEGRATION} -STATE_INFO = [ - {"name": "v", "units": "dimensionless", "component": "my_ode", "type": VariableType.STATE} +STATE_INFO = {"name": "v", "units": "dimensionless", "component": "my_ode", "type": VariableType.STATE} + + +CONSTANT_INFO = [ +] + +COMPUTED_CONSTANT_INFO = [ + {"name": "a", "units": "per_s", "component": "my_ode", "type": VariableType.COMPUTED_CONSTANT} ] -VARIABLE_INFO = [ - {"name": "a", "units": "per_s", "component": "my_ode", "type": VariableType.COMPUTED_CONSTANT}, +ALGEBRAIC_INFO = [ {"name": "x", "units": "per_s", "component": "my_algebraic_eqn", "type": VariableType.ALGEBRAIC} ] diff --git a/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.c b/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.c index 4449ebc701..1ca2804815 100644 --- a/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.c +++ b/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.c @@ -19,8 +19,14 @@ const VariableInfo STATE_INFO[] = { {"v", "dimensionless", "my_component", STATE} }; -const VariableInfo VARIABLE_INFO[] = { - {"a", "per_s", "my_component", COMPUTED_CONSTANT}, +const VariableInfo CONSTANT_INFO[] = { +}; + +const VariableInfo COMPUTED_CONSTANT_INFO[] = { + {"a", "per_s", "my_component", COMPUTED_CONSTANT} +}; + +const VariableInfo ALGEBRAIC_INFO[] = { {"x", "per_s", "my_component", ALGEBRAIC} }; diff --git a/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.h b/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.h index ca79cc5f25..ec10997670 100644 --- a/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.h +++ b/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.h @@ -29,7 +29,9 @@ typedef struct { extern const VariableInfo VOI_INFO; extern const VariableInfo STATE_INFO[]; -extern const VariableInfo VARIABLE_INFO[]; +extern const VariableInfo CONSTANT_INFO[]; +extern const VariableInfo COMPUTED_CONSTANT_INFO[]; +extern const VariableInfo ALGEBRAIC_INFO[]; double * createStatesArray(); double * createVariablesArray(); diff --git a/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.py b/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.py index 3228a39f5b..b0f2b7a22e 100644 --- a/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.py +++ b/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.py @@ -23,12 +23,17 @@ class VariableType(Enum): VOI_INFO = {"name": "t", "units": "second", "component": "my_component", "type": VariableType.VARIABLE_OF_INTEGRATION} -STATE_INFO = [ - {"name": "v", "units": "dimensionless", "component": "my_component", "type": VariableType.STATE} +STATE_INFO = {"name": "v", "units": "dimensionless", "component": "my_component", "type": VariableType.STATE} + + +CONSTANT_INFO = [ +] + +COMPUTED_CONSTANT_INFO = [ + {"name": "a", "units": "per_s", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT} ] -VARIABLE_INFO = [ - {"name": "a", "units": "per_s", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, +ALGEBRAIC_INFO = [ {"name": "x", "units": "per_s", "component": "my_component", "type": VariableType.ALGEBRAIC} ] diff --git a/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.c b/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.c index 32f1de15fa..3a887564d0 100644 --- a/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.c +++ b/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.c @@ -19,8 +19,14 @@ const VariableInfo STATE_INFO[] = { {"x", "dimensionless", "my_ode", STATE} }; -const VariableInfo VARIABLE_INFO[] = { - {"a", "per_s", "my_ode", COMPUTED_CONSTANT}, +const VariableInfo CONSTANT_INFO[] = { +}; + +const VariableInfo COMPUTED_CONSTANT_INFO[] = { + {"a", "per_s", "my_ode", COMPUTED_CONSTANT} +}; + +const VariableInfo ALGEBRAIC_INFO[] = { {"xx", "dimensionless", "my_algebraic_eqn", ALGEBRAIC} }; diff --git a/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.h b/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.h index d2a3025e39..ca2d89ac46 100644 --- a/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.h +++ b/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.h @@ -29,7 +29,9 @@ typedef struct { extern const VariableInfo VOI_INFO; extern const VariableInfo STATE_INFO[]; -extern const VariableInfo VARIABLE_INFO[]; +extern const VariableInfo CONSTANT_INFO[]; +extern const VariableInfo COMPUTED_CONSTANT_INFO[]; +extern const VariableInfo ALGEBRAIC_INFO[]; double * createStatesArray(); double * createVariablesArray(); diff --git a/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.py b/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.py index 44baf1642b..30fb1833db 100644 --- a/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.py +++ b/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.py @@ -23,12 +23,17 @@ class VariableType(Enum): VOI_INFO = {"name": "t", "units": "second", "component": "environment", "type": VariableType.VARIABLE_OF_INTEGRATION} -STATE_INFO = [ - {"name": "x", "units": "dimensionless", "component": "my_ode", "type": VariableType.STATE} +STATE_INFO = {"name": "x", "units": "dimensionless", "component": "my_ode", "type": VariableType.STATE} + + +CONSTANT_INFO = [ +] + +COMPUTED_CONSTANT_INFO = [ + {"name": "a", "units": "per_s", "component": "my_ode", "type": VariableType.COMPUTED_CONSTANT} ] -VARIABLE_INFO = [ - {"name": "a", "units": "per_s", "component": "my_ode", "type": VariableType.COMPUTED_CONSTANT}, +ALGEBRAIC_INFO = [ {"name": "xx", "units": "dimensionless", "component": "my_algebraic_eqn", "type": VariableType.ALGEBRAIC} ] diff --git a/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.c b/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.c index 352e5bd87c..c25242a83d 100644 --- a/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.c +++ b/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.c @@ -19,8 +19,14 @@ const VariableInfo STATE_INFO[] = { {"x", "dimensionless", "my_model", STATE} }; -const VariableInfo VARIABLE_INFO[] = { - {"a", "per_s", "my_model", COMPUTED_CONSTANT}, +const VariableInfo CONSTANT_INFO[] = { +}; + +const VariableInfo COMPUTED_CONSTANT_INFO[] = { + {"a", "per_s", "my_model", COMPUTED_CONSTANT} +}; + +const VariableInfo ALGEBRAIC_INFO[] = { {"xx", "dimensionless", "my_model", ALGEBRAIC} }; diff --git a/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.h b/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.h index cfae2b1d2f..204f85667a 100644 --- a/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.h +++ b/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.h @@ -29,7 +29,9 @@ typedef struct { extern const VariableInfo VOI_INFO; extern const VariableInfo STATE_INFO[]; -extern const VariableInfo VARIABLE_INFO[]; +extern const VariableInfo CONSTANT_INFO[]; +extern const VariableInfo COMPUTED_CONSTANT_INFO[]; +extern const VariableInfo ALGEBRAIC_INFO[]; double * createStatesArray(); double * createVariablesArray(); diff --git a/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.py b/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.py index 1a8d75e50b..81450104a7 100644 --- a/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.py +++ b/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.py @@ -23,12 +23,17 @@ class VariableType(Enum): VOI_INFO = {"name": "t", "units": "second", "component": "my_model", "type": VariableType.VARIABLE_OF_INTEGRATION} -STATE_INFO = [ - {"name": "x", "units": "dimensionless", "component": "my_model", "type": VariableType.STATE} +STATE_INFO = {"name": "x", "units": "dimensionless", "component": "my_model", "type": VariableType.STATE} + + +CONSTANT_INFO = [ +] + +COMPUTED_CONSTANT_INFO = [ + {"name": "a", "units": "per_s", "component": "my_model", "type": VariableType.COMPUTED_CONSTANT} ] -VARIABLE_INFO = [ - {"name": "a", "units": "per_s", "component": "my_model", "type": VariableType.COMPUTED_CONSTANT}, +ALGEBRAIC_INFO = [ {"name": "xx", "units": "dimensionless", "component": "my_model", "type": VariableType.ALGEBRAIC} ] diff --git a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.c b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.c index 78af0f1c1f..9729fbf028 100644 --- a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.c +++ b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.c @@ -12,10 +12,16 @@ const size_t CONSTANT_COUNT = 0; const size_t COMPUTED_CONSTANT_COUNT = 3; const size_t ALGEBRAIC_COUNT = 1; -const VariableInfo VARIABLE_INFO[] = { +const VariableInfo CONSTANT_INFO[] = { +}; + +const VariableInfo COMPUTED_CONSTANT_INFO[] = { {"b", "dimensionless", "my_algebraic_eqn", COMPUTED_CONSTANT}, {"c", "dimensionless", "my_algebraic_eqn", COMPUTED_CONSTANT}, - {"d", "dimensionless", "my_algebraic_eqn", COMPUTED_CONSTANT}, + {"d", "dimensionless", "my_algebraic_eqn", COMPUTED_CONSTANT} +}; + +const VariableInfo ALGEBRAIC_INFO[] = { {"a", "dimensionless", "my_algebraic_eqn", ALGEBRAIC} }; diff --git a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.c b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.c index 5e1f7d6b8c..0dc47b9c06 100644 --- a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.c +++ b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.c @@ -13,10 +13,19 @@ const size_t COMPUTED_CONSTANT_COUNT = 3; const size_t ALGEBRAIC_COUNT = 0; const size_t EXTERNAL_COUNT = 1; -const VariableInfo VARIABLE_INFO[] = { +const VariableInfo CONSTANT_INFO[] = { +}; + +const VariableInfo COMPUTED_CONSTANT_INFO[] = { {"b", "dimensionless", "my_algebraic_eqn", COMPUTED_CONSTANT}, {"c", "dimensionless", "my_algebraic_eqn", COMPUTED_CONSTANT}, - {"d", "dimensionless", "my_algebraic_eqn", COMPUTED_CONSTANT}, + {"d", "dimensionless", "my_algebraic_eqn", COMPUTED_CONSTANT} +}; + +const VariableInfo ALGEBRAIC_INFO[] = { +}; + +const VariableInfo EXTERNAL_INFO[] = { {"a", "dimensionless", "my_algebraic_eqn", EXTERNAL} }; diff --git a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.h b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.h index 9763338779..da181acb28 100644 --- a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.h +++ b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.h @@ -26,7 +26,10 @@ typedef struct { VariableType type; } VariableInfo; -extern const VariableInfo VARIABLE_INFO[]; +extern const VariableInfo CONSTANT_INFO[]; +extern const VariableInfo COMPUTED_CONSTANT_INFO[]; +extern const VariableInfo ALGEBRAIC_INFO[]; +extern const VariableInfo EXTERNAL_INFO[]; double * createVariablesArray(); void deleteArray(double *array); diff --git a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.py b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.py index ed3205098b..abab654efe 100644 --- a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.py +++ b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.py @@ -20,10 +20,19 @@ class VariableType(Enum): EXTERNAL = 3 -VARIABLE_INFO = [ +CONSTANT_INFO = [ +] + +COMPUTED_CONSTANT_INFO = [ {"name": "b", "units": "dimensionless", "component": "my_algebraic_eqn", "type": VariableType.COMPUTED_CONSTANT}, {"name": "c", "units": "dimensionless", "component": "my_algebraic_eqn", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "d", "units": "dimensionless", "component": "my_algebraic_eqn", "type": VariableType.COMPUTED_CONSTANT}, + {"name": "d", "units": "dimensionless", "component": "my_algebraic_eqn", "type": VariableType.COMPUTED_CONSTANT} +] + +ALGEBRAIC_INFO = [ +] + +EXTERNAL_INFO = [ {"name": "a", "units": "dimensionless", "component": "my_algebraic_eqn", "type": VariableType.EXTERNAL} ] diff --git a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.h b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.h index 8b9a1fb666..a14bcb3994 100644 --- a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.h +++ b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.h @@ -24,7 +24,9 @@ typedef struct { VariableType type; } VariableInfo; -extern const VariableInfo VARIABLE_INFO[]; +extern const VariableInfo CONSTANT_INFO[]; +extern const VariableInfo COMPUTED_CONSTANT_INFO[]; +extern const VariableInfo ALGEBRAIC_INFO[]; double * createVariablesArray(); void deleteArray(double *array); diff --git a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.py b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.py index 1f349758b7..47a6536efe 100644 --- a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.py +++ b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.py @@ -18,10 +18,16 @@ class VariableType(Enum): ALGEBRAIC = 2 -VARIABLE_INFO = [ +CONSTANT_INFO = [ +] + +COMPUTED_CONSTANT_INFO = [ {"name": "b", "units": "dimensionless", "component": "my_algebraic_eqn", "type": VariableType.COMPUTED_CONSTANT}, {"name": "c", "units": "dimensionless", "component": "my_algebraic_eqn", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "d", "units": "dimensionless", "component": "my_algebraic_eqn", "type": VariableType.COMPUTED_CONSTANT}, + {"name": "d", "units": "dimensionless", "component": "my_algebraic_eqn", "type": VariableType.COMPUTED_CONSTANT} +] + +ALGEBRAIC_INFO = [ {"name": "a", "units": "dimensionless", "component": "my_algebraic_eqn", "type": VariableType.ALGEBRAIC} ] diff --git a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.c b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.c index eb6d409ade..10613b8287 100644 --- a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.c +++ b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.c @@ -12,7 +12,13 @@ const size_t CONSTANT_COUNT = 0; const size_t COMPUTED_CONSTANT_COUNT = 0; const size_t ALGEBRAIC_COUNT = 3; -const VariableInfo VARIABLE_INFO[] = { +const VariableInfo CONSTANT_INFO[] = { +}; + +const VariableInfo COMPUTED_CONSTANT_INFO[] = { +}; + +const VariableInfo ALGEBRAIC_INFO[] = { {"x", "dimensionless", "my_algebraic_system", ALGEBRAIC}, {"y", "dimensionless", "my_algebraic_system", ALGEBRAIC}, {"z", "dimensionless", "my_algebraic_system", ALGEBRAIC} diff --git a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.h b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.h index 69ce3f6763..6633bbe218 100644 --- a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.h +++ b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.h @@ -24,7 +24,9 @@ typedef struct { VariableType type; } VariableInfo; -extern const VariableInfo VARIABLE_INFO[]; +extern const VariableInfo CONSTANT_INFO[]; +extern const VariableInfo COMPUTED_CONSTANT_INFO[]; +extern const VariableInfo ALGEBRAIC_INFO[]; double * createVariablesArray(); void deleteArray(double *array); diff --git a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.py b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.py index de50e042ec..797157fd51 100644 --- a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.py +++ b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.py @@ -18,7 +18,13 @@ class VariableType(Enum): ALGEBRAIC = 2 -VARIABLE_INFO = [ +CONSTANT_INFO = [ +] + +COMPUTED_CONSTANT_INFO = [ +] + +ALGEBRAIC_INFO = [ {"name": "x", "units": "dimensionless", "component": "my_algebraic_system", "type": VariableType.ALGEBRAIC}, {"name": "y", "units": "dimensionless", "component": "my_algebraic_system", "type": VariableType.ALGEBRAIC}, {"name": "z", "units": "dimensionless", "component": "my_algebraic_system", "type": VariableType.ALGEBRAIC} diff --git a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.c b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.c index a22f00fad6..5596bf8a64 100644 --- a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.c +++ b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.c @@ -13,7 +13,16 @@ const size_t COMPUTED_CONSTANT_COUNT = 0; const size_t ALGEBRAIC_COUNT = 0; const size_t EXTERNAL_COUNT = 3; -const VariableInfo VARIABLE_INFO[] = { +const VariableInfo CONSTANT_INFO[] = { +}; + +const VariableInfo COMPUTED_CONSTANT_INFO[] = { +}; + +const VariableInfo ALGEBRAIC_INFO[] = { +}; + +const VariableInfo EXTERNAL_INFO[] = { {"x", "dimensionless", "my_algebraic_system", EXTERNAL}, {"y", "dimensionless", "my_algebraic_system", EXTERNAL}, {"z", "dimensionless", "my_algebraic_system", EXTERNAL} diff --git a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.h b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.h index 0c3b6b4a50..a2a7d679f7 100644 --- a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.h +++ b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.h @@ -26,7 +26,10 @@ typedef struct { VariableType type; } VariableInfo; -extern const VariableInfo VARIABLE_INFO[]; +extern const VariableInfo CONSTANT_INFO[]; +extern const VariableInfo COMPUTED_CONSTANT_INFO[]; +extern const VariableInfo ALGEBRAIC_INFO[]; +extern const VariableInfo EXTERNAL_INFO[]; double * createVariablesArray(); void deleteArray(double *array); diff --git a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.py b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.py index c79c816133..63ee6d6d85 100644 --- a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.py +++ b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.py @@ -20,7 +20,16 @@ class VariableType(Enum): EXTERNAL = 3 -VARIABLE_INFO = [ +CONSTANT_INFO = [ +] + +COMPUTED_CONSTANT_INFO = [ +] + +ALGEBRAIC_INFO = [ +] + +EXTERNAL_INFO = [ {"name": "x", "units": "dimensionless", "component": "my_algebraic_system", "type": VariableType.EXTERNAL}, {"name": "y", "units": "dimensionless", "component": "my_algebraic_system", "type": VariableType.EXTERNAL}, {"name": "z", "units": "dimensionless", "component": "my_algebraic_system", "type": VariableType.EXTERNAL} diff --git a/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.c b/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.c index be81938b4f..4cebe90c97 100644 --- a/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.c +++ b/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.c @@ -12,10 +12,16 @@ const size_t CONSTANT_COUNT = 2; const size_t COMPUTED_CONSTANT_COUNT = 1; const size_t ALGEBRAIC_COUNT = 3; -const VariableInfo VARIABLE_INFO[] = { +const VariableInfo CONSTANT_INFO[] = { {"x", "dimensionless", "my_algebraic_system", CONSTANT}, - {"y", "dimensionless", "my_algebraic_system", CONSTANT}, - {"a", "dimensionless", "my_algebraic_system", COMPUTED_CONSTANT}, + {"y", "dimensionless", "my_algebraic_system", CONSTANT} +}; + +const VariableInfo COMPUTED_CONSTANT_INFO[] = { + {"a", "dimensionless", "my_algebraic_system", COMPUTED_CONSTANT} +}; + +const VariableInfo ALGEBRAIC_INFO[] = { {"d", "dimensionless", "my_algebraic_system", ALGEBRAIC}, {"b", "dimensionless", "my_algebraic_system", ALGEBRAIC}, {"c", "dimensionless", "my_algebraic_system", ALGEBRAIC} diff --git a/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.h b/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.h index 69ce3f6763..6633bbe218 100644 --- a/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.h +++ b/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.h @@ -24,7 +24,9 @@ typedef struct { VariableType type; } VariableInfo; -extern const VariableInfo VARIABLE_INFO[]; +extern const VariableInfo CONSTANT_INFO[]; +extern const VariableInfo COMPUTED_CONSTANT_INFO[]; +extern const VariableInfo ALGEBRAIC_INFO[]; double * createVariablesArray(); void deleteArray(double *array); diff --git a/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.py b/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.py index a10c6ed591..4c2a52ea36 100644 --- a/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.py +++ b/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.py @@ -18,10 +18,16 @@ class VariableType(Enum): ALGEBRAIC = 2 -VARIABLE_INFO = [ +CONSTANT_INFO = [ {"name": "x", "units": "dimensionless", "component": "my_algebraic_system", "type": VariableType.CONSTANT}, - {"name": "y", "units": "dimensionless", "component": "my_algebraic_system", "type": VariableType.CONSTANT}, - {"name": "a", "units": "dimensionless", "component": "my_algebraic_system", "type": VariableType.COMPUTED_CONSTANT}, + {"name": "y", "units": "dimensionless", "component": "my_algebraic_system", "type": VariableType.CONSTANT} +] + +COMPUTED_CONSTANT_INFO = [ + {"name": "a", "units": "dimensionless", "component": "my_algebraic_system", "type": VariableType.COMPUTED_CONSTANT} +] + +ALGEBRAIC_INFO = [ {"name": "d", "units": "dimensionless", "component": "my_algebraic_system", "type": VariableType.ALGEBRAIC}, {"name": "b", "units": "dimensionless", "component": "my_algebraic_system", "type": VariableType.ALGEBRAIC}, {"name": "c", "units": "dimensionless", "component": "my_algebraic_system", "type": VariableType.ALGEBRAIC} diff --git a/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.c b/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.c index df91e1567d..bb02166a70 100644 --- a/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.c +++ b/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.c @@ -12,10 +12,16 @@ const size_t CONSTANT_COUNT = 2; const size_t COMPUTED_CONSTANT_COUNT = 1; const size_t ALGEBRAIC_COUNT = 3; -const VariableInfo VARIABLE_INFO[] = { +const VariableInfo CONSTANT_INFO[] = { {"x", "dimensionless", "my_algebraic_system", CONSTANT}, - {"y", "dimensionless", "my_algebraic_system", CONSTANT}, - {"a", "dimensionless", "my_algebraic_system", COMPUTED_CONSTANT}, + {"y", "dimensionless", "my_algebraic_system", CONSTANT} +}; + +const VariableInfo COMPUTED_CONSTANT_INFO[] = { + {"a", "dimensionless", "my_algebraic_system", COMPUTED_CONSTANT} +}; + +const VariableInfo ALGEBRAIC_INFO[] = { {"c", "dimensionless", "my_algebraic_system", ALGEBRAIC}, {"b", "dimensionless", "my_algebraic_system", ALGEBRAIC}, {"d", "dimensionless", "my_algebraic_system", ALGEBRAIC} diff --git a/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.h b/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.h index 69ce3f6763..6633bbe218 100644 --- a/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.h +++ b/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.h @@ -24,7 +24,9 @@ typedef struct { VariableType type; } VariableInfo; -extern const VariableInfo VARIABLE_INFO[]; +extern const VariableInfo CONSTANT_INFO[]; +extern const VariableInfo COMPUTED_CONSTANT_INFO[]; +extern const VariableInfo ALGEBRAIC_INFO[]; double * createVariablesArray(); void deleteArray(double *array); diff --git a/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.py b/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.py index 3272ba8398..232ab46ef2 100644 --- a/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.py +++ b/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.py @@ -18,10 +18,16 @@ class VariableType(Enum): ALGEBRAIC = 2 -VARIABLE_INFO = [ +CONSTANT_INFO = [ {"name": "x", "units": "dimensionless", "component": "my_algebraic_system", "type": VariableType.CONSTANT}, - {"name": "y", "units": "dimensionless", "component": "my_algebraic_system", "type": VariableType.CONSTANT}, - {"name": "a", "units": "dimensionless", "component": "my_algebraic_system", "type": VariableType.COMPUTED_CONSTANT}, + {"name": "y", "units": "dimensionless", "component": "my_algebraic_system", "type": VariableType.CONSTANT} +] + +COMPUTED_CONSTANT_INFO = [ + {"name": "a", "units": "dimensionless", "component": "my_algebraic_system", "type": VariableType.COMPUTED_CONSTANT} +] + +ALGEBRAIC_INFO = [ {"name": "c", "units": "dimensionless", "component": "my_algebraic_system", "type": VariableType.ALGEBRAIC}, {"name": "b", "units": "dimensionless", "component": "my_algebraic_system", "type": VariableType.ALGEBRAIC}, {"name": "d", "units": "dimensionless", "component": "my_algebraic_system", "type": VariableType.ALGEBRAIC} diff --git a/tests/resources/generator/algebraic_unknown_var_on_rhs/model.c b/tests/resources/generator/algebraic_unknown_var_on_rhs/model.c index bfdee7fae6..d53d3e1fd0 100644 --- a/tests/resources/generator/algebraic_unknown_var_on_rhs/model.c +++ b/tests/resources/generator/algebraic_unknown_var_on_rhs/model.c @@ -12,11 +12,17 @@ const size_t CONSTANT_COUNT = 0; const size_t COMPUTED_CONSTANT_COUNT = 2; const size_t ALGEBRAIC_COUNT = 0; -const VariableInfo VARIABLE_INFO[] = { +const VariableInfo CONSTANT_INFO[] = { +}; + +const VariableInfo COMPUTED_CONSTANT_INFO[] = { {"x", "dimensionless", "my_component", COMPUTED_CONSTANT}, {"y", "dimensionless", "my_component", COMPUTED_CONSTANT} }; +const VariableInfo ALGEBRAIC_INFO[] = { +}; + double * createVariablesArray() { double *res = (double *) malloc(VARIABLE_COUNT*sizeof(double)); diff --git a/tests/resources/generator/algebraic_unknown_var_on_rhs/model.h b/tests/resources/generator/algebraic_unknown_var_on_rhs/model.h index d26413c671..2e7b0dd0b1 100644 --- a/tests/resources/generator/algebraic_unknown_var_on_rhs/model.h +++ b/tests/resources/generator/algebraic_unknown_var_on_rhs/model.h @@ -24,7 +24,9 @@ typedef struct { VariableType type; } VariableInfo; -extern const VariableInfo VARIABLE_INFO[]; +extern const VariableInfo CONSTANT_INFO[]; +extern const VariableInfo COMPUTED_CONSTANT_INFO[]; +extern const VariableInfo ALGEBRAIC_INFO[]; double * createVariablesArray(); void deleteArray(double *array); diff --git a/tests/resources/generator/algebraic_unknown_var_on_rhs/model.py b/tests/resources/generator/algebraic_unknown_var_on_rhs/model.py index 020c15fc01..9b2aca6711 100644 --- a/tests/resources/generator/algebraic_unknown_var_on_rhs/model.py +++ b/tests/resources/generator/algebraic_unknown_var_on_rhs/model.py @@ -18,11 +18,17 @@ class VariableType(Enum): ALGEBRAIC = 2 -VARIABLE_INFO = [ +CONSTANT_INFO = [ +] + +COMPUTED_CONSTANT_INFO = [ {"name": "x", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, {"name": "y", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT} ] +ALGEBRAIC_INFO = [ +] + def create_variables_array(): return [nan]*VARIABLE_COUNT diff --git a/tests/resources/generator/cell_geometry_model/model.c b/tests/resources/generator/cell_geometry_model/model.c index 1d2073048e..48d3bfc777 100644 --- a/tests/resources/generator/cell_geometry_model/model.c +++ b/tests/resources/generator/cell_geometry_model/model.c @@ -12,13 +12,19 @@ const size_t CONSTANT_COUNT = 2; const size_t COMPUTED_CONSTANT_COUNT = 2; const size_t ALGEBRAIC_COUNT = 0; -const VariableInfo VARIABLE_INFO[] = { +const VariableInfo CONSTANT_INFO[] = { {"L", "centimeter", "cell_geometry", CONSTANT}, - {"rad", "centimeter", "cell_geometry", CONSTANT}, + {"rad", "centimeter", "cell_geometry", CONSTANT} +}; + +const VariableInfo COMPUTED_CONSTANT_INFO[] = { {"vcell", "microlitre", "cell_geometry", COMPUTED_CONSTANT}, {"vss", "microlitre", "cell_geometry", COMPUTED_CONSTANT} }; +const VariableInfo ALGEBRAIC_INFO[] = { +}; + double * createVariablesArray() { double *res = (double *) malloc(VARIABLE_COUNT*sizeof(double)); diff --git a/tests/resources/generator/cell_geometry_model/model.external.c b/tests/resources/generator/cell_geometry_model/model.external.c index 4fe760dd4a..1ca71d6f68 100644 --- a/tests/resources/generator/cell_geometry_model/model.external.c +++ b/tests/resources/generator/cell_geometry_model/model.external.c @@ -13,9 +13,18 @@ const size_t COMPUTED_CONSTANT_COUNT = 0; const size_t ALGEBRAIC_COUNT = 2; const size_t EXTERNAL_COUNT = 2; -const VariableInfo VARIABLE_INFO[] = { +const VariableInfo CONSTANT_INFO[] = { +}; + +const VariableInfo COMPUTED_CONSTANT_INFO[] = { +}; + +const VariableInfo ALGEBRAIC_INFO[] = { {"vcell", "microlitre", "cell_geometry", ALGEBRAIC}, - {"vss", "microlitre", "cell_geometry", ALGEBRAIC}, + {"vss", "microlitre", "cell_geometry", ALGEBRAIC} +}; + +const VariableInfo EXTERNAL_INFO[] = { {"L", "centimeter", "cell_geometry", EXTERNAL}, {"rad", "centimeter", "cell_geometry", EXTERNAL} }; diff --git a/tests/resources/generator/cell_geometry_model/model.external.h b/tests/resources/generator/cell_geometry_model/model.external.h index 4138452982..84cfc4521f 100644 --- a/tests/resources/generator/cell_geometry_model/model.external.h +++ b/tests/resources/generator/cell_geometry_model/model.external.h @@ -26,7 +26,10 @@ typedef struct { VariableType type; } VariableInfo; -extern const VariableInfo VARIABLE_INFO[]; +extern const VariableInfo CONSTANT_INFO[]; +extern const VariableInfo COMPUTED_CONSTANT_INFO[]; +extern const VariableInfo ALGEBRAIC_INFO[]; +extern const VariableInfo EXTERNAL_INFO[]; double * createVariablesArray(); void deleteArray(double *array); diff --git a/tests/resources/generator/cell_geometry_model/model.external.py b/tests/resources/generator/cell_geometry_model/model.external.py index 4c1af8bb9f..15e494636e 100644 --- a/tests/resources/generator/cell_geometry_model/model.external.py +++ b/tests/resources/generator/cell_geometry_model/model.external.py @@ -20,9 +20,18 @@ class VariableType(Enum): EXTERNAL = 3 -VARIABLE_INFO = [ +CONSTANT_INFO = [ +] + +COMPUTED_CONSTANT_INFO = [ +] + +ALGEBRAIC_INFO = [ {"name": "vcell", "units": "microlitre", "component": "cell_geometry", "type": VariableType.ALGEBRAIC}, - {"name": "vss", "units": "microlitre", "component": "cell_geometry", "type": VariableType.ALGEBRAIC}, + {"name": "vss", "units": "microlitre", "component": "cell_geometry", "type": VariableType.ALGEBRAIC} +] + +EXTERNAL_INFO = [ {"name": "L", "units": "centimeter", "component": "cell_geometry", "type": VariableType.EXTERNAL}, {"name": "rad", "units": "centimeter", "component": "cell_geometry", "type": VariableType.EXTERNAL} ] diff --git a/tests/resources/generator/cell_geometry_model/model.h b/tests/resources/generator/cell_geometry_model/model.h index d291cbc391..9dc3b94992 100644 --- a/tests/resources/generator/cell_geometry_model/model.h +++ b/tests/resources/generator/cell_geometry_model/model.h @@ -24,7 +24,9 @@ typedef struct { VariableType type; } VariableInfo; -extern const VariableInfo VARIABLE_INFO[]; +extern const VariableInfo CONSTANT_INFO[]; +extern const VariableInfo COMPUTED_CONSTANT_INFO[]; +extern const VariableInfo ALGEBRAIC_INFO[]; double * createVariablesArray(); void deleteArray(double *array); diff --git a/tests/resources/generator/cell_geometry_model/model.py b/tests/resources/generator/cell_geometry_model/model.py index b25e428a56..1ef05bdede 100644 --- a/tests/resources/generator/cell_geometry_model/model.py +++ b/tests/resources/generator/cell_geometry_model/model.py @@ -18,13 +18,19 @@ class VariableType(Enum): ALGEBRAIC = 2 -VARIABLE_INFO = [ +CONSTANT_INFO = [ {"name": "L", "units": "centimeter", "component": "cell_geometry", "type": VariableType.CONSTANT}, - {"name": "rad", "units": "centimeter", "component": "cell_geometry", "type": VariableType.CONSTANT}, + {"name": "rad", "units": "centimeter", "component": "cell_geometry", "type": VariableType.CONSTANT} +] + +COMPUTED_CONSTANT_INFO = [ {"name": "vcell", "units": "microlitre", "component": "cell_geometry", "type": VariableType.COMPUTED_CONSTANT}, {"name": "vss", "units": "microlitre", "component": "cell_geometry", "type": VariableType.COMPUTED_CONSTANT} ] +ALGEBRAIC_INFO = [ +] + def create_variables_array(): return [nan]*VARIABLE_COUNT diff --git a/tests/resources/generator/cellml_mappings_and_encapsulations/model.c b/tests/resources/generator/cellml_mappings_and_encapsulations/model.c index 3f59baaf87..f304992cb6 100644 --- a/tests/resources/generator/cellml_mappings_and_encapsulations/model.c +++ b/tests/resources/generator/cellml_mappings_and_encapsulations/model.c @@ -20,7 +20,13 @@ const VariableInfo STATE_INFO[] = { {"x", "mM", "circle_x", STATE} }; -const VariableInfo VARIABLE_INFO[] = { +const VariableInfo CONSTANT_INFO[] = { +}; + +const VariableInfo COMPUTED_CONSTANT_INFO[] = { +}; + +const VariableInfo ALGEBRAIC_INFO[] = { {"local_complex_maths", "mM", "circle_sibling", ALGEBRAIC}, {"two_x", "milli_mole", "circle_x_sibling", ALGEBRAIC} }; diff --git a/tests/resources/generator/cellml_mappings_and_encapsulations/model.h b/tests/resources/generator/cellml_mappings_and_encapsulations/model.h index 91a2bbdb90..9719caec08 100644 --- a/tests/resources/generator/cellml_mappings_and_encapsulations/model.h +++ b/tests/resources/generator/cellml_mappings_and_encapsulations/model.h @@ -29,7 +29,9 @@ typedef struct { extern const VariableInfo VOI_INFO; extern const VariableInfo STATE_INFO[]; -extern const VariableInfo VARIABLE_INFO[]; +extern const VariableInfo CONSTANT_INFO[]; +extern const VariableInfo COMPUTED_CONSTANT_INFO[]; +extern const VariableInfo ALGEBRAIC_INFO[]; double * createStatesArray(); double * createVariablesArray(); diff --git a/tests/resources/generator/cellml_mappings_and_encapsulations/model.py b/tests/resources/generator/cellml_mappings_and_encapsulations/model.py index 42799d8118..745325178c 100644 --- a/tests/resources/generator/cellml_mappings_and_encapsulations/model.py +++ b/tests/resources/generator/cellml_mappings_and_encapsulations/model.py @@ -23,12 +23,17 @@ class VariableType(Enum): VOI_INFO = {"name": "t", "units": "ms", "component": "environment", "type": VariableType.VARIABLE_OF_INTEGRATION} -STATE_INFO = [ - {"name": "y", "units": "mM", "component": "circle_y_implementation", "type": VariableType.STATE}, +STATE_INFO = {"name": "y", "units": "mM", "component": "circle_y_implementation", "type": VariableType.STATE}, {"name": "x", "units": "mM", "component": "circle_x", "type": VariableType.STATE} + + +CONSTANT_INFO = [ +] + +COMPUTED_CONSTANT_INFO = [ ] -VARIABLE_INFO = [ +ALGEBRAIC_INFO = [ {"name": "local_complex_maths", "units": "mM", "component": "circle_sibling", "type": VariableType.ALGEBRAIC}, {"name": "two_x", "units": "milli_mole", "component": "circle_x_sibling", "type": VariableType.ALGEBRAIC} ] diff --git a/tests/resources/generator/cellml_slc_example/model.py b/tests/resources/generator/cellml_slc_example/model.py index b03cf86487..cf83a22619 100644 --- a/tests/resources/generator/cellml_slc_example/model.py +++ b/tests/resources/generator/cellml_slc_example/model.py @@ -18,7 +18,7 @@ class VariableType(Enum): ALGEBRAIC = 2 -VARIABLE_INFO = [ +CONSTANT_INFO = [ {"name": "E", "units": "fmol", "component": "SLC_template3_ss", "type": VariableType.CONSTANT}, {"name": "P_0", "units": "per_fmol_sec4", "component": "SLC_template3_ss", "type": VariableType.CONSTANT}, {"name": "q_Ao", "units": "fmol", "component": "SLC_template3_ss", "type": VariableType.CONSTANT}, @@ -27,10 +27,16 @@ class VariableType(Enum): {"name": "P_2", "units": "per_fmol_sec3", "component": "SLC_template3_ss", "type": VariableType.CONSTANT}, {"name": "P_5", "units": "per_sec3", "component": "SLC_template3_ss", "type": VariableType.CONSTANT}, {"name": "P_4", "units": "per_fmol2_sec3", "component": "SLC_template3_ss", "type": VariableType.CONSTANT}, - {"name": "P_3", "units": "per_fmol_sec3", "component": "SLC_template3_ss", "type": VariableType.CONSTANT}, + {"name": "P_3", "units": "per_fmol_sec3", "component": "SLC_template3_ss", "type": VariableType.CONSTANT} +] + +COMPUTED_CONSTANT_INFO = [ {"name": "v", "units": "fmol_per_sec", "component": "SLC_template3_ss", "type": VariableType.COMPUTED_CONSTANT} ] +ALGEBRAIC_INFO = [ +] + def create_variables_array(): return [nan]*VARIABLE_COUNT diff --git a/tests/resources/generator/cellml_state_initialised_using_variable/model.c b/tests/resources/generator/cellml_state_initialised_using_variable/model.c index e8e13541c2..cf52db26bc 100644 --- a/tests/resources/generator/cellml_state_initialised_using_variable/model.c +++ b/tests/resources/generator/cellml_state_initialised_using_variable/model.c @@ -19,10 +19,16 @@ const VariableInfo STATE_INFO[] = { {"x", "mV", "main", STATE} }; -const VariableInfo VARIABLE_INFO[] = { +const VariableInfo CONSTANT_INFO[] = { {"k", "mV", "constants", CONSTANT} }; +const VariableInfo COMPUTED_CONSTANT_INFO[] = { +}; + +const VariableInfo ALGEBRAIC_INFO[] = { +}; + double * createStatesArray() { double *res = (double *) malloc(STATE_COUNT*sizeof(double)); diff --git a/tests/resources/generator/cellml_state_initialised_using_variable/model.h b/tests/resources/generator/cellml_state_initialised_using_variable/model.h index e95d12eb15..4209283480 100644 --- a/tests/resources/generator/cellml_state_initialised_using_variable/model.h +++ b/tests/resources/generator/cellml_state_initialised_using_variable/model.h @@ -29,7 +29,9 @@ typedef struct { extern const VariableInfo VOI_INFO; extern const VariableInfo STATE_INFO[]; -extern const VariableInfo VARIABLE_INFO[]; +extern const VariableInfo CONSTANT_INFO[]; +extern const VariableInfo COMPUTED_CONSTANT_INFO[]; +extern const VariableInfo ALGEBRAIC_INFO[]; double * createStatesArray(); double * createVariablesArray(); diff --git a/tests/resources/generator/cellml_state_initialised_using_variable/model.py b/tests/resources/generator/cellml_state_initialised_using_variable/model.py index 5aae09a47d..f32c24fe01 100644 --- a/tests/resources/generator/cellml_state_initialised_using_variable/model.py +++ b/tests/resources/generator/cellml_state_initialised_using_variable/model.py @@ -23,14 +23,19 @@ class VariableType(Enum): VOI_INFO = {"name": "t", "units": "ms", "component": "environment", "type": VariableType.VARIABLE_OF_INTEGRATION} -STATE_INFO = [ - {"name": "x", "units": "mV", "component": "main", "type": VariableType.STATE} -] +STATE_INFO = {"name": "x", "units": "mV", "component": "main", "type": VariableType.STATE} + -VARIABLE_INFO = [ +CONSTANT_INFO = [ {"name": "k", "units": "mV", "component": "constants", "type": VariableType.CONSTANT} ] +COMPUTED_CONSTANT_INFO = [ +] + +ALGEBRAIC_INFO = [ +] + def create_states_array(): return [nan]*STATE_COUNT diff --git a/tests/resources/generator/cellml_unit_scaling_constant/model.c b/tests/resources/generator/cellml_unit_scaling_constant/model.c index 21638fba96..a3494f54db 100644 --- a/tests/resources/generator/cellml_unit_scaling_constant/model.c +++ b/tests/resources/generator/cellml_unit_scaling_constant/model.c @@ -12,12 +12,18 @@ const size_t CONSTANT_COUNT = 1; const size_t COMPUTED_CONSTANT_COUNT = 2; const size_t ALGEBRAIC_COUNT = 0; -const VariableInfo VARIABLE_INFO[] = { - {"k", "mM", "constants", CONSTANT}, +const VariableInfo CONSTANT_INFO[] = { + {"k", "mM", "constants", CONSTANT} +}; + +const VariableInfo COMPUTED_CONSTANT_INFO[] = { {"x", "mM", "main", COMPUTED_CONSTANT}, {"y", "M", "main", COMPUTED_CONSTANT} }; +const VariableInfo ALGEBRAIC_INFO[] = { +}; + double * createVariablesArray() { double *res = (double *) malloc(VARIABLE_COUNT*sizeof(double)); diff --git a/tests/resources/generator/cellml_unit_scaling_constant/model.h b/tests/resources/generator/cellml_unit_scaling_constant/model.h index 435deb74f0..2e51e8fd10 100644 --- a/tests/resources/generator/cellml_unit_scaling_constant/model.h +++ b/tests/resources/generator/cellml_unit_scaling_constant/model.h @@ -24,7 +24,9 @@ typedef struct { VariableType type; } VariableInfo; -extern const VariableInfo VARIABLE_INFO[]; +extern const VariableInfo CONSTANT_INFO[]; +extern const VariableInfo COMPUTED_CONSTANT_INFO[]; +extern const VariableInfo ALGEBRAIC_INFO[]; double * createVariablesArray(); void deleteArray(double *array); diff --git a/tests/resources/generator/cellml_unit_scaling_constant/model.py b/tests/resources/generator/cellml_unit_scaling_constant/model.py index d2ee195c50..bc4e24cb43 100644 --- a/tests/resources/generator/cellml_unit_scaling_constant/model.py +++ b/tests/resources/generator/cellml_unit_scaling_constant/model.py @@ -18,12 +18,18 @@ class VariableType(Enum): ALGEBRAIC = 2 -VARIABLE_INFO = [ - {"name": "k", "units": "mM", "component": "constants", "type": VariableType.CONSTANT}, +CONSTANT_INFO = [ + {"name": "k", "units": "mM", "component": "constants", "type": VariableType.CONSTANT} +] + +COMPUTED_CONSTANT_INFO = [ {"name": "x", "units": "mM", "component": "main", "type": VariableType.COMPUTED_CONSTANT}, {"name": "y", "units": "M", "component": "main", "type": VariableType.COMPUTED_CONSTANT} ] +ALGEBRAIC_INFO = [ +] + def create_variables_array(): return [nan]*VARIABLE_COUNT diff --git a/tests/resources/generator/cellml_unit_scaling_rate/model.c b/tests/resources/generator/cellml_unit_scaling_rate/model.c index 603a1eab39..302ea642f2 100644 --- a/tests/resources/generator/cellml_unit_scaling_rate/model.c +++ b/tests/resources/generator/cellml_unit_scaling_rate/model.c @@ -19,7 +19,13 @@ const VariableInfo STATE_INFO[] = { {"k", "mM", "states", STATE} }; -const VariableInfo VARIABLE_INFO[] = { +const VariableInfo CONSTANT_INFO[] = { +}; + +const VariableInfo COMPUTED_CONSTANT_INFO[] = { +}; + +const VariableInfo ALGEBRAIC_INFO[] = { {"x", "mM", "main", ALGEBRAIC}, {"y", "M", "main", ALGEBRAIC} }; diff --git a/tests/resources/generator/cellml_unit_scaling_rate/model.h b/tests/resources/generator/cellml_unit_scaling_rate/model.h index e95d12eb15..4209283480 100644 --- a/tests/resources/generator/cellml_unit_scaling_rate/model.h +++ b/tests/resources/generator/cellml_unit_scaling_rate/model.h @@ -29,7 +29,9 @@ typedef struct { extern const VariableInfo VOI_INFO; extern const VariableInfo STATE_INFO[]; -extern const VariableInfo VARIABLE_INFO[]; +extern const VariableInfo CONSTANT_INFO[]; +extern const VariableInfo COMPUTED_CONSTANT_INFO[]; +extern const VariableInfo ALGEBRAIC_INFO[]; double * createStatesArray(); double * createVariablesArray(); diff --git a/tests/resources/generator/cellml_unit_scaling_rate/model.py b/tests/resources/generator/cellml_unit_scaling_rate/model.py index f74588e123..4a031e2530 100644 --- a/tests/resources/generator/cellml_unit_scaling_rate/model.py +++ b/tests/resources/generator/cellml_unit_scaling_rate/model.py @@ -23,11 +23,16 @@ class VariableType(Enum): VOI_INFO = {"name": "t", "units": "ms", "component": "environment", "type": VariableType.VARIABLE_OF_INTEGRATION} -STATE_INFO = [ - {"name": "k", "units": "mM", "component": "states", "type": VariableType.STATE} +STATE_INFO = {"name": "k", "units": "mM", "component": "states", "type": VariableType.STATE} + + +CONSTANT_INFO = [ +] + +COMPUTED_CONSTANT_INFO = [ ] -VARIABLE_INFO = [ +ALGEBRAIC_INFO = [ {"name": "x", "units": "mM", "component": "main", "type": VariableType.ALGEBRAIC}, {"name": "y", "units": "M", "component": "main", "type": VariableType.ALGEBRAIC} ] diff --git a/tests/resources/generator/cellml_unit_scaling_state/model.c b/tests/resources/generator/cellml_unit_scaling_state/model.c index 34c1bca1f3..550d7ad85f 100644 --- a/tests/resources/generator/cellml_unit_scaling_state/model.c +++ b/tests/resources/generator/cellml_unit_scaling_state/model.c @@ -19,7 +19,13 @@ const VariableInfo STATE_INFO[] = { {"k", "mM", "states", STATE} }; -const VariableInfo VARIABLE_INFO[] = { +const VariableInfo CONSTANT_INFO[] = { +}; + +const VariableInfo COMPUTED_CONSTANT_INFO[] = { +}; + +const VariableInfo ALGEBRAIC_INFO[] = { {"x", "mM", "main", ALGEBRAIC}, {"y", "M", "main", ALGEBRAIC} }; diff --git a/tests/resources/generator/cellml_unit_scaling_state/model.h b/tests/resources/generator/cellml_unit_scaling_state/model.h index e95d12eb15..4209283480 100644 --- a/tests/resources/generator/cellml_unit_scaling_state/model.h +++ b/tests/resources/generator/cellml_unit_scaling_state/model.h @@ -29,7 +29,9 @@ typedef struct { extern const VariableInfo VOI_INFO; extern const VariableInfo STATE_INFO[]; -extern const VariableInfo VARIABLE_INFO[]; +extern const VariableInfo CONSTANT_INFO[]; +extern const VariableInfo COMPUTED_CONSTANT_INFO[]; +extern const VariableInfo ALGEBRAIC_INFO[]; double * createStatesArray(); double * createVariablesArray(); diff --git a/tests/resources/generator/cellml_unit_scaling_state/model.py b/tests/resources/generator/cellml_unit_scaling_state/model.py index ec43146e3c..f5bfca28fc 100644 --- a/tests/resources/generator/cellml_unit_scaling_state/model.py +++ b/tests/resources/generator/cellml_unit_scaling_state/model.py @@ -23,11 +23,16 @@ class VariableType(Enum): VOI_INFO = {"name": "t", "units": "ms", "component": "environment", "type": VariableType.VARIABLE_OF_INTEGRATION} -STATE_INFO = [ - {"name": "k", "units": "mM", "component": "states", "type": VariableType.STATE} +STATE_INFO = {"name": "k", "units": "mM", "component": "states", "type": VariableType.STATE} + + +CONSTANT_INFO = [ +] + +COMPUTED_CONSTANT_INFO = [ ] -VARIABLE_INFO = [ +ALGEBRAIC_INFO = [ {"name": "x", "units": "mM", "component": "main", "type": VariableType.ALGEBRAIC}, {"name": "y", "units": "M", "component": "main", "type": VariableType.ALGEBRAIC} ] diff --git a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.c b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.c index c0db3b3a33..03bb266d52 100644 --- a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.c +++ b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.c @@ -20,7 +20,13 @@ const VariableInfo STATE_INFO[] = { {"k2", "M", "main", STATE} }; -const VariableInfo VARIABLE_INFO[] = { +const VariableInfo CONSTANT_INFO[] = { +}; + +const VariableInfo COMPUTED_CONSTANT_INFO[] = { +}; + +const VariableInfo ALGEBRAIC_INFO[] = { }; double * createStatesArray() diff --git a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.h b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.h index bd4dd923ef..46d3f1cf83 100644 --- a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.h +++ b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.h @@ -29,7 +29,9 @@ typedef struct { extern const VariableInfo VOI_INFO; extern const VariableInfo STATE_INFO[]; -extern const VariableInfo VARIABLE_INFO[]; +extern const VariableInfo CONSTANT_INFO[]; +extern const VariableInfo COMPUTED_CONSTANT_INFO[]; +extern const VariableInfo ALGEBRAIC_INFO[]; double * createStatesArray(); double * createVariablesArray(); diff --git a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.py b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.py index 86e48a995e..d3f5a756d0 100644 --- a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.py +++ b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.py @@ -23,12 +23,17 @@ class VariableType(Enum): VOI_INFO = {"name": "t", "units": "ms", "component": "environment", "type": VariableType.VARIABLE_OF_INTEGRATION} -STATE_INFO = [ - {"name": "k1", "units": "mM", "component": "main", "type": VariableType.STATE}, +STATE_INFO = {"name": "k1", "units": "mM", "component": "main", "type": VariableType.STATE}, {"name": "k2", "units": "M", "component": "main", "type": VariableType.STATE} + + +CONSTANT_INFO = [ +] + +COMPUTED_CONSTANT_INFO = [ ] -VARIABLE_INFO = [ +ALGEBRAIC_INFO = [ ] diff --git a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.c b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.c index 27bf38fab2..2cb41fddff 100644 --- a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.c +++ b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.c @@ -20,11 +20,17 @@ const VariableInfo STATE_INFO[] = { {"k2", "M", "main", STATE} }; -const VariableInfo VARIABLE_INFO[] = { +const VariableInfo CONSTANT_INFO[] = { {"k1_cst", "mM", "constants", CONSTANT}, {"k2_cst", "mM", "constants", CONSTANT} }; +const VariableInfo COMPUTED_CONSTANT_INFO[] = { +}; + +const VariableInfo ALGEBRAIC_INFO[] = { +}; + double * createStatesArray() { double *res = (double *) malloc(STATE_COUNT*sizeof(double)); diff --git a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.h b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.h index fc9911e7e4..ef9422431b 100644 --- a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.h +++ b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.h @@ -29,7 +29,9 @@ typedef struct { extern const VariableInfo VOI_INFO; extern const VariableInfo STATE_INFO[]; -extern const VariableInfo VARIABLE_INFO[]; +extern const VariableInfo CONSTANT_INFO[]; +extern const VariableInfo COMPUTED_CONSTANT_INFO[]; +extern const VariableInfo ALGEBRAIC_INFO[]; double * createStatesArray(); double * createVariablesArray(); diff --git a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.py b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.py index 9e1edd3c46..0ad4df9191 100644 --- a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.py +++ b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.py @@ -23,16 +23,21 @@ class VariableType(Enum): VOI_INFO = {"name": "t", "units": "ms", "component": "environment", "type": VariableType.VARIABLE_OF_INTEGRATION} -STATE_INFO = [ - {"name": "k1", "units": "mM", "component": "main", "type": VariableType.STATE}, +STATE_INFO = {"name": "k1", "units": "mM", "component": "main", "type": VariableType.STATE}, {"name": "k2", "units": "M", "component": "main", "type": VariableType.STATE} -] -VARIABLE_INFO = [ + +CONSTANT_INFO = [ {"name": "k1_cst", "units": "mM", "component": "constants", "type": VariableType.CONSTANT}, {"name": "k2_cst", "units": "mM", "component": "constants", "type": VariableType.CONSTANT} ] +COMPUTED_CONSTANT_INFO = [ +] + +ALGEBRAIC_INFO = [ +] + def create_states_array(): return [nan]*STATE_COUNT diff --git a/tests/resources/generator/cellml_unit_scaling_voi_direct/model.c b/tests/resources/generator/cellml_unit_scaling_voi_direct/model.c index f0e1d42ba4..f29503e6a4 100644 --- a/tests/resources/generator/cellml_unit_scaling_voi_direct/model.c +++ b/tests/resources/generator/cellml_unit_scaling_voi_direct/model.c @@ -20,7 +20,13 @@ const VariableInfo STATE_INFO[] = { {"y", "dimensionless", "main", STATE} }; -const VariableInfo VARIABLE_INFO[] = { +const VariableInfo CONSTANT_INFO[] = { +}; + +const VariableInfo COMPUTED_CONSTANT_INFO[] = { +}; + +const VariableInfo ALGEBRAIC_INFO[] = { }; double * createStatesArray() diff --git a/tests/resources/generator/cellml_unit_scaling_voi_direct/model.h b/tests/resources/generator/cellml_unit_scaling_voi_direct/model.h index 3f1fb63fd2..35acb14707 100644 --- a/tests/resources/generator/cellml_unit_scaling_voi_direct/model.h +++ b/tests/resources/generator/cellml_unit_scaling_voi_direct/model.h @@ -29,7 +29,9 @@ typedef struct { extern const VariableInfo VOI_INFO; extern const VariableInfo STATE_INFO[]; -extern const VariableInfo VARIABLE_INFO[]; +extern const VariableInfo CONSTANT_INFO[]; +extern const VariableInfo COMPUTED_CONSTANT_INFO[]; +extern const VariableInfo ALGEBRAIC_INFO[]; double * createStatesArray(); double * createVariablesArray(); diff --git a/tests/resources/generator/cellml_unit_scaling_voi_direct/model.py b/tests/resources/generator/cellml_unit_scaling_voi_direct/model.py index e14df017f1..f86e8920c7 100644 --- a/tests/resources/generator/cellml_unit_scaling_voi_direct/model.py +++ b/tests/resources/generator/cellml_unit_scaling_voi_direct/model.py @@ -23,12 +23,17 @@ class VariableType(Enum): VOI_INFO = {"name": "t", "units": "ms", "component": "environment", "type": VariableType.VARIABLE_OF_INTEGRATION} -STATE_INFO = [ - {"name": "x", "units": "dimensionless", "component": "main", "type": VariableType.STATE}, +STATE_INFO = {"name": "x", "units": "dimensionless", "component": "main", "type": VariableType.STATE}, {"name": "y", "units": "dimensionless", "component": "main", "type": VariableType.STATE} + + +CONSTANT_INFO = [ +] + +COMPUTED_CONSTANT_INFO = [ ] -VARIABLE_INFO = [ +ALGEBRAIC_INFO = [ ] diff --git a/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.c b/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.c index cd6840c595..05950cf519 100644 --- a/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.c +++ b/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.c @@ -21,7 +21,13 @@ const VariableInfo STATE_INFO[] = { {"x", "metre", "t_in_ks", STATE} }; -const VariableInfo VARIABLE_INFO[] = { +const VariableInfo CONSTANT_INFO[] = { +}; + +const VariableInfo COMPUTED_CONSTANT_INFO[] = { +}; + +const VariableInfo ALGEBRAIC_INFO[] = { }; double * createStatesArray() diff --git a/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.h b/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.h index 123e68564c..ce44fd3c14 100644 --- a/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.h +++ b/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.h @@ -29,7 +29,9 @@ typedef struct { extern const VariableInfo VOI_INFO; extern const VariableInfo STATE_INFO[]; -extern const VariableInfo VARIABLE_INFO[]; +extern const VariableInfo CONSTANT_INFO[]; +extern const VariableInfo COMPUTED_CONSTANT_INFO[]; +extern const VariableInfo ALGEBRAIC_INFO[]; double * createStatesArray(); double * createVariablesArray(); diff --git a/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.py b/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.py index ac4a5b3097..7519964294 100644 --- a/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.py +++ b/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.py @@ -23,13 +23,18 @@ class VariableType(Enum): VOI_INFO = {"name": "t", "units": "second", "component": "environment", "type": VariableType.VARIABLE_OF_INTEGRATION} -STATE_INFO = [ - {"name": "x", "units": "metre", "component": "t_in_s", "type": VariableType.STATE}, +STATE_INFO = {"name": "x", "units": "metre", "component": "t_in_s", "type": VariableType.STATE}, {"name": "x", "units": "metre", "component": "t_in_ms", "type": VariableType.STATE}, {"name": "x", "units": "metre", "component": "t_in_ks", "type": VariableType.STATE} + + +CONSTANT_INFO = [ +] + +COMPUTED_CONSTANT_INFO = [ ] -VARIABLE_INFO = [ +ALGEBRAIC_INFO = [ ] diff --git a/tests/resources/generator/dae_cellml_1_1_model/model.c b/tests/resources/generator/dae_cellml_1_1_model/model.c index 3b8e5e3bc3..c35d824f1b 100644 --- a/tests/resources/generator/dae_cellml_1_1_model/model.c +++ b/tests/resources/generator/dae_cellml_1_1_model/model.c @@ -20,12 +20,18 @@ const VariableInfo STATE_INFO[] = { {"v_3", "C_per_s", "main", STATE} }; -const VariableInfo VARIABLE_INFO[] = { +const VariableInfo CONSTANT_INFO[] = { {"v_in", "C_per_s", "main", CONSTANT}, {"v_out", "C_per_s", "main", CONSTANT}, {"C", "C2_per_J", "main", CONSTANT}, {"R", "Js_per_C2", "main", CONSTANT}, - {"L", "Js2_per_C2", "main", CONSTANT}, + {"L", "Js2_per_C2", "main", CONSTANT} +}; + +const VariableInfo COMPUTED_CONSTANT_INFO[] = { +}; + +const VariableInfo ALGEBRAIC_INFO[] = { {"v_1", "C_per_s", "main", ALGEBRAIC}, {"v_2", "C_per_s", "main", ALGEBRAIC}, {"u_1", "J_per_C", "main", ALGEBRAIC}, diff --git a/tests/resources/generator/dae_cellml_1_1_model/model.h b/tests/resources/generator/dae_cellml_1_1_model/model.h index 2bcb43579c..8ebd938f3f 100644 --- a/tests/resources/generator/dae_cellml_1_1_model/model.h +++ b/tests/resources/generator/dae_cellml_1_1_model/model.h @@ -29,7 +29,9 @@ typedef struct { extern const VariableInfo VOI_INFO; extern const VariableInfo STATE_INFO[]; -extern const VariableInfo VARIABLE_INFO[]; +extern const VariableInfo CONSTANT_INFO[]; +extern const VariableInfo COMPUTED_CONSTANT_INFO[]; +extern const VariableInfo ALGEBRAIC_INFO[]; double * createStatesArray(); double * createVariablesArray(); diff --git a/tests/resources/generator/dae_cellml_1_1_model/model.py b/tests/resources/generator/dae_cellml_1_1_model/model.py index 50658a4dbf..3c39a8b8c7 100644 --- a/tests/resources/generator/dae_cellml_1_1_model/model.py +++ b/tests/resources/generator/dae_cellml_1_1_model/model.py @@ -23,17 +23,22 @@ class VariableType(Enum): VOI_INFO = {"name": "t", "units": "second", "component": "main", "type": VariableType.VARIABLE_OF_INTEGRATION} -STATE_INFO = [ - {"name": "q_1", "units": "coulomb", "component": "main", "type": VariableType.STATE}, +STATE_INFO = {"name": "q_1", "units": "coulomb", "component": "main", "type": VariableType.STATE}, {"name": "v_3", "units": "C_per_s", "component": "main", "type": VariableType.STATE} -] -VARIABLE_INFO = [ + +CONSTANT_INFO = [ {"name": "v_in", "units": "C_per_s", "component": "main", "type": VariableType.CONSTANT}, {"name": "v_out", "units": "C_per_s", "component": "main", "type": VariableType.CONSTANT}, {"name": "C", "units": "C2_per_J", "component": "main", "type": VariableType.CONSTANT}, {"name": "R", "units": "Js_per_C2", "component": "main", "type": VariableType.CONSTANT}, - {"name": "L", "units": "Js2_per_C2", "component": "main", "type": VariableType.CONSTANT}, + {"name": "L", "units": "Js2_per_C2", "component": "main", "type": VariableType.CONSTANT} +] + +COMPUTED_CONSTANT_INFO = [ +] + +ALGEBRAIC_INFO = [ {"name": "v_1", "units": "C_per_s", "component": "main", "type": VariableType.ALGEBRAIC}, {"name": "v_2", "units": "C_per_s", "component": "main", "type": VariableType.ALGEBRAIC}, {"name": "u_1", "units": "J_per_C", "component": "main", "type": VariableType.ALGEBRAIC}, diff --git a/tests/resources/generator/dependent_eqns/model.c b/tests/resources/generator/dependent_eqns/model.c index 7bbb981447..796c72dbff 100644 --- a/tests/resources/generator/dependent_eqns/model.c +++ b/tests/resources/generator/dependent_eqns/model.c @@ -19,7 +19,13 @@ const VariableInfo STATE_INFO[] = { {"x", "dimensionless", "my_component", STATE} }; -const VariableInfo VARIABLE_INFO[] = { +const VariableInfo CONSTANT_INFO[] = { +}; + +const VariableInfo COMPUTED_CONSTANT_INFO[] = { +}; + +const VariableInfo ALGEBRAIC_INFO[] = { {"a", "second", "my_component", ALGEBRAIC}, {"b", "second", "my_component", ALGEBRAIC} }; diff --git a/tests/resources/generator/dependent_eqns/model.h b/tests/resources/generator/dependent_eqns/model.h index 676c75fecd..3e6d21a18b 100644 --- a/tests/resources/generator/dependent_eqns/model.h +++ b/tests/resources/generator/dependent_eqns/model.h @@ -29,7 +29,9 @@ typedef struct { extern const VariableInfo VOI_INFO; extern const VariableInfo STATE_INFO[]; -extern const VariableInfo VARIABLE_INFO[]; +extern const VariableInfo CONSTANT_INFO[]; +extern const VariableInfo COMPUTED_CONSTANT_INFO[]; +extern const VariableInfo ALGEBRAIC_INFO[]; double * createStatesArray(); double * createVariablesArray(); diff --git a/tests/resources/generator/dependent_eqns/model.py b/tests/resources/generator/dependent_eqns/model.py index 5ed89e9102..98091ed391 100644 --- a/tests/resources/generator/dependent_eqns/model.py +++ b/tests/resources/generator/dependent_eqns/model.py @@ -23,11 +23,16 @@ class VariableType(Enum): VOI_INFO = {"name": "time", "units": "second", "component": "my_component", "type": VariableType.VARIABLE_OF_INTEGRATION} -STATE_INFO = [ - {"name": "x", "units": "dimensionless", "component": "my_component", "type": VariableType.STATE} +STATE_INFO = {"name": "x", "units": "dimensionless", "component": "my_component", "type": VariableType.STATE} + + +CONSTANT_INFO = [ +] + +COMPUTED_CONSTANT_INFO = [ ] -VARIABLE_INFO = [ +ALGEBRAIC_INFO = [ {"name": "a", "units": "second", "component": "my_component", "type": VariableType.ALGEBRAIC}, {"name": "b", "units": "second", "component": "my_component", "type": VariableType.ALGEBRAIC} ] diff --git a/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.c b/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.c index 0e25bc096d..51bfd4d931 100644 --- a/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.c +++ b/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.c @@ -51,7 +51,7 @@ const VariableInfo STATE_INFO[] = { {"a", "dimensionless", "i_KACh_a_gate", STATE} }; -const VariableInfo VARIABLE_INFO[] = { +const VariableInfo CONSTANT_INFO[] = { {"ACh", "millimolar", "Rate_modulation_experiments", CONSTANT}, {"Iso_1_uM", "dimensionless", "Rate_modulation_experiments", CONSTANT}, {"Nao", "millimolar", "Ionic_values", CONSTANT}, @@ -142,7 +142,10 @@ const VariableInfo VARIABLE_INFO[] = { {"g_Kr", "microS", "i_Kr", CONSTANT}, {"g_Ks_", "microS", "i_Ks", CONSTANT}, {"ACh_on", "dimensionless", "i_KACh", CONSTANT}, - {"g_KACh", "microS", "i_KACh", CONSTANT}, + {"g_KACh", "microS", "i_KACh", CONSTANT} +}; + +const VariableInfo COMPUTED_CONSTANT_INFO[] = { {"RTONF", "millivolt", "Membrane", COMPUTED_CONSTANT}, {"E_K", "millivolt", "Ionic_values", COMPUTED_CONSTANT}, {"V_i", "millimetre3", "Cell_parameters", COMPUTED_CONSTANT}, @@ -167,7 +170,10 @@ const VariableInfo VARIABLE_INFO[] = { {"Iso_slope_dL", "dimensionless", "i_CaL_dL_gate", COMPUTED_CONSTANT}, {"g_Ks", "microS", "i_Ks", COMPUTED_CONSTANT}, {"Iso_shift", "millivolt", "i_Ks_n_gate", COMPUTED_CONSTANT}, - {"alpha_a", "per_second", "i_KACh_a_gate", COMPUTED_CONSTANT}, + {"alpha_a", "per_second", "i_KACh_a_gate", COMPUTED_CONSTANT} +}; + +const VariableInfo ALGEBRAIC_INFO[] = { {"E_Na", "millivolt", "Ionic_values", ALGEBRAIC}, {"Nai", "millimolar", "Nai_concentration", ALGEBRAIC}, {"E_Ca", "millivolt", "Ionic_values", ALGEBRAIC}, diff --git a/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.h b/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.h index e94e9dec00..1fee5d4d2b 100644 --- a/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.h +++ b/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.h @@ -29,7 +29,9 @@ typedef struct { extern const VariableInfo VOI_INFO; extern const VariableInfo STATE_INFO[]; -extern const VariableInfo VARIABLE_INFO[]; +extern const VariableInfo CONSTANT_INFO[]; +extern const VariableInfo COMPUTED_CONSTANT_INFO[]; +extern const VariableInfo ALGEBRAIC_INFO[]; double * createStatesArray(); double * createVariablesArray(); diff --git a/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.py b/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.py index 413cd1d94d..ef40ae85f8 100644 --- a/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.py +++ b/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.py @@ -23,8 +23,7 @@ class VariableType(Enum): VOI_INFO = {"name": "time", "units": "second", "component": "environment", "type": VariableType.VARIABLE_OF_INTEGRATION} -STATE_INFO = [ - {"name": "Ca_sub", "units": "millimolar", "component": "Ca_dynamics", "type": VariableType.STATE}, +STATE_INFO = {"name": "Ca_sub", "units": "millimolar", "component": "Ca_dynamics", "type": VariableType.STATE}, {"name": "Nai_", "units": "millimolar", "component": "Nai_concentration", "type": VariableType.STATE}, {"name": "Ca_jsr", "units": "millimolar", "component": "Ca_dynamics", "type": VariableType.STATE}, {"name": "O", "units": "dimensionless", "component": "Ca_SR_release", "type": VariableType.STATE}, @@ -57,9 +56,9 @@ class VariableType(Enum): {"name": "paS", "units": "dimensionless", "component": "i_Kr_pa_gate", "type": VariableType.STATE}, {"name": "n", "units": "dimensionless", "component": "i_Ks_n_gate", "type": VariableType.STATE}, {"name": "a", "units": "dimensionless", "component": "i_KACh_a_gate", "type": VariableType.STATE} -] -VARIABLE_INFO = [ + +CONSTANT_INFO = [ {"name": "ACh", "units": "millimolar", "component": "Rate_modulation_experiments", "type": VariableType.CONSTANT}, {"name": "Iso_1_uM", "units": "dimensionless", "component": "Rate_modulation_experiments", "type": VariableType.CONSTANT}, {"name": "Nao", "units": "millimolar", "component": "Ionic_values", "type": VariableType.CONSTANT}, @@ -150,7 +149,10 @@ class VariableType(Enum): {"name": "g_Kr", "units": "microS", "component": "i_Kr", "type": VariableType.CONSTANT}, {"name": "g_Ks_", "units": "microS", "component": "i_Ks", "type": VariableType.CONSTANT}, {"name": "ACh_on", "units": "dimensionless", "component": "i_KACh", "type": VariableType.CONSTANT}, - {"name": "g_KACh", "units": "microS", "component": "i_KACh", "type": VariableType.CONSTANT}, + {"name": "g_KACh", "units": "microS", "component": "i_KACh", "type": VariableType.CONSTANT} +] + +COMPUTED_CONSTANT_INFO = [ {"name": "RTONF", "units": "millivolt", "component": "Membrane", "type": VariableType.COMPUTED_CONSTANT}, {"name": "E_K", "units": "millivolt", "component": "Ionic_values", "type": VariableType.COMPUTED_CONSTANT}, {"name": "V_i", "units": "millimetre3", "component": "Cell_parameters", "type": VariableType.COMPUTED_CONSTANT}, @@ -175,7 +177,10 @@ class VariableType(Enum): {"name": "Iso_slope_dL", "units": "dimensionless", "component": "i_CaL_dL_gate", "type": VariableType.COMPUTED_CONSTANT}, {"name": "g_Ks", "units": "microS", "component": "i_Ks", "type": VariableType.COMPUTED_CONSTANT}, {"name": "Iso_shift", "units": "millivolt", "component": "i_Ks_n_gate", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "alpha_a", "units": "per_second", "component": "i_KACh_a_gate", "type": VariableType.COMPUTED_CONSTANT}, + {"name": "alpha_a", "units": "per_second", "component": "i_KACh_a_gate", "type": VariableType.COMPUTED_CONSTANT} +] + +ALGEBRAIC_INFO = [ {"name": "E_Na", "units": "millivolt", "component": "Ionic_values", "type": VariableType.ALGEBRAIC}, {"name": "Nai", "units": "millimolar", "component": "Nai_concentration", "type": VariableType.ALGEBRAIC}, {"name": "E_Ca", "units": "millivolt", "component": "Ionic_values", "type": VariableType.ALGEBRAIC}, diff --git a/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.c b/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.c index 798a745cac..7717d14f13 100644 --- a/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.c +++ b/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.c @@ -33,7 +33,7 @@ const VariableInfo STATE_INFO[] = { {"y", "dimensionless", "hyperpolarisation_activated_current_y_gate", STATE} }; -const VariableInfo VARIABLE_INFO[] = { +const VariableInfo CONSTANT_INFO[] = { {"dCell", "dimensionless", "membrane", CONSTANT}, {"Version", "dimensionless", "membrane", CONSTANT}, {"FCellConstant", "dimensionless", "membrane", CONSTANT}, @@ -143,7 +143,10 @@ const VariableInfo VARIABLE_INFO[] = { {"g_f_K_Centre_1DCapable", "microS", "hyperpolarisation_activated_current", CONSTANT}, {"g_f_K_Periphery_1DCapable", "microS", "hyperpolarisation_activated_current", CONSTANT}, {"g_f_K_Centre_0DCapable", "microS", "hyperpolarisation_activated_current", CONSTANT}, - {"g_f_K_Periphery_0DCapable", "microS", "hyperpolarisation_activated_current", CONSTANT}, + {"g_f_K_Periphery_0DCapable", "microS", "hyperpolarisation_activated_current", CONSTANT} +}; + +const VariableInfo COMPUTED_CONSTANT_INFO[] = { {"FCell", "dimensionless", "membrane", COMPUTED_CONSTANT}, {"Cm", "microF", "membrane", COMPUTED_CONSTANT}, {"i_Ca_p", "nanoA", "persistent_calcium_current", COMPUTED_CONSTANT}, @@ -166,7 +169,10 @@ const VariableInfo VARIABLE_INFO[] = { {"tau_P_i", "second", "rapid_delayed_rectifying_potassium_current_P_i_gate", COMPUTED_CONSTANT}, {"g_K_s", "microS", "slow_delayed_rectifying_potassium_current", COMPUTED_CONSTANT}, {"g_f_Na", "microS", "hyperpolarisation_activated_current", COMPUTED_CONSTANT}, - {"g_f_K", "microS", "hyperpolarisation_activated_current", COMPUTED_CONSTANT}, + {"g_f_K", "microS", "hyperpolarisation_activated_current", COMPUTED_CONSTANT} +}; + +const VariableInfo ALGEBRAIC_INFO[] = { {"i_Na", "nanoA", "sodium_current", ALGEBRAIC}, {"i_p", "nanoA", "sodium_potassium_pump", ALGEBRAIC}, {"i_NaCa", "nanoA", "sodium_calcium_exchanger", ALGEBRAIC}, diff --git a/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.h b/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.h index 2715ae2d90..5838d8bc89 100644 --- a/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.h +++ b/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.h @@ -29,7 +29,9 @@ typedef struct { extern const VariableInfo VOI_INFO; extern const VariableInfo STATE_INFO[]; -extern const VariableInfo VARIABLE_INFO[]; +extern const VariableInfo CONSTANT_INFO[]; +extern const VariableInfo COMPUTED_CONSTANT_INFO[]; +extern const VariableInfo ALGEBRAIC_INFO[]; double * createStatesArray(); double * createVariablesArray(); diff --git a/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.py b/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.py index 4c0443449d..01844df2cd 100644 --- a/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.py +++ b/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.py @@ -23,8 +23,7 @@ class VariableType(Enum): VOI_INFO = {"name": "time", "units": "second", "component": "environment", "type": VariableType.VARIABLE_OF_INTEGRATION} -STATE_INFO = [ - {"name": "V", "units": "millivolt", "component": "membrane", "type": VariableType.STATE}, +STATE_INFO = {"name": "V", "units": "millivolt", "component": "membrane", "type": VariableType.STATE}, {"name": "m", "units": "dimensionless", "component": "sodium_current_m_gate", "type": VariableType.STATE}, {"name": "h1", "units": "dimensionless", "component": "sodium_current_h_gate", "type": VariableType.STATE}, {"name": "h2", "units": "dimensionless", "component": "sodium_current_h_gate", "type": VariableType.STATE}, @@ -39,9 +38,9 @@ class VariableType(Enum): {"name": "P_as", "units": "dimensionless", "component": "rapid_delayed_rectifying_potassium_current_P_as_gate", "type": VariableType.STATE}, {"name": "xs", "units": "dimensionless", "component": "slow_delayed_rectifying_potassium_current_xs_gate", "type": VariableType.STATE}, {"name": "y", "units": "dimensionless", "component": "hyperpolarisation_activated_current_y_gate", "type": VariableType.STATE} -] -VARIABLE_INFO = [ + +CONSTANT_INFO = [ {"name": "dCell", "units": "dimensionless", "component": "membrane", "type": VariableType.CONSTANT}, {"name": "Version", "units": "dimensionless", "component": "membrane", "type": VariableType.CONSTANT}, {"name": "FCellConstant", "units": "dimensionless", "component": "membrane", "type": VariableType.CONSTANT}, @@ -151,7 +150,10 @@ class VariableType(Enum): {"name": "g_f_K_Centre_1DCapable", "units": "microS", "component": "hyperpolarisation_activated_current", "type": VariableType.CONSTANT}, {"name": "g_f_K_Periphery_1DCapable", "units": "microS", "component": "hyperpolarisation_activated_current", "type": VariableType.CONSTANT}, {"name": "g_f_K_Centre_0DCapable", "units": "microS", "component": "hyperpolarisation_activated_current", "type": VariableType.CONSTANT}, - {"name": "g_f_K_Periphery_0DCapable", "units": "microS", "component": "hyperpolarisation_activated_current", "type": VariableType.CONSTANT}, + {"name": "g_f_K_Periphery_0DCapable", "units": "microS", "component": "hyperpolarisation_activated_current", "type": VariableType.CONSTANT} +] + +COMPUTED_CONSTANT_INFO = [ {"name": "FCell", "units": "dimensionless", "component": "membrane", "type": VariableType.COMPUTED_CONSTANT}, {"name": "Cm", "units": "microF", "component": "membrane", "type": VariableType.COMPUTED_CONSTANT}, {"name": "i_Ca_p", "units": "nanoA", "component": "persistent_calcium_current", "type": VariableType.COMPUTED_CONSTANT}, @@ -174,7 +176,10 @@ class VariableType(Enum): {"name": "tau_P_i", "units": "second", "component": "rapid_delayed_rectifying_potassium_current_P_i_gate", "type": VariableType.COMPUTED_CONSTANT}, {"name": "g_K_s", "units": "microS", "component": "slow_delayed_rectifying_potassium_current", "type": VariableType.COMPUTED_CONSTANT}, {"name": "g_f_Na", "units": "microS", "component": "hyperpolarisation_activated_current", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "g_f_K", "units": "microS", "component": "hyperpolarisation_activated_current", "type": VariableType.COMPUTED_CONSTANT}, + {"name": "g_f_K", "units": "microS", "component": "hyperpolarisation_activated_current", "type": VariableType.COMPUTED_CONSTANT} +] + +ALGEBRAIC_INFO = [ {"name": "i_Na", "units": "nanoA", "component": "sodium_current", "type": VariableType.ALGEBRAIC}, {"name": "i_p", "units": "nanoA", "component": "sodium_potassium_pump", "type": VariableType.ALGEBRAIC}, {"name": "i_NaCa", "units": "nanoA", "component": "sodium_calcium_exchanger", "type": VariableType.ALGEBRAIC}, diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.c index 1d4908a139..f917c76649 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.c @@ -23,15 +23,21 @@ const VariableInfo STATE_INFO[] = { {"n", "dimensionless", "potassium_channel_n_gate", STATE} }; -const VariableInfo VARIABLE_INFO[] = { +const VariableInfo CONSTANT_INFO[] = { {"Cm", "microF_per_cm2", "membrane", CONSTANT}, {"E_R", "millivolt", "membrane", CONSTANT}, {"g_L", "milliS_per_cm2", "leakage_current", CONSTANT}, {"g_Na", "milliS_per_cm2", "sodium_channel", CONSTANT}, - {"g_K", "milliS_per_cm2", "potassium_channel", CONSTANT}, + {"g_K", "milliS_per_cm2", "potassium_channel", CONSTANT} +}; + +const VariableInfo COMPUTED_CONSTANT_INFO[] = { {"E_L", "millivolt", "leakage_current", COMPUTED_CONSTANT}, {"E_Na", "millivolt", "sodium_channel", COMPUTED_CONSTANT}, - {"E_K", "millivolt", "potassium_channel", COMPUTED_CONSTANT}, + {"E_K", "millivolt", "potassium_channel", COMPUTED_CONSTANT} +}; + +const VariableInfo ALGEBRAIC_INFO[] = { {"i_L", "microA_per_cm2", "leakage_current", ALGEBRAIC}, {"i_K", "microA_per_cm2", "potassium_channel", ALGEBRAIC}, {"i_Na", "microA_per_cm2", "sodium_channel", ALGEBRAIC}, @@ -40,7 +46,10 @@ const VariableInfo VARIABLE_INFO[] = { {"alpha_h", "per_millisecond", "sodium_channel_h_gate", ALGEBRAIC}, {"beta_h", "per_millisecond", "sodium_channel_h_gate", ALGEBRAIC}, {"alpha_n", "per_millisecond", "potassium_channel_n_gate", ALGEBRAIC}, - {"beta_n", "per_millisecond", "potassium_channel_n_gate", ALGEBRAIC}, + {"beta_n", "per_millisecond", "potassium_channel_n_gate", ALGEBRAIC} +}; + +const VariableInfo EXTERNAL_INFO[] = { {"i_Stim", "microA_per_cm2", "membrane", EXTERNAL} }; diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.h index 8ae5a3e5dd..5fb0b0dbc2 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.h +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.h @@ -31,7 +31,10 @@ typedef struct { extern const VariableInfo VOI_INFO; extern const VariableInfo STATE_INFO[]; -extern const VariableInfo VARIABLE_INFO[]; +extern const VariableInfo CONSTANT_INFO[]; +extern const VariableInfo COMPUTED_CONSTANT_INFO[]; +extern const VariableInfo ALGEBRAIC_INFO[]; +extern const VariableInfo EXTERNAL_INFO[]; double * createStatesArray(); double * createVariablesArray(); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.py index 5a01f6f0a8..069d0600da 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.py @@ -25,22 +25,27 @@ class VariableType(Enum): VOI_INFO = {"name": "time", "units": "millisecond", "component": "environment", "type": VariableType.VARIABLE_OF_INTEGRATION} -STATE_INFO = [ - {"name": "V", "units": "millivolt", "component": "membrane", "type": VariableType.STATE}, +STATE_INFO = {"name": "V", "units": "millivolt", "component": "membrane", "type": VariableType.STATE}, {"name": "h", "units": "dimensionless", "component": "sodium_channel_h_gate", "type": VariableType.STATE}, {"name": "m", "units": "dimensionless", "component": "sodium_channel_m_gate", "type": VariableType.STATE}, {"name": "n", "units": "dimensionless", "component": "potassium_channel_n_gate", "type": VariableType.STATE} -] -VARIABLE_INFO = [ + +CONSTANT_INFO = [ {"name": "Cm", "units": "microF_per_cm2", "component": "membrane", "type": VariableType.CONSTANT}, {"name": "E_R", "units": "millivolt", "component": "membrane", "type": VariableType.CONSTANT}, {"name": "g_L", "units": "milliS_per_cm2", "component": "leakage_current", "type": VariableType.CONSTANT}, {"name": "g_Na", "units": "milliS_per_cm2", "component": "sodium_channel", "type": VariableType.CONSTANT}, - {"name": "g_K", "units": "milliS_per_cm2", "component": "potassium_channel", "type": VariableType.CONSTANT}, + {"name": "g_K", "units": "milliS_per_cm2", "component": "potassium_channel", "type": VariableType.CONSTANT} +] + +COMPUTED_CONSTANT_INFO = [ {"name": "E_L", "units": "millivolt", "component": "leakage_current", "type": VariableType.COMPUTED_CONSTANT}, {"name": "E_Na", "units": "millivolt", "component": "sodium_channel", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "E_K", "units": "millivolt", "component": "potassium_channel", "type": VariableType.COMPUTED_CONSTANT}, + {"name": "E_K", "units": "millivolt", "component": "potassium_channel", "type": VariableType.COMPUTED_CONSTANT} +] + +ALGEBRAIC_INFO = [ {"name": "i_L", "units": "microA_per_cm2", "component": "leakage_current", "type": VariableType.ALGEBRAIC}, {"name": "i_K", "units": "microA_per_cm2", "component": "potassium_channel", "type": VariableType.ALGEBRAIC}, {"name": "i_Na", "units": "microA_per_cm2", "component": "sodium_channel", "type": VariableType.ALGEBRAIC}, @@ -49,7 +54,10 @@ class VariableType(Enum): {"name": "alpha_h", "units": "per_millisecond", "component": "sodium_channel_h_gate", "type": VariableType.ALGEBRAIC}, {"name": "beta_h", "units": "per_millisecond", "component": "sodium_channel_h_gate", "type": VariableType.ALGEBRAIC}, {"name": "alpha_n", "units": "per_millisecond", "component": "potassium_channel_n_gate", "type": VariableType.ALGEBRAIC}, - {"name": "beta_n", "units": "per_millisecond", "component": "potassium_channel_n_gate", "type": VariableType.ALGEBRAIC}, + {"name": "beta_n", "units": "per_millisecond", "component": "potassium_channel_n_gate", "type": VariableType.ALGEBRAIC} +] + +EXTERNAL_INFO = [ {"name": "i_Stim", "units": "microA_per_cm2", "component": "membrane", "type": VariableType.EXTERNAL} ] diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.c index 68474ef4fe..e031f85b45 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.c @@ -22,15 +22,21 @@ const VariableInfo STATE_INFO[] = { {"n", "dimensionless", "potassium_channel_n_gate", STATE} }; -const VariableInfo VARIABLE_INFO[] = { +const VariableInfo CONSTANT_INFO[] = { {"Cm", "microF_per_cm2", "membrane", CONSTANT}, {"E_R", "millivolt", "membrane", CONSTANT}, {"g_L", "milliS_per_cm2", "leakage_current", CONSTANT}, {"g_Na", "milliS_per_cm2", "sodium_channel", CONSTANT}, - {"g_K", "milliS_per_cm2", "potassium_channel", CONSTANT}, + {"g_K", "milliS_per_cm2", "potassium_channel", CONSTANT} +}; + +const VariableInfo COMPUTED_CONSTANT_INFO[] = { {"E_L", "millivolt", "leakage_current", COMPUTED_CONSTANT}, {"E_Na", "millivolt", "sodium_channel", COMPUTED_CONSTANT}, - {"E_K", "millivolt", "potassium_channel", COMPUTED_CONSTANT}, + {"E_K", "millivolt", "potassium_channel", COMPUTED_CONSTANT} +}; + +const VariableInfo ALGEBRAIC_INFO[] = { {"i_Stim", "microA_per_cm2", "membrane", ALGEBRAIC}, {"i_L", "microA_per_cm2", "leakage_current", ALGEBRAIC}, {"i_K", "microA_per_cm2", "potassium_channel", ALGEBRAIC}, diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.c index 69c72fb83b..6d9bf826c3 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.c @@ -23,14 +23,20 @@ const VariableInfo STATE_INFO[] = { {"n", "dimensionless", "potassium_channel_n_gate", STATE} }; -const VariableInfo VARIABLE_INFO[] = { +const VariableInfo CONSTANT_INFO[] = { {"Cm", "microF_per_cm2", "membrane", CONSTANT}, {"E_R", "millivolt", "membrane", CONSTANT}, {"g_L", "milliS_per_cm2", "leakage_current", CONSTANT}, {"g_Na", "milliS_per_cm2", "sodium_channel", CONSTANT}, - {"g_K", "milliS_per_cm2", "potassium_channel", CONSTANT}, + {"g_K", "milliS_per_cm2", "potassium_channel", CONSTANT} +}; + +const VariableInfo COMPUTED_CONSTANT_INFO[] = { {"E_Na", "millivolt", "sodium_channel", COMPUTED_CONSTANT}, - {"E_K", "millivolt", "potassium_channel", COMPUTED_CONSTANT}, + {"E_K", "millivolt", "potassium_channel", COMPUTED_CONSTANT} +}; + +const VariableInfo ALGEBRAIC_INFO[] = { {"i_Stim", "microA_per_cm2", "membrane", ALGEBRAIC}, {"i_L", "microA_per_cm2", "leakage_current", ALGEBRAIC}, {"i_K", "microA_per_cm2", "potassium_channel", ALGEBRAIC}, @@ -40,7 +46,10 @@ const VariableInfo VARIABLE_INFO[] = { {"alpha_h", "per_millisecond", "sodium_channel_h_gate", ALGEBRAIC}, {"beta_h", "per_millisecond", "sodium_channel_h_gate", ALGEBRAIC}, {"alpha_n", "per_millisecond", "potassium_channel_n_gate", ALGEBRAIC}, - {"beta_n", "per_millisecond", "potassium_channel_n_gate", ALGEBRAIC}, + {"beta_n", "per_millisecond", "potassium_channel_n_gate", ALGEBRAIC} +}; + +const VariableInfo EXTERNAL_INFO[] = { {"E_L", "millivolt", "leakage_current", EXTERNAL} }; diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.h index 8ae5a3e5dd..5fb0b0dbc2 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.h +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.h @@ -31,7 +31,10 @@ typedef struct { extern const VariableInfo VOI_INFO; extern const VariableInfo STATE_INFO[]; -extern const VariableInfo VARIABLE_INFO[]; +extern const VariableInfo CONSTANT_INFO[]; +extern const VariableInfo COMPUTED_CONSTANT_INFO[]; +extern const VariableInfo ALGEBRAIC_INFO[]; +extern const VariableInfo EXTERNAL_INFO[]; double * createStatesArray(); double * createVariablesArray(); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.py index 39e9f1d653..b8319e0fd5 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.py @@ -25,21 +25,26 @@ class VariableType(Enum): VOI_INFO = {"name": "time", "units": "millisecond", "component": "environment", "type": VariableType.VARIABLE_OF_INTEGRATION} -STATE_INFO = [ - {"name": "V", "units": "millivolt", "component": "membrane", "type": VariableType.STATE}, +STATE_INFO = {"name": "V", "units": "millivolt", "component": "membrane", "type": VariableType.STATE}, {"name": "h", "units": "dimensionless", "component": "sodium_channel_h_gate", "type": VariableType.STATE}, {"name": "m", "units": "dimensionless", "component": "sodium_channel_m_gate", "type": VariableType.STATE}, {"name": "n", "units": "dimensionless", "component": "potassium_channel_n_gate", "type": VariableType.STATE} -] -VARIABLE_INFO = [ + +CONSTANT_INFO = [ {"name": "Cm", "units": "microF_per_cm2", "component": "membrane", "type": VariableType.CONSTANT}, {"name": "E_R", "units": "millivolt", "component": "membrane", "type": VariableType.CONSTANT}, {"name": "g_L", "units": "milliS_per_cm2", "component": "leakage_current", "type": VariableType.CONSTANT}, {"name": "g_Na", "units": "milliS_per_cm2", "component": "sodium_channel", "type": VariableType.CONSTANT}, - {"name": "g_K", "units": "milliS_per_cm2", "component": "potassium_channel", "type": VariableType.CONSTANT}, + {"name": "g_K", "units": "milliS_per_cm2", "component": "potassium_channel", "type": VariableType.CONSTANT} +] + +COMPUTED_CONSTANT_INFO = [ {"name": "E_Na", "units": "millivolt", "component": "sodium_channel", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "E_K", "units": "millivolt", "component": "potassium_channel", "type": VariableType.COMPUTED_CONSTANT}, + {"name": "E_K", "units": "millivolt", "component": "potassium_channel", "type": VariableType.COMPUTED_CONSTANT} +] + +ALGEBRAIC_INFO = [ {"name": "i_Stim", "units": "microA_per_cm2", "component": "membrane", "type": VariableType.ALGEBRAIC}, {"name": "i_L", "units": "microA_per_cm2", "component": "leakage_current", "type": VariableType.ALGEBRAIC}, {"name": "i_K", "units": "microA_per_cm2", "component": "potassium_channel", "type": VariableType.ALGEBRAIC}, @@ -49,7 +54,10 @@ class VariableType(Enum): {"name": "alpha_h", "units": "per_millisecond", "component": "sodium_channel_h_gate", "type": VariableType.ALGEBRAIC}, {"name": "beta_h", "units": "per_millisecond", "component": "sodium_channel_h_gate", "type": VariableType.ALGEBRAIC}, {"name": "alpha_n", "units": "per_millisecond", "component": "potassium_channel_n_gate", "type": VariableType.ALGEBRAIC}, - {"name": "beta_n", "units": "per_millisecond", "component": "potassium_channel_n_gate", "type": VariableType.ALGEBRAIC}, + {"name": "beta_n", "units": "per_millisecond", "component": "potassium_channel_n_gate", "type": VariableType.ALGEBRAIC} +] + +EXTERNAL_INFO = [ {"name": "E_L", "units": "millivolt", "component": "leakage_current", "type": VariableType.EXTERNAL} ] diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.c index d9d05dbabc..5637ee56eb 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.c @@ -23,14 +23,20 @@ const VariableInfo STATE_INFO[] = { {"n", "dimensionless", "potassium_channel_n_gate", STATE} }; -const VariableInfo VARIABLE_INFO[] = { +const VariableInfo CONSTANT_INFO[] = { {"E_R", "millivolt", "membrane", CONSTANT}, {"g_L", "milliS_per_cm2", "leakage_current", CONSTANT}, {"g_Na", "milliS_per_cm2", "sodium_channel", CONSTANT}, - {"g_K", "milliS_per_cm2", "potassium_channel", CONSTANT}, + {"g_K", "milliS_per_cm2", "potassium_channel", CONSTANT} +}; + +const VariableInfo COMPUTED_CONSTANT_INFO[] = { {"E_L", "millivolt", "leakage_current", COMPUTED_CONSTANT}, {"E_Na", "millivolt", "sodium_channel", COMPUTED_CONSTANT}, - {"E_K", "millivolt", "potassium_channel", COMPUTED_CONSTANT}, + {"E_K", "millivolt", "potassium_channel", COMPUTED_CONSTANT} +}; + +const VariableInfo ALGEBRAIC_INFO[] = { {"i_Stim", "microA_per_cm2", "membrane", ALGEBRAIC}, {"i_L", "microA_per_cm2", "leakage_current", ALGEBRAIC}, {"i_K", "microA_per_cm2", "potassium_channel", ALGEBRAIC}, @@ -40,7 +46,10 @@ const VariableInfo VARIABLE_INFO[] = { {"alpha_h", "per_millisecond", "sodium_channel_h_gate", ALGEBRAIC}, {"beta_h", "per_millisecond", "sodium_channel_h_gate", ALGEBRAIC}, {"alpha_n", "per_millisecond", "potassium_channel_n_gate", ALGEBRAIC}, - {"beta_n", "per_millisecond", "potassium_channel_n_gate", ALGEBRAIC}, + {"beta_n", "per_millisecond", "potassium_channel_n_gate", ALGEBRAIC} +}; + +const VariableInfo EXTERNAL_INFO[] = { {"Cm", "microF_per_cm2", "membrane", EXTERNAL} }; diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.h index 8ae5a3e5dd..5fb0b0dbc2 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.h +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.h @@ -31,7 +31,10 @@ typedef struct { extern const VariableInfo VOI_INFO; extern const VariableInfo STATE_INFO[]; -extern const VariableInfo VARIABLE_INFO[]; +extern const VariableInfo CONSTANT_INFO[]; +extern const VariableInfo COMPUTED_CONSTANT_INFO[]; +extern const VariableInfo ALGEBRAIC_INFO[]; +extern const VariableInfo EXTERNAL_INFO[]; double * createStatesArray(); double * createVariablesArray(); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.py index 3749793d0d..bb2ac5e624 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.py @@ -25,21 +25,26 @@ class VariableType(Enum): VOI_INFO = {"name": "time", "units": "millisecond", "component": "environment", "type": VariableType.VARIABLE_OF_INTEGRATION} -STATE_INFO = [ - {"name": "V", "units": "millivolt", "component": "membrane", "type": VariableType.STATE}, +STATE_INFO = {"name": "V", "units": "millivolt", "component": "membrane", "type": VariableType.STATE}, {"name": "h", "units": "dimensionless", "component": "sodium_channel_h_gate", "type": VariableType.STATE}, {"name": "m", "units": "dimensionless", "component": "sodium_channel_m_gate", "type": VariableType.STATE}, {"name": "n", "units": "dimensionless", "component": "potassium_channel_n_gate", "type": VariableType.STATE} -] -VARIABLE_INFO = [ + +CONSTANT_INFO = [ {"name": "E_R", "units": "millivolt", "component": "membrane", "type": VariableType.CONSTANT}, {"name": "g_L", "units": "milliS_per_cm2", "component": "leakage_current", "type": VariableType.CONSTANT}, {"name": "g_Na", "units": "milliS_per_cm2", "component": "sodium_channel", "type": VariableType.CONSTANT}, - {"name": "g_K", "units": "milliS_per_cm2", "component": "potassium_channel", "type": VariableType.CONSTANT}, + {"name": "g_K", "units": "milliS_per_cm2", "component": "potassium_channel", "type": VariableType.CONSTANT} +] + +COMPUTED_CONSTANT_INFO = [ {"name": "E_L", "units": "millivolt", "component": "leakage_current", "type": VariableType.COMPUTED_CONSTANT}, {"name": "E_Na", "units": "millivolt", "component": "sodium_channel", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "E_K", "units": "millivolt", "component": "potassium_channel", "type": VariableType.COMPUTED_CONSTANT}, + {"name": "E_K", "units": "millivolt", "component": "potassium_channel", "type": VariableType.COMPUTED_CONSTANT} +] + +ALGEBRAIC_INFO = [ {"name": "i_Stim", "units": "microA_per_cm2", "component": "membrane", "type": VariableType.ALGEBRAIC}, {"name": "i_L", "units": "microA_per_cm2", "component": "leakage_current", "type": VariableType.ALGEBRAIC}, {"name": "i_K", "units": "microA_per_cm2", "component": "potassium_channel", "type": VariableType.ALGEBRAIC}, @@ -49,7 +54,10 @@ class VariableType(Enum): {"name": "alpha_h", "units": "per_millisecond", "component": "sodium_channel_h_gate", "type": VariableType.ALGEBRAIC}, {"name": "beta_h", "units": "per_millisecond", "component": "sodium_channel_h_gate", "type": VariableType.ALGEBRAIC}, {"name": "alpha_n", "units": "per_millisecond", "component": "potassium_channel_n_gate", "type": VariableType.ALGEBRAIC}, - {"name": "beta_n", "units": "per_millisecond", "component": "potassium_channel_n_gate", "type": VariableType.ALGEBRAIC}, + {"name": "beta_n", "units": "per_millisecond", "component": "potassium_channel_n_gate", "type": VariableType.ALGEBRAIC} +] + +EXTERNAL_INFO = [ {"name": "Cm", "units": "microF_per_cm2", "component": "membrane", "type": VariableType.EXTERNAL} ] diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.c index 4048ffd583..4fd81f7a08 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.c @@ -22,15 +22,21 @@ const VariableInfo STATE_INFO[] = { {"n", "dimensionless", "potassium_channel_n_gate", STATE} }; -const VariableInfo VARIABLE_INFO[] = { +const VariableInfo CONSTANT_INFO[] = { {"Cm", "microF_per_cm2", "membrane", CONSTANT}, {"E_R", "millivolt", "membrane", CONSTANT}, {"g_L", "milliS_per_cm2", "leakage_current", CONSTANT}, {"g_Na", "milliS_per_cm2", "sodium_channel", CONSTANT}, - {"g_K", "milliS_per_cm2", "potassium_channel", CONSTANT}, + {"g_K", "milliS_per_cm2", "potassium_channel", CONSTANT} +}; + +const VariableInfo COMPUTED_CONSTANT_INFO[] = { {"E_L", "millivolt", "leakage_current", COMPUTED_CONSTANT}, {"E_Na", "millivolt", "sodium_channel", COMPUTED_CONSTANT}, - {"E_K", "millivolt", "potassium_channel", COMPUTED_CONSTANT}, + {"E_K", "millivolt", "potassium_channel", COMPUTED_CONSTANT} +}; + +const VariableInfo ALGEBRAIC_INFO[] = { {"i_Stim", "microA_per_cm2", "membrane", ALGEBRAIC}, {"i_L", "microA_per_cm2", "leakage_current", ALGEBRAIC}, {"i_K", "microA_per_cm2", "potassium_channel", ALGEBRAIC}, diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.h index 2379ada7dc..7a76b71aff 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.h +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.h @@ -29,7 +29,9 @@ typedef struct { extern const VariableInfo VOI_INFO; extern const VariableInfo STATE_INFO[]; -extern const VariableInfo VARIABLE_INFO[]; +extern const VariableInfo CONSTANT_INFO[]; +extern const VariableInfo COMPUTED_CONSTANT_INFO[]; +extern const VariableInfo ALGEBRAIC_INFO[]; double * createStatesArray(); double * createVariablesArray(); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.py index cbeb56196a..a58ab94164 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.py @@ -23,22 +23,27 @@ class VariableType(Enum): VOI_INFO = {"name": "time", "units": "millisecond", "component": "environment", "type": VariableType.VARIABLE_OF_INTEGRATION} -STATE_INFO = [ - {"name": "V", "units": "millivolt", "component": "membrane", "type": VariableType.STATE}, +STATE_INFO = {"name": "V", "units": "millivolt", "component": "membrane", "type": VariableType.STATE}, {"name": "h", "units": "dimensionless", "component": "sodium_channel_h_gate", "type": VariableType.STATE}, {"name": "m", "units": "dimensionless", "component": "sodium_channel_m_gate", "type": VariableType.STATE}, {"name": "n", "units": "dimensionless", "component": "potassium_channel_n_gate", "type": VariableType.STATE} -] -VARIABLE_INFO = [ + +CONSTANT_INFO = [ {"name": "Cm", "units": "microF_per_cm2", "component": "membrane", "type": VariableType.CONSTANT}, {"name": "E_R", "units": "millivolt", "component": "membrane", "type": VariableType.CONSTANT}, {"name": "g_L", "units": "milliS_per_cm2", "component": "leakage_current", "type": VariableType.CONSTANT}, {"name": "g_Na", "units": "milliS_per_cm2", "component": "sodium_channel", "type": VariableType.CONSTANT}, - {"name": "g_K", "units": "milliS_per_cm2", "component": "potassium_channel", "type": VariableType.CONSTANT}, + {"name": "g_K", "units": "milliS_per_cm2", "component": "potassium_channel", "type": VariableType.CONSTANT} +] + +COMPUTED_CONSTANT_INFO = [ {"name": "E_L", "units": "millivolt", "component": "leakage_current", "type": VariableType.COMPUTED_CONSTANT}, {"name": "E_Na", "units": "millivolt", "component": "sodium_channel", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "E_K", "units": "millivolt", "component": "potassium_channel", "type": VariableType.COMPUTED_CONSTANT}, + {"name": "E_K", "units": "millivolt", "component": "potassium_channel", "type": VariableType.COMPUTED_CONSTANT} +] + +ALGEBRAIC_INFO = [ {"name": "i_Stim", "units": "microA_per_cm2", "component": "membrane", "type": VariableType.ALGEBRAIC}, {"name": "i_L", "units": "microA_per_cm2", "component": "leakage_current", "type": VariableType.ALGEBRAIC}, {"name": "i_K", "units": "microA_per_cm2", "component": "potassium_channel", "type": VariableType.ALGEBRAIC}, diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.c index e38ef8855e..b51c60bfdf 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.c @@ -23,15 +23,21 @@ const VariableInfo STATE_INFO[] = { {"n", "dimensionless", "potassium_channel_n_gate", STATE} }; -const VariableInfo VARIABLE_INFO[] = { +const VariableInfo CONSTANT_INFO[] = { {"Cm", "microF_per_cm2", "membrane", CONSTANT}, {"E_R", "millivolt", "membrane", CONSTANT}, {"g_L", "milliS_per_cm2", "leakage_current", CONSTANT}, {"g_Na", "milliS_per_cm2", "sodium_channel", CONSTANT}, - {"g_K", "milliS_per_cm2", "potassium_channel", CONSTANT}, + {"g_K", "milliS_per_cm2", "potassium_channel", CONSTANT} +}; + +const VariableInfo COMPUTED_CONSTANT_INFO[] = { {"E_L", "millivolt", "leakage_current", COMPUTED_CONSTANT}, {"E_Na", "millivolt", "sodium_channel", COMPUTED_CONSTANT}, - {"E_K", "millivolt", "potassium_channel", COMPUTED_CONSTANT}, + {"E_K", "millivolt", "potassium_channel", COMPUTED_CONSTANT} +}; + +const VariableInfo ALGEBRAIC_INFO[] = { {"i_L", "microA_per_cm2", "leakage_current", ALGEBRAIC}, {"i_K", "microA_per_cm2", "potassium_channel", ALGEBRAIC}, {"i_Na", "microA_per_cm2", "sodium_channel", ALGEBRAIC}, @@ -39,7 +45,10 @@ const VariableInfo VARIABLE_INFO[] = { {"beta_m", "per_millisecond", "sodium_channel_m_gate", ALGEBRAIC}, {"alpha_h", "per_millisecond", "sodium_channel_h_gate", ALGEBRAIC}, {"beta_h", "per_millisecond", "sodium_channel_h_gate", ALGEBRAIC}, - {"alpha_n", "per_millisecond", "potassium_channel_n_gate", ALGEBRAIC}, + {"alpha_n", "per_millisecond", "potassium_channel_n_gate", ALGEBRAIC} +}; + +const VariableInfo EXTERNAL_INFO[] = { {"i_Stim", "microA_per_cm2", "membrane", EXTERNAL}, {"beta_n", "per_millisecond", "potassium_channel_n_gate", EXTERNAL} }; diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.h index 8ae5a3e5dd..5fb0b0dbc2 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.h +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.h @@ -31,7 +31,10 @@ typedef struct { extern const VariableInfo VOI_INFO; extern const VariableInfo STATE_INFO[]; -extern const VariableInfo VARIABLE_INFO[]; +extern const VariableInfo CONSTANT_INFO[]; +extern const VariableInfo COMPUTED_CONSTANT_INFO[]; +extern const VariableInfo ALGEBRAIC_INFO[]; +extern const VariableInfo EXTERNAL_INFO[]; double * createStatesArray(); double * createVariablesArray(); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.py index 98ab308f32..715e2a036a 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.py @@ -25,22 +25,27 @@ class VariableType(Enum): VOI_INFO = {"name": "time", "units": "millisecond", "component": "environment", "type": VariableType.VARIABLE_OF_INTEGRATION} -STATE_INFO = [ - {"name": "V", "units": "millivolt", "component": "membrane", "type": VariableType.STATE}, +STATE_INFO = {"name": "V", "units": "millivolt", "component": "membrane", "type": VariableType.STATE}, {"name": "h", "units": "dimensionless", "component": "sodium_channel_h_gate", "type": VariableType.STATE}, {"name": "m", "units": "dimensionless", "component": "sodium_channel_m_gate", "type": VariableType.STATE}, {"name": "n", "units": "dimensionless", "component": "potassium_channel_n_gate", "type": VariableType.STATE} -] -VARIABLE_INFO = [ + +CONSTANT_INFO = [ {"name": "Cm", "units": "microF_per_cm2", "component": "membrane", "type": VariableType.CONSTANT}, {"name": "E_R", "units": "millivolt", "component": "membrane", "type": VariableType.CONSTANT}, {"name": "g_L", "units": "milliS_per_cm2", "component": "leakage_current", "type": VariableType.CONSTANT}, {"name": "g_Na", "units": "milliS_per_cm2", "component": "sodium_channel", "type": VariableType.CONSTANT}, - {"name": "g_K", "units": "milliS_per_cm2", "component": "potassium_channel", "type": VariableType.CONSTANT}, + {"name": "g_K", "units": "milliS_per_cm2", "component": "potassium_channel", "type": VariableType.CONSTANT} +] + +COMPUTED_CONSTANT_INFO = [ {"name": "E_L", "units": "millivolt", "component": "leakage_current", "type": VariableType.COMPUTED_CONSTANT}, {"name": "E_Na", "units": "millivolt", "component": "sodium_channel", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "E_K", "units": "millivolt", "component": "potassium_channel", "type": VariableType.COMPUTED_CONSTANT}, + {"name": "E_K", "units": "millivolt", "component": "potassium_channel", "type": VariableType.COMPUTED_CONSTANT} +] + +ALGEBRAIC_INFO = [ {"name": "i_L", "units": "microA_per_cm2", "component": "leakage_current", "type": VariableType.ALGEBRAIC}, {"name": "i_K", "units": "microA_per_cm2", "component": "potassium_channel", "type": VariableType.ALGEBRAIC}, {"name": "i_Na", "units": "microA_per_cm2", "component": "sodium_channel", "type": VariableType.ALGEBRAIC}, @@ -48,7 +53,10 @@ class VariableType(Enum): {"name": "beta_m", "units": "per_millisecond", "component": "sodium_channel_m_gate", "type": VariableType.ALGEBRAIC}, {"name": "alpha_h", "units": "per_millisecond", "component": "sodium_channel_h_gate", "type": VariableType.ALGEBRAIC}, {"name": "beta_h", "units": "per_millisecond", "component": "sodium_channel_h_gate", "type": VariableType.ALGEBRAIC}, - {"name": "alpha_n", "units": "per_millisecond", "component": "potassium_channel_n_gate", "type": VariableType.ALGEBRAIC}, + {"name": "alpha_n", "units": "per_millisecond", "component": "potassium_channel_n_gate", "type": VariableType.ALGEBRAIC} +] + +EXTERNAL_INFO = [ {"name": "i_Stim", "units": "microA_per_cm2", "component": "membrane", "type": VariableType.EXTERNAL}, {"name": "beta_n", "units": "per_millisecond", "component": "potassium_channel_n_gate", "type": VariableType.EXTERNAL} ] diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.c index 91f595dd07..c27fbd144f 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.c @@ -23,11 +23,17 @@ const VariableInfo STATE_INFO[] = { {"n", "dimensionless", "potassium_channel_n_gate", STATE} }; -const VariableInfo VARIABLE_INFO[] = { +const VariableInfo CONSTANT_INFO[] = { {"Cm", "microF_per_cm2", "membrane", CONSTANT}, {"g_L", "milliS_per_cm2", "leakage_current", CONSTANT}, {"g_Na", "milliS_per_cm2", "sodium_channel", CONSTANT}, - {"g_K", "milliS_per_cm2", "potassium_channel", CONSTANT}, + {"g_K", "milliS_per_cm2", "potassium_channel", CONSTANT} +}; + +const VariableInfo COMPUTED_CONSTANT_INFO[] = { +}; + +const VariableInfo ALGEBRAIC_INFO[] = { {"i_Stim", "microA_per_cm2", "membrane", ALGEBRAIC}, {"i_L", "microA_per_cm2", "leakage_current", ALGEBRAIC}, {"i_K", "microA_per_cm2", "potassium_channel", ALGEBRAIC}, @@ -39,7 +45,10 @@ const VariableInfo VARIABLE_INFO[] = { {"alpha_h", "per_millisecond", "sodium_channel_h_gate", ALGEBRAIC}, {"beta_h", "per_millisecond", "sodium_channel_h_gate", ALGEBRAIC}, {"alpha_n", "per_millisecond", "potassium_channel_n_gate", ALGEBRAIC}, - {"beta_n", "per_millisecond", "potassium_channel_n_gate", ALGEBRAIC}, + {"beta_n", "per_millisecond", "potassium_channel_n_gate", ALGEBRAIC} +}; + +const VariableInfo EXTERNAL_INFO[] = { {"E_R", "millivolt", "membrane", EXTERNAL}, {"E_K", "millivolt", "potassium_channel", EXTERNAL} }; diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.h index 8ae5a3e5dd..5fb0b0dbc2 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.h +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.h @@ -31,7 +31,10 @@ typedef struct { extern const VariableInfo VOI_INFO; extern const VariableInfo STATE_INFO[]; -extern const VariableInfo VARIABLE_INFO[]; +extern const VariableInfo CONSTANT_INFO[]; +extern const VariableInfo COMPUTED_CONSTANT_INFO[]; +extern const VariableInfo ALGEBRAIC_INFO[]; +extern const VariableInfo EXTERNAL_INFO[]; double * createStatesArray(); double * createVariablesArray(); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.py index 7785dba580..4bd3875267 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.py @@ -25,18 +25,23 @@ class VariableType(Enum): VOI_INFO = {"name": "time", "units": "millisecond", "component": "environment", "type": VariableType.VARIABLE_OF_INTEGRATION} -STATE_INFO = [ - {"name": "V", "units": "millivolt", "component": "membrane", "type": VariableType.STATE}, +STATE_INFO = {"name": "V", "units": "millivolt", "component": "membrane", "type": VariableType.STATE}, {"name": "h", "units": "dimensionless", "component": "sodium_channel_h_gate", "type": VariableType.STATE}, {"name": "m", "units": "dimensionless", "component": "sodium_channel_m_gate", "type": VariableType.STATE}, {"name": "n", "units": "dimensionless", "component": "potassium_channel_n_gate", "type": VariableType.STATE} -] -VARIABLE_INFO = [ + +CONSTANT_INFO = [ {"name": "Cm", "units": "microF_per_cm2", "component": "membrane", "type": VariableType.CONSTANT}, {"name": "g_L", "units": "milliS_per_cm2", "component": "leakage_current", "type": VariableType.CONSTANT}, {"name": "g_Na", "units": "milliS_per_cm2", "component": "sodium_channel", "type": VariableType.CONSTANT}, - {"name": "g_K", "units": "milliS_per_cm2", "component": "potassium_channel", "type": VariableType.CONSTANT}, + {"name": "g_K", "units": "milliS_per_cm2", "component": "potassium_channel", "type": VariableType.CONSTANT} +] + +COMPUTED_CONSTANT_INFO = [ +] + +ALGEBRAIC_INFO = [ {"name": "i_Stim", "units": "microA_per_cm2", "component": "membrane", "type": VariableType.ALGEBRAIC}, {"name": "i_L", "units": "microA_per_cm2", "component": "leakage_current", "type": VariableType.ALGEBRAIC}, {"name": "i_K", "units": "microA_per_cm2", "component": "potassium_channel", "type": VariableType.ALGEBRAIC}, @@ -48,7 +53,10 @@ class VariableType(Enum): {"name": "alpha_h", "units": "per_millisecond", "component": "sodium_channel_h_gate", "type": VariableType.ALGEBRAIC}, {"name": "beta_h", "units": "per_millisecond", "component": "sodium_channel_h_gate", "type": VariableType.ALGEBRAIC}, {"name": "alpha_n", "units": "per_millisecond", "component": "potassium_channel_n_gate", "type": VariableType.ALGEBRAIC}, - {"name": "beta_n", "units": "per_millisecond", "component": "potassium_channel_n_gate", "type": VariableType.ALGEBRAIC}, + {"name": "beta_n", "units": "per_millisecond", "component": "potassium_channel_n_gate", "type": VariableType.ALGEBRAIC} +] + +EXTERNAL_INFO = [ {"name": "E_R", "units": "millivolt", "component": "membrane", "type": VariableType.EXTERNAL}, {"name": "E_K", "units": "millivolt", "component": "potassium_channel", "type": VariableType.EXTERNAL} ] diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.c index 3193041ba2..125ae87227 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.c @@ -23,13 +23,19 @@ const VariableInfo STATE_INFO[] = { {"n", "dimensionless", "potassium_channel_n_gate", STATE} }; -const VariableInfo VARIABLE_INFO[] = { +const VariableInfo CONSTANT_INFO[] = { {"E_R", "millivolt", "membrane", CONSTANT}, {"g_L", "milliS_per_cm2", "leakage_current", CONSTANT}, - {"g_K", "milliS_per_cm2", "potassium_channel", CONSTANT}, + {"g_K", "milliS_per_cm2", "potassium_channel", CONSTANT} +}; + +const VariableInfo COMPUTED_CONSTANT_INFO[] = { {"E_L", "millivolt", "leakage_current", COMPUTED_CONSTANT}, {"E_Na", "millivolt", "sodium_channel", COMPUTED_CONSTANT}, - {"E_K", "millivolt", "potassium_channel", COMPUTED_CONSTANT}, + {"E_K", "millivolt", "potassium_channel", COMPUTED_CONSTANT} +}; + +const VariableInfo ALGEBRAIC_INFO[] = { {"i_Stim", "microA_per_cm2", "membrane", ALGEBRAIC}, {"i_L", "microA_per_cm2", "leakage_current", ALGEBRAIC}, {"i_K", "microA_per_cm2", "potassium_channel", ALGEBRAIC}, @@ -39,7 +45,10 @@ const VariableInfo VARIABLE_INFO[] = { {"alpha_h", "per_millisecond", "sodium_channel_h_gate", ALGEBRAIC}, {"beta_h", "per_millisecond", "sodium_channel_h_gate", ALGEBRAIC}, {"alpha_n", "per_millisecond", "potassium_channel_n_gate", ALGEBRAIC}, - {"beta_n", "per_millisecond", "potassium_channel_n_gate", ALGEBRAIC}, + {"beta_n", "per_millisecond", "potassium_channel_n_gate", ALGEBRAIC} +}; + +const VariableInfo EXTERNAL_INFO[] = { {"Cm", "microF_per_cm2", "membrane", EXTERNAL}, {"g_Na", "milliS_per_cm2", "sodium_channel", EXTERNAL} }; diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.h index 8ae5a3e5dd..5fb0b0dbc2 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.h +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.h @@ -31,7 +31,10 @@ typedef struct { extern const VariableInfo VOI_INFO; extern const VariableInfo STATE_INFO[]; -extern const VariableInfo VARIABLE_INFO[]; +extern const VariableInfo CONSTANT_INFO[]; +extern const VariableInfo COMPUTED_CONSTANT_INFO[]; +extern const VariableInfo ALGEBRAIC_INFO[]; +extern const VariableInfo EXTERNAL_INFO[]; double * createStatesArray(); double * createVariablesArray(); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.py index 49f7f8bcb6..78a627ae1d 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.py @@ -25,20 +25,25 @@ class VariableType(Enum): VOI_INFO = {"name": "time", "units": "millisecond", "component": "environment", "type": VariableType.VARIABLE_OF_INTEGRATION} -STATE_INFO = [ - {"name": "V", "units": "millivolt", "component": "membrane", "type": VariableType.STATE}, +STATE_INFO = {"name": "V", "units": "millivolt", "component": "membrane", "type": VariableType.STATE}, {"name": "h", "units": "dimensionless", "component": "sodium_channel_h_gate", "type": VariableType.STATE}, {"name": "m", "units": "dimensionless", "component": "sodium_channel_m_gate", "type": VariableType.STATE}, {"name": "n", "units": "dimensionless", "component": "potassium_channel_n_gate", "type": VariableType.STATE} -] -VARIABLE_INFO = [ + +CONSTANT_INFO = [ {"name": "E_R", "units": "millivolt", "component": "membrane", "type": VariableType.CONSTANT}, {"name": "g_L", "units": "milliS_per_cm2", "component": "leakage_current", "type": VariableType.CONSTANT}, - {"name": "g_K", "units": "milliS_per_cm2", "component": "potassium_channel", "type": VariableType.CONSTANT}, + {"name": "g_K", "units": "milliS_per_cm2", "component": "potassium_channel", "type": VariableType.CONSTANT} +] + +COMPUTED_CONSTANT_INFO = [ {"name": "E_L", "units": "millivolt", "component": "leakage_current", "type": VariableType.COMPUTED_CONSTANT}, {"name": "E_Na", "units": "millivolt", "component": "sodium_channel", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "E_K", "units": "millivolt", "component": "potassium_channel", "type": VariableType.COMPUTED_CONSTANT}, + {"name": "E_K", "units": "millivolt", "component": "potassium_channel", "type": VariableType.COMPUTED_CONSTANT} +] + +ALGEBRAIC_INFO = [ {"name": "i_Stim", "units": "microA_per_cm2", "component": "membrane", "type": VariableType.ALGEBRAIC}, {"name": "i_L", "units": "microA_per_cm2", "component": "leakage_current", "type": VariableType.ALGEBRAIC}, {"name": "i_K", "units": "microA_per_cm2", "component": "potassium_channel", "type": VariableType.ALGEBRAIC}, @@ -48,7 +53,10 @@ class VariableType(Enum): {"name": "alpha_h", "units": "per_millisecond", "component": "sodium_channel_h_gate", "type": VariableType.ALGEBRAIC}, {"name": "beta_h", "units": "per_millisecond", "component": "sodium_channel_h_gate", "type": VariableType.ALGEBRAIC}, {"name": "alpha_n", "units": "per_millisecond", "component": "potassium_channel_n_gate", "type": VariableType.ALGEBRAIC}, - {"name": "beta_n", "units": "per_millisecond", "component": "potassium_channel_n_gate", "type": VariableType.ALGEBRAIC}, + {"name": "beta_n", "units": "per_millisecond", "component": "potassium_channel_n_gate", "type": VariableType.ALGEBRAIC} +] + +EXTERNAL_INFO = [ {"name": "Cm", "units": "microF_per_cm2", "component": "membrane", "type": VariableType.EXTERNAL}, {"name": "g_Na", "units": "milliS_per_cm2", "component": "sodium_channel", "type": VariableType.EXTERNAL} ] diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.c index a36578b7b9..f8caa76515 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.c @@ -21,15 +21,21 @@ const VariableInfo STATE_INFO[] = { {"n", "dimensionless", "potassium_channel_n_gate", STATE} }; -const VariableInfo VARIABLE_INFO[] = { +const VariableInfo CONSTANT_INFO[] = { {"Cm", "microF_per_cm2", "membrane", CONSTANT}, {"E_R", "millivolt", "membrane", CONSTANT}, {"g_L", "milliS_per_cm2", "leakage_current", CONSTANT}, {"g_Na", "milliS_per_cm2", "sodium_channel", CONSTANT}, - {"g_K", "milliS_per_cm2", "potassium_channel", CONSTANT}, + {"g_K", "milliS_per_cm2", "potassium_channel", CONSTANT} +}; + +const VariableInfo COMPUTED_CONSTANT_INFO[] = { {"E_L", "millivolt", "leakage_current", COMPUTED_CONSTANT}, {"E_Na", "millivolt", "sodium_channel", COMPUTED_CONSTANT}, - {"E_K", "millivolt", "potassium_channel", COMPUTED_CONSTANT}, + {"E_K", "millivolt", "potassium_channel", COMPUTED_CONSTANT} +}; + +const VariableInfo ALGEBRAIC_INFO[] = { {"i_Stim", "microA_per_cm2", "membrane", ALGEBRAIC}, {"i_L", "microA_per_cm2", "leakage_current", ALGEBRAIC}, {"i_K", "microA_per_cm2", "potassium_channel", ALGEBRAIC}, @@ -39,7 +45,10 @@ const VariableInfo VARIABLE_INFO[] = { {"alpha_h", "per_millisecond", "sodium_channel_h_gate", ALGEBRAIC}, {"beta_h", "per_millisecond", "sodium_channel_h_gate", ALGEBRAIC}, {"alpha_n", "per_millisecond", "potassium_channel_n_gate", ALGEBRAIC}, - {"beta_n", "per_millisecond", "potassium_channel_n_gate", ALGEBRAIC}, + {"beta_n", "per_millisecond", "potassium_channel_n_gate", ALGEBRAIC} +}; + +const VariableInfo EXTERNAL_INFO[] = { {"V", "millivolt", "membrane", EXTERNAL}, {"m", "dimensionless", "sodium_channel_m_gate", EXTERNAL} }; diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.h index 8ae5a3e5dd..5fb0b0dbc2 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.h +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.h @@ -31,7 +31,10 @@ typedef struct { extern const VariableInfo VOI_INFO; extern const VariableInfo STATE_INFO[]; -extern const VariableInfo VARIABLE_INFO[]; +extern const VariableInfo CONSTANT_INFO[]; +extern const VariableInfo COMPUTED_CONSTANT_INFO[]; +extern const VariableInfo ALGEBRAIC_INFO[]; +extern const VariableInfo EXTERNAL_INFO[]; double * createStatesArray(); double * createVariablesArray(); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.py index 10b92a843f..6d926cf22d 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.py @@ -25,20 +25,25 @@ class VariableType(Enum): VOI_INFO = {"name": "time", "units": "millisecond", "component": "environment", "type": VariableType.VARIABLE_OF_INTEGRATION} -STATE_INFO = [ - {"name": "h", "units": "dimensionless", "component": "sodium_channel_h_gate", "type": VariableType.STATE}, +STATE_INFO = {"name": "h", "units": "dimensionless", "component": "sodium_channel_h_gate", "type": VariableType.STATE}, {"name": "n", "units": "dimensionless", "component": "potassium_channel_n_gate", "type": VariableType.STATE} -] -VARIABLE_INFO = [ + +CONSTANT_INFO = [ {"name": "Cm", "units": "microF_per_cm2", "component": "membrane", "type": VariableType.CONSTANT}, {"name": "E_R", "units": "millivolt", "component": "membrane", "type": VariableType.CONSTANT}, {"name": "g_L", "units": "milliS_per_cm2", "component": "leakage_current", "type": VariableType.CONSTANT}, {"name": "g_Na", "units": "milliS_per_cm2", "component": "sodium_channel", "type": VariableType.CONSTANT}, - {"name": "g_K", "units": "milliS_per_cm2", "component": "potassium_channel", "type": VariableType.CONSTANT}, + {"name": "g_K", "units": "milliS_per_cm2", "component": "potassium_channel", "type": VariableType.CONSTANT} +] + +COMPUTED_CONSTANT_INFO = [ {"name": "E_L", "units": "millivolt", "component": "leakage_current", "type": VariableType.COMPUTED_CONSTANT}, {"name": "E_Na", "units": "millivolt", "component": "sodium_channel", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "E_K", "units": "millivolt", "component": "potassium_channel", "type": VariableType.COMPUTED_CONSTANT}, + {"name": "E_K", "units": "millivolt", "component": "potassium_channel", "type": VariableType.COMPUTED_CONSTANT} +] + +ALGEBRAIC_INFO = [ {"name": "i_Stim", "units": "microA_per_cm2", "component": "membrane", "type": VariableType.ALGEBRAIC}, {"name": "i_L", "units": "microA_per_cm2", "component": "leakage_current", "type": VariableType.ALGEBRAIC}, {"name": "i_K", "units": "microA_per_cm2", "component": "potassium_channel", "type": VariableType.ALGEBRAIC}, @@ -48,7 +53,10 @@ class VariableType(Enum): {"name": "alpha_h", "units": "per_millisecond", "component": "sodium_channel_h_gate", "type": VariableType.ALGEBRAIC}, {"name": "beta_h", "units": "per_millisecond", "component": "sodium_channel_h_gate", "type": VariableType.ALGEBRAIC}, {"name": "alpha_n", "units": "per_millisecond", "component": "potassium_channel_n_gate", "type": VariableType.ALGEBRAIC}, - {"name": "beta_n", "units": "per_millisecond", "component": "potassium_channel_n_gate", "type": VariableType.ALGEBRAIC}, + {"name": "beta_n", "units": "per_millisecond", "component": "potassium_channel_n_gate", "type": VariableType.ALGEBRAIC} +] + +EXTERNAL_INFO = [ {"name": "V", "units": "millivolt", "component": "membrane", "type": VariableType.EXTERNAL}, {"name": "m", "units": "dimensionless", "component": "sodium_channel_m_gate", "type": VariableType.EXTERNAL} ] diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.c index 3cb02dcd1c..c3b86c0a31 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.c @@ -22,15 +22,21 @@ const VariableInfo STATE_INFO[] = { {"n", "dimensionless", "potassium_channel_n_gate", STATE} }; -const VariableInfo VARIABLE_INFO[] = { +const VariableInfo CONSTANT_INFO[] = { {"Cm", "microF_per_cm2", "membrane", CONSTANT}, {"E_R", "millivolt", "membrane", CONSTANT}, {"g_L", "milliS_per_cm2", "leakage_current", CONSTANT}, {"g_Na", "milliS_per_cm2", "sodium_channel", CONSTANT}, - {"g_K", "milliS_per_cm2", "potassium_channel", CONSTANT}, + {"g_K", "milliS_per_cm2", "potassium_channel", CONSTANT} +}; + +const VariableInfo COMPUTED_CONSTANT_INFO[] = { {"E_L", "millivolt", "leakage_current", COMPUTED_CONSTANT}, {"E_Na", "millivolt", "sodium_channel", COMPUTED_CONSTANT}, - {"E_K", "millivolt", "potassium_channel", COMPUTED_CONSTANT}, + {"E_K", "millivolt", "potassium_channel", COMPUTED_CONSTANT} +}; + +const VariableInfo ALGEBRAIC_INFO[] = { {"i_Stim", "microA_per_cm2", "membrane", ALGEBRAIC}, {"i_L", "microA_per_cm2", "leakage_current", ALGEBRAIC}, {"i_K", "microA_per_cm2", "potassium_channel", ALGEBRAIC}, @@ -38,7 +44,10 @@ const VariableInfo VARIABLE_INFO[] = { {"beta_m", "per_millisecond", "sodium_channel_m_gate", ALGEBRAIC}, {"alpha_h", "per_millisecond", "sodium_channel_h_gate", ALGEBRAIC}, {"beta_h", "per_millisecond", "sodium_channel_h_gate", ALGEBRAIC}, - {"beta_n", "per_millisecond", "potassium_channel_n_gate", ALGEBRAIC}, + {"beta_n", "per_millisecond", "potassium_channel_n_gate", ALGEBRAIC} +}; + +const VariableInfo EXTERNAL_INFO[] = { {"V", "millivolt", "membrane", EXTERNAL}, {"i_Na", "microA_per_cm2", "sodium_channel", EXTERNAL}, {"alpha_n", "per_millisecond", "potassium_channel_n_gate", EXTERNAL} diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.h index 8ae5a3e5dd..5fb0b0dbc2 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.h +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.h @@ -31,7 +31,10 @@ typedef struct { extern const VariableInfo VOI_INFO; extern const VariableInfo STATE_INFO[]; -extern const VariableInfo VARIABLE_INFO[]; +extern const VariableInfo CONSTANT_INFO[]; +extern const VariableInfo COMPUTED_CONSTANT_INFO[]; +extern const VariableInfo ALGEBRAIC_INFO[]; +extern const VariableInfo EXTERNAL_INFO[]; double * createStatesArray(); double * createVariablesArray(); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.py index 1f15be90f4..8ec0625cec 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.py @@ -25,21 +25,26 @@ class VariableType(Enum): VOI_INFO = {"name": "time", "units": "millisecond", "component": "environment", "type": VariableType.VARIABLE_OF_INTEGRATION} -STATE_INFO = [ - {"name": "h", "units": "dimensionless", "component": "sodium_channel_h_gate", "type": VariableType.STATE}, +STATE_INFO = {"name": "h", "units": "dimensionless", "component": "sodium_channel_h_gate", "type": VariableType.STATE}, {"name": "m", "units": "dimensionless", "component": "sodium_channel_m_gate", "type": VariableType.STATE}, {"name": "n", "units": "dimensionless", "component": "potassium_channel_n_gate", "type": VariableType.STATE} -] -VARIABLE_INFO = [ + +CONSTANT_INFO = [ {"name": "Cm", "units": "microF_per_cm2", "component": "membrane", "type": VariableType.CONSTANT}, {"name": "E_R", "units": "millivolt", "component": "membrane", "type": VariableType.CONSTANT}, {"name": "g_L", "units": "milliS_per_cm2", "component": "leakage_current", "type": VariableType.CONSTANT}, {"name": "g_Na", "units": "milliS_per_cm2", "component": "sodium_channel", "type": VariableType.CONSTANT}, - {"name": "g_K", "units": "milliS_per_cm2", "component": "potassium_channel", "type": VariableType.CONSTANT}, + {"name": "g_K", "units": "milliS_per_cm2", "component": "potassium_channel", "type": VariableType.CONSTANT} +] + +COMPUTED_CONSTANT_INFO = [ {"name": "E_L", "units": "millivolt", "component": "leakage_current", "type": VariableType.COMPUTED_CONSTANT}, {"name": "E_Na", "units": "millivolt", "component": "sodium_channel", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "E_K", "units": "millivolt", "component": "potassium_channel", "type": VariableType.COMPUTED_CONSTANT}, + {"name": "E_K", "units": "millivolt", "component": "potassium_channel", "type": VariableType.COMPUTED_CONSTANT} +] + +ALGEBRAIC_INFO = [ {"name": "i_Stim", "units": "microA_per_cm2", "component": "membrane", "type": VariableType.ALGEBRAIC}, {"name": "i_L", "units": "microA_per_cm2", "component": "leakage_current", "type": VariableType.ALGEBRAIC}, {"name": "i_K", "units": "microA_per_cm2", "component": "potassium_channel", "type": VariableType.ALGEBRAIC}, @@ -47,7 +52,10 @@ class VariableType(Enum): {"name": "beta_m", "units": "per_millisecond", "component": "sodium_channel_m_gate", "type": VariableType.ALGEBRAIC}, {"name": "alpha_h", "units": "per_millisecond", "component": "sodium_channel_h_gate", "type": VariableType.ALGEBRAIC}, {"name": "beta_h", "units": "per_millisecond", "component": "sodium_channel_h_gate", "type": VariableType.ALGEBRAIC}, - {"name": "beta_n", "units": "per_millisecond", "component": "potassium_channel_n_gate", "type": VariableType.ALGEBRAIC}, + {"name": "beta_n", "units": "per_millisecond", "component": "potassium_channel_n_gate", "type": VariableType.ALGEBRAIC} +] + +EXTERNAL_INFO = [ {"name": "V", "units": "millivolt", "component": "membrane", "type": VariableType.EXTERNAL}, {"name": "i_Na", "units": "microA_per_cm2", "component": "sodium_channel", "type": VariableType.EXTERNAL}, {"name": "alpha_n", "units": "per_millisecond", "component": "potassium_channel_n_gate", "type": VariableType.EXTERNAL} diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.h index 2379ada7dc..7a76b71aff 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.h +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.h @@ -29,7 +29,9 @@ typedef struct { extern const VariableInfo VOI_INFO; extern const VariableInfo STATE_INFO[]; -extern const VariableInfo VARIABLE_INFO[]; +extern const VariableInfo CONSTANT_INFO[]; +extern const VariableInfo COMPUTED_CONSTANT_INFO[]; +extern const VariableInfo ALGEBRAIC_INFO[]; double * createStatesArray(); double * createVariablesArray(); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.py index de38477e32..6f1ab2d372 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.py @@ -23,22 +23,27 @@ class VariableType(Enum): VOI_INFO = {"name": "time", "units": "millisecond", "component": "environment", "type": VariableType.VARIABLE_OF_INTEGRATION} -STATE_INFO = [ - {"name": "V", "units": "millivolt", "component": "membrane", "type": VariableType.STATE}, +STATE_INFO = {"name": "V", "units": "millivolt", "component": "membrane", "type": VariableType.STATE}, {"name": "h", "units": "dimensionless", "component": "sodium_channel_h_gate", "type": VariableType.STATE}, {"name": "m", "units": "dimensionless", "component": "sodium_channel_m_gate", "type": VariableType.STATE}, {"name": "n", "units": "dimensionless", "component": "potassium_channel_n_gate", "type": VariableType.STATE} -] -VARIABLE_INFO = [ + +CONSTANT_INFO = [ {"name": "Cm", "units": "microF_per_cm2", "component": "membrane", "type": VariableType.CONSTANT}, {"name": "E_R", "units": "millivolt", "component": "membrane", "type": VariableType.CONSTANT}, {"name": "g_L", "units": "milliS_per_cm2", "component": "leakage_current", "type": VariableType.CONSTANT}, {"name": "g_Na", "units": "milliS_per_cm2", "component": "sodium_channel", "type": VariableType.CONSTANT}, - {"name": "g_K", "units": "milliS_per_cm2", "component": "potassium_channel", "type": VariableType.CONSTANT}, + {"name": "g_K", "units": "milliS_per_cm2", "component": "potassium_channel", "type": VariableType.CONSTANT} +] + +COMPUTED_CONSTANT_INFO = [ {"name": "E_L", "units": "millivolt", "component": "leakage_current", "type": VariableType.COMPUTED_CONSTANT}, {"name": "E_Na", "units": "millivolt", "component": "sodium_channel", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "E_K", "units": "millivolt", "component": "potassium_channel", "type": VariableType.COMPUTED_CONSTANT}, + {"name": "E_K", "units": "millivolt", "component": "potassium_channel", "type": VariableType.COMPUTED_CONSTANT} +] + +ALGEBRAIC_INFO = [ {"name": "i_Stim", "units": "microA_per_cm2", "component": "membrane", "type": VariableType.ALGEBRAIC}, {"name": "i_L", "units": "microA_per_cm2", "component": "leakage_current", "type": VariableType.ALGEBRAIC}, {"name": "i_K", "units": "microA_per_cm2", "component": "potassium_channel", "type": VariableType.ALGEBRAIC}, diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.c index a1ec41db71..2492a86c03 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.c @@ -22,15 +22,21 @@ const VariableInfo STATE_INFO[] = { {"n", "dimensionless", "potassium_channel_n_gate", STATE} }; -const VariableInfo VARIABLE_INFO[] = { +const VariableInfo CONSTANT_INFO[] = { {"Cm", "microF_per_cm2", "membrane", CONSTANT}, {"E_R", "millivolt", "membrane", CONSTANT}, {"g_L", "milliS_per_cm2", "leakage_current", CONSTANT}, {"g_Na", "milliS_per_cm2", "sodium_channel", CONSTANT}, - {"g_K", "milliS_per_cm2", "potassium_channel", CONSTANT}, + {"g_K", "milliS_per_cm2", "potassium_channel", CONSTANT} +}; + +const VariableInfo COMPUTED_CONSTANT_INFO[] = { {"E_L", "millivolt", "leakage_current", COMPUTED_CONSTANT}, {"E_Na", "millivolt", "sodium_channel", COMPUTED_CONSTANT}, - {"E_K", "millivolt", "potassium_channel", COMPUTED_CONSTANT}, + {"E_K", "millivolt", "potassium_channel", COMPUTED_CONSTANT} +}; + +const VariableInfo ALGEBRAIC_INFO[] = { {"i_Stim", "microA_per_cm2", "membrane", ALGEBRAIC}, {"i_L", "microA_per_cm2", "leakage_current", ALGEBRAIC}, {"i_K", "microA_per_cm2", "potassium_channel", ALGEBRAIC}, @@ -40,7 +46,10 @@ const VariableInfo VARIABLE_INFO[] = { {"alpha_h", "per_millisecond", "sodium_channel_h_gate", ALGEBRAIC}, {"beta_h", "per_millisecond", "sodium_channel_h_gate", ALGEBRAIC}, {"alpha_n", "per_millisecond", "potassium_channel_n_gate", ALGEBRAIC}, - {"beta_n", "per_millisecond", "potassium_channel_n_gate", ALGEBRAIC}, + {"beta_n", "per_millisecond", "potassium_channel_n_gate", ALGEBRAIC} +}; + +const VariableInfo EXTERNAL_INFO[] = { {"m", "dimensionless", "sodium_channel_m_gate", EXTERNAL} }; diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.h index 8ae5a3e5dd..5fb0b0dbc2 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.h +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.h @@ -31,7 +31,10 @@ typedef struct { extern const VariableInfo VOI_INFO; extern const VariableInfo STATE_INFO[]; -extern const VariableInfo VARIABLE_INFO[]; +extern const VariableInfo CONSTANT_INFO[]; +extern const VariableInfo COMPUTED_CONSTANT_INFO[]; +extern const VariableInfo ALGEBRAIC_INFO[]; +extern const VariableInfo EXTERNAL_INFO[]; double * createStatesArray(); double * createVariablesArray(); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.py index 2ed93ed11c..40c52077b9 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.py @@ -25,21 +25,26 @@ class VariableType(Enum): VOI_INFO = {"name": "time", "units": "millisecond", "component": "environment", "type": VariableType.VARIABLE_OF_INTEGRATION} -STATE_INFO = [ - {"name": "V", "units": "millivolt", "component": "membrane", "type": VariableType.STATE}, +STATE_INFO = {"name": "V", "units": "millivolt", "component": "membrane", "type": VariableType.STATE}, {"name": "h", "units": "dimensionless", "component": "sodium_channel_h_gate", "type": VariableType.STATE}, {"name": "n", "units": "dimensionless", "component": "potassium_channel_n_gate", "type": VariableType.STATE} -] -VARIABLE_INFO = [ + +CONSTANT_INFO = [ {"name": "Cm", "units": "microF_per_cm2", "component": "membrane", "type": VariableType.CONSTANT}, {"name": "E_R", "units": "millivolt", "component": "membrane", "type": VariableType.CONSTANT}, {"name": "g_L", "units": "milliS_per_cm2", "component": "leakage_current", "type": VariableType.CONSTANT}, {"name": "g_Na", "units": "milliS_per_cm2", "component": "sodium_channel", "type": VariableType.CONSTANT}, - {"name": "g_K", "units": "milliS_per_cm2", "component": "potassium_channel", "type": VariableType.CONSTANT}, + {"name": "g_K", "units": "milliS_per_cm2", "component": "potassium_channel", "type": VariableType.CONSTANT} +] + +COMPUTED_CONSTANT_INFO = [ {"name": "E_L", "units": "millivolt", "component": "leakage_current", "type": VariableType.COMPUTED_CONSTANT}, {"name": "E_Na", "units": "millivolt", "component": "sodium_channel", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "E_K", "units": "millivolt", "component": "potassium_channel", "type": VariableType.COMPUTED_CONSTANT}, + {"name": "E_K", "units": "millivolt", "component": "potassium_channel", "type": VariableType.COMPUTED_CONSTANT} +] + +ALGEBRAIC_INFO = [ {"name": "i_Stim", "units": "microA_per_cm2", "component": "membrane", "type": VariableType.ALGEBRAIC}, {"name": "i_L", "units": "microA_per_cm2", "component": "leakage_current", "type": VariableType.ALGEBRAIC}, {"name": "i_K", "units": "microA_per_cm2", "component": "potassium_channel", "type": VariableType.ALGEBRAIC}, @@ -49,7 +54,10 @@ class VariableType(Enum): {"name": "alpha_h", "units": "per_millisecond", "component": "sodium_channel_h_gate", "type": VariableType.ALGEBRAIC}, {"name": "beta_h", "units": "per_millisecond", "component": "sodium_channel_h_gate", "type": VariableType.ALGEBRAIC}, {"name": "alpha_n", "units": "per_millisecond", "component": "potassium_channel_n_gate", "type": VariableType.ALGEBRAIC}, - {"name": "beta_n", "units": "per_millisecond", "component": "potassium_channel_n_gate", "type": VariableType.ALGEBRAIC}, + {"name": "beta_n", "units": "per_millisecond", "component": "potassium_channel_n_gate", "type": VariableType.ALGEBRAIC} +] + +EXTERNAL_INFO = [ {"name": "m", "units": "dimensionless", "component": "sodium_channel_m_gate", "type": VariableType.EXTERNAL} ] diff --git a/tests/resources/generator/noble_model_1962/model.c b/tests/resources/generator/noble_model_1962/model.c index 01b9013b68..7966221694 100644 --- a/tests/resources/generator/noble_model_1962/model.c +++ b/tests/resources/generator/noble_model_1962/model.c @@ -22,12 +22,18 @@ const VariableInfo STATE_INFO[] = { {"n", "dimensionless", "potassium_channel_n_gate", STATE} }; -const VariableInfo VARIABLE_INFO[] = { +const VariableInfo CONSTANT_INFO[] = { {"Cm", "microF_per_cm2", "membrane", CONSTANT}, {"g_L", "milliS_per_cm2", "leakage_current", CONSTANT}, {"E_L", "millivolt", "leakage_current", CONSTANT}, {"g_Na_max", "milliS_per_cm2", "sodium_channel", CONSTANT}, - {"E_Na", "millivolt", "sodium_channel", CONSTANT}, + {"E_Na", "millivolt", "sodium_channel", CONSTANT} +}; + +const VariableInfo COMPUTED_CONSTANT_INFO[] = { +}; + +const VariableInfo ALGEBRAIC_INFO[] = { {"i_Na", "microA_per_cm2", "sodium_channel", ALGEBRAIC}, {"i_Leak", "microA_per_cm2", "leakage_current", ALGEBRAIC}, {"i_K", "microA_per_cm2", "potassium_channel", ALGEBRAIC}, diff --git a/tests/resources/generator/noble_model_1962/model.h b/tests/resources/generator/noble_model_1962/model.h index a4c365da25..76e98a8542 100644 --- a/tests/resources/generator/noble_model_1962/model.h +++ b/tests/resources/generator/noble_model_1962/model.h @@ -29,7 +29,9 @@ typedef struct { extern const VariableInfo VOI_INFO; extern const VariableInfo STATE_INFO[]; -extern const VariableInfo VARIABLE_INFO[]; +extern const VariableInfo CONSTANT_INFO[]; +extern const VariableInfo COMPUTED_CONSTANT_INFO[]; +extern const VariableInfo ALGEBRAIC_INFO[]; double * createStatesArray(); double * createVariablesArray(); diff --git a/tests/resources/generator/noble_model_1962/model.py b/tests/resources/generator/noble_model_1962/model.py index 4eb81b090f..7a19fb3e3f 100644 --- a/tests/resources/generator/noble_model_1962/model.py +++ b/tests/resources/generator/noble_model_1962/model.py @@ -23,19 +23,24 @@ class VariableType(Enum): VOI_INFO = {"name": "time", "units": "millisecond", "component": "environment", "type": VariableType.VARIABLE_OF_INTEGRATION} -STATE_INFO = [ - {"name": "V", "units": "millivolt", "component": "membrane", "type": VariableType.STATE}, +STATE_INFO = {"name": "V", "units": "millivolt", "component": "membrane", "type": VariableType.STATE}, {"name": "m", "units": "dimensionless", "component": "sodium_channel_m_gate", "type": VariableType.STATE}, {"name": "h", "units": "dimensionless", "component": "sodium_channel_h_gate", "type": VariableType.STATE}, {"name": "n", "units": "dimensionless", "component": "potassium_channel_n_gate", "type": VariableType.STATE} -] -VARIABLE_INFO = [ + +CONSTANT_INFO = [ {"name": "Cm", "units": "microF_per_cm2", "component": "membrane", "type": VariableType.CONSTANT}, {"name": "g_L", "units": "milliS_per_cm2", "component": "leakage_current", "type": VariableType.CONSTANT}, {"name": "E_L", "units": "millivolt", "component": "leakage_current", "type": VariableType.CONSTANT}, {"name": "g_Na_max", "units": "milliS_per_cm2", "component": "sodium_channel", "type": VariableType.CONSTANT}, - {"name": "E_Na", "units": "millivolt", "component": "sodium_channel", "type": VariableType.CONSTANT}, + {"name": "E_Na", "units": "millivolt", "component": "sodium_channel", "type": VariableType.CONSTANT} +] + +COMPUTED_CONSTANT_INFO = [ +] + +ALGEBRAIC_INFO = [ {"name": "i_Na", "units": "microA_per_cm2", "component": "sodium_channel", "type": VariableType.ALGEBRAIC}, {"name": "i_Leak", "units": "microA_per_cm2", "component": "leakage_current", "type": VariableType.ALGEBRAIC}, {"name": "i_K", "units": "microA_per_cm2", "component": "potassium_channel", "type": VariableType.ALGEBRAIC}, diff --git a/tests/resources/generator/ode_computed_var_on_rhs/model.c b/tests/resources/generator/ode_computed_var_on_rhs/model.c index 1eadd46729..1aee953d69 100644 --- a/tests/resources/generator/ode_computed_var_on_rhs/model.c +++ b/tests/resources/generator/ode_computed_var_on_rhs/model.c @@ -19,10 +19,16 @@ const VariableInfo STATE_INFO[] = { {"x", "dimensionless", "my_ode", STATE} }; -const VariableInfo VARIABLE_INFO[] = { +const VariableInfo CONSTANT_INFO[] = { +}; + +const VariableInfo COMPUTED_CONSTANT_INFO[] = { {"a", "per_s", "my_ode", COMPUTED_CONSTANT} }; +const VariableInfo ALGEBRAIC_INFO[] = { +}; + double * createStatesArray() { double *res = (double *) malloc(STATE_COUNT*sizeof(double)); diff --git a/tests/resources/generator/ode_computed_var_on_rhs/model.h b/tests/resources/generator/ode_computed_var_on_rhs/model.h index 3f1fb63fd2..35acb14707 100644 --- a/tests/resources/generator/ode_computed_var_on_rhs/model.h +++ b/tests/resources/generator/ode_computed_var_on_rhs/model.h @@ -29,7 +29,9 @@ typedef struct { extern const VariableInfo VOI_INFO; extern const VariableInfo STATE_INFO[]; -extern const VariableInfo VARIABLE_INFO[]; +extern const VariableInfo CONSTANT_INFO[]; +extern const VariableInfo COMPUTED_CONSTANT_INFO[]; +extern const VariableInfo ALGEBRAIC_INFO[]; double * createStatesArray(); double * createVariablesArray(); diff --git a/tests/resources/generator/ode_computed_var_on_rhs/model.py b/tests/resources/generator/ode_computed_var_on_rhs/model.py index 6de2a7b40a..a0eefbb103 100644 --- a/tests/resources/generator/ode_computed_var_on_rhs/model.py +++ b/tests/resources/generator/ode_computed_var_on_rhs/model.py @@ -23,14 +23,19 @@ class VariableType(Enum): VOI_INFO = {"name": "t", "units": "second", "component": "environment", "type": VariableType.VARIABLE_OF_INTEGRATION} -STATE_INFO = [ - {"name": "x", "units": "dimensionless", "component": "my_ode", "type": VariableType.STATE} +STATE_INFO = {"name": "x", "units": "dimensionless", "component": "my_ode", "type": VariableType.STATE} + + +CONSTANT_INFO = [ ] -VARIABLE_INFO = [ +COMPUTED_CONSTANT_INFO = [ {"name": "a", "units": "per_s", "component": "my_ode", "type": VariableType.COMPUTED_CONSTANT} ] +ALGEBRAIC_INFO = [ +] + def create_states_array(): return [nan]*STATE_COUNT diff --git a/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.c b/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.c index 35629691c5..5917645d36 100644 --- a/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.c +++ b/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.c @@ -19,10 +19,16 @@ const VariableInfo STATE_INFO[] = { {"x", "dimensionless", "my_component", STATE} }; -const VariableInfo VARIABLE_INFO[] = { +const VariableInfo CONSTANT_INFO[] = { +}; + +const VariableInfo COMPUTED_CONSTANT_INFO[] = { {"a", "per_s", "my_component", COMPUTED_CONSTANT} }; +const VariableInfo ALGEBRAIC_INFO[] = { +}; + double * createStatesArray() { double *res = (double *) malloc(STATE_COUNT*sizeof(double)); diff --git a/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.h b/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.h index ca79cc5f25..ec10997670 100644 --- a/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.h +++ b/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.h @@ -29,7 +29,9 @@ typedef struct { extern const VariableInfo VOI_INFO; extern const VariableInfo STATE_INFO[]; -extern const VariableInfo VARIABLE_INFO[]; +extern const VariableInfo CONSTANT_INFO[]; +extern const VariableInfo COMPUTED_CONSTANT_INFO[]; +extern const VariableInfo ALGEBRAIC_INFO[]; double * createStatesArray(); double * createVariablesArray(); diff --git a/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.py b/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.py index 48b38de074..694094710a 100644 --- a/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.py +++ b/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.py @@ -23,14 +23,19 @@ class VariableType(Enum): VOI_INFO = {"name": "t", "units": "second", "component": "my_component", "type": VariableType.VARIABLE_OF_INTEGRATION} -STATE_INFO = [ - {"name": "x", "units": "dimensionless", "component": "my_component", "type": VariableType.STATE} +STATE_INFO = {"name": "x", "units": "dimensionless", "component": "my_component", "type": VariableType.STATE} + + +CONSTANT_INFO = [ ] -VARIABLE_INFO = [ +COMPUTED_CONSTANT_INFO = [ {"name": "a", "units": "per_s", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT} ] +ALGEBRAIC_INFO = [ +] + def create_states_array(): return [nan]*STATE_COUNT diff --git a/tests/resources/generator/ode_const_var_on_rhs/model.c b/tests/resources/generator/ode_const_var_on_rhs/model.c index 7324a50b7b..9008822215 100644 --- a/tests/resources/generator/ode_const_var_on_rhs/model.c +++ b/tests/resources/generator/ode_const_var_on_rhs/model.c @@ -19,10 +19,16 @@ const VariableInfo STATE_INFO[] = { {"x", "dimensionless", "my_ode", STATE} }; -const VariableInfo VARIABLE_INFO[] = { +const VariableInfo CONSTANT_INFO[] = { {"a", "per_s", "my_ode", CONSTANT} }; +const VariableInfo COMPUTED_CONSTANT_INFO[] = { +}; + +const VariableInfo ALGEBRAIC_INFO[] = { +}; + double * createStatesArray() { double *res = (double *) malloc(STATE_COUNT*sizeof(double)); diff --git a/tests/resources/generator/ode_const_var_on_rhs/model.h b/tests/resources/generator/ode_const_var_on_rhs/model.h index 3f1fb63fd2..35acb14707 100644 --- a/tests/resources/generator/ode_const_var_on_rhs/model.h +++ b/tests/resources/generator/ode_const_var_on_rhs/model.h @@ -29,7 +29,9 @@ typedef struct { extern const VariableInfo VOI_INFO; extern const VariableInfo STATE_INFO[]; -extern const VariableInfo VARIABLE_INFO[]; +extern const VariableInfo CONSTANT_INFO[]; +extern const VariableInfo COMPUTED_CONSTANT_INFO[]; +extern const VariableInfo ALGEBRAIC_INFO[]; double * createStatesArray(); double * createVariablesArray(); diff --git a/tests/resources/generator/ode_const_var_on_rhs/model.py b/tests/resources/generator/ode_const_var_on_rhs/model.py index 913f34ea27..183abb260c 100644 --- a/tests/resources/generator/ode_const_var_on_rhs/model.py +++ b/tests/resources/generator/ode_const_var_on_rhs/model.py @@ -23,14 +23,19 @@ class VariableType(Enum): VOI_INFO = {"name": "t", "units": "second", "component": "environment", "type": VariableType.VARIABLE_OF_INTEGRATION} -STATE_INFO = [ - {"name": "x", "units": "dimensionless", "component": "my_ode", "type": VariableType.STATE} -] +STATE_INFO = {"name": "x", "units": "dimensionless", "component": "my_ode", "type": VariableType.STATE} + -VARIABLE_INFO = [ +CONSTANT_INFO = [ {"name": "a", "units": "per_s", "component": "my_ode", "type": VariableType.CONSTANT} ] +COMPUTED_CONSTANT_INFO = [ +] + +ALGEBRAIC_INFO = [ +] + def create_states_array(): return [nan]*STATE_COUNT diff --git a/tests/resources/generator/ode_const_var_on_rhs_one_component/model.c b/tests/resources/generator/ode_const_var_on_rhs_one_component/model.c index 2e3fe1c553..c982a3aa03 100644 --- a/tests/resources/generator/ode_const_var_on_rhs_one_component/model.c +++ b/tests/resources/generator/ode_const_var_on_rhs_one_component/model.c @@ -19,10 +19,16 @@ const VariableInfo STATE_INFO[] = { {"x", "dimensionless", "my_component", STATE} }; -const VariableInfo VARIABLE_INFO[] = { +const VariableInfo CONSTANT_INFO[] = { {"a", "per_s", "my_component", CONSTANT} }; +const VariableInfo COMPUTED_CONSTANT_INFO[] = { +}; + +const VariableInfo ALGEBRAIC_INFO[] = { +}; + double * createStatesArray() { double *res = (double *) malloc(STATE_COUNT*sizeof(double)); diff --git a/tests/resources/generator/ode_const_var_on_rhs_one_component/model.h b/tests/resources/generator/ode_const_var_on_rhs_one_component/model.h index ca79cc5f25..ec10997670 100644 --- a/tests/resources/generator/ode_const_var_on_rhs_one_component/model.h +++ b/tests/resources/generator/ode_const_var_on_rhs_one_component/model.h @@ -29,7 +29,9 @@ typedef struct { extern const VariableInfo VOI_INFO; extern const VariableInfo STATE_INFO[]; -extern const VariableInfo VARIABLE_INFO[]; +extern const VariableInfo CONSTANT_INFO[]; +extern const VariableInfo COMPUTED_CONSTANT_INFO[]; +extern const VariableInfo ALGEBRAIC_INFO[]; double * createStatesArray(); double * createVariablesArray(); diff --git a/tests/resources/generator/ode_const_var_on_rhs_one_component/model.py b/tests/resources/generator/ode_const_var_on_rhs_one_component/model.py index 65e03adfd4..7fe189c7a6 100644 --- a/tests/resources/generator/ode_const_var_on_rhs_one_component/model.py +++ b/tests/resources/generator/ode_const_var_on_rhs_one_component/model.py @@ -23,14 +23,19 @@ class VariableType(Enum): VOI_INFO = {"name": "t", "units": "second", "component": "my_component", "type": VariableType.VARIABLE_OF_INTEGRATION} -STATE_INFO = [ - {"name": "x", "units": "dimensionless", "component": "my_component", "type": VariableType.STATE} -] +STATE_INFO = {"name": "x", "units": "dimensionless", "component": "my_component", "type": VariableType.STATE} + -VARIABLE_INFO = [ +CONSTANT_INFO = [ {"name": "a", "units": "per_s", "component": "my_component", "type": VariableType.CONSTANT} ] +COMPUTED_CONSTANT_INFO = [ +] + +ALGEBRAIC_INFO = [ +] + def create_states_array(): return [nan]*STATE_COUNT diff --git a/tests/resources/generator/ode_constant_on_rhs/model.c b/tests/resources/generator/ode_constant_on_rhs/model.c index 71e7ea5a8a..d1981b0361 100644 --- a/tests/resources/generator/ode_constant_on_rhs/model.c +++ b/tests/resources/generator/ode_constant_on_rhs/model.c @@ -19,7 +19,13 @@ const VariableInfo STATE_INFO[] = { {"x", "dimensionless", "my_ode", STATE} }; -const VariableInfo VARIABLE_INFO[] = { +const VariableInfo CONSTANT_INFO[] = { +}; + +const VariableInfo COMPUTED_CONSTANT_INFO[] = { +}; + +const VariableInfo ALGEBRAIC_INFO[] = { }; double * createStatesArray() diff --git a/tests/resources/generator/ode_constant_on_rhs/model.h b/tests/resources/generator/ode_constant_on_rhs/model.h index 3f1fb63fd2..35acb14707 100644 --- a/tests/resources/generator/ode_constant_on_rhs/model.h +++ b/tests/resources/generator/ode_constant_on_rhs/model.h @@ -29,7 +29,9 @@ typedef struct { extern const VariableInfo VOI_INFO; extern const VariableInfo STATE_INFO[]; -extern const VariableInfo VARIABLE_INFO[]; +extern const VariableInfo CONSTANT_INFO[]; +extern const VariableInfo COMPUTED_CONSTANT_INFO[]; +extern const VariableInfo ALGEBRAIC_INFO[]; double * createStatesArray(); double * createVariablesArray(); diff --git a/tests/resources/generator/ode_constant_on_rhs/model.py b/tests/resources/generator/ode_constant_on_rhs/model.py index bc525feb58..1b1b18f967 100644 --- a/tests/resources/generator/ode_constant_on_rhs/model.py +++ b/tests/resources/generator/ode_constant_on_rhs/model.py @@ -23,11 +23,16 @@ class VariableType(Enum): VOI_INFO = {"name": "t", "units": "second", "component": "environment", "type": VariableType.VARIABLE_OF_INTEGRATION} -STATE_INFO = [ - {"name": "x", "units": "dimensionless", "component": "my_ode", "type": VariableType.STATE} +STATE_INFO = {"name": "x", "units": "dimensionless", "component": "my_ode", "type": VariableType.STATE} + + +CONSTANT_INFO = [ +] + +COMPUTED_CONSTANT_INFO = [ ] -VARIABLE_INFO = [ +ALGEBRAIC_INFO = [ ] diff --git a/tests/resources/generator/ode_constant_on_rhs_one_component/model.c b/tests/resources/generator/ode_constant_on_rhs_one_component/model.c index a37c8889b6..e299805f43 100644 --- a/tests/resources/generator/ode_constant_on_rhs_one_component/model.c +++ b/tests/resources/generator/ode_constant_on_rhs_one_component/model.c @@ -19,7 +19,13 @@ const VariableInfo STATE_INFO[] = { {"x", "dimensionless", "my_component", STATE} }; -const VariableInfo VARIABLE_INFO[] = { +const VariableInfo CONSTANT_INFO[] = { +}; + +const VariableInfo COMPUTED_CONSTANT_INFO[] = { +}; + +const VariableInfo ALGEBRAIC_INFO[] = { }; double * createStatesArray() diff --git a/tests/resources/generator/ode_constant_on_rhs_one_component/model.h b/tests/resources/generator/ode_constant_on_rhs_one_component/model.h index ca79cc5f25..ec10997670 100644 --- a/tests/resources/generator/ode_constant_on_rhs_one_component/model.h +++ b/tests/resources/generator/ode_constant_on_rhs_one_component/model.h @@ -29,7 +29,9 @@ typedef struct { extern const VariableInfo VOI_INFO; extern const VariableInfo STATE_INFO[]; -extern const VariableInfo VARIABLE_INFO[]; +extern const VariableInfo CONSTANT_INFO[]; +extern const VariableInfo COMPUTED_CONSTANT_INFO[]; +extern const VariableInfo ALGEBRAIC_INFO[]; double * createStatesArray(); double * createVariablesArray(); diff --git a/tests/resources/generator/ode_constant_on_rhs_one_component/model.py b/tests/resources/generator/ode_constant_on_rhs_one_component/model.py index 22311d1da6..81899058c8 100644 --- a/tests/resources/generator/ode_constant_on_rhs_one_component/model.py +++ b/tests/resources/generator/ode_constant_on_rhs_one_component/model.py @@ -23,11 +23,16 @@ class VariableType(Enum): VOI_INFO = {"name": "t", "units": "second", "component": "my_component", "type": VariableType.VARIABLE_OF_INTEGRATION} -STATE_INFO = [ - {"name": "x", "units": "dimensionless", "component": "my_component", "type": VariableType.STATE} +STATE_INFO = {"name": "x", "units": "dimensionless", "component": "my_component", "type": VariableType.STATE} + + +CONSTANT_INFO = [ +] + +COMPUTED_CONSTANT_INFO = [ ] -VARIABLE_INFO = [ +ALGEBRAIC_INFO = [ ] diff --git a/tests/resources/generator/ode_multiple_dependent_odes/model.c b/tests/resources/generator/ode_multiple_dependent_odes/model.c index d8bbbf62ad..c43f947e75 100644 --- a/tests/resources/generator/ode_multiple_dependent_odes/model.c +++ b/tests/resources/generator/ode_multiple_dependent_odes/model.c @@ -20,10 +20,16 @@ const VariableInfo STATE_INFO[] = { {"y", "dimensionless", "my_y_ode", STATE} }; -const VariableInfo VARIABLE_INFO[] = { +const VariableInfo CONSTANT_INFO[] = { {"epsilon", "dimensionless", "my_y_ode", CONSTANT} }; +const VariableInfo COMPUTED_CONSTANT_INFO[] = { +}; + +const VariableInfo ALGEBRAIC_INFO[] = { +}; + double * createStatesArray() { double *res = (double *) malloc(STATE_COUNT*sizeof(double)); diff --git a/tests/resources/generator/ode_multiple_dependent_odes/model.h b/tests/resources/generator/ode_multiple_dependent_odes/model.h index cc74aaa0bd..82e013544d 100644 --- a/tests/resources/generator/ode_multiple_dependent_odes/model.h +++ b/tests/resources/generator/ode_multiple_dependent_odes/model.h @@ -29,7 +29,9 @@ typedef struct { extern const VariableInfo VOI_INFO; extern const VariableInfo STATE_INFO[]; -extern const VariableInfo VARIABLE_INFO[]; +extern const VariableInfo CONSTANT_INFO[]; +extern const VariableInfo COMPUTED_CONSTANT_INFO[]; +extern const VariableInfo ALGEBRAIC_INFO[]; double * createStatesArray(); double * createVariablesArray(); diff --git a/tests/resources/generator/ode_multiple_dependent_odes/model.py b/tests/resources/generator/ode_multiple_dependent_odes/model.py index a6af28cef0..6edcb43f76 100644 --- a/tests/resources/generator/ode_multiple_dependent_odes/model.py +++ b/tests/resources/generator/ode_multiple_dependent_odes/model.py @@ -23,15 +23,20 @@ class VariableType(Enum): VOI_INFO = {"name": "t", "units": "second", "component": "environment", "type": VariableType.VARIABLE_OF_INTEGRATION} -STATE_INFO = [ - {"name": "x", "units": "dimensionless", "component": "my_x_ode", "type": VariableType.STATE}, +STATE_INFO = {"name": "x", "units": "dimensionless", "component": "my_x_ode", "type": VariableType.STATE}, {"name": "y", "units": "dimensionless", "component": "my_y_ode", "type": VariableType.STATE} -] -VARIABLE_INFO = [ + +CONSTANT_INFO = [ {"name": "epsilon", "units": "dimensionless", "component": "my_y_ode", "type": VariableType.CONSTANT} ] +COMPUTED_CONSTANT_INFO = [ +] + +ALGEBRAIC_INFO = [ +] + def create_states_array(): return [nan]*STATE_COUNT diff --git a/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.c b/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.c index 9ce2fe018f..9e5d0e2959 100644 --- a/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.c +++ b/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.c @@ -20,10 +20,16 @@ const VariableInfo STATE_INFO[] = { {"y", "dimensionless", "my_component", STATE} }; -const VariableInfo VARIABLE_INFO[] = { +const VariableInfo CONSTANT_INFO[] = { {"epsilon", "dimensionless", "my_component", CONSTANT} }; +const VariableInfo COMPUTED_CONSTANT_INFO[] = { +}; + +const VariableInfo ALGEBRAIC_INFO[] = { +}; + double * createStatesArray() { double *res = (double *) malloc(STATE_COUNT*sizeof(double)); diff --git a/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.h b/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.h index f0d48d38d5..021fc35210 100644 --- a/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.h +++ b/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.h @@ -29,7 +29,9 @@ typedef struct { extern const VariableInfo VOI_INFO; extern const VariableInfo STATE_INFO[]; -extern const VariableInfo VARIABLE_INFO[]; +extern const VariableInfo CONSTANT_INFO[]; +extern const VariableInfo COMPUTED_CONSTANT_INFO[]; +extern const VariableInfo ALGEBRAIC_INFO[]; double * createStatesArray(); double * createVariablesArray(); diff --git a/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.py b/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.py index faa79d3225..adbe50fe77 100644 --- a/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.py +++ b/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.py @@ -23,15 +23,20 @@ class VariableType(Enum): VOI_INFO = {"name": "t", "units": "second", "component": "my_component", "type": VariableType.VARIABLE_OF_INTEGRATION} -STATE_INFO = [ - {"name": "x", "units": "dimensionless", "component": "my_component", "type": VariableType.STATE}, +STATE_INFO = {"name": "x", "units": "dimensionless", "component": "my_component", "type": VariableType.STATE}, {"name": "y", "units": "dimensionless", "component": "my_component", "type": VariableType.STATE} -] -VARIABLE_INFO = [ + +CONSTANT_INFO = [ {"name": "epsilon", "units": "dimensionless", "component": "my_component", "type": VariableType.CONSTANT} ] +COMPUTED_CONSTANT_INFO = [ +] + +ALGEBRAIC_INFO = [ +] + def create_states_array(): return [nan]*STATE_COUNT diff --git a/tests/resources/generator/ode_multiple_odes_with_same_name/model.c b/tests/resources/generator/ode_multiple_odes_with_same_name/model.c index 82e57fc2df..4caef92311 100644 --- a/tests/resources/generator/ode_multiple_odes_with_same_name/model.c +++ b/tests/resources/generator/ode_multiple_odes_with_same_name/model.c @@ -20,10 +20,16 @@ const VariableInfo STATE_INFO[] = { {"x", "dimensionless", "my_second_ode", STATE} }; -const VariableInfo VARIABLE_INFO[] = { +const VariableInfo CONSTANT_INFO[] = { {"a", "per_s", "my_second_ode", CONSTANT} }; +const VariableInfo COMPUTED_CONSTANT_INFO[] = { +}; + +const VariableInfo ALGEBRAIC_INFO[] = { +}; + double * createStatesArray() { double *res = (double *) malloc(STATE_COUNT*sizeof(double)); diff --git a/tests/resources/generator/ode_multiple_odes_with_same_name/model.h b/tests/resources/generator/ode_multiple_odes_with_same_name/model.h index 0b0953abe2..41b1e7be52 100644 --- a/tests/resources/generator/ode_multiple_odes_with_same_name/model.h +++ b/tests/resources/generator/ode_multiple_odes_with_same_name/model.h @@ -29,7 +29,9 @@ typedef struct { extern const VariableInfo VOI_INFO; extern const VariableInfo STATE_INFO[]; -extern const VariableInfo VARIABLE_INFO[]; +extern const VariableInfo CONSTANT_INFO[]; +extern const VariableInfo COMPUTED_CONSTANT_INFO[]; +extern const VariableInfo ALGEBRAIC_INFO[]; double * createStatesArray(); double * createVariablesArray(); diff --git a/tests/resources/generator/ode_multiple_odes_with_same_name/model.py b/tests/resources/generator/ode_multiple_odes_with_same_name/model.py index 2a5ff0d6c8..d23db44675 100644 --- a/tests/resources/generator/ode_multiple_odes_with_same_name/model.py +++ b/tests/resources/generator/ode_multiple_odes_with_same_name/model.py @@ -23,15 +23,20 @@ class VariableType(Enum): VOI_INFO = {"name": "t", "units": "second", "component": "environment", "type": VariableType.VARIABLE_OF_INTEGRATION} -STATE_INFO = [ - {"name": "x", "units": "dimensionless", "component": "my_first_ode", "type": VariableType.STATE}, +STATE_INFO = {"name": "x", "units": "dimensionless", "component": "my_first_ode", "type": VariableType.STATE}, {"name": "x", "units": "dimensionless", "component": "my_second_ode", "type": VariableType.STATE} -] -VARIABLE_INFO = [ + +CONSTANT_INFO = [ {"name": "a", "units": "per_s", "component": "my_second_ode", "type": VariableType.CONSTANT} ] +COMPUTED_CONSTANT_INFO = [ +] + +ALGEBRAIC_INFO = [ +] + def create_states_array(): return [nan]*STATE_COUNT diff --git a/tests/resources/generator/ode_unknown_var_on_rhs/model.c b/tests/resources/generator/ode_unknown_var_on_rhs/model.c index 0b29e548b4..ab500425be 100644 --- a/tests/resources/generator/ode_unknown_var_on_rhs/model.c +++ b/tests/resources/generator/ode_unknown_var_on_rhs/model.c @@ -20,7 +20,13 @@ const VariableInfo STATE_INFO[] = { {"y", "dimensionless", "my_ode", STATE} }; -const VariableInfo VARIABLE_INFO[] = { +const VariableInfo CONSTANT_INFO[] = { +}; + +const VariableInfo COMPUTED_CONSTANT_INFO[] = { +}; + +const VariableInfo ALGEBRAIC_INFO[] = { }; double * createStatesArray() diff --git a/tests/resources/generator/ode_unknown_var_on_rhs/model.h b/tests/resources/generator/ode_unknown_var_on_rhs/model.h index 3f1fb63fd2..35acb14707 100644 --- a/tests/resources/generator/ode_unknown_var_on_rhs/model.h +++ b/tests/resources/generator/ode_unknown_var_on_rhs/model.h @@ -29,7 +29,9 @@ typedef struct { extern const VariableInfo VOI_INFO; extern const VariableInfo STATE_INFO[]; -extern const VariableInfo VARIABLE_INFO[]; +extern const VariableInfo CONSTANT_INFO[]; +extern const VariableInfo COMPUTED_CONSTANT_INFO[]; +extern const VariableInfo ALGEBRAIC_INFO[]; double * createStatesArray(); double * createVariablesArray(); diff --git a/tests/resources/generator/ode_unknown_var_on_rhs/model.py b/tests/resources/generator/ode_unknown_var_on_rhs/model.py index 2f19ddc26b..f7b81c3c3a 100644 --- a/tests/resources/generator/ode_unknown_var_on_rhs/model.py +++ b/tests/resources/generator/ode_unknown_var_on_rhs/model.py @@ -23,12 +23,17 @@ class VariableType(Enum): VOI_INFO = {"name": "t", "units": "second", "component": "environment", "type": VariableType.VARIABLE_OF_INTEGRATION} -STATE_INFO = [ - {"name": "x", "units": "dimensionless", "component": "my_ode", "type": VariableType.STATE}, +STATE_INFO = {"name": "x", "units": "dimensionless", "component": "my_ode", "type": VariableType.STATE}, {"name": "y", "units": "dimensionless", "component": "my_ode", "type": VariableType.STATE} + + +CONSTANT_INFO = [ +] + +COMPUTED_CONSTANT_INFO = [ ] -VARIABLE_INFO = [ +ALGEBRAIC_INFO = [ ] diff --git a/tests/resources/generator/robertson_model_1966/model.dae.c b/tests/resources/generator/robertson_model_1966/model.dae.c index 81baaa83cd..01a0c5db85 100644 --- a/tests/resources/generator/robertson_model_1966/model.dae.c +++ b/tests/resources/generator/robertson_model_1966/model.dae.c @@ -20,10 +20,16 @@ const VariableInfo STATE_INFO[] = { {"y2", "dimensionless", "main", STATE} }; -const VariableInfo VARIABLE_INFO[] = { +const VariableInfo CONSTANT_INFO[] = { {"k1", "dimensionless", "main", CONSTANT}, {"k3", "dimensionless", "main", CONSTANT}, - {"k2", "dimensionless", "main", CONSTANT}, + {"k2", "dimensionless", "main", CONSTANT} +}; + +const VariableInfo COMPUTED_CONSTANT_INFO[] = { +}; + +const VariableInfo ALGEBRAIC_INFO[] = { {"y3", "dimensionless", "main", ALGEBRAIC}, {"y2_scaled", "dimensionless", "main", ALGEBRAIC} }; diff --git a/tests/resources/generator/robertson_model_1966/model.dae.h b/tests/resources/generator/robertson_model_1966/model.dae.h index bca2cef3a4..f41a8e9e90 100644 --- a/tests/resources/generator/robertson_model_1966/model.dae.h +++ b/tests/resources/generator/robertson_model_1966/model.dae.h @@ -29,7 +29,9 @@ typedef struct { extern const VariableInfo VOI_INFO; extern const VariableInfo STATE_INFO[]; -extern const VariableInfo VARIABLE_INFO[]; +extern const VariableInfo CONSTANT_INFO[]; +extern const VariableInfo COMPUTED_CONSTANT_INFO[]; +extern const VariableInfo ALGEBRAIC_INFO[]; double * createStatesArray(); double * createVariablesArray(); diff --git a/tests/resources/generator/robertson_model_1966/model.dae.py b/tests/resources/generator/robertson_model_1966/model.dae.py index 8a4f383de4..41f161a812 100644 --- a/tests/resources/generator/robertson_model_1966/model.dae.py +++ b/tests/resources/generator/robertson_model_1966/model.dae.py @@ -23,15 +23,20 @@ class VariableType(Enum): VOI_INFO = {"name": "t", "units": "dimensionless", "component": "main", "type": VariableType.VARIABLE_OF_INTEGRATION} -STATE_INFO = [ - {"name": "y1", "units": "dimensionless", "component": "main", "type": VariableType.STATE}, +STATE_INFO = {"name": "y1", "units": "dimensionless", "component": "main", "type": VariableType.STATE}, {"name": "y2", "units": "dimensionless", "component": "main", "type": VariableType.STATE} -] -VARIABLE_INFO = [ + +CONSTANT_INFO = [ {"name": "k1", "units": "dimensionless", "component": "main", "type": VariableType.CONSTANT}, {"name": "k3", "units": "dimensionless", "component": "main", "type": VariableType.CONSTANT}, - {"name": "k2", "units": "dimensionless", "component": "main", "type": VariableType.CONSTANT}, + {"name": "k2", "units": "dimensionless", "component": "main", "type": VariableType.CONSTANT} +] + +COMPUTED_CONSTANT_INFO = [ +] + +ALGEBRAIC_INFO = [ {"name": "y3", "units": "dimensionless", "component": "main", "type": VariableType.ALGEBRAIC}, {"name": "y2_scaled", "units": "dimensionless", "component": "main", "type": VariableType.ALGEBRAIC} ] diff --git a/tests/resources/generator/robertson_model_1966/model.ode.c b/tests/resources/generator/robertson_model_1966/model.ode.c index 7bbd363e08..fef5b5c53f 100644 --- a/tests/resources/generator/robertson_model_1966/model.ode.c +++ b/tests/resources/generator/robertson_model_1966/model.ode.c @@ -21,10 +21,16 @@ const VariableInfo STATE_INFO[] = { {"y2", "dimensionless", "main", STATE} }; -const VariableInfo VARIABLE_INFO[] = { +const VariableInfo CONSTANT_INFO[] = { {"k1", "dimensionless", "main", CONSTANT}, {"k3", "dimensionless", "main", CONSTANT}, - {"k2", "dimensionless", "main", CONSTANT}, + {"k2", "dimensionless", "main", CONSTANT} +}; + +const VariableInfo COMPUTED_CONSTANT_INFO[] = { +}; + +const VariableInfo ALGEBRAIC_INFO[] = { {"y2_scaled", "dimensionless", "main", ALGEBRAIC} }; diff --git a/tests/resources/generator/robertson_model_1966/model.ode.h b/tests/resources/generator/robertson_model_1966/model.ode.h index bca2cef3a4..f41a8e9e90 100644 --- a/tests/resources/generator/robertson_model_1966/model.ode.h +++ b/tests/resources/generator/robertson_model_1966/model.ode.h @@ -29,7 +29,9 @@ typedef struct { extern const VariableInfo VOI_INFO; extern const VariableInfo STATE_INFO[]; -extern const VariableInfo VARIABLE_INFO[]; +extern const VariableInfo CONSTANT_INFO[]; +extern const VariableInfo COMPUTED_CONSTANT_INFO[]; +extern const VariableInfo ALGEBRAIC_INFO[]; double * createStatesArray(); double * createVariablesArray(); diff --git a/tests/resources/generator/robertson_model_1966/model.ode.py b/tests/resources/generator/robertson_model_1966/model.ode.py index 2aaab1f031..832cb289de 100644 --- a/tests/resources/generator/robertson_model_1966/model.ode.py +++ b/tests/resources/generator/robertson_model_1966/model.ode.py @@ -23,16 +23,21 @@ class VariableType(Enum): VOI_INFO = {"name": "t", "units": "dimensionless", "component": "main", "type": VariableType.VARIABLE_OF_INTEGRATION} -STATE_INFO = [ - {"name": "y1", "units": "dimensionless", "component": "main", "type": VariableType.STATE}, +STATE_INFO = {"name": "y1", "units": "dimensionless", "component": "main", "type": VariableType.STATE}, {"name": "y3", "units": "dimensionless", "component": "main", "type": VariableType.STATE}, {"name": "y2", "units": "dimensionless", "component": "main", "type": VariableType.STATE} -] -VARIABLE_INFO = [ + +CONSTANT_INFO = [ {"name": "k1", "units": "dimensionless", "component": "main", "type": VariableType.CONSTANT}, {"name": "k3", "units": "dimensionless", "component": "main", "type": VariableType.CONSTANT}, - {"name": "k2", "units": "dimensionless", "component": "main", "type": VariableType.CONSTANT}, + {"name": "k2", "units": "dimensionless", "component": "main", "type": VariableType.CONSTANT} +] + +COMPUTED_CONSTANT_INFO = [ +] + +ALGEBRAIC_INFO = [ {"name": "y2_scaled", "units": "dimensionless", "component": "main", "type": VariableType.ALGEBRAIC} ] diff --git a/tests/resources/generator/sine_model_imports/model.c b/tests/resources/generator/sine_model_imports/model.c index 0c1602c01f..ddc2826b8c 100644 --- a/tests/resources/generator/sine_model_imports/model.c +++ b/tests/resources/generator/sine_model_imports/model.c @@ -19,14 +19,20 @@ const VariableInfo STATE_INFO[] = { {"sin", "dimensionless", "deriv_approx_sin", STATE} }; -const VariableInfo VARIABLE_INFO[] = { +const VariableInfo CONSTANT_INFO[] = { {"deriv_approx_initial_value", "dimensionless", "main", CONSTANT}, - {"C", "dimensionless", "main", CONSTANT}, + {"C", "dimensionless", "main", CONSTANT} +}; + +const VariableInfo COMPUTED_CONSTANT_INFO[] = { {"k2_oPi", "dimensionless", "parabolic_approx_sin", COMPUTED_CONSTANT}, {"k2Pi", "dimensionless", "parabolic_approx_sin", COMPUTED_CONSTANT}, {"kPi_2", "dimensionless", "parabolic_approx_sin", COMPUTED_CONSTANT}, {"kPi", "dimensionless", "parabolic_approx_sin", COMPUTED_CONSTANT}, - {"kPi_32", "dimensionless", "parabolic_approx_sin", COMPUTED_CONSTANT}, + {"kPi_32", "dimensionless", "parabolic_approx_sin", COMPUTED_CONSTANT} +}; + +const VariableInfo ALGEBRAIC_INFO[] = { {"sin", "dimensionless", "actual_sin", ALGEBRAIC}, {"sin", "dimensionless", "parabolic_approx_sin", ALGEBRAIC}, {"z", "dimensionless", "parabolic_approx_sin", ALGEBRAIC} diff --git a/tests/resources/generator/sine_model_imports/model.h b/tests/resources/generator/sine_model_imports/model.h index 93c965f336..fa49280dca 100644 --- a/tests/resources/generator/sine_model_imports/model.h +++ b/tests/resources/generator/sine_model_imports/model.h @@ -29,7 +29,9 @@ typedef struct { extern const VariableInfo VOI_INFO; extern const VariableInfo STATE_INFO[]; -extern const VariableInfo VARIABLE_INFO[]; +extern const VariableInfo CONSTANT_INFO[]; +extern const VariableInfo COMPUTED_CONSTANT_INFO[]; +extern const VariableInfo ALGEBRAIC_INFO[]; double * createStatesArray(); double * createVariablesArray(); diff --git a/tests/resources/generator/sine_model_imports/model.py b/tests/resources/generator/sine_model_imports/model.py index 8119f98058..ed86aa9c59 100644 --- a/tests/resources/generator/sine_model_imports/model.py +++ b/tests/resources/generator/sine_model_imports/model.py @@ -23,18 +23,23 @@ class VariableType(Enum): VOI_INFO = {"name": "x", "units": "dimensionless", "component": "main", "type": VariableType.VARIABLE_OF_INTEGRATION} -STATE_INFO = [ - {"name": "sin", "units": "dimensionless", "component": "deriv_approx_sin", "type": VariableType.STATE} -] +STATE_INFO = {"name": "sin", "units": "dimensionless", "component": "deriv_approx_sin", "type": VariableType.STATE} + -VARIABLE_INFO = [ +CONSTANT_INFO = [ {"name": "deriv_approx_initial_value", "units": "dimensionless", "component": "main", "type": VariableType.CONSTANT}, - {"name": "C", "units": "dimensionless", "component": "main", "type": VariableType.CONSTANT}, + {"name": "C", "units": "dimensionless", "component": "main", "type": VariableType.CONSTANT} +] + +COMPUTED_CONSTANT_INFO = [ {"name": "k2_oPi", "units": "dimensionless", "component": "parabolic_approx_sin", "type": VariableType.COMPUTED_CONSTANT}, {"name": "k2Pi", "units": "dimensionless", "component": "parabolic_approx_sin", "type": VariableType.COMPUTED_CONSTANT}, {"name": "kPi_2", "units": "dimensionless", "component": "parabolic_approx_sin", "type": VariableType.COMPUTED_CONSTANT}, {"name": "kPi", "units": "dimensionless", "component": "parabolic_approx_sin", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "kPi_32", "units": "dimensionless", "component": "parabolic_approx_sin", "type": VariableType.COMPUTED_CONSTANT}, + {"name": "kPi_32", "units": "dimensionless", "component": "parabolic_approx_sin", "type": VariableType.COMPUTED_CONSTANT} +] + +ALGEBRAIC_INFO = [ {"name": "sin", "units": "dimensionless", "component": "actual_sin", "type": VariableType.ALGEBRAIC}, {"name": "sin", "units": "dimensionless", "component": "parabolic_approx_sin", "type": VariableType.ALGEBRAIC}, {"name": "z", "units": "dimensionless", "component": "parabolic_approx_sin", "type": VariableType.ALGEBRAIC} diff --git a/tests/resources/generator/unknown_variable_as_external_variable/model.c b/tests/resources/generator/unknown_variable_as_external_variable/model.c index 9a6fb704d7..8fb19598c7 100644 --- a/tests/resources/generator/unknown_variable_as_external_variable/model.c +++ b/tests/resources/generator/unknown_variable_as_external_variable/model.c @@ -13,7 +13,7 @@ const size_t COMPUTED_CONSTANT_COUNT = 0; const size_t ALGEBRAIC_COUNT = 1; const size_t EXTERNAL_COUNT = 1; -const VariableInfo VARIABLE_INFO[] = { +const VariableInfo CONSTANT_INFO[] = { {"E", "fmol", "SLC_template3_ss", CONSTANT}, {"P_0", "per_fmol_sec4", "SLC_template3_ss", CONSTANT}, {"q_Ao", "fmol", "SLC_template3_ss", CONSTANT}, @@ -21,8 +21,17 @@ const VariableInfo VARIABLE_INFO[] = { {"q_Ai", "fmol", "SLC_template3_ss", CONSTANT}, {"P_2", "per_fmol_sec3", "SLC_template3_ss", CONSTANT}, {"P_5", "per_sec3", "SLC_template3_ss", CONSTANT}, - {"P_4", "per_fmol2_sec3", "SLC_template3_ss", CONSTANT}, - {"v", "fmol_per_sec", "SLC_template3_ss", ALGEBRAIC}, + {"P_4", "per_fmol2_sec3", "SLC_template3_ss", CONSTANT} +}; + +const VariableInfo COMPUTED_CONSTANT_INFO[] = { +}; + +const VariableInfo ALGEBRAIC_INFO[] = { + {"v", "fmol_per_sec", "SLC_template3_ss", ALGEBRAIC} +}; + +const VariableInfo EXTERNAL_INFO[] = { {"P_3", "per_fmol_sec3", "SLC_template3_ss", EXTERNAL} }; diff --git a/tests/resources/generator/unknown_variable_as_external_variable/model.h b/tests/resources/generator/unknown_variable_as_external_variable/model.h index 92576c047d..19a59cbdf0 100644 --- a/tests/resources/generator/unknown_variable_as_external_variable/model.h +++ b/tests/resources/generator/unknown_variable_as_external_variable/model.h @@ -26,7 +26,10 @@ typedef struct { VariableType type; } VariableInfo; -extern const VariableInfo VARIABLE_INFO[]; +extern const VariableInfo CONSTANT_INFO[]; +extern const VariableInfo COMPUTED_CONSTANT_INFO[]; +extern const VariableInfo ALGEBRAIC_INFO[]; +extern const VariableInfo EXTERNAL_INFO[]; double * createVariablesArray(); void deleteArray(double *array); diff --git a/tests/resources/generator/unknown_variable_as_external_variable/model.py b/tests/resources/generator/unknown_variable_as_external_variable/model.py index 67a0315a54..f0888ac184 100644 --- a/tests/resources/generator/unknown_variable_as_external_variable/model.py +++ b/tests/resources/generator/unknown_variable_as_external_variable/model.py @@ -20,7 +20,7 @@ class VariableType(Enum): EXTERNAL = 3 -VARIABLE_INFO = [ +CONSTANT_INFO = [ {"name": "E", "units": "fmol", "component": "SLC_template3_ss", "type": VariableType.CONSTANT}, {"name": "P_0", "units": "per_fmol_sec4", "component": "SLC_template3_ss", "type": VariableType.CONSTANT}, {"name": "q_Ao", "units": "fmol", "component": "SLC_template3_ss", "type": VariableType.CONSTANT}, @@ -28,8 +28,17 @@ class VariableType(Enum): {"name": "q_Ai", "units": "fmol", "component": "SLC_template3_ss", "type": VariableType.CONSTANT}, {"name": "P_2", "units": "per_fmol_sec3", "component": "SLC_template3_ss", "type": VariableType.CONSTANT}, {"name": "P_5", "units": "per_sec3", "component": "SLC_template3_ss", "type": VariableType.CONSTANT}, - {"name": "P_4", "units": "per_fmol2_sec3", "component": "SLC_template3_ss", "type": VariableType.CONSTANT}, - {"name": "v", "units": "fmol_per_sec", "component": "SLC_template3_ss", "type": VariableType.ALGEBRAIC}, + {"name": "P_4", "units": "per_fmol2_sec3", "component": "SLC_template3_ss", "type": VariableType.CONSTANT} +] + +COMPUTED_CONSTANT_INFO = [ +] + +ALGEBRAIC_INFO = [ + {"name": "v", "units": "fmol_per_sec", "component": "SLC_template3_ss", "type": VariableType.ALGEBRAIC} +] + +EXTERNAL_INFO = [ {"name": "P_3", "units": "per_fmol_sec3", "component": "SLC_template3_ss", "type": VariableType.EXTERNAL} ] diff --git a/tests/resources/generator/variable_initialised_using_a_constant/model.c b/tests/resources/generator/variable_initialised_using_a_constant/model.c index bf4de6ab23..eecc37c615 100644 --- a/tests/resources/generator/variable_initialised_using_a_constant/model.c +++ b/tests/resources/generator/variable_initialised_using_a_constant/model.c @@ -19,10 +19,16 @@ const VariableInfo STATE_INFO[] = { {"X", "dimensionless", "component_1", STATE} }; -const VariableInfo VARIABLE_INFO[] = { +const VariableInfo CONSTANT_INFO[] = { {"X_init", "dimensionless", "component_2", CONSTANT} }; +const VariableInfo COMPUTED_CONSTANT_INFO[] = { +}; + +const VariableInfo ALGEBRAIC_INFO[] = { +}; + double * createStatesArray() { double *res = (double *) malloc(STATE_COUNT*sizeof(double)); diff --git a/tests/resources/generator/variable_initialised_using_a_constant/model.h b/tests/resources/generator/variable_initialised_using_a_constant/model.h index 340f578dd8..0db53022c6 100644 --- a/tests/resources/generator/variable_initialised_using_a_constant/model.h +++ b/tests/resources/generator/variable_initialised_using_a_constant/model.h @@ -29,7 +29,9 @@ typedef struct { extern const VariableInfo VOI_INFO; extern const VariableInfo STATE_INFO[]; -extern const VariableInfo VARIABLE_INFO[]; +extern const VariableInfo CONSTANT_INFO[]; +extern const VariableInfo COMPUTED_CONSTANT_INFO[]; +extern const VariableInfo ALGEBRAIC_INFO[]; double * createStatesArray(); double * createVariablesArray(); diff --git a/tests/resources/generator/variable_initialised_using_a_constant/model.py b/tests/resources/generator/variable_initialised_using_a_constant/model.py index 491332bdf0..a2dd6a166e 100644 --- a/tests/resources/generator/variable_initialised_using_a_constant/model.py +++ b/tests/resources/generator/variable_initialised_using_a_constant/model.py @@ -23,14 +23,19 @@ class VariableType(Enum): VOI_INFO = {"name": "t", "units": "second", "component": "component_1", "type": VariableType.VARIABLE_OF_INTEGRATION} -STATE_INFO = [ - {"name": "X", "units": "dimensionless", "component": "component_1", "type": VariableType.STATE} -] +STATE_INFO = {"name": "X", "units": "dimensionless", "component": "component_1", "type": VariableType.STATE} + -VARIABLE_INFO = [ +CONSTANT_INFO = [ {"name": "X_init", "units": "dimensionless", "component": "component_2", "type": VariableType.CONSTANT} ] +COMPUTED_CONSTANT_INFO = [ +] + +ALGEBRAIC_INFO = [ +] + def create_states_array(): return [nan]*STATE_COUNT From 4bc05e88837ca1292337d6e39c0f53f2aecf5b5d Mon Sep 17 00:00:00 2001 From: Alan Garny Date: Wed, 14 Aug 2024 15:06:36 +0200 Subject: [PATCH 20/85] Generator: don't need to mention the type of a variable in a XXX_INFO array anymore. --- src/api/libcellml/generatorprofile.h | 166 ------ src/bindings/interface/generatorprofile.i | 42 -- src/bindings/javascript/generatorprofile.cpp | 14 - src/generator.cpp | 50 +- src/generator_p.h | 7 +- src/generatorprofile.cpp | 186 +------ src/generatorprofilesha1values.h | 4 +- src/generatorprofiletools.cpp | 12 - .../javascript/generatorprofile.test.js | 48 -- .../bindings/python/test_generator_profile.py | 87 +-- tests/coverage/coverage.cpp | 50 -- tests/generator/generatorprofile.cpp | 65 +-- tests/resources/coverage/generator/model.c | 422 +++++++------- tests/resources/coverage/generator/model.h | 9 - .../generator/model.modified.profile.c | 422 +++++++------- .../generator/model.modified.profile.h | 9 - .../generator/model.modified.profile.py | 431 +++++++-------- tests/resources/coverage/generator/model.py | 431 +++++++-------- .../algebraic_eqn_computed_var_on_rhs/model.c | 4 +- .../model.external.c | 4 +- .../model.external.h | 8 - .../model.external.py | 12 +- .../algebraic_eqn_computed_var_on_rhs/model.h | 7 - .../model.py | 11 +- .../algebraic_eqn_const_var_on_rhs/model.c | 4 +- .../algebraic_eqn_const_var_on_rhs/model.h | 7 - .../algebraic_eqn_const_var_on_rhs/model.py | 11 +- .../algebraic_eqn_constant_on_rhs/model.c | 2 +- .../algebraic_eqn_constant_on_rhs/model.h | 7 - .../algebraic_eqn_constant_on_rhs/model.py | 9 +- .../algebraic_eqn_derivative_on_rhs/model.c | 8 +- .../algebraic_eqn_derivative_on_rhs/model.h | 9 - .../algebraic_eqn_derivative_on_rhs/model.py | 17 +- .../model.c | 8 +- .../model.h | 9 - .../model.py | 17 +- .../algebraic_eqn_state_var_on_rhs/model.c | 8 +- .../algebraic_eqn_state_var_on_rhs/model.h | 9 - .../algebraic_eqn_state_var_on_rhs/model.py | 17 +- .../model.c | 8 +- .../model.h | 9 - .../model.py | 17 +- .../model.c | 8 +- .../model.external.c | 8 +- .../model.external.h | 8 - .../model.external.py | 16 +- .../model.h | 7 - .../model.py | 15 +- .../model.c | 6 +- .../model.h | 7 - .../model.py | 13 +- .../model.three.externals.c | 6 +- .../model.three.externals.h | 8 - .../model.three.externals.py | 14 +- .../model.not.ordered.c | 12 +- .../model.not.ordered.h | 7 - .../model.not.ordered.py | 19 +- .../model.ordered.c | 12 +- .../model.ordered.h | 7 - .../model.ordered.py | 19 +- .../algebraic_unknown_var_on_rhs/model.c | 4 +- .../algebraic_unknown_var_on_rhs/model.h | 7 - .../algebraic_unknown_var_on_rhs/model.py | 11 +- .../generator/cell_geometry_model/model.c | 8 +- .../cell_geometry_model/model.external.c | 8 +- .../cell_geometry_model/model.external.h | 8 - .../cell_geometry_model/model.external.py | 16 +- .../generator/cell_geometry_model/model.h | 7 - .../generator/cell_geometry_model/model.py | 15 +- .../model.c | 10 +- .../model.h | 9 - .../model.py | 19 +- .../generator/cellml_slc_example/model.py | 27 +- .../model.c | 6 +- .../model.h | 9 - .../model.py | 15 +- .../cellml_unit_scaling_constant/model.c | 6 +- .../cellml_unit_scaling_constant/model.h | 7 - .../cellml_unit_scaling_constant/model.py | 13 +- .../cellml_unit_scaling_rate/model.c | 8 +- .../cellml_unit_scaling_rate/model.h | 9 - .../cellml_unit_scaling_rate/model.py | 17 +- .../cellml_unit_scaling_state/model.c | 8 +- .../cellml_unit_scaling_state/model.h | 9 - .../cellml_unit_scaling_state/model.py | 17 +- .../model.c | 6 +- .../model.h | 9 - .../model.py | 15 +- .../model.c | 10 +- .../model.h | 9 - .../model.py | 19 +- .../cellml_unit_scaling_voi_direct/model.c | 6 +- .../cellml_unit_scaling_voi_direct/model.h | 9 - .../cellml_unit_scaling_voi_direct/model.py | 15 +- .../cellml_unit_scaling_voi_indirect/model.c | 8 +- .../cellml_unit_scaling_voi_indirect/model.h | 9 - .../cellml_unit_scaling_voi_indirect/model.py | 17 +- .../generator/dae_cellml_1_1_model/model.c | 26 +- .../generator/dae_cellml_1_1_model/model.h | 9 - .../generator/dae_cellml_1_1_model/model.py | 35 +- .../generator/dependent_eqns/model.c | 8 +- .../generator/dependent_eqns/model.h | 9 - .../generator/dependent_eqns/model.py | 17 +- .../model.c | 502 ++++++++--------- .../model.h | 9 - .../model.py | 513 +++++++++--------- .../model.c | 402 +++++++------- .../model.h | 9 - .../model.py | 411 +++++++------- .../model.algebraic.c | 46 +- .../model.algebraic.h | 10 - .../model.algebraic.py | 56 +- .../model.c | 46 +- .../model.computed.constant.c | 46 +- .../model.computed.constant.h | 10 - .../model.computed.constant.py | 56 +- .../model.constant.c | 46 +- .../model.constant.h | 10 - .../model.constant.py | 56 +- .../model.dae.c | 46 +- .../model.dae.h | 9 - .../model.dae.py | 55 +- .../model.dependent.algebraic.c | 46 +- .../model.dependent.algebraic.h | 10 - .../model.dependent.algebraic.py | 56 +- .../model.dependent.computed.constant.c | 46 +- .../model.dependent.computed.constant.h | 10 - .../model.dependent.computed.constant.py | 56 +- .../model.dependent.constant.c | 46 +- .../model.dependent.constant.h | 10 - .../model.dependent.constant.py | 56 +- .../model.dependent.state.c | 46 +- .../model.dependent.state.h | 10 - .../model.dependent.state.py | 56 +- .../model.external.c | 46 +- .../model.external.h | 10 - .../model.external.py | 56 +- .../model.h | 9 - .../model.py | 55 +- .../model.state.c | 46 +- .../model.state.h | 10 - .../model.state.py | 56 +- .../generator/noble_model_1962/model.c | 44 +- .../generator/noble_model_1962/model.h | 9 - .../generator/noble_model_1962/model.py | 53 +- .../generator/ode_computed_var_on_rhs/model.c | 6 +- .../generator/ode_computed_var_on_rhs/model.h | 9 - .../ode_computed_var_on_rhs/model.py | 15 +- .../model.c | 6 +- .../model.h | 9 - .../model.py | 15 +- .../generator/ode_const_var_on_rhs/model.c | 6 +- .../generator/ode_const_var_on_rhs/model.h | 9 - .../generator/ode_const_var_on_rhs/model.py | 15 +- .../model.c | 6 +- .../model.h | 9 - .../model.py | 15 +- .../generator/ode_constant_on_rhs/model.c | 4 +- .../generator/ode_constant_on_rhs/model.h | 9 - .../generator/ode_constant_on_rhs/model.py | 13 +- .../ode_constant_on_rhs_one_component/model.c | 4 +- .../ode_constant_on_rhs_one_component/model.h | 9 - .../model.py | 13 +- .../ode_multiple_dependent_odes/model.c | 8 +- .../ode_multiple_dependent_odes/model.h | 9 - .../ode_multiple_dependent_odes/model.py | 17 +- .../model.c | 8 +- .../model.h | 9 - .../model.py | 17 +- .../ode_multiple_odes_with_same_name/model.c | 8 +- .../ode_multiple_odes_with_same_name/model.h | 9 - .../ode_multiple_odes_with_same_name/model.py | 17 +- .../generator/ode_unknown_var_on_rhs/model.c | 6 +- .../generator/ode_unknown_var_on_rhs/model.h | 9 - .../generator/ode_unknown_var_on_rhs/model.py | 15 +- .../robertson_model_1966/model.dae.c | 16 +- .../robertson_model_1966/model.dae.h | 9 - .../robertson_model_1966/model.dae.py | 25 +- .../robertson_model_1966/model.ode.c | 16 +- .../robertson_model_1966/model.ode.h | 9 - .../robertson_model_1966/model.ode.py | 25 +- .../generator/sine_model_imports/model.c | 24 +- .../generator/sine_model_imports/model.h | 9 - .../generator/sine_model_imports/model.py | 33 +- .../model.c | 20 +- .../model.h | 8 - .../model.py | 28 +- .../model.c | 6 +- .../model.h | 9 - .../model.py | 15 +- 190 files changed, 2692 insertions(+), 4422 deletions(-) diff --git a/src/api/libcellml/generatorprofile.h b/src/api/libcellml/generatorprofile.h index b3ee8ec275..69a00d263a 100644 --- a/src/api/libcellml/generatorprofile.h +++ b/src/api/libcellml/generatorprofile.h @@ -2653,172 +2653,6 @@ class LIBCELLML_EXPORT GeneratorProfile */ void setImplementationExternalCountString(const std::string &implementationExternalCountString); - /** - * @brief Get the @c std::string for the data structure for the variable - * type object. - * - * Return the @c std::string for the data structure for the variable type - * object. - * - * @param forDifferentialModel Whether the data structure is for a - * differential model, as opposed to an algebraic model. - * @param withExternalVariables Whether the data structure is for a model - * with external variables. - * - * @return The @c std::string for the data structure for the variable type - * object. - */ - std::string variableTypeObjectString(bool forDifferentialModel, - bool withExternalVariables) const; - - /** - * @brief Set the @c std::string for the data structure for the variable - * type object. - * - * Set the @c std::string for the data structure for the variable type - * object. - * - * @sa variableTypeObjectString - * - * @param forDifferentialModel Whether the data structure is for a - * differential model, as opposed to an algebraic model. - * @param withExternalVariables Whether the data structure is for a model - * with external variables. - * @param variableTypeObjectString The @c std::string to use for the data - * structure for the variable type object. - */ - void setVariableTypeObjectString(bool forDifferentialModel, - bool withExternalVariables, - const std::string &variableTypeObjectString); - - /** - * @brief Get the @c std::string for the name of the variable of integration - * variable type. - * - * Return the @c std::string for the name of the variable of integration - * variable type that is used in a differential model. - * - * @return The @c std::string for the name of the variable of integration - * variable type. - */ - std::string variableOfIntegrationVariableTypeString() const; - - /** - * @brief Set the @c std::string for the name of the variable of integration - * variable type. - * - * Set the @c std::string for the name of the variable of integration - * variable type that is used in a differential model. - * - * @param variableOfIntegrationVariableTypeString The @c std::string to use - * for the name of the variable of integration variable type. - */ - void setVariableOfIntegrationVariableTypeString(const std::string &variableOfIntegrationVariableTypeString); - - /** - * @brief Get the @c std::string for the name of the state variable type. - * - * Return the @c std::string for the name of the state variable type that is - * used in a differential model. - * - * @return The @c std::string for the name of the state variable type. - */ - std::string stateVariableTypeString() const; - - /** - * @brief Set the @c std::string for the name of the state variable type. - * - * Set the @c std::string for the name of the state variable type that is - * used in a differential model. - * - * @param stateTypeString The @c std::string to use for the name of the - * state variable type. - */ - void setStateVariableTypeString(const std::string &stateVariableTypeString); - - /** - * @brief Get the @c std::string for the name of the constant variable type. - * - * Return the @c std::string for the name of the constant variable type. - * - * @return The @c std::string for the name of the constant variable type. - */ - std::string constantVariableTypeString() const; - - /** - * @brief Set the @c std::string for the name of the constant variable type. - * - * Set the @c std::string for the name of the constant variable type. - * - * @param constantVariableTypeString The @c std::string to use for the name of the - * constant variable type. - */ - void setConstantVariableTypeString(const std::string &constantVariableTypeString); - - /** - * @brief Get the @c std::string for the name of the computed constant - * variable type. - * - * Return the @c std::string for the name of the computed constant variable - * type. - * - * @return The @c std::string for the name of the computed constant variable - * type. - */ - std::string computedConstantVariableTypeString() const; - - /** - * @brief Set the @c std::string for the name of the computed constant - * variable type. - * - * Set the @c std::string for the name of the computed constant variable - * type. - * - * @param computedConstantVariableTypeString The @c std::string to use for the name of the - * computed constant variable type. - */ - void setComputedConstantVariableTypeString(const std::string &computedConstantVariableTypeString); - - /** - * @brief Get the @c std::string for the name of the algebraic variable - * type. - * - * Return the @c std::string for the name of the algebraic variable type. - * - * @return The @c std::string for the name of the algebraic variable type. - */ - std::string algebraicVariableTypeString() const; - - /** - * @brief Set the @c std::string for the name of the algebraic variable - * type. - * - * Set the @c std::string for the name of the algebraic variable type. - * - * @param algebraicVariableTypeString The @c std::string to use for the name of the - * algebraic variable type. - */ - void setAlgebraicVariableTypeString(const std::string &algebraicVariableTypeString); - - /** - * @brief Get the @c std::string for the name of the external variable type. - * - * Return the @c std::string for the name of the external variable type. - * - * @return The @c std::string for the name of the external variable type. - */ - std::string externalVariableTypeString() const; - - /** - * @brief Set the @c std::string for the name of the external variable type. - * - * Set this @c std::string for the name of the external variable type. - * - * @param externalVariableTypeString The @c std::string to use for the name of the - * external variable type. - */ - void setExternalVariableTypeString(const std::string &externalVariableTypeString); - /** * @brief Get the @c std::string for the data structure for the variable * information object. diff --git a/src/bindings/interface/generatorprofile.i b/src/bindings/interface/generatorprofile.i index b7e5c3cb6d..712e2198a8 100644 --- a/src/bindings/interface/generatorprofile.i +++ b/src/bindings/interface/generatorprofile.i @@ -729,48 +729,6 @@ the tag, which will be replaced with the number of states in t "Sets the string for the implementation of the external count constant. To be useful, the string should contain the tag, which will be replaced with the number of states in the model."; -%feature("docstring") libcellml::GeneratorProfile::variableTypeObjectString -"Returns the string for the data structure for the variable type object."; - -%feature("docstring") libcellml::GeneratorProfile::setVariableTypeObjectString -"Sets the string for the data structure for the variable type object."; - -%feature("docstring") libcellml::GeneratorProfile::variableOfIntegrationVariableTypeString -"Returns the string for the name of the variable of integration variable type."; - -%feature("docstring") libcellml::GeneratorProfile::setVariableOfIntegrationVariableTypeString -"Sets the string for the name of the variable of integration variable type."; - -%feature("docstring") libcellml::GeneratorProfile::stateVariableTypeString -"Returns the string for the name of the state variable type."; - -%feature("docstring") libcellml::GeneratorProfile::setStateVariableTypeString -"Sets the string for the name of the state variable type."; - -%feature("docstring") libcellml::GeneratorProfile::constantVariableTypeString -"Returns the string for the name of the constant variable type."; - -%feature("docstring") libcellml::GeneratorProfile::setConstantVariableTypeString -"Sets the string for the name of the constant variable type."; - -%feature("docstring") libcellml::GeneratorProfile::computedConstantVariableTypeString -"Returns the string for the name of the computed constant variable type."; - -%feature("docstring") libcellml::GeneratorProfile::setComputedConstantVariableTypeString -"Sets the string for the name of the computed constant variable type."; - -%feature("docstring") libcellml::GeneratorProfile::algebraicVariableTypeString -"Returns the string for the name of the algebraic variable type."; - -%feature("docstring") libcellml::GeneratorProfile::setAlgebraicVariableTypeString -"Sets the string for the name of the algebraic variable type."; - -%feature("docstring") libcellml::GeneratorProfile::externalVariableTypeString -"Returns the string for the name of the external variable type."; - -%feature("docstring") libcellml::GeneratorProfile::setExternalVariableTypeString -"Sets the string for the name of the external variable type."; - %feature("docstring") libcellml::GeneratorProfile::variableInfoObjectString "Returns the string for the data structure for the variable information object."; diff --git a/src/bindings/javascript/generatorprofile.cpp b/src/bindings/javascript/generatorprofile.cpp index b2fef805b6..5a28e6cac2 100644 --- a/src/bindings/javascript/generatorprofile.cpp +++ b/src/bindings/javascript/generatorprofile.cpp @@ -267,20 +267,6 @@ EMSCRIPTEN_BINDINGS(libcellml_generatorprofile) .function("setInterfaceExternalCountString", &libcellml::GeneratorProfile::setInterfaceExternalCountString) .function("implementationExternalCountString", &libcellml::GeneratorProfile::implementationExternalCountString) .function("setImplementationExternalCountString", &libcellml::GeneratorProfile::setImplementationExternalCountString) - .function("variableTypeObjectString", &libcellml::GeneratorProfile::variableTypeObjectString) - .function("setVariableTypeObjectString", &libcellml::GeneratorProfile::setVariableTypeObjectString) - .function("variableOfIntegrationVariableTypeString", &libcellml::GeneratorProfile::variableOfIntegrationVariableTypeString) - .function("setVariableOfIntegrationVariableTypeString", &libcellml::GeneratorProfile::setVariableOfIntegrationVariableTypeString) - .function("stateVariableTypeString", &libcellml::GeneratorProfile::stateVariableTypeString) - .function("setStateVariableTypeString", &libcellml::GeneratorProfile::setStateVariableTypeString) - .function("constantVariableTypeString", &libcellml::GeneratorProfile::constantVariableTypeString) - .function("setConstantVariableTypeString", &libcellml::GeneratorProfile::setConstantVariableTypeString) - .function("computedConstantVariableTypeString", &libcellml::GeneratorProfile::computedConstantVariableTypeString) - .function("setComputedConstantVariableTypeString", &libcellml::GeneratorProfile::setComputedConstantVariableTypeString) - .function("algebraicVariableTypeString", &libcellml::GeneratorProfile::algebraicVariableTypeString) - .function("setAlgebraicVariableTypeString", &libcellml::GeneratorProfile::setAlgebraicVariableTypeString) - .function("externalVariableTypeString", &libcellml::GeneratorProfile::externalVariableTypeString) - .function("setExternalVariableTypeString", &libcellml::GeneratorProfile::setExternalVariableTypeString) .function("variableInfoObjectString", &libcellml::GeneratorProfile::variableInfoObjectString) .function("setVariableInfoObjectString", &libcellml::GeneratorProfile::setVariableInfoObjectString) .function("interfaceVoiInfoString", &libcellml::GeneratorProfile::interfaceVoiInfoString) diff --git a/src/generator.cpp b/src/generator.cpp index 442fc9d1a8..4c7b02d814 100644 --- a/src/generator.cpp +++ b/src/generator.cpp @@ -361,17 +361,6 @@ void Generator::GeneratorImpl::addStateAndVariableCountCode(bool interface) mCode += code; } -void Generator::GeneratorImpl::addVariableTypeObjectCode() -{ - auto variableTypeObjectString = mProfile->variableTypeObjectString(modelHasOdes(), - mModel->hasExternalVariables()); - - if (!variableTypeObjectString.empty()) { - mCode += newLineIfNeeded() - + variableTypeObjectString; - } -} - std::string Generator::GeneratorImpl::generateVariableInfoObjectCode(const std::string &objectString) const { size_t componentSize = 0; @@ -398,14 +387,12 @@ void Generator::GeneratorImpl::addVariableInfoObjectCode() std::string Generator::GeneratorImpl::generateVariableInfoEntryCode(const std::string &name, const std::string &units, - const std::string &component, - const std::string &type) const + const std::string &component) const { - return replace(replace(replace(replace(mProfile->variableInfoEntryString(), + return replace(replace(replace(mProfile->variableInfoEntryString(), "[NAME]", name), "[UNITS]", units), - "[COMPONENT]", component), - "[TYPE]", type); + "[COMPONENT]", component); } void Generator::GeneratorImpl::addInterfaceVariableInfoCode() @@ -447,13 +434,11 @@ void Generator::GeneratorImpl::addInterfaceVariableInfoCode() } void Generator::GeneratorImpl::doAddImplementationVariableInfoCode(const std::string &variableInfoString, - const std::string &variableTypeString, const std::vector &variables, bool voiVariable) { if (!variableInfoString.empty() && !mProfile->variableInfoEntryString().empty() - && !variableTypeString.empty() && !mProfile->arrayElementSeparatorString().empty()) { std::string infoElementsCode; @@ -467,8 +452,7 @@ void Generator::GeneratorImpl::doAddImplementationVariableInfoCode(const std::st infoElementsCode += (voiVariable ? "" : mProfile->indentString()) + generateVariableInfoEntryCode(variableVariable->name(), variableVariable->units()->name(), - owningComponent(variableVariable)->name(), - variableTypeString); + owningComponent(variableVariable)->name()); } if (!voiVariable && !infoElementsCode.empty()) { @@ -487,33 +471,21 @@ void Generator::GeneratorImpl::addImplementationVariableInfoCode() variables.push_back(mModel->voi()); - doAddImplementationVariableInfoCode(mProfile->implementationVoiInfoString(), - mProfile->variableOfIntegrationVariableTypeString(), - variables, true); + doAddImplementationVariableInfoCode(mProfile->implementationVoiInfoString(), variables, true); } if (modelHasOdes()) { - doAddImplementationVariableInfoCode(mProfile->implementationStateInfoString(), - mProfile->stateVariableTypeString(), - mModel->states(), false); + doAddImplementationVariableInfoCode(mProfile->implementationStateInfoString(), mModel->states(), false); } - doAddImplementationVariableInfoCode(mProfile->implementationConstantInfoString(), - mProfile->constantVariableTypeString(), - mModel->constants(), false); + doAddImplementationVariableInfoCode(mProfile->implementationConstantInfoString(), mModel->constants(), false); - doAddImplementationVariableInfoCode(mProfile->implementationComputedConstantInfoString(), - mProfile->computedConstantVariableTypeString(), - mModel->computedConstants(), false); + doAddImplementationVariableInfoCode(mProfile->implementationComputedConstantInfoString(), mModel->computedConstants(), false); - doAddImplementationVariableInfoCode(mProfile->implementationAlgebraicInfoString(), - mProfile->algebraicVariableTypeString(), - mModel->algebraic(), false); + doAddImplementationVariableInfoCode(mProfile->implementationAlgebraicInfoString(), mModel->algebraic(), false); if (mModel->hasExternalVariables()) { - doAddImplementationVariableInfoCode(mProfile->implementationExternalInfoString(), - mProfile->externalVariableTypeString(), - mModel->externals(), false); + doAddImplementationVariableInfoCode(mProfile->implementationExternalInfoString(), mModel->externals(), false); } } @@ -2025,7 +1997,6 @@ std::string Generator::interfaceCode() const // Add code for the variable information related objects. - mPimpl->addVariableTypeObjectCode(); mPimpl->addVariableInfoObjectCode(); // Add code for the interface of the information about the variable of integration, states, constants, computed @@ -2080,7 +2051,6 @@ std::string Generator::implementationCode() const // Add code for the variable information related objects. if (!mPimpl->mProfile->hasInterface()) { - mPimpl->addVariableTypeObjectCode(); mPimpl->addVariableInfoObjectCode(); } diff --git a/src/generator_p.h b/src/generator_p.h index fd79ffbff8..02c6fdf5a5 100644 --- a/src/generator_p.h +++ b/src/generator_p.h @@ -82,20 +82,17 @@ struct Generator::GeneratorImpl void addStateAndVariableCountCode(bool interface = false); - void addVariableTypeObjectCode(); - std::string generateVariableInfoObjectCode(const std::string &objectString) const; void addVariableInfoObjectCode(); std::string generateVariableInfoEntryCode(const std::string &name, const std::string &units, - const std::string &component, - const std::string &type) const; + const std::string &component) const; void addInterfaceVariableInfoCode(); - void doAddImplementationVariableInfoCode(const std::string &variableInfoString, const std::string &variableTypeString, + void doAddImplementationVariableInfoCode(const std::string &variableInfoString, const std::vector &variables, bool voiVariable); void addImplementationVariableInfoCode(); diff --git a/src/generatorprofile.cpp b/src/generatorprofile.cpp index 4258948d4e..843249297c 100644 --- a/src/generatorprofile.cpp +++ b/src/generatorprofile.cpp @@ -196,18 +196,6 @@ struct GeneratorProfile::GeneratorProfileImpl std::string mInterfaceExternalCountString; std::string mImplementationExternalCountString; - std::string mVariableTypeObjectFamWoevString; - std::string mVariableTypeObjectFamWevString; - std::string mVariableTypeObjectFdmWoevString; - std::string mVariableTypeObjectFdmWevString; - - std::string mVariableOfIntegrationVariableTypeString; - std::string mStateVariableTypeString; - std::string mConstantVariableTypeString; - std::string mComputedConstantVariableTypeString; - std::string mAlgebraicVariableTypeString; - std::string mExternalVariableTypeString; - std::string mVariableInfoObjectString; std::string mInterfaceVoiInfoString; @@ -537,45 +525,10 @@ void GeneratorProfile::GeneratorProfileImpl::loadProfile(GeneratorProfile::Profi mInterfaceExternalCountString = "extern const size_t EXTERNAL_COUNT;\n"; mImplementationExternalCountString = "const size_t EXTERNAL_COUNT = [EXTERNAL_COUNT];\n"; - mVariableTypeObjectFamWoevString = "typedef enum {\n" - " CONSTANT,\n" - " COMPUTED_CONSTANT,\n" - " ALGEBRAIC\n" - "} VariableType;\n"; - mVariableTypeObjectFamWevString = "typedef enum {\n" - " CONSTANT,\n" - " COMPUTED_CONSTANT,\n" - " ALGEBRAIC,\n" - " EXTERNAL\n" - "} VariableType;\n"; - mVariableTypeObjectFdmWoevString = "typedef enum {\n" - " VARIABLE_OF_INTEGRATION,\n" - " STATE,\n" - " CONSTANT,\n" - " COMPUTED_CONSTANT,\n" - " ALGEBRAIC\n" - "} VariableType;\n"; - mVariableTypeObjectFdmWevString = "typedef enum {\n" - " VARIABLE_OF_INTEGRATION,\n" - " STATE,\n" - " CONSTANT,\n" - " COMPUTED_CONSTANT,\n" - " ALGEBRAIC,\n" - " EXTERNAL\n" - "} VariableType;\n"; - - mVariableOfIntegrationVariableTypeString = "VARIABLE_OF_INTEGRATION"; - mStateVariableTypeString = "STATE"; - mConstantVariableTypeString = "CONSTANT"; - mComputedConstantVariableTypeString = "COMPUTED_CONSTANT"; - mAlgebraicVariableTypeString = "ALGEBRAIC"; - mExternalVariableTypeString = "EXTERNAL"; - mVariableInfoObjectString = "typedef struct {\n" " char name[[NAME_SIZE]];\n" " char units[[UNITS_SIZE]];\n" " char component[[COMPONENT_SIZE]];\n" - " VariableType type;\n" "} VariableInfo;\n"; mInterfaceVoiInfoString = "extern const VariableInfo VOI_INFO;\n"; @@ -606,7 +559,7 @@ void GeneratorProfile::GeneratorProfileImpl::loadProfile(GeneratorProfile::Profi "[CODE]" "};\n"; - mVariableInfoEntryString = "{\"[NAME]\", \"[UNITS]\", \"[COMPONENT]\", [TYPE]}"; + mVariableInfoEntryString = "{\"[NAME]\", \"[UNITS]\", \"[COMPONENT]\"}"; mVoiString = "voi"; @@ -992,44 +945,6 @@ void GeneratorProfile::GeneratorProfileImpl::loadProfile(GeneratorProfile::Profi mInterfaceExternalCountString = ""; mImplementationExternalCountString = "EXTERNAL_COUNT = [EXTERNAL_COUNT]\n"; - mVariableTypeObjectFamWoevString = "\n" - "class VariableType(Enum):\n" - " CONSTANT = 0\n" - " COMPUTED_CONSTANT = 1\n" - " ALGEBRAIC = 2\n" - "\n"; - mVariableTypeObjectFamWevString = "\n" - "class VariableType(Enum):\n" - " CONSTANT = 0\n" - " COMPUTED_CONSTANT = 1\n" - " ALGEBRAIC = 2\n" - " EXTERNAL = 3\n" - "\n"; - mVariableTypeObjectFdmWoevString = "\n" - "class VariableType(Enum):\n" - " VARIABLE_OF_INTEGRATION = 0\n" - " STATE = 1\n" - " CONSTANT = 2\n" - " COMPUTED_CONSTANT = 3\n" - " ALGEBRAIC = 4\n" - "\n"; - mVariableTypeObjectFdmWevString = "\n" - "class VariableType(Enum):\n" - " VARIABLE_OF_INTEGRATION = 0\n" - " STATE = 1\n" - " CONSTANT = 2\n" - " COMPUTED_CONSTANT = 3\n" - " ALGEBRAIC = 4\n" - " EXTERNAL = 5\n" - "\n"; - - mVariableOfIntegrationVariableTypeString = "VariableType.VARIABLE_OF_INTEGRATION"; - mStateVariableTypeString = "VariableType.STATE"; - mConstantVariableTypeString = "VariableType.CONSTANT"; - mComputedConstantVariableTypeString = "VariableType.COMPUTED_CONSTANT"; - mAlgebraicVariableTypeString = "VariableType.ALGEBRAIC"; - mExternalVariableTypeString = "VariableType.EXTERNAL"; - mVariableInfoObjectString = ""; mInterfaceVoiInfoString = ""; @@ -1058,7 +973,7 @@ void GeneratorProfile::GeneratorProfileImpl::loadProfile(GeneratorProfile::Profi "[CODE]" "]\n"; - mVariableInfoEntryString = "{\"name\": \"[NAME]\", \"units\": \"[UNITS]\", \"component\": \"[COMPONENT]\", \"type\": [TYPE]}"; + mVariableInfoEntryString = "{\"name\": \"[NAME]\", \"units\": \"[UNITS]\", \"component\": \"[COMPONENT]\"}"; mVoiString = "voi"; @@ -2400,103 +2315,6 @@ void GeneratorProfile::setImplementationExternalCountString(const std::string &i mPimpl->mImplementationExternalCountString = implementationExternalCountString; } -std::string GeneratorProfile::variableTypeObjectString(bool forDifferentialModel, - bool withExternalVariables) const -{ - if (forDifferentialModel) { - if (withExternalVariables) { - return mPimpl->mVariableTypeObjectFdmWevString; - } - - return mPimpl->mVariableTypeObjectFdmWoevString; - } - - if (withExternalVariables) { - return mPimpl->mVariableTypeObjectFamWevString; - } - - return mPimpl->mVariableTypeObjectFamWoevString; -} - -void GeneratorProfile::setVariableTypeObjectString(bool forDifferentialModel, - bool withExternalVariables, - const std::string &variableTypeObjectString) -{ - if (forDifferentialModel) { - if (withExternalVariables) { - mPimpl->mVariableTypeObjectFdmWevString = variableTypeObjectString; - } else { - mPimpl->mVariableTypeObjectFdmWoevString = variableTypeObjectString; - } - } else { - if (withExternalVariables) { - mPimpl->mVariableTypeObjectFamWevString = variableTypeObjectString; - } else { - mPimpl->mVariableTypeObjectFamWoevString = variableTypeObjectString; - } - } -} - -std::string GeneratorProfile::variableOfIntegrationVariableTypeString() const -{ - return mPimpl->mVariableOfIntegrationVariableTypeString; -} - -void GeneratorProfile::setVariableOfIntegrationVariableTypeString(const std::string &variableOfIntegrationVariableTypeString) -{ - mPimpl->mVariableOfIntegrationVariableTypeString = variableOfIntegrationVariableTypeString; -} - -std::string GeneratorProfile::stateVariableTypeString() const -{ - return mPimpl->mStateVariableTypeString; -} - -void GeneratorProfile::setStateVariableTypeString(const std::string &stateVariableTypeString) -{ - mPimpl->mStateVariableTypeString = stateVariableTypeString; -} - -std::string GeneratorProfile::constantVariableTypeString() const -{ - return mPimpl->mConstantVariableTypeString; -} - -void GeneratorProfile::setConstantVariableTypeString(const std::string &constantVariableTypeString) -{ - mPimpl->mConstantVariableTypeString = constantVariableTypeString; -} - -std::string GeneratorProfile::computedConstantVariableTypeString() const -{ - return mPimpl->mComputedConstantVariableTypeString; -} - -void GeneratorProfile::setComputedConstantVariableTypeString(const std::string &computedConstantVariableTypeString) -{ - mPimpl->mComputedConstantVariableTypeString = computedConstantVariableTypeString; -} - -std::string GeneratorProfile::algebraicVariableTypeString() const -{ - return mPimpl->mAlgebraicVariableTypeString; -} - -void GeneratorProfile::setAlgebraicVariableTypeString(const std::string &algebraicVariableTypeString) -{ - mPimpl->mAlgebraicVariableTypeString = algebraicVariableTypeString; -} - -std::string GeneratorProfile::externalVariableTypeString() const -{ - return mPimpl->mExternalVariableTypeString; -} - -void GeneratorProfile::setExternalVariableTypeString(const std::string &externalVariableTypeString) -{ - mPimpl->mExternalVariableTypeString = externalVariableTypeString; -} - std::string GeneratorProfile::variableInfoObjectString() const { return mPimpl->mVariableInfoObjectString; diff --git a/src/generatorprofilesha1values.h b/src/generatorprofilesha1values.h index 5db086202d..577df6a27e 100644 --- a/src/generatorprofilesha1values.h +++ b/src/generatorprofilesha1values.h @@ -24,7 +24,7 @@ namespace libcellml { * The content of this file is generated, do not edit this file directly. * See docs/dev_utilities.rst for further information. */ -static const char C_GENERATOR_PROFILE_SHA1[] = "51c71d6a06d1b6e38467cc3f333062d5be98fba1"; -static const char PYTHON_GENERATOR_PROFILE_SHA1[] = "710333a658fecca12a9ff0c6bf41dd45a12c0f35"; +static const char C_GENERATOR_PROFILE_SHA1[] = "14c2693a5338e70419f230e375f49acef40a68ce"; +static const char PYTHON_GENERATOR_PROFILE_SHA1[] = "23ed0dcff0e9015280889861f4d75420fd14c211"; } // namespace libcellml diff --git a/src/generatorprofiletools.cpp b/src/generatorprofiletools.cpp index f798af19dd..9891778cee 100644 --- a/src/generatorprofiletools.cpp +++ b/src/generatorprofiletools.cpp @@ -454,18 +454,6 @@ std::string generatorProfileAsString(const GeneratorProfilePtr &generatorProfile profileContents += generatorProfile->interfaceExternalCountString() + generatorProfile->implementationExternalCountString(); - profileContents += generatorProfile->variableTypeObjectString(false, false); - profileContents += generatorProfile->variableTypeObjectString(false, true); - profileContents += generatorProfile->variableTypeObjectString(true, false); - profileContents += generatorProfile->variableTypeObjectString(true, true); - - profileContents += generatorProfile->variableOfIntegrationVariableTypeString() - + generatorProfile->stateVariableTypeString() - + generatorProfile->constantVariableTypeString() - + generatorProfile->computedConstantVariableTypeString() - + generatorProfile->algebraicVariableTypeString() - + generatorProfile->externalVariableTypeString(); - profileContents += generatorProfile->variableInfoObjectString(); profileContents += generatorProfile->interfaceVoiInfoString() diff --git a/tests/bindings/javascript/generatorprofile.test.js b/tests/bindings/javascript/generatorprofile.test.js index 095d280520..6aa7460ee7 100644 --- a/tests/bindings/javascript/generatorprofile.test.js +++ b/tests/bindings/javascript/generatorprofile.test.js @@ -732,54 +732,6 @@ describe("GeneratorProfile tests", () => { x.setImplementationExternalCountString("something") expect(x.implementationExternalCountString()).toBe("something") }); - test("Checking GeneratorProfile.variableTypeObjectString.", () => { - const x = new libcellml.GeneratorProfile(libcellml.GeneratorProfile.Profile.C) - - x.setVariableTypeObjectString(false, false, "something") - expect(x.variableTypeObjectString(false, false)).toBe("something") - x.setVariableTypeObjectString(false, true, "something") - expect(x.variableTypeObjectString(false, true)).toBe("something") - x.setVariableTypeObjectString(true, false, "something") - expect(x.variableTypeObjectString(true, false)).toBe("something") - x.setVariableTypeObjectString(true, true, "something") - expect(x.variableTypeObjectString(true, true)).toBe("something") - }); - test("Checking GeneratorProfile.variableOfIntegrationVariableTypeString.", () => { - const x = new libcellml.GeneratorProfile(libcellml.GeneratorProfile.Profile.C) - - x.setVariableOfIntegrationVariableTypeString("something") - expect(x.variableOfIntegrationVariableTypeString()).toBe("something") - }); - test("Checking GeneratorProfile.stateVariableTypeString.", () => { - const x = new libcellml.GeneratorProfile(libcellml.GeneratorProfile.Profile.C) - - x.setStateVariableTypeString("something") - expect(x.stateVariableTypeString()).toBe("something") - }); - test("Checking GeneratorProfile.constantVariableTypeString.", () => { - const x = new libcellml.GeneratorProfile(libcellml.GeneratorProfile.Profile.C) - - x.setConstantVariableTypeString("something") - expect(x.constantVariableTypeString()).toBe("something") - }); - test("Checking GeneratorProfile.computedConstantVariableTypeString.", () => { - const x = new libcellml.GeneratorProfile(libcellml.GeneratorProfile.Profile.C) - - x.setComputedConstantVariableTypeString("something") - expect(x.computedConstantVariableTypeString()).toBe("something") - }); - test("Checking GeneratorProfile.algebraicVariableTypeString.", () => { - const x = new libcellml.GeneratorProfile(libcellml.GeneratorProfile.Profile.C) - - x.setAlgebraicVariableTypeString("something") - expect(x.algebraicVariableTypeString()).toBe("something") - }); - test("Checking GeneratorProfile.externalVariableTypeString.", () => { - const x = new libcellml.GeneratorProfile(libcellml.GeneratorProfile.Profile.C) - - x.setExternalVariableTypeString("something") - expect(x.externalVariableTypeString()).toBe("something") - }); test("Checking GeneratorProfile.variableInfoObjectString.", () => { const x = new libcellml.GeneratorProfile(libcellml.GeneratorProfile.Profile.C) diff --git a/tests/bindings/python/test_generator_profile.py b/tests/bindings/python/test_generator_profile.py index ce31fc92c1..cf532b8a6f 100644 --- a/tests/bindings/python/test_generator_profile.py +++ b/tests/bindings/python/test_generator_profile.py @@ -214,24 +214,6 @@ def test_acsch_string(self): g.setAcschString(GeneratorProfileTestCase.VALUE) self.assertEqual(GeneratorProfileTestCase.VALUE, g.acschString()) - def test_algebraic_variable_type_string(self): - from libcellml import GeneratorProfile - - g = GeneratorProfile() - - self.assertEqual('ALGEBRAIC', g.algebraicVariableTypeString()) - g.setAlgebraicVariableTypeString(GeneratorProfileTestCase.VALUE) - self.assertEqual(GeneratorProfileTestCase.VALUE, g.algebraicVariableTypeString()) - - def test_external_variable_type_string(self): - from libcellml import GeneratorProfile - - g = GeneratorProfile() - - self.assertEqual('EXTERNAL', g.externalVariableTypeString()) - g.setExternalVariableTypeString(GeneratorProfileTestCase.VALUE) - self.assertEqual(GeneratorProfileTestCase.VALUE, g.externalVariableTypeString()) - def test_and_function_string(self): from libcellml import GeneratorProfile @@ -396,15 +378,6 @@ def test_common_logarithm_string(self): g.setCommonLogarithmString(GeneratorProfileTestCase.VALUE) self.assertEqual(GeneratorProfileTestCase.VALUE, g.commonLogarithmString()) - def test_computed_constant_variable_type_string(self): - from libcellml import GeneratorProfile - - g = GeneratorProfile() - - self.assertEqual('COMPUTED_CONSTANT', g.computedConstantVariableTypeString()) - g.setComputedConstantVariableTypeString(GeneratorProfileTestCase.VALUE) - self.assertEqual(GeneratorProfileTestCase.VALUE, g.computedConstantVariableTypeString()) - def test_conditional_operator_else_string(self): from libcellml import GeneratorProfile @@ -423,33 +396,6 @@ def test_conditional_operator_if_string(self): g.setConditionalOperatorIfString(GeneratorProfileTestCase.VALUE) self.assertEqual(GeneratorProfileTestCase.VALUE, g.conditionalOperatorIfString()) - def test_variable_of_integration_variable_type_string(self): - from libcellml import GeneratorProfile - - g = GeneratorProfile() - - self.assertEqual('VARIABLE_OF_INTEGRATION', g.variableOfIntegrationVariableTypeString()) - g.setVariableOfIntegrationVariableTypeString(GeneratorProfileTestCase.VALUE) - self.assertEqual(GeneratorProfileTestCase.VALUE, g.variableOfIntegrationVariableTypeString()) - - def test_state_variable_type_string(self): - from libcellml import GeneratorProfile - - g = GeneratorProfile() - - self.assertEqual('STATE', g.stateVariableTypeString()) - g.setStateVariableTypeString(GeneratorProfileTestCase.VALUE) - self.assertEqual(GeneratorProfileTestCase.VALUE, g.stateVariableTypeString()) - - def test_constant_variable_type_string(self): - from libcellml import GeneratorProfile - - g = GeneratorProfile() - - self.assertEqual('CONSTANT', g.constantVariableTypeString()) - g.setConstantVariableTypeString(GeneratorProfileTestCase.VALUE) - self.assertEqual(GeneratorProfileTestCase.VALUE, g.constantVariableTypeString()) - def test_cos_string(self): from libcellml import GeneratorProfile @@ -1634,7 +1580,7 @@ def test_variable_info_entry_string(self): g = GeneratorProfile() - self.assertEqual('{"[NAME]", "[UNITS]", "[COMPONENT]", [TYPE]}', g.variableInfoEntryString()) + self.assertEqual('{"[NAME]", "[UNITS]", "[COMPONENT]"}', g.variableInfoEntryString()) g.setVariableInfoEntryString(GeneratorProfileTestCase.VALUE) self.assertEqual(GeneratorProfileTestCase.VALUE, g.variableInfoEntryString()) @@ -1644,40 +1590,11 @@ def test_variable_info_object_string(self): g = GeneratorProfile() self.assertEqual( - 'typedef struct {\n char name[[NAME_SIZE]];\n char units[[UNITS_SIZE]];\n char component[[COMPONENT_SIZE]];\n VariableType type;\n} VariableInfo;\n', + 'typedef struct {\n char name[[NAME_SIZE]];\n char units[[UNITS_SIZE]];\n char component[[COMPONENT_SIZE]];\n} VariableInfo;\n', g.variableInfoObjectString()) g.setVariableInfoObjectString(GeneratorProfileTestCase.VALUE) self.assertEqual(GeneratorProfileTestCase.VALUE, g.variableInfoObjectString()) - def test_variable_type_object_string(self): - from libcellml import GeneratorProfile - - g = GeneratorProfile() - - self.assertEqual( - 'typedef enum {\n CONSTANT,\n COMPUTED_CONSTANT,\n ALGEBRAIC\n} VariableType;\n', - g.variableTypeObjectString(False, False)) - g.setVariableTypeObjectString(False, False, GeneratorProfileTestCase.VALUE) - self.assertEqual(GeneratorProfileTestCase.VALUE, g.variableTypeObjectString(False, False)) - - self.assertEqual( - 'typedef enum {\n CONSTANT,\n COMPUTED_CONSTANT,\n ALGEBRAIC,\n EXTERNAL\n} VariableType;\n', - g.variableTypeObjectString(False, True)) - g.setVariableTypeObjectString(False, True, GeneratorProfileTestCase.VALUE) - self.assertEqual(GeneratorProfileTestCase.VALUE, g.variableTypeObjectString(False, True)) - - self.assertEqual( - 'typedef enum {\n VARIABLE_OF_INTEGRATION,\n STATE,\n CONSTANT,\n COMPUTED_CONSTANT,\n ALGEBRAIC\n} VariableType;\n', - g.variableTypeObjectString(True, False)) - g.setVariableTypeObjectString(True, False, GeneratorProfileTestCase.VALUE) - self.assertEqual(GeneratorProfileTestCase.VALUE, g.variableTypeObjectString(True, False)) - - self.assertEqual( - 'typedef enum {\n VARIABLE_OF_INTEGRATION,\n STATE,\n CONSTANT,\n COMPUTED_CONSTANT,\n ALGEBRAIC,\n EXTERNAL\n} VariableType;\n', - g.variableTypeObjectString(True, True)) - g.setVariableTypeObjectString(True, True, GeneratorProfileTestCase.VALUE) - self.assertEqual(GeneratorProfileTestCase.VALUE, g.variableTypeObjectString(True, True)) - def test_constants_array_string(self): from libcellml import GeneratorProfile diff --git a/tests/coverage/coverage.cpp b/tests/coverage/coverage.cpp index 2a6a53ea78..b2e37fbab4 100644 --- a/tests/coverage/coverage.cpp +++ b/tests/coverage/coverage.cpp @@ -718,18 +718,6 @@ TEST(Coverage, generator) profile->setImplementationAlgebraicCountString(""); profile->setImplementationExternalCountString(""); - profile->setVariableTypeObjectString(false, false, ""); - profile->setVariableTypeObjectString(false, true, ""); - profile->setVariableTypeObjectString(true, false, ""); - profile->setVariableTypeObjectString(true, true, ""); - - profile->setVariableOfIntegrationVariableTypeString(""); - profile->setStateVariableTypeString(""); - profile->setConstantVariableTypeString(""); - profile->setComputedConstantVariableTypeString(""); - profile->setAlgebraicVariableTypeString(""); - profile->setExternalVariableTypeString(""); - profile->setVariableInfoObjectString(""); profile->setImplementationVoiInfoString(""); @@ -809,18 +797,6 @@ TEST(Coverage, generator) profile->setInterfaceExternalCountString(""); profile->setImplementationExternalCountString(""); - profile->setVariableTypeObjectString(false, false, ""); - profile->setVariableTypeObjectString(false, true, ""); - profile->setVariableTypeObjectString(true, false, ""); - profile->setVariableTypeObjectString(true, true, ""); - - profile->setVariableOfIntegrationVariableTypeString(""); - profile->setStateVariableTypeString(""); - profile->setConstantVariableTypeString(""); - profile->setComputedConstantVariableTypeString(""); - profile->setAlgebraicVariableTypeString(""); - profile->setExternalVariableTypeString(""); - profile->setVariableInfoObjectString(""); profile->setInterfaceVoiInfoString(""); @@ -926,32 +902,6 @@ TEST(Coverage, generator) profile->setFindRootCallString(true, ""); profile->setNlaSolveCallString(false, ""); profile->setNlaSolveCallString(true, ""); - profile->setVariableOfIntegrationVariableTypeString(""); - - generator->implementationCode(); - - profile->setStateVariableTypeString(""); - profile->setVariableOfIntegrationVariableTypeString("xxx"); - - generator->implementationCode(); - - profile->setConstantVariableTypeString(""); - profile->setStateVariableTypeString("xxx"); - - generator->implementationCode(); - - profile->setComputedConstantVariableTypeString(""); - profile->setConstantVariableTypeString("xxx"); - - generator->implementationCode(); - - profile->setComputedConstantVariableTypeString("xxx"); - profile->setAlgebraicVariableTypeString(""); - - generator->implementationCode(); - - profile->setAlgebraicVariableTypeString("xxx"); - profile->setExternalVariableTypeString(""); generator->implementationCode(); diff --git a/tests/generator/generatorprofile.cpp b/tests/generator/generatorprofile.cpp index 7f079b5c0d..97cba41273 100644 --- a/tests/generator/generatorprofile.cpp +++ b/tests/generator/generatorprofile.cpp @@ -291,49 +291,10 @@ TEST(GeneratorProfile, defaultMiscellaneousValues) EXPECT_EQ("extern const size_t EXTERNAL_COUNT;\n", generatorProfile->interfaceExternalCountString()); EXPECT_EQ("const size_t EXTERNAL_COUNT = [EXTERNAL_COUNT];\n", generatorProfile->implementationExternalCountString()); - EXPECT_EQ("typedef enum {\n" - " CONSTANT,\n" - " COMPUTED_CONSTANT,\n" - " ALGEBRAIC\n" - "} VariableType;\n", - generatorProfile->variableTypeObjectString(false, false)); - EXPECT_EQ("typedef enum {\n" - " CONSTANT,\n" - " COMPUTED_CONSTANT,\n" - " ALGEBRAIC,\n" - " EXTERNAL\n" - "} VariableType;\n", - generatorProfile->variableTypeObjectString(false, true)); - EXPECT_EQ("typedef enum {\n" - " VARIABLE_OF_INTEGRATION,\n" - " STATE,\n" - " CONSTANT,\n" - " COMPUTED_CONSTANT,\n" - " ALGEBRAIC\n" - "} VariableType;\n", - generatorProfile->variableTypeObjectString(true, false)); - EXPECT_EQ("typedef enum {\n" - " VARIABLE_OF_INTEGRATION,\n" - " STATE,\n" - " CONSTANT,\n" - " COMPUTED_CONSTANT,\n" - " ALGEBRAIC,\n" - " EXTERNAL\n" - "} VariableType;\n", - generatorProfile->variableTypeObjectString(true, true)); - - EXPECT_EQ("VARIABLE_OF_INTEGRATION", generatorProfile->variableOfIntegrationVariableTypeString()); - EXPECT_EQ("STATE", generatorProfile->stateVariableTypeString()); - EXPECT_EQ("CONSTANT", generatorProfile->constantVariableTypeString()); - EXPECT_EQ("COMPUTED_CONSTANT", generatorProfile->computedConstantVariableTypeString()); - EXPECT_EQ("ALGEBRAIC", generatorProfile->algebraicVariableTypeString()); - EXPECT_EQ("EXTERNAL", generatorProfile->externalVariableTypeString()); - EXPECT_EQ("typedef struct {\n" " char name[[NAME_SIZE]];\n" " char units[[UNITS_SIZE]];\n" " char component[[COMPONENT_SIZE]];\n" - " VariableType type;\n" "} VariableInfo;\n", generatorProfile->variableInfoObjectString()); @@ -370,7 +331,7 @@ TEST(GeneratorProfile, defaultMiscellaneousValues) "};\n", generatorProfile->implementationExternalInfoString()); - EXPECT_EQ("{\"[NAME]\", \"[UNITS]\", \"[COMPONENT]\", [TYPE]}", generatorProfile->variableInfoEntryString()); + EXPECT_EQ("{\"[NAME]\", \"[UNITS]\", \"[COMPONENT]\"}", generatorProfile->variableInfoEntryString()); EXPECT_EQ("voi", generatorProfile->voiString()); @@ -906,18 +867,6 @@ TEST(GeneratorProfile, miscellaneous) generatorProfile->setInterfaceExternalCountString(value); generatorProfile->setImplementationExternalCountString(value); - generatorProfile->setVariableTypeObjectString(false, false, value); - generatorProfile->setVariableTypeObjectString(false, true, value); - generatorProfile->setVariableTypeObjectString(true, false, value); - generatorProfile->setVariableTypeObjectString(true, true, value); - - generatorProfile->setVariableOfIntegrationVariableTypeString(value); - generatorProfile->setStateVariableTypeString(value); - generatorProfile->setConstantVariableTypeString(value); - generatorProfile->setComputedConstantVariableTypeString(value); - generatorProfile->setAlgebraicVariableTypeString(value); - generatorProfile->setExternalVariableTypeString(value); - generatorProfile->setVariableInfoObjectString(value); generatorProfile->setInterfaceVoiInfoString(value); @@ -1055,18 +1004,6 @@ TEST(GeneratorProfile, miscellaneous) EXPECT_EQ(value, generatorProfile->interfaceExternalCountString()); EXPECT_EQ(value, generatorProfile->implementationExternalCountString()); - EXPECT_EQ(value, generatorProfile->variableTypeObjectString(false, false)); - EXPECT_EQ(value, generatorProfile->variableTypeObjectString(false, true)); - EXPECT_EQ(value, generatorProfile->variableTypeObjectString(true, false)); - EXPECT_EQ(value, generatorProfile->variableTypeObjectString(true, true)); - - EXPECT_EQ(value, generatorProfile->variableOfIntegrationVariableTypeString()); - EXPECT_EQ(value, generatorProfile->stateVariableTypeString()); - EXPECT_EQ(value, generatorProfile->constantVariableTypeString()); - EXPECT_EQ(value, generatorProfile->computedConstantVariableTypeString()); - EXPECT_EQ(value, generatorProfile->algebraicVariableTypeString()); - EXPECT_EQ(value, generatorProfile->externalVariableTypeString()); - EXPECT_EQ(value, generatorProfile->variableInfoObjectString()); EXPECT_EQ(value, generatorProfile->interfaceVoiInfoString()); diff --git a/tests/resources/coverage/generator/model.c b/tests/resources/coverage/generator/model.c index c354ffd2c6..e65de4ae99 100644 --- a/tests/resources/coverage/generator/model.c +++ b/tests/resources/coverage/generator/model.c @@ -13,228 +13,228 @@ const size_t CONSTANT_COUNT = 7; const size_t COMPUTED_CONSTANT_COUNT = 200; const size_t ALGEBRAIC_COUNT = 2; -const VariableInfo VOI_INFO = {"t", "second", "my_component", VARIABLE_OF_INTEGRATION}; +const VariableInfo VOI_INFO = {"t", "second", "my_component"}; const VariableInfo STATE_INFO[] = { - {"x", "dimensionless", "my_component", STATE} + {"x", "dimensionless", "my_component"} }; const VariableInfo CONSTANT_INFO[] = { - {"m", "dimensionless", "my_component", CONSTANT}, - {"n", "dimensionless", "my_component", CONSTANT}, - {"o", "dimensionless", "my_component", CONSTANT}, - {"p", "dimensionless", "my_component", CONSTANT}, - {"q", "dimensionless", "my_component", CONSTANT}, - {"r", "dimensionless", "my_component", CONSTANT}, - {"s", "dimensionless", "my_component", CONSTANT} + {"m", "dimensionless", "my_component"}, + {"n", "dimensionless", "my_component"}, + {"o", "dimensionless", "my_component"}, + {"p", "dimensionless", "my_component"}, + {"q", "dimensionless", "my_component"}, + {"r", "dimensionless", "my_component"}, + {"s", "dimensionless", "my_component"} }; const VariableInfo COMPUTED_CONSTANT_INFO[] = { - {"eqnEq", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnEqCoverageParentheses", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnNeq", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnNeqCoverageParentheses", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnLt", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnLtCoverageParentheses", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnLeq", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnLeqCoverageParentheses", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnGt", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnGtCoverageParentheses", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnGeq", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnGeqCoverageParentheses", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnAnd", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnAndMultiple", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnAndParentheses", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnAndParenthesesLeftPlusWith", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnAndParenthesesLeftPlusWithout", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnAndParenthesesLeftMinusWith", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnAndParenthesesLeftMinusWithout", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnAndParenthesesLeftPower", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnAndParenthesesLeftRoot", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnAndParenthesesRightPlusWith", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnAndParenthesesRightPlusWithout", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnAndParenthesesRightMinusWith", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnAndParenthesesRightMinusWithout", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnAndParenthesesRightPower", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnAndParenthesesRightRoot", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnAndCoverageParentheses", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnOr", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnOrMultiple", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnOrParentheses", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnOrParenthesesLeftPlusWith", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnOrParenthesesLeftPlusWithout", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnOrParenthesesLeftMinusWith", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnOrParenthesesLeftMinusWithout", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnOrParenthesesLeftPower", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnOrParenthesesLeftRoot", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnOrParenthesesRightPlusWith", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnOrParenthesesRightPlusWithout", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnOrParenthesesRightMinusWith", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnOrParenthesesRightMinusWithout", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnOrParenthesesRightPower", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnOrParenthesesRightRoot", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnOrCoverageParentheses", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnXor", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnXorMultiple", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnXorParentheses", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnXorParenthesesLeftPlusWith", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnXorParenthesesLeftPlusWithout", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnXorParenthesesLeftMinusWith", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnXorParenthesesLeftMinusWithout", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnXorParenthesesLeftPower", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnXorParenthesesLeftRoot", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnXorParenthesesRightPlusWith", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnXorParenthesesRightPlusWithout", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnXorParenthesesRightMinusWith", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnXorParenthesesRightMinusWithout", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnXorParenthesesRightPower", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnXorParenthesesRightRoot", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnXorCoverageParentheses", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnNot", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnPlus", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnPlusMultiple", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnPlusParentheses", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnPlusUnary", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnMinus", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnMinusParentheses", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnMinusParenthesesPlusWith", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnMinusParenthesesPlusWithout", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnMinusParenthesesDirectUnaryMinus", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnMinusParenthesesIndirectUnaryMinus", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnMinusUnary", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnMinusUnaryParentheses", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnTimes", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnTimesMultiple", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnTimesParentheses", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnTimesParenthesesLeftPlusWith", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnTimesParenthesesLeftPlusWithout", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnTimesParenthesesLeftMinusWith", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnTimesParenthesesLeftMinusWithout", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnTimesParenthesesRightPlusWith", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnTimesParenthesesRightPlusWithout", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnTimesParenthesesRightMinusWith", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnTimesParenthesesRightMinusWithout", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnDivide", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnDivideParentheses", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnDivideParenthesesLeftPlusWith", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnDivideParenthesesLeftPlusWithout", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnDivideParenthesesLeftMinusWith", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnDivideParenthesesLeftMinusWithout", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnDivideParenthesesRightPlusWith", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnDivideParenthesesRightPlusWithout", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnDivideParenthesesRightMinusWith", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnDivideParenthesesRightMinusWithout", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnDivideParenthesesRightTimes", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnDivideParenthesesRightDivide", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnPowerSqrt", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnPowerSqr", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnPowerCube", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnPowerCi", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnPowerParentheses", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnPowerParenthesesLeftPlusWith", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnPowerParenthesesLeftPlusWithout", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnPowerParenthesesLeftMinusWith", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnPowerParenthesesLeftMinusWithout", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnPowerParenthesesLeftTimes", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnPowerParenthesesLeftDivide", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnPowerParenthesesRightPlusWith", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnPowerParenthesesRightPlusWithout", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnPowerParenthesesRightMinusWith", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnPowerParenthesesRightMinusWithout", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnPowerParenthesesRightTimes", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnPowerParenthesesRightDivide", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnPowerParenthesesRightPower", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnPowerParenthesesRightRoot", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnRootSqrt", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnRootSqrtOther", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnRootCube", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnRootCi", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnRootParentheses", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnRootParenthesesLeftPlusWith", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnRootParenthesesLeftPlusWithout", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnRootParenthesesLeftMinusWith", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnRootParenthesesLeftMinusWithout", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnRootParenthesesLeftTimes", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnRootParenthesesLeftDivide", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnRootParenthesesRightPlusWith", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnRootParenthesesRightPlusWithout", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnRootParenthesesRightMinusWith", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnRootParenthesesRightMinusWithout", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnRootParenthesesRightTimes", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnRootParenthesesRightDivide", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnRootParenthesesRightPower", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnRootParenthesesRightRoot", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnAbs", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnExp", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnLn", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnLog", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnLog2", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnLog10", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnLogCi", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnCeiling", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnFloor", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnMin", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnMinMultiple", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnMax", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnMaxMultiple", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnRem", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnSin", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnCos", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnTan", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnSec", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnCsc", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnCot", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnSinh", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnCosh", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnTanh", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnSech", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnCsch", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnCoth", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnArcsin", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnArccos", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnArctan", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnArcsec", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnArccsc", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnArccot", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnArcsinh", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnArccosh", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnArctanh", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnArcsech", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnArccsch", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnArccoth", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnPiecewisePiece", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnPiecewisePieceOtherwise", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnPiecewisePiecePiecePiece", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnPiecewisePiecePiecePieceOtherwise", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnWithPiecewise", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnCnInteger", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnCnDouble", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnCnIntegerWithExponent", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnCnDoubleWithExponent", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnCi", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnTrue", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnFalse", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnExponentiale", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnPi", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnInfinity", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnNotanumber", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnCoverageForPlusOperator", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnCoverageForMinusOperator", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnCoverageForTimesOperator", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnCoverageForDivideOperator", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnCoverageForAndOperator", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnCoverageForOrOperator", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnCoverageForXorOperator", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnCoverageForPowerOperator", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnCoverageForRootOperator", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnCoverageForMinusUnary", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnComputedConstant1", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnComputedConstant2", "dimensionless", "my_component", COMPUTED_CONSTANT} + {"eqnEq", "dimensionless", "my_component"}, + {"eqnEqCoverageParentheses", "dimensionless", "my_component"}, + {"eqnNeq", "dimensionless", "my_component"}, + {"eqnNeqCoverageParentheses", "dimensionless", "my_component"}, + {"eqnLt", "dimensionless", "my_component"}, + {"eqnLtCoverageParentheses", "dimensionless", "my_component"}, + {"eqnLeq", "dimensionless", "my_component"}, + {"eqnLeqCoverageParentheses", "dimensionless", "my_component"}, + {"eqnGt", "dimensionless", "my_component"}, + {"eqnGtCoverageParentheses", "dimensionless", "my_component"}, + {"eqnGeq", "dimensionless", "my_component"}, + {"eqnGeqCoverageParentheses", "dimensionless", "my_component"}, + {"eqnAnd", "dimensionless", "my_component"}, + {"eqnAndMultiple", "dimensionless", "my_component"}, + {"eqnAndParentheses", "dimensionless", "my_component"}, + {"eqnAndParenthesesLeftPlusWith", "dimensionless", "my_component"}, + {"eqnAndParenthesesLeftPlusWithout", "dimensionless", "my_component"}, + {"eqnAndParenthesesLeftMinusWith", "dimensionless", "my_component"}, + {"eqnAndParenthesesLeftMinusWithout", "dimensionless", "my_component"}, + {"eqnAndParenthesesLeftPower", "dimensionless", "my_component"}, + {"eqnAndParenthesesLeftRoot", "dimensionless", "my_component"}, + {"eqnAndParenthesesRightPlusWith", "dimensionless", "my_component"}, + {"eqnAndParenthesesRightPlusWithout", "dimensionless", "my_component"}, + {"eqnAndParenthesesRightMinusWith", "dimensionless", "my_component"}, + {"eqnAndParenthesesRightMinusWithout", "dimensionless", "my_component"}, + {"eqnAndParenthesesRightPower", "dimensionless", "my_component"}, + {"eqnAndParenthesesRightRoot", "dimensionless", "my_component"}, + {"eqnAndCoverageParentheses", "dimensionless", "my_component"}, + {"eqnOr", "dimensionless", "my_component"}, + {"eqnOrMultiple", "dimensionless", "my_component"}, + {"eqnOrParentheses", "dimensionless", "my_component"}, + {"eqnOrParenthesesLeftPlusWith", "dimensionless", "my_component"}, + {"eqnOrParenthesesLeftPlusWithout", "dimensionless", "my_component"}, + {"eqnOrParenthesesLeftMinusWith", "dimensionless", "my_component"}, + {"eqnOrParenthesesLeftMinusWithout", "dimensionless", "my_component"}, + {"eqnOrParenthesesLeftPower", "dimensionless", "my_component"}, + {"eqnOrParenthesesLeftRoot", "dimensionless", "my_component"}, + {"eqnOrParenthesesRightPlusWith", "dimensionless", "my_component"}, + {"eqnOrParenthesesRightPlusWithout", "dimensionless", "my_component"}, + {"eqnOrParenthesesRightMinusWith", "dimensionless", "my_component"}, + {"eqnOrParenthesesRightMinusWithout", "dimensionless", "my_component"}, + {"eqnOrParenthesesRightPower", "dimensionless", "my_component"}, + {"eqnOrParenthesesRightRoot", "dimensionless", "my_component"}, + {"eqnOrCoverageParentheses", "dimensionless", "my_component"}, + {"eqnXor", "dimensionless", "my_component"}, + {"eqnXorMultiple", "dimensionless", "my_component"}, + {"eqnXorParentheses", "dimensionless", "my_component"}, + {"eqnXorParenthesesLeftPlusWith", "dimensionless", "my_component"}, + {"eqnXorParenthesesLeftPlusWithout", "dimensionless", "my_component"}, + {"eqnXorParenthesesLeftMinusWith", "dimensionless", "my_component"}, + {"eqnXorParenthesesLeftMinusWithout", "dimensionless", "my_component"}, + {"eqnXorParenthesesLeftPower", "dimensionless", "my_component"}, + {"eqnXorParenthesesLeftRoot", "dimensionless", "my_component"}, + {"eqnXorParenthesesRightPlusWith", "dimensionless", "my_component"}, + {"eqnXorParenthesesRightPlusWithout", "dimensionless", "my_component"}, + {"eqnXorParenthesesRightMinusWith", "dimensionless", "my_component"}, + {"eqnXorParenthesesRightMinusWithout", "dimensionless", "my_component"}, + {"eqnXorParenthesesRightPower", "dimensionless", "my_component"}, + {"eqnXorParenthesesRightRoot", "dimensionless", "my_component"}, + {"eqnXorCoverageParentheses", "dimensionless", "my_component"}, + {"eqnNot", "dimensionless", "my_component"}, + {"eqnPlus", "dimensionless", "my_component"}, + {"eqnPlusMultiple", "dimensionless", "my_component"}, + {"eqnPlusParentheses", "dimensionless", "my_component"}, + {"eqnPlusUnary", "dimensionless", "my_component"}, + {"eqnMinus", "dimensionless", "my_component"}, + {"eqnMinusParentheses", "dimensionless", "my_component"}, + {"eqnMinusParenthesesPlusWith", "dimensionless", "my_component"}, + {"eqnMinusParenthesesPlusWithout", "dimensionless", "my_component"}, + {"eqnMinusParenthesesDirectUnaryMinus", "dimensionless", "my_component"}, + {"eqnMinusParenthesesIndirectUnaryMinus", "dimensionless", "my_component"}, + {"eqnMinusUnary", "dimensionless", "my_component"}, + {"eqnMinusUnaryParentheses", "dimensionless", "my_component"}, + {"eqnTimes", "dimensionless", "my_component"}, + {"eqnTimesMultiple", "dimensionless", "my_component"}, + {"eqnTimesParentheses", "dimensionless", "my_component"}, + {"eqnTimesParenthesesLeftPlusWith", "dimensionless", "my_component"}, + {"eqnTimesParenthesesLeftPlusWithout", "dimensionless", "my_component"}, + {"eqnTimesParenthesesLeftMinusWith", "dimensionless", "my_component"}, + {"eqnTimesParenthesesLeftMinusWithout", "dimensionless", "my_component"}, + {"eqnTimesParenthesesRightPlusWith", "dimensionless", "my_component"}, + {"eqnTimesParenthesesRightPlusWithout", "dimensionless", "my_component"}, + {"eqnTimesParenthesesRightMinusWith", "dimensionless", "my_component"}, + {"eqnTimesParenthesesRightMinusWithout", "dimensionless", "my_component"}, + {"eqnDivide", "dimensionless", "my_component"}, + {"eqnDivideParentheses", "dimensionless", "my_component"}, + {"eqnDivideParenthesesLeftPlusWith", "dimensionless", "my_component"}, + {"eqnDivideParenthesesLeftPlusWithout", "dimensionless", "my_component"}, + {"eqnDivideParenthesesLeftMinusWith", "dimensionless", "my_component"}, + {"eqnDivideParenthesesLeftMinusWithout", "dimensionless", "my_component"}, + {"eqnDivideParenthesesRightPlusWith", "dimensionless", "my_component"}, + {"eqnDivideParenthesesRightPlusWithout", "dimensionless", "my_component"}, + {"eqnDivideParenthesesRightMinusWith", "dimensionless", "my_component"}, + {"eqnDivideParenthesesRightMinusWithout", "dimensionless", "my_component"}, + {"eqnDivideParenthesesRightTimes", "dimensionless", "my_component"}, + {"eqnDivideParenthesesRightDivide", "dimensionless", "my_component"}, + {"eqnPowerSqrt", "dimensionless", "my_component"}, + {"eqnPowerSqr", "dimensionless", "my_component"}, + {"eqnPowerCube", "dimensionless", "my_component"}, + {"eqnPowerCi", "dimensionless", "my_component"}, + {"eqnPowerParentheses", "dimensionless", "my_component"}, + {"eqnPowerParenthesesLeftPlusWith", "dimensionless", "my_component"}, + {"eqnPowerParenthesesLeftPlusWithout", "dimensionless", "my_component"}, + {"eqnPowerParenthesesLeftMinusWith", "dimensionless", "my_component"}, + {"eqnPowerParenthesesLeftMinusWithout", "dimensionless", "my_component"}, + {"eqnPowerParenthesesLeftTimes", "dimensionless", "my_component"}, + {"eqnPowerParenthesesLeftDivide", "dimensionless", "my_component"}, + {"eqnPowerParenthesesRightPlusWith", "dimensionless", "my_component"}, + {"eqnPowerParenthesesRightPlusWithout", "dimensionless", "my_component"}, + {"eqnPowerParenthesesRightMinusWith", "dimensionless", "my_component"}, + {"eqnPowerParenthesesRightMinusWithout", "dimensionless", "my_component"}, + {"eqnPowerParenthesesRightTimes", "dimensionless", "my_component"}, + {"eqnPowerParenthesesRightDivide", "dimensionless", "my_component"}, + {"eqnPowerParenthesesRightPower", "dimensionless", "my_component"}, + {"eqnPowerParenthesesRightRoot", "dimensionless", "my_component"}, + {"eqnRootSqrt", "dimensionless", "my_component"}, + {"eqnRootSqrtOther", "dimensionless", "my_component"}, + {"eqnRootCube", "dimensionless", "my_component"}, + {"eqnRootCi", "dimensionless", "my_component"}, + {"eqnRootParentheses", "dimensionless", "my_component"}, + {"eqnRootParenthesesLeftPlusWith", "dimensionless", "my_component"}, + {"eqnRootParenthesesLeftPlusWithout", "dimensionless", "my_component"}, + {"eqnRootParenthesesLeftMinusWith", "dimensionless", "my_component"}, + {"eqnRootParenthesesLeftMinusWithout", "dimensionless", "my_component"}, + {"eqnRootParenthesesLeftTimes", "dimensionless", "my_component"}, + {"eqnRootParenthesesLeftDivide", "dimensionless", "my_component"}, + {"eqnRootParenthesesRightPlusWith", "dimensionless", "my_component"}, + {"eqnRootParenthesesRightPlusWithout", "dimensionless", "my_component"}, + {"eqnRootParenthesesRightMinusWith", "dimensionless", "my_component"}, + {"eqnRootParenthesesRightMinusWithout", "dimensionless", "my_component"}, + {"eqnRootParenthesesRightTimes", "dimensionless", "my_component"}, + {"eqnRootParenthesesRightDivide", "dimensionless", "my_component"}, + {"eqnRootParenthesesRightPower", "dimensionless", "my_component"}, + {"eqnRootParenthesesRightRoot", "dimensionless", "my_component"}, + {"eqnAbs", "dimensionless", "my_component"}, + {"eqnExp", "dimensionless", "my_component"}, + {"eqnLn", "dimensionless", "my_component"}, + {"eqnLog", "dimensionless", "my_component"}, + {"eqnLog2", "dimensionless", "my_component"}, + {"eqnLog10", "dimensionless", "my_component"}, + {"eqnLogCi", "dimensionless", "my_component"}, + {"eqnCeiling", "dimensionless", "my_component"}, + {"eqnFloor", "dimensionless", "my_component"}, + {"eqnMin", "dimensionless", "my_component"}, + {"eqnMinMultiple", "dimensionless", "my_component"}, + {"eqnMax", "dimensionless", "my_component"}, + {"eqnMaxMultiple", "dimensionless", "my_component"}, + {"eqnRem", "dimensionless", "my_component"}, + {"eqnSin", "dimensionless", "my_component"}, + {"eqnCos", "dimensionless", "my_component"}, + {"eqnTan", "dimensionless", "my_component"}, + {"eqnSec", "dimensionless", "my_component"}, + {"eqnCsc", "dimensionless", "my_component"}, + {"eqnCot", "dimensionless", "my_component"}, + {"eqnSinh", "dimensionless", "my_component"}, + {"eqnCosh", "dimensionless", "my_component"}, + {"eqnTanh", "dimensionless", "my_component"}, + {"eqnSech", "dimensionless", "my_component"}, + {"eqnCsch", "dimensionless", "my_component"}, + {"eqnCoth", "dimensionless", "my_component"}, + {"eqnArcsin", "dimensionless", "my_component"}, + {"eqnArccos", "dimensionless", "my_component"}, + {"eqnArctan", "dimensionless", "my_component"}, + {"eqnArcsec", "dimensionless", "my_component"}, + {"eqnArccsc", "dimensionless", "my_component"}, + {"eqnArccot", "dimensionless", "my_component"}, + {"eqnArcsinh", "dimensionless", "my_component"}, + {"eqnArccosh", "dimensionless", "my_component"}, + {"eqnArctanh", "dimensionless", "my_component"}, + {"eqnArcsech", "dimensionless", "my_component"}, + {"eqnArccsch", "dimensionless", "my_component"}, + {"eqnArccoth", "dimensionless", "my_component"}, + {"eqnPiecewisePiece", "dimensionless", "my_component"}, + {"eqnPiecewisePieceOtherwise", "dimensionless", "my_component"}, + {"eqnPiecewisePiecePiecePiece", "dimensionless", "my_component"}, + {"eqnPiecewisePiecePiecePieceOtherwise", "dimensionless", "my_component"}, + {"eqnWithPiecewise", "dimensionless", "my_component"}, + {"eqnCnInteger", "dimensionless", "my_component"}, + {"eqnCnDouble", "dimensionless", "my_component"}, + {"eqnCnIntegerWithExponent", "dimensionless", "my_component"}, + {"eqnCnDoubleWithExponent", "dimensionless", "my_component"}, + {"eqnCi", "dimensionless", "my_component"}, + {"eqnTrue", "dimensionless", "my_component"}, + {"eqnFalse", "dimensionless", "my_component"}, + {"eqnExponentiale", "dimensionless", "my_component"}, + {"eqnPi", "dimensionless", "my_component"}, + {"eqnInfinity", "dimensionless", "my_component"}, + {"eqnNotanumber", "dimensionless", "my_component"}, + {"eqnCoverageForPlusOperator", "dimensionless", "my_component"}, + {"eqnCoverageForMinusOperator", "dimensionless", "my_component"}, + {"eqnCoverageForTimesOperator", "dimensionless", "my_component"}, + {"eqnCoverageForDivideOperator", "dimensionless", "my_component"}, + {"eqnCoverageForAndOperator", "dimensionless", "my_component"}, + {"eqnCoverageForOrOperator", "dimensionless", "my_component"}, + {"eqnCoverageForXorOperator", "dimensionless", "my_component"}, + {"eqnCoverageForPowerOperator", "dimensionless", "my_component"}, + {"eqnCoverageForRootOperator", "dimensionless", "my_component"}, + {"eqnCoverageForMinusUnary", "dimensionless", "my_component"}, + {"eqnComputedConstant1", "dimensionless", "my_component"}, + {"eqnComputedConstant2", "dimensionless", "my_component"} }; const VariableInfo ALGEBRAIC_INFO[] = { - {"eqnNlaVariable1", "dimensionless", "my_component", ALGEBRAIC}, - {"eqnNlaVariable2", "dimensionless", "my_component", ALGEBRAIC} + {"eqnNlaVariable1", "dimensionless", "my_component"}, + {"eqnNlaVariable2", "dimensionless", "my_component"} }; double xor(double x, double y) diff --git a/tests/resources/coverage/generator/model.h b/tests/resources/coverage/generator/model.h index 07d230338b..f394f95039 100644 --- a/tests/resources/coverage/generator/model.h +++ b/tests/resources/coverage/generator/model.h @@ -12,19 +12,10 @@ extern const size_t CONSTANT_COUNT; extern const size_t COMPUTED_CONSTANT_COUNT; extern const size_t ALGEBRAIC_COUNT; -typedef enum { - VARIABLE_OF_INTEGRATION, - STATE, - CONSTANT, - COMPUTED_CONSTANT, - ALGEBRAIC -} VariableType; - typedef struct { char name[38]; char units[14]; char component[13]; - VariableType type; } VariableInfo; extern const VariableInfo VOI_INFO; diff --git a/tests/resources/coverage/generator/model.modified.profile.c b/tests/resources/coverage/generator/model.modified.profile.c index b81232df93..d63bb27d2b 100644 --- a/tests/resources/coverage/generator/model.modified.profile.c +++ b/tests/resources/coverage/generator/model.modified.profile.c @@ -13,228 +13,228 @@ const size_t CONSTANT_COUNT = 7; const size_t COMPUTED_CONSTANT_COUNT = 200; const size_t ALGEBRAIC_COUNT = 2; -const VariableInfo VOI_INFO = {"t", "second", "my_component", VARIABLE_OF_INTEGRATION}; +const VariableInfo VOI_INFO = {"t", "second", "my_component"}; const VariableInfo STATE_INFO[] = { - {"x", "dimensionless", "my_component", STATE} + {"x", "dimensionless", "my_component"} }; const VariableInfo CONSTANT_INFO[] = { - {"m", "dimensionless", "my_component", CONSTANT}, - {"n", "dimensionless", "my_component", CONSTANT}, - {"o", "dimensionless", "my_component", CONSTANT}, - {"p", "dimensionless", "my_component", CONSTANT}, - {"q", "dimensionless", "my_component", CONSTANT}, - {"r", "dimensionless", "my_component", CONSTANT}, - {"s", "dimensionless", "my_component", CONSTANT} + {"m", "dimensionless", "my_component"}, + {"n", "dimensionless", "my_component"}, + {"o", "dimensionless", "my_component"}, + {"p", "dimensionless", "my_component"}, + {"q", "dimensionless", "my_component"}, + {"r", "dimensionless", "my_component"}, + {"s", "dimensionless", "my_component"} }; const VariableInfo COMPUTED_CONSTANT_INFO[] = { - {"eqnEq", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnEqCoverageParentheses", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnNeq", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnNeqCoverageParentheses", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnLt", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnLtCoverageParentheses", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnLeq", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnLeqCoverageParentheses", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnGt", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnGtCoverageParentheses", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnGeq", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnGeqCoverageParentheses", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnAnd", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnAndMultiple", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnAndParentheses", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnAndParenthesesLeftPlusWith", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnAndParenthesesLeftPlusWithout", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnAndParenthesesLeftMinusWith", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnAndParenthesesLeftMinusWithout", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnAndParenthesesLeftPower", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnAndParenthesesLeftRoot", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnAndParenthesesRightPlusWith", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnAndParenthesesRightPlusWithout", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnAndParenthesesRightMinusWith", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnAndParenthesesRightMinusWithout", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnAndParenthesesRightPower", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnAndParenthesesRightRoot", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnAndCoverageParentheses", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnOr", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnOrMultiple", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnOrParentheses", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnOrParenthesesLeftPlusWith", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnOrParenthesesLeftPlusWithout", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnOrParenthesesLeftMinusWith", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnOrParenthesesLeftMinusWithout", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnOrParenthesesLeftPower", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnOrParenthesesLeftRoot", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnOrParenthesesRightPlusWith", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnOrParenthesesRightPlusWithout", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnOrParenthesesRightMinusWith", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnOrParenthesesRightMinusWithout", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnOrParenthesesRightPower", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnOrParenthesesRightRoot", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnOrCoverageParentheses", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnXor", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnXorMultiple", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnXorParentheses", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnXorParenthesesLeftPlusWith", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnXorParenthesesLeftPlusWithout", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnXorParenthesesLeftMinusWith", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnXorParenthesesLeftMinusWithout", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnXorParenthesesLeftPower", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnXorParenthesesLeftRoot", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnXorParenthesesRightPlusWith", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnXorParenthesesRightPlusWithout", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnXorParenthesesRightMinusWith", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnXorParenthesesRightMinusWithout", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnXorParenthesesRightPower", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnXorParenthesesRightRoot", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnXorCoverageParentheses", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnNot", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnPlus", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnPlusMultiple", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnPlusParentheses", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnPlusUnary", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnMinus", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnMinusParentheses", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnMinusParenthesesPlusWith", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnMinusParenthesesPlusWithout", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnMinusParenthesesDirectUnaryMinus", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnMinusParenthesesIndirectUnaryMinus", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnMinusUnary", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnMinusUnaryParentheses", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnTimes", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnTimesMultiple", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnTimesParentheses", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnTimesParenthesesLeftPlusWith", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnTimesParenthesesLeftPlusWithout", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnTimesParenthesesLeftMinusWith", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnTimesParenthesesLeftMinusWithout", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnTimesParenthesesRightPlusWith", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnTimesParenthesesRightPlusWithout", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnTimesParenthesesRightMinusWith", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnTimesParenthesesRightMinusWithout", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnDivide", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnDivideParentheses", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnDivideParenthesesLeftPlusWith", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnDivideParenthesesLeftPlusWithout", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnDivideParenthesesLeftMinusWith", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnDivideParenthesesLeftMinusWithout", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnDivideParenthesesRightPlusWith", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnDivideParenthesesRightPlusWithout", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnDivideParenthesesRightMinusWith", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnDivideParenthesesRightMinusWithout", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnDivideParenthesesRightTimes", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnDivideParenthesesRightDivide", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnPowerSqrt", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnPowerSqr", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnPowerCube", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnPowerCi", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnPowerParentheses", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnPowerParenthesesLeftPlusWith", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnPowerParenthesesLeftPlusWithout", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnPowerParenthesesLeftMinusWith", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnPowerParenthesesLeftMinusWithout", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnPowerParenthesesLeftTimes", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnPowerParenthesesLeftDivide", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnPowerParenthesesRightPlusWith", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnPowerParenthesesRightPlusWithout", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnPowerParenthesesRightMinusWith", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnPowerParenthesesRightMinusWithout", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnPowerParenthesesRightTimes", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnPowerParenthesesRightDivide", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnPowerParenthesesRightPower", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnPowerParenthesesRightRoot", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnRootSqrt", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnRootSqrtOther", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnRootCube", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnRootCi", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnRootParentheses", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnRootParenthesesLeftPlusWith", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnRootParenthesesLeftPlusWithout", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnRootParenthesesLeftMinusWith", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnRootParenthesesLeftMinusWithout", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnRootParenthesesLeftTimes", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnRootParenthesesLeftDivide", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnRootParenthesesRightPlusWith", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnRootParenthesesRightPlusWithout", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnRootParenthesesRightMinusWith", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnRootParenthesesRightMinusWithout", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnRootParenthesesRightTimes", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnRootParenthesesRightDivide", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnRootParenthesesRightPower", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnRootParenthesesRightRoot", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnAbs", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnExp", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnLn", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnLog", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnLog2", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnLog10", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnLogCi", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnCeiling", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnFloor", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnMin", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnMinMultiple", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnMax", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnMaxMultiple", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnRem", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnSin", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnCos", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnTan", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnSec", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnCsc", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnCot", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnSinh", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnCosh", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnTanh", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnSech", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnCsch", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnCoth", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnArcsin", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnArccos", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnArctan", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnArcsec", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnArccsc", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnArccot", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnArcsinh", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnArccosh", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnArctanh", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnArcsech", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnArccsch", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnArccoth", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnPiecewisePiece", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnPiecewisePieceOtherwise", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnPiecewisePiecePiecePiece", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnPiecewisePiecePiecePieceOtherwise", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnWithPiecewise", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnCnInteger", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnCnDouble", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnCnIntegerWithExponent", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnCnDoubleWithExponent", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnCi", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnTrue", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnFalse", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnExponentiale", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnPi", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnInfinity", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnNotanumber", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnCoverageForPlusOperator", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnCoverageForMinusOperator", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnCoverageForTimesOperator", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnCoverageForDivideOperator", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnCoverageForAndOperator", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnCoverageForOrOperator", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnCoverageForXorOperator", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnCoverageForPowerOperator", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnCoverageForRootOperator", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnCoverageForMinusUnary", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnComputedConstant1", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"eqnComputedConstant2", "dimensionless", "my_component", COMPUTED_CONSTANT} + {"eqnEq", "dimensionless", "my_component"}, + {"eqnEqCoverageParentheses", "dimensionless", "my_component"}, + {"eqnNeq", "dimensionless", "my_component"}, + {"eqnNeqCoverageParentheses", "dimensionless", "my_component"}, + {"eqnLt", "dimensionless", "my_component"}, + {"eqnLtCoverageParentheses", "dimensionless", "my_component"}, + {"eqnLeq", "dimensionless", "my_component"}, + {"eqnLeqCoverageParentheses", "dimensionless", "my_component"}, + {"eqnGt", "dimensionless", "my_component"}, + {"eqnGtCoverageParentheses", "dimensionless", "my_component"}, + {"eqnGeq", "dimensionless", "my_component"}, + {"eqnGeqCoverageParentheses", "dimensionless", "my_component"}, + {"eqnAnd", "dimensionless", "my_component"}, + {"eqnAndMultiple", "dimensionless", "my_component"}, + {"eqnAndParentheses", "dimensionless", "my_component"}, + {"eqnAndParenthesesLeftPlusWith", "dimensionless", "my_component"}, + {"eqnAndParenthesesLeftPlusWithout", "dimensionless", "my_component"}, + {"eqnAndParenthesesLeftMinusWith", "dimensionless", "my_component"}, + {"eqnAndParenthesesLeftMinusWithout", "dimensionless", "my_component"}, + {"eqnAndParenthesesLeftPower", "dimensionless", "my_component"}, + {"eqnAndParenthesesLeftRoot", "dimensionless", "my_component"}, + {"eqnAndParenthesesRightPlusWith", "dimensionless", "my_component"}, + {"eqnAndParenthesesRightPlusWithout", "dimensionless", "my_component"}, + {"eqnAndParenthesesRightMinusWith", "dimensionless", "my_component"}, + {"eqnAndParenthesesRightMinusWithout", "dimensionless", "my_component"}, + {"eqnAndParenthesesRightPower", "dimensionless", "my_component"}, + {"eqnAndParenthesesRightRoot", "dimensionless", "my_component"}, + {"eqnAndCoverageParentheses", "dimensionless", "my_component"}, + {"eqnOr", "dimensionless", "my_component"}, + {"eqnOrMultiple", "dimensionless", "my_component"}, + {"eqnOrParentheses", "dimensionless", "my_component"}, + {"eqnOrParenthesesLeftPlusWith", "dimensionless", "my_component"}, + {"eqnOrParenthesesLeftPlusWithout", "dimensionless", "my_component"}, + {"eqnOrParenthesesLeftMinusWith", "dimensionless", "my_component"}, + {"eqnOrParenthesesLeftMinusWithout", "dimensionless", "my_component"}, + {"eqnOrParenthesesLeftPower", "dimensionless", "my_component"}, + {"eqnOrParenthesesLeftRoot", "dimensionless", "my_component"}, + {"eqnOrParenthesesRightPlusWith", "dimensionless", "my_component"}, + {"eqnOrParenthesesRightPlusWithout", "dimensionless", "my_component"}, + {"eqnOrParenthesesRightMinusWith", "dimensionless", "my_component"}, + {"eqnOrParenthesesRightMinusWithout", "dimensionless", "my_component"}, + {"eqnOrParenthesesRightPower", "dimensionless", "my_component"}, + {"eqnOrParenthesesRightRoot", "dimensionless", "my_component"}, + {"eqnOrCoverageParentheses", "dimensionless", "my_component"}, + {"eqnXor", "dimensionless", "my_component"}, + {"eqnXorMultiple", "dimensionless", "my_component"}, + {"eqnXorParentheses", "dimensionless", "my_component"}, + {"eqnXorParenthesesLeftPlusWith", "dimensionless", "my_component"}, + {"eqnXorParenthesesLeftPlusWithout", "dimensionless", "my_component"}, + {"eqnXorParenthesesLeftMinusWith", "dimensionless", "my_component"}, + {"eqnXorParenthesesLeftMinusWithout", "dimensionless", "my_component"}, + {"eqnXorParenthesesLeftPower", "dimensionless", "my_component"}, + {"eqnXorParenthesesLeftRoot", "dimensionless", "my_component"}, + {"eqnXorParenthesesRightPlusWith", "dimensionless", "my_component"}, + {"eqnXorParenthesesRightPlusWithout", "dimensionless", "my_component"}, + {"eqnXorParenthesesRightMinusWith", "dimensionless", "my_component"}, + {"eqnXorParenthesesRightMinusWithout", "dimensionless", "my_component"}, + {"eqnXorParenthesesRightPower", "dimensionless", "my_component"}, + {"eqnXorParenthesesRightRoot", "dimensionless", "my_component"}, + {"eqnXorCoverageParentheses", "dimensionless", "my_component"}, + {"eqnNot", "dimensionless", "my_component"}, + {"eqnPlus", "dimensionless", "my_component"}, + {"eqnPlusMultiple", "dimensionless", "my_component"}, + {"eqnPlusParentheses", "dimensionless", "my_component"}, + {"eqnPlusUnary", "dimensionless", "my_component"}, + {"eqnMinus", "dimensionless", "my_component"}, + {"eqnMinusParentheses", "dimensionless", "my_component"}, + {"eqnMinusParenthesesPlusWith", "dimensionless", "my_component"}, + {"eqnMinusParenthesesPlusWithout", "dimensionless", "my_component"}, + {"eqnMinusParenthesesDirectUnaryMinus", "dimensionless", "my_component"}, + {"eqnMinusParenthesesIndirectUnaryMinus", "dimensionless", "my_component"}, + {"eqnMinusUnary", "dimensionless", "my_component"}, + {"eqnMinusUnaryParentheses", "dimensionless", "my_component"}, + {"eqnTimes", "dimensionless", "my_component"}, + {"eqnTimesMultiple", "dimensionless", "my_component"}, + {"eqnTimesParentheses", "dimensionless", "my_component"}, + {"eqnTimesParenthesesLeftPlusWith", "dimensionless", "my_component"}, + {"eqnTimesParenthesesLeftPlusWithout", "dimensionless", "my_component"}, + {"eqnTimesParenthesesLeftMinusWith", "dimensionless", "my_component"}, + {"eqnTimesParenthesesLeftMinusWithout", "dimensionless", "my_component"}, + {"eqnTimesParenthesesRightPlusWith", "dimensionless", "my_component"}, + {"eqnTimesParenthesesRightPlusWithout", "dimensionless", "my_component"}, + {"eqnTimesParenthesesRightMinusWith", "dimensionless", "my_component"}, + {"eqnTimesParenthesesRightMinusWithout", "dimensionless", "my_component"}, + {"eqnDivide", "dimensionless", "my_component"}, + {"eqnDivideParentheses", "dimensionless", "my_component"}, + {"eqnDivideParenthesesLeftPlusWith", "dimensionless", "my_component"}, + {"eqnDivideParenthesesLeftPlusWithout", "dimensionless", "my_component"}, + {"eqnDivideParenthesesLeftMinusWith", "dimensionless", "my_component"}, + {"eqnDivideParenthesesLeftMinusWithout", "dimensionless", "my_component"}, + {"eqnDivideParenthesesRightPlusWith", "dimensionless", "my_component"}, + {"eqnDivideParenthesesRightPlusWithout", "dimensionless", "my_component"}, + {"eqnDivideParenthesesRightMinusWith", "dimensionless", "my_component"}, + {"eqnDivideParenthesesRightMinusWithout", "dimensionless", "my_component"}, + {"eqnDivideParenthesesRightTimes", "dimensionless", "my_component"}, + {"eqnDivideParenthesesRightDivide", "dimensionless", "my_component"}, + {"eqnPowerSqrt", "dimensionless", "my_component"}, + {"eqnPowerSqr", "dimensionless", "my_component"}, + {"eqnPowerCube", "dimensionless", "my_component"}, + {"eqnPowerCi", "dimensionless", "my_component"}, + {"eqnPowerParentheses", "dimensionless", "my_component"}, + {"eqnPowerParenthesesLeftPlusWith", "dimensionless", "my_component"}, + {"eqnPowerParenthesesLeftPlusWithout", "dimensionless", "my_component"}, + {"eqnPowerParenthesesLeftMinusWith", "dimensionless", "my_component"}, + {"eqnPowerParenthesesLeftMinusWithout", "dimensionless", "my_component"}, + {"eqnPowerParenthesesLeftTimes", "dimensionless", "my_component"}, + {"eqnPowerParenthesesLeftDivide", "dimensionless", "my_component"}, + {"eqnPowerParenthesesRightPlusWith", "dimensionless", "my_component"}, + {"eqnPowerParenthesesRightPlusWithout", "dimensionless", "my_component"}, + {"eqnPowerParenthesesRightMinusWith", "dimensionless", "my_component"}, + {"eqnPowerParenthesesRightMinusWithout", "dimensionless", "my_component"}, + {"eqnPowerParenthesesRightTimes", "dimensionless", "my_component"}, + {"eqnPowerParenthesesRightDivide", "dimensionless", "my_component"}, + {"eqnPowerParenthesesRightPower", "dimensionless", "my_component"}, + {"eqnPowerParenthesesRightRoot", "dimensionless", "my_component"}, + {"eqnRootSqrt", "dimensionless", "my_component"}, + {"eqnRootSqrtOther", "dimensionless", "my_component"}, + {"eqnRootCube", "dimensionless", "my_component"}, + {"eqnRootCi", "dimensionless", "my_component"}, + {"eqnRootParentheses", "dimensionless", "my_component"}, + {"eqnRootParenthesesLeftPlusWith", "dimensionless", "my_component"}, + {"eqnRootParenthesesLeftPlusWithout", "dimensionless", "my_component"}, + {"eqnRootParenthesesLeftMinusWith", "dimensionless", "my_component"}, + {"eqnRootParenthesesLeftMinusWithout", "dimensionless", "my_component"}, + {"eqnRootParenthesesLeftTimes", "dimensionless", "my_component"}, + {"eqnRootParenthesesLeftDivide", "dimensionless", "my_component"}, + {"eqnRootParenthesesRightPlusWith", "dimensionless", "my_component"}, + {"eqnRootParenthesesRightPlusWithout", "dimensionless", "my_component"}, + {"eqnRootParenthesesRightMinusWith", "dimensionless", "my_component"}, + {"eqnRootParenthesesRightMinusWithout", "dimensionless", "my_component"}, + {"eqnRootParenthesesRightTimes", "dimensionless", "my_component"}, + {"eqnRootParenthesesRightDivide", "dimensionless", "my_component"}, + {"eqnRootParenthesesRightPower", "dimensionless", "my_component"}, + {"eqnRootParenthesesRightRoot", "dimensionless", "my_component"}, + {"eqnAbs", "dimensionless", "my_component"}, + {"eqnExp", "dimensionless", "my_component"}, + {"eqnLn", "dimensionless", "my_component"}, + {"eqnLog", "dimensionless", "my_component"}, + {"eqnLog2", "dimensionless", "my_component"}, + {"eqnLog10", "dimensionless", "my_component"}, + {"eqnLogCi", "dimensionless", "my_component"}, + {"eqnCeiling", "dimensionless", "my_component"}, + {"eqnFloor", "dimensionless", "my_component"}, + {"eqnMin", "dimensionless", "my_component"}, + {"eqnMinMultiple", "dimensionless", "my_component"}, + {"eqnMax", "dimensionless", "my_component"}, + {"eqnMaxMultiple", "dimensionless", "my_component"}, + {"eqnRem", "dimensionless", "my_component"}, + {"eqnSin", "dimensionless", "my_component"}, + {"eqnCos", "dimensionless", "my_component"}, + {"eqnTan", "dimensionless", "my_component"}, + {"eqnSec", "dimensionless", "my_component"}, + {"eqnCsc", "dimensionless", "my_component"}, + {"eqnCot", "dimensionless", "my_component"}, + {"eqnSinh", "dimensionless", "my_component"}, + {"eqnCosh", "dimensionless", "my_component"}, + {"eqnTanh", "dimensionless", "my_component"}, + {"eqnSech", "dimensionless", "my_component"}, + {"eqnCsch", "dimensionless", "my_component"}, + {"eqnCoth", "dimensionless", "my_component"}, + {"eqnArcsin", "dimensionless", "my_component"}, + {"eqnArccos", "dimensionless", "my_component"}, + {"eqnArctan", "dimensionless", "my_component"}, + {"eqnArcsec", "dimensionless", "my_component"}, + {"eqnArccsc", "dimensionless", "my_component"}, + {"eqnArccot", "dimensionless", "my_component"}, + {"eqnArcsinh", "dimensionless", "my_component"}, + {"eqnArccosh", "dimensionless", "my_component"}, + {"eqnArctanh", "dimensionless", "my_component"}, + {"eqnArcsech", "dimensionless", "my_component"}, + {"eqnArccsch", "dimensionless", "my_component"}, + {"eqnArccoth", "dimensionless", "my_component"}, + {"eqnPiecewisePiece", "dimensionless", "my_component"}, + {"eqnPiecewisePieceOtherwise", "dimensionless", "my_component"}, + {"eqnPiecewisePiecePiecePiece", "dimensionless", "my_component"}, + {"eqnPiecewisePiecePiecePieceOtherwise", "dimensionless", "my_component"}, + {"eqnWithPiecewise", "dimensionless", "my_component"}, + {"eqnCnInteger", "dimensionless", "my_component"}, + {"eqnCnDouble", "dimensionless", "my_component"}, + {"eqnCnIntegerWithExponent", "dimensionless", "my_component"}, + {"eqnCnDoubleWithExponent", "dimensionless", "my_component"}, + {"eqnCi", "dimensionless", "my_component"}, + {"eqnTrue", "dimensionless", "my_component"}, + {"eqnFalse", "dimensionless", "my_component"}, + {"eqnExponentiale", "dimensionless", "my_component"}, + {"eqnPi", "dimensionless", "my_component"}, + {"eqnInfinity", "dimensionless", "my_component"}, + {"eqnNotanumber", "dimensionless", "my_component"}, + {"eqnCoverageForPlusOperator", "dimensionless", "my_component"}, + {"eqnCoverageForMinusOperator", "dimensionless", "my_component"}, + {"eqnCoverageForTimesOperator", "dimensionless", "my_component"}, + {"eqnCoverageForDivideOperator", "dimensionless", "my_component"}, + {"eqnCoverageForAndOperator", "dimensionless", "my_component"}, + {"eqnCoverageForOrOperator", "dimensionless", "my_component"}, + {"eqnCoverageForXorOperator", "dimensionless", "my_component"}, + {"eqnCoverageForPowerOperator", "dimensionless", "my_component"}, + {"eqnCoverageForRootOperator", "dimensionless", "my_component"}, + {"eqnCoverageForMinusUnary", "dimensionless", "my_component"}, + {"eqnComputedConstant1", "dimensionless", "my_component"}, + {"eqnComputedConstant2", "dimensionless", "my_component"} }; const VariableInfo ALGEBRAIC_INFO[] = { - {"eqnNlaVariable1", "dimensionless", "my_component", ALGEBRAIC}, - {"eqnNlaVariable2", "dimensionless", "my_component", ALGEBRAIC} + {"eqnNlaVariable1", "dimensionless", "my_component"}, + {"eqnNlaVariable2", "dimensionless", "my_component"} }; double xor(double x, double y) diff --git a/tests/resources/coverage/generator/model.modified.profile.h b/tests/resources/coverage/generator/model.modified.profile.h index 7bb7462bec..fb41e8e19d 100644 --- a/tests/resources/coverage/generator/model.modified.profile.h +++ b/tests/resources/coverage/generator/model.modified.profile.h @@ -12,19 +12,10 @@ extern const size_t CONSTANT_COUNT; extern const size_t COMPUTED_CONSTANT_COUNT; extern const size_t ALGEBRAIC_COUNT; -typedef enum { - VARIABLE_OF_INTEGRATION, - STATE, - CONSTANT, - COMPUTED_CONSTANT, - ALGEBRAIC -} VariableType; - typedef struct { char name[38]; char units[14]; char component[13]; - VariableType type; } VariableInfo; extern const VariableInfo VOI_INFO; diff --git a/tests/resources/coverage/generator/model.modified.profile.py b/tests/resources/coverage/generator/model.modified.profile.py index c7b36b99de..450b761364 100644 --- a/tests/resources/coverage/generator/model.modified.profile.py +++ b/tests/resources/coverage/generator/model.modified.profile.py @@ -12,236 +12,227 @@ COMPUTED_CONSTANT_COUNT = 200 ALGEBRAIC_COUNT = 2 +VOI_INFO = {"name": "t", "units": "second", "component": "my_component"} -class VariableType(Enum): - VARIABLE_OF_INTEGRATION = 0 - STATE = 1 - CONSTANT = 2 - COMPUTED_CONSTANT = 3 - ALGEBRAIC = 4 - - -VOI_INFO = {"name": "t", "units": "second", "component": "my_component", "type": VariableType.VARIABLE_OF_INTEGRATION} - -STATE_INFO = {"name": "x", "units": "dimensionless", "component": "my_component", "type": VariableType.STATE} +STATE_INFO = {"name": "x", "units": "dimensionless", "component": "my_component"} CONSTANT_INFO = [ - {"name": "m", "units": "dimensionless", "component": "my_component", "type": VariableType.CONSTANT}, - {"name": "n", "units": "dimensionless", "component": "my_component", "type": VariableType.CONSTANT}, - {"name": "o", "units": "dimensionless", "component": "my_component", "type": VariableType.CONSTANT}, - {"name": "p", "units": "dimensionless", "component": "my_component", "type": VariableType.CONSTANT}, - {"name": "q", "units": "dimensionless", "component": "my_component", "type": VariableType.CONSTANT}, - {"name": "r", "units": "dimensionless", "component": "my_component", "type": VariableType.CONSTANT}, - {"name": "s", "units": "dimensionless", "component": "my_component", "type": VariableType.CONSTANT} + {"name": "m", "units": "dimensionless", "component": "my_component"}, + {"name": "n", "units": "dimensionless", "component": "my_component"}, + {"name": "o", "units": "dimensionless", "component": "my_component"}, + {"name": "p", "units": "dimensionless", "component": "my_component"}, + {"name": "q", "units": "dimensionless", "component": "my_component"}, + {"name": "r", "units": "dimensionless", "component": "my_component"}, + {"name": "s", "units": "dimensionless", "component": "my_component"} ] COMPUTED_CONSTANT_INFO = [ - {"name": "eqnEq", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnEqCoverageParentheses", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnNeq", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnNeqCoverageParentheses", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnLt", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnLtCoverageParentheses", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnLeq", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnLeqCoverageParentheses", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnGt", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnGtCoverageParentheses", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnGeq", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnGeqCoverageParentheses", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnAnd", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnAndMultiple", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnAndParentheses", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnAndParenthesesLeftPlusWith", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnAndParenthesesLeftPlusWithout", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnAndParenthesesLeftMinusWith", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnAndParenthesesLeftMinusWithout", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnAndParenthesesLeftPower", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnAndParenthesesLeftRoot", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnAndParenthesesRightPlusWith", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnAndParenthesesRightPlusWithout", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnAndParenthesesRightMinusWith", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnAndParenthesesRightMinusWithout", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnAndParenthesesRightPower", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnAndParenthesesRightRoot", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnAndCoverageParentheses", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnOr", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnOrMultiple", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnOrParentheses", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnOrParenthesesLeftPlusWith", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnOrParenthesesLeftPlusWithout", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnOrParenthesesLeftMinusWith", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnOrParenthesesLeftMinusWithout", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnOrParenthesesLeftPower", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnOrParenthesesLeftRoot", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnOrParenthesesRightPlusWith", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnOrParenthesesRightPlusWithout", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnOrParenthesesRightMinusWith", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnOrParenthesesRightMinusWithout", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnOrParenthesesRightPower", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnOrParenthesesRightRoot", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnOrCoverageParentheses", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnXor", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnXorMultiple", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnXorParentheses", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnXorParenthesesLeftPlusWith", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnXorParenthesesLeftPlusWithout", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnXorParenthesesLeftMinusWith", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnXorParenthesesLeftMinusWithout", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnXorParenthesesLeftPower", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnXorParenthesesLeftRoot", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnXorParenthesesRightPlusWith", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnXorParenthesesRightPlusWithout", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnXorParenthesesRightMinusWith", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnXorParenthesesRightMinusWithout", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnXorParenthesesRightPower", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnXorParenthesesRightRoot", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnXorCoverageParentheses", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnNot", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnPlus", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnPlusMultiple", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnPlusParentheses", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnPlusUnary", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnMinus", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnMinusParentheses", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnMinusParenthesesPlusWith", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnMinusParenthesesPlusWithout", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnMinusParenthesesDirectUnaryMinus", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnMinusParenthesesIndirectUnaryMinus", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnMinusUnary", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnMinusUnaryParentheses", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnTimes", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnTimesMultiple", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnTimesParentheses", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnTimesParenthesesLeftPlusWith", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnTimesParenthesesLeftPlusWithout", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnTimesParenthesesLeftMinusWith", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnTimesParenthesesLeftMinusWithout", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnTimesParenthesesRightPlusWith", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnTimesParenthesesRightPlusWithout", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnTimesParenthesesRightMinusWith", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnTimesParenthesesRightMinusWithout", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnDivide", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnDivideParentheses", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnDivideParenthesesLeftPlusWith", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnDivideParenthesesLeftPlusWithout", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnDivideParenthesesLeftMinusWith", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnDivideParenthesesLeftMinusWithout", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnDivideParenthesesRightPlusWith", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnDivideParenthesesRightPlusWithout", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnDivideParenthesesRightMinusWith", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnDivideParenthesesRightMinusWithout", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnDivideParenthesesRightTimes", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnDivideParenthesesRightDivide", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnPowerSqrt", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnPowerSqr", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnPowerCube", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnPowerCi", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnPowerParentheses", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnPowerParenthesesLeftPlusWith", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnPowerParenthesesLeftPlusWithout", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnPowerParenthesesLeftMinusWith", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnPowerParenthesesLeftMinusWithout", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnPowerParenthesesLeftTimes", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnPowerParenthesesLeftDivide", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnPowerParenthesesRightPlusWith", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnPowerParenthesesRightPlusWithout", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnPowerParenthesesRightMinusWith", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnPowerParenthesesRightMinusWithout", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnPowerParenthesesRightTimes", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnPowerParenthesesRightDivide", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnPowerParenthesesRightPower", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnPowerParenthesesRightRoot", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnRootSqrt", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnRootSqrtOther", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnRootCube", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnRootCi", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnRootParentheses", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnRootParenthesesLeftPlusWith", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnRootParenthesesLeftPlusWithout", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnRootParenthesesLeftMinusWith", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnRootParenthesesLeftMinusWithout", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnRootParenthesesLeftTimes", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnRootParenthesesLeftDivide", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnRootParenthesesRightPlusWith", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnRootParenthesesRightPlusWithout", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnRootParenthesesRightMinusWith", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnRootParenthesesRightMinusWithout", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnRootParenthesesRightTimes", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnRootParenthesesRightDivide", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnRootParenthesesRightPower", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnRootParenthesesRightRoot", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnAbs", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnExp", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnLn", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnLog", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnLog2", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnLog10", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnLogCi", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnCeiling", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnFloor", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnMin", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnMinMultiple", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnMax", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnMaxMultiple", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnRem", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnSin", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnCos", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnTan", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnSec", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnCsc", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnCot", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnSinh", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnCosh", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnTanh", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnSech", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnCsch", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnCoth", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnArcsin", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnArccos", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnArctan", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnArcsec", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnArccsc", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnArccot", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnArcsinh", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnArccosh", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnArctanh", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnArcsech", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnArccsch", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnArccoth", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnPiecewisePiece", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnPiecewisePieceOtherwise", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnPiecewisePiecePiecePiece", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnPiecewisePiecePiecePieceOtherwise", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnWithPiecewise", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnCnInteger", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnCnDouble", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnCnIntegerWithExponent", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnCnDoubleWithExponent", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnCi", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnTrue", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnFalse", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnExponentiale", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnPi", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnInfinity", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnNotanumber", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnCoverageForPlusOperator", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnCoverageForMinusOperator", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnCoverageForTimesOperator", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnCoverageForDivideOperator", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnCoverageForAndOperator", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnCoverageForOrOperator", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnCoverageForXorOperator", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnCoverageForPowerOperator", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnCoverageForRootOperator", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnCoverageForMinusUnary", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnComputedConstant1", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnComputedConstant2", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT} + {"name": "eqnEq", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnEqCoverageParentheses", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnNeq", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnNeqCoverageParentheses", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnLt", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnLtCoverageParentheses", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnLeq", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnLeqCoverageParentheses", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnGt", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnGtCoverageParentheses", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnGeq", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnGeqCoverageParentheses", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnAnd", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnAndMultiple", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnAndParentheses", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnAndParenthesesLeftPlusWith", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnAndParenthesesLeftPlusWithout", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnAndParenthesesLeftMinusWith", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnAndParenthesesLeftMinusWithout", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnAndParenthesesLeftPower", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnAndParenthesesLeftRoot", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnAndParenthesesRightPlusWith", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnAndParenthesesRightPlusWithout", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnAndParenthesesRightMinusWith", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnAndParenthesesRightMinusWithout", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnAndParenthesesRightPower", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnAndParenthesesRightRoot", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnAndCoverageParentheses", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnOr", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnOrMultiple", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnOrParentheses", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnOrParenthesesLeftPlusWith", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnOrParenthesesLeftPlusWithout", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnOrParenthesesLeftMinusWith", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnOrParenthesesLeftMinusWithout", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnOrParenthesesLeftPower", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnOrParenthesesLeftRoot", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnOrParenthesesRightPlusWith", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnOrParenthesesRightPlusWithout", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnOrParenthesesRightMinusWith", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnOrParenthesesRightMinusWithout", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnOrParenthesesRightPower", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnOrParenthesesRightRoot", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnOrCoverageParentheses", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnXor", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnXorMultiple", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnXorParentheses", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnXorParenthesesLeftPlusWith", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnXorParenthesesLeftPlusWithout", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnXorParenthesesLeftMinusWith", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnXorParenthesesLeftMinusWithout", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnXorParenthesesLeftPower", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnXorParenthesesLeftRoot", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnXorParenthesesRightPlusWith", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnXorParenthesesRightPlusWithout", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnXorParenthesesRightMinusWith", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnXorParenthesesRightMinusWithout", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnXorParenthesesRightPower", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnXorParenthesesRightRoot", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnXorCoverageParentheses", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnNot", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnPlus", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnPlusMultiple", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnPlusParentheses", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnPlusUnary", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnMinus", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnMinusParentheses", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnMinusParenthesesPlusWith", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnMinusParenthesesPlusWithout", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnMinusParenthesesDirectUnaryMinus", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnMinusParenthesesIndirectUnaryMinus", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnMinusUnary", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnMinusUnaryParentheses", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnTimes", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnTimesMultiple", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnTimesParentheses", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnTimesParenthesesLeftPlusWith", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnTimesParenthesesLeftPlusWithout", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnTimesParenthesesLeftMinusWith", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnTimesParenthesesLeftMinusWithout", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnTimesParenthesesRightPlusWith", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnTimesParenthesesRightPlusWithout", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnTimesParenthesesRightMinusWith", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnTimesParenthesesRightMinusWithout", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnDivide", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnDivideParentheses", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnDivideParenthesesLeftPlusWith", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnDivideParenthesesLeftPlusWithout", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnDivideParenthesesLeftMinusWith", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnDivideParenthesesLeftMinusWithout", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnDivideParenthesesRightPlusWith", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnDivideParenthesesRightPlusWithout", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnDivideParenthesesRightMinusWith", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnDivideParenthesesRightMinusWithout", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnDivideParenthesesRightTimes", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnDivideParenthesesRightDivide", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnPowerSqrt", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnPowerSqr", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnPowerCube", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnPowerCi", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnPowerParentheses", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnPowerParenthesesLeftPlusWith", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnPowerParenthesesLeftPlusWithout", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnPowerParenthesesLeftMinusWith", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnPowerParenthesesLeftMinusWithout", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnPowerParenthesesLeftTimes", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnPowerParenthesesLeftDivide", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnPowerParenthesesRightPlusWith", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnPowerParenthesesRightPlusWithout", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnPowerParenthesesRightMinusWith", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnPowerParenthesesRightMinusWithout", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnPowerParenthesesRightTimes", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnPowerParenthesesRightDivide", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnPowerParenthesesRightPower", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnPowerParenthesesRightRoot", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnRootSqrt", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnRootSqrtOther", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnRootCube", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnRootCi", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnRootParentheses", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnRootParenthesesLeftPlusWith", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnRootParenthesesLeftPlusWithout", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnRootParenthesesLeftMinusWith", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnRootParenthesesLeftMinusWithout", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnRootParenthesesLeftTimes", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnRootParenthesesLeftDivide", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnRootParenthesesRightPlusWith", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnRootParenthesesRightPlusWithout", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnRootParenthesesRightMinusWith", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnRootParenthesesRightMinusWithout", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnRootParenthesesRightTimes", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnRootParenthesesRightDivide", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnRootParenthesesRightPower", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnRootParenthesesRightRoot", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnAbs", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnExp", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnLn", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnLog", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnLog2", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnLog10", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnLogCi", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnCeiling", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnFloor", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnMin", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnMinMultiple", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnMax", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnMaxMultiple", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnRem", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnSin", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnCos", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnTan", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnSec", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnCsc", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnCot", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnSinh", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnCosh", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnTanh", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnSech", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnCsch", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnCoth", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnArcsin", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnArccos", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnArctan", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnArcsec", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnArccsc", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnArccot", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnArcsinh", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnArccosh", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnArctanh", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnArcsech", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnArccsch", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnArccoth", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnPiecewisePiece", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnPiecewisePieceOtherwise", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnPiecewisePiecePiecePiece", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnPiecewisePiecePiecePieceOtherwise", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnWithPiecewise", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnCnInteger", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnCnDouble", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnCnIntegerWithExponent", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnCnDoubleWithExponent", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnCi", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnTrue", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnFalse", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnExponentiale", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnPi", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnInfinity", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnNotanumber", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnCoverageForPlusOperator", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnCoverageForMinusOperator", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnCoverageForTimesOperator", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnCoverageForDivideOperator", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnCoverageForAndOperator", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnCoverageForOrOperator", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnCoverageForXorOperator", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnCoverageForPowerOperator", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnCoverageForRootOperator", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnCoverageForMinusUnary", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnComputedConstant1", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnComputedConstant2", "units": "dimensionless", "component": "my_component"} ] ALGEBRAIC_INFO = [ - {"name": "eqnNlaVariable1", "units": "dimensionless", "component": "my_component", "type": VariableType.ALGEBRAIC}, - {"name": "eqnNlaVariable2", "units": "dimensionless", "component": "my_component", "type": VariableType.ALGEBRAIC} + {"name": "eqnNlaVariable1", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnNlaVariable2", "units": "dimensionless", "component": "my_component"} ] diff --git a/tests/resources/coverage/generator/model.py b/tests/resources/coverage/generator/model.py index bea011a82b..0ddd0fe1ec 100644 --- a/tests/resources/coverage/generator/model.py +++ b/tests/resources/coverage/generator/model.py @@ -12,236 +12,227 @@ COMPUTED_CONSTANT_COUNT = 200 ALGEBRAIC_COUNT = 2 +VOI_INFO = {"name": "t", "units": "second", "component": "my_component"} -class VariableType(Enum): - VARIABLE_OF_INTEGRATION = 0 - STATE = 1 - CONSTANT = 2 - COMPUTED_CONSTANT = 3 - ALGEBRAIC = 4 - - -VOI_INFO = {"name": "t", "units": "second", "component": "my_component", "type": VariableType.VARIABLE_OF_INTEGRATION} - -STATE_INFO = {"name": "x", "units": "dimensionless", "component": "my_component", "type": VariableType.STATE} +STATE_INFO = {"name": "x", "units": "dimensionless", "component": "my_component"} CONSTANT_INFO = [ - {"name": "m", "units": "dimensionless", "component": "my_component", "type": VariableType.CONSTANT}, - {"name": "n", "units": "dimensionless", "component": "my_component", "type": VariableType.CONSTANT}, - {"name": "o", "units": "dimensionless", "component": "my_component", "type": VariableType.CONSTANT}, - {"name": "p", "units": "dimensionless", "component": "my_component", "type": VariableType.CONSTANT}, - {"name": "q", "units": "dimensionless", "component": "my_component", "type": VariableType.CONSTANT}, - {"name": "r", "units": "dimensionless", "component": "my_component", "type": VariableType.CONSTANT}, - {"name": "s", "units": "dimensionless", "component": "my_component", "type": VariableType.CONSTANT} + {"name": "m", "units": "dimensionless", "component": "my_component"}, + {"name": "n", "units": "dimensionless", "component": "my_component"}, + {"name": "o", "units": "dimensionless", "component": "my_component"}, + {"name": "p", "units": "dimensionless", "component": "my_component"}, + {"name": "q", "units": "dimensionless", "component": "my_component"}, + {"name": "r", "units": "dimensionless", "component": "my_component"}, + {"name": "s", "units": "dimensionless", "component": "my_component"} ] COMPUTED_CONSTANT_INFO = [ - {"name": "eqnEq", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnEqCoverageParentheses", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnNeq", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnNeqCoverageParentheses", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnLt", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnLtCoverageParentheses", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnLeq", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnLeqCoverageParentheses", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnGt", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnGtCoverageParentheses", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnGeq", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnGeqCoverageParentheses", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnAnd", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnAndMultiple", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnAndParentheses", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnAndParenthesesLeftPlusWith", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnAndParenthesesLeftPlusWithout", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnAndParenthesesLeftMinusWith", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnAndParenthesesLeftMinusWithout", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnAndParenthesesLeftPower", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnAndParenthesesLeftRoot", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnAndParenthesesRightPlusWith", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnAndParenthesesRightPlusWithout", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnAndParenthesesRightMinusWith", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnAndParenthesesRightMinusWithout", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnAndParenthesesRightPower", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnAndParenthesesRightRoot", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnAndCoverageParentheses", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnOr", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnOrMultiple", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnOrParentheses", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnOrParenthesesLeftPlusWith", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnOrParenthesesLeftPlusWithout", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnOrParenthesesLeftMinusWith", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnOrParenthesesLeftMinusWithout", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnOrParenthesesLeftPower", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnOrParenthesesLeftRoot", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnOrParenthesesRightPlusWith", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnOrParenthesesRightPlusWithout", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnOrParenthesesRightMinusWith", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnOrParenthesesRightMinusWithout", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnOrParenthesesRightPower", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnOrParenthesesRightRoot", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnOrCoverageParentheses", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnXor", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnXorMultiple", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnXorParentheses", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnXorParenthesesLeftPlusWith", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnXorParenthesesLeftPlusWithout", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnXorParenthesesLeftMinusWith", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnXorParenthesesLeftMinusWithout", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnXorParenthesesLeftPower", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnXorParenthesesLeftRoot", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnXorParenthesesRightPlusWith", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnXorParenthesesRightPlusWithout", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnXorParenthesesRightMinusWith", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnXorParenthesesRightMinusWithout", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnXorParenthesesRightPower", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnXorParenthesesRightRoot", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnXorCoverageParentheses", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnNot", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnPlus", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnPlusMultiple", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnPlusParentheses", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnPlusUnary", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnMinus", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnMinusParentheses", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnMinusParenthesesPlusWith", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnMinusParenthesesPlusWithout", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnMinusParenthesesDirectUnaryMinus", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnMinusParenthesesIndirectUnaryMinus", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnMinusUnary", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnMinusUnaryParentheses", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnTimes", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnTimesMultiple", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnTimesParentheses", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnTimesParenthesesLeftPlusWith", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnTimesParenthesesLeftPlusWithout", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnTimesParenthesesLeftMinusWith", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnTimesParenthesesLeftMinusWithout", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnTimesParenthesesRightPlusWith", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnTimesParenthesesRightPlusWithout", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnTimesParenthesesRightMinusWith", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnTimesParenthesesRightMinusWithout", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnDivide", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnDivideParentheses", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnDivideParenthesesLeftPlusWith", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnDivideParenthesesLeftPlusWithout", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnDivideParenthesesLeftMinusWith", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnDivideParenthesesLeftMinusWithout", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnDivideParenthesesRightPlusWith", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnDivideParenthesesRightPlusWithout", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnDivideParenthesesRightMinusWith", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnDivideParenthesesRightMinusWithout", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnDivideParenthesesRightTimes", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnDivideParenthesesRightDivide", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnPowerSqrt", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnPowerSqr", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnPowerCube", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnPowerCi", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnPowerParentheses", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnPowerParenthesesLeftPlusWith", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnPowerParenthesesLeftPlusWithout", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnPowerParenthesesLeftMinusWith", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnPowerParenthesesLeftMinusWithout", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnPowerParenthesesLeftTimes", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnPowerParenthesesLeftDivide", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnPowerParenthesesRightPlusWith", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnPowerParenthesesRightPlusWithout", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnPowerParenthesesRightMinusWith", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnPowerParenthesesRightMinusWithout", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnPowerParenthesesRightTimes", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnPowerParenthesesRightDivide", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnPowerParenthesesRightPower", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnPowerParenthesesRightRoot", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnRootSqrt", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnRootSqrtOther", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnRootCube", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnRootCi", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnRootParentheses", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnRootParenthesesLeftPlusWith", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnRootParenthesesLeftPlusWithout", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnRootParenthesesLeftMinusWith", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnRootParenthesesLeftMinusWithout", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnRootParenthesesLeftTimes", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnRootParenthesesLeftDivide", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnRootParenthesesRightPlusWith", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnRootParenthesesRightPlusWithout", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnRootParenthesesRightMinusWith", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnRootParenthesesRightMinusWithout", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnRootParenthesesRightTimes", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnRootParenthesesRightDivide", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnRootParenthesesRightPower", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnRootParenthesesRightRoot", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnAbs", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnExp", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnLn", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnLog", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnLog2", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnLog10", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnLogCi", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnCeiling", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnFloor", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnMin", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnMinMultiple", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnMax", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnMaxMultiple", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnRem", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnSin", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnCos", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnTan", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnSec", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnCsc", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnCot", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnSinh", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnCosh", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnTanh", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnSech", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnCsch", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnCoth", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnArcsin", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnArccos", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnArctan", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnArcsec", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnArccsc", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnArccot", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnArcsinh", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnArccosh", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnArctanh", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnArcsech", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnArccsch", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnArccoth", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnPiecewisePiece", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnPiecewisePieceOtherwise", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnPiecewisePiecePiecePiece", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnPiecewisePiecePiecePieceOtherwise", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnWithPiecewise", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnCnInteger", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnCnDouble", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnCnIntegerWithExponent", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnCnDoubleWithExponent", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnCi", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnTrue", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnFalse", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnExponentiale", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnPi", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnInfinity", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnNotanumber", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnCoverageForPlusOperator", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnCoverageForMinusOperator", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnCoverageForTimesOperator", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnCoverageForDivideOperator", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnCoverageForAndOperator", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnCoverageForOrOperator", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnCoverageForXorOperator", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnCoverageForPowerOperator", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnCoverageForRootOperator", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnCoverageForMinusUnary", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnComputedConstant1", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "eqnComputedConstant2", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT} + {"name": "eqnEq", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnEqCoverageParentheses", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnNeq", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnNeqCoverageParentheses", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnLt", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnLtCoverageParentheses", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnLeq", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnLeqCoverageParentheses", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnGt", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnGtCoverageParentheses", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnGeq", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnGeqCoverageParentheses", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnAnd", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnAndMultiple", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnAndParentheses", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnAndParenthesesLeftPlusWith", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnAndParenthesesLeftPlusWithout", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnAndParenthesesLeftMinusWith", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnAndParenthesesLeftMinusWithout", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnAndParenthesesLeftPower", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnAndParenthesesLeftRoot", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnAndParenthesesRightPlusWith", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnAndParenthesesRightPlusWithout", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnAndParenthesesRightMinusWith", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnAndParenthesesRightMinusWithout", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnAndParenthesesRightPower", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnAndParenthesesRightRoot", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnAndCoverageParentheses", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnOr", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnOrMultiple", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnOrParentheses", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnOrParenthesesLeftPlusWith", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnOrParenthesesLeftPlusWithout", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnOrParenthesesLeftMinusWith", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnOrParenthesesLeftMinusWithout", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnOrParenthesesLeftPower", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnOrParenthesesLeftRoot", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnOrParenthesesRightPlusWith", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnOrParenthesesRightPlusWithout", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnOrParenthesesRightMinusWith", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnOrParenthesesRightMinusWithout", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnOrParenthesesRightPower", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnOrParenthesesRightRoot", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnOrCoverageParentheses", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnXor", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnXorMultiple", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnXorParentheses", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnXorParenthesesLeftPlusWith", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnXorParenthesesLeftPlusWithout", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnXorParenthesesLeftMinusWith", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnXorParenthesesLeftMinusWithout", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnXorParenthesesLeftPower", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnXorParenthesesLeftRoot", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnXorParenthesesRightPlusWith", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnXorParenthesesRightPlusWithout", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnXorParenthesesRightMinusWith", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnXorParenthesesRightMinusWithout", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnXorParenthesesRightPower", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnXorParenthesesRightRoot", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnXorCoverageParentheses", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnNot", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnPlus", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnPlusMultiple", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnPlusParentheses", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnPlusUnary", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnMinus", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnMinusParentheses", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnMinusParenthesesPlusWith", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnMinusParenthesesPlusWithout", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnMinusParenthesesDirectUnaryMinus", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnMinusParenthesesIndirectUnaryMinus", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnMinusUnary", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnMinusUnaryParentheses", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnTimes", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnTimesMultiple", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnTimesParentheses", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnTimesParenthesesLeftPlusWith", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnTimesParenthesesLeftPlusWithout", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnTimesParenthesesLeftMinusWith", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnTimesParenthesesLeftMinusWithout", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnTimesParenthesesRightPlusWith", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnTimesParenthesesRightPlusWithout", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnTimesParenthesesRightMinusWith", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnTimesParenthesesRightMinusWithout", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnDivide", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnDivideParentheses", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnDivideParenthesesLeftPlusWith", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnDivideParenthesesLeftPlusWithout", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnDivideParenthesesLeftMinusWith", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnDivideParenthesesLeftMinusWithout", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnDivideParenthesesRightPlusWith", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnDivideParenthesesRightPlusWithout", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnDivideParenthesesRightMinusWith", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnDivideParenthesesRightMinusWithout", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnDivideParenthesesRightTimes", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnDivideParenthesesRightDivide", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnPowerSqrt", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnPowerSqr", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnPowerCube", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnPowerCi", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnPowerParentheses", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnPowerParenthesesLeftPlusWith", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnPowerParenthesesLeftPlusWithout", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnPowerParenthesesLeftMinusWith", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnPowerParenthesesLeftMinusWithout", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnPowerParenthesesLeftTimes", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnPowerParenthesesLeftDivide", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnPowerParenthesesRightPlusWith", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnPowerParenthesesRightPlusWithout", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnPowerParenthesesRightMinusWith", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnPowerParenthesesRightMinusWithout", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnPowerParenthesesRightTimes", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnPowerParenthesesRightDivide", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnPowerParenthesesRightPower", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnPowerParenthesesRightRoot", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnRootSqrt", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnRootSqrtOther", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnRootCube", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnRootCi", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnRootParentheses", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnRootParenthesesLeftPlusWith", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnRootParenthesesLeftPlusWithout", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnRootParenthesesLeftMinusWith", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnRootParenthesesLeftMinusWithout", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnRootParenthesesLeftTimes", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnRootParenthesesLeftDivide", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnRootParenthesesRightPlusWith", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnRootParenthesesRightPlusWithout", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnRootParenthesesRightMinusWith", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnRootParenthesesRightMinusWithout", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnRootParenthesesRightTimes", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnRootParenthesesRightDivide", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnRootParenthesesRightPower", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnRootParenthesesRightRoot", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnAbs", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnExp", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnLn", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnLog", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnLog2", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnLog10", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnLogCi", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnCeiling", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnFloor", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnMin", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnMinMultiple", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnMax", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnMaxMultiple", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnRem", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnSin", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnCos", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnTan", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnSec", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnCsc", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnCot", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnSinh", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnCosh", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnTanh", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnSech", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnCsch", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnCoth", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnArcsin", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnArccos", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnArctan", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnArcsec", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnArccsc", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnArccot", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnArcsinh", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnArccosh", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnArctanh", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnArcsech", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnArccsch", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnArccoth", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnPiecewisePiece", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnPiecewisePieceOtherwise", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnPiecewisePiecePiecePiece", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnPiecewisePiecePiecePieceOtherwise", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnWithPiecewise", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnCnInteger", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnCnDouble", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnCnIntegerWithExponent", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnCnDoubleWithExponent", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnCi", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnTrue", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnFalse", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnExponentiale", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnPi", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnInfinity", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnNotanumber", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnCoverageForPlusOperator", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnCoverageForMinusOperator", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnCoverageForTimesOperator", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnCoverageForDivideOperator", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnCoverageForAndOperator", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnCoverageForOrOperator", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnCoverageForXorOperator", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnCoverageForPowerOperator", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnCoverageForRootOperator", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnCoverageForMinusUnary", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnComputedConstant1", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnComputedConstant2", "units": "dimensionless", "component": "my_component"} ] ALGEBRAIC_INFO = [ - {"name": "eqnNlaVariable1", "units": "dimensionless", "component": "my_component", "type": VariableType.ALGEBRAIC}, - {"name": "eqnNlaVariable2", "units": "dimensionless", "component": "my_component", "type": VariableType.ALGEBRAIC} + {"name": "eqnNlaVariable1", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnNlaVariable2", "units": "dimensionless", "component": "my_component"} ] diff --git a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.c b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.c index 93b538b35d..d3373bd80c 100644 --- a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.c +++ b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.c @@ -16,8 +16,8 @@ const VariableInfo CONSTANT_INFO[] = { }; const VariableInfo COMPUTED_CONSTANT_INFO[] = { - {"x", "dimensionless", "my_algebraic_eqn", COMPUTED_CONSTANT}, - {"a", "dimensionless", "my_algebraic_eqn", COMPUTED_CONSTANT} + {"x", "dimensionless", "my_algebraic_eqn"}, + {"a", "dimensionless", "my_algebraic_eqn"} }; const VariableInfo ALGEBRAIC_INFO[] = { diff --git a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.c b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.c index 4d448046df..fcac8daa35 100644 --- a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.c +++ b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.c @@ -20,11 +20,11 @@ const VariableInfo COMPUTED_CONSTANT_INFO[] = { }; const VariableInfo ALGEBRAIC_INFO[] = { - {"x", "dimensionless", "my_algebraic_eqn", ALGEBRAIC} + {"x", "dimensionless", "my_algebraic_eqn"} }; const VariableInfo EXTERNAL_INFO[] = { - {"a", "dimensionless", "my_algebraic_eqn", EXTERNAL} + {"a", "dimensionless", "my_algebraic_eqn"} }; double * createVariablesArray() diff --git a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.h b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.h index da181acb28..ae517dbae9 100644 --- a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.h +++ b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.h @@ -12,18 +12,10 @@ extern const size_t COMPUTED_CONSTANT_COUNT; extern const size_t ALGEBRAIC_COUNT; extern const size_t EXTERNAL_COUNT; -typedef enum { - CONSTANT, - COMPUTED_CONSTANT, - ALGEBRAIC, - EXTERNAL -} VariableType; - typedef struct { char name[2]; char units[14]; char component[17]; - VariableType type; } VariableInfo; extern const VariableInfo CONSTANT_INFO[]; diff --git a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.py b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.py index 267f46df4f..5aad8e9322 100644 --- a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.py +++ b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.py @@ -12,14 +12,6 @@ ALGEBRAIC_COUNT = 1 EXTERNAL_COUNT = 1 - -class VariableType(Enum): - CONSTANT = 0 - COMPUTED_CONSTANT = 1 - ALGEBRAIC = 2 - EXTERNAL = 3 - - CONSTANT_INFO = [ ] @@ -27,11 +19,11 @@ class VariableType(Enum): ] ALGEBRAIC_INFO = [ - {"name": "x", "units": "dimensionless", "component": "my_algebraic_eqn", "type": VariableType.ALGEBRAIC} + {"name": "x", "units": "dimensionless", "component": "my_algebraic_eqn"} ] EXTERNAL_INFO = [ - {"name": "a", "units": "dimensionless", "component": "my_algebraic_eqn", "type": VariableType.EXTERNAL} + {"name": "a", "units": "dimensionless", "component": "my_algebraic_eqn"} ] diff --git a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.h b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.h index a14bcb3994..e7483121b5 100644 --- a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.h +++ b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.h @@ -11,17 +11,10 @@ extern const size_t CONSTANT_COUNT; extern const size_t COMPUTED_CONSTANT_COUNT; extern const size_t ALGEBRAIC_COUNT; -typedef enum { - CONSTANT, - COMPUTED_CONSTANT, - ALGEBRAIC -} VariableType; - typedef struct { char name[2]; char units[14]; char component[17]; - VariableType type; } VariableInfo; extern const VariableInfo CONSTANT_INFO[]; diff --git a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.py b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.py index f4989919ea..5b2757c655 100644 --- a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.py +++ b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.py @@ -11,19 +11,12 @@ COMPUTED_CONSTANT_COUNT = 2 ALGEBRAIC_COUNT = 0 - -class VariableType(Enum): - CONSTANT = 0 - COMPUTED_CONSTANT = 1 - ALGEBRAIC = 2 - - CONSTANT_INFO = [ ] COMPUTED_CONSTANT_INFO = [ - {"name": "x", "units": "dimensionless", "component": "my_algebraic_eqn", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "a", "units": "dimensionless", "component": "my_algebraic_eqn", "type": VariableType.COMPUTED_CONSTANT} + {"name": "x", "units": "dimensionless", "component": "my_algebraic_eqn"}, + {"name": "a", "units": "dimensionless", "component": "my_algebraic_eqn"} ] ALGEBRAIC_INFO = [ diff --git a/tests/resources/generator/algebraic_eqn_const_var_on_rhs/model.c b/tests/resources/generator/algebraic_eqn_const_var_on_rhs/model.c index 55fb1236ad..f1a027bb90 100644 --- a/tests/resources/generator/algebraic_eqn_const_var_on_rhs/model.c +++ b/tests/resources/generator/algebraic_eqn_const_var_on_rhs/model.c @@ -13,11 +13,11 @@ const size_t COMPUTED_CONSTANT_COUNT = 1; const size_t ALGEBRAIC_COUNT = 0; const VariableInfo CONSTANT_INFO[] = { - {"a", "dimensionless", "my_algebraic_eqn", CONSTANT} + {"a", "dimensionless", "my_algebraic_eqn"} }; const VariableInfo COMPUTED_CONSTANT_INFO[] = { - {"x", "dimensionless", "my_algebraic_eqn", COMPUTED_CONSTANT} + {"x", "dimensionless", "my_algebraic_eqn"} }; const VariableInfo ALGEBRAIC_INFO[] = { diff --git a/tests/resources/generator/algebraic_eqn_const_var_on_rhs/model.h b/tests/resources/generator/algebraic_eqn_const_var_on_rhs/model.h index a14bcb3994..e7483121b5 100644 --- a/tests/resources/generator/algebraic_eqn_const_var_on_rhs/model.h +++ b/tests/resources/generator/algebraic_eqn_const_var_on_rhs/model.h @@ -11,17 +11,10 @@ extern const size_t CONSTANT_COUNT; extern const size_t COMPUTED_CONSTANT_COUNT; extern const size_t ALGEBRAIC_COUNT; -typedef enum { - CONSTANT, - COMPUTED_CONSTANT, - ALGEBRAIC -} VariableType; - typedef struct { char name[2]; char units[14]; char component[17]; - VariableType type; } VariableInfo; extern const VariableInfo CONSTANT_INFO[]; diff --git a/tests/resources/generator/algebraic_eqn_const_var_on_rhs/model.py b/tests/resources/generator/algebraic_eqn_const_var_on_rhs/model.py index a6562fdf52..11f3c989c7 100644 --- a/tests/resources/generator/algebraic_eqn_const_var_on_rhs/model.py +++ b/tests/resources/generator/algebraic_eqn_const_var_on_rhs/model.py @@ -11,19 +11,12 @@ COMPUTED_CONSTANT_COUNT = 1 ALGEBRAIC_COUNT = 0 - -class VariableType(Enum): - CONSTANT = 0 - COMPUTED_CONSTANT = 1 - ALGEBRAIC = 2 - - CONSTANT_INFO = [ - {"name": "a", "units": "dimensionless", "component": "my_algebraic_eqn", "type": VariableType.CONSTANT} + {"name": "a", "units": "dimensionless", "component": "my_algebraic_eqn"} ] COMPUTED_CONSTANT_INFO = [ - {"name": "x", "units": "dimensionless", "component": "my_algebraic_eqn", "type": VariableType.COMPUTED_CONSTANT} + {"name": "x", "units": "dimensionless", "component": "my_algebraic_eqn"} ] ALGEBRAIC_INFO = [ diff --git a/tests/resources/generator/algebraic_eqn_constant_on_rhs/model.c b/tests/resources/generator/algebraic_eqn_constant_on_rhs/model.c index 0c647741fb..d675f0bf54 100644 --- a/tests/resources/generator/algebraic_eqn_constant_on_rhs/model.c +++ b/tests/resources/generator/algebraic_eqn_constant_on_rhs/model.c @@ -16,7 +16,7 @@ const VariableInfo CONSTANT_INFO[] = { }; const VariableInfo COMPUTED_CONSTANT_INFO[] = { - {"x", "dimensionless", "my_component", COMPUTED_CONSTANT} + {"x", "dimensionless", "my_component"} }; const VariableInfo ALGEBRAIC_INFO[] = { diff --git a/tests/resources/generator/algebraic_eqn_constant_on_rhs/model.h b/tests/resources/generator/algebraic_eqn_constant_on_rhs/model.h index 2e7b0dd0b1..c22b338947 100644 --- a/tests/resources/generator/algebraic_eqn_constant_on_rhs/model.h +++ b/tests/resources/generator/algebraic_eqn_constant_on_rhs/model.h @@ -11,17 +11,10 @@ extern const size_t CONSTANT_COUNT; extern const size_t COMPUTED_CONSTANT_COUNT; extern const size_t ALGEBRAIC_COUNT; -typedef enum { - CONSTANT, - COMPUTED_CONSTANT, - ALGEBRAIC -} VariableType; - typedef struct { char name[2]; char units[14]; char component[13]; - VariableType type; } VariableInfo; extern const VariableInfo CONSTANT_INFO[]; diff --git a/tests/resources/generator/algebraic_eqn_constant_on_rhs/model.py b/tests/resources/generator/algebraic_eqn_constant_on_rhs/model.py index 8c32d995f3..32441f8f5c 100644 --- a/tests/resources/generator/algebraic_eqn_constant_on_rhs/model.py +++ b/tests/resources/generator/algebraic_eqn_constant_on_rhs/model.py @@ -11,18 +11,11 @@ COMPUTED_CONSTANT_COUNT = 1 ALGEBRAIC_COUNT = 0 - -class VariableType(Enum): - CONSTANT = 0 - COMPUTED_CONSTANT = 1 - ALGEBRAIC = 2 - - CONSTANT_INFO = [ ] COMPUTED_CONSTANT_INFO = [ - {"name": "x", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT} + {"name": "x", "units": "dimensionless", "component": "my_component"} ] ALGEBRAIC_INFO = [ diff --git a/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.c b/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.c index ec215a064d..b74b04c00c 100644 --- a/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.c +++ b/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.c @@ -13,21 +13,21 @@ const size_t CONSTANT_COUNT = 0; const size_t COMPUTED_CONSTANT_COUNT = 1; const size_t ALGEBRAIC_COUNT = 1; -const VariableInfo VOI_INFO = {"t", "second", "environment", VARIABLE_OF_INTEGRATION}; +const VariableInfo VOI_INFO = {"t", "second", "environment"}; const VariableInfo STATE_INFO[] = { - {"v", "dimensionless", "my_ode", STATE} + {"v", "dimensionless", "my_ode"} }; const VariableInfo CONSTANT_INFO[] = { }; const VariableInfo COMPUTED_CONSTANT_INFO[] = { - {"a", "per_s", "my_ode", COMPUTED_CONSTANT} + {"a", "per_s", "my_ode"} }; const VariableInfo ALGEBRAIC_INFO[] = { - {"x", "per_s", "my_algebraic_eqn", ALGEBRAIC} + {"x", "per_s", "my_algebraic_eqn"} }; double * createStatesArray() diff --git a/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.h b/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.h index bb606064c9..897ad01fb4 100644 --- a/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.h +++ b/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.h @@ -12,19 +12,10 @@ extern const size_t CONSTANT_COUNT; extern const size_t COMPUTED_CONSTANT_COUNT; extern const size_t ALGEBRAIC_COUNT; -typedef enum { - VARIABLE_OF_INTEGRATION, - STATE, - CONSTANT, - COMPUTED_CONSTANT, - ALGEBRAIC -} VariableType; - typedef struct { char name[2]; char units[14]; char component[17]; - VariableType type; } VariableInfo; extern const VariableInfo VOI_INFO; diff --git a/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.py b/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.py index 9a708f2353..50a4280dd6 100644 --- a/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.py +++ b/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.py @@ -12,29 +12,20 @@ COMPUTED_CONSTANT_COUNT = 1 ALGEBRAIC_COUNT = 1 +VOI_INFO = {"name": "t", "units": "second", "component": "environment"} -class VariableType(Enum): - VARIABLE_OF_INTEGRATION = 0 - STATE = 1 - CONSTANT = 2 - COMPUTED_CONSTANT = 3 - ALGEBRAIC = 4 - - -VOI_INFO = {"name": "t", "units": "second", "component": "environment", "type": VariableType.VARIABLE_OF_INTEGRATION} - -STATE_INFO = {"name": "v", "units": "dimensionless", "component": "my_ode", "type": VariableType.STATE} +STATE_INFO = {"name": "v", "units": "dimensionless", "component": "my_ode"} CONSTANT_INFO = [ ] COMPUTED_CONSTANT_INFO = [ - {"name": "a", "units": "per_s", "component": "my_ode", "type": VariableType.COMPUTED_CONSTANT} + {"name": "a", "units": "per_s", "component": "my_ode"} ] ALGEBRAIC_INFO = [ - {"name": "x", "units": "per_s", "component": "my_algebraic_eqn", "type": VariableType.ALGEBRAIC} + {"name": "x", "units": "per_s", "component": "my_algebraic_eqn"} ] diff --git a/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.c b/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.c index 1ca2804815..b5dfae2720 100644 --- a/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.c +++ b/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.c @@ -13,21 +13,21 @@ const size_t CONSTANT_COUNT = 0; const size_t COMPUTED_CONSTANT_COUNT = 1; const size_t ALGEBRAIC_COUNT = 1; -const VariableInfo VOI_INFO = {"t", "second", "my_component", VARIABLE_OF_INTEGRATION}; +const VariableInfo VOI_INFO = {"t", "second", "my_component"}; const VariableInfo STATE_INFO[] = { - {"v", "dimensionless", "my_component", STATE} + {"v", "dimensionless", "my_component"} }; const VariableInfo CONSTANT_INFO[] = { }; const VariableInfo COMPUTED_CONSTANT_INFO[] = { - {"a", "per_s", "my_component", COMPUTED_CONSTANT} + {"a", "per_s", "my_component"} }; const VariableInfo ALGEBRAIC_INFO[] = { - {"x", "per_s", "my_component", ALGEBRAIC} + {"x", "per_s", "my_component"} }; double * createStatesArray() diff --git a/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.h b/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.h index ec10997670..1c36d8d5fc 100644 --- a/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.h +++ b/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.h @@ -12,19 +12,10 @@ extern const size_t CONSTANT_COUNT; extern const size_t COMPUTED_CONSTANT_COUNT; extern const size_t ALGEBRAIC_COUNT; -typedef enum { - VARIABLE_OF_INTEGRATION, - STATE, - CONSTANT, - COMPUTED_CONSTANT, - ALGEBRAIC -} VariableType; - typedef struct { char name[2]; char units[14]; char component[13]; - VariableType type; } VariableInfo; extern const VariableInfo VOI_INFO; diff --git a/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.py b/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.py index b0f2b7a22e..03b8c76bcd 100644 --- a/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.py +++ b/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.py @@ -12,29 +12,20 @@ COMPUTED_CONSTANT_COUNT = 1 ALGEBRAIC_COUNT = 1 +VOI_INFO = {"name": "t", "units": "second", "component": "my_component"} -class VariableType(Enum): - VARIABLE_OF_INTEGRATION = 0 - STATE = 1 - CONSTANT = 2 - COMPUTED_CONSTANT = 3 - ALGEBRAIC = 4 - - -VOI_INFO = {"name": "t", "units": "second", "component": "my_component", "type": VariableType.VARIABLE_OF_INTEGRATION} - -STATE_INFO = {"name": "v", "units": "dimensionless", "component": "my_component", "type": VariableType.STATE} +STATE_INFO = {"name": "v", "units": "dimensionless", "component": "my_component"} CONSTANT_INFO = [ ] COMPUTED_CONSTANT_INFO = [ - {"name": "a", "units": "per_s", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT} + {"name": "a", "units": "per_s", "component": "my_component"} ] ALGEBRAIC_INFO = [ - {"name": "x", "units": "per_s", "component": "my_component", "type": VariableType.ALGEBRAIC} + {"name": "x", "units": "per_s", "component": "my_component"} ] diff --git a/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.c b/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.c index 3a887564d0..5d8fd74b97 100644 --- a/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.c +++ b/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.c @@ -13,21 +13,21 @@ const size_t CONSTANT_COUNT = 0; const size_t COMPUTED_CONSTANT_COUNT = 1; const size_t ALGEBRAIC_COUNT = 1; -const VariableInfo VOI_INFO = {"t", "second", "environment", VARIABLE_OF_INTEGRATION}; +const VariableInfo VOI_INFO = {"t", "second", "environment"}; const VariableInfo STATE_INFO[] = { - {"x", "dimensionless", "my_ode", STATE} + {"x", "dimensionless", "my_ode"} }; const VariableInfo CONSTANT_INFO[] = { }; const VariableInfo COMPUTED_CONSTANT_INFO[] = { - {"a", "per_s", "my_ode", COMPUTED_CONSTANT} + {"a", "per_s", "my_ode"} }; const VariableInfo ALGEBRAIC_INFO[] = { - {"xx", "dimensionless", "my_algebraic_eqn", ALGEBRAIC} + {"xx", "dimensionless", "my_algebraic_eqn"} }; double * createStatesArray() diff --git a/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.h b/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.h index ca2d89ac46..5d58dcfbbe 100644 --- a/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.h +++ b/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.h @@ -12,19 +12,10 @@ extern const size_t CONSTANT_COUNT; extern const size_t COMPUTED_CONSTANT_COUNT; extern const size_t ALGEBRAIC_COUNT; -typedef enum { - VARIABLE_OF_INTEGRATION, - STATE, - CONSTANT, - COMPUTED_CONSTANT, - ALGEBRAIC -} VariableType; - typedef struct { char name[3]; char units[14]; char component[17]; - VariableType type; } VariableInfo; extern const VariableInfo VOI_INFO; diff --git a/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.py b/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.py index 30fb1833db..20c3b72475 100644 --- a/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.py +++ b/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.py @@ -12,29 +12,20 @@ COMPUTED_CONSTANT_COUNT = 1 ALGEBRAIC_COUNT = 1 +VOI_INFO = {"name": "t", "units": "second", "component": "environment"} -class VariableType(Enum): - VARIABLE_OF_INTEGRATION = 0 - STATE = 1 - CONSTANT = 2 - COMPUTED_CONSTANT = 3 - ALGEBRAIC = 4 - - -VOI_INFO = {"name": "t", "units": "second", "component": "environment", "type": VariableType.VARIABLE_OF_INTEGRATION} - -STATE_INFO = {"name": "x", "units": "dimensionless", "component": "my_ode", "type": VariableType.STATE} +STATE_INFO = {"name": "x", "units": "dimensionless", "component": "my_ode"} CONSTANT_INFO = [ ] COMPUTED_CONSTANT_INFO = [ - {"name": "a", "units": "per_s", "component": "my_ode", "type": VariableType.COMPUTED_CONSTANT} + {"name": "a", "units": "per_s", "component": "my_ode"} ] ALGEBRAIC_INFO = [ - {"name": "xx", "units": "dimensionless", "component": "my_algebraic_eqn", "type": VariableType.ALGEBRAIC} + {"name": "xx", "units": "dimensionless", "component": "my_algebraic_eqn"} ] diff --git a/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.c b/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.c index c25242a83d..9312cbe361 100644 --- a/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.c +++ b/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.c @@ -13,21 +13,21 @@ const size_t CONSTANT_COUNT = 0; const size_t COMPUTED_CONSTANT_COUNT = 1; const size_t ALGEBRAIC_COUNT = 1; -const VariableInfo VOI_INFO = {"t", "second", "my_model", VARIABLE_OF_INTEGRATION}; +const VariableInfo VOI_INFO = {"t", "second", "my_model"}; const VariableInfo STATE_INFO[] = { - {"x", "dimensionless", "my_model", STATE} + {"x", "dimensionless", "my_model"} }; const VariableInfo CONSTANT_INFO[] = { }; const VariableInfo COMPUTED_CONSTANT_INFO[] = { - {"a", "per_s", "my_model", COMPUTED_CONSTANT} + {"a", "per_s", "my_model"} }; const VariableInfo ALGEBRAIC_INFO[] = { - {"xx", "dimensionless", "my_model", ALGEBRAIC} + {"xx", "dimensionless", "my_model"} }; double * createStatesArray() diff --git a/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.h b/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.h index 204f85667a..de15f76cf9 100644 --- a/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.h +++ b/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.h @@ -12,19 +12,10 @@ extern const size_t CONSTANT_COUNT; extern const size_t COMPUTED_CONSTANT_COUNT; extern const size_t ALGEBRAIC_COUNT; -typedef enum { - VARIABLE_OF_INTEGRATION, - STATE, - CONSTANT, - COMPUTED_CONSTANT, - ALGEBRAIC -} VariableType; - typedef struct { char name[3]; char units[14]; char component[9]; - VariableType type; } VariableInfo; extern const VariableInfo VOI_INFO; diff --git a/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.py b/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.py index 81450104a7..b20a4ecffb 100644 --- a/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.py +++ b/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.py @@ -12,29 +12,20 @@ COMPUTED_CONSTANT_COUNT = 1 ALGEBRAIC_COUNT = 1 +VOI_INFO = {"name": "t", "units": "second", "component": "my_model"} -class VariableType(Enum): - VARIABLE_OF_INTEGRATION = 0 - STATE = 1 - CONSTANT = 2 - COMPUTED_CONSTANT = 3 - ALGEBRAIC = 4 - - -VOI_INFO = {"name": "t", "units": "second", "component": "my_model", "type": VariableType.VARIABLE_OF_INTEGRATION} - -STATE_INFO = {"name": "x", "units": "dimensionless", "component": "my_model", "type": VariableType.STATE} +STATE_INFO = {"name": "x", "units": "dimensionless", "component": "my_model"} CONSTANT_INFO = [ ] COMPUTED_CONSTANT_INFO = [ - {"name": "a", "units": "per_s", "component": "my_model", "type": VariableType.COMPUTED_CONSTANT} + {"name": "a", "units": "per_s", "component": "my_model"} ] ALGEBRAIC_INFO = [ - {"name": "xx", "units": "dimensionless", "component": "my_model", "type": VariableType.ALGEBRAIC} + {"name": "xx", "units": "dimensionless", "component": "my_model"} ] diff --git a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.c b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.c index 9729fbf028..c03fdb7147 100644 --- a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.c +++ b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.c @@ -16,13 +16,13 @@ const VariableInfo CONSTANT_INFO[] = { }; const VariableInfo COMPUTED_CONSTANT_INFO[] = { - {"b", "dimensionless", "my_algebraic_eqn", COMPUTED_CONSTANT}, - {"c", "dimensionless", "my_algebraic_eqn", COMPUTED_CONSTANT}, - {"d", "dimensionless", "my_algebraic_eqn", COMPUTED_CONSTANT} + {"b", "dimensionless", "my_algebraic_eqn"}, + {"c", "dimensionless", "my_algebraic_eqn"}, + {"d", "dimensionless", "my_algebraic_eqn"} }; const VariableInfo ALGEBRAIC_INFO[] = { - {"a", "dimensionless", "my_algebraic_eqn", ALGEBRAIC} + {"a", "dimensionless", "my_algebraic_eqn"} }; double * createVariablesArray() diff --git a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.c b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.c index 0dc47b9c06..dfeff7ef99 100644 --- a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.c +++ b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.c @@ -17,16 +17,16 @@ const VariableInfo CONSTANT_INFO[] = { }; const VariableInfo COMPUTED_CONSTANT_INFO[] = { - {"b", "dimensionless", "my_algebraic_eqn", COMPUTED_CONSTANT}, - {"c", "dimensionless", "my_algebraic_eqn", COMPUTED_CONSTANT}, - {"d", "dimensionless", "my_algebraic_eqn", COMPUTED_CONSTANT} + {"b", "dimensionless", "my_algebraic_eqn"}, + {"c", "dimensionless", "my_algebraic_eqn"}, + {"d", "dimensionless", "my_algebraic_eqn"} }; const VariableInfo ALGEBRAIC_INFO[] = { }; const VariableInfo EXTERNAL_INFO[] = { - {"a", "dimensionless", "my_algebraic_eqn", EXTERNAL} + {"a", "dimensionless", "my_algebraic_eqn"} }; double * createVariablesArray() diff --git a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.h b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.h index da181acb28..ae517dbae9 100644 --- a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.h +++ b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.h @@ -12,18 +12,10 @@ extern const size_t COMPUTED_CONSTANT_COUNT; extern const size_t ALGEBRAIC_COUNT; extern const size_t EXTERNAL_COUNT; -typedef enum { - CONSTANT, - COMPUTED_CONSTANT, - ALGEBRAIC, - EXTERNAL -} VariableType; - typedef struct { char name[2]; char units[14]; char component[17]; - VariableType type; } VariableInfo; extern const VariableInfo CONSTANT_INFO[]; diff --git a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.py b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.py index abab654efe..c63f98fa9b 100644 --- a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.py +++ b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.py @@ -12,28 +12,20 @@ ALGEBRAIC_COUNT = 0 EXTERNAL_COUNT = 1 - -class VariableType(Enum): - CONSTANT = 0 - COMPUTED_CONSTANT = 1 - ALGEBRAIC = 2 - EXTERNAL = 3 - - CONSTANT_INFO = [ ] COMPUTED_CONSTANT_INFO = [ - {"name": "b", "units": "dimensionless", "component": "my_algebraic_eqn", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "c", "units": "dimensionless", "component": "my_algebraic_eqn", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "d", "units": "dimensionless", "component": "my_algebraic_eqn", "type": VariableType.COMPUTED_CONSTANT} + {"name": "b", "units": "dimensionless", "component": "my_algebraic_eqn"}, + {"name": "c", "units": "dimensionless", "component": "my_algebraic_eqn"}, + {"name": "d", "units": "dimensionless", "component": "my_algebraic_eqn"} ] ALGEBRAIC_INFO = [ ] EXTERNAL_INFO = [ - {"name": "a", "units": "dimensionless", "component": "my_algebraic_eqn", "type": VariableType.EXTERNAL} + {"name": "a", "units": "dimensionless", "component": "my_algebraic_eqn"} ] diff --git a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.h b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.h index a14bcb3994..e7483121b5 100644 --- a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.h +++ b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.h @@ -11,17 +11,10 @@ extern const size_t CONSTANT_COUNT; extern const size_t COMPUTED_CONSTANT_COUNT; extern const size_t ALGEBRAIC_COUNT; -typedef enum { - CONSTANT, - COMPUTED_CONSTANT, - ALGEBRAIC -} VariableType; - typedef struct { char name[2]; char units[14]; char component[17]; - VariableType type; } VariableInfo; extern const VariableInfo CONSTANT_INFO[]; diff --git a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.py b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.py index 47a6536efe..ac5049aa04 100644 --- a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.py +++ b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.py @@ -11,24 +11,17 @@ COMPUTED_CONSTANT_COUNT = 3 ALGEBRAIC_COUNT = 1 - -class VariableType(Enum): - CONSTANT = 0 - COMPUTED_CONSTANT = 1 - ALGEBRAIC = 2 - - CONSTANT_INFO = [ ] COMPUTED_CONSTANT_INFO = [ - {"name": "b", "units": "dimensionless", "component": "my_algebraic_eqn", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "c", "units": "dimensionless", "component": "my_algebraic_eqn", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "d", "units": "dimensionless", "component": "my_algebraic_eqn", "type": VariableType.COMPUTED_CONSTANT} + {"name": "b", "units": "dimensionless", "component": "my_algebraic_eqn"}, + {"name": "c", "units": "dimensionless", "component": "my_algebraic_eqn"}, + {"name": "d", "units": "dimensionless", "component": "my_algebraic_eqn"} ] ALGEBRAIC_INFO = [ - {"name": "a", "units": "dimensionless", "component": "my_algebraic_eqn", "type": VariableType.ALGEBRAIC} + {"name": "a", "units": "dimensionless", "component": "my_algebraic_eqn"} ] diff --git a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.c b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.c index 10613b8287..650710a25f 100644 --- a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.c +++ b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.c @@ -19,9 +19,9 @@ const VariableInfo COMPUTED_CONSTANT_INFO[] = { }; const VariableInfo ALGEBRAIC_INFO[] = { - {"x", "dimensionless", "my_algebraic_system", ALGEBRAIC}, - {"y", "dimensionless", "my_algebraic_system", ALGEBRAIC}, - {"z", "dimensionless", "my_algebraic_system", ALGEBRAIC} + {"x", "dimensionless", "my_algebraic_system"}, + {"y", "dimensionless", "my_algebraic_system"}, + {"z", "dimensionless", "my_algebraic_system"} }; double * createVariablesArray() diff --git a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.h b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.h index 6633bbe218..a8b4dbbcc0 100644 --- a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.h +++ b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.h @@ -11,17 +11,10 @@ extern const size_t CONSTANT_COUNT; extern const size_t COMPUTED_CONSTANT_COUNT; extern const size_t ALGEBRAIC_COUNT; -typedef enum { - CONSTANT, - COMPUTED_CONSTANT, - ALGEBRAIC -} VariableType; - typedef struct { char name[2]; char units[14]; char component[20]; - VariableType type; } VariableInfo; extern const VariableInfo CONSTANT_INFO[]; diff --git a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.py b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.py index 797157fd51..00c16f3985 100644 --- a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.py +++ b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.py @@ -11,13 +11,6 @@ COMPUTED_CONSTANT_COUNT = 0 ALGEBRAIC_COUNT = 3 - -class VariableType(Enum): - CONSTANT = 0 - COMPUTED_CONSTANT = 1 - ALGEBRAIC = 2 - - CONSTANT_INFO = [ ] @@ -25,9 +18,9 @@ class VariableType(Enum): ] ALGEBRAIC_INFO = [ - {"name": "x", "units": "dimensionless", "component": "my_algebraic_system", "type": VariableType.ALGEBRAIC}, - {"name": "y", "units": "dimensionless", "component": "my_algebraic_system", "type": VariableType.ALGEBRAIC}, - {"name": "z", "units": "dimensionless", "component": "my_algebraic_system", "type": VariableType.ALGEBRAIC} + {"name": "x", "units": "dimensionless", "component": "my_algebraic_system"}, + {"name": "y", "units": "dimensionless", "component": "my_algebraic_system"}, + {"name": "z", "units": "dimensionless", "component": "my_algebraic_system"} ] diff --git a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.c b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.c index 5596bf8a64..d2d15bfa5d 100644 --- a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.c +++ b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.c @@ -23,9 +23,9 @@ const VariableInfo ALGEBRAIC_INFO[] = { }; const VariableInfo EXTERNAL_INFO[] = { - {"x", "dimensionless", "my_algebraic_system", EXTERNAL}, - {"y", "dimensionless", "my_algebraic_system", EXTERNAL}, - {"z", "dimensionless", "my_algebraic_system", EXTERNAL} + {"x", "dimensionless", "my_algebraic_system"}, + {"y", "dimensionless", "my_algebraic_system"}, + {"z", "dimensionless", "my_algebraic_system"} }; double * createVariablesArray() diff --git a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.h b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.h index a2a7d679f7..7e21388caa 100644 --- a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.h +++ b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.h @@ -12,18 +12,10 @@ extern const size_t COMPUTED_CONSTANT_COUNT; extern const size_t ALGEBRAIC_COUNT; extern const size_t EXTERNAL_COUNT; -typedef enum { - CONSTANT, - COMPUTED_CONSTANT, - ALGEBRAIC, - EXTERNAL -} VariableType; - typedef struct { char name[2]; char units[14]; char component[20]; - VariableType type; } VariableInfo; extern const VariableInfo CONSTANT_INFO[]; diff --git a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.py b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.py index 63ee6d6d85..bc87f93445 100644 --- a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.py +++ b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.py @@ -12,14 +12,6 @@ ALGEBRAIC_COUNT = 0 EXTERNAL_COUNT = 3 - -class VariableType(Enum): - CONSTANT = 0 - COMPUTED_CONSTANT = 1 - ALGEBRAIC = 2 - EXTERNAL = 3 - - CONSTANT_INFO = [ ] @@ -30,9 +22,9 @@ class VariableType(Enum): ] EXTERNAL_INFO = [ - {"name": "x", "units": "dimensionless", "component": "my_algebraic_system", "type": VariableType.EXTERNAL}, - {"name": "y", "units": "dimensionless", "component": "my_algebraic_system", "type": VariableType.EXTERNAL}, - {"name": "z", "units": "dimensionless", "component": "my_algebraic_system", "type": VariableType.EXTERNAL} + {"name": "x", "units": "dimensionless", "component": "my_algebraic_system"}, + {"name": "y", "units": "dimensionless", "component": "my_algebraic_system"}, + {"name": "z", "units": "dimensionless", "component": "my_algebraic_system"} ] diff --git a/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.c b/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.c index 4cebe90c97..feb3430edb 100644 --- a/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.c +++ b/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.c @@ -13,18 +13,18 @@ const size_t COMPUTED_CONSTANT_COUNT = 1; const size_t ALGEBRAIC_COUNT = 3; const VariableInfo CONSTANT_INFO[] = { - {"x", "dimensionless", "my_algebraic_system", CONSTANT}, - {"y", "dimensionless", "my_algebraic_system", CONSTANT} + {"x", "dimensionless", "my_algebraic_system"}, + {"y", "dimensionless", "my_algebraic_system"} }; const VariableInfo COMPUTED_CONSTANT_INFO[] = { - {"a", "dimensionless", "my_algebraic_system", COMPUTED_CONSTANT} + {"a", "dimensionless", "my_algebraic_system"} }; const VariableInfo ALGEBRAIC_INFO[] = { - {"d", "dimensionless", "my_algebraic_system", ALGEBRAIC}, - {"b", "dimensionless", "my_algebraic_system", ALGEBRAIC}, - {"c", "dimensionless", "my_algebraic_system", ALGEBRAIC} + {"d", "dimensionless", "my_algebraic_system"}, + {"b", "dimensionless", "my_algebraic_system"}, + {"c", "dimensionless", "my_algebraic_system"} }; double * createVariablesArray() diff --git a/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.h b/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.h index 6633bbe218..a8b4dbbcc0 100644 --- a/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.h +++ b/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.h @@ -11,17 +11,10 @@ extern const size_t CONSTANT_COUNT; extern const size_t COMPUTED_CONSTANT_COUNT; extern const size_t ALGEBRAIC_COUNT; -typedef enum { - CONSTANT, - COMPUTED_CONSTANT, - ALGEBRAIC -} VariableType; - typedef struct { char name[2]; char units[14]; char component[20]; - VariableType type; } VariableInfo; extern const VariableInfo CONSTANT_INFO[]; diff --git a/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.py b/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.py index 4c2a52ea36..4c438c3f1b 100644 --- a/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.py +++ b/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.py @@ -11,26 +11,19 @@ COMPUTED_CONSTANT_COUNT = 1 ALGEBRAIC_COUNT = 3 - -class VariableType(Enum): - CONSTANT = 0 - COMPUTED_CONSTANT = 1 - ALGEBRAIC = 2 - - CONSTANT_INFO = [ - {"name": "x", "units": "dimensionless", "component": "my_algebraic_system", "type": VariableType.CONSTANT}, - {"name": "y", "units": "dimensionless", "component": "my_algebraic_system", "type": VariableType.CONSTANT} + {"name": "x", "units": "dimensionless", "component": "my_algebraic_system"}, + {"name": "y", "units": "dimensionless", "component": "my_algebraic_system"} ] COMPUTED_CONSTANT_INFO = [ - {"name": "a", "units": "dimensionless", "component": "my_algebraic_system", "type": VariableType.COMPUTED_CONSTANT} + {"name": "a", "units": "dimensionless", "component": "my_algebraic_system"} ] ALGEBRAIC_INFO = [ - {"name": "d", "units": "dimensionless", "component": "my_algebraic_system", "type": VariableType.ALGEBRAIC}, - {"name": "b", "units": "dimensionless", "component": "my_algebraic_system", "type": VariableType.ALGEBRAIC}, - {"name": "c", "units": "dimensionless", "component": "my_algebraic_system", "type": VariableType.ALGEBRAIC} + {"name": "d", "units": "dimensionless", "component": "my_algebraic_system"}, + {"name": "b", "units": "dimensionless", "component": "my_algebraic_system"}, + {"name": "c", "units": "dimensionless", "component": "my_algebraic_system"} ] diff --git a/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.c b/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.c index bb02166a70..48ed210ade 100644 --- a/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.c +++ b/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.c @@ -13,18 +13,18 @@ const size_t COMPUTED_CONSTANT_COUNT = 1; const size_t ALGEBRAIC_COUNT = 3; const VariableInfo CONSTANT_INFO[] = { - {"x", "dimensionless", "my_algebraic_system", CONSTANT}, - {"y", "dimensionless", "my_algebraic_system", CONSTANT} + {"x", "dimensionless", "my_algebraic_system"}, + {"y", "dimensionless", "my_algebraic_system"} }; const VariableInfo COMPUTED_CONSTANT_INFO[] = { - {"a", "dimensionless", "my_algebraic_system", COMPUTED_CONSTANT} + {"a", "dimensionless", "my_algebraic_system"} }; const VariableInfo ALGEBRAIC_INFO[] = { - {"c", "dimensionless", "my_algebraic_system", ALGEBRAIC}, - {"b", "dimensionless", "my_algebraic_system", ALGEBRAIC}, - {"d", "dimensionless", "my_algebraic_system", ALGEBRAIC} + {"c", "dimensionless", "my_algebraic_system"}, + {"b", "dimensionless", "my_algebraic_system"}, + {"d", "dimensionless", "my_algebraic_system"} }; double * createVariablesArray() diff --git a/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.h b/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.h index 6633bbe218..a8b4dbbcc0 100644 --- a/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.h +++ b/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.h @@ -11,17 +11,10 @@ extern const size_t CONSTANT_COUNT; extern const size_t COMPUTED_CONSTANT_COUNT; extern const size_t ALGEBRAIC_COUNT; -typedef enum { - CONSTANT, - COMPUTED_CONSTANT, - ALGEBRAIC -} VariableType; - typedef struct { char name[2]; char units[14]; char component[20]; - VariableType type; } VariableInfo; extern const VariableInfo CONSTANT_INFO[]; diff --git a/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.py b/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.py index 232ab46ef2..d58855d92d 100644 --- a/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.py +++ b/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.py @@ -11,26 +11,19 @@ COMPUTED_CONSTANT_COUNT = 1 ALGEBRAIC_COUNT = 3 - -class VariableType(Enum): - CONSTANT = 0 - COMPUTED_CONSTANT = 1 - ALGEBRAIC = 2 - - CONSTANT_INFO = [ - {"name": "x", "units": "dimensionless", "component": "my_algebraic_system", "type": VariableType.CONSTANT}, - {"name": "y", "units": "dimensionless", "component": "my_algebraic_system", "type": VariableType.CONSTANT} + {"name": "x", "units": "dimensionless", "component": "my_algebraic_system"}, + {"name": "y", "units": "dimensionless", "component": "my_algebraic_system"} ] COMPUTED_CONSTANT_INFO = [ - {"name": "a", "units": "dimensionless", "component": "my_algebraic_system", "type": VariableType.COMPUTED_CONSTANT} + {"name": "a", "units": "dimensionless", "component": "my_algebraic_system"} ] ALGEBRAIC_INFO = [ - {"name": "c", "units": "dimensionless", "component": "my_algebraic_system", "type": VariableType.ALGEBRAIC}, - {"name": "b", "units": "dimensionless", "component": "my_algebraic_system", "type": VariableType.ALGEBRAIC}, - {"name": "d", "units": "dimensionless", "component": "my_algebraic_system", "type": VariableType.ALGEBRAIC} + {"name": "c", "units": "dimensionless", "component": "my_algebraic_system"}, + {"name": "b", "units": "dimensionless", "component": "my_algebraic_system"}, + {"name": "d", "units": "dimensionless", "component": "my_algebraic_system"} ] diff --git a/tests/resources/generator/algebraic_unknown_var_on_rhs/model.c b/tests/resources/generator/algebraic_unknown_var_on_rhs/model.c index d53d3e1fd0..8bfb7a585d 100644 --- a/tests/resources/generator/algebraic_unknown_var_on_rhs/model.c +++ b/tests/resources/generator/algebraic_unknown_var_on_rhs/model.c @@ -16,8 +16,8 @@ const VariableInfo CONSTANT_INFO[] = { }; const VariableInfo COMPUTED_CONSTANT_INFO[] = { - {"x", "dimensionless", "my_component", COMPUTED_CONSTANT}, - {"y", "dimensionless", "my_component", COMPUTED_CONSTANT} + {"x", "dimensionless", "my_component"}, + {"y", "dimensionless", "my_component"} }; const VariableInfo ALGEBRAIC_INFO[] = { diff --git a/tests/resources/generator/algebraic_unknown_var_on_rhs/model.h b/tests/resources/generator/algebraic_unknown_var_on_rhs/model.h index 2e7b0dd0b1..c22b338947 100644 --- a/tests/resources/generator/algebraic_unknown_var_on_rhs/model.h +++ b/tests/resources/generator/algebraic_unknown_var_on_rhs/model.h @@ -11,17 +11,10 @@ extern const size_t CONSTANT_COUNT; extern const size_t COMPUTED_CONSTANT_COUNT; extern const size_t ALGEBRAIC_COUNT; -typedef enum { - CONSTANT, - COMPUTED_CONSTANT, - ALGEBRAIC -} VariableType; - typedef struct { char name[2]; char units[14]; char component[13]; - VariableType type; } VariableInfo; extern const VariableInfo CONSTANT_INFO[]; diff --git a/tests/resources/generator/algebraic_unknown_var_on_rhs/model.py b/tests/resources/generator/algebraic_unknown_var_on_rhs/model.py index 9b2aca6711..0740ee0de4 100644 --- a/tests/resources/generator/algebraic_unknown_var_on_rhs/model.py +++ b/tests/resources/generator/algebraic_unknown_var_on_rhs/model.py @@ -11,19 +11,12 @@ COMPUTED_CONSTANT_COUNT = 2 ALGEBRAIC_COUNT = 0 - -class VariableType(Enum): - CONSTANT = 0 - COMPUTED_CONSTANT = 1 - ALGEBRAIC = 2 - - CONSTANT_INFO = [ ] COMPUTED_CONSTANT_INFO = [ - {"name": "x", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "y", "units": "dimensionless", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT} + {"name": "x", "units": "dimensionless", "component": "my_component"}, + {"name": "y", "units": "dimensionless", "component": "my_component"} ] ALGEBRAIC_INFO = [ diff --git a/tests/resources/generator/cell_geometry_model/model.c b/tests/resources/generator/cell_geometry_model/model.c index 48d3bfc777..a4bb58334d 100644 --- a/tests/resources/generator/cell_geometry_model/model.c +++ b/tests/resources/generator/cell_geometry_model/model.c @@ -13,13 +13,13 @@ const size_t COMPUTED_CONSTANT_COUNT = 2; const size_t ALGEBRAIC_COUNT = 0; const VariableInfo CONSTANT_INFO[] = { - {"L", "centimeter", "cell_geometry", CONSTANT}, - {"rad", "centimeter", "cell_geometry", CONSTANT} + {"L", "centimeter", "cell_geometry"}, + {"rad", "centimeter", "cell_geometry"} }; const VariableInfo COMPUTED_CONSTANT_INFO[] = { - {"vcell", "microlitre", "cell_geometry", COMPUTED_CONSTANT}, - {"vss", "microlitre", "cell_geometry", COMPUTED_CONSTANT} + {"vcell", "microlitre", "cell_geometry"}, + {"vss", "microlitre", "cell_geometry"} }; const VariableInfo ALGEBRAIC_INFO[] = { diff --git a/tests/resources/generator/cell_geometry_model/model.external.c b/tests/resources/generator/cell_geometry_model/model.external.c index 1ca71d6f68..7a5964bc53 100644 --- a/tests/resources/generator/cell_geometry_model/model.external.c +++ b/tests/resources/generator/cell_geometry_model/model.external.c @@ -20,13 +20,13 @@ const VariableInfo COMPUTED_CONSTANT_INFO[] = { }; const VariableInfo ALGEBRAIC_INFO[] = { - {"vcell", "microlitre", "cell_geometry", ALGEBRAIC}, - {"vss", "microlitre", "cell_geometry", ALGEBRAIC} + {"vcell", "microlitre", "cell_geometry"}, + {"vss", "microlitre", "cell_geometry"} }; const VariableInfo EXTERNAL_INFO[] = { - {"L", "centimeter", "cell_geometry", EXTERNAL}, - {"rad", "centimeter", "cell_geometry", EXTERNAL} + {"L", "centimeter", "cell_geometry"}, + {"rad", "centimeter", "cell_geometry"} }; double * createVariablesArray() diff --git a/tests/resources/generator/cell_geometry_model/model.external.h b/tests/resources/generator/cell_geometry_model/model.external.h index 84cfc4521f..36d3e18222 100644 --- a/tests/resources/generator/cell_geometry_model/model.external.h +++ b/tests/resources/generator/cell_geometry_model/model.external.h @@ -12,18 +12,10 @@ extern const size_t COMPUTED_CONSTANT_COUNT; extern const size_t ALGEBRAIC_COUNT; extern const size_t EXTERNAL_COUNT; -typedef enum { - CONSTANT, - COMPUTED_CONSTANT, - ALGEBRAIC, - EXTERNAL -} VariableType; - typedef struct { char name[6]; char units[11]; char component[14]; - VariableType type; } VariableInfo; extern const VariableInfo CONSTANT_INFO[]; diff --git a/tests/resources/generator/cell_geometry_model/model.external.py b/tests/resources/generator/cell_geometry_model/model.external.py index 15e494636e..aa3d00363b 100644 --- a/tests/resources/generator/cell_geometry_model/model.external.py +++ b/tests/resources/generator/cell_geometry_model/model.external.py @@ -12,14 +12,6 @@ ALGEBRAIC_COUNT = 2 EXTERNAL_COUNT = 2 - -class VariableType(Enum): - CONSTANT = 0 - COMPUTED_CONSTANT = 1 - ALGEBRAIC = 2 - EXTERNAL = 3 - - CONSTANT_INFO = [ ] @@ -27,13 +19,13 @@ class VariableType(Enum): ] ALGEBRAIC_INFO = [ - {"name": "vcell", "units": "microlitre", "component": "cell_geometry", "type": VariableType.ALGEBRAIC}, - {"name": "vss", "units": "microlitre", "component": "cell_geometry", "type": VariableType.ALGEBRAIC} + {"name": "vcell", "units": "microlitre", "component": "cell_geometry"}, + {"name": "vss", "units": "microlitre", "component": "cell_geometry"} ] EXTERNAL_INFO = [ - {"name": "L", "units": "centimeter", "component": "cell_geometry", "type": VariableType.EXTERNAL}, - {"name": "rad", "units": "centimeter", "component": "cell_geometry", "type": VariableType.EXTERNAL} + {"name": "L", "units": "centimeter", "component": "cell_geometry"}, + {"name": "rad", "units": "centimeter", "component": "cell_geometry"} ] diff --git a/tests/resources/generator/cell_geometry_model/model.h b/tests/resources/generator/cell_geometry_model/model.h index 9dc3b94992..687403023c 100644 --- a/tests/resources/generator/cell_geometry_model/model.h +++ b/tests/resources/generator/cell_geometry_model/model.h @@ -11,17 +11,10 @@ extern const size_t CONSTANT_COUNT; extern const size_t COMPUTED_CONSTANT_COUNT; extern const size_t ALGEBRAIC_COUNT; -typedef enum { - CONSTANT, - COMPUTED_CONSTANT, - ALGEBRAIC -} VariableType; - typedef struct { char name[6]; char units[11]; char component[14]; - VariableType type; } VariableInfo; extern const VariableInfo CONSTANT_INFO[]; diff --git a/tests/resources/generator/cell_geometry_model/model.py b/tests/resources/generator/cell_geometry_model/model.py index 1ef05bdede..4ba53cbccb 100644 --- a/tests/resources/generator/cell_geometry_model/model.py +++ b/tests/resources/generator/cell_geometry_model/model.py @@ -11,21 +11,14 @@ COMPUTED_CONSTANT_COUNT = 2 ALGEBRAIC_COUNT = 0 - -class VariableType(Enum): - CONSTANT = 0 - COMPUTED_CONSTANT = 1 - ALGEBRAIC = 2 - - CONSTANT_INFO = [ - {"name": "L", "units": "centimeter", "component": "cell_geometry", "type": VariableType.CONSTANT}, - {"name": "rad", "units": "centimeter", "component": "cell_geometry", "type": VariableType.CONSTANT} + {"name": "L", "units": "centimeter", "component": "cell_geometry"}, + {"name": "rad", "units": "centimeter", "component": "cell_geometry"} ] COMPUTED_CONSTANT_INFO = [ - {"name": "vcell", "units": "microlitre", "component": "cell_geometry", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "vss", "units": "microlitre", "component": "cell_geometry", "type": VariableType.COMPUTED_CONSTANT} + {"name": "vcell", "units": "microlitre", "component": "cell_geometry"}, + {"name": "vss", "units": "microlitre", "component": "cell_geometry"} ] ALGEBRAIC_INFO = [ diff --git a/tests/resources/generator/cellml_mappings_and_encapsulations/model.c b/tests/resources/generator/cellml_mappings_and_encapsulations/model.c index f304992cb6..5bb0dea81b 100644 --- a/tests/resources/generator/cellml_mappings_and_encapsulations/model.c +++ b/tests/resources/generator/cellml_mappings_and_encapsulations/model.c @@ -13,11 +13,11 @@ const size_t CONSTANT_COUNT = 0; const size_t COMPUTED_CONSTANT_COUNT = 0; const size_t ALGEBRAIC_COUNT = 2; -const VariableInfo VOI_INFO = {"t", "ms", "environment", VARIABLE_OF_INTEGRATION}; +const VariableInfo VOI_INFO = {"t", "ms", "environment"}; const VariableInfo STATE_INFO[] = { - {"y", "mM", "circle_y_implementation", STATE}, - {"x", "mM", "circle_x", STATE} + {"y", "mM", "circle_y_implementation"}, + {"x", "mM", "circle_x"} }; const VariableInfo CONSTANT_INFO[] = { @@ -27,8 +27,8 @@ const VariableInfo COMPUTED_CONSTANT_INFO[] = { }; const VariableInfo ALGEBRAIC_INFO[] = { - {"local_complex_maths", "mM", "circle_sibling", ALGEBRAIC}, - {"two_x", "milli_mole", "circle_x_sibling", ALGEBRAIC} + {"local_complex_maths", "mM", "circle_sibling"}, + {"two_x", "milli_mole", "circle_x_sibling"} }; double * createStatesArray() diff --git a/tests/resources/generator/cellml_mappings_and_encapsulations/model.h b/tests/resources/generator/cellml_mappings_and_encapsulations/model.h index 9719caec08..ad9e483ac2 100644 --- a/tests/resources/generator/cellml_mappings_and_encapsulations/model.h +++ b/tests/resources/generator/cellml_mappings_and_encapsulations/model.h @@ -12,19 +12,10 @@ extern const size_t CONSTANT_COUNT; extern const size_t COMPUTED_CONSTANT_COUNT; extern const size_t ALGEBRAIC_COUNT; -typedef enum { - VARIABLE_OF_INTEGRATION, - STATE, - CONSTANT, - COMPUTED_CONSTANT, - ALGEBRAIC -} VariableType; - typedef struct { char name[20]; char units[11]; char component[24]; - VariableType type; } VariableInfo; extern const VariableInfo VOI_INFO; diff --git a/tests/resources/generator/cellml_mappings_and_encapsulations/model.py b/tests/resources/generator/cellml_mappings_and_encapsulations/model.py index 745325178c..21fd05b38f 100644 --- a/tests/resources/generator/cellml_mappings_and_encapsulations/model.py +++ b/tests/resources/generator/cellml_mappings_and_encapsulations/model.py @@ -12,19 +12,10 @@ COMPUTED_CONSTANT_COUNT = 0 ALGEBRAIC_COUNT = 2 +VOI_INFO = {"name": "t", "units": "ms", "component": "environment"} -class VariableType(Enum): - VARIABLE_OF_INTEGRATION = 0 - STATE = 1 - CONSTANT = 2 - COMPUTED_CONSTANT = 3 - ALGEBRAIC = 4 - - -VOI_INFO = {"name": "t", "units": "ms", "component": "environment", "type": VariableType.VARIABLE_OF_INTEGRATION} - -STATE_INFO = {"name": "y", "units": "mM", "component": "circle_y_implementation", "type": VariableType.STATE}, - {"name": "x", "units": "mM", "component": "circle_x", "type": VariableType.STATE} +STATE_INFO = {"name": "y", "units": "mM", "component": "circle_y_implementation"}, + {"name": "x", "units": "mM", "component": "circle_x"} CONSTANT_INFO = [ @@ -34,8 +25,8 @@ class VariableType(Enum): ] ALGEBRAIC_INFO = [ - {"name": "local_complex_maths", "units": "mM", "component": "circle_sibling", "type": VariableType.ALGEBRAIC}, - {"name": "two_x", "units": "milli_mole", "component": "circle_x_sibling", "type": VariableType.ALGEBRAIC} + {"name": "local_complex_maths", "units": "mM", "component": "circle_sibling"}, + {"name": "two_x", "units": "milli_mole", "component": "circle_x_sibling"} ] diff --git a/tests/resources/generator/cellml_slc_example/model.py b/tests/resources/generator/cellml_slc_example/model.py index cf83a22619..e75683666e 100644 --- a/tests/resources/generator/cellml_slc_example/model.py +++ b/tests/resources/generator/cellml_slc_example/model.py @@ -11,27 +11,20 @@ COMPUTED_CONSTANT_COUNT = 1 ALGEBRAIC_COUNT = 0 - -class VariableType(Enum): - CONSTANT = 0 - COMPUTED_CONSTANT = 1 - ALGEBRAIC = 2 - - CONSTANT_INFO = [ - {"name": "E", "units": "fmol", "component": "SLC_template3_ss", "type": VariableType.CONSTANT}, - {"name": "P_0", "units": "per_fmol_sec4", "component": "SLC_template3_ss", "type": VariableType.CONSTANT}, - {"name": "q_Ao", "units": "fmol", "component": "SLC_template3_ss", "type": VariableType.CONSTANT}, - {"name": "P_1", "units": "per_fmol_sec4", "component": "SLC_template3_ss", "type": VariableType.CONSTANT}, - {"name": "q_Ai", "units": "fmol", "component": "SLC_template3_ss", "type": VariableType.CONSTANT}, - {"name": "P_2", "units": "per_fmol_sec3", "component": "SLC_template3_ss", "type": VariableType.CONSTANT}, - {"name": "P_5", "units": "per_sec3", "component": "SLC_template3_ss", "type": VariableType.CONSTANT}, - {"name": "P_4", "units": "per_fmol2_sec3", "component": "SLC_template3_ss", "type": VariableType.CONSTANT}, - {"name": "P_3", "units": "per_fmol_sec3", "component": "SLC_template3_ss", "type": VariableType.CONSTANT} + {"name": "E", "units": "fmol", "component": "SLC_template3_ss"}, + {"name": "P_0", "units": "per_fmol_sec4", "component": "SLC_template3_ss"}, + {"name": "q_Ao", "units": "fmol", "component": "SLC_template3_ss"}, + {"name": "P_1", "units": "per_fmol_sec4", "component": "SLC_template3_ss"}, + {"name": "q_Ai", "units": "fmol", "component": "SLC_template3_ss"}, + {"name": "P_2", "units": "per_fmol_sec3", "component": "SLC_template3_ss"}, + {"name": "P_5", "units": "per_sec3", "component": "SLC_template3_ss"}, + {"name": "P_4", "units": "per_fmol2_sec3", "component": "SLC_template3_ss"}, + {"name": "P_3", "units": "per_fmol_sec3", "component": "SLC_template3_ss"} ] COMPUTED_CONSTANT_INFO = [ - {"name": "v", "units": "fmol_per_sec", "component": "SLC_template3_ss", "type": VariableType.COMPUTED_CONSTANT} + {"name": "v", "units": "fmol_per_sec", "component": "SLC_template3_ss"} ] ALGEBRAIC_INFO = [ diff --git a/tests/resources/generator/cellml_state_initialised_using_variable/model.c b/tests/resources/generator/cellml_state_initialised_using_variable/model.c index cf52db26bc..074a5a21bd 100644 --- a/tests/resources/generator/cellml_state_initialised_using_variable/model.c +++ b/tests/resources/generator/cellml_state_initialised_using_variable/model.c @@ -13,14 +13,14 @@ const size_t CONSTANT_COUNT = 1; const size_t COMPUTED_CONSTANT_COUNT = 0; const size_t ALGEBRAIC_COUNT = 0; -const VariableInfo VOI_INFO = {"t", "ms", "environment", VARIABLE_OF_INTEGRATION}; +const VariableInfo VOI_INFO = {"t", "ms", "environment"}; const VariableInfo STATE_INFO[] = { - {"x", "mV", "main", STATE} + {"x", "mV", "main"} }; const VariableInfo CONSTANT_INFO[] = { - {"k", "mV", "constants", CONSTANT} + {"k", "mV", "constants"} }; const VariableInfo COMPUTED_CONSTANT_INFO[] = { diff --git a/tests/resources/generator/cellml_state_initialised_using_variable/model.h b/tests/resources/generator/cellml_state_initialised_using_variable/model.h index 4209283480..b05828f9b0 100644 --- a/tests/resources/generator/cellml_state_initialised_using_variable/model.h +++ b/tests/resources/generator/cellml_state_initialised_using_variable/model.h @@ -12,19 +12,10 @@ extern const size_t CONSTANT_COUNT; extern const size_t COMPUTED_CONSTANT_COUNT; extern const size_t ALGEBRAIC_COUNT; -typedef enum { - VARIABLE_OF_INTEGRATION, - STATE, - CONSTANT, - COMPUTED_CONSTANT, - ALGEBRAIC -} VariableType; - typedef struct { char name[2]; char units[3]; char component[12]; - VariableType type; } VariableInfo; extern const VariableInfo VOI_INFO; diff --git a/tests/resources/generator/cellml_state_initialised_using_variable/model.py b/tests/resources/generator/cellml_state_initialised_using_variable/model.py index f32c24fe01..0a0aa2864f 100644 --- a/tests/resources/generator/cellml_state_initialised_using_variable/model.py +++ b/tests/resources/generator/cellml_state_initialised_using_variable/model.py @@ -12,22 +12,13 @@ COMPUTED_CONSTANT_COUNT = 0 ALGEBRAIC_COUNT = 0 +VOI_INFO = {"name": "t", "units": "ms", "component": "environment"} -class VariableType(Enum): - VARIABLE_OF_INTEGRATION = 0 - STATE = 1 - CONSTANT = 2 - COMPUTED_CONSTANT = 3 - ALGEBRAIC = 4 - - -VOI_INFO = {"name": "t", "units": "ms", "component": "environment", "type": VariableType.VARIABLE_OF_INTEGRATION} - -STATE_INFO = {"name": "x", "units": "mV", "component": "main", "type": VariableType.STATE} +STATE_INFO = {"name": "x", "units": "mV", "component": "main"} CONSTANT_INFO = [ - {"name": "k", "units": "mV", "component": "constants", "type": VariableType.CONSTANT} + {"name": "k", "units": "mV", "component": "constants"} ] COMPUTED_CONSTANT_INFO = [ diff --git a/tests/resources/generator/cellml_unit_scaling_constant/model.c b/tests/resources/generator/cellml_unit_scaling_constant/model.c index a3494f54db..cabb1e7285 100644 --- a/tests/resources/generator/cellml_unit_scaling_constant/model.c +++ b/tests/resources/generator/cellml_unit_scaling_constant/model.c @@ -13,12 +13,12 @@ const size_t COMPUTED_CONSTANT_COUNT = 2; const size_t ALGEBRAIC_COUNT = 0; const VariableInfo CONSTANT_INFO[] = { - {"k", "mM", "constants", CONSTANT} + {"k", "mM", "constants"} }; const VariableInfo COMPUTED_CONSTANT_INFO[] = { - {"x", "mM", "main", COMPUTED_CONSTANT}, - {"y", "M", "main", COMPUTED_CONSTANT} + {"x", "mM", "main"}, + {"y", "M", "main"} }; const VariableInfo ALGEBRAIC_INFO[] = { diff --git a/tests/resources/generator/cellml_unit_scaling_constant/model.h b/tests/resources/generator/cellml_unit_scaling_constant/model.h index 2e51e8fd10..1fff52ad98 100644 --- a/tests/resources/generator/cellml_unit_scaling_constant/model.h +++ b/tests/resources/generator/cellml_unit_scaling_constant/model.h @@ -11,17 +11,10 @@ extern const size_t CONSTANT_COUNT; extern const size_t COMPUTED_CONSTANT_COUNT; extern const size_t ALGEBRAIC_COUNT; -typedef enum { - CONSTANT, - COMPUTED_CONSTANT, - ALGEBRAIC -} VariableType; - typedef struct { char name[2]; char units[3]; char component[10]; - VariableType type; } VariableInfo; extern const VariableInfo CONSTANT_INFO[]; diff --git a/tests/resources/generator/cellml_unit_scaling_constant/model.py b/tests/resources/generator/cellml_unit_scaling_constant/model.py index bc4e24cb43..02d595b20a 100644 --- a/tests/resources/generator/cellml_unit_scaling_constant/model.py +++ b/tests/resources/generator/cellml_unit_scaling_constant/model.py @@ -11,20 +11,13 @@ COMPUTED_CONSTANT_COUNT = 2 ALGEBRAIC_COUNT = 0 - -class VariableType(Enum): - CONSTANT = 0 - COMPUTED_CONSTANT = 1 - ALGEBRAIC = 2 - - CONSTANT_INFO = [ - {"name": "k", "units": "mM", "component": "constants", "type": VariableType.CONSTANT} + {"name": "k", "units": "mM", "component": "constants"} ] COMPUTED_CONSTANT_INFO = [ - {"name": "x", "units": "mM", "component": "main", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "y", "units": "M", "component": "main", "type": VariableType.COMPUTED_CONSTANT} + {"name": "x", "units": "mM", "component": "main"}, + {"name": "y", "units": "M", "component": "main"} ] ALGEBRAIC_INFO = [ diff --git a/tests/resources/generator/cellml_unit_scaling_rate/model.c b/tests/resources/generator/cellml_unit_scaling_rate/model.c index 302ea642f2..c0529e1dc5 100644 --- a/tests/resources/generator/cellml_unit_scaling_rate/model.c +++ b/tests/resources/generator/cellml_unit_scaling_rate/model.c @@ -13,10 +13,10 @@ const size_t CONSTANT_COUNT = 0; const size_t COMPUTED_CONSTANT_COUNT = 0; const size_t ALGEBRAIC_COUNT = 2; -const VariableInfo VOI_INFO = {"t", "ms", "environment", VARIABLE_OF_INTEGRATION}; +const VariableInfo VOI_INFO = {"t", "ms", "environment"}; const VariableInfo STATE_INFO[] = { - {"k", "mM", "states", STATE} + {"k", "mM", "states"} }; const VariableInfo CONSTANT_INFO[] = { @@ -26,8 +26,8 @@ const VariableInfo COMPUTED_CONSTANT_INFO[] = { }; const VariableInfo ALGEBRAIC_INFO[] = { - {"x", "mM", "main", ALGEBRAIC}, - {"y", "M", "main", ALGEBRAIC} + {"x", "mM", "main"}, + {"y", "M", "main"} }; double * createStatesArray() diff --git a/tests/resources/generator/cellml_unit_scaling_rate/model.h b/tests/resources/generator/cellml_unit_scaling_rate/model.h index 4209283480..b05828f9b0 100644 --- a/tests/resources/generator/cellml_unit_scaling_rate/model.h +++ b/tests/resources/generator/cellml_unit_scaling_rate/model.h @@ -12,19 +12,10 @@ extern const size_t CONSTANT_COUNT; extern const size_t COMPUTED_CONSTANT_COUNT; extern const size_t ALGEBRAIC_COUNT; -typedef enum { - VARIABLE_OF_INTEGRATION, - STATE, - CONSTANT, - COMPUTED_CONSTANT, - ALGEBRAIC -} VariableType; - typedef struct { char name[2]; char units[3]; char component[12]; - VariableType type; } VariableInfo; extern const VariableInfo VOI_INFO; diff --git a/tests/resources/generator/cellml_unit_scaling_rate/model.py b/tests/resources/generator/cellml_unit_scaling_rate/model.py index 4a031e2530..536b041ddc 100644 --- a/tests/resources/generator/cellml_unit_scaling_rate/model.py +++ b/tests/resources/generator/cellml_unit_scaling_rate/model.py @@ -12,18 +12,9 @@ COMPUTED_CONSTANT_COUNT = 0 ALGEBRAIC_COUNT = 2 +VOI_INFO = {"name": "t", "units": "ms", "component": "environment"} -class VariableType(Enum): - VARIABLE_OF_INTEGRATION = 0 - STATE = 1 - CONSTANT = 2 - COMPUTED_CONSTANT = 3 - ALGEBRAIC = 4 - - -VOI_INFO = {"name": "t", "units": "ms", "component": "environment", "type": VariableType.VARIABLE_OF_INTEGRATION} - -STATE_INFO = {"name": "k", "units": "mM", "component": "states", "type": VariableType.STATE} +STATE_INFO = {"name": "k", "units": "mM", "component": "states"} CONSTANT_INFO = [ @@ -33,8 +24,8 @@ class VariableType(Enum): ] ALGEBRAIC_INFO = [ - {"name": "x", "units": "mM", "component": "main", "type": VariableType.ALGEBRAIC}, - {"name": "y", "units": "M", "component": "main", "type": VariableType.ALGEBRAIC} + {"name": "x", "units": "mM", "component": "main"}, + {"name": "y", "units": "M", "component": "main"} ] diff --git a/tests/resources/generator/cellml_unit_scaling_state/model.c b/tests/resources/generator/cellml_unit_scaling_state/model.c index 550d7ad85f..f2664b5fae 100644 --- a/tests/resources/generator/cellml_unit_scaling_state/model.c +++ b/tests/resources/generator/cellml_unit_scaling_state/model.c @@ -13,10 +13,10 @@ const size_t CONSTANT_COUNT = 0; const size_t COMPUTED_CONSTANT_COUNT = 0; const size_t ALGEBRAIC_COUNT = 2; -const VariableInfo VOI_INFO = {"t", "ms", "environment", VARIABLE_OF_INTEGRATION}; +const VariableInfo VOI_INFO = {"t", "ms", "environment"}; const VariableInfo STATE_INFO[] = { - {"k", "mM", "states", STATE} + {"k", "mM", "states"} }; const VariableInfo CONSTANT_INFO[] = { @@ -26,8 +26,8 @@ const VariableInfo COMPUTED_CONSTANT_INFO[] = { }; const VariableInfo ALGEBRAIC_INFO[] = { - {"x", "mM", "main", ALGEBRAIC}, - {"y", "M", "main", ALGEBRAIC} + {"x", "mM", "main"}, + {"y", "M", "main"} }; double * createStatesArray() diff --git a/tests/resources/generator/cellml_unit_scaling_state/model.h b/tests/resources/generator/cellml_unit_scaling_state/model.h index 4209283480..b05828f9b0 100644 --- a/tests/resources/generator/cellml_unit_scaling_state/model.h +++ b/tests/resources/generator/cellml_unit_scaling_state/model.h @@ -12,19 +12,10 @@ extern const size_t CONSTANT_COUNT; extern const size_t COMPUTED_CONSTANT_COUNT; extern const size_t ALGEBRAIC_COUNT; -typedef enum { - VARIABLE_OF_INTEGRATION, - STATE, - CONSTANT, - COMPUTED_CONSTANT, - ALGEBRAIC -} VariableType; - typedef struct { char name[2]; char units[3]; char component[12]; - VariableType type; } VariableInfo; extern const VariableInfo VOI_INFO; diff --git a/tests/resources/generator/cellml_unit_scaling_state/model.py b/tests/resources/generator/cellml_unit_scaling_state/model.py index f5bfca28fc..3a560fa48c 100644 --- a/tests/resources/generator/cellml_unit_scaling_state/model.py +++ b/tests/resources/generator/cellml_unit_scaling_state/model.py @@ -12,18 +12,9 @@ COMPUTED_CONSTANT_COUNT = 0 ALGEBRAIC_COUNT = 2 +VOI_INFO = {"name": "t", "units": "ms", "component": "environment"} -class VariableType(Enum): - VARIABLE_OF_INTEGRATION = 0 - STATE = 1 - CONSTANT = 2 - COMPUTED_CONSTANT = 3 - ALGEBRAIC = 4 - - -VOI_INFO = {"name": "t", "units": "ms", "component": "environment", "type": VariableType.VARIABLE_OF_INTEGRATION} - -STATE_INFO = {"name": "k", "units": "mM", "component": "states", "type": VariableType.STATE} +STATE_INFO = {"name": "k", "units": "mM", "component": "states"} CONSTANT_INFO = [ @@ -33,8 +24,8 @@ class VariableType(Enum): ] ALGEBRAIC_INFO = [ - {"name": "x", "units": "mM", "component": "main", "type": VariableType.ALGEBRAIC}, - {"name": "y", "units": "M", "component": "main", "type": VariableType.ALGEBRAIC} + {"name": "x", "units": "mM", "component": "main"}, + {"name": "y", "units": "M", "component": "main"} ] diff --git a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.c b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.c index 03bb266d52..94efa316a3 100644 --- a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.c +++ b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.c @@ -13,11 +13,11 @@ const size_t CONSTANT_COUNT = 0; const size_t COMPUTED_CONSTANT_COUNT = 0; const size_t ALGEBRAIC_COUNT = 0; -const VariableInfo VOI_INFO = {"t", "ms", "environment", VARIABLE_OF_INTEGRATION}; +const VariableInfo VOI_INFO = {"t", "ms", "environment"}; const VariableInfo STATE_INFO[] = { - {"k1", "mM", "main", STATE}, - {"k2", "M", "main", STATE} + {"k1", "mM", "main"}, + {"k2", "M", "main"} }; const VariableInfo CONSTANT_INFO[] = { diff --git a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.h b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.h index 46d3f1cf83..b889cfc43e 100644 --- a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.h +++ b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.h @@ -12,19 +12,10 @@ extern const size_t CONSTANT_COUNT; extern const size_t COMPUTED_CONSTANT_COUNT; extern const size_t ALGEBRAIC_COUNT; -typedef enum { - VARIABLE_OF_INTEGRATION, - STATE, - CONSTANT, - COMPUTED_CONSTANT, - ALGEBRAIC -} VariableType; - typedef struct { char name[3]; char units[3]; char component[12]; - VariableType type; } VariableInfo; extern const VariableInfo VOI_INFO; diff --git a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.py b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.py index d3f5a756d0..dce4e92ce1 100644 --- a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.py +++ b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.py @@ -12,19 +12,10 @@ COMPUTED_CONSTANT_COUNT = 0 ALGEBRAIC_COUNT = 0 +VOI_INFO = {"name": "t", "units": "ms", "component": "environment"} -class VariableType(Enum): - VARIABLE_OF_INTEGRATION = 0 - STATE = 1 - CONSTANT = 2 - COMPUTED_CONSTANT = 3 - ALGEBRAIC = 4 - - -VOI_INFO = {"name": "t", "units": "ms", "component": "environment", "type": VariableType.VARIABLE_OF_INTEGRATION} - -STATE_INFO = {"name": "k1", "units": "mM", "component": "main", "type": VariableType.STATE}, - {"name": "k2", "units": "M", "component": "main", "type": VariableType.STATE} +STATE_INFO = {"name": "k1", "units": "mM", "component": "main"}, + {"name": "k2", "units": "M", "component": "main"} CONSTANT_INFO = [ diff --git a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.c b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.c index 2cb41fddff..52c79b1c7c 100644 --- a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.c +++ b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.c @@ -13,16 +13,16 @@ const size_t CONSTANT_COUNT = 2; const size_t COMPUTED_CONSTANT_COUNT = 0; const size_t ALGEBRAIC_COUNT = 0; -const VariableInfo VOI_INFO = {"t", "ms", "environment", VARIABLE_OF_INTEGRATION}; +const VariableInfo VOI_INFO = {"t", "ms", "environment"}; const VariableInfo STATE_INFO[] = { - {"k1", "mM", "main", STATE}, - {"k2", "M", "main", STATE} + {"k1", "mM", "main"}, + {"k2", "M", "main"} }; const VariableInfo CONSTANT_INFO[] = { - {"k1_cst", "mM", "constants", CONSTANT}, - {"k2_cst", "mM", "constants", CONSTANT} + {"k1_cst", "mM", "constants"}, + {"k2_cst", "mM", "constants"} }; const VariableInfo COMPUTED_CONSTANT_INFO[] = { diff --git a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.h b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.h index ef9422431b..59b9535ec8 100644 --- a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.h +++ b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.h @@ -12,19 +12,10 @@ extern const size_t CONSTANT_COUNT; extern const size_t COMPUTED_CONSTANT_COUNT; extern const size_t ALGEBRAIC_COUNT; -typedef enum { - VARIABLE_OF_INTEGRATION, - STATE, - CONSTANT, - COMPUTED_CONSTANT, - ALGEBRAIC -} VariableType; - typedef struct { char name[7]; char units[3]; char component[12]; - VariableType type; } VariableInfo; extern const VariableInfo VOI_INFO; diff --git a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.py b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.py index 0ad4df9191..98b669a5f5 100644 --- a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.py +++ b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.py @@ -12,24 +12,15 @@ COMPUTED_CONSTANT_COUNT = 0 ALGEBRAIC_COUNT = 0 +VOI_INFO = {"name": "t", "units": "ms", "component": "environment"} -class VariableType(Enum): - VARIABLE_OF_INTEGRATION = 0 - STATE = 1 - CONSTANT = 2 - COMPUTED_CONSTANT = 3 - ALGEBRAIC = 4 - - -VOI_INFO = {"name": "t", "units": "ms", "component": "environment", "type": VariableType.VARIABLE_OF_INTEGRATION} - -STATE_INFO = {"name": "k1", "units": "mM", "component": "main", "type": VariableType.STATE}, - {"name": "k2", "units": "M", "component": "main", "type": VariableType.STATE} +STATE_INFO = {"name": "k1", "units": "mM", "component": "main"}, + {"name": "k2", "units": "M", "component": "main"} CONSTANT_INFO = [ - {"name": "k1_cst", "units": "mM", "component": "constants", "type": VariableType.CONSTANT}, - {"name": "k2_cst", "units": "mM", "component": "constants", "type": VariableType.CONSTANT} + {"name": "k1_cst", "units": "mM", "component": "constants"}, + {"name": "k2_cst", "units": "mM", "component": "constants"} ] COMPUTED_CONSTANT_INFO = [ diff --git a/tests/resources/generator/cellml_unit_scaling_voi_direct/model.c b/tests/resources/generator/cellml_unit_scaling_voi_direct/model.c index f29503e6a4..63f8794d12 100644 --- a/tests/resources/generator/cellml_unit_scaling_voi_direct/model.c +++ b/tests/resources/generator/cellml_unit_scaling_voi_direct/model.c @@ -13,11 +13,11 @@ const size_t CONSTANT_COUNT = 0; const size_t COMPUTED_CONSTANT_COUNT = 0; const size_t ALGEBRAIC_COUNT = 0; -const VariableInfo VOI_INFO = {"t", "ms", "environment", VARIABLE_OF_INTEGRATION}; +const VariableInfo VOI_INFO = {"t", "ms", "environment"}; const VariableInfo STATE_INFO[] = { - {"x", "dimensionless", "main", STATE}, - {"y", "dimensionless", "main", STATE} + {"x", "dimensionless", "main"}, + {"y", "dimensionless", "main"} }; const VariableInfo CONSTANT_INFO[] = { diff --git a/tests/resources/generator/cellml_unit_scaling_voi_direct/model.h b/tests/resources/generator/cellml_unit_scaling_voi_direct/model.h index 35acb14707..8d446982d8 100644 --- a/tests/resources/generator/cellml_unit_scaling_voi_direct/model.h +++ b/tests/resources/generator/cellml_unit_scaling_voi_direct/model.h @@ -12,19 +12,10 @@ extern const size_t CONSTANT_COUNT; extern const size_t COMPUTED_CONSTANT_COUNT; extern const size_t ALGEBRAIC_COUNT; -typedef enum { - VARIABLE_OF_INTEGRATION, - STATE, - CONSTANT, - COMPUTED_CONSTANT, - ALGEBRAIC -} VariableType; - typedef struct { char name[2]; char units[14]; char component[12]; - VariableType type; } VariableInfo; extern const VariableInfo VOI_INFO; diff --git a/tests/resources/generator/cellml_unit_scaling_voi_direct/model.py b/tests/resources/generator/cellml_unit_scaling_voi_direct/model.py index f86e8920c7..b8ff408e52 100644 --- a/tests/resources/generator/cellml_unit_scaling_voi_direct/model.py +++ b/tests/resources/generator/cellml_unit_scaling_voi_direct/model.py @@ -12,19 +12,10 @@ COMPUTED_CONSTANT_COUNT = 0 ALGEBRAIC_COUNT = 0 +VOI_INFO = {"name": "t", "units": "ms", "component": "environment"} -class VariableType(Enum): - VARIABLE_OF_INTEGRATION = 0 - STATE = 1 - CONSTANT = 2 - COMPUTED_CONSTANT = 3 - ALGEBRAIC = 4 - - -VOI_INFO = {"name": "t", "units": "ms", "component": "environment", "type": VariableType.VARIABLE_OF_INTEGRATION} - -STATE_INFO = {"name": "x", "units": "dimensionless", "component": "main", "type": VariableType.STATE}, - {"name": "y", "units": "dimensionless", "component": "main", "type": VariableType.STATE} +STATE_INFO = {"name": "x", "units": "dimensionless", "component": "main"}, + {"name": "y", "units": "dimensionless", "component": "main"} CONSTANT_INFO = [ diff --git a/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.c b/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.c index 05950cf519..d3b8f3522a 100644 --- a/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.c +++ b/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.c @@ -13,12 +13,12 @@ const size_t CONSTANT_COUNT = 0; const size_t COMPUTED_CONSTANT_COUNT = 0; const size_t ALGEBRAIC_COUNT = 0; -const VariableInfo VOI_INFO = {"t", "second", "environment", VARIABLE_OF_INTEGRATION}; +const VariableInfo VOI_INFO = {"t", "second", "environment"}; const VariableInfo STATE_INFO[] = { - {"x", "metre", "t_in_s", STATE}, - {"x", "metre", "t_in_ms", STATE}, - {"x", "metre", "t_in_ks", STATE} + {"x", "metre", "t_in_s"}, + {"x", "metre", "t_in_ms"}, + {"x", "metre", "t_in_ks"} }; const VariableInfo CONSTANT_INFO[] = { diff --git a/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.h b/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.h index ce44fd3c14..749c14ce79 100644 --- a/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.h +++ b/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.h @@ -12,19 +12,10 @@ extern const size_t CONSTANT_COUNT; extern const size_t COMPUTED_CONSTANT_COUNT; extern const size_t ALGEBRAIC_COUNT; -typedef enum { - VARIABLE_OF_INTEGRATION, - STATE, - CONSTANT, - COMPUTED_CONSTANT, - ALGEBRAIC -} VariableType; - typedef struct { char name[2]; char units[7]; char component[12]; - VariableType type; } VariableInfo; extern const VariableInfo VOI_INFO; diff --git a/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.py b/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.py index 7519964294..c651290c65 100644 --- a/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.py +++ b/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.py @@ -12,20 +12,11 @@ COMPUTED_CONSTANT_COUNT = 0 ALGEBRAIC_COUNT = 0 +VOI_INFO = {"name": "t", "units": "second", "component": "environment"} -class VariableType(Enum): - VARIABLE_OF_INTEGRATION = 0 - STATE = 1 - CONSTANT = 2 - COMPUTED_CONSTANT = 3 - ALGEBRAIC = 4 - - -VOI_INFO = {"name": "t", "units": "second", "component": "environment", "type": VariableType.VARIABLE_OF_INTEGRATION} - -STATE_INFO = {"name": "x", "units": "metre", "component": "t_in_s", "type": VariableType.STATE}, - {"name": "x", "units": "metre", "component": "t_in_ms", "type": VariableType.STATE}, - {"name": "x", "units": "metre", "component": "t_in_ks", "type": VariableType.STATE} +STATE_INFO = {"name": "x", "units": "metre", "component": "t_in_s"}, + {"name": "x", "units": "metre", "component": "t_in_ms"}, + {"name": "x", "units": "metre", "component": "t_in_ks"} CONSTANT_INFO = [ diff --git a/tests/resources/generator/dae_cellml_1_1_model/model.c b/tests/resources/generator/dae_cellml_1_1_model/model.c index c35d824f1b..1ebd5e5fb5 100644 --- a/tests/resources/generator/dae_cellml_1_1_model/model.c +++ b/tests/resources/generator/dae_cellml_1_1_model/model.c @@ -13,30 +13,30 @@ const size_t CONSTANT_COUNT = 5; const size_t COMPUTED_CONSTANT_COUNT = 0; const size_t ALGEBRAIC_COUNT = 5; -const VariableInfo VOI_INFO = {"t", "second", "main", VARIABLE_OF_INTEGRATION}; +const VariableInfo VOI_INFO = {"t", "second", "main"}; const VariableInfo STATE_INFO[] = { - {"q_1", "coulomb", "main", STATE}, - {"v_3", "C_per_s", "main", STATE} + {"q_1", "coulomb", "main"}, + {"v_3", "C_per_s", "main"} }; const VariableInfo CONSTANT_INFO[] = { - {"v_in", "C_per_s", "main", CONSTANT}, - {"v_out", "C_per_s", "main", CONSTANT}, - {"C", "C2_per_J", "main", CONSTANT}, - {"R", "Js_per_C2", "main", CONSTANT}, - {"L", "Js2_per_C2", "main", CONSTANT} + {"v_in", "C_per_s", "main"}, + {"v_out", "C_per_s", "main"}, + {"C", "C2_per_J", "main"}, + {"R", "Js_per_C2", "main"}, + {"L", "Js2_per_C2", "main"} }; const VariableInfo COMPUTED_CONSTANT_INFO[] = { }; const VariableInfo ALGEBRAIC_INFO[] = { - {"v_1", "C_per_s", "main", ALGEBRAIC}, - {"v_2", "C_per_s", "main", ALGEBRAIC}, - {"u_1", "J_per_C", "main", ALGEBRAIC}, - {"u_2", "J_per_C", "main", ALGEBRAIC}, - {"u_3", "J_per_C", "main", ALGEBRAIC} + {"v_1", "C_per_s", "main"}, + {"v_2", "C_per_s", "main"}, + {"u_1", "J_per_C", "main"}, + {"u_2", "J_per_C", "main"}, + {"u_3", "J_per_C", "main"} }; double * createStatesArray() diff --git a/tests/resources/generator/dae_cellml_1_1_model/model.h b/tests/resources/generator/dae_cellml_1_1_model/model.h index 8ebd938f3f..b6b9e63d2d 100644 --- a/tests/resources/generator/dae_cellml_1_1_model/model.h +++ b/tests/resources/generator/dae_cellml_1_1_model/model.h @@ -12,19 +12,10 @@ extern const size_t CONSTANT_COUNT; extern const size_t COMPUTED_CONSTANT_COUNT; extern const size_t ALGEBRAIC_COUNT; -typedef enum { - VARIABLE_OF_INTEGRATION, - STATE, - CONSTANT, - COMPUTED_CONSTANT, - ALGEBRAIC -} VariableType; - typedef struct { char name[6]; char units[11]; char component[5]; - VariableType type; } VariableInfo; extern const VariableInfo VOI_INFO; diff --git a/tests/resources/generator/dae_cellml_1_1_model/model.py b/tests/resources/generator/dae_cellml_1_1_model/model.py index 3c39a8b8c7..ec7692c381 100644 --- a/tests/resources/generator/dae_cellml_1_1_model/model.py +++ b/tests/resources/generator/dae_cellml_1_1_model/model.py @@ -12,38 +12,29 @@ COMPUTED_CONSTANT_COUNT = 0 ALGEBRAIC_COUNT = 5 +VOI_INFO = {"name": "t", "units": "second", "component": "main"} -class VariableType(Enum): - VARIABLE_OF_INTEGRATION = 0 - STATE = 1 - CONSTANT = 2 - COMPUTED_CONSTANT = 3 - ALGEBRAIC = 4 - - -VOI_INFO = {"name": "t", "units": "second", "component": "main", "type": VariableType.VARIABLE_OF_INTEGRATION} - -STATE_INFO = {"name": "q_1", "units": "coulomb", "component": "main", "type": VariableType.STATE}, - {"name": "v_3", "units": "C_per_s", "component": "main", "type": VariableType.STATE} +STATE_INFO = {"name": "q_1", "units": "coulomb", "component": "main"}, + {"name": "v_3", "units": "C_per_s", "component": "main"} CONSTANT_INFO = [ - {"name": "v_in", "units": "C_per_s", "component": "main", "type": VariableType.CONSTANT}, - {"name": "v_out", "units": "C_per_s", "component": "main", "type": VariableType.CONSTANT}, - {"name": "C", "units": "C2_per_J", "component": "main", "type": VariableType.CONSTANT}, - {"name": "R", "units": "Js_per_C2", "component": "main", "type": VariableType.CONSTANT}, - {"name": "L", "units": "Js2_per_C2", "component": "main", "type": VariableType.CONSTANT} + {"name": "v_in", "units": "C_per_s", "component": "main"}, + {"name": "v_out", "units": "C_per_s", "component": "main"}, + {"name": "C", "units": "C2_per_J", "component": "main"}, + {"name": "R", "units": "Js_per_C2", "component": "main"}, + {"name": "L", "units": "Js2_per_C2", "component": "main"} ] COMPUTED_CONSTANT_INFO = [ ] ALGEBRAIC_INFO = [ - {"name": "v_1", "units": "C_per_s", "component": "main", "type": VariableType.ALGEBRAIC}, - {"name": "v_2", "units": "C_per_s", "component": "main", "type": VariableType.ALGEBRAIC}, - {"name": "u_1", "units": "J_per_C", "component": "main", "type": VariableType.ALGEBRAIC}, - {"name": "u_2", "units": "J_per_C", "component": "main", "type": VariableType.ALGEBRAIC}, - {"name": "u_3", "units": "J_per_C", "component": "main", "type": VariableType.ALGEBRAIC} + {"name": "v_1", "units": "C_per_s", "component": "main"}, + {"name": "v_2", "units": "C_per_s", "component": "main"}, + {"name": "u_1", "units": "J_per_C", "component": "main"}, + {"name": "u_2", "units": "J_per_C", "component": "main"}, + {"name": "u_3", "units": "J_per_C", "component": "main"} ] diff --git a/tests/resources/generator/dependent_eqns/model.c b/tests/resources/generator/dependent_eqns/model.c index 796c72dbff..abaa47ae6c 100644 --- a/tests/resources/generator/dependent_eqns/model.c +++ b/tests/resources/generator/dependent_eqns/model.c @@ -13,10 +13,10 @@ const size_t CONSTANT_COUNT = 0; const size_t COMPUTED_CONSTANT_COUNT = 0; const size_t ALGEBRAIC_COUNT = 2; -const VariableInfo VOI_INFO = {"time", "second", "my_component", VARIABLE_OF_INTEGRATION}; +const VariableInfo VOI_INFO = {"time", "second", "my_component"}; const VariableInfo STATE_INFO[] = { - {"x", "dimensionless", "my_component", STATE} + {"x", "dimensionless", "my_component"} }; const VariableInfo CONSTANT_INFO[] = { @@ -26,8 +26,8 @@ const VariableInfo COMPUTED_CONSTANT_INFO[] = { }; const VariableInfo ALGEBRAIC_INFO[] = { - {"a", "second", "my_component", ALGEBRAIC}, - {"b", "second", "my_component", ALGEBRAIC} + {"a", "second", "my_component"}, + {"b", "second", "my_component"} }; double * createStatesArray() diff --git a/tests/resources/generator/dependent_eqns/model.h b/tests/resources/generator/dependent_eqns/model.h index 3e6d21a18b..31a196c76d 100644 --- a/tests/resources/generator/dependent_eqns/model.h +++ b/tests/resources/generator/dependent_eqns/model.h @@ -12,19 +12,10 @@ extern const size_t CONSTANT_COUNT; extern const size_t COMPUTED_CONSTANT_COUNT; extern const size_t ALGEBRAIC_COUNT; -typedef enum { - VARIABLE_OF_INTEGRATION, - STATE, - CONSTANT, - COMPUTED_CONSTANT, - ALGEBRAIC -} VariableType; - typedef struct { char name[5]; char units[14]; char component[13]; - VariableType type; } VariableInfo; extern const VariableInfo VOI_INFO; diff --git a/tests/resources/generator/dependent_eqns/model.py b/tests/resources/generator/dependent_eqns/model.py index 98091ed391..a2d3b99f8f 100644 --- a/tests/resources/generator/dependent_eqns/model.py +++ b/tests/resources/generator/dependent_eqns/model.py @@ -12,18 +12,9 @@ COMPUTED_CONSTANT_COUNT = 0 ALGEBRAIC_COUNT = 2 +VOI_INFO = {"name": "time", "units": "second", "component": "my_component"} -class VariableType(Enum): - VARIABLE_OF_INTEGRATION = 0 - STATE = 1 - CONSTANT = 2 - COMPUTED_CONSTANT = 3 - ALGEBRAIC = 4 - - -VOI_INFO = {"name": "time", "units": "second", "component": "my_component", "type": VariableType.VARIABLE_OF_INTEGRATION} - -STATE_INFO = {"name": "x", "units": "dimensionless", "component": "my_component", "type": VariableType.STATE} +STATE_INFO = {"name": "x", "units": "dimensionless", "component": "my_component"} CONSTANT_INFO = [ @@ -33,8 +24,8 @@ class VariableType(Enum): ] ALGEBRAIC_INFO = [ - {"name": "a", "units": "second", "component": "my_component", "type": VariableType.ALGEBRAIC}, - {"name": "b", "units": "second", "component": "my_component", "type": VariableType.ALGEBRAIC} + {"name": "a", "units": "second", "component": "my_component"}, + {"name": "b", "units": "second", "component": "my_component"} ] diff --git a/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.c b/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.c index 51bfd4d931..a382c211ba 100644 --- a/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.c +++ b/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.c @@ -13,268 +13,268 @@ const size_t CONSTANT_COUNT = 91; const size_t COMPUTED_CONSTANT_COUNT = 25; const size_t ALGEBRAIC_COUNT = 101; -const VariableInfo VOI_INFO = {"time", "second", "environment", VARIABLE_OF_INTEGRATION}; +const VariableInfo VOI_INFO = {"time", "second", "environment"}; const VariableInfo STATE_INFO[] = { - {"Ca_sub", "millimolar", "Ca_dynamics", STATE}, - {"Nai_", "millimolar", "Nai_concentration", STATE}, - {"Ca_jsr", "millimolar", "Ca_dynamics", STATE}, - {"O", "dimensionless", "Ca_SR_release", STATE}, - {"R", "dimensionless", "Ca_SR_release", STATE}, - {"RI", "dimensionless", "Ca_SR_release", STATE}, - {"I", "dimensionless", "Ca_SR_release", STATE}, - {"Cai", "millimolar", "Ca_dynamics", STATE}, - {"Ca_nsr", "millimolar", "Ca_dynamics", STATE}, - {"fTC", "dimensionless", "Ca_buffering", STATE}, - {"fTMC", "dimensionless", "Ca_buffering", STATE}, - {"fTMM", "dimensionless", "Ca_buffering", STATE}, - {"fCMi", "dimensionless", "Ca_buffering", STATE}, - {"fCMs", "dimensionless", "Ca_buffering", STATE}, - {"fCQ", "dimensionless", "Ca_buffering", STATE}, - {"V_ode", "millivolt", "Membrane", STATE}, - {"y", "dimensionless", "i_f_y_gate", STATE}, - {"h", "dimensionless", "i_Na_h_gate", STATE}, - {"m", "dimensionless", "i_Na_m_gate", STATE}, - {"s_Kur", "dimensionless", "i_Kur_sKur_gate", STATE}, - {"r_Kur", "dimensionless", "i_Kur_rKur_gate", STATE}, - {"fCa", "dimensionless", "i_CaL_fCa_gate", STATE}, - {"fL", "dimensionless", "i_CaL_fL_gate", STATE}, - {"dL", "dimensionless", "i_CaL_dL_gate", STATE}, - {"fT", "dimensionless", "i_CaT_fT_gate", STATE}, - {"dT", "dimensionless", "i_CaT_dT_gate", STATE}, - {"r", "dimensionless", "i_to_r_gate", STATE}, - {"q", "dimensionless", "i_to_q_gate", STATE}, - {"piy", "dimensionless", "i_Kr_pi_gate", STATE}, - {"paF", "dimensionless", "i_Kr_pa_gate", STATE}, - {"paS", "dimensionless", "i_Kr_pa_gate", STATE}, - {"n", "dimensionless", "i_Ks_n_gate", STATE}, - {"a", "dimensionless", "i_KACh_a_gate", STATE} + {"Ca_sub", "millimolar", "Ca_dynamics"}, + {"Nai_", "millimolar", "Nai_concentration"}, + {"Ca_jsr", "millimolar", "Ca_dynamics"}, + {"O", "dimensionless", "Ca_SR_release"}, + {"R", "dimensionless", "Ca_SR_release"}, + {"RI", "dimensionless", "Ca_SR_release"}, + {"I", "dimensionless", "Ca_SR_release"}, + {"Cai", "millimolar", "Ca_dynamics"}, + {"Ca_nsr", "millimolar", "Ca_dynamics"}, + {"fTC", "dimensionless", "Ca_buffering"}, + {"fTMC", "dimensionless", "Ca_buffering"}, + {"fTMM", "dimensionless", "Ca_buffering"}, + {"fCMi", "dimensionless", "Ca_buffering"}, + {"fCMs", "dimensionless", "Ca_buffering"}, + {"fCQ", "dimensionless", "Ca_buffering"}, + {"V_ode", "millivolt", "Membrane"}, + {"y", "dimensionless", "i_f_y_gate"}, + {"h", "dimensionless", "i_Na_h_gate"}, + {"m", "dimensionless", "i_Na_m_gate"}, + {"s_Kur", "dimensionless", "i_Kur_sKur_gate"}, + {"r_Kur", "dimensionless", "i_Kur_rKur_gate"}, + {"fCa", "dimensionless", "i_CaL_fCa_gate"}, + {"fL", "dimensionless", "i_CaL_fL_gate"}, + {"dL", "dimensionless", "i_CaL_dL_gate"}, + {"fT", "dimensionless", "i_CaT_fT_gate"}, + {"dT", "dimensionless", "i_CaT_dT_gate"}, + {"r", "dimensionless", "i_to_r_gate"}, + {"q", "dimensionless", "i_to_q_gate"}, + {"piy", "dimensionless", "i_Kr_pi_gate"}, + {"paF", "dimensionless", "i_Kr_pa_gate"}, + {"paS", "dimensionless", "i_Kr_pa_gate"}, + {"n", "dimensionless", "i_Ks_n_gate"}, + {"a", "dimensionless", "i_KACh_a_gate"} }; const VariableInfo CONSTANT_INFO[] = { - {"ACh", "millimolar", "Rate_modulation_experiments", CONSTANT}, - {"Iso_1_uM", "dimensionless", "Rate_modulation_experiments", CONSTANT}, - {"Nao", "millimolar", "Ionic_values", CONSTANT}, - {"Ko", "millimolar", "Ionic_values", CONSTANT}, - {"Ki", "millimolar", "Ionic_values", CONSTANT}, - {"Cao", "millimolar", "Ionic_values", CONSTANT}, - {"Nai_clamp", "dimensionless", "Nai_concentration", CONSTANT}, - {"F", "coulomb_per_mole", "Membrane", CONSTANT}, - {"Km_Nap", "millimolar", "i_NaK", CONSTANT}, - {"Km_Kp", "millimolar", "i_NaK", CONSTANT}, - {"i_NaK_max", "nanoA", "i_NaK", CONSTANT}, - {"blockade_NaCa", "dimensionless", "i_NaCa", CONSTANT}, - {"K_NaCa", "nanoA", "i_NaCa", CONSTANT}, - {"K3ni", "millimolar", "i_NaCa", CONSTANT}, - {"Kci", "millimolar", "i_NaCa", CONSTANT}, - {"Qci", "dimensionless", "i_NaCa", CONSTANT}, - {"K1ni", "millimolar", "i_NaCa", CONSTANT}, - {"K2ni", "millimolar", "i_NaCa", CONSTANT}, - {"Qn", "dimensionless", "i_NaCa", CONSTANT}, - {"Kcni", "millimolar", "i_NaCa", CONSTANT}, - {"K3no", "millimolar", "i_NaCa", CONSTANT}, - {"Kco", "millimolar", "i_NaCa", CONSTANT}, - {"Qco", "dimensionless", "i_NaCa", CONSTANT}, - {"K1no", "millimolar", "i_NaCa", CONSTANT}, - {"K2no", "millimolar", "i_NaCa", CONSTANT}, - {"ks", "per_second", "Ca_SR_release", CONSTANT}, - {"MaxSR", "dimensionless", "Ca_SR_release", CONSTANT}, - {"MinSR", "dimensionless", "Ca_SR_release", CONSTANT}, - {"EC50_SR", "millimolar", "Ca_SR_release", CONSTANT}, - {"HSR", "dimensionless", "Ca_SR_release", CONSTANT}, - {"koCa", "per_millimolar2_second", "Ca_SR_release", CONSTANT}, - {"kiCa", "per_millimolar_second", "Ca_SR_release", CONSTANT}, - {"kim", "per_second", "Ca_SR_release", CONSTANT}, - {"kom", "per_second", "Ca_SR_release", CONSTANT}, - {"P_up_basal", "millimolar_per_second", "Ca_intracellular_fluxes", CONSTANT}, - {"tau_dif_Ca", "second", "Ca_intracellular_fluxes", CONSTANT}, - {"K_up", "millimolar", "Ca_intracellular_fluxes", CONSTANT}, - {"slope_up", "millimolar", "Ca_intracellular_fluxes", CONSTANT}, - {"tau_tr", "second", "Ca_intracellular_fluxes", CONSTANT}, - {"kf_TC", "per_millimolar_second", "Ca_buffering", CONSTANT}, - {"kb_TC", "per_second", "Ca_buffering", CONSTANT}, - {"kf_TMC", "per_millimolar_second", "Ca_buffering", CONSTANT}, - {"kb_TMC", "per_second", "Ca_buffering", CONSTANT}, - {"kf_TMM", "per_millimolar_second", "Ca_buffering", CONSTANT}, - {"Mgi", "millimolar", "Ca_buffering", CONSTANT}, - {"kb_TMM", "per_second", "Ca_buffering", CONSTANT}, - {"kf_CM", "per_millimolar_second", "Ca_buffering", CONSTANT}, - {"kb_CM", "per_second", "Ca_buffering", CONSTANT}, - {"kf_CQ", "per_millimolar_second", "Ca_buffering", CONSTANT}, - {"kb_CQ", "per_second", "Ca_buffering", CONSTANT}, - {"TC_tot", "millimolar", "Ca_buffering", CONSTANT}, - {"TMC_tot", "millimolar", "Ca_buffering", CONSTANT}, - {"CM_tot", "millimolar", "Ca_buffering", CONSTANT}, - {"CQ_tot", "millimolar", "Ca_buffering", CONSTANT}, - {"L_cell", "micrometre", "Cell_parameters", CONSTANT}, - {"R_cell", "micrometre", "Cell_parameters", CONSTANT}, - {"L_sub", "micrometre", "Cell_parameters", CONSTANT}, - {"V_jsr_part", "dimensionless", "Cell_parameters", CONSTANT}, - {"V_i_part", "dimensionless", "Cell_parameters", CONSTANT}, - {"V_nsr_part", "dimensionless", "Cell_parameters", CONSTANT}, - {"C", "microF", "Membrane", CONSTANT}, - {"R", "joule_per_kilomole_kelvin", "Membrane", CONSTANT}, - {"T", "kelvin", "Membrane", CONSTANT}, - {"clamp_mode", "dimensionless", "Membrane", CONSTANT}, - {"V_test", "millivolt", "Voltage_clamp", CONSTANT}, - {"t_holding", "second", "Voltage_clamp", CONSTANT}, - {"t_test", "second", "Voltage_clamp", CONSTANT}, - {"V_holding", "millivolt", "Voltage_clamp", CONSTANT}, - {"g_f", "microS", "i_f", CONSTANT}, - {"Km_f", "millimolar", "i_f", CONSTANT}, - {"alpha", "dimensionless", "i_f", CONSTANT}, - {"blockade", "dimensionless", "i_f", CONSTANT}, - {"y_shift", "millivolt", "i_f_y_gate", CONSTANT}, - {"g_Na", "microS", "i_Na", CONSTANT}, - {"g_Na_L", "microS", "i_Na", CONSTANT}, - {"delta_m", "millivolt", "i_Na_m_gate", CONSTANT}, - {"g_Kur", "microS", "i_Kur", CONSTANT}, - {"P_CaL", "nanoA_per_millimolar", "i_CaL", CONSTANT}, - {"V_dL", "millivolt", "i_CaL_dL_gate", CONSTANT}, - {"k_dL", "millivolt", "i_CaL_dL_gate", CONSTANT}, - {"shift_fL", "millivolt", "i_CaL_fL_gate", CONSTANT}, - {"k_fL", "millivolt", "i_CaL_fL_gate", CONSTANT}, - {"Km_fCa", "millimolar", "i_CaL_fCa_gate", CONSTANT}, - {"alpha_fCa", "per_second", "i_CaL_fCa_gate", CONSTANT}, - {"P_CaT", "nanoA_per_millimolar", "i_CaT", CONSTANT}, - {"offset_fT", "second", "i_CaT_fT_gate", CONSTANT}, - {"g_to", "microS", "i_to", CONSTANT}, - {"g_Kr", "microS", "i_Kr", CONSTANT}, - {"g_Ks_", "microS", "i_Ks", CONSTANT}, - {"ACh_on", "dimensionless", "i_KACh", CONSTANT}, - {"g_KACh", "microS", "i_KACh", CONSTANT} + {"ACh", "millimolar", "Rate_modulation_experiments"}, + {"Iso_1_uM", "dimensionless", "Rate_modulation_experiments"}, + {"Nao", "millimolar", "Ionic_values"}, + {"Ko", "millimolar", "Ionic_values"}, + {"Ki", "millimolar", "Ionic_values"}, + {"Cao", "millimolar", "Ionic_values"}, + {"Nai_clamp", "dimensionless", "Nai_concentration"}, + {"F", "coulomb_per_mole", "Membrane"}, + {"Km_Nap", "millimolar", "i_NaK"}, + {"Km_Kp", "millimolar", "i_NaK"}, + {"i_NaK_max", "nanoA", "i_NaK"}, + {"blockade_NaCa", "dimensionless", "i_NaCa"}, + {"K_NaCa", "nanoA", "i_NaCa"}, + {"K3ni", "millimolar", "i_NaCa"}, + {"Kci", "millimolar", "i_NaCa"}, + {"Qci", "dimensionless", "i_NaCa"}, + {"K1ni", "millimolar", "i_NaCa"}, + {"K2ni", "millimolar", "i_NaCa"}, + {"Qn", "dimensionless", "i_NaCa"}, + {"Kcni", "millimolar", "i_NaCa"}, + {"K3no", "millimolar", "i_NaCa"}, + {"Kco", "millimolar", "i_NaCa"}, + {"Qco", "dimensionless", "i_NaCa"}, + {"K1no", "millimolar", "i_NaCa"}, + {"K2no", "millimolar", "i_NaCa"}, + {"ks", "per_second", "Ca_SR_release"}, + {"MaxSR", "dimensionless", "Ca_SR_release"}, + {"MinSR", "dimensionless", "Ca_SR_release"}, + {"EC50_SR", "millimolar", "Ca_SR_release"}, + {"HSR", "dimensionless", "Ca_SR_release"}, + {"koCa", "per_millimolar2_second", "Ca_SR_release"}, + {"kiCa", "per_millimolar_second", "Ca_SR_release"}, + {"kim", "per_second", "Ca_SR_release"}, + {"kom", "per_second", "Ca_SR_release"}, + {"P_up_basal", "millimolar_per_second", "Ca_intracellular_fluxes"}, + {"tau_dif_Ca", "second", "Ca_intracellular_fluxes"}, + {"K_up", "millimolar", "Ca_intracellular_fluxes"}, + {"slope_up", "millimolar", "Ca_intracellular_fluxes"}, + {"tau_tr", "second", "Ca_intracellular_fluxes"}, + {"kf_TC", "per_millimolar_second", "Ca_buffering"}, + {"kb_TC", "per_second", "Ca_buffering"}, + {"kf_TMC", "per_millimolar_second", "Ca_buffering"}, + {"kb_TMC", "per_second", "Ca_buffering"}, + {"kf_TMM", "per_millimolar_second", "Ca_buffering"}, + {"Mgi", "millimolar", "Ca_buffering"}, + {"kb_TMM", "per_second", "Ca_buffering"}, + {"kf_CM", "per_millimolar_second", "Ca_buffering"}, + {"kb_CM", "per_second", "Ca_buffering"}, + {"kf_CQ", "per_millimolar_second", "Ca_buffering"}, + {"kb_CQ", "per_second", "Ca_buffering"}, + {"TC_tot", "millimolar", "Ca_buffering"}, + {"TMC_tot", "millimolar", "Ca_buffering"}, + {"CM_tot", "millimolar", "Ca_buffering"}, + {"CQ_tot", "millimolar", "Ca_buffering"}, + {"L_cell", "micrometre", "Cell_parameters"}, + {"R_cell", "micrometre", "Cell_parameters"}, + {"L_sub", "micrometre", "Cell_parameters"}, + {"V_jsr_part", "dimensionless", "Cell_parameters"}, + {"V_i_part", "dimensionless", "Cell_parameters"}, + {"V_nsr_part", "dimensionless", "Cell_parameters"}, + {"C", "microF", "Membrane"}, + {"R", "joule_per_kilomole_kelvin", "Membrane"}, + {"T", "kelvin", "Membrane"}, + {"clamp_mode", "dimensionless", "Membrane"}, + {"V_test", "millivolt", "Voltage_clamp"}, + {"t_holding", "second", "Voltage_clamp"}, + {"t_test", "second", "Voltage_clamp"}, + {"V_holding", "millivolt", "Voltage_clamp"}, + {"g_f", "microS", "i_f"}, + {"Km_f", "millimolar", "i_f"}, + {"alpha", "dimensionless", "i_f"}, + {"blockade", "dimensionless", "i_f"}, + {"y_shift", "millivolt", "i_f_y_gate"}, + {"g_Na", "microS", "i_Na"}, + {"g_Na_L", "microS", "i_Na"}, + {"delta_m", "millivolt", "i_Na_m_gate"}, + {"g_Kur", "microS", "i_Kur"}, + {"P_CaL", "nanoA_per_millimolar", "i_CaL"}, + {"V_dL", "millivolt", "i_CaL_dL_gate"}, + {"k_dL", "millivolt", "i_CaL_dL_gate"}, + {"shift_fL", "millivolt", "i_CaL_fL_gate"}, + {"k_fL", "millivolt", "i_CaL_fL_gate"}, + {"Km_fCa", "millimolar", "i_CaL_fCa_gate"}, + {"alpha_fCa", "per_second", "i_CaL_fCa_gate"}, + {"P_CaT", "nanoA_per_millimolar", "i_CaT"}, + {"offset_fT", "second", "i_CaT_fT_gate"}, + {"g_to", "microS", "i_to"}, + {"g_Kr", "microS", "i_Kr"}, + {"g_Ks_", "microS", "i_Ks"}, + {"ACh_on", "dimensionless", "i_KACh"}, + {"g_KACh", "microS", "i_KACh"} }; const VariableInfo COMPUTED_CONSTANT_INFO[] = { - {"RTONF", "millivolt", "Membrane", COMPUTED_CONSTANT}, - {"E_K", "millivolt", "Ionic_values", COMPUTED_CONSTANT}, - {"V_i", "millimetre3", "Cell_parameters", COMPUTED_CONSTANT}, - {"V_sub", "millimetre3", "Cell_parameters", COMPUTED_CONSTANT}, - {"Iso_increase", "dimensionless", "i_NaK", COMPUTED_CONSTANT}, - {"k34", "dimensionless", "i_NaCa", COMPUTED_CONSTANT}, - {"b_up", "dimensionless", "Ca_intracellular_fluxes", COMPUTED_CONSTANT}, - {"P_up", "millimolar_per_second", "Ca_intracellular_fluxes", COMPUTED_CONSTANT}, - {"V_nsr", "millimetre3", "Cell_parameters", COMPUTED_CONSTANT}, - {"V_jsr", "millimetre3", "Cell_parameters", COMPUTED_CONSTANT}, - {"V_cell", "millimetre3", "Cell_parameters", COMPUTED_CONSTANT}, - {"G_f", "microS", "i_f", COMPUTED_CONSTANT}, - {"G_f_K", "microS", "i_f", COMPUTED_CONSTANT}, - {"G_f_Na", "microS", "i_f", COMPUTED_CONSTANT}, - {"g_f_Na", "microS", "i_f", COMPUTED_CONSTANT}, - {"g_f_K", "microS", "i_f", COMPUTED_CONSTANT}, - {"ACh_shift", "millivolt", "i_f_y_gate", COMPUTED_CONSTANT}, - {"Iso_shift", "millivolt", "i_f_y_gate", COMPUTED_CONSTANT}, - {"Iso_increase", "dimensionless", "i_CaL", COMPUTED_CONSTANT}, - {"ACh_block", "dimensionless", "i_CaL", COMPUTED_CONSTANT}, - {"Iso_shift_dL", "millivolt", "i_CaL_dL_gate", COMPUTED_CONSTANT}, - {"Iso_slope_dL", "dimensionless", "i_CaL_dL_gate", COMPUTED_CONSTANT}, - {"g_Ks", "microS", "i_Ks", COMPUTED_CONSTANT}, - {"Iso_shift", "millivolt", "i_Ks_n_gate", COMPUTED_CONSTANT}, - {"alpha_a", "per_second", "i_KACh_a_gate", COMPUTED_CONSTANT} + {"RTONF", "millivolt", "Membrane"}, + {"E_K", "millivolt", "Ionic_values"}, + {"V_i", "millimetre3", "Cell_parameters"}, + {"V_sub", "millimetre3", "Cell_parameters"}, + {"Iso_increase", "dimensionless", "i_NaK"}, + {"k34", "dimensionless", "i_NaCa"}, + {"b_up", "dimensionless", "Ca_intracellular_fluxes"}, + {"P_up", "millimolar_per_second", "Ca_intracellular_fluxes"}, + {"V_nsr", "millimetre3", "Cell_parameters"}, + {"V_jsr", "millimetre3", "Cell_parameters"}, + {"V_cell", "millimetre3", "Cell_parameters"}, + {"G_f", "microS", "i_f"}, + {"G_f_K", "microS", "i_f"}, + {"G_f_Na", "microS", "i_f"}, + {"g_f_Na", "microS", "i_f"}, + {"g_f_K", "microS", "i_f"}, + {"ACh_shift", "millivolt", "i_f_y_gate"}, + {"Iso_shift", "millivolt", "i_f_y_gate"}, + {"Iso_increase", "dimensionless", "i_CaL"}, + {"ACh_block", "dimensionless", "i_CaL"}, + {"Iso_shift_dL", "millivolt", "i_CaL_dL_gate"}, + {"Iso_slope_dL", "dimensionless", "i_CaL_dL_gate"}, + {"g_Ks", "microS", "i_Ks"}, + {"Iso_shift", "millivolt", "i_Ks_n_gate"}, + {"alpha_a", "per_second", "i_KACh_a_gate"} }; const VariableInfo ALGEBRAIC_INFO[] = { - {"E_Na", "millivolt", "Ionic_values", ALGEBRAIC}, - {"Nai", "millimolar", "Nai_concentration", ALGEBRAIC}, - {"E_Ca", "millivolt", "Ionic_values", ALGEBRAIC}, - {"i_Na", "nanoA", "i_Na", ALGEBRAIC}, - {"i_NaCa", "nanoA", "i_NaCa", ALGEBRAIC}, - {"i_NaK", "nanoA", "i_NaK", ALGEBRAIC}, - {"i_siNa", "nanoA", "i_CaL", ALGEBRAIC}, - {"i_fNa", "nanoA", "i_f", ALGEBRAIC}, - {"V", "millivolt", "Membrane", ALGEBRAIC}, - {"x2", "dimensionless", "i_NaCa", ALGEBRAIC}, - {"k21", "dimensionless", "i_NaCa", ALGEBRAIC}, - {"x1", "dimensionless", "i_NaCa", ALGEBRAIC}, - {"k12", "dimensionless", "i_NaCa", ALGEBRAIC}, - {"x4", "dimensionless", "i_NaCa", ALGEBRAIC}, - {"x3", "dimensionless", "i_NaCa", ALGEBRAIC}, - {"k41", "dimensionless", "i_NaCa", ALGEBRAIC}, - {"k23", "dimensionless", "i_NaCa", ALGEBRAIC}, - {"k43", "dimensionless", "i_NaCa", ALGEBRAIC}, - {"k32", "dimensionless", "i_NaCa", ALGEBRAIC}, - {"k14", "dimensionless", "i_NaCa", ALGEBRAIC}, - {"di", "dimensionless", "i_NaCa", ALGEBRAIC}, - {"do", "dimensionless", "i_NaCa", ALGEBRAIC}, - {"j_SRCarel", "millimolar_per_second", "Ca_SR_release", ALGEBRAIC}, - {"diff", "millimolar", "Ca_SR_release", ALGEBRAIC}, - {"kCaSR", "dimensionless", "Ca_SR_release", ALGEBRAIC}, - {"koSRCa", "per_millimolar2_second", "Ca_SR_release", ALGEBRAIC}, - {"kiSRCa", "per_millimolar_second", "Ca_SR_release", ALGEBRAIC}, - {"P_tot", "dimensionless", "Ca_SR_release", ALGEBRAIC}, - {"j_Ca_dif", "millimolar_per_second", "Ca_intracellular_fluxes", ALGEBRAIC}, - {"j_up", "millimolar_per_second", "Ca_intracellular_fluxes", ALGEBRAIC}, - {"j_tr", "millimolar_per_second", "Ca_intracellular_fluxes", ALGEBRAIC}, - {"delta_fTC", "per_second", "Ca_buffering", ALGEBRAIC}, - {"delta_fTMC", "per_second", "Ca_buffering", ALGEBRAIC}, - {"delta_fTMM", "per_second", "Ca_buffering", ALGEBRAIC}, - {"delta_fCMi", "per_second", "Ca_buffering", ALGEBRAIC}, - {"delta_fCMs", "per_second", "Ca_buffering", ALGEBRAIC}, - {"delta_fCQ", "per_second", "Ca_buffering", ALGEBRAIC}, - {"i_siCa", "nanoA", "i_CaL", ALGEBRAIC}, - {"i_CaT", "nanoA", "i_CaT", ALGEBRAIC}, - {"i_tot", "nanoA", "Membrane", ALGEBRAIC}, - {"i_f", "nanoA", "i_f", ALGEBRAIC}, - {"i_Kur", "nanoA", "i_Kur", ALGEBRAIC}, - {"i_KACh", "nanoA", "i_KACh", ALGEBRAIC}, - {"i_CaL", "nanoA", "i_CaL", ALGEBRAIC}, - {"i_to", "nanoA", "i_to", ALGEBRAIC}, - {"i_Ks", "nanoA", "i_Ks", ALGEBRAIC}, - {"i_Kr", "nanoA", "i_Kr", ALGEBRAIC}, - {"V_clamp", "millivolt", "Voltage_clamp", ALGEBRAIC}, - {"i_fK", "nanoA", "i_f", ALGEBRAIC}, - {"tau_y", "second", "i_f_y_gate", ALGEBRAIC}, - {"y_infinity", "dimensionless", "i_f_y_gate", ALGEBRAIC}, - {"E_mh", "millivolt", "i_Na", ALGEBRAIC}, - {"i_Na_", "nanoA", "i_Na", ALGEBRAIC}, - {"i_Na_L", "nanoA", "i_Na", ALGEBRAIC}, - {"m_infinity", "dimensionless", "i_Na_m_gate", ALGEBRAIC}, - {"E0_m", "millivolt", "i_Na_m_gate", ALGEBRAIC}, - {"alpha_m", "per_second", "i_Na_m_gate", ALGEBRAIC}, - {"beta_m", "per_second", "i_Na_m_gate", ALGEBRAIC}, - {"tau_m", "second", "i_Na_m_gate", ALGEBRAIC}, - {"h_infinity", "dimensionless", "i_Na_h_gate", ALGEBRAIC}, - {"alpha_h", "per_second", "i_Na_h_gate", ALGEBRAIC}, - {"beta_h", "per_second", "i_Na_h_gate", ALGEBRAIC}, - {"tau_h", "second", "i_Na_h_gate", ALGEBRAIC}, - {"r_Kur_infinity", "dimensionless", "i_Kur_rKur_gate", ALGEBRAIC}, - {"tau_r_Kur", "second", "i_Kur_rKur_gate", ALGEBRAIC}, - {"s_Kur_infinity", "dimensionless", "i_Kur_sKur_gate", ALGEBRAIC}, - {"tau_s_Kur", "second", "i_Kur_sKur_gate", ALGEBRAIC}, - {"i_siK", "nanoA", "i_CaL", ALGEBRAIC}, - {"dL_infinity", "dimensionless", "i_CaL_dL_gate", ALGEBRAIC}, - {"tau_dL", "second", "i_CaL_dL_gate", ALGEBRAIC}, - {"alpha_dL", "per_second", "i_CaL_dL_gate", ALGEBRAIC}, - {"beta_dL", "per_second", "i_CaL_dL_gate", ALGEBRAIC}, - {"adVm", "millivolt", "i_CaL_dL_gate", ALGEBRAIC}, - {"bdVm", "millivolt", "i_CaL_dL_gate", ALGEBRAIC}, - {"fL_infinity", "dimensionless", "i_CaL_fL_gate", ALGEBRAIC}, - {"tau_fL", "second", "i_CaL_fL_gate", ALGEBRAIC}, - {"fCa_infinity", "dimensionless", "i_CaL_fCa_gate", ALGEBRAIC}, - {"tau_fCa", "second", "i_CaL_fCa_gate", ALGEBRAIC}, - {"dT_infinity", "dimensionless", "i_CaT_dT_gate", ALGEBRAIC}, - {"tau_dT", "second", "i_CaT_dT_gate", ALGEBRAIC}, - {"fT_infinity", "dimensionless", "i_CaT_fT_gate", ALGEBRAIC}, - {"tau_fT", "second", "i_CaT_fT_gate", ALGEBRAIC}, - {"q_infinity", "dimensionless", "i_to_q_gate", ALGEBRAIC}, - {"tau_q", "second", "i_to_q_gate", ALGEBRAIC}, - {"r_infinity", "dimensionless", "i_to_r_gate", ALGEBRAIC}, - {"tau_r", "second", "i_to_r_gate", ALGEBRAIC}, - {"alfapaF", "per_second", "i_Kr_pa_gate", ALGEBRAIC}, - {"betapaF", "per_second", "i_Kr_pa_gate", ALGEBRAIC}, - {"pa_infinity", "dimensionless", "i_Kr_pa_gate", ALGEBRAIC}, - {"tau_paS", "second", "i_Kr_pa_gate", ALGEBRAIC}, - {"tau_paF", "second", "i_Kr_pa_gate", ALGEBRAIC}, - {"tau_pi", "second", "i_Kr_pi_gate", ALGEBRAIC}, - {"pi_infinity", "dimensionless", "i_Kr_pi_gate", ALGEBRAIC}, - {"E_Ks", "millivolt", "i_Ks", ALGEBRAIC}, - {"n_infinity", "dimensionless", "i_Ks_n_gate", ALGEBRAIC}, - {"tau_n", "second", "i_Ks_n_gate", ALGEBRAIC}, - {"alpha_n", "per_second", "i_Ks_n_gate", ALGEBRAIC}, - {"beta_n", "per_second", "i_Ks_n_gate", ALGEBRAIC}, - {"beta_a", "per_second", "i_KACh_a_gate", ALGEBRAIC}, - {"a_infinity", "dimensionless", "i_KACh_a_gate", ALGEBRAIC}, - {"tau_a", "second", "i_KACh_a_gate", ALGEBRAIC} + {"E_Na", "millivolt", "Ionic_values"}, + {"Nai", "millimolar", "Nai_concentration"}, + {"E_Ca", "millivolt", "Ionic_values"}, + {"i_Na", "nanoA", "i_Na"}, + {"i_NaCa", "nanoA", "i_NaCa"}, + {"i_NaK", "nanoA", "i_NaK"}, + {"i_siNa", "nanoA", "i_CaL"}, + {"i_fNa", "nanoA", "i_f"}, + {"V", "millivolt", "Membrane"}, + {"x2", "dimensionless", "i_NaCa"}, + {"k21", "dimensionless", "i_NaCa"}, + {"x1", "dimensionless", "i_NaCa"}, + {"k12", "dimensionless", "i_NaCa"}, + {"x4", "dimensionless", "i_NaCa"}, + {"x3", "dimensionless", "i_NaCa"}, + {"k41", "dimensionless", "i_NaCa"}, + {"k23", "dimensionless", "i_NaCa"}, + {"k43", "dimensionless", "i_NaCa"}, + {"k32", "dimensionless", "i_NaCa"}, + {"k14", "dimensionless", "i_NaCa"}, + {"di", "dimensionless", "i_NaCa"}, + {"do", "dimensionless", "i_NaCa"}, + {"j_SRCarel", "millimolar_per_second", "Ca_SR_release"}, + {"diff", "millimolar", "Ca_SR_release"}, + {"kCaSR", "dimensionless", "Ca_SR_release"}, + {"koSRCa", "per_millimolar2_second", "Ca_SR_release"}, + {"kiSRCa", "per_millimolar_second", "Ca_SR_release"}, + {"P_tot", "dimensionless", "Ca_SR_release"}, + {"j_Ca_dif", "millimolar_per_second", "Ca_intracellular_fluxes"}, + {"j_up", "millimolar_per_second", "Ca_intracellular_fluxes"}, + {"j_tr", "millimolar_per_second", "Ca_intracellular_fluxes"}, + {"delta_fTC", "per_second", "Ca_buffering"}, + {"delta_fTMC", "per_second", "Ca_buffering"}, + {"delta_fTMM", "per_second", "Ca_buffering"}, + {"delta_fCMi", "per_second", "Ca_buffering"}, + {"delta_fCMs", "per_second", "Ca_buffering"}, + {"delta_fCQ", "per_second", "Ca_buffering"}, + {"i_siCa", "nanoA", "i_CaL"}, + {"i_CaT", "nanoA", "i_CaT"}, + {"i_tot", "nanoA", "Membrane"}, + {"i_f", "nanoA", "i_f"}, + {"i_Kur", "nanoA", "i_Kur"}, + {"i_KACh", "nanoA", "i_KACh"}, + {"i_CaL", "nanoA", "i_CaL"}, + {"i_to", "nanoA", "i_to"}, + {"i_Ks", "nanoA", "i_Ks"}, + {"i_Kr", "nanoA", "i_Kr"}, + {"V_clamp", "millivolt", "Voltage_clamp"}, + {"i_fK", "nanoA", "i_f"}, + {"tau_y", "second", "i_f_y_gate"}, + {"y_infinity", "dimensionless", "i_f_y_gate"}, + {"E_mh", "millivolt", "i_Na"}, + {"i_Na_", "nanoA", "i_Na"}, + {"i_Na_L", "nanoA", "i_Na"}, + {"m_infinity", "dimensionless", "i_Na_m_gate"}, + {"E0_m", "millivolt", "i_Na_m_gate"}, + {"alpha_m", "per_second", "i_Na_m_gate"}, + {"beta_m", "per_second", "i_Na_m_gate"}, + {"tau_m", "second", "i_Na_m_gate"}, + {"h_infinity", "dimensionless", "i_Na_h_gate"}, + {"alpha_h", "per_second", "i_Na_h_gate"}, + {"beta_h", "per_second", "i_Na_h_gate"}, + {"tau_h", "second", "i_Na_h_gate"}, + {"r_Kur_infinity", "dimensionless", "i_Kur_rKur_gate"}, + {"tau_r_Kur", "second", "i_Kur_rKur_gate"}, + {"s_Kur_infinity", "dimensionless", "i_Kur_sKur_gate"}, + {"tau_s_Kur", "second", "i_Kur_sKur_gate"}, + {"i_siK", "nanoA", "i_CaL"}, + {"dL_infinity", "dimensionless", "i_CaL_dL_gate"}, + {"tau_dL", "second", "i_CaL_dL_gate"}, + {"alpha_dL", "per_second", "i_CaL_dL_gate"}, + {"beta_dL", "per_second", "i_CaL_dL_gate"}, + {"adVm", "millivolt", "i_CaL_dL_gate"}, + {"bdVm", "millivolt", "i_CaL_dL_gate"}, + {"fL_infinity", "dimensionless", "i_CaL_fL_gate"}, + {"tau_fL", "second", "i_CaL_fL_gate"}, + {"fCa_infinity", "dimensionless", "i_CaL_fCa_gate"}, + {"tau_fCa", "second", "i_CaL_fCa_gate"}, + {"dT_infinity", "dimensionless", "i_CaT_dT_gate"}, + {"tau_dT", "second", "i_CaT_dT_gate"}, + {"fT_infinity", "dimensionless", "i_CaT_fT_gate"}, + {"tau_fT", "second", "i_CaT_fT_gate"}, + {"q_infinity", "dimensionless", "i_to_q_gate"}, + {"tau_q", "second", "i_to_q_gate"}, + {"r_infinity", "dimensionless", "i_to_r_gate"}, + {"tau_r", "second", "i_to_r_gate"}, + {"alfapaF", "per_second", "i_Kr_pa_gate"}, + {"betapaF", "per_second", "i_Kr_pa_gate"}, + {"pa_infinity", "dimensionless", "i_Kr_pa_gate"}, + {"tau_paS", "second", "i_Kr_pa_gate"}, + {"tau_paF", "second", "i_Kr_pa_gate"}, + {"tau_pi", "second", "i_Kr_pi_gate"}, + {"pi_infinity", "dimensionless", "i_Kr_pi_gate"}, + {"E_Ks", "millivolt", "i_Ks"}, + {"n_infinity", "dimensionless", "i_Ks_n_gate"}, + {"tau_n", "second", "i_Ks_n_gate"}, + {"alpha_n", "per_second", "i_Ks_n_gate"}, + {"beta_n", "per_second", "i_Ks_n_gate"}, + {"beta_a", "per_second", "i_KACh_a_gate"}, + {"a_infinity", "dimensionless", "i_KACh_a_gate"}, + {"tau_a", "second", "i_KACh_a_gate"} }; double * createStatesArray() diff --git a/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.h b/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.h index 1fee5d4d2b..72b9004c18 100644 --- a/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.h +++ b/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.h @@ -12,19 +12,10 @@ extern const size_t CONSTANT_COUNT; extern const size_t COMPUTED_CONSTANT_COUNT; extern const size_t ALGEBRAIC_COUNT; -typedef enum { - VARIABLE_OF_INTEGRATION, - STATE, - CONSTANT, - COMPUTED_CONSTANT, - ALGEBRAIC -} VariableType; - typedef struct { char name[15]; char units[26]; char component[28]; - VariableType type; } VariableInfo; extern const VariableInfo VOI_INFO; diff --git a/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.py b/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.py index ef40ae85f8..41c3234100 100644 --- a/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.py +++ b/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.py @@ -12,276 +12,267 @@ COMPUTED_CONSTANT_COUNT = 25 ALGEBRAIC_COUNT = 101 - -class VariableType(Enum): - VARIABLE_OF_INTEGRATION = 0 - STATE = 1 - CONSTANT = 2 - COMPUTED_CONSTANT = 3 - ALGEBRAIC = 4 - - -VOI_INFO = {"name": "time", "units": "second", "component": "environment", "type": VariableType.VARIABLE_OF_INTEGRATION} - -STATE_INFO = {"name": "Ca_sub", "units": "millimolar", "component": "Ca_dynamics", "type": VariableType.STATE}, - {"name": "Nai_", "units": "millimolar", "component": "Nai_concentration", "type": VariableType.STATE}, - {"name": "Ca_jsr", "units": "millimolar", "component": "Ca_dynamics", "type": VariableType.STATE}, - {"name": "O", "units": "dimensionless", "component": "Ca_SR_release", "type": VariableType.STATE}, - {"name": "R", "units": "dimensionless", "component": "Ca_SR_release", "type": VariableType.STATE}, - {"name": "RI", "units": "dimensionless", "component": "Ca_SR_release", "type": VariableType.STATE}, - {"name": "I", "units": "dimensionless", "component": "Ca_SR_release", "type": VariableType.STATE}, - {"name": "Cai", "units": "millimolar", "component": "Ca_dynamics", "type": VariableType.STATE}, - {"name": "Ca_nsr", "units": "millimolar", "component": "Ca_dynamics", "type": VariableType.STATE}, - {"name": "fTC", "units": "dimensionless", "component": "Ca_buffering", "type": VariableType.STATE}, - {"name": "fTMC", "units": "dimensionless", "component": "Ca_buffering", "type": VariableType.STATE}, - {"name": "fTMM", "units": "dimensionless", "component": "Ca_buffering", "type": VariableType.STATE}, - {"name": "fCMi", "units": "dimensionless", "component": "Ca_buffering", "type": VariableType.STATE}, - {"name": "fCMs", "units": "dimensionless", "component": "Ca_buffering", "type": VariableType.STATE}, - {"name": "fCQ", "units": "dimensionless", "component": "Ca_buffering", "type": VariableType.STATE}, - {"name": "V_ode", "units": "millivolt", "component": "Membrane", "type": VariableType.STATE}, - {"name": "y", "units": "dimensionless", "component": "i_f_y_gate", "type": VariableType.STATE}, - {"name": "h", "units": "dimensionless", "component": "i_Na_h_gate", "type": VariableType.STATE}, - {"name": "m", "units": "dimensionless", "component": "i_Na_m_gate", "type": VariableType.STATE}, - {"name": "s_Kur", "units": "dimensionless", "component": "i_Kur_sKur_gate", "type": VariableType.STATE}, - {"name": "r_Kur", "units": "dimensionless", "component": "i_Kur_rKur_gate", "type": VariableType.STATE}, - {"name": "fCa", "units": "dimensionless", "component": "i_CaL_fCa_gate", "type": VariableType.STATE}, - {"name": "fL", "units": "dimensionless", "component": "i_CaL_fL_gate", "type": VariableType.STATE}, - {"name": "dL", "units": "dimensionless", "component": "i_CaL_dL_gate", "type": VariableType.STATE}, - {"name": "fT", "units": "dimensionless", "component": "i_CaT_fT_gate", "type": VariableType.STATE}, - {"name": "dT", "units": "dimensionless", "component": "i_CaT_dT_gate", "type": VariableType.STATE}, - {"name": "r", "units": "dimensionless", "component": "i_to_r_gate", "type": VariableType.STATE}, - {"name": "q", "units": "dimensionless", "component": "i_to_q_gate", "type": VariableType.STATE}, - {"name": "piy", "units": "dimensionless", "component": "i_Kr_pi_gate", "type": VariableType.STATE}, - {"name": "paF", "units": "dimensionless", "component": "i_Kr_pa_gate", "type": VariableType.STATE}, - {"name": "paS", "units": "dimensionless", "component": "i_Kr_pa_gate", "type": VariableType.STATE}, - {"name": "n", "units": "dimensionless", "component": "i_Ks_n_gate", "type": VariableType.STATE}, - {"name": "a", "units": "dimensionless", "component": "i_KACh_a_gate", "type": VariableType.STATE} +VOI_INFO = {"name": "time", "units": "second", "component": "environment"} + +STATE_INFO = {"name": "Ca_sub", "units": "millimolar", "component": "Ca_dynamics"}, + {"name": "Nai_", "units": "millimolar", "component": "Nai_concentration"}, + {"name": "Ca_jsr", "units": "millimolar", "component": "Ca_dynamics"}, + {"name": "O", "units": "dimensionless", "component": "Ca_SR_release"}, + {"name": "R", "units": "dimensionless", "component": "Ca_SR_release"}, + {"name": "RI", "units": "dimensionless", "component": "Ca_SR_release"}, + {"name": "I", "units": "dimensionless", "component": "Ca_SR_release"}, + {"name": "Cai", "units": "millimolar", "component": "Ca_dynamics"}, + {"name": "Ca_nsr", "units": "millimolar", "component": "Ca_dynamics"}, + {"name": "fTC", "units": "dimensionless", "component": "Ca_buffering"}, + {"name": "fTMC", "units": "dimensionless", "component": "Ca_buffering"}, + {"name": "fTMM", "units": "dimensionless", "component": "Ca_buffering"}, + {"name": "fCMi", "units": "dimensionless", "component": "Ca_buffering"}, + {"name": "fCMs", "units": "dimensionless", "component": "Ca_buffering"}, + {"name": "fCQ", "units": "dimensionless", "component": "Ca_buffering"}, + {"name": "V_ode", "units": "millivolt", "component": "Membrane"}, + {"name": "y", "units": "dimensionless", "component": "i_f_y_gate"}, + {"name": "h", "units": "dimensionless", "component": "i_Na_h_gate"}, + {"name": "m", "units": "dimensionless", "component": "i_Na_m_gate"}, + {"name": "s_Kur", "units": "dimensionless", "component": "i_Kur_sKur_gate"}, + {"name": "r_Kur", "units": "dimensionless", "component": "i_Kur_rKur_gate"}, + {"name": "fCa", "units": "dimensionless", "component": "i_CaL_fCa_gate"}, + {"name": "fL", "units": "dimensionless", "component": "i_CaL_fL_gate"}, + {"name": "dL", "units": "dimensionless", "component": "i_CaL_dL_gate"}, + {"name": "fT", "units": "dimensionless", "component": "i_CaT_fT_gate"}, + {"name": "dT", "units": "dimensionless", "component": "i_CaT_dT_gate"}, + {"name": "r", "units": "dimensionless", "component": "i_to_r_gate"}, + {"name": "q", "units": "dimensionless", "component": "i_to_q_gate"}, + {"name": "piy", "units": "dimensionless", "component": "i_Kr_pi_gate"}, + {"name": "paF", "units": "dimensionless", "component": "i_Kr_pa_gate"}, + {"name": "paS", "units": "dimensionless", "component": "i_Kr_pa_gate"}, + {"name": "n", "units": "dimensionless", "component": "i_Ks_n_gate"}, + {"name": "a", "units": "dimensionless", "component": "i_KACh_a_gate"} CONSTANT_INFO = [ - {"name": "ACh", "units": "millimolar", "component": "Rate_modulation_experiments", "type": VariableType.CONSTANT}, - {"name": "Iso_1_uM", "units": "dimensionless", "component": "Rate_modulation_experiments", "type": VariableType.CONSTANT}, - {"name": "Nao", "units": "millimolar", "component": "Ionic_values", "type": VariableType.CONSTANT}, - {"name": "Ko", "units": "millimolar", "component": "Ionic_values", "type": VariableType.CONSTANT}, - {"name": "Ki", "units": "millimolar", "component": "Ionic_values", "type": VariableType.CONSTANT}, - {"name": "Cao", "units": "millimolar", "component": "Ionic_values", "type": VariableType.CONSTANT}, - {"name": "Nai_clamp", "units": "dimensionless", "component": "Nai_concentration", "type": VariableType.CONSTANT}, - {"name": "F", "units": "coulomb_per_mole", "component": "Membrane", "type": VariableType.CONSTANT}, - {"name": "Km_Nap", "units": "millimolar", "component": "i_NaK", "type": VariableType.CONSTANT}, - {"name": "Km_Kp", "units": "millimolar", "component": "i_NaK", "type": VariableType.CONSTANT}, - {"name": "i_NaK_max", "units": "nanoA", "component": "i_NaK", "type": VariableType.CONSTANT}, - {"name": "blockade_NaCa", "units": "dimensionless", "component": "i_NaCa", "type": VariableType.CONSTANT}, - {"name": "K_NaCa", "units": "nanoA", "component": "i_NaCa", "type": VariableType.CONSTANT}, - {"name": "K3ni", "units": "millimolar", "component": "i_NaCa", "type": VariableType.CONSTANT}, - {"name": "Kci", "units": "millimolar", "component": "i_NaCa", "type": VariableType.CONSTANT}, - {"name": "Qci", "units": "dimensionless", "component": "i_NaCa", "type": VariableType.CONSTANT}, - {"name": "K1ni", "units": "millimolar", "component": "i_NaCa", "type": VariableType.CONSTANT}, - {"name": "K2ni", "units": "millimolar", "component": "i_NaCa", "type": VariableType.CONSTANT}, - {"name": "Qn", "units": "dimensionless", "component": "i_NaCa", "type": VariableType.CONSTANT}, - {"name": "Kcni", "units": "millimolar", "component": "i_NaCa", "type": VariableType.CONSTANT}, - {"name": "K3no", "units": "millimolar", "component": "i_NaCa", "type": VariableType.CONSTANT}, - {"name": "Kco", "units": "millimolar", "component": "i_NaCa", "type": VariableType.CONSTANT}, - {"name": "Qco", "units": "dimensionless", "component": "i_NaCa", "type": VariableType.CONSTANT}, - {"name": "K1no", "units": "millimolar", "component": "i_NaCa", "type": VariableType.CONSTANT}, - {"name": "K2no", "units": "millimolar", "component": "i_NaCa", "type": VariableType.CONSTANT}, - {"name": "ks", "units": "per_second", "component": "Ca_SR_release", "type": VariableType.CONSTANT}, - {"name": "MaxSR", "units": "dimensionless", "component": "Ca_SR_release", "type": VariableType.CONSTANT}, - {"name": "MinSR", "units": "dimensionless", "component": "Ca_SR_release", "type": VariableType.CONSTANT}, - {"name": "EC50_SR", "units": "millimolar", "component": "Ca_SR_release", "type": VariableType.CONSTANT}, - {"name": "HSR", "units": "dimensionless", "component": "Ca_SR_release", "type": VariableType.CONSTANT}, - {"name": "koCa", "units": "per_millimolar2_second", "component": "Ca_SR_release", "type": VariableType.CONSTANT}, - {"name": "kiCa", "units": "per_millimolar_second", "component": "Ca_SR_release", "type": VariableType.CONSTANT}, - {"name": "kim", "units": "per_second", "component": "Ca_SR_release", "type": VariableType.CONSTANT}, - {"name": "kom", "units": "per_second", "component": "Ca_SR_release", "type": VariableType.CONSTANT}, - {"name": "P_up_basal", "units": "millimolar_per_second", "component": "Ca_intracellular_fluxes", "type": VariableType.CONSTANT}, - {"name": "tau_dif_Ca", "units": "second", "component": "Ca_intracellular_fluxes", "type": VariableType.CONSTANT}, - {"name": "K_up", "units": "millimolar", "component": "Ca_intracellular_fluxes", "type": VariableType.CONSTANT}, - {"name": "slope_up", "units": "millimolar", "component": "Ca_intracellular_fluxes", "type": VariableType.CONSTANT}, - {"name": "tau_tr", "units": "second", "component": "Ca_intracellular_fluxes", "type": VariableType.CONSTANT}, - {"name": "kf_TC", "units": "per_millimolar_second", "component": "Ca_buffering", "type": VariableType.CONSTANT}, - {"name": "kb_TC", "units": "per_second", "component": "Ca_buffering", "type": VariableType.CONSTANT}, - {"name": "kf_TMC", "units": "per_millimolar_second", "component": "Ca_buffering", "type": VariableType.CONSTANT}, - {"name": "kb_TMC", "units": "per_second", "component": "Ca_buffering", "type": VariableType.CONSTANT}, - {"name": "kf_TMM", "units": "per_millimolar_second", "component": "Ca_buffering", "type": VariableType.CONSTANT}, - {"name": "Mgi", "units": "millimolar", "component": "Ca_buffering", "type": VariableType.CONSTANT}, - {"name": "kb_TMM", "units": "per_second", "component": "Ca_buffering", "type": VariableType.CONSTANT}, - {"name": "kf_CM", "units": "per_millimolar_second", "component": "Ca_buffering", "type": VariableType.CONSTANT}, - {"name": "kb_CM", "units": "per_second", "component": "Ca_buffering", "type": VariableType.CONSTANT}, - {"name": "kf_CQ", "units": "per_millimolar_second", "component": "Ca_buffering", "type": VariableType.CONSTANT}, - {"name": "kb_CQ", "units": "per_second", "component": "Ca_buffering", "type": VariableType.CONSTANT}, - {"name": "TC_tot", "units": "millimolar", "component": "Ca_buffering", "type": VariableType.CONSTANT}, - {"name": "TMC_tot", "units": "millimolar", "component": "Ca_buffering", "type": VariableType.CONSTANT}, - {"name": "CM_tot", "units": "millimolar", "component": "Ca_buffering", "type": VariableType.CONSTANT}, - {"name": "CQ_tot", "units": "millimolar", "component": "Ca_buffering", "type": VariableType.CONSTANT}, - {"name": "L_cell", "units": "micrometre", "component": "Cell_parameters", "type": VariableType.CONSTANT}, - {"name": "R_cell", "units": "micrometre", "component": "Cell_parameters", "type": VariableType.CONSTANT}, - {"name": "L_sub", "units": "micrometre", "component": "Cell_parameters", "type": VariableType.CONSTANT}, - {"name": "V_jsr_part", "units": "dimensionless", "component": "Cell_parameters", "type": VariableType.CONSTANT}, - {"name": "V_i_part", "units": "dimensionless", "component": "Cell_parameters", "type": VariableType.CONSTANT}, - {"name": "V_nsr_part", "units": "dimensionless", "component": "Cell_parameters", "type": VariableType.CONSTANT}, - {"name": "C", "units": "microF", "component": "Membrane", "type": VariableType.CONSTANT}, - {"name": "R", "units": "joule_per_kilomole_kelvin", "component": "Membrane", "type": VariableType.CONSTANT}, - {"name": "T", "units": "kelvin", "component": "Membrane", "type": VariableType.CONSTANT}, - {"name": "clamp_mode", "units": "dimensionless", "component": "Membrane", "type": VariableType.CONSTANT}, - {"name": "V_test", "units": "millivolt", "component": "Voltage_clamp", "type": VariableType.CONSTANT}, - {"name": "t_holding", "units": "second", "component": "Voltage_clamp", "type": VariableType.CONSTANT}, - {"name": "t_test", "units": "second", "component": "Voltage_clamp", "type": VariableType.CONSTANT}, - {"name": "V_holding", "units": "millivolt", "component": "Voltage_clamp", "type": VariableType.CONSTANT}, - {"name": "g_f", "units": "microS", "component": "i_f", "type": VariableType.CONSTANT}, - {"name": "Km_f", "units": "millimolar", "component": "i_f", "type": VariableType.CONSTANT}, - {"name": "alpha", "units": "dimensionless", "component": "i_f", "type": VariableType.CONSTANT}, - {"name": "blockade", "units": "dimensionless", "component": "i_f", "type": VariableType.CONSTANT}, - {"name": "y_shift", "units": "millivolt", "component": "i_f_y_gate", "type": VariableType.CONSTANT}, - {"name": "g_Na", "units": "microS", "component": "i_Na", "type": VariableType.CONSTANT}, - {"name": "g_Na_L", "units": "microS", "component": "i_Na", "type": VariableType.CONSTANT}, - {"name": "delta_m", "units": "millivolt", "component": "i_Na_m_gate", "type": VariableType.CONSTANT}, - {"name": "g_Kur", "units": "microS", "component": "i_Kur", "type": VariableType.CONSTANT}, - {"name": "P_CaL", "units": "nanoA_per_millimolar", "component": "i_CaL", "type": VariableType.CONSTANT}, - {"name": "V_dL", "units": "millivolt", "component": "i_CaL_dL_gate", "type": VariableType.CONSTANT}, - {"name": "k_dL", "units": "millivolt", "component": "i_CaL_dL_gate", "type": VariableType.CONSTANT}, - {"name": "shift_fL", "units": "millivolt", "component": "i_CaL_fL_gate", "type": VariableType.CONSTANT}, - {"name": "k_fL", "units": "millivolt", "component": "i_CaL_fL_gate", "type": VariableType.CONSTANT}, - {"name": "Km_fCa", "units": "millimolar", "component": "i_CaL_fCa_gate", "type": VariableType.CONSTANT}, - {"name": "alpha_fCa", "units": "per_second", "component": "i_CaL_fCa_gate", "type": VariableType.CONSTANT}, - {"name": "P_CaT", "units": "nanoA_per_millimolar", "component": "i_CaT", "type": VariableType.CONSTANT}, - {"name": "offset_fT", "units": "second", "component": "i_CaT_fT_gate", "type": VariableType.CONSTANT}, - {"name": "g_to", "units": "microS", "component": "i_to", "type": VariableType.CONSTANT}, - {"name": "g_Kr", "units": "microS", "component": "i_Kr", "type": VariableType.CONSTANT}, - {"name": "g_Ks_", "units": "microS", "component": "i_Ks", "type": VariableType.CONSTANT}, - {"name": "ACh_on", "units": "dimensionless", "component": "i_KACh", "type": VariableType.CONSTANT}, - {"name": "g_KACh", "units": "microS", "component": "i_KACh", "type": VariableType.CONSTANT} + {"name": "ACh", "units": "millimolar", "component": "Rate_modulation_experiments"}, + {"name": "Iso_1_uM", "units": "dimensionless", "component": "Rate_modulation_experiments"}, + {"name": "Nao", "units": "millimolar", "component": "Ionic_values"}, + {"name": "Ko", "units": "millimolar", "component": "Ionic_values"}, + {"name": "Ki", "units": "millimolar", "component": "Ionic_values"}, + {"name": "Cao", "units": "millimolar", "component": "Ionic_values"}, + {"name": "Nai_clamp", "units": "dimensionless", "component": "Nai_concentration"}, + {"name": "F", "units": "coulomb_per_mole", "component": "Membrane"}, + {"name": "Km_Nap", "units": "millimolar", "component": "i_NaK"}, + {"name": "Km_Kp", "units": "millimolar", "component": "i_NaK"}, + {"name": "i_NaK_max", "units": "nanoA", "component": "i_NaK"}, + {"name": "blockade_NaCa", "units": "dimensionless", "component": "i_NaCa"}, + {"name": "K_NaCa", "units": "nanoA", "component": "i_NaCa"}, + {"name": "K3ni", "units": "millimolar", "component": "i_NaCa"}, + {"name": "Kci", "units": "millimolar", "component": "i_NaCa"}, + {"name": "Qci", "units": "dimensionless", "component": "i_NaCa"}, + {"name": "K1ni", "units": "millimolar", "component": "i_NaCa"}, + {"name": "K2ni", "units": "millimolar", "component": "i_NaCa"}, + {"name": "Qn", "units": "dimensionless", "component": "i_NaCa"}, + {"name": "Kcni", "units": "millimolar", "component": "i_NaCa"}, + {"name": "K3no", "units": "millimolar", "component": "i_NaCa"}, + {"name": "Kco", "units": "millimolar", "component": "i_NaCa"}, + {"name": "Qco", "units": "dimensionless", "component": "i_NaCa"}, + {"name": "K1no", "units": "millimolar", "component": "i_NaCa"}, + {"name": "K2no", "units": "millimolar", "component": "i_NaCa"}, + {"name": "ks", "units": "per_second", "component": "Ca_SR_release"}, + {"name": "MaxSR", "units": "dimensionless", "component": "Ca_SR_release"}, + {"name": "MinSR", "units": "dimensionless", "component": "Ca_SR_release"}, + {"name": "EC50_SR", "units": "millimolar", "component": "Ca_SR_release"}, + {"name": "HSR", "units": "dimensionless", "component": "Ca_SR_release"}, + {"name": "koCa", "units": "per_millimolar2_second", "component": "Ca_SR_release"}, + {"name": "kiCa", "units": "per_millimolar_second", "component": "Ca_SR_release"}, + {"name": "kim", "units": "per_second", "component": "Ca_SR_release"}, + {"name": "kom", "units": "per_second", "component": "Ca_SR_release"}, + {"name": "P_up_basal", "units": "millimolar_per_second", "component": "Ca_intracellular_fluxes"}, + {"name": "tau_dif_Ca", "units": "second", "component": "Ca_intracellular_fluxes"}, + {"name": "K_up", "units": "millimolar", "component": "Ca_intracellular_fluxes"}, + {"name": "slope_up", "units": "millimolar", "component": "Ca_intracellular_fluxes"}, + {"name": "tau_tr", "units": "second", "component": "Ca_intracellular_fluxes"}, + {"name": "kf_TC", "units": "per_millimolar_second", "component": "Ca_buffering"}, + {"name": "kb_TC", "units": "per_second", "component": "Ca_buffering"}, + {"name": "kf_TMC", "units": "per_millimolar_second", "component": "Ca_buffering"}, + {"name": "kb_TMC", "units": "per_second", "component": "Ca_buffering"}, + {"name": "kf_TMM", "units": "per_millimolar_second", "component": "Ca_buffering"}, + {"name": "Mgi", "units": "millimolar", "component": "Ca_buffering"}, + {"name": "kb_TMM", "units": "per_second", "component": "Ca_buffering"}, + {"name": "kf_CM", "units": "per_millimolar_second", "component": "Ca_buffering"}, + {"name": "kb_CM", "units": "per_second", "component": "Ca_buffering"}, + {"name": "kf_CQ", "units": "per_millimolar_second", "component": "Ca_buffering"}, + {"name": "kb_CQ", "units": "per_second", "component": "Ca_buffering"}, + {"name": "TC_tot", "units": "millimolar", "component": "Ca_buffering"}, + {"name": "TMC_tot", "units": "millimolar", "component": "Ca_buffering"}, + {"name": "CM_tot", "units": "millimolar", "component": "Ca_buffering"}, + {"name": "CQ_tot", "units": "millimolar", "component": "Ca_buffering"}, + {"name": "L_cell", "units": "micrometre", "component": "Cell_parameters"}, + {"name": "R_cell", "units": "micrometre", "component": "Cell_parameters"}, + {"name": "L_sub", "units": "micrometre", "component": "Cell_parameters"}, + {"name": "V_jsr_part", "units": "dimensionless", "component": "Cell_parameters"}, + {"name": "V_i_part", "units": "dimensionless", "component": "Cell_parameters"}, + {"name": "V_nsr_part", "units": "dimensionless", "component": "Cell_parameters"}, + {"name": "C", "units": "microF", "component": "Membrane"}, + {"name": "R", "units": "joule_per_kilomole_kelvin", "component": "Membrane"}, + {"name": "T", "units": "kelvin", "component": "Membrane"}, + {"name": "clamp_mode", "units": "dimensionless", "component": "Membrane"}, + {"name": "V_test", "units": "millivolt", "component": "Voltage_clamp"}, + {"name": "t_holding", "units": "second", "component": "Voltage_clamp"}, + {"name": "t_test", "units": "second", "component": "Voltage_clamp"}, + {"name": "V_holding", "units": "millivolt", "component": "Voltage_clamp"}, + {"name": "g_f", "units": "microS", "component": "i_f"}, + {"name": "Km_f", "units": "millimolar", "component": "i_f"}, + {"name": "alpha", "units": "dimensionless", "component": "i_f"}, + {"name": "blockade", "units": "dimensionless", "component": "i_f"}, + {"name": "y_shift", "units": "millivolt", "component": "i_f_y_gate"}, + {"name": "g_Na", "units": "microS", "component": "i_Na"}, + {"name": "g_Na_L", "units": "microS", "component": "i_Na"}, + {"name": "delta_m", "units": "millivolt", "component": "i_Na_m_gate"}, + {"name": "g_Kur", "units": "microS", "component": "i_Kur"}, + {"name": "P_CaL", "units": "nanoA_per_millimolar", "component": "i_CaL"}, + {"name": "V_dL", "units": "millivolt", "component": "i_CaL_dL_gate"}, + {"name": "k_dL", "units": "millivolt", "component": "i_CaL_dL_gate"}, + {"name": "shift_fL", "units": "millivolt", "component": "i_CaL_fL_gate"}, + {"name": "k_fL", "units": "millivolt", "component": "i_CaL_fL_gate"}, + {"name": "Km_fCa", "units": "millimolar", "component": "i_CaL_fCa_gate"}, + {"name": "alpha_fCa", "units": "per_second", "component": "i_CaL_fCa_gate"}, + {"name": "P_CaT", "units": "nanoA_per_millimolar", "component": "i_CaT"}, + {"name": "offset_fT", "units": "second", "component": "i_CaT_fT_gate"}, + {"name": "g_to", "units": "microS", "component": "i_to"}, + {"name": "g_Kr", "units": "microS", "component": "i_Kr"}, + {"name": "g_Ks_", "units": "microS", "component": "i_Ks"}, + {"name": "ACh_on", "units": "dimensionless", "component": "i_KACh"}, + {"name": "g_KACh", "units": "microS", "component": "i_KACh"} ] COMPUTED_CONSTANT_INFO = [ - {"name": "RTONF", "units": "millivolt", "component": "Membrane", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "E_K", "units": "millivolt", "component": "Ionic_values", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "V_i", "units": "millimetre3", "component": "Cell_parameters", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "V_sub", "units": "millimetre3", "component": "Cell_parameters", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "Iso_increase", "units": "dimensionless", "component": "i_NaK", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "k34", "units": "dimensionless", "component": "i_NaCa", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "b_up", "units": "dimensionless", "component": "Ca_intracellular_fluxes", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "P_up", "units": "millimolar_per_second", "component": "Ca_intracellular_fluxes", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "V_nsr", "units": "millimetre3", "component": "Cell_parameters", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "V_jsr", "units": "millimetre3", "component": "Cell_parameters", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "V_cell", "units": "millimetre3", "component": "Cell_parameters", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "G_f", "units": "microS", "component": "i_f", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "G_f_K", "units": "microS", "component": "i_f", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "G_f_Na", "units": "microS", "component": "i_f", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "g_f_Na", "units": "microS", "component": "i_f", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "g_f_K", "units": "microS", "component": "i_f", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "ACh_shift", "units": "millivolt", "component": "i_f_y_gate", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "Iso_shift", "units": "millivolt", "component": "i_f_y_gate", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "Iso_increase", "units": "dimensionless", "component": "i_CaL", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "ACh_block", "units": "dimensionless", "component": "i_CaL", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "Iso_shift_dL", "units": "millivolt", "component": "i_CaL_dL_gate", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "Iso_slope_dL", "units": "dimensionless", "component": "i_CaL_dL_gate", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "g_Ks", "units": "microS", "component": "i_Ks", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "Iso_shift", "units": "millivolt", "component": "i_Ks_n_gate", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "alpha_a", "units": "per_second", "component": "i_KACh_a_gate", "type": VariableType.COMPUTED_CONSTANT} + {"name": "RTONF", "units": "millivolt", "component": "Membrane"}, + {"name": "E_K", "units": "millivolt", "component": "Ionic_values"}, + {"name": "V_i", "units": "millimetre3", "component": "Cell_parameters"}, + {"name": "V_sub", "units": "millimetre3", "component": "Cell_parameters"}, + {"name": "Iso_increase", "units": "dimensionless", "component": "i_NaK"}, + {"name": "k34", "units": "dimensionless", "component": "i_NaCa"}, + {"name": "b_up", "units": "dimensionless", "component": "Ca_intracellular_fluxes"}, + {"name": "P_up", "units": "millimolar_per_second", "component": "Ca_intracellular_fluxes"}, + {"name": "V_nsr", "units": "millimetre3", "component": "Cell_parameters"}, + {"name": "V_jsr", "units": "millimetre3", "component": "Cell_parameters"}, + {"name": "V_cell", "units": "millimetre3", "component": "Cell_parameters"}, + {"name": "G_f", "units": "microS", "component": "i_f"}, + {"name": "G_f_K", "units": "microS", "component": "i_f"}, + {"name": "G_f_Na", "units": "microS", "component": "i_f"}, + {"name": "g_f_Na", "units": "microS", "component": "i_f"}, + {"name": "g_f_K", "units": "microS", "component": "i_f"}, + {"name": "ACh_shift", "units": "millivolt", "component": "i_f_y_gate"}, + {"name": "Iso_shift", "units": "millivolt", "component": "i_f_y_gate"}, + {"name": "Iso_increase", "units": "dimensionless", "component": "i_CaL"}, + {"name": "ACh_block", "units": "dimensionless", "component": "i_CaL"}, + {"name": "Iso_shift_dL", "units": "millivolt", "component": "i_CaL_dL_gate"}, + {"name": "Iso_slope_dL", "units": "dimensionless", "component": "i_CaL_dL_gate"}, + {"name": "g_Ks", "units": "microS", "component": "i_Ks"}, + {"name": "Iso_shift", "units": "millivolt", "component": "i_Ks_n_gate"}, + {"name": "alpha_a", "units": "per_second", "component": "i_KACh_a_gate"} ] ALGEBRAIC_INFO = [ - {"name": "E_Na", "units": "millivolt", "component": "Ionic_values", "type": VariableType.ALGEBRAIC}, - {"name": "Nai", "units": "millimolar", "component": "Nai_concentration", "type": VariableType.ALGEBRAIC}, - {"name": "E_Ca", "units": "millivolt", "component": "Ionic_values", "type": VariableType.ALGEBRAIC}, - {"name": "i_Na", "units": "nanoA", "component": "i_Na", "type": VariableType.ALGEBRAIC}, - {"name": "i_NaCa", "units": "nanoA", "component": "i_NaCa", "type": VariableType.ALGEBRAIC}, - {"name": "i_NaK", "units": "nanoA", "component": "i_NaK", "type": VariableType.ALGEBRAIC}, - {"name": "i_siNa", "units": "nanoA", "component": "i_CaL", "type": VariableType.ALGEBRAIC}, - {"name": "i_fNa", "units": "nanoA", "component": "i_f", "type": VariableType.ALGEBRAIC}, - {"name": "V", "units": "millivolt", "component": "Membrane", "type": VariableType.ALGEBRAIC}, - {"name": "x2", "units": "dimensionless", "component": "i_NaCa", "type": VariableType.ALGEBRAIC}, - {"name": "k21", "units": "dimensionless", "component": "i_NaCa", "type": VariableType.ALGEBRAIC}, - {"name": "x1", "units": "dimensionless", "component": "i_NaCa", "type": VariableType.ALGEBRAIC}, - {"name": "k12", "units": "dimensionless", "component": "i_NaCa", "type": VariableType.ALGEBRAIC}, - {"name": "x4", "units": "dimensionless", "component": "i_NaCa", "type": VariableType.ALGEBRAIC}, - {"name": "x3", "units": "dimensionless", "component": "i_NaCa", "type": VariableType.ALGEBRAIC}, - {"name": "k41", "units": "dimensionless", "component": "i_NaCa", "type": VariableType.ALGEBRAIC}, - {"name": "k23", "units": "dimensionless", "component": "i_NaCa", "type": VariableType.ALGEBRAIC}, - {"name": "k43", "units": "dimensionless", "component": "i_NaCa", "type": VariableType.ALGEBRAIC}, - {"name": "k32", "units": "dimensionless", "component": "i_NaCa", "type": VariableType.ALGEBRAIC}, - {"name": "k14", "units": "dimensionless", "component": "i_NaCa", "type": VariableType.ALGEBRAIC}, - {"name": "di", "units": "dimensionless", "component": "i_NaCa", "type": VariableType.ALGEBRAIC}, - {"name": "do", "units": "dimensionless", "component": "i_NaCa", "type": VariableType.ALGEBRAIC}, - {"name": "j_SRCarel", "units": "millimolar_per_second", "component": "Ca_SR_release", "type": VariableType.ALGEBRAIC}, - {"name": "diff", "units": "millimolar", "component": "Ca_SR_release", "type": VariableType.ALGEBRAIC}, - {"name": "kCaSR", "units": "dimensionless", "component": "Ca_SR_release", "type": VariableType.ALGEBRAIC}, - {"name": "koSRCa", "units": "per_millimolar2_second", "component": "Ca_SR_release", "type": VariableType.ALGEBRAIC}, - {"name": "kiSRCa", "units": "per_millimolar_second", "component": "Ca_SR_release", "type": VariableType.ALGEBRAIC}, - {"name": "P_tot", "units": "dimensionless", "component": "Ca_SR_release", "type": VariableType.ALGEBRAIC}, - {"name": "j_Ca_dif", "units": "millimolar_per_second", "component": "Ca_intracellular_fluxes", "type": VariableType.ALGEBRAIC}, - {"name": "j_up", "units": "millimolar_per_second", "component": "Ca_intracellular_fluxes", "type": VariableType.ALGEBRAIC}, - {"name": "j_tr", "units": "millimolar_per_second", "component": "Ca_intracellular_fluxes", "type": VariableType.ALGEBRAIC}, - {"name": "delta_fTC", "units": "per_second", "component": "Ca_buffering", "type": VariableType.ALGEBRAIC}, - {"name": "delta_fTMC", "units": "per_second", "component": "Ca_buffering", "type": VariableType.ALGEBRAIC}, - {"name": "delta_fTMM", "units": "per_second", "component": "Ca_buffering", "type": VariableType.ALGEBRAIC}, - {"name": "delta_fCMi", "units": "per_second", "component": "Ca_buffering", "type": VariableType.ALGEBRAIC}, - {"name": "delta_fCMs", "units": "per_second", "component": "Ca_buffering", "type": VariableType.ALGEBRAIC}, - {"name": "delta_fCQ", "units": "per_second", "component": "Ca_buffering", "type": VariableType.ALGEBRAIC}, - {"name": "i_siCa", "units": "nanoA", "component": "i_CaL", "type": VariableType.ALGEBRAIC}, - {"name": "i_CaT", "units": "nanoA", "component": "i_CaT", "type": VariableType.ALGEBRAIC}, - {"name": "i_tot", "units": "nanoA", "component": "Membrane", "type": VariableType.ALGEBRAIC}, - {"name": "i_f", "units": "nanoA", "component": "i_f", "type": VariableType.ALGEBRAIC}, - {"name": "i_Kur", "units": "nanoA", "component": "i_Kur", "type": VariableType.ALGEBRAIC}, - {"name": "i_KACh", "units": "nanoA", "component": "i_KACh", "type": VariableType.ALGEBRAIC}, - {"name": "i_CaL", "units": "nanoA", "component": "i_CaL", "type": VariableType.ALGEBRAIC}, - {"name": "i_to", "units": "nanoA", "component": "i_to", "type": VariableType.ALGEBRAIC}, - {"name": "i_Ks", "units": "nanoA", "component": "i_Ks", "type": VariableType.ALGEBRAIC}, - {"name": "i_Kr", "units": "nanoA", "component": "i_Kr", "type": VariableType.ALGEBRAIC}, - {"name": "V_clamp", "units": "millivolt", "component": "Voltage_clamp", "type": VariableType.ALGEBRAIC}, - {"name": "i_fK", "units": "nanoA", "component": "i_f", "type": VariableType.ALGEBRAIC}, - {"name": "tau_y", "units": "second", "component": "i_f_y_gate", "type": VariableType.ALGEBRAIC}, - {"name": "y_infinity", "units": "dimensionless", "component": "i_f_y_gate", "type": VariableType.ALGEBRAIC}, - {"name": "E_mh", "units": "millivolt", "component": "i_Na", "type": VariableType.ALGEBRAIC}, - {"name": "i_Na_", "units": "nanoA", "component": "i_Na", "type": VariableType.ALGEBRAIC}, - {"name": "i_Na_L", "units": "nanoA", "component": "i_Na", "type": VariableType.ALGEBRAIC}, - {"name": "m_infinity", "units": "dimensionless", "component": "i_Na_m_gate", "type": VariableType.ALGEBRAIC}, - {"name": "E0_m", "units": "millivolt", "component": "i_Na_m_gate", "type": VariableType.ALGEBRAIC}, - {"name": "alpha_m", "units": "per_second", "component": "i_Na_m_gate", "type": VariableType.ALGEBRAIC}, - {"name": "beta_m", "units": "per_second", "component": "i_Na_m_gate", "type": VariableType.ALGEBRAIC}, - {"name": "tau_m", "units": "second", "component": "i_Na_m_gate", "type": VariableType.ALGEBRAIC}, - {"name": "h_infinity", "units": "dimensionless", "component": "i_Na_h_gate", "type": VariableType.ALGEBRAIC}, - {"name": "alpha_h", "units": "per_second", "component": "i_Na_h_gate", "type": VariableType.ALGEBRAIC}, - {"name": "beta_h", "units": "per_second", "component": "i_Na_h_gate", "type": VariableType.ALGEBRAIC}, - {"name": "tau_h", "units": "second", "component": "i_Na_h_gate", "type": VariableType.ALGEBRAIC}, - {"name": "r_Kur_infinity", "units": "dimensionless", "component": "i_Kur_rKur_gate", "type": VariableType.ALGEBRAIC}, - {"name": "tau_r_Kur", "units": "second", "component": "i_Kur_rKur_gate", "type": VariableType.ALGEBRAIC}, - {"name": "s_Kur_infinity", "units": "dimensionless", "component": "i_Kur_sKur_gate", "type": VariableType.ALGEBRAIC}, - {"name": "tau_s_Kur", "units": "second", "component": "i_Kur_sKur_gate", "type": VariableType.ALGEBRAIC}, - {"name": "i_siK", "units": "nanoA", "component": "i_CaL", "type": VariableType.ALGEBRAIC}, - {"name": "dL_infinity", "units": "dimensionless", "component": "i_CaL_dL_gate", "type": VariableType.ALGEBRAIC}, - {"name": "tau_dL", "units": "second", "component": "i_CaL_dL_gate", "type": VariableType.ALGEBRAIC}, - {"name": "alpha_dL", "units": "per_second", "component": "i_CaL_dL_gate", "type": VariableType.ALGEBRAIC}, - {"name": "beta_dL", "units": "per_second", "component": "i_CaL_dL_gate", "type": VariableType.ALGEBRAIC}, - {"name": "adVm", "units": "millivolt", "component": "i_CaL_dL_gate", "type": VariableType.ALGEBRAIC}, - {"name": "bdVm", "units": "millivolt", "component": "i_CaL_dL_gate", "type": VariableType.ALGEBRAIC}, - {"name": "fL_infinity", "units": "dimensionless", "component": "i_CaL_fL_gate", "type": VariableType.ALGEBRAIC}, - {"name": "tau_fL", "units": "second", "component": "i_CaL_fL_gate", "type": VariableType.ALGEBRAIC}, - {"name": "fCa_infinity", "units": "dimensionless", "component": "i_CaL_fCa_gate", "type": VariableType.ALGEBRAIC}, - {"name": "tau_fCa", "units": "second", "component": "i_CaL_fCa_gate", "type": VariableType.ALGEBRAIC}, - {"name": "dT_infinity", "units": "dimensionless", "component": "i_CaT_dT_gate", "type": VariableType.ALGEBRAIC}, - {"name": "tau_dT", "units": "second", "component": "i_CaT_dT_gate", "type": VariableType.ALGEBRAIC}, - {"name": "fT_infinity", "units": "dimensionless", "component": "i_CaT_fT_gate", "type": VariableType.ALGEBRAIC}, - {"name": "tau_fT", "units": "second", "component": "i_CaT_fT_gate", "type": VariableType.ALGEBRAIC}, - {"name": "q_infinity", "units": "dimensionless", "component": "i_to_q_gate", "type": VariableType.ALGEBRAIC}, - {"name": "tau_q", "units": "second", "component": "i_to_q_gate", "type": VariableType.ALGEBRAIC}, - {"name": "r_infinity", "units": "dimensionless", "component": "i_to_r_gate", "type": VariableType.ALGEBRAIC}, - {"name": "tau_r", "units": "second", "component": "i_to_r_gate", "type": VariableType.ALGEBRAIC}, - {"name": "alfapaF", "units": "per_second", "component": "i_Kr_pa_gate", "type": VariableType.ALGEBRAIC}, - {"name": "betapaF", "units": "per_second", "component": "i_Kr_pa_gate", "type": VariableType.ALGEBRAIC}, - {"name": "pa_infinity", "units": "dimensionless", "component": "i_Kr_pa_gate", "type": VariableType.ALGEBRAIC}, - {"name": "tau_paS", "units": "second", "component": "i_Kr_pa_gate", "type": VariableType.ALGEBRAIC}, - {"name": "tau_paF", "units": "second", "component": "i_Kr_pa_gate", "type": VariableType.ALGEBRAIC}, - {"name": "tau_pi", "units": "second", "component": "i_Kr_pi_gate", "type": VariableType.ALGEBRAIC}, - {"name": "pi_infinity", "units": "dimensionless", "component": "i_Kr_pi_gate", "type": VariableType.ALGEBRAIC}, - {"name": "E_Ks", "units": "millivolt", "component": "i_Ks", "type": VariableType.ALGEBRAIC}, - {"name": "n_infinity", "units": "dimensionless", "component": "i_Ks_n_gate", "type": VariableType.ALGEBRAIC}, - {"name": "tau_n", "units": "second", "component": "i_Ks_n_gate", "type": VariableType.ALGEBRAIC}, - {"name": "alpha_n", "units": "per_second", "component": "i_Ks_n_gate", "type": VariableType.ALGEBRAIC}, - {"name": "beta_n", "units": "per_second", "component": "i_Ks_n_gate", "type": VariableType.ALGEBRAIC}, - {"name": "beta_a", "units": "per_second", "component": "i_KACh_a_gate", "type": VariableType.ALGEBRAIC}, - {"name": "a_infinity", "units": "dimensionless", "component": "i_KACh_a_gate", "type": VariableType.ALGEBRAIC}, - {"name": "tau_a", "units": "second", "component": "i_KACh_a_gate", "type": VariableType.ALGEBRAIC} + {"name": "E_Na", "units": "millivolt", "component": "Ionic_values"}, + {"name": "Nai", "units": "millimolar", "component": "Nai_concentration"}, + {"name": "E_Ca", "units": "millivolt", "component": "Ionic_values"}, + {"name": "i_Na", "units": "nanoA", "component": "i_Na"}, + {"name": "i_NaCa", "units": "nanoA", "component": "i_NaCa"}, + {"name": "i_NaK", "units": "nanoA", "component": "i_NaK"}, + {"name": "i_siNa", "units": "nanoA", "component": "i_CaL"}, + {"name": "i_fNa", "units": "nanoA", "component": "i_f"}, + {"name": "V", "units": "millivolt", "component": "Membrane"}, + {"name": "x2", "units": "dimensionless", "component": "i_NaCa"}, + {"name": "k21", "units": "dimensionless", "component": "i_NaCa"}, + {"name": "x1", "units": "dimensionless", "component": "i_NaCa"}, + {"name": "k12", "units": "dimensionless", "component": "i_NaCa"}, + {"name": "x4", "units": "dimensionless", "component": "i_NaCa"}, + {"name": "x3", "units": "dimensionless", "component": "i_NaCa"}, + {"name": "k41", "units": "dimensionless", "component": "i_NaCa"}, + {"name": "k23", "units": "dimensionless", "component": "i_NaCa"}, + {"name": "k43", "units": "dimensionless", "component": "i_NaCa"}, + {"name": "k32", "units": "dimensionless", "component": "i_NaCa"}, + {"name": "k14", "units": "dimensionless", "component": "i_NaCa"}, + {"name": "di", "units": "dimensionless", "component": "i_NaCa"}, + {"name": "do", "units": "dimensionless", "component": "i_NaCa"}, + {"name": "j_SRCarel", "units": "millimolar_per_second", "component": "Ca_SR_release"}, + {"name": "diff", "units": "millimolar", "component": "Ca_SR_release"}, + {"name": "kCaSR", "units": "dimensionless", "component": "Ca_SR_release"}, + {"name": "koSRCa", "units": "per_millimolar2_second", "component": "Ca_SR_release"}, + {"name": "kiSRCa", "units": "per_millimolar_second", "component": "Ca_SR_release"}, + {"name": "P_tot", "units": "dimensionless", "component": "Ca_SR_release"}, + {"name": "j_Ca_dif", "units": "millimolar_per_second", "component": "Ca_intracellular_fluxes"}, + {"name": "j_up", "units": "millimolar_per_second", "component": "Ca_intracellular_fluxes"}, + {"name": "j_tr", "units": "millimolar_per_second", "component": "Ca_intracellular_fluxes"}, + {"name": "delta_fTC", "units": "per_second", "component": "Ca_buffering"}, + {"name": "delta_fTMC", "units": "per_second", "component": "Ca_buffering"}, + {"name": "delta_fTMM", "units": "per_second", "component": "Ca_buffering"}, + {"name": "delta_fCMi", "units": "per_second", "component": "Ca_buffering"}, + {"name": "delta_fCMs", "units": "per_second", "component": "Ca_buffering"}, + {"name": "delta_fCQ", "units": "per_second", "component": "Ca_buffering"}, + {"name": "i_siCa", "units": "nanoA", "component": "i_CaL"}, + {"name": "i_CaT", "units": "nanoA", "component": "i_CaT"}, + {"name": "i_tot", "units": "nanoA", "component": "Membrane"}, + {"name": "i_f", "units": "nanoA", "component": "i_f"}, + {"name": "i_Kur", "units": "nanoA", "component": "i_Kur"}, + {"name": "i_KACh", "units": "nanoA", "component": "i_KACh"}, + {"name": "i_CaL", "units": "nanoA", "component": "i_CaL"}, + {"name": "i_to", "units": "nanoA", "component": "i_to"}, + {"name": "i_Ks", "units": "nanoA", "component": "i_Ks"}, + {"name": "i_Kr", "units": "nanoA", "component": "i_Kr"}, + {"name": "V_clamp", "units": "millivolt", "component": "Voltage_clamp"}, + {"name": "i_fK", "units": "nanoA", "component": "i_f"}, + {"name": "tau_y", "units": "second", "component": "i_f_y_gate"}, + {"name": "y_infinity", "units": "dimensionless", "component": "i_f_y_gate"}, + {"name": "E_mh", "units": "millivolt", "component": "i_Na"}, + {"name": "i_Na_", "units": "nanoA", "component": "i_Na"}, + {"name": "i_Na_L", "units": "nanoA", "component": "i_Na"}, + {"name": "m_infinity", "units": "dimensionless", "component": "i_Na_m_gate"}, + {"name": "E0_m", "units": "millivolt", "component": "i_Na_m_gate"}, + {"name": "alpha_m", "units": "per_second", "component": "i_Na_m_gate"}, + {"name": "beta_m", "units": "per_second", "component": "i_Na_m_gate"}, + {"name": "tau_m", "units": "second", "component": "i_Na_m_gate"}, + {"name": "h_infinity", "units": "dimensionless", "component": "i_Na_h_gate"}, + {"name": "alpha_h", "units": "per_second", "component": "i_Na_h_gate"}, + {"name": "beta_h", "units": "per_second", "component": "i_Na_h_gate"}, + {"name": "tau_h", "units": "second", "component": "i_Na_h_gate"}, + {"name": "r_Kur_infinity", "units": "dimensionless", "component": "i_Kur_rKur_gate"}, + {"name": "tau_r_Kur", "units": "second", "component": "i_Kur_rKur_gate"}, + {"name": "s_Kur_infinity", "units": "dimensionless", "component": "i_Kur_sKur_gate"}, + {"name": "tau_s_Kur", "units": "second", "component": "i_Kur_sKur_gate"}, + {"name": "i_siK", "units": "nanoA", "component": "i_CaL"}, + {"name": "dL_infinity", "units": "dimensionless", "component": "i_CaL_dL_gate"}, + {"name": "tau_dL", "units": "second", "component": "i_CaL_dL_gate"}, + {"name": "alpha_dL", "units": "per_second", "component": "i_CaL_dL_gate"}, + {"name": "beta_dL", "units": "per_second", "component": "i_CaL_dL_gate"}, + {"name": "adVm", "units": "millivolt", "component": "i_CaL_dL_gate"}, + {"name": "bdVm", "units": "millivolt", "component": "i_CaL_dL_gate"}, + {"name": "fL_infinity", "units": "dimensionless", "component": "i_CaL_fL_gate"}, + {"name": "tau_fL", "units": "second", "component": "i_CaL_fL_gate"}, + {"name": "fCa_infinity", "units": "dimensionless", "component": "i_CaL_fCa_gate"}, + {"name": "tau_fCa", "units": "second", "component": "i_CaL_fCa_gate"}, + {"name": "dT_infinity", "units": "dimensionless", "component": "i_CaT_dT_gate"}, + {"name": "tau_dT", "units": "second", "component": "i_CaT_dT_gate"}, + {"name": "fT_infinity", "units": "dimensionless", "component": "i_CaT_fT_gate"}, + {"name": "tau_fT", "units": "second", "component": "i_CaT_fT_gate"}, + {"name": "q_infinity", "units": "dimensionless", "component": "i_to_q_gate"}, + {"name": "tau_q", "units": "second", "component": "i_to_q_gate"}, + {"name": "r_infinity", "units": "dimensionless", "component": "i_to_r_gate"}, + {"name": "tau_r", "units": "second", "component": "i_to_r_gate"}, + {"name": "alfapaF", "units": "per_second", "component": "i_Kr_pa_gate"}, + {"name": "betapaF", "units": "per_second", "component": "i_Kr_pa_gate"}, + {"name": "pa_infinity", "units": "dimensionless", "component": "i_Kr_pa_gate"}, + {"name": "tau_paS", "units": "second", "component": "i_Kr_pa_gate"}, + {"name": "tau_paF", "units": "second", "component": "i_Kr_pa_gate"}, + {"name": "tau_pi", "units": "second", "component": "i_Kr_pi_gate"}, + {"name": "pi_infinity", "units": "dimensionless", "component": "i_Kr_pi_gate"}, + {"name": "E_Ks", "units": "millivolt", "component": "i_Ks"}, + {"name": "n_infinity", "units": "dimensionless", "component": "i_Ks_n_gate"}, + {"name": "tau_n", "units": "second", "component": "i_Ks_n_gate"}, + {"name": "alpha_n", "units": "per_second", "component": "i_Ks_n_gate"}, + {"name": "beta_n", "units": "per_second", "component": "i_Ks_n_gate"}, + {"name": "beta_a", "units": "per_second", "component": "i_KACh_a_gate"}, + {"name": "a_infinity", "units": "dimensionless", "component": "i_KACh_a_gate"}, + {"name": "tau_a", "units": "second", "component": "i_KACh_a_gate"} ] diff --git a/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.c b/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.c index 7717d14f13..cd6dbc4de0 100644 --- a/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.c +++ b/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.c @@ -13,218 +13,218 @@ const size_t CONSTANT_COUNT = 110; const size_t COMPUTED_CONSTANT_COUNT = 23; const size_t ALGEBRAIC_COUNT = 52; -const VariableInfo VOI_INFO = {"time", "second", "environment", VARIABLE_OF_INTEGRATION}; +const VariableInfo VOI_INFO = {"time", "second", "environment"}; const VariableInfo STATE_INFO[] = { - {"V", "millivolt", "membrane", STATE}, - {"m", "dimensionless", "sodium_current_m_gate", STATE}, - {"h1", "dimensionless", "sodium_current_h_gate", STATE}, - {"h2", "dimensionless", "sodium_current_h_gate", STATE}, - {"f_L", "dimensionless", "L_type_Ca_channel_f_gate", STATE}, - {"d_L", "dimensionless", "L_type_Ca_channel_d_gate", STATE}, - {"f_T", "dimensionless", "T_type_Ca_channel_f_gate", STATE}, - {"d_T", "dimensionless", "T_type_Ca_channel_d_gate", STATE}, - {"r", "dimensionless", "four_AP_sensitive_currents_r_gate", STATE}, - {"q", "dimensionless", "four_AP_sensitive_currents_q_gate", STATE}, - {"P_i", "dimensionless", "rapid_delayed_rectifying_potassium_current_P_i_gate", STATE}, - {"P_af", "dimensionless", "rapid_delayed_rectifying_potassium_current_P_af_gate", STATE}, - {"P_as", "dimensionless", "rapid_delayed_rectifying_potassium_current_P_as_gate", STATE}, - {"xs", "dimensionless", "slow_delayed_rectifying_potassium_current_xs_gate", STATE}, - {"y", "dimensionless", "hyperpolarisation_activated_current_y_gate", STATE} + {"V", "millivolt", "membrane"}, + {"m", "dimensionless", "sodium_current_m_gate"}, + {"h1", "dimensionless", "sodium_current_h_gate"}, + {"h2", "dimensionless", "sodium_current_h_gate"}, + {"f_L", "dimensionless", "L_type_Ca_channel_f_gate"}, + {"d_L", "dimensionless", "L_type_Ca_channel_d_gate"}, + {"f_T", "dimensionless", "T_type_Ca_channel_f_gate"}, + {"d_T", "dimensionless", "T_type_Ca_channel_d_gate"}, + {"r", "dimensionless", "four_AP_sensitive_currents_r_gate"}, + {"q", "dimensionless", "four_AP_sensitive_currents_q_gate"}, + {"P_i", "dimensionless", "rapid_delayed_rectifying_potassium_current_P_i_gate"}, + {"P_af", "dimensionless", "rapid_delayed_rectifying_potassium_current_P_af_gate"}, + {"P_as", "dimensionless", "rapid_delayed_rectifying_potassium_current_P_as_gate"}, + {"xs", "dimensionless", "slow_delayed_rectifying_potassium_current_xs_gate"}, + {"y", "dimensionless", "hyperpolarisation_activated_current_y_gate"} }; const VariableInfo CONSTANT_INFO[] = { - {"dCell", "dimensionless", "membrane", CONSTANT}, - {"Version", "dimensionless", "membrane", CONSTANT}, - {"FCellConstant", "dimensionless", "membrane", CONSTANT}, - {"CmCentre", "microF", "membrane", CONSTANT}, - {"CmPeriphery", "microF", "membrane", CONSTANT}, - {"R", "millijoule_per_mole_kelvin", "membrane", CONSTANT}, - {"T", "kelvin", "membrane", CONSTANT}, - {"F", "coulomb_per_mole", "membrane", CONSTANT}, - {"g_b_Na_Centre_Published", "microS", "sodium_background_current", CONSTANT}, - {"g_b_Na_Periphery_Published", "microS", "sodium_background_current", CONSTANT}, - {"g_b_Na_Centre_1DCapable", "microS", "sodium_background_current", CONSTANT}, - {"g_b_Na_Periphery_1DCapable", "microS", "sodium_background_current", CONSTANT}, - {"g_b_Na_Centre_0DCapable", "microS", "sodium_background_current", CONSTANT}, - {"g_b_Na_Periphery_0DCapable", "microS", "sodium_background_current", CONSTANT}, - {"g_b_K_Centre_Published", "microS", "potassium_background_current", CONSTANT}, - {"g_b_K_Periphery_Published", "microS", "potassium_background_current", CONSTANT}, - {"g_b_K_Centre_1DCapable", "microS", "potassium_background_current", CONSTANT}, - {"g_b_K_Periphery_1DCapable", "microS", "potassium_background_current", CONSTANT}, - {"g_b_K_Centre_0DCapable", "microS", "potassium_background_current", CONSTANT}, - {"g_b_K_Periphery_0DCapable", "microS", "potassium_background_current", CONSTANT}, - {"g_b_Ca_Centre_Published", "microS", "calcium_background_current", CONSTANT}, - {"g_b_Ca_Periphery_Published", "microS", "calcium_background_current", CONSTANT}, - {"g_b_Ca_Centre_1DCapable", "microS", "calcium_background_current", CONSTANT}, - {"g_b_Ca_Periphery_1DCapable", "microS", "calcium_background_current", CONSTANT}, - {"g_b_Ca_Centre_0DCapable", "microS", "calcium_background_current", CONSTANT}, - {"g_b_Ca_Periphery_0DCapable", "microS", "calcium_background_current", CONSTANT}, - {"k_NaCa_Centre_Published", "nanoA", "sodium_calcium_exchanger", CONSTANT}, - {"k_NaCa_Periphery_Published", "nanoA", "sodium_calcium_exchanger", CONSTANT}, - {"k_NaCa_Centre_1DCapable", "nanoA", "sodium_calcium_exchanger", CONSTANT}, - {"k_NaCa_Periphery_1DCapable", "nanoA", "sodium_calcium_exchanger", CONSTANT}, - {"k_NaCa_Centre_0DCapable", "nanoA", "sodium_calcium_exchanger", CONSTANT}, - {"k_NaCa_Periphery_0DCapable", "nanoA", "sodium_calcium_exchanger", CONSTANT}, - {"Na_i", "millimolar", "ionic_concentrations", CONSTANT}, - {"gamma_NaCa", "dimensionless", "sodium_calcium_exchanger", CONSTANT}, - {"Ca_o", "millimolar", "ionic_concentrations", CONSTANT}, - {"Na_o", "millimolar", "ionic_concentrations", CONSTANT}, - {"Ca_i", "millimolar", "ionic_concentrations", CONSTANT}, - {"d_NaCa", "dimensionless", "sodium_calcium_exchanger", CONSTANT}, - {"i_p_max_Centre_Published", "nanoA", "sodium_potassium_pump", CONSTANT}, - {"i_p_max_Periphery_Published", "nanoA", "sodium_potassium_pump", CONSTANT}, - {"i_p_max_Centre_1DCapable", "nanoA", "sodium_potassium_pump", CONSTANT}, - {"i_p_max_Periphery_1DCapable", "nanoA", "sodium_potassium_pump", CONSTANT}, - {"i_p_max_Centre_0DCapable", "nanoA", "sodium_potassium_pump", CONSTANT}, - {"i_p_max_Periphery_0DCapable", "nanoA", "sodium_potassium_pump", CONSTANT}, - {"K_o", "millimolar", "ionic_concentrations", CONSTANT}, - {"K_m_K", "millimolar", "sodium_potassium_pump", CONSTANT}, - {"K_m_Na", "millimolar", "sodium_potassium_pump", CONSTANT}, - {"i_Ca_p_max_Centre_Published", "nanoA", "persistent_calcium_current", CONSTANT}, - {"i_Ca_p_max_Periphery_Published", "nanoA", "persistent_calcium_current", CONSTANT}, - {"i_Ca_p_max_Centre_1DCapable", "nanoA", "persistent_calcium_current", CONSTANT}, - {"i_Ca_p_max_Periphery_1DCapable", "nanoA", "persistent_calcium_current", CONSTANT}, - {"i_Ca_p_max_Centre_0DCapable", "nanoA", "persistent_calcium_current", CONSTANT}, - {"i_Ca_p_max_Periphery_0DCapable", "nanoA", "persistent_calcium_current", CONSTANT}, - {"K_i", "millimolar", "ionic_concentrations", CONSTANT}, - {"g_Na_Centre_Published", "microlitre_per_second", "sodium_current", CONSTANT}, - {"g_Na_Periphery_Published", "microlitre_per_second", "sodium_current", CONSTANT}, - {"g_Na_Centre_1DCapable", "microlitre_per_second", "sodium_current", CONSTANT}, - {"g_Na_Periphery_1DCapable", "microlitre_per_second", "sodium_current", CONSTANT}, - {"g_Na_Centre_0DCapable", "microlitre_per_second", "sodium_current", CONSTANT}, - {"g_Na_Periphery_0DCapable", "microlitre_per_second", "sodium_current", CONSTANT}, - {"g_Ca_L_Centre_Published", "microS", "L_type_Ca_channel", CONSTANT}, - {"g_Ca_L_Periphery_Published", "microS", "L_type_Ca_channel", CONSTANT}, - {"g_Ca_L_Centre_1DCapable", "microS", "L_type_Ca_channel", CONSTANT}, - {"g_Ca_L_Periphery_1DCapable", "microS", "L_type_Ca_channel", CONSTANT}, - {"g_Ca_L_Centre_0DCapable", "microS", "L_type_Ca_channel", CONSTANT}, - {"g_Ca_L_Periphery_0DCapable", "microS", "L_type_Ca_channel", CONSTANT}, - {"E_Ca_L", "millivolt", "L_type_Ca_channel", CONSTANT}, - {"g_Ca_T_Centre_Published", "microS", "T_type_Ca_channel", CONSTANT}, - {"g_Ca_T_Periphery_Published", "microS", "T_type_Ca_channel", CONSTANT}, - {"g_Ca_T_Centre_1DCapable", "microS", "T_type_Ca_channel", CONSTANT}, - {"g_Ca_T_Periphery_1DCapable", "microS", "T_type_Ca_channel", CONSTANT}, - {"g_Ca_T_Centre_0DCapable", "microS", "T_type_Ca_channel", CONSTANT}, - {"g_Ca_T_Periphery_0DCapable", "microS", "T_type_Ca_channel", CONSTANT}, - {"E_Ca_T", "millivolt", "T_type_Ca_channel", CONSTANT}, - {"g_to_Centre_Published", "microS", "four_AP_sensitive_currents", CONSTANT}, - {"g_to_Periphery_Published", "microS", "four_AP_sensitive_currents", CONSTANT}, - {"g_to_Centre_1DCapable", "microS", "four_AP_sensitive_currents", CONSTANT}, - {"g_to_Periphery_1DCapable", "microS", "four_AP_sensitive_currents", CONSTANT}, - {"g_to_Centre_0DCapable", "microS", "four_AP_sensitive_currents", CONSTANT}, - {"g_to_Periphery_0DCapable", "microS", "four_AP_sensitive_currents", CONSTANT}, - {"g_sus_Centre_Published", "microS", "four_AP_sensitive_currents", CONSTANT}, - {"g_sus_Periphery_Published", "microS", "four_AP_sensitive_currents", CONSTANT}, - {"g_sus_Centre_1DCapable", "microS", "four_AP_sensitive_currents", CONSTANT}, - {"g_sus_Periphery_1DCapable", "microS", "four_AP_sensitive_currents", CONSTANT}, - {"g_sus_Centre_0DCapable", "microS", "four_AP_sensitive_currents", CONSTANT}, - {"g_sus_Periphery_0DCapable", "microS", "four_AP_sensitive_currents", CONSTANT}, - {"g_K_r_Centre_Published", "microS", "rapid_delayed_rectifying_potassium_current", CONSTANT}, - {"g_K_r_Periphery_Published", "microS", "rapid_delayed_rectifying_potassium_current", CONSTANT}, - {"g_K_r_Centre_1DCapable", "microS", "rapid_delayed_rectifying_potassium_current", CONSTANT}, - {"g_K_r_Periphery_1DCapable", "microS", "rapid_delayed_rectifying_potassium_current", CONSTANT}, - {"g_K_r_Centre_0DCapable", "microS", "rapid_delayed_rectifying_potassium_current", CONSTANT}, - {"g_K_r_Periphery_0DCapable", "microS", "rapid_delayed_rectifying_potassium_current", CONSTANT}, - {"g_K_s_Centre_Published", "microS", "slow_delayed_rectifying_potassium_current", CONSTANT}, - {"g_K_s_Periphery_Published", "microS", "slow_delayed_rectifying_potassium_current", CONSTANT}, - {"g_K_s_Centre_1DCapable", "microS", "slow_delayed_rectifying_potassium_current", CONSTANT}, - {"g_K_s_Periphery_1DCapable", "microS", "slow_delayed_rectifying_potassium_current", CONSTANT}, - {"g_K_s_Centre_0DCapable", "microS", "slow_delayed_rectifying_potassium_current", CONSTANT}, - {"g_K_s_Periphery_0DCapable", "microS", "slow_delayed_rectifying_potassium_current", CONSTANT}, - {"g_f_Na_Centre_Published", "microS", "hyperpolarisation_activated_current", CONSTANT}, - {"g_f_Na_Periphery_Published", "microS", "hyperpolarisation_activated_current", CONSTANT}, - {"g_f_Na_Centre_1DCapable", "microS", "hyperpolarisation_activated_current", CONSTANT}, - {"g_f_Na_Periphery_1DCapable", "microS", "hyperpolarisation_activated_current", CONSTANT}, - {"g_f_Na_Centre_0DCapable", "microS", "hyperpolarisation_activated_current", CONSTANT}, - {"g_f_Na_Periphery_0DCapable", "microS", "hyperpolarisation_activated_current", CONSTANT}, - {"g_f_K_Centre_Published", "microS", "hyperpolarisation_activated_current", CONSTANT}, - {"g_f_K_Periphery_Published", "microS", "hyperpolarisation_activated_current", CONSTANT}, - {"g_f_K_Centre_1DCapable", "microS", "hyperpolarisation_activated_current", CONSTANT}, - {"g_f_K_Periphery_1DCapable", "microS", "hyperpolarisation_activated_current", CONSTANT}, - {"g_f_K_Centre_0DCapable", "microS", "hyperpolarisation_activated_current", CONSTANT}, - {"g_f_K_Periphery_0DCapable", "microS", "hyperpolarisation_activated_current", CONSTANT} + {"dCell", "dimensionless", "membrane"}, + {"Version", "dimensionless", "membrane"}, + {"FCellConstant", "dimensionless", "membrane"}, + {"CmCentre", "microF", "membrane"}, + {"CmPeriphery", "microF", "membrane"}, + {"R", "millijoule_per_mole_kelvin", "membrane"}, + {"T", "kelvin", "membrane"}, + {"F", "coulomb_per_mole", "membrane"}, + {"g_b_Na_Centre_Published", "microS", "sodium_background_current"}, + {"g_b_Na_Periphery_Published", "microS", "sodium_background_current"}, + {"g_b_Na_Centre_1DCapable", "microS", "sodium_background_current"}, + {"g_b_Na_Periphery_1DCapable", "microS", "sodium_background_current"}, + {"g_b_Na_Centre_0DCapable", "microS", "sodium_background_current"}, + {"g_b_Na_Periphery_0DCapable", "microS", "sodium_background_current"}, + {"g_b_K_Centre_Published", "microS", "potassium_background_current"}, + {"g_b_K_Periphery_Published", "microS", "potassium_background_current"}, + {"g_b_K_Centre_1DCapable", "microS", "potassium_background_current"}, + {"g_b_K_Periphery_1DCapable", "microS", "potassium_background_current"}, + {"g_b_K_Centre_0DCapable", "microS", "potassium_background_current"}, + {"g_b_K_Periphery_0DCapable", "microS", "potassium_background_current"}, + {"g_b_Ca_Centre_Published", "microS", "calcium_background_current"}, + {"g_b_Ca_Periphery_Published", "microS", "calcium_background_current"}, + {"g_b_Ca_Centre_1DCapable", "microS", "calcium_background_current"}, + {"g_b_Ca_Periphery_1DCapable", "microS", "calcium_background_current"}, + {"g_b_Ca_Centre_0DCapable", "microS", "calcium_background_current"}, + {"g_b_Ca_Periphery_0DCapable", "microS", "calcium_background_current"}, + {"k_NaCa_Centre_Published", "nanoA", "sodium_calcium_exchanger"}, + {"k_NaCa_Periphery_Published", "nanoA", "sodium_calcium_exchanger"}, + {"k_NaCa_Centre_1DCapable", "nanoA", "sodium_calcium_exchanger"}, + {"k_NaCa_Periphery_1DCapable", "nanoA", "sodium_calcium_exchanger"}, + {"k_NaCa_Centre_0DCapable", "nanoA", "sodium_calcium_exchanger"}, + {"k_NaCa_Periphery_0DCapable", "nanoA", "sodium_calcium_exchanger"}, + {"Na_i", "millimolar", "ionic_concentrations"}, + {"gamma_NaCa", "dimensionless", "sodium_calcium_exchanger"}, + {"Ca_o", "millimolar", "ionic_concentrations"}, + {"Na_o", "millimolar", "ionic_concentrations"}, + {"Ca_i", "millimolar", "ionic_concentrations"}, + {"d_NaCa", "dimensionless", "sodium_calcium_exchanger"}, + {"i_p_max_Centre_Published", "nanoA", "sodium_potassium_pump"}, + {"i_p_max_Periphery_Published", "nanoA", "sodium_potassium_pump"}, + {"i_p_max_Centre_1DCapable", "nanoA", "sodium_potassium_pump"}, + {"i_p_max_Periphery_1DCapable", "nanoA", "sodium_potassium_pump"}, + {"i_p_max_Centre_0DCapable", "nanoA", "sodium_potassium_pump"}, + {"i_p_max_Periphery_0DCapable", "nanoA", "sodium_potassium_pump"}, + {"K_o", "millimolar", "ionic_concentrations"}, + {"K_m_K", "millimolar", "sodium_potassium_pump"}, + {"K_m_Na", "millimolar", "sodium_potassium_pump"}, + {"i_Ca_p_max_Centre_Published", "nanoA", "persistent_calcium_current"}, + {"i_Ca_p_max_Periphery_Published", "nanoA", "persistent_calcium_current"}, + {"i_Ca_p_max_Centre_1DCapable", "nanoA", "persistent_calcium_current"}, + {"i_Ca_p_max_Periphery_1DCapable", "nanoA", "persistent_calcium_current"}, + {"i_Ca_p_max_Centre_0DCapable", "nanoA", "persistent_calcium_current"}, + {"i_Ca_p_max_Periphery_0DCapable", "nanoA", "persistent_calcium_current"}, + {"K_i", "millimolar", "ionic_concentrations"}, + {"g_Na_Centre_Published", "microlitre_per_second", "sodium_current"}, + {"g_Na_Periphery_Published", "microlitre_per_second", "sodium_current"}, + {"g_Na_Centre_1DCapable", "microlitre_per_second", "sodium_current"}, + {"g_Na_Periphery_1DCapable", "microlitre_per_second", "sodium_current"}, + {"g_Na_Centre_0DCapable", "microlitre_per_second", "sodium_current"}, + {"g_Na_Periphery_0DCapable", "microlitre_per_second", "sodium_current"}, + {"g_Ca_L_Centre_Published", "microS", "L_type_Ca_channel"}, + {"g_Ca_L_Periphery_Published", "microS", "L_type_Ca_channel"}, + {"g_Ca_L_Centre_1DCapable", "microS", "L_type_Ca_channel"}, + {"g_Ca_L_Periphery_1DCapable", "microS", "L_type_Ca_channel"}, + {"g_Ca_L_Centre_0DCapable", "microS", "L_type_Ca_channel"}, + {"g_Ca_L_Periphery_0DCapable", "microS", "L_type_Ca_channel"}, + {"E_Ca_L", "millivolt", "L_type_Ca_channel"}, + {"g_Ca_T_Centre_Published", "microS", "T_type_Ca_channel"}, + {"g_Ca_T_Periphery_Published", "microS", "T_type_Ca_channel"}, + {"g_Ca_T_Centre_1DCapable", "microS", "T_type_Ca_channel"}, + {"g_Ca_T_Periphery_1DCapable", "microS", "T_type_Ca_channel"}, + {"g_Ca_T_Centre_0DCapable", "microS", "T_type_Ca_channel"}, + {"g_Ca_T_Periphery_0DCapable", "microS", "T_type_Ca_channel"}, + {"E_Ca_T", "millivolt", "T_type_Ca_channel"}, + {"g_to_Centre_Published", "microS", "four_AP_sensitive_currents"}, + {"g_to_Periphery_Published", "microS", "four_AP_sensitive_currents"}, + {"g_to_Centre_1DCapable", "microS", "four_AP_sensitive_currents"}, + {"g_to_Periphery_1DCapable", "microS", "four_AP_sensitive_currents"}, + {"g_to_Centre_0DCapable", "microS", "four_AP_sensitive_currents"}, + {"g_to_Periphery_0DCapable", "microS", "four_AP_sensitive_currents"}, + {"g_sus_Centre_Published", "microS", "four_AP_sensitive_currents"}, + {"g_sus_Periphery_Published", "microS", "four_AP_sensitive_currents"}, + {"g_sus_Centre_1DCapable", "microS", "four_AP_sensitive_currents"}, + {"g_sus_Periphery_1DCapable", "microS", "four_AP_sensitive_currents"}, + {"g_sus_Centre_0DCapable", "microS", "four_AP_sensitive_currents"}, + {"g_sus_Periphery_0DCapable", "microS", "four_AP_sensitive_currents"}, + {"g_K_r_Centre_Published", "microS", "rapid_delayed_rectifying_potassium_current"}, + {"g_K_r_Periphery_Published", "microS", "rapid_delayed_rectifying_potassium_current"}, + {"g_K_r_Centre_1DCapable", "microS", "rapid_delayed_rectifying_potassium_current"}, + {"g_K_r_Periphery_1DCapable", "microS", "rapid_delayed_rectifying_potassium_current"}, + {"g_K_r_Centre_0DCapable", "microS", "rapid_delayed_rectifying_potassium_current"}, + {"g_K_r_Periphery_0DCapable", "microS", "rapid_delayed_rectifying_potassium_current"}, + {"g_K_s_Centre_Published", "microS", "slow_delayed_rectifying_potassium_current"}, + {"g_K_s_Periphery_Published", "microS", "slow_delayed_rectifying_potassium_current"}, + {"g_K_s_Centre_1DCapable", "microS", "slow_delayed_rectifying_potassium_current"}, + {"g_K_s_Periphery_1DCapable", "microS", "slow_delayed_rectifying_potassium_current"}, + {"g_K_s_Centre_0DCapable", "microS", "slow_delayed_rectifying_potassium_current"}, + {"g_K_s_Periphery_0DCapable", "microS", "slow_delayed_rectifying_potassium_current"}, + {"g_f_Na_Centre_Published", "microS", "hyperpolarisation_activated_current"}, + {"g_f_Na_Periphery_Published", "microS", "hyperpolarisation_activated_current"}, + {"g_f_Na_Centre_1DCapable", "microS", "hyperpolarisation_activated_current"}, + {"g_f_Na_Periphery_1DCapable", "microS", "hyperpolarisation_activated_current"}, + {"g_f_Na_Centre_0DCapable", "microS", "hyperpolarisation_activated_current"}, + {"g_f_Na_Periphery_0DCapable", "microS", "hyperpolarisation_activated_current"}, + {"g_f_K_Centre_Published", "microS", "hyperpolarisation_activated_current"}, + {"g_f_K_Periphery_Published", "microS", "hyperpolarisation_activated_current"}, + {"g_f_K_Centre_1DCapable", "microS", "hyperpolarisation_activated_current"}, + {"g_f_K_Periphery_1DCapable", "microS", "hyperpolarisation_activated_current"}, + {"g_f_K_Centre_0DCapable", "microS", "hyperpolarisation_activated_current"}, + {"g_f_K_Periphery_0DCapable", "microS", "hyperpolarisation_activated_current"} }; const VariableInfo COMPUTED_CONSTANT_INFO[] = { - {"FCell", "dimensionless", "membrane", COMPUTED_CONSTANT}, - {"Cm", "microF", "membrane", COMPUTED_CONSTANT}, - {"i_Ca_p", "nanoA", "persistent_calcium_current", COMPUTED_CONSTANT}, - {"g_b_Na", "microS", "sodium_background_current", COMPUTED_CONSTANT}, - {"E_Na", "millivolt", "reversal_and_equilibrium_potentials", COMPUTED_CONSTANT}, - {"g_b_K", "microS", "potassium_background_current", COMPUTED_CONSTANT}, - {"E_K", "millivolt", "reversal_and_equilibrium_potentials", COMPUTED_CONSTANT}, - {"g_b_Ca", "microS", "calcium_background_current", COMPUTED_CONSTANT}, - {"E_Ca", "millivolt", "reversal_and_equilibrium_potentials", COMPUTED_CONSTANT}, - {"k_NaCa", "nanoA", "sodium_calcium_exchanger", COMPUTED_CONSTANT}, - {"i_p_max", "nanoA", "sodium_potassium_pump", COMPUTED_CONSTANT}, - {"i_Ca_p_max", "nanoA", "persistent_calcium_current", COMPUTED_CONSTANT}, - {"E_K_s", "millivolt", "reversal_and_equilibrium_potentials", COMPUTED_CONSTANT}, - {"g_Na", "microlitre_per_second", "sodium_current", COMPUTED_CONSTANT}, - {"g_Ca_L", "microS", "L_type_Ca_channel", COMPUTED_CONSTANT}, - {"g_Ca_T", "microS", "T_type_Ca_channel", COMPUTED_CONSTANT}, - {"g_to", "microS", "four_AP_sensitive_currents", COMPUTED_CONSTANT}, - {"g_sus", "microS", "four_AP_sensitive_currents", COMPUTED_CONSTANT}, - {"g_K_r", "microS", "rapid_delayed_rectifying_potassium_current", COMPUTED_CONSTANT}, - {"tau_P_i", "second", "rapid_delayed_rectifying_potassium_current_P_i_gate", COMPUTED_CONSTANT}, - {"g_K_s", "microS", "slow_delayed_rectifying_potassium_current", COMPUTED_CONSTANT}, - {"g_f_Na", "microS", "hyperpolarisation_activated_current", COMPUTED_CONSTANT}, - {"g_f_K", "microS", "hyperpolarisation_activated_current", COMPUTED_CONSTANT} + {"FCell", "dimensionless", "membrane"}, + {"Cm", "microF", "membrane"}, + {"i_Ca_p", "nanoA", "persistent_calcium_current"}, + {"g_b_Na", "microS", "sodium_background_current"}, + {"E_Na", "millivolt", "reversal_and_equilibrium_potentials"}, + {"g_b_K", "microS", "potassium_background_current"}, + {"E_K", "millivolt", "reversal_and_equilibrium_potentials"}, + {"g_b_Ca", "microS", "calcium_background_current"}, + {"E_Ca", "millivolt", "reversal_and_equilibrium_potentials"}, + {"k_NaCa", "nanoA", "sodium_calcium_exchanger"}, + {"i_p_max", "nanoA", "sodium_potassium_pump"}, + {"i_Ca_p_max", "nanoA", "persistent_calcium_current"}, + {"E_K_s", "millivolt", "reversal_and_equilibrium_potentials"}, + {"g_Na", "microlitre_per_second", "sodium_current"}, + {"g_Ca_L", "microS", "L_type_Ca_channel"}, + {"g_Ca_T", "microS", "T_type_Ca_channel"}, + {"g_to", "microS", "four_AP_sensitive_currents"}, + {"g_sus", "microS", "four_AP_sensitive_currents"}, + {"g_K_r", "microS", "rapid_delayed_rectifying_potassium_current"}, + {"tau_P_i", "second", "rapid_delayed_rectifying_potassium_current_P_i_gate"}, + {"g_K_s", "microS", "slow_delayed_rectifying_potassium_current"}, + {"g_f_Na", "microS", "hyperpolarisation_activated_current"}, + {"g_f_K", "microS", "hyperpolarisation_activated_current"} }; const VariableInfo ALGEBRAIC_INFO[] = { - {"i_Na", "nanoA", "sodium_current", ALGEBRAIC}, - {"i_p", "nanoA", "sodium_potassium_pump", ALGEBRAIC}, - {"i_NaCa", "nanoA", "sodium_calcium_exchanger", ALGEBRAIC}, - {"i_b_K", "nanoA", "potassium_background_current", ALGEBRAIC}, - {"i_b_Ca", "nanoA", "calcium_background_current", ALGEBRAIC}, - {"i_b_Na", "nanoA", "sodium_background_current", ALGEBRAIC}, - {"i_f_K", "nanoA", "hyperpolarisation_activated_current", ALGEBRAIC}, - {"i_f_Na", "nanoA", "hyperpolarisation_activated_current", ALGEBRAIC}, - {"i_K_s", "nanoA", "slow_delayed_rectifying_potassium_current", ALGEBRAIC}, - {"i_K_r", "nanoA", "rapid_delayed_rectifying_potassium_current", ALGEBRAIC}, - {"i_sus", "nanoA", "four_AP_sensitive_currents", ALGEBRAIC}, - {"i_to", "nanoA", "four_AP_sensitive_currents", ALGEBRAIC}, - {"i_Ca_T", "nanoA", "T_type_Ca_channel", ALGEBRAIC}, - {"i_Ca_L", "nanoA", "L_type_Ca_channel", ALGEBRAIC}, - {"h", "dimensionless", "sodium_current_h_gate", ALGEBRAIC}, - {"m_infinity", "dimensionless", "sodium_current_m_gate", ALGEBRAIC}, - {"tau_m", "second", "sodium_current_m_gate", ALGEBRAIC}, - {"F_Na", "dimensionless", "sodium_current_h_gate", ALGEBRAIC}, - {"h1_infinity", "dimensionless", "sodium_current_h_gate", ALGEBRAIC}, - {"tau_h1", "second", "sodium_current_h_gate", ALGEBRAIC}, - {"h2_infinity", "dimensionless", "sodium_current_h_gate", ALGEBRAIC}, - {"tau_h2", "second", "sodium_current_h_gate", ALGEBRAIC}, - {"d_L_infinity", "dimensionless", "L_type_Ca_channel_d_gate", ALGEBRAIC}, - {"tau_d_L", "second", "L_type_Ca_channel_d_gate", ALGEBRAIC}, - {"alpha_d_L", "per_second", "L_type_Ca_channel_d_gate", ALGEBRAIC}, - {"beta_d_L", "per_second", "L_type_Ca_channel_d_gate", ALGEBRAIC}, - {"f_L_infinity", "dimensionless", "L_type_Ca_channel_f_gate", ALGEBRAIC}, - {"tau_f_L", "second", "L_type_Ca_channel_f_gate", ALGEBRAIC}, - {"alpha_f_L", "per_second", "L_type_Ca_channel_f_gate", ALGEBRAIC}, - {"beta_f_L", "per_second", "L_type_Ca_channel_f_gate", ALGEBRAIC}, - {"d_T_infinity", "dimensionless", "T_type_Ca_channel_d_gate", ALGEBRAIC}, - {"tau_d_T", "second", "T_type_Ca_channel_d_gate", ALGEBRAIC}, - {"alpha_d_T", "per_second", "T_type_Ca_channel_d_gate", ALGEBRAIC}, - {"beta_d_T", "per_second", "T_type_Ca_channel_d_gate", ALGEBRAIC}, - {"f_T_infinity", "dimensionless", "T_type_Ca_channel_f_gate", ALGEBRAIC}, - {"tau_f_T", "second", "T_type_Ca_channel_f_gate", ALGEBRAIC}, - {"alpha_f_T", "per_second", "T_type_Ca_channel_f_gate", ALGEBRAIC}, - {"beta_f_T", "per_second", "T_type_Ca_channel_f_gate", ALGEBRAIC}, - {"q_infinity", "dimensionless", "four_AP_sensitive_currents_q_gate", ALGEBRAIC}, - {"tau_q", "second", "four_AP_sensitive_currents_q_gate", ALGEBRAIC}, - {"r_infinity", "dimensionless", "four_AP_sensitive_currents_r_gate", ALGEBRAIC}, - {"tau_r", "second", "four_AP_sensitive_currents_r_gate", ALGEBRAIC}, - {"P_a", "dimensionless", "rapid_delayed_rectifying_potassium_current", ALGEBRAIC}, - {"P_af_infinity", "dimensionless", "rapid_delayed_rectifying_potassium_current_P_af_gate", ALGEBRAIC}, - {"tau_P_af", "second", "rapid_delayed_rectifying_potassium_current_P_af_gate", ALGEBRAIC}, - {"P_as_infinity", "dimensionless", "rapid_delayed_rectifying_potassium_current_P_as_gate", ALGEBRAIC}, - {"tau_P_as", "second", "rapid_delayed_rectifying_potassium_current_P_as_gate", ALGEBRAIC}, - {"P_i_infinity", "dimensionless", "rapid_delayed_rectifying_potassium_current_P_i_gate", ALGEBRAIC}, - {"alpha_xs", "per_second", "slow_delayed_rectifying_potassium_current_xs_gate", ALGEBRAIC}, - {"beta_xs", "per_second", "slow_delayed_rectifying_potassium_current_xs_gate", ALGEBRAIC}, - {"alpha_y", "per_second", "hyperpolarisation_activated_current_y_gate", ALGEBRAIC}, - {"beta_y", "per_second", "hyperpolarisation_activated_current_y_gate", ALGEBRAIC} + {"i_Na", "nanoA", "sodium_current"}, + {"i_p", "nanoA", "sodium_potassium_pump"}, + {"i_NaCa", "nanoA", "sodium_calcium_exchanger"}, + {"i_b_K", "nanoA", "potassium_background_current"}, + {"i_b_Ca", "nanoA", "calcium_background_current"}, + {"i_b_Na", "nanoA", "sodium_background_current"}, + {"i_f_K", "nanoA", "hyperpolarisation_activated_current"}, + {"i_f_Na", "nanoA", "hyperpolarisation_activated_current"}, + {"i_K_s", "nanoA", "slow_delayed_rectifying_potassium_current"}, + {"i_K_r", "nanoA", "rapid_delayed_rectifying_potassium_current"}, + {"i_sus", "nanoA", "four_AP_sensitive_currents"}, + {"i_to", "nanoA", "four_AP_sensitive_currents"}, + {"i_Ca_T", "nanoA", "T_type_Ca_channel"}, + {"i_Ca_L", "nanoA", "L_type_Ca_channel"}, + {"h", "dimensionless", "sodium_current_h_gate"}, + {"m_infinity", "dimensionless", "sodium_current_m_gate"}, + {"tau_m", "second", "sodium_current_m_gate"}, + {"F_Na", "dimensionless", "sodium_current_h_gate"}, + {"h1_infinity", "dimensionless", "sodium_current_h_gate"}, + {"tau_h1", "second", "sodium_current_h_gate"}, + {"h2_infinity", "dimensionless", "sodium_current_h_gate"}, + {"tau_h2", "second", "sodium_current_h_gate"}, + {"d_L_infinity", "dimensionless", "L_type_Ca_channel_d_gate"}, + {"tau_d_L", "second", "L_type_Ca_channel_d_gate"}, + {"alpha_d_L", "per_second", "L_type_Ca_channel_d_gate"}, + {"beta_d_L", "per_second", "L_type_Ca_channel_d_gate"}, + {"f_L_infinity", "dimensionless", "L_type_Ca_channel_f_gate"}, + {"tau_f_L", "second", "L_type_Ca_channel_f_gate"}, + {"alpha_f_L", "per_second", "L_type_Ca_channel_f_gate"}, + {"beta_f_L", "per_second", "L_type_Ca_channel_f_gate"}, + {"d_T_infinity", "dimensionless", "T_type_Ca_channel_d_gate"}, + {"tau_d_T", "second", "T_type_Ca_channel_d_gate"}, + {"alpha_d_T", "per_second", "T_type_Ca_channel_d_gate"}, + {"beta_d_T", "per_second", "T_type_Ca_channel_d_gate"}, + {"f_T_infinity", "dimensionless", "T_type_Ca_channel_f_gate"}, + {"tau_f_T", "second", "T_type_Ca_channel_f_gate"}, + {"alpha_f_T", "per_second", "T_type_Ca_channel_f_gate"}, + {"beta_f_T", "per_second", "T_type_Ca_channel_f_gate"}, + {"q_infinity", "dimensionless", "four_AP_sensitive_currents_q_gate"}, + {"tau_q", "second", "four_AP_sensitive_currents_q_gate"}, + {"r_infinity", "dimensionless", "four_AP_sensitive_currents_r_gate"}, + {"tau_r", "second", "four_AP_sensitive_currents_r_gate"}, + {"P_a", "dimensionless", "rapid_delayed_rectifying_potassium_current"}, + {"P_af_infinity", "dimensionless", "rapid_delayed_rectifying_potassium_current_P_af_gate"}, + {"tau_P_af", "second", "rapid_delayed_rectifying_potassium_current_P_af_gate"}, + {"P_as_infinity", "dimensionless", "rapid_delayed_rectifying_potassium_current_P_as_gate"}, + {"tau_P_as", "second", "rapid_delayed_rectifying_potassium_current_P_as_gate"}, + {"P_i_infinity", "dimensionless", "rapid_delayed_rectifying_potassium_current_P_i_gate"}, + {"alpha_xs", "per_second", "slow_delayed_rectifying_potassium_current_xs_gate"}, + {"beta_xs", "per_second", "slow_delayed_rectifying_potassium_current_xs_gate"}, + {"alpha_y", "per_second", "hyperpolarisation_activated_current_y_gate"}, + {"beta_y", "per_second", "hyperpolarisation_activated_current_y_gate"} }; double * createStatesArray() diff --git a/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.h b/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.h index 5838d8bc89..4edb4f7200 100644 --- a/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.h +++ b/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.h @@ -12,19 +12,10 @@ extern const size_t CONSTANT_COUNT; extern const size_t COMPUTED_CONSTANT_COUNT; extern const size_t ALGEBRAIC_COUNT; -typedef enum { - VARIABLE_OF_INTEGRATION, - STATE, - CONSTANT, - COMPUTED_CONSTANT, - ALGEBRAIC -} VariableType; - typedef struct { char name[31]; char units[27]; char component[53]; - VariableType type; } VariableInfo; extern const VariableInfo VOI_INFO; diff --git a/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.py b/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.py index 01844df2cd..a10fd42ef1 100644 --- a/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.py +++ b/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.py @@ -12,226 +12,217 @@ COMPUTED_CONSTANT_COUNT = 23 ALGEBRAIC_COUNT = 52 +VOI_INFO = {"name": "time", "units": "second", "component": "environment"} -class VariableType(Enum): - VARIABLE_OF_INTEGRATION = 0 - STATE = 1 - CONSTANT = 2 - COMPUTED_CONSTANT = 3 - ALGEBRAIC = 4 - - -VOI_INFO = {"name": "time", "units": "second", "component": "environment", "type": VariableType.VARIABLE_OF_INTEGRATION} - -STATE_INFO = {"name": "V", "units": "millivolt", "component": "membrane", "type": VariableType.STATE}, - {"name": "m", "units": "dimensionless", "component": "sodium_current_m_gate", "type": VariableType.STATE}, - {"name": "h1", "units": "dimensionless", "component": "sodium_current_h_gate", "type": VariableType.STATE}, - {"name": "h2", "units": "dimensionless", "component": "sodium_current_h_gate", "type": VariableType.STATE}, - {"name": "f_L", "units": "dimensionless", "component": "L_type_Ca_channel_f_gate", "type": VariableType.STATE}, - {"name": "d_L", "units": "dimensionless", "component": "L_type_Ca_channel_d_gate", "type": VariableType.STATE}, - {"name": "f_T", "units": "dimensionless", "component": "T_type_Ca_channel_f_gate", "type": VariableType.STATE}, - {"name": "d_T", "units": "dimensionless", "component": "T_type_Ca_channel_d_gate", "type": VariableType.STATE}, - {"name": "r", "units": "dimensionless", "component": "four_AP_sensitive_currents_r_gate", "type": VariableType.STATE}, - {"name": "q", "units": "dimensionless", "component": "four_AP_sensitive_currents_q_gate", "type": VariableType.STATE}, - {"name": "P_i", "units": "dimensionless", "component": "rapid_delayed_rectifying_potassium_current_P_i_gate", "type": VariableType.STATE}, - {"name": "P_af", "units": "dimensionless", "component": "rapid_delayed_rectifying_potassium_current_P_af_gate", "type": VariableType.STATE}, - {"name": "P_as", "units": "dimensionless", "component": "rapid_delayed_rectifying_potassium_current_P_as_gate", "type": VariableType.STATE}, - {"name": "xs", "units": "dimensionless", "component": "slow_delayed_rectifying_potassium_current_xs_gate", "type": VariableType.STATE}, - {"name": "y", "units": "dimensionless", "component": "hyperpolarisation_activated_current_y_gate", "type": VariableType.STATE} +STATE_INFO = {"name": "V", "units": "millivolt", "component": "membrane"}, + {"name": "m", "units": "dimensionless", "component": "sodium_current_m_gate"}, + {"name": "h1", "units": "dimensionless", "component": "sodium_current_h_gate"}, + {"name": "h2", "units": "dimensionless", "component": "sodium_current_h_gate"}, + {"name": "f_L", "units": "dimensionless", "component": "L_type_Ca_channel_f_gate"}, + {"name": "d_L", "units": "dimensionless", "component": "L_type_Ca_channel_d_gate"}, + {"name": "f_T", "units": "dimensionless", "component": "T_type_Ca_channel_f_gate"}, + {"name": "d_T", "units": "dimensionless", "component": "T_type_Ca_channel_d_gate"}, + {"name": "r", "units": "dimensionless", "component": "four_AP_sensitive_currents_r_gate"}, + {"name": "q", "units": "dimensionless", "component": "four_AP_sensitive_currents_q_gate"}, + {"name": "P_i", "units": "dimensionless", "component": "rapid_delayed_rectifying_potassium_current_P_i_gate"}, + {"name": "P_af", "units": "dimensionless", "component": "rapid_delayed_rectifying_potassium_current_P_af_gate"}, + {"name": "P_as", "units": "dimensionless", "component": "rapid_delayed_rectifying_potassium_current_P_as_gate"}, + {"name": "xs", "units": "dimensionless", "component": "slow_delayed_rectifying_potassium_current_xs_gate"}, + {"name": "y", "units": "dimensionless", "component": "hyperpolarisation_activated_current_y_gate"} CONSTANT_INFO = [ - {"name": "dCell", "units": "dimensionless", "component": "membrane", "type": VariableType.CONSTANT}, - {"name": "Version", "units": "dimensionless", "component": "membrane", "type": VariableType.CONSTANT}, - {"name": "FCellConstant", "units": "dimensionless", "component": "membrane", "type": VariableType.CONSTANT}, - {"name": "CmCentre", "units": "microF", "component": "membrane", "type": VariableType.CONSTANT}, - {"name": "CmPeriphery", "units": "microF", "component": "membrane", "type": VariableType.CONSTANT}, - {"name": "R", "units": "millijoule_per_mole_kelvin", "component": "membrane", "type": VariableType.CONSTANT}, - {"name": "T", "units": "kelvin", "component": "membrane", "type": VariableType.CONSTANT}, - {"name": "F", "units": "coulomb_per_mole", "component": "membrane", "type": VariableType.CONSTANT}, - {"name": "g_b_Na_Centre_Published", "units": "microS", "component": "sodium_background_current", "type": VariableType.CONSTANT}, - {"name": "g_b_Na_Periphery_Published", "units": "microS", "component": "sodium_background_current", "type": VariableType.CONSTANT}, - {"name": "g_b_Na_Centre_1DCapable", "units": "microS", "component": "sodium_background_current", "type": VariableType.CONSTANT}, - {"name": "g_b_Na_Periphery_1DCapable", "units": "microS", "component": "sodium_background_current", "type": VariableType.CONSTANT}, - {"name": "g_b_Na_Centre_0DCapable", "units": "microS", "component": "sodium_background_current", "type": VariableType.CONSTANT}, - {"name": "g_b_Na_Periphery_0DCapable", "units": "microS", "component": "sodium_background_current", "type": VariableType.CONSTANT}, - {"name": "g_b_K_Centre_Published", "units": "microS", "component": "potassium_background_current", "type": VariableType.CONSTANT}, - {"name": "g_b_K_Periphery_Published", "units": "microS", "component": "potassium_background_current", "type": VariableType.CONSTANT}, - {"name": "g_b_K_Centre_1DCapable", "units": "microS", "component": "potassium_background_current", "type": VariableType.CONSTANT}, - {"name": "g_b_K_Periphery_1DCapable", "units": "microS", "component": "potassium_background_current", "type": VariableType.CONSTANT}, - {"name": "g_b_K_Centre_0DCapable", "units": "microS", "component": "potassium_background_current", "type": VariableType.CONSTANT}, - {"name": "g_b_K_Periphery_0DCapable", "units": "microS", "component": "potassium_background_current", "type": VariableType.CONSTANT}, - {"name": "g_b_Ca_Centre_Published", "units": "microS", "component": "calcium_background_current", "type": VariableType.CONSTANT}, - {"name": "g_b_Ca_Periphery_Published", "units": "microS", "component": "calcium_background_current", "type": VariableType.CONSTANT}, - {"name": "g_b_Ca_Centre_1DCapable", "units": "microS", "component": "calcium_background_current", "type": VariableType.CONSTANT}, - {"name": "g_b_Ca_Periphery_1DCapable", "units": "microS", "component": "calcium_background_current", "type": VariableType.CONSTANT}, - {"name": "g_b_Ca_Centre_0DCapable", "units": "microS", "component": "calcium_background_current", "type": VariableType.CONSTANT}, - {"name": "g_b_Ca_Periphery_0DCapable", "units": "microS", "component": "calcium_background_current", "type": VariableType.CONSTANT}, - {"name": "k_NaCa_Centre_Published", "units": "nanoA", "component": "sodium_calcium_exchanger", "type": VariableType.CONSTANT}, - {"name": "k_NaCa_Periphery_Published", "units": "nanoA", "component": "sodium_calcium_exchanger", "type": VariableType.CONSTANT}, - {"name": "k_NaCa_Centre_1DCapable", "units": "nanoA", "component": "sodium_calcium_exchanger", "type": VariableType.CONSTANT}, - {"name": "k_NaCa_Periphery_1DCapable", "units": "nanoA", "component": "sodium_calcium_exchanger", "type": VariableType.CONSTANT}, - {"name": "k_NaCa_Centre_0DCapable", "units": "nanoA", "component": "sodium_calcium_exchanger", "type": VariableType.CONSTANT}, - {"name": "k_NaCa_Periphery_0DCapable", "units": "nanoA", "component": "sodium_calcium_exchanger", "type": VariableType.CONSTANT}, - {"name": "Na_i", "units": "millimolar", "component": "ionic_concentrations", "type": VariableType.CONSTANT}, - {"name": "gamma_NaCa", "units": "dimensionless", "component": "sodium_calcium_exchanger", "type": VariableType.CONSTANT}, - {"name": "Ca_o", "units": "millimolar", "component": "ionic_concentrations", "type": VariableType.CONSTANT}, - {"name": "Na_o", "units": "millimolar", "component": "ionic_concentrations", "type": VariableType.CONSTANT}, - {"name": "Ca_i", "units": "millimolar", "component": "ionic_concentrations", "type": VariableType.CONSTANT}, - {"name": "d_NaCa", "units": "dimensionless", "component": "sodium_calcium_exchanger", "type": VariableType.CONSTANT}, - {"name": "i_p_max_Centre_Published", "units": "nanoA", "component": "sodium_potassium_pump", "type": VariableType.CONSTANT}, - {"name": "i_p_max_Periphery_Published", "units": "nanoA", "component": "sodium_potassium_pump", "type": VariableType.CONSTANT}, - {"name": "i_p_max_Centre_1DCapable", "units": "nanoA", "component": "sodium_potassium_pump", "type": VariableType.CONSTANT}, - {"name": "i_p_max_Periphery_1DCapable", "units": "nanoA", "component": "sodium_potassium_pump", "type": VariableType.CONSTANT}, - {"name": "i_p_max_Centre_0DCapable", "units": "nanoA", "component": "sodium_potassium_pump", "type": VariableType.CONSTANT}, - {"name": "i_p_max_Periphery_0DCapable", "units": "nanoA", "component": "sodium_potassium_pump", "type": VariableType.CONSTANT}, - {"name": "K_o", "units": "millimolar", "component": "ionic_concentrations", "type": VariableType.CONSTANT}, - {"name": "K_m_K", "units": "millimolar", "component": "sodium_potassium_pump", "type": VariableType.CONSTANT}, - {"name": "K_m_Na", "units": "millimolar", "component": "sodium_potassium_pump", "type": VariableType.CONSTANT}, - {"name": "i_Ca_p_max_Centre_Published", "units": "nanoA", "component": "persistent_calcium_current", "type": VariableType.CONSTANT}, - {"name": "i_Ca_p_max_Periphery_Published", "units": "nanoA", "component": "persistent_calcium_current", "type": VariableType.CONSTANT}, - {"name": "i_Ca_p_max_Centre_1DCapable", "units": "nanoA", "component": "persistent_calcium_current", "type": VariableType.CONSTANT}, - {"name": "i_Ca_p_max_Periphery_1DCapable", "units": "nanoA", "component": "persistent_calcium_current", "type": VariableType.CONSTANT}, - {"name": "i_Ca_p_max_Centre_0DCapable", "units": "nanoA", "component": "persistent_calcium_current", "type": VariableType.CONSTANT}, - {"name": "i_Ca_p_max_Periphery_0DCapable", "units": "nanoA", "component": "persistent_calcium_current", "type": VariableType.CONSTANT}, - {"name": "K_i", "units": "millimolar", "component": "ionic_concentrations", "type": VariableType.CONSTANT}, - {"name": "g_Na_Centre_Published", "units": "microlitre_per_second", "component": "sodium_current", "type": VariableType.CONSTANT}, - {"name": "g_Na_Periphery_Published", "units": "microlitre_per_second", "component": "sodium_current", "type": VariableType.CONSTANT}, - {"name": "g_Na_Centre_1DCapable", "units": "microlitre_per_second", "component": "sodium_current", "type": VariableType.CONSTANT}, - {"name": "g_Na_Periphery_1DCapable", "units": "microlitre_per_second", "component": "sodium_current", "type": VariableType.CONSTANT}, - {"name": "g_Na_Centre_0DCapable", "units": "microlitre_per_second", "component": "sodium_current", "type": VariableType.CONSTANT}, - {"name": "g_Na_Periphery_0DCapable", "units": "microlitre_per_second", "component": "sodium_current", "type": VariableType.CONSTANT}, - {"name": "g_Ca_L_Centre_Published", "units": "microS", "component": "L_type_Ca_channel", "type": VariableType.CONSTANT}, - {"name": "g_Ca_L_Periphery_Published", "units": "microS", "component": "L_type_Ca_channel", "type": VariableType.CONSTANT}, - {"name": "g_Ca_L_Centre_1DCapable", "units": "microS", "component": "L_type_Ca_channel", "type": VariableType.CONSTANT}, - {"name": "g_Ca_L_Periphery_1DCapable", "units": "microS", "component": "L_type_Ca_channel", "type": VariableType.CONSTANT}, - {"name": "g_Ca_L_Centre_0DCapable", "units": "microS", "component": "L_type_Ca_channel", "type": VariableType.CONSTANT}, - {"name": "g_Ca_L_Periphery_0DCapable", "units": "microS", "component": "L_type_Ca_channel", "type": VariableType.CONSTANT}, - {"name": "E_Ca_L", "units": "millivolt", "component": "L_type_Ca_channel", "type": VariableType.CONSTANT}, - {"name": "g_Ca_T_Centre_Published", "units": "microS", "component": "T_type_Ca_channel", "type": VariableType.CONSTANT}, - {"name": "g_Ca_T_Periphery_Published", "units": "microS", "component": "T_type_Ca_channel", "type": VariableType.CONSTANT}, - {"name": "g_Ca_T_Centre_1DCapable", "units": "microS", "component": "T_type_Ca_channel", "type": VariableType.CONSTANT}, - {"name": "g_Ca_T_Periphery_1DCapable", "units": "microS", "component": "T_type_Ca_channel", "type": VariableType.CONSTANT}, - {"name": "g_Ca_T_Centre_0DCapable", "units": "microS", "component": "T_type_Ca_channel", "type": VariableType.CONSTANT}, - {"name": "g_Ca_T_Periphery_0DCapable", "units": "microS", "component": "T_type_Ca_channel", "type": VariableType.CONSTANT}, - {"name": "E_Ca_T", "units": "millivolt", "component": "T_type_Ca_channel", "type": VariableType.CONSTANT}, - {"name": "g_to_Centre_Published", "units": "microS", "component": "four_AP_sensitive_currents", "type": VariableType.CONSTANT}, - {"name": "g_to_Periphery_Published", "units": "microS", "component": "four_AP_sensitive_currents", "type": VariableType.CONSTANT}, - {"name": "g_to_Centre_1DCapable", "units": "microS", "component": "four_AP_sensitive_currents", "type": VariableType.CONSTANT}, - {"name": "g_to_Periphery_1DCapable", "units": "microS", "component": "four_AP_sensitive_currents", "type": VariableType.CONSTANT}, - {"name": "g_to_Centre_0DCapable", "units": "microS", "component": "four_AP_sensitive_currents", "type": VariableType.CONSTANT}, - {"name": "g_to_Periphery_0DCapable", "units": "microS", "component": "four_AP_sensitive_currents", "type": VariableType.CONSTANT}, - {"name": "g_sus_Centre_Published", "units": "microS", "component": "four_AP_sensitive_currents", "type": VariableType.CONSTANT}, - {"name": "g_sus_Periphery_Published", "units": "microS", "component": "four_AP_sensitive_currents", "type": VariableType.CONSTANT}, - {"name": "g_sus_Centre_1DCapable", "units": "microS", "component": "four_AP_sensitive_currents", "type": VariableType.CONSTANT}, - {"name": "g_sus_Periphery_1DCapable", "units": "microS", "component": "four_AP_sensitive_currents", "type": VariableType.CONSTANT}, - {"name": "g_sus_Centre_0DCapable", "units": "microS", "component": "four_AP_sensitive_currents", "type": VariableType.CONSTANT}, - {"name": "g_sus_Periphery_0DCapable", "units": "microS", "component": "four_AP_sensitive_currents", "type": VariableType.CONSTANT}, - {"name": "g_K_r_Centre_Published", "units": "microS", "component": "rapid_delayed_rectifying_potassium_current", "type": VariableType.CONSTANT}, - {"name": "g_K_r_Periphery_Published", "units": "microS", "component": "rapid_delayed_rectifying_potassium_current", "type": VariableType.CONSTANT}, - {"name": "g_K_r_Centre_1DCapable", "units": "microS", "component": "rapid_delayed_rectifying_potassium_current", "type": VariableType.CONSTANT}, - {"name": "g_K_r_Periphery_1DCapable", "units": "microS", "component": "rapid_delayed_rectifying_potassium_current", "type": VariableType.CONSTANT}, - {"name": "g_K_r_Centre_0DCapable", "units": "microS", "component": "rapid_delayed_rectifying_potassium_current", "type": VariableType.CONSTANT}, - {"name": "g_K_r_Periphery_0DCapable", "units": "microS", "component": "rapid_delayed_rectifying_potassium_current", "type": VariableType.CONSTANT}, - {"name": "g_K_s_Centre_Published", "units": "microS", "component": "slow_delayed_rectifying_potassium_current", "type": VariableType.CONSTANT}, - {"name": "g_K_s_Periphery_Published", "units": "microS", "component": "slow_delayed_rectifying_potassium_current", "type": VariableType.CONSTANT}, - {"name": "g_K_s_Centre_1DCapable", "units": "microS", "component": "slow_delayed_rectifying_potassium_current", "type": VariableType.CONSTANT}, - {"name": "g_K_s_Periphery_1DCapable", "units": "microS", "component": "slow_delayed_rectifying_potassium_current", "type": VariableType.CONSTANT}, - {"name": "g_K_s_Centre_0DCapable", "units": "microS", "component": "slow_delayed_rectifying_potassium_current", "type": VariableType.CONSTANT}, - {"name": "g_K_s_Periphery_0DCapable", "units": "microS", "component": "slow_delayed_rectifying_potassium_current", "type": VariableType.CONSTANT}, - {"name": "g_f_Na_Centre_Published", "units": "microS", "component": "hyperpolarisation_activated_current", "type": VariableType.CONSTANT}, - {"name": "g_f_Na_Periphery_Published", "units": "microS", "component": "hyperpolarisation_activated_current", "type": VariableType.CONSTANT}, - {"name": "g_f_Na_Centre_1DCapable", "units": "microS", "component": "hyperpolarisation_activated_current", "type": VariableType.CONSTANT}, - {"name": "g_f_Na_Periphery_1DCapable", "units": "microS", "component": "hyperpolarisation_activated_current", "type": VariableType.CONSTANT}, - {"name": "g_f_Na_Centre_0DCapable", "units": "microS", "component": "hyperpolarisation_activated_current", "type": VariableType.CONSTANT}, - {"name": "g_f_Na_Periphery_0DCapable", "units": "microS", "component": "hyperpolarisation_activated_current", "type": VariableType.CONSTANT}, - {"name": "g_f_K_Centre_Published", "units": "microS", "component": "hyperpolarisation_activated_current", "type": VariableType.CONSTANT}, - {"name": "g_f_K_Periphery_Published", "units": "microS", "component": "hyperpolarisation_activated_current", "type": VariableType.CONSTANT}, - {"name": "g_f_K_Centre_1DCapable", "units": "microS", "component": "hyperpolarisation_activated_current", "type": VariableType.CONSTANT}, - {"name": "g_f_K_Periphery_1DCapable", "units": "microS", "component": "hyperpolarisation_activated_current", "type": VariableType.CONSTANT}, - {"name": "g_f_K_Centre_0DCapable", "units": "microS", "component": "hyperpolarisation_activated_current", "type": VariableType.CONSTANT}, - {"name": "g_f_K_Periphery_0DCapable", "units": "microS", "component": "hyperpolarisation_activated_current", "type": VariableType.CONSTANT} + {"name": "dCell", "units": "dimensionless", "component": "membrane"}, + {"name": "Version", "units": "dimensionless", "component": "membrane"}, + {"name": "FCellConstant", "units": "dimensionless", "component": "membrane"}, + {"name": "CmCentre", "units": "microF", "component": "membrane"}, + {"name": "CmPeriphery", "units": "microF", "component": "membrane"}, + {"name": "R", "units": "millijoule_per_mole_kelvin", "component": "membrane"}, + {"name": "T", "units": "kelvin", "component": "membrane"}, + {"name": "F", "units": "coulomb_per_mole", "component": "membrane"}, + {"name": "g_b_Na_Centre_Published", "units": "microS", "component": "sodium_background_current"}, + {"name": "g_b_Na_Periphery_Published", "units": "microS", "component": "sodium_background_current"}, + {"name": "g_b_Na_Centre_1DCapable", "units": "microS", "component": "sodium_background_current"}, + {"name": "g_b_Na_Periphery_1DCapable", "units": "microS", "component": "sodium_background_current"}, + {"name": "g_b_Na_Centre_0DCapable", "units": "microS", "component": "sodium_background_current"}, + {"name": "g_b_Na_Periphery_0DCapable", "units": "microS", "component": "sodium_background_current"}, + {"name": "g_b_K_Centre_Published", "units": "microS", "component": "potassium_background_current"}, + {"name": "g_b_K_Periphery_Published", "units": "microS", "component": "potassium_background_current"}, + {"name": "g_b_K_Centre_1DCapable", "units": "microS", "component": "potassium_background_current"}, + {"name": "g_b_K_Periphery_1DCapable", "units": "microS", "component": "potassium_background_current"}, + {"name": "g_b_K_Centre_0DCapable", "units": "microS", "component": "potassium_background_current"}, + {"name": "g_b_K_Periphery_0DCapable", "units": "microS", "component": "potassium_background_current"}, + {"name": "g_b_Ca_Centre_Published", "units": "microS", "component": "calcium_background_current"}, + {"name": "g_b_Ca_Periphery_Published", "units": "microS", "component": "calcium_background_current"}, + {"name": "g_b_Ca_Centre_1DCapable", "units": "microS", "component": "calcium_background_current"}, + {"name": "g_b_Ca_Periphery_1DCapable", "units": "microS", "component": "calcium_background_current"}, + {"name": "g_b_Ca_Centre_0DCapable", "units": "microS", "component": "calcium_background_current"}, + {"name": "g_b_Ca_Periphery_0DCapable", "units": "microS", "component": "calcium_background_current"}, + {"name": "k_NaCa_Centre_Published", "units": "nanoA", "component": "sodium_calcium_exchanger"}, + {"name": "k_NaCa_Periphery_Published", "units": "nanoA", "component": "sodium_calcium_exchanger"}, + {"name": "k_NaCa_Centre_1DCapable", "units": "nanoA", "component": "sodium_calcium_exchanger"}, + {"name": "k_NaCa_Periphery_1DCapable", "units": "nanoA", "component": "sodium_calcium_exchanger"}, + {"name": "k_NaCa_Centre_0DCapable", "units": "nanoA", "component": "sodium_calcium_exchanger"}, + {"name": "k_NaCa_Periphery_0DCapable", "units": "nanoA", "component": "sodium_calcium_exchanger"}, + {"name": "Na_i", "units": "millimolar", "component": "ionic_concentrations"}, + {"name": "gamma_NaCa", "units": "dimensionless", "component": "sodium_calcium_exchanger"}, + {"name": "Ca_o", "units": "millimolar", "component": "ionic_concentrations"}, + {"name": "Na_o", "units": "millimolar", "component": "ionic_concentrations"}, + {"name": "Ca_i", "units": "millimolar", "component": "ionic_concentrations"}, + {"name": "d_NaCa", "units": "dimensionless", "component": "sodium_calcium_exchanger"}, + {"name": "i_p_max_Centre_Published", "units": "nanoA", "component": "sodium_potassium_pump"}, + {"name": "i_p_max_Periphery_Published", "units": "nanoA", "component": "sodium_potassium_pump"}, + {"name": "i_p_max_Centre_1DCapable", "units": "nanoA", "component": "sodium_potassium_pump"}, + {"name": "i_p_max_Periphery_1DCapable", "units": "nanoA", "component": "sodium_potassium_pump"}, + {"name": "i_p_max_Centre_0DCapable", "units": "nanoA", "component": "sodium_potassium_pump"}, + {"name": "i_p_max_Periphery_0DCapable", "units": "nanoA", "component": "sodium_potassium_pump"}, + {"name": "K_o", "units": "millimolar", "component": "ionic_concentrations"}, + {"name": "K_m_K", "units": "millimolar", "component": "sodium_potassium_pump"}, + {"name": "K_m_Na", "units": "millimolar", "component": "sodium_potassium_pump"}, + {"name": "i_Ca_p_max_Centre_Published", "units": "nanoA", "component": "persistent_calcium_current"}, + {"name": "i_Ca_p_max_Periphery_Published", "units": "nanoA", "component": "persistent_calcium_current"}, + {"name": "i_Ca_p_max_Centre_1DCapable", "units": "nanoA", "component": "persistent_calcium_current"}, + {"name": "i_Ca_p_max_Periphery_1DCapable", "units": "nanoA", "component": "persistent_calcium_current"}, + {"name": "i_Ca_p_max_Centre_0DCapable", "units": "nanoA", "component": "persistent_calcium_current"}, + {"name": "i_Ca_p_max_Periphery_0DCapable", "units": "nanoA", "component": "persistent_calcium_current"}, + {"name": "K_i", "units": "millimolar", "component": "ionic_concentrations"}, + {"name": "g_Na_Centre_Published", "units": "microlitre_per_second", "component": "sodium_current"}, + {"name": "g_Na_Periphery_Published", "units": "microlitre_per_second", "component": "sodium_current"}, + {"name": "g_Na_Centre_1DCapable", "units": "microlitre_per_second", "component": "sodium_current"}, + {"name": "g_Na_Periphery_1DCapable", "units": "microlitre_per_second", "component": "sodium_current"}, + {"name": "g_Na_Centre_0DCapable", "units": "microlitre_per_second", "component": "sodium_current"}, + {"name": "g_Na_Periphery_0DCapable", "units": "microlitre_per_second", "component": "sodium_current"}, + {"name": "g_Ca_L_Centre_Published", "units": "microS", "component": "L_type_Ca_channel"}, + {"name": "g_Ca_L_Periphery_Published", "units": "microS", "component": "L_type_Ca_channel"}, + {"name": "g_Ca_L_Centre_1DCapable", "units": "microS", "component": "L_type_Ca_channel"}, + {"name": "g_Ca_L_Periphery_1DCapable", "units": "microS", "component": "L_type_Ca_channel"}, + {"name": "g_Ca_L_Centre_0DCapable", "units": "microS", "component": "L_type_Ca_channel"}, + {"name": "g_Ca_L_Periphery_0DCapable", "units": "microS", "component": "L_type_Ca_channel"}, + {"name": "E_Ca_L", "units": "millivolt", "component": "L_type_Ca_channel"}, + {"name": "g_Ca_T_Centre_Published", "units": "microS", "component": "T_type_Ca_channel"}, + {"name": "g_Ca_T_Periphery_Published", "units": "microS", "component": "T_type_Ca_channel"}, + {"name": "g_Ca_T_Centre_1DCapable", "units": "microS", "component": "T_type_Ca_channel"}, + {"name": "g_Ca_T_Periphery_1DCapable", "units": "microS", "component": "T_type_Ca_channel"}, + {"name": "g_Ca_T_Centre_0DCapable", "units": "microS", "component": "T_type_Ca_channel"}, + {"name": "g_Ca_T_Periphery_0DCapable", "units": "microS", "component": "T_type_Ca_channel"}, + {"name": "E_Ca_T", "units": "millivolt", "component": "T_type_Ca_channel"}, + {"name": "g_to_Centre_Published", "units": "microS", "component": "four_AP_sensitive_currents"}, + {"name": "g_to_Periphery_Published", "units": "microS", "component": "four_AP_sensitive_currents"}, + {"name": "g_to_Centre_1DCapable", "units": "microS", "component": "four_AP_sensitive_currents"}, + {"name": "g_to_Periphery_1DCapable", "units": "microS", "component": "four_AP_sensitive_currents"}, + {"name": "g_to_Centre_0DCapable", "units": "microS", "component": "four_AP_sensitive_currents"}, + {"name": "g_to_Periphery_0DCapable", "units": "microS", "component": "four_AP_sensitive_currents"}, + {"name": "g_sus_Centre_Published", "units": "microS", "component": "four_AP_sensitive_currents"}, + {"name": "g_sus_Periphery_Published", "units": "microS", "component": "four_AP_sensitive_currents"}, + {"name": "g_sus_Centre_1DCapable", "units": "microS", "component": "four_AP_sensitive_currents"}, + {"name": "g_sus_Periphery_1DCapable", "units": "microS", "component": "four_AP_sensitive_currents"}, + {"name": "g_sus_Centre_0DCapable", "units": "microS", "component": "four_AP_sensitive_currents"}, + {"name": "g_sus_Periphery_0DCapable", "units": "microS", "component": "four_AP_sensitive_currents"}, + {"name": "g_K_r_Centre_Published", "units": "microS", "component": "rapid_delayed_rectifying_potassium_current"}, + {"name": "g_K_r_Periphery_Published", "units": "microS", "component": "rapid_delayed_rectifying_potassium_current"}, + {"name": "g_K_r_Centre_1DCapable", "units": "microS", "component": "rapid_delayed_rectifying_potassium_current"}, + {"name": "g_K_r_Periphery_1DCapable", "units": "microS", "component": "rapid_delayed_rectifying_potassium_current"}, + {"name": "g_K_r_Centre_0DCapable", "units": "microS", "component": "rapid_delayed_rectifying_potassium_current"}, + {"name": "g_K_r_Periphery_0DCapable", "units": "microS", "component": "rapid_delayed_rectifying_potassium_current"}, + {"name": "g_K_s_Centre_Published", "units": "microS", "component": "slow_delayed_rectifying_potassium_current"}, + {"name": "g_K_s_Periphery_Published", "units": "microS", "component": "slow_delayed_rectifying_potassium_current"}, + {"name": "g_K_s_Centre_1DCapable", "units": "microS", "component": "slow_delayed_rectifying_potassium_current"}, + {"name": "g_K_s_Periphery_1DCapable", "units": "microS", "component": "slow_delayed_rectifying_potassium_current"}, + {"name": "g_K_s_Centre_0DCapable", "units": "microS", "component": "slow_delayed_rectifying_potassium_current"}, + {"name": "g_K_s_Periphery_0DCapable", "units": "microS", "component": "slow_delayed_rectifying_potassium_current"}, + {"name": "g_f_Na_Centre_Published", "units": "microS", "component": "hyperpolarisation_activated_current"}, + {"name": "g_f_Na_Periphery_Published", "units": "microS", "component": "hyperpolarisation_activated_current"}, + {"name": "g_f_Na_Centre_1DCapable", "units": "microS", "component": "hyperpolarisation_activated_current"}, + {"name": "g_f_Na_Periphery_1DCapable", "units": "microS", "component": "hyperpolarisation_activated_current"}, + {"name": "g_f_Na_Centre_0DCapable", "units": "microS", "component": "hyperpolarisation_activated_current"}, + {"name": "g_f_Na_Periphery_0DCapable", "units": "microS", "component": "hyperpolarisation_activated_current"}, + {"name": "g_f_K_Centre_Published", "units": "microS", "component": "hyperpolarisation_activated_current"}, + {"name": "g_f_K_Periphery_Published", "units": "microS", "component": "hyperpolarisation_activated_current"}, + {"name": "g_f_K_Centre_1DCapable", "units": "microS", "component": "hyperpolarisation_activated_current"}, + {"name": "g_f_K_Periphery_1DCapable", "units": "microS", "component": "hyperpolarisation_activated_current"}, + {"name": "g_f_K_Centre_0DCapable", "units": "microS", "component": "hyperpolarisation_activated_current"}, + {"name": "g_f_K_Periphery_0DCapable", "units": "microS", "component": "hyperpolarisation_activated_current"} ] COMPUTED_CONSTANT_INFO = [ - {"name": "FCell", "units": "dimensionless", "component": "membrane", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "Cm", "units": "microF", "component": "membrane", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "i_Ca_p", "units": "nanoA", "component": "persistent_calcium_current", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "g_b_Na", "units": "microS", "component": "sodium_background_current", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "E_Na", "units": "millivolt", "component": "reversal_and_equilibrium_potentials", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "g_b_K", "units": "microS", "component": "potassium_background_current", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "E_K", "units": "millivolt", "component": "reversal_and_equilibrium_potentials", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "g_b_Ca", "units": "microS", "component": "calcium_background_current", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "E_Ca", "units": "millivolt", "component": "reversal_and_equilibrium_potentials", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "k_NaCa", "units": "nanoA", "component": "sodium_calcium_exchanger", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "i_p_max", "units": "nanoA", "component": "sodium_potassium_pump", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "i_Ca_p_max", "units": "nanoA", "component": "persistent_calcium_current", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "E_K_s", "units": "millivolt", "component": "reversal_and_equilibrium_potentials", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "g_Na", "units": "microlitre_per_second", "component": "sodium_current", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "g_Ca_L", "units": "microS", "component": "L_type_Ca_channel", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "g_Ca_T", "units": "microS", "component": "T_type_Ca_channel", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "g_to", "units": "microS", "component": "four_AP_sensitive_currents", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "g_sus", "units": "microS", "component": "four_AP_sensitive_currents", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "g_K_r", "units": "microS", "component": "rapid_delayed_rectifying_potassium_current", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "tau_P_i", "units": "second", "component": "rapid_delayed_rectifying_potassium_current_P_i_gate", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "g_K_s", "units": "microS", "component": "slow_delayed_rectifying_potassium_current", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "g_f_Na", "units": "microS", "component": "hyperpolarisation_activated_current", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "g_f_K", "units": "microS", "component": "hyperpolarisation_activated_current", "type": VariableType.COMPUTED_CONSTANT} + {"name": "FCell", "units": "dimensionless", "component": "membrane"}, + {"name": "Cm", "units": "microF", "component": "membrane"}, + {"name": "i_Ca_p", "units": "nanoA", "component": "persistent_calcium_current"}, + {"name": "g_b_Na", "units": "microS", "component": "sodium_background_current"}, + {"name": "E_Na", "units": "millivolt", "component": "reversal_and_equilibrium_potentials"}, + {"name": "g_b_K", "units": "microS", "component": "potassium_background_current"}, + {"name": "E_K", "units": "millivolt", "component": "reversal_and_equilibrium_potentials"}, + {"name": "g_b_Ca", "units": "microS", "component": "calcium_background_current"}, + {"name": "E_Ca", "units": "millivolt", "component": "reversal_and_equilibrium_potentials"}, + {"name": "k_NaCa", "units": "nanoA", "component": "sodium_calcium_exchanger"}, + {"name": "i_p_max", "units": "nanoA", "component": "sodium_potassium_pump"}, + {"name": "i_Ca_p_max", "units": "nanoA", "component": "persistent_calcium_current"}, + {"name": "E_K_s", "units": "millivolt", "component": "reversal_and_equilibrium_potentials"}, + {"name": "g_Na", "units": "microlitre_per_second", "component": "sodium_current"}, + {"name": "g_Ca_L", "units": "microS", "component": "L_type_Ca_channel"}, + {"name": "g_Ca_T", "units": "microS", "component": "T_type_Ca_channel"}, + {"name": "g_to", "units": "microS", "component": "four_AP_sensitive_currents"}, + {"name": "g_sus", "units": "microS", "component": "four_AP_sensitive_currents"}, + {"name": "g_K_r", "units": "microS", "component": "rapid_delayed_rectifying_potassium_current"}, + {"name": "tau_P_i", "units": "second", "component": "rapid_delayed_rectifying_potassium_current_P_i_gate"}, + {"name": "g_K_s", "units": "microS", "component": "slow_delayed_rectifying_potassium_current"}, + {"name": "g_f_Na", "units": "microS", "component": "hyperpolarisation_activated_current"}, + {"name": "g_f_K", "units": "microS", "component": "hyperpolarisation_activated_current"} ] ALGEBRAIC_INFO = [ - {"name": "i_Na", "units": "nanoA", "component": "sodium_current", "type": VariableType.ALGEBRAIC}, - {"name": "i_p", "units": "nanoA", "component": "sodium_potassium_pump", "type": VariableType.ALGEBRAIC}, - {"name": "i_NaCa", "units": "nanoA", "component": "sodium_calcium_exchanger", "type": VariableType.ALGEBRAIC}, - {"name": "i_b_K", "units": "nanoA", "component": "potassium_background_current", "type": VariableType.ALGEBRAIC}, - {"name": "i_b_Ca", "units": "nanoA", "component": "calcium_background_current", "type": VariableType.ALGEBRAIC}, - {"name": "i_b_Na", "units": "nanoA", "component": "sodium_background_current", "type": VariableType.ALGEBRAIC}, - {"name": "i_f_K", "units": "nanoA", "component": "hyperpolarisation_activated_current", "type": VariableType.ALGEBRAIC}, - {"name": "i_f_Na", "units": "nanoA", "component": "hyperpolarisation_activated_current", "type": VariableType.ALGEBRAIC}, - {"name": "i_K_s", "units": "nanoA", "component": "slow_delayed_rectifying_potassium_current", "type": VariableType.ALGEBRAIC}, - {"name": "i_K_r", "units": "nanoA", "component": "rapid_delayed_rectifying_potassium_current", "type": VariableType.ALGEBRAIC}, - {"name": "i_sus", "units": "nanoA", "component": "four_AP_sensitive_currents", "type": VariableType.ALGEBRAIC}, - {"name": "i_to", "units": "nanoA", "component": "four_AP_sensitive_currents", "type": VariableType.ALGEBRAIC}, - {"name": "i_Ca_T", "units": "nanoA", "component": "T_type_Ca_channel", "type": VariableType.ALGEBRAIC}, - {"name": "i_Ca_L", "units": "nanoA", "component": "L_type_Ca_channel", "type": VariableType.ALGEBRAIC}, - {"name": "h", "units": "dimensionless", "component": "sodium_current_h_gate", "type": VariableType.ALGEBRAIC}, - {"name": "m_infinity", "units": "dimensionless", "component": "sodium_current_m_gate", "type": VariableType.ALGEBRAIC}, - {"name": "tau_m", "units": "second", "component": "sodium_current_m_gate", "type": VariableType.ALGEBRAIC}, - {"name": "F_Na", "units": "dimensionless", "component": "sodium_current_h_gate", "type": VariableType.ALGEBRAIC}, - {"name": "h1_infinity", "units": "dimensionless", "component": "sodium_current_h_gate", "type": VariableType.ALGEBRAIC}, - {"name": "tau_h1", "units": "second", "component": "sodium_current_h_gate", "type": VariableType.ALGEBRAIC}, - {"name": "h2_infinity", "units": "dimensionless", "component": "sodium_current_h_gate", "type": VariableType.ALGEBRAIC}, - {"name": "tau_h2", "units": "second", "component": "sodium_current_h_gate", "type": VariableType.ALGEBRAIC}, - {"name": "d_L_infinity", "units": "dimensionless", "component": "L_type_Ca_channel_d_gate", "type": VariableType.ALGEBRAIC}, - {"name": "tau_d_L", "units": "second", "component": "L_type_Ca_channel_d_gate", "type": VariableType.ALGEBRAIC}, - {"name": "alpha_d_L", "units": "per_second", "component": "L_type_Ca_channel_d_gate", "type": VariableType.ALGEBRAIC}, - {"name": "beta_d_L", "units": "per_second", "component": "L_type_Ca_channel_d_gate", "type": VariableType.ALGEBRAIC}, - {"name": "f_L_infinity", "units": "dimensionless", "component": "L_type_Ca_channel_f_gate", "type": VariableType.ALGEBRAIC}, - {"name": "tau_f_L", "units": "second", "component": "L_type_Ca_channel_f_gate", "type": VariableType.ALGEBRAIC}, - {"name": "alpha_f_L", "units": "per_second", "component": "L_type_Ca_channel_f_gate", "type": VariableType.ALGEBRAIC}, - {"name": "beta_f_L", "units": "per_second", "component": "L_type_Ca_channel_f_gate", "type": VariableType.ALGEBRAIC}, - {"name": "d_T_infinity", "units": "dimensionless", "component": "T_type_Ca_channel_d_gate", "type": VariableType.ALGEBRAIC}, - {"name": "tau_d_T", "units": "second", "component": "T_type_Ca_channel_d_gate", "type": VariableType.ALGEBRAIC}, - {"name": "alpha_d_T", "units": "per_second", "component": "T_type_Ca_channel_d_gate", "type": VariableType.ALGEBRAIC}, - {"name": "beta_d_T", "units": "per_second", "component": "T_type_Ca_channel_d_gate", "type": VariableType.ALGEBRAIC}, - {"name": "f_T_infinity", "units": "dimensionless", "component": "T_type_Ca_channel_f_gate", "type": VariableType.ALGEBRAIC}, - {"name": "tau_f_T", "units": "second", "component": "T_type_Ca_channel_f_gate", "type": VariableType.ALGEBRAIC}, - {"name": "alpha_f_T", "units": "per_second", "component": "T_type_Ca_channel_f_gate", "type": VariableType.ALGEBRAIC}, - {"name": "beta_f_T", "units": "per_second", "component": "T_type_Ca_channel_f_gate", "type": VariableType.ALGEBRAIC}, - {"name": "q_infinity", "units": "dimensionless", "component": "four_AP_sensitive_currents_q_gate", "type": VariableType.ALGEBRAIC}, - {"name": "tau_q", "units": "second", "component": "four_AP_sensitive_currents_q_gate", "type": VariableType.ALGEBRAIC}, - {"name": "r_infinity", "units": "dimensionless", "component": "four_AP_sensitive_currents_r_gate", "type": VariableType.ALGEBRAIC}, - {"name": "tau_r", "units": "second", "component": "four_AP_sensitive_currents_r_gate", "type": VariableType.ALGEBRAIC}, - {"name": "P_a", "units": "dimensionless", "component": "rapid_delayed_rectifying_potassium_current", "type": VariableType.ALGEBRAIC}, - {"name": "P_af_infinity", "units": "dimensionless", "component": "rapid_delayed_rectifying_potassium_current_P_af_gate", "type": VariableType.ALGEBRAIC}, - {"name": "tau_P_af", "units": "second", "component": "rapid_delayed_rectifying_potassium_current_P_af_gate", "type": VariableType.ALGEBRAIC}, - {"name": "P_as_infinity", "units": "dimensionless", "component": "rapid_delayed_rectifying_potassium_current_P_as_gate", "type": VariableType.ALGEBRAIC}, - {"name": "tau_P_as", "units": "second", "component": "rapid_delayed_rectifying_potassium_current_P_as_gate", "type": VariableType.ALGEBRAIC}, - {"name": "P_i_infinity", "units": "dimensionless", "component": "rapid_delayed_rectifying_potassium_current_P_i_gate", "type": VariableType.ALGEBRAIC}, - {"name": "alpha_xs", "units": "per_second", "component": "slow_delayed_rectifying_potassium_current_xs_gate", "type": VariableType.ALGEBRAIC}, - {"name": "beta_xs", "units": "per_second", "component": "slow_delayed_rectifying_potassium_current_xs_gate", "type": VariableType.ALGEBRAIC}, - {"name": "alpha_y", "units": "per_second", "component": "hyperpolarisation_activated_current_y_gate", "type": VariableType.ALGEBRAIC}, - {"name": "beta_y", "units": "per_second", "component": "hyperpolarisation_activated_current_y_gate", "type": VariableType.ALGEBRAIC} + {"name": "i_Na", "units": "nanoA", "component": "sodium_current"}, + {"name": "i_p", "units": "nanoA", "component": "sodium_potassium_pump"}, + {"name": "i_NaCa", "units": "nanoA", "component": "sodium_calcium_exchanger"}, + {"name": "i_b_K", "units": "nanoA", "component": "potassium_background_current"}, + {"name": "i_b_Ca", "units": "nanoA", "component": "calcium_background_current"}, + {"name": "i_b_Na", "units": "nanoA", "component": "sodium_background_current"}, + {"name": "i_f_K", "units": "nanoA", "component": "hyperpolarisation_activated_current"}, + {"name": "i_f_Na", "units": "nanoA", "component": "hyperpolarisation_activated_current"}, + {"name": "i_K_s", "units": "nanoA", "component": "slow_delayed_rectifying_potassium_current"}, + {"name": "i_K_r", "units": "nanoA", "component": "rapid_delayed_rectifying_potassium_current"}, + {"name": "i_sus", "units": "nanoA", "component": "four_AP_sensitive_currents"}, + {"name": "i_to", "units": "nanoA", "component": "four_AP_sensitive_currents"}, + {"name": "i_Ca_T", "units": "nanoA", "component": "T_type_Ca_channel"}, + {"name": "i_Ca_L", "units": "nanoA", "component": "L_type_Ca_channel"}, + {"name": "h", "units": "dimensionless", "component": "sodium_current_h_gate"}, + {"name": "m_infinity", "units": "dimensionless", "component": "sodium_current_m_gate"}, + {"name": "tau_m", "units": "second", "component": "sodium_current_m_gate"}, + {"name": "F_Na", "units": "dimensionless", "component": "sodium_current_h_gate"}, + {"name": "h1_infinity", "units": "dimensionless", "component": "sodium_current_h_gate"}, + {"name": "tau_h1", "units": "second", "component": "sodium_current_h_gate"}, + {"name": "h2_infinity", "units": "dimensionless", "component": "sodium_current_h_gate"}, + {"name": "tau_h2", "units": "second", "component": "sodium_current_h_gate"}, + {"name": "d_L_infinity", "units": "dimensionless", "component": "L_type_Ca_channel_d_gate"}, + {"name": "tau_d_L", "units": "second", "component": "L_type_Ca_channel_d_gate"}, + {"name": "alpha_d_L", "units": "per_second", "component": "L_type_Ca_channel_d_gate"}, + {"name": "beta_d_L", "units": "per_second", "component": "L_type_Ca_channel_d_gate"}, + {"name": "f_L_infinity", "units": "dimensionless", "component": "L_type_Ca_channel_f_gate"}, + {"name": "tau_f_L", "units": "second", "component": "L_type_Ca_channel_f_gate"}, + {"name": "alpha_f_L", "units": "per_second", "component": "L_type_Ca_channel_f_gate"}, + {"name": "beta_f_L", "units": "per_second", "component": "L_type_Ca_channel_f_gate"}, + {"name": "d_T_infinity", "units": "dimensionless", "component": "T_type_Ca_channel_d_gate"}, + {"name": "tau_d_T", "units": "second", "component": "T_type_Ca_channel_d_gate"}, + {"name": "alpha_d_T", "units": "per_second", "component": "T_type_Ca_channel_d_gate"}, + {"name": "beta_d_T", "units": "per_second", "component": "T_type_Ca_channel_d_gate"}, + {"name": "f_T_infinity", "units": "dimensionless", "component": "T_type_Ca_channel_f_gate"}, + {"name": "tau_f_T", "units": "second", "component": "T_type_Ca_channel_f_gate"}, + {"name": "alpha_f_T", "units": "per_second", "component": "T_type_Ca_channel_f_gate"}, + {"name": "beta_f_T", "units": "per_second", "component": "T_type_Ca_channel_f_gate"}, + {"name": "q_infinity", "units": "dimensionless", "component": "four_AP_sensitive_currents_q_gate"}, + {"name": "tau_q", "units": "second", "component": "four_AP_sensitive_currents_q_gate"}, + {"name": "r_infinity", "units": "dimensionless", "component": "four_AP_sensitive_currents_r_gate"}, + {"name": "tau_r", "units": "second", "component": "four_AP_sensitive_currents_r_gate"}, + {"name": "P_a", "units": "dimensionless", "component": "rapid_delayed_rectifying_potassium_current"}, + {"name": "P_af_infinity", "units": "dimensionless", "component": "rapid_delayed_rectifying_potassium_current_P_af_gate"}, + {"name": "tau_P_af", "units": "second", "component": "rapid_delayed_rectifying_potassium_current_P_af_gate"}, + {"name": "P_as_infinity", "units": "dimensionless", "component": "rapid_delayed_rectifying_potassium_current_P_as_gate"}, + {"name": "tau_P_as", "units": "second", "component": "rapid_delayed_rectifying_potassium_current_P_as_gate"}, + {"name": "P_i_infinity", "units": "dimensionless", "component": "rapid_delayed_rectifying_potassium_current_P_i_gate"}, + {"name": "alpha_xs", "units": "per_second", "component": "slow_delayed_rectifying_potassium_current_xs_gate"}, + {"name": "beta_xs", "units": "per_second", "component": "slow_delayed_rectifying_potassium_current_xs_gate"}, + {"name": "alpha_y", "units": "per_second", "component": "hyperpolarisation_activated_current_y_gate"}, + {"name": "beta_y", "units": "per_second", "component": "hyperpolarisation_activated_current_y_gate"} ] diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.c index f917c76649..8bb5523780 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.c @@ -14,43 +14,43 @@ const size_t COMPUTED_CONSTANT_COUNT = 3; const size_t ALGEBRAIC_COUNT = 9; const size_t EXTERNAL_COUNT = 1; -const VariableInfo VOI_INFO = {"time", "millisecond", "environment", VARIABLE_OF_INTEGRATION}; +const VariableInfo VOI_INFO = {"time", "millisecond", "environment"}; const VariableInfo STATE_INFO[] = { - {"V", "millivolt", "membrane", STATE}, - {"h", "dimensionless", "sodium_channel_h_gate", STATE}, - {"m", "dimensionless", "sodium_channel_m_gate", STATE}, - {"n", "dimensionless", "potassium_channel_n_gate", STATE} + {"V", "millivolt", "membrane"}, + {"h", "dimensionless", "sodium_channel_h_gate"}, + {"m", "dimensionless", "sodium_channel_m_gate"}, + {"n", "dimensionless", "potassium_channel_n_gate"} }; const VariableInfo CONSTANT_INFO[] = { - {"Cm", "microF_per_cm2", "membrane", CONSTANT}, - {"E_R", "millivolt", "membrane", CONSTANT}, - {"g_L", "milliS_per_cm2", "leakage_current", CONSTANT}, - {"g_Na", "milliS_per_cm2", "sodium_channel", CONSTANT}, - {"g_K", "milliS_per_cm2", "potassium_channel", CONSTANT} + {"Cm", "microF_per_cm2", "membrane"}, + {"E_R", "millivolt", "membrane"}, + {"g_L", "milliS_per_cm2", "leakage_current"}, + {"g_Na", "milliS_per_cm2", "sodium_channel"}, + {"g_K", "milliS_per_cm2", "potassium_channel"} }; const VariableInfo COMPUTED_CONSTANT_INFO[] = { - {"E_L", "millivolt", "leakage_current", COMPUTED_CONSTANT}, - {"E_Na", "millivolt", "sodium_channel", COMPUTED_CONSTANT}, - {"E_K", "millivolt", "potassium_channel", COMPUTED_CONSTANT} + {"E_L", "millivolt", "leakage_current"}, + {"E_Na", "millivolt", "sodium_channel"}, + {"E_K", "millivolt", "potassium_channel"} }; const VariableInfo ALGEBRAIC_INFO[] = { - {"i_L", "microA_per_cm2", "leakage_current", ALGEBRAIC}, - {"i_K", "microA_per_cm2", "potassium_channel", ALGEBRAIC}, - {"i_Na", "microA_per_cm2", "sodium_channel", ALGEBRAIC}, - {"alpha_m", "per_millisecond", "sodium_channel_m_gate", ALGEBRAIC}, - {"beta_m", "per_millisecond", "sodium_channel_m_gate", ALGEBRAIC}, - {"alpha_h", "per_millisecond", "sodium_channel_h_gate", ALGEBRAIC}, - {"beta_h", "per_millisecond", "sodium_channel_h_gate", ALGEBRAIC}, - {"alpha_n", "per_millisecond", "potassium_channel_n_gate", ALGEBRAIC}, - {"beta_n", "per_millisecond", "potassium_channel_n_gate", ALGEBRAIC} + {"i_L", "microA_per_cm2", "leakage_current"}, + {"i_K", "microA_per_cm2", "potassium_channel"}, + {"i_Na", "microA_per_cm2", "sodium_channel"}, + {"alpha_m", "per_millisecond", "sodium_channel_m_gate"}, + {"beta_m", "per_millisecond", "sodium_channel_m_gate"}, + {"alpha_h", "per_millisecond", "sodium_channel_h_gate"}, + {"beta_h", "per_millisecond", "sodium_channel_h_gate"}, + {"alpha_n", "per_millisecond", "potassium_channel_n_gate"}, + {"beta_n", "per_millisecond", "potassium_channel_n_gate"} }; const VariableInfo EXTERNAL_INFO[] = { - {"i_Stim", "microA_per_cm2", "membrane", EXTERNAL} + {"i_Stim", "microA_per_cm2", "membrane"} }; double * createStatesArray() diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.h index 5fb0b0dbc2..87c9d97a56 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.h +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.h @@ -13,20 +13,10 @@ extern const size_t COMPUTED_CONSTANT_COUNT; extern const size_t ALGEBRAIC_COUNT; extern const size_t EXTERNAL_COUNT; -typedef enum { - VARIABLE_OF_INTEGRATION, - STATE, - CONSTANT, - COMPUTED_CONSTANT, - ALGEBRAIC, - EXTERNAL -} VariableType; - typedef struct { char name[8]; char units[16]; char component[25]; - VariableType type; } VariableInfo; extern const VariableInfo VOI_INFO; diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.py index 069d0600da..1b9d75ed20 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.py @@ -13,52 +13,42 @@ ALGEBRAIC_COUNT = 9 EXTERNAL_COUNT = 1 +VOI_INFO = {"name": "time", "units": "millisecond", "component": "environment"} -class VariableType(Enum): - VARIABLE_OF_INTEGRATION = 0 - STATE = 1 - CONSTANT = 2 - COMPUTED_CONSTANT = 3 - ALGEBRAIC = 4 - EXTERNAL = 5 - - -VOI_INFO = {"name": "time", "units": "millisecond", "component": "environment", "type": VariableType.VARIABLE_OF_INTEGRATION} - -STATE_INFO = {"name": "V", "units": "millivolt", "component": "membrane", "type": VariableType.STATE}, - {"name": "h", "units": "dimensionless", "component": "sodium_channel_h_gate", "type": VariableType.STATE}, - {"name": "m", "units": "dimensionless", "component": "sodium_channel_m_gate", "type": VariableType.STATE}, - {"name": "n", "units": "dimensionless", "component": "potassium_channel_n_gate", "type": VariableType.STATE} +STATE_INFO = {"name": "V", "units": "millivolt", "component": "membrane"}, + {"name": "h", "units": "dimensionless", "component": "sodium_channel_h_gate"}, + {"name": "m", "units": "dimensionless", "component": "sodium_channel_m_gate"}, + {"name": "n", "units": "dimensionless", "component": "potassium_channel_n_gate"} CONSTANT_INFO = [ - {"name": "Cm", "units": "microF_per_cm2", "component": "membrane", "type": VariableType.CONSTANT}, - {"name": "E_R", "units": "millivolt", "component": "membrane", "type": VariableType.CONSTANT}, - {"name": "g_L", "units": "milliS_per_cm2", "component": "leakage_current", "type": VariableType.CONSTANT}, - {"name": "g_Na", "units": "milliS_per_cm2", "component": "sodium_channel", "type": VariableType.CONSTANT}, - {"name": "g_K", "units": "milliS_per_cm2", "component": "potassium_channel", "type": VariableType.CONSTANT} + {"name": "Cm", "units": "microF_per_cm2", "component": "membrane"}, + {"name": "E_R", "units": "millivolt", "component": "membrane"}, + {"name": "g_L", "units": "milliS_per_cm2", "component": "leakage_current"}, + {"name": "g_Na", "units": "milliS_per_cm2", "component": "sodium_channel"}, + {"name": "g_K", "units": "milliS_per_cm2", "component": "potassium_channel"} ] COMPUTED_CONSTANT_INFO = [ - {"name": "E_L", "units": "millivolt", "component": "leakage_current", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "E_Na", "units": "millivolt", "component": "sodium_channel", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "E_K", "units": "millivolt", "component": "potassium_channel", "type": VariableType.COMPUTED_CONSTANT} + {"name": "E_L", "units": "millivolt", "component": "leakage_current"}, + {"name": "E_Na", "units": "millivolt", "component": "sodium_channel"}, + {"name": "E_K", "units": "millivolt", "component": "potassium_channel"} ] ALGEBRAIC_INFO = [ - {"name": "i_L", "units": "microA_per_cm2", "component": "leakage_current", "type": VariableType.ALGEBRAIC}, - {"name": "i_K", "units": "microA_per_cm2", "component": "potassium_channel", "type": VariableType.ALGEBRAIC}, - {"name": "i_Na", "units": "microA_per_cm2", "component": "sodium_channel", "type": VariableType.ALGEBRAIC}, - {"name": "alpha_m", "units": "per_millisecond", "component": "sodium_channel_m_gate", "type": VariableType.ALGEBRAIC}, - {"name": "beta_m", "units": "per_millisecond", "component": "sodium_channel_m_gate", "type": VariableType.ALGEBRAIC}, - {"name": "alpha_h", "units": "per_millisecond", "component": "sodium_channel_h_gate", "type": VariableType.ALGEBRAIC}, - {"name": "beta_h", "units": "per_millisecond", "component": "sodium_channel_h_gate", "type": VariableType.ALGEBRAIC}, - {"name": "alpha_n", "units": "per_millisecond", "component": "potassium_channel_n_gate", "type": VariableType.ALGEBRAIC}, - {"name": "beta_n", "units": "per_millisecond", "component": "potassium_channel_n_gate", "type": VariableType.ALGEBRAIC} + {"name": "i_L", "units": "microA_per_cm2", "component": "leakage_current"}, + {"name": "i_K", "units": "microA_per_cm2", "component": "potassium_channel"}, + {"name": "i_Na", "units": "microA_per_cm2", "component": "sodium_channel"}, + {"name": "alpha_m", "units": "per_millisecond", "component": "sodium_channel_m_gate"}, + {"name": "beta_m", "units": "per_millisecond", "component": "sodium_channel_m_gate"}, + {"name": "alpha_h", "units": "per_millisecond", "component": "sodium_channel_h_gate"}, + {"name": "beta_h", "units": "per_millisecond", "component": "sodium_channel_h_gate"}, + {"name": "alpha_n", "units": "per_millisecond", "component": "potassium_channel_n_gate"}, + {"name": "beta_n", "units": "per_millisecond", "component": "potassium_channel_n_gate"} ] EXTERNAL_INFO = [ - {"name": "i_Stim", "units": "microA_per_cm2", "component": "membrane", "type": VariableType.EXTERNAL} + {"name": "i_Stim", "units": "microA_per_cm2", "component": "membrane"} ] diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.c index e031f85b45..77ac9b4bec 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.c @@ -13,40 +13,40 @@ const size_t CONSTANT_COUNT = 5; const size_t COMPUTED_CONSTANT_COUNT = 3; const size_t ALGEBRAIC_COUNT = 10; -const VariableInfo VOI_INFO = {"time", "millisecond", "environment", VARIABLE_OF_INTEGRATION}; +const VariableInfo VOI_INFO = {"time", "millisecond", "environment"}; const VariableInfo STATE_INFO[] = { - {"V", "millivolt", "membrane", STATE}, - {"h", "dimensionless", "sodium_channel_h_gate", STATE}, - {"m", "dimensionless", "sodium_channel_m_gate", STATE}, - {"n", "dimensionless", "potassium_channel_n_gate", STATE} + {"V", "millivolt", "membrane"}, + {"h", "dimensionless", "sodium_channel_h_gate"}, + {"m", "dimensionless", "sodium_channel_m_gate"}, + {"n", "dimensionless", "potassium_channel_n_gate"} }; const VariableInfo CONSTANT_INFO[] = { - {"Cm", "microF_per_cm2", "membrane", CONSTANT}, - {"E_R", "millivolt", "membrane", CONSTANT}, - {"g_L", "milliS_per_cm2", "leakage_current", CONSTANT}, - {"g_Na", "milliS_per_cm2", "sodium_channel", CONSTANT}, - {"g_K", "milliS_per_cm2", "potassium_channel", CONSTANT} + {"Cm", "microF_per_cm2", "membrane"}, + {"E_R", "millivolt", "membrane"}, + {"g_L", "milliS_per_cm2", "leakage_current"}, + {"g_Na", "milliS_per_cm2", "sodium_channel"}, + {"g_K", "milliS_per_cm2", "potassium_channel"} }; const VariableInfo COMPUTED_CONSTANT_INFO[] = { - {"E_L", "millivolt", "leakage_current", COMPUTED_CONSTANT}, - {"E_Na", "millivolt", "sodium_channel", COMPUTED_CONSTANT}, - {"E_K", "millivolt", "potassium_channel", COMPUTED_CONSTANT} + {"E_L", "millivolt", "leakage_current"}, + {"E_Na", "millivolt", "sodium_channel"}, + {"E_K", "millivolt", "potassium_channel"} }; const VariableInfo ALGEBRAIC_INFO[] = { - {"i_Stim", "microA_per_cm2", "membrane", ALGEBRAIC}, - {"i_L", "microA_per_cm2", "leakage_current", ALGEBRAIC}, - {"i_K", "microA_per_cm2", "potassium_channel", ALGEBRAIC}, - {"i_Na", "microA_per_cm2", "sodium_channel", ALGEBRAIC}, - {"alpha_m", "per_millisecond", "sodium_channel_m_gate", ALGEBRAIC}, - {"beta_m", "per_millisecond", "sodium_channel_m_gate", ALGEBRAIC}, - {"alpha_h", "per_millisecond", "sodium_channel_h_gate", ALGEBRAIC}, - {"beta_h", "per_millisecond", "sodium_channel_h_gate", ALGEBRAIC}, - {"alpha_n", "per_millisecond", "potassium_channel_n_gate", ALGEBRAIC}, - {"beta_n", "per_millisecond", "potassium_channel_n_gate", ALGEBRAIC} + {"i_Stim", "microA_per_cm2", "membrane"}, + {"i_L", "microA_per_cm2", "leakage_current"}, + {"i_K", "microA_per_cm2", "potassium_channel"}, + {"i_Na", "microA_per_cm2", "sodium_channel"}, + {"alpha_m", "per_millisecond", "sodium_channel_m_gate"}, + {"beta_m", "per_millisecond", "sodium_channel_m_gate"}, + {"alpha_h", "per_millisecond", "sodium_channel_h_gate"}, + {"beta_h", "per_millisecond", "sodium_channel_h_gate"}, + {"alpha_n", "per_millisecond", "potassium_channel_n_gate"}, + {"beta_n", "per_millisecond", "potassium_channel_n_gate"} }; double * createStatesArray() diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.c index 6d9bf826c3..b478980248 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.c @@ -14,43 +14,43 @@ const size_t COMPUTED_CONSTANT_COUNT = 2; const size_t ALGEBRAIC_COUNT = 10; const size_t EXTERNAL_COUNT = 1; -const VariableInfo VOI_INFO = {"time", "millisecond", "environment", VARIABLE_OF_INTEGRATION}; +const VariableInfo VOI_INFO = {"time", "millisecond", "environment"}; const VariableInfo STATE_INFO[] = { - {"V", "millivolt", "membrane", STATE}, - {"h", "dimensionless", "sodium_channel_h_gate", STATE}, - {"m", "dimensionless", "sodium_channel_m_gate", STATE}, - {"n", "dimensionless", "potassium_channel_n_gate", STATE} + {"V", "millivolt", "membrane"}, + {"h", "dimensionless", "sodium_channel_h_gate"}, + {"m", "dimensionless", "sodium_channel_m_gate"}, + {"n", "dimensionless", "potassium_channel_n_gate"} }; const VariableInfo CONSTANT_INFO[] = { - {"Cm", "microF_per_cm2", "membrane", CONSTANT}, - {"E_R", "millivolt", "membrane", CONSTANT}, - {"g_L", "milliS_per_cm2", "leakage_current", CONSTANT}, - {"g_Na", "milliS_per_cm2", "sodium_channel", CONSTANT}, - {"g_K", "milliS_per_cm2", "potassium_channel", CONSTANT} + {"Cm", "microF_per_cm2", "membrane"}, + {"E_R", "millivolt", "membrane"}, + {"g_L", "milliS_per_cm2", "leakage_current"}, + {"g_Na", "milliS_per_cm2", "sodium_channel"}, + {"g_K", "milliS_per_cm2", "potassium_channel"} }; const VariableInfo COMPUTED_CONSTANT_INFO[] = { - {"E_Na", "millivolt", "sodium_channel", COMPUTED_CONSTANT}, - {"E_K", "millivolt", "potassium_channel", COMPUTED_CONSTANT} + {"E_Na", "millivolt", "sodium_channel"}, + {"E_K", "millivolt", "potassium_channel"} }; const VariableInfo ALGEBRAIC_INFO[] = { - {"i_Stim", "microA_per_cm2", "membrane", ALGEBRAIC}, - {"i_L", "microA_per_cm2", "leakage_current", ALGEBRAIC}, - {"i_K", "microA_per_cm2", "potassium_channel", ALGEBRAIC}, - {"i_Na", "microA_per_cm2", "sodium_channel", ALGEBRAIC}, - {"alpha_m", "per_millisecond", "sodium_channel_m_gate", ALGEBRAIC}, - {"beta_m", "per_millisecond", "sodium_channel_m_gate", ALGEBRAIC}, - {"alpha_h", "per_millisecond", "sodium_channel_h_gate", ALGEBRAIC}, - {"beta_h", "per_millisecond", "sodium_channel_h_gate", ALGEBRAIC}, - {"alpha_n", "per_millisecond", "potassium_channel_n_gate", ALGEBRAIC}, - {"beta_n", "per_millisecond", "potassium_channel_n_gate", ALGEBRAIC} + {"i_Stim", "microA_per_cm2", "membrane"}, + {"i_L", "microA_per_cm2", "leakage_current"}, + {"i_K", "microA_per_cm2", "potassium_channel"}, + {"i_Na", "microA_per_cm2", "sodium_channel"}, + {"alpha_m", "per_millisecond", "sodium_channel_m_gate"}, + {"beta_m", "per_millisecond", "sodium_channel_m_gate"}, + {"alpha_h", "per_millisecond", "sodium_channel_h_gate"}, + {"beta_h", "per_millisecond", "sodium_channel_h_gate"}, + {"alpha_n", "per_millisecond", "potassium_channel_n_gate"}, + {"beta_n", "per_millisecond", "potassium_channel_n_gate"} }; const VariableInfo EXTERNAL_INFO[] = { - {"E_L", "millivolt", "leakage_current", EXTERNAL} + {"E_L", "millivolt", "leakage_current"} }; double * createStatesArray() diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.h index 5fb0b0dbc2..87c9d97a56 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.h +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.h @@ -13,20 +13,10 @@ extern const size_t COMPUTED_CONSTANT_COUNT; extern const size_t ALGEBRAIC_COUNT; extern const size_t EXTERNAL_COUNT; -typedef enum { - VARIABLE_OF_INTEGRATION, - STATE, - CONSTANT, - COMPUTED_CONSTANT, - ALGEBRAIC, - EXTERNAL -} VariableType; - typedef struct { char name[8]; char units[16]; char component[25]; - VariableType type; } VariableInfo; extern const VariableInfo VOI_INFO; diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.py index b8319e0fd5..45f4360d8c 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.py @@ -13,52 +13,42 @@ ALGEBRAIC_COUNT = 10 EXTERNAL_COUNT = 1 +VOI_INFO = {"name": "time", "units": "millisecond", "component": "environment"} -class VariableType(Enum): - VARIABLE_OF_INTEGRATION = 0 - STATE = 1 - CONSTANT = 2 - COMPUTED_CONSTANT = 3 - ALGEBRAIC = 4 - EXTERNAL = 5 - - -VOI_INFO = {"name": "time", "units": "millisecond", "component": "environment", "type": VariableType.VARIABLE_OF_INTEGRATION} - -STATE_INFO = {"name": "V", "units": "millivolt", "component": "membrane", "type": VariableType.STATE}, - {"name": "h", "units": "dimensionless", "component": "sodium_channel_h_gate", "type": VariableType.STATE}, - {"name": "m", "units": "dimensionless", "component": "sodium_channel_m_gate", "type": VariableType.STATE}, - {"name": "n", "units": "dimensionless", "component": "potassium_channel_n_gate", "type": VariableType.STATE} +STATE_INFO = {"name": "V", "units": "millivolt", "component": "membrane"}, + {"name": "h", "units": "dimensionless", "component": "sodium_channel_h_gate"}, + {"name": "m", "units": "dimensionless", "component": "sodium_channel_m_gate"}, + {"name": "n", "units": "dimensionless", "component": "potassium_channel_n_gate"} CONSTANT_INFO = [ - {"name": "Cm", "units": "microF_per_cm2", "component": "membrane", "type": VariableType.CONSTANT}, - {"name": "E_R", "units": "millivolt", "component": "membrane", "type": VariableType.CONSTANT}, - {"name": "g_L", "units": "milliS_per_cm2", "component": "leakage_current", "type": VariableType.CONSTANT}, - {"name": "g_Na", "units": "milliS_per_cm2", "component": "sodium_channel", "type": VariableType.CONSTANT}, - {"name": "g_K", "units": "milliS_per_cm2", "component": "potassium_channel", "type": VariableType.CONSTANT} + {"name": "Cm", "units": "microF_per_cm2", "component": "membrane"}, + {"name": "E_R", "units": "millivolt", "component": "membrane"}, + {"name": "g_L", "units": "milliS_per_cm2", "component": "leakage_current"}, + {"name": "g_Na", "units": "milliS_per_cm2", "component": "sodium_channel"}, + {"name": "g_K", "units": "milliS_per_cm2", "component": "potassium_channel"} ] COMPUTED_CONSTANT_INFO = [ - {"name": "E_Na", "units": "millivolt", "component": "sodium_channel", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "E_K", "units": "millivolt", "component": "potassium_channel", "type": VariableType.COMPUTED_CONSTANT} + {"name": "E_Na", "units": "millivolt", "component": "sodium_channel"}, + {"name": "E_K", "units": "millivolt", "component": "potassium_channel"} ] ALGEBRAIC_INFO = [ - {"name": "i_Stim", "units": "microA_per_cm2", "component": "membrane", "type": VariableType.ALGEBRAIC}, - {"name": "i_L", "units": "microA_per_cm2", "component": "leakage_current", "type": VariableType.ALGEBRAIC}, - {"name": "i_K", "units": "microA_per_cm2", "component": "potassium_channel", "type": VariableType.ALGEBRAIC}, - {"name": "i_Na", "units": "microA_per_cm2", "component": "sodium_channel", "type": VariableType.ALGEBRAIC}, - {"name": "alpha_m", "units": "per_millisecond", "component": "sodium_channel_m_gate", "type": VariableType.ALGEBRAIC}, - {"name": "beta_m", "units": "per_millisecond", "component": "sodium_channel_m_gate", "type": VariableType.ALGEBRAIC}, - {"name": "alpha_h", "units": "per_millisecond", "component": "sodium_channel_h_gate", "type": VariableType.ALGEBRAIC}, - {"name": "beta_h", "units": "per_millisecond", "component": "sodium_channel_h_gate", "type": VariableType.ALGEBRAIC}, - {"name": "alpha_n", "units": "per_millisecond", "component": "potassium_channel_n_gate", "type": VariableType.ALGEBRAIC}, - {"name": "beta_n", "units": "per_millisecond", "component": "potassium_channel_n_gate", "type": VariableType.ALGEBRAIC} + {"name": "i_Stim", "units": "microA_per_cm2", "component": "membrane"}, + {"name": "i_L", "units": "microA_per_cm2", "component": "leakage_current"}, + {"name": "i_K", "units": "microA_per_cm2", "component": "potassium_channel"}, + {"name": "i_Na", "units": "microA_per_cm2", "component": "sodium_channel"}, + {"name": "alpha_m", "units": "per_millisecond", "component": "sodium_channel_m_gate"}, + {"name": "beta_m", "units": "per_millisecond", "component": "sodium_channel_m_gate"}, + {"name": "alpha_h", "units": "per_millisecond", "component": "sodium_channel_h_gate"}, + {"name": "beta_h", "units": "per_millisecond", "component": "sodium_channel_h_gate"}, + {"name": "alpha_n", "units": "per_millisecond", "component": "potassium_channel_n_gate"}, + {"name": "beta_n", "units": "per_millisecond", "component": "potassium_channel_n_gate"} ] EXTERNAL_INFO = [ - {"name": "E_L", "units": "millivolt", "component": "leakage_current", "type": VariableType.EXTERNAL} + {"name": "E_L", "units": "millivolt", "component": "leakage_current"} ] diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.c index 5637ee56eb..7de8288be3 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.c @@ -14,43 +14,43 @@ const size_t COMPUTED_CONSTANT_COUNT = 3; const size_t ALGEBRAIC_COUNT = 10; const size_t EXTERNAL_COUNT = 1; -const VariableInfo VOI_INFO = {"time", "millisecond", "environment", VARIABLE_OF_INTEGRATION}; +const VariableInfo VOI_INFO = {"time", "millisecond", "environment"}; const VariableInfo STATE_INFO[] = { - {"V", "millivolt", "membrane", STATE}, - {"h", "dimensionless", "sodium_channel_h_gate", STATE}, - {"m", "dimensionless", "sodium_channel_m_gate", STATE}, - {"n", "dimensionless", "potassium_channel_n_gate", STATE} + {"V", "millivolt", "membrane"}, + {"h", "dimensionless", "sodium_channel_h_gate"}, + {"m", "dimensionless", "sodium_channel_m_gate"}, + {"n", "dimensionless", "potassium_channel_n_gate"} }; const VariableInfo CONSTANT_INFO[] = { - {"E_R", "millivolt", "membrane", CONSTANT}, - {"g_L", "milliS_per_cm2", "leakage_current", CONSTANT}, - {"g_Na", "milliS_per_cm2", "sodium_channel", CONSTANT}, - {"g_K", "milliS_per_cm2", "potassium_channel", CONSTANT} + {"E_R", "millivolt", "membrane"}, + {"g_L", "milliS_per_cm2", "leakage_current"}, + {"g_Na", "milliS_per_cm2", "sodium_channel"}, + {"g_K", "milliS_per_cm2", "potassium_channel"} }; const VariableInfo COMPUTED_CONSTANT_INFO[] = { - {"E_L", "millivolt", "leakage_current", COMPUTED_CONSTANT}, - {"E_Na", "millivolt", "sodium_channel", COMPUTED_CONSTANT}, - {"E_K", "millivolt", "potassium_channel", COMPUTED_CONSTANT} + {"E_L", "millivolt", "leakage_current"}, + {"E_Na", "millivolt", "sodium_channel"}, + {"E_K", "millivolt", "potassium_channel"} }; const VariableInfo ALGEBRAIC_INFO[] = { - {"i_Stim", "microA_per_cm2", "membrane", ALGEBRAIC}, - {"i_L", "microA_per_cm2", "leakage_current", ALGEBRAIC}, - {"i_K", "microA_per_cm2", "potassium_channel", ALGEBRAIC}, - {"i_Na", "microA_per_cm2", "sodium_channel", ALGEBRAIC}, - {"alpha_m", "per_millisecond", "sodium_channel_m_gate", ALGEBRAIC}, - {"beta_m", "per_millisecond", "sodium_channel_m_gate", ALGEBRAIC}, - {"alpha_h", "per_millisecond", "sodium_channel_h_gate", ALGEBRAIC}, - {"beta_h", "per_millisecond", "sodium_channel_h_gate", ALGEBRAIC}, - {"alpha_n", "per_millisecond", "potassium_channel_n_gate", ALGEBRAIC}, - {"beta_n", "per_millisecond", "potassium_channel_n_gate", ALGEBRAIC} + {"i_Stim", "microA_per_cm2", "membrane"}, + {"i_L", "microA_per_cm2", "leakage_current"}, + {"i_K", "microA_per_cm2", "potassium_channel"}, + {"i_Na", "microA_per_cm2", "sodium_channel"}, + {"alpha_m", "per_millisecond", "sodium_channel_m_gate"}, + {"beta_m", "per_millisecond", "sodium_channel_m_gate"}, + {"alpha_h", "per_millisecond", "sodium_channel_h_gate"}, + {"beta_h", "per_millisecond", "sodium_channel_h_gate"}, + {"alpha_n", "per_millisecond", "potassium_channel_n_gate"}, + {"beta_n", "per_millisecond", "potassium_channel_n_gate"} }; const VariableInfo EXTERNAL_INFO[] = { - {"Cm", "microF_per_cm2", "membrane", EXTERNAL} + {"Cm", "microF_per_cm2", "membrane"} }; double * createStatesArray() diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.h index 5fb0b0dbc2..87c9d97a56 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.h +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.h @@ -13,20 +13,10 @@ extern const size_t COMPUTED_CONSTANT_COUNT; extern const size_t ALGEBRAIC_COUNT; extern const size_t EXTERNAL_COUNT; -typedef enum { - VARIABLE_OF_INTEGRATION, - STATE, - CONSTANT, - COMPUTED_CONSTANT, - ALGEBRAIC, - EXTERNAL -} VariableType; - typedef struct { char name[8]; char units[16]; char component[25]; - VariableType type; } VariableInfo; extern const VariableInfo VOI_INFO; diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.py index bb2ac5e624..96c8a1f6e5 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.py @@ -13,52 +13,42 @@ ALGEBRAIC_COUNT = 10 EXTERNAL_COUNT = 1 +VOI_INFO = {"name": "time", "units": "millisecond", "component": "environment"} -class VariableType(Enum): - VARIABLE_OF_INTEGRATION = 0 - STATE = 1 - CONSTANT = 2 - COMPUTED_CONSTANT = 3 - ALGEBRAIC = 4 - EXTERNAL = 5 - - -VOI_INFO = {"name": "time", "units": "millisecond", "component": "environment", "type": VariableType.VARIABLE_OF_INTEGRATION} - -STATE_INFO = {"name": "V", "units": "millivolt", "component": "membrane", "type": VariableType.STATE}, - {"name": "h", "units": "dimensionless", "component": "sodium_channel_h_gate", "type": VariableType.STATE}, - {"name": "m", "units": "dimensionless", "component": "sodium_channel_m_gate", "type": VariableType.STATE}, - {"name": "n", "units": "dimensionless", "component": "potassium_channel_n_gate", "type": VariableType.STATE} +STATE_INFO = {"name": "V", "units": "millivolt", "component": "membrane"}, + {"name": "h", "units": "dimensionless", "component": "sodium_channel_h_gate"}, + {"name": "m", "units": "dimensionless", "component": "sodium_channel_m_gate"}, + {"name": "n", "units": "dimensionless", "component": "potassium_channel_n_gate"} CONSTANT_INFO = [ - {"name": "E_R", "units": "millivolt", "component": "membrane", "type": VariableType.CONSTANT}, - {"name": "g_L", "units": "milliS_per_cm2", "component": "leakage_current", "type": VariableType.CONSTANT}, - {"name": "g_Na", "units": "milliS_per_cm2", "component": "sodium_channel", "type": VariableType.CONSTANT}, - {"name": "g_K", "units": "milliS_per_cm2", "component": "potassium_channel", "type": VariableType.CONSTANT} + {"name": "E_R", "units": "millivolt", "component": "membrane"}, + {"name": "g_L", "units": "milliS_per_cm2", "component": "leakage_current"}, + {"name": "g_Na", "units": "milliS_per_cm2", "component": "sodium_channel"}, + {"name": "g_K", "units": "milliS_per_cm2", "component": "potassium_channel"} ] COMPUTED_CONSTANT_INFO = [ - {"name": "E_L", "units": "millivolt", "component": "leakage_current", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "E_Na", "units": "millivolt", "component": "sodium_channel", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "E_K", "units": "millivolt", "component": "potassium_channel", "type": VariableType.COMPUTED_CONSTANT} + {"name": "E_L", "units": "millivolt", "component": "leakage_current"}, + {"name": "E_Na", "units": "millivolt", "component": "sodium_channel"}, + {"name": "E_K", "units": "millivolt", "component": "potassium_channel"} ] ALGEBRAIC_INFO = [ - {"name": "i_Stim", "units": "microA_per_cm2", "component": "membrane", "type": VariableType.ALGEBRAIC}, - {"name": "i_L", "units": "microA_per_cm2", "component": "leakage_current", "type": VariableType.ALGEBRAIC}, - {"name": "i_K", "units": "microA_per_cm2", "component": "potassium_channel", "type": VariableType.ALGEBRAIC}, - {"name": "i_Na", "units": "microA_per_cm2", "component": "sodium_channel", "type": VariableType.ALGEBRAIC}, - {"name": "alpha_m", "units": "per_millisecond", "component": "sodium_channel_m_gate", "type": VariableType.ALGEBRAIC}, - {"name": "beta_m", "units": "per_millisecond", "component": "sodium_channel_m_gate", "type": VariableType.ALGEBRAIC}, - {"name": "alpha_h", "units": "per_millisecond", "component": "sodium_channel_h_gate", "type": VariableType.ALGEBRAIC}, - {"name": "beta_h", "units": "per_millisecond", "component": "sodium_channel_h_gate", "type": VariableType.ALGEBRAIC}, - {"name": "alpha_n", "units": "per_millisecond", "component": "potassium_channel_n_gate", "type": VariableType.ALGEBRAIC}, - {"name": "beta_n", "units": "per_millisecond", "component": "potassium_channel_n_gate", "type": VariableType.ALGEBRAIC} + {"name": "i_Stim", "units": "microA_per_cm2", "component": "membrane"}, + {"name": "i_L", "units": "microA_per_cm2", "component": "leakage_current"}, + {"name": "i_K", "units": "microA_per_cm2", "component": "potassium_channel"}, + {"name": "i_Na", "units": "microA_per_cm2", "component": "sodium_channel"}, + {"name": "alpha_m", "units": "per_millisecond", "component": "sodium_channel_m_gate"}, + {"name": "beta_m", "units": "per_millisecond", "component": "sodium_channel_m_gate"}, + {"name": "alpha_h", "units": "per_millisecond", "component": "sodium_channel_h_gate"}, + {"name": "beta_h", "units": "per_millisecond", "component": "sodium_channel_h_gate"}, + {"name": "alpha_n", "units": "per_millisecond", "component": "potassium_channel_n_gate"}, + {"name": "beta_n", "units": "per_millisecond", "component": "potassium_channel_n_gate"} ] EXTERNAL_INFO = [ - {"name": "Cm", "units": "microF_per_cm2", "component": "membrane", "type": VariableType.EXTERNAL} + {"name": "Cm", "units": "microF_per_cm2", "component": "membrane"} ] diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.c index 4fd81f7a08..d15936a8ac 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.c @@ -13,40 +13,40 @@ const size_t CONSTANT_COUNT = 5; const size_t COMPUTED_CONSTANT_COUNT = 3; const size_t ALGEBRAIC_COUNT = 10; -const VariableInfo VOI_INFO = {"time", "millisecond", "environment", VARIABLE_OF_INTEGRATION}; +const VariableInfo VOI_INFO = {"time", "millisecond", "environment"}; const VariableInfo STATE_INFO[] = { - {"V", "millivolt", "membrane", STATE}, - {"h", "dimensionless", "sodium_channel_h_gate", STATE}, - {"m", "dimensionless", "sodium_channel_m_gate", STATE}, - {"n", "dimensionless", "potassium_channel_n_gate", STATE} + {"V", "millivolt", "membrane"}, + {"h", "dimensionless", "sodium_channel_h_gate"}, + {"m", "dimensionless", "sodium_channel_m_gate"}, + {"n", "dimensionless", "potassium_channel_n_gate"} }; const VariableInfo CONSTANT_INFO[] = { - {"Cm", "microF_per_cm2", "membrane", CONSTANT}, - {"E_R", "millivolt", "membrane", CONSTANT}, - {"g_L", "milliS_per_cm2", "leakage_current", CONSTANT}, - {"g_Na", "milliS_per_cm2", "sodium_channel", CONSTANT}, - {"g_K", "milliS_per_cm2", "potassium_channel", CONSTANT} + {"Cm", "microF_per_cm2", "membrane"}, + {"E_R", "millivolt", "membrane"}, + {"g_L", "milliS_per_cm2", "leakage_current"}, + {"g_Na", "milliS_per_cm2", "sodium_channel"}, + {"g_K", "milliS_per_cm2", "potassium_channel"} }; const VariableInfo COMPUTED_CONSTANT_INFO[] = { - {"E_L", "millivolt", "leakage_current", COMPUTED_CONSTANT}, - {"E_Na", "millivolt", "sodium_channel", COMPUTED_CONSTANT}, - {"E_K", "millivolt", "potassium_channel", COMPUTED_CONSTANT} + {"E_L", "millivolt", "leakage_current"}, + {"E_Na", "millivolt", "sodium_channel"}, + {"E_K", "millivolt", "potassium_channel"} }; const VariableInfo ALGEBRAIC_INFO[] = { - {"i_Stim", "microA_per_cm2", "membrane", ALGEBRAIC}, - {"i_L", "microA_per_cm2", "leakage_current", ALGEBRAIC}, - {"i_K", "microA_per_cm2", "potassium_channel", ALGEBRAIC}, - {"i_Na", "microA_per_cm2", "sodium_channel", ALGEBRAIC}, - {"alpha_m", "per_millisecond", "sodium_channel_m_gate", ALGEBRAIC}, - {"beta_m", "per_millisecond", "sodium_channel_m_gate", ALGEBRAIC}, - {"alpha_h", "per_millisecond", "sodium_channel_h_gate", ALGEBRAIC}, - {"beta_h", "per_millisecond", "sodium_channel_h_gate", ALGEBRAIC}, - {"alpha_n", "per_millisecond", "potassium_channel_n_gate", ALGEBRAIC}, - {"beta_n", "per_millisecond", "potassium_channel_n_gate", ALGEBRAIC} + {"i_Stim", "microA_per_cm2", "membrane"}, + {"i_L", "microA_per_cm2", "leakage_current"}, + {"i_K", "microA_per_cm2", "potassium_channel"}, + {"i_Na", "microA_per_cm2", "sodium_channel"}, + {"alpha_m", "per_millisecond", "sodium_channel_m_gate"}, + {"beta_m", "per_millisecond", "sodium_channel_m_gate"}, + {"alpha_h", "per_millisecond", "sodium_channel_h_gate"}, + {"beta_h", "per_millisecond", "sodium_channel_h_gate"}, + {"alpha_n", "per_millisecond", "potassium_channel_n_gate"}, + {"beta_n", "per_millisecond", "potassium_channel_n_gate"} }; double * createStatesArray() diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.h index 7a76b71aff..d64d07bb62 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.h +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.h @@ -12,19 +12,10 @@ extern const size_t CONSTANT_COUNT; extern const size_t COMPUTED_CONSTANT_COUNT; extern const size_t ALGEBRAIC_COUNT; -typedef enum { - VARIABLE_OF_INTEGRATION, - STATE, - CONSTANT, - COMPUTED_CONSTANT, - ALGEBRAIC -} VariableType; - typedef struct { char name[8]; char units[16]; char component[25]; - VariableType type; } VariableInfo; extern const VariableInfo VOI_INFO; diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.py index a58ab94164..9293f1936a 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.py @@ -12,48 +12,39 @@ COMPUTED_CONSTANT_COUNT = 3 ALGEBRAIC_COUNT = 10 +VOI_INFO = {"name": "time", "units": "millisecond", "component": "environment"} -class VariableType(Enum): - VARIABLE_OF_INTEGRATION = 0 - STATE = 1 - CONSTANT = 2 - COMPUTED_CONSTANT = 3 - ALGEBRAIC = 4 - - -VOI_INFO = {"name": "time", "units": "millisecond", "component": "environment", "type": VariableType.VARIABLE_OF_INTEGRATION} - -STATE_INFO = {"name": "V", "units": "millivolt", "component": "membrane", "type": VariableType.STATE}, - {"name": "h", "units": "dimensionless", "component": "sodium_channel_h_gate", "type": VariableType.STATE}, - {"name": "m", "units": "dimensionless", "component": "sodium_channel_m_gate", "type": VariableType.STATE}, - {"name": "n", "units": "dimensionless", "component": "potassium_channel_n_gate", "type": VariableType.STATE} +STATE_INFO = {"name": "V", "units": "millivolt", "component": "membrane"}, + {"name": "h", "units": "dimensionless", "component": "sodium_channel_h_gate"}, + {"name": "m", "units": "dimensionless", "component": "sodium_channel_m_gate"}, + {"name": "n", "units": "dimensionless", "component": "potassium_channel_n_gate"} CONSTANT_INFO = [ - {"name": "Cm", "units": "microF_per_cm2", "component": "membrane", "type": VariableType.CONSTANT}, - {"name": "E_R", "units": "millivolt", "component": "membrane", "type": VariableType.CONSTANT}, - {"name": "g_L", "units": "milliS_per_cm2", "component": "leakage_current", "type": VariableType.CONSTANT}, - {"name": "g_Na", "units": "milliS_per_cm2", "component": "sodium_channel", "type": VariableType.CONSTANT}, - {"name": "g_K", "units": "milliS_per_cm2", "component": "potassium_channel", "type": VariableType.CONSTANT} + {"name": "Cm", "units": "microF_per_cm2", "component": "membrane"}, + {"name": "E_R", "units": "millivolt", "component": "membrane"}, + {"name": "g_L", "units": "milliS_per_cm2", "component": "leakage_current"}, + {"name": "g_Na", "units": "milliS_per_cm2", "component": "sodium_channel"}, + {"name": "g_K", "units": "milliS_per_cm2", "component": "potassium_channel"} ] COMPUTED_CONSTANT_INFO = [ - {"name": "E_L", "units": "millivolt", "component": "leakage_current", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "E_Na", "units": "millivolt", "component": "sodium_channel", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "E_K", "units": "millivolt", "component": "potassium_channel", "type": VariableType.COMPUTED_CONSTANT} + {"name": "E_L", "units": "millivolt", "component": "leakage_current"}, + {"name": "E_Na", "units": "millivolt", "component": "sodium_channel"}, + {"name": "E_K", "units": "millivolt", "component": "potassium_channel"} ] ALGEBRAIC_INFO = [ - {"name": "i_Stim", "units": "microA_per_cm2", "component": "membrane", "type": VariableType.ALGEBRAIC}, - {"name": "i_L", "units": "microA_per_cm2", "component": "leakage_current", "type": VariableType.ALGEBRAIC}, - {"name": "i_K", "units": "microA_per_cm2", "component": "potassium_channel", "type": VariableType.ALGEBRAIC}, - {"name": "i_Na", "units": "microA_per_cm2", "component": "sodium_channel", "type": VariableType.ALGEBRAIC}, - {"name": "alpha_m", "units": "per_millisecond", "component": "sodium_channel_m_gate", "type": VariableType.ALGEBRAIC}, - {"name": "beta_m", "units": "per_millisecond", "component": "sodium_channel_m_gate", "type": VariableType.ALGEBRAIC}, - {"name": "alpha_h", "units": "per_millisecond", "component": "sodium_channel_h_gate", "type": VariableType.ALGEBRAIC}, - {"name": "beta_h", "units": "per_millisecond", "component": "sodium_channel_h_gate", "type": VariableType.ALGEBRAIC}, - {"name": "alpha_n", "units": "per_millisecond", "component": "potassium_channel_n_gate", "type": VariableType.ALGEBRAIC}, - {"name": "beta_n", "units": "per_millisecond", "component": "potassium_channel_n_gate", "type": VariableType.ALGEBRAIC} + {"name": "i_Stim", "units": "microA_per_cm2", "component": "membrane"}, + {"name": "i_L", "units": "microA_per_cm2", "component": "leakage_current"}, + {"name": "i_K", "units": "microA_per_cm2", "component": "potassium_channel"}, + {"name": "i_Na", "units": "microA_per_cm2", "component": "sodium_channel"}, + {"name": "alpha_m", "units": "per_millisecond", "component": "sodium_channel_m_gate"}, + {"name": "beta_m", "units": "per_millisecond", "component": "sodium_channel_m_gate"}, + {"name": "alpha_h", "units": "per_millisecond", "component": "sodium_channel_h_gate"}, + {"name": "beta_h", "units": "per_millisecond", "component": "sodium_channel_h_gate"}, + {"name": "alpha_n", "units": "per_millisecond", "component": "potassium_channel_n_gate"}, + {"name": "beta_n", "units": "per_millisecond", "component": "potassium_channel_n_gate"} ] diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.c index b51c60bfdf..070a92f7be 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.c @@ -14,43 +14,43 @@ const size_t COMPUTED_CONSTANT_COUNT = 3; const size_t ALGEBRAIC_COUNT = 8; const size_t EXTERNAL_COUNT = 2; -const VariableInfo VOI_INFO = {"time", "millisecond", "environment", VARIABLE_OF_INTEGRATION}; +const VariableInfo VOI_INFO = {"time", "millisecond", "environment"}; const VariableInfo STATE_INFO[] = { - {"V", "millivolt", "membrane", STATE}, - {"h", "dimensionless", "sodium_channel_h_gate", STATE}, - {"m", "dimensionless", "sodium_channel_m_gate", STATE}, - {"n", "dimensionless", "potassium_channel_n_gate", STATE} + {"V", "millivolt", "membrane"}, + {"h", "dimensionless", "sodium_channel_h_gate"}, + {"m", "dimensionless", "sodium_channel_m_gate"}, + {"n", "dimensionless", "potassium_channel_n_gate"} }; const VariableInfo CONSTANT_INFO[] = { - {"Cm", "microF_per_cm2", "membrane", CONSTANT}, - {"E_R", "millivolt", "membrane", CONSTANT}, - {"g_L", "milliS_per_cm2", "leakage_current", CONSTANT}, - {"g_Na", "milliS_per_cm2", "sodium_channel", CONSTANT}, - {"g_K", "milliS_per_cm2", "potassium_channel", CONSTANT} + {"Cm", "microF_per_cm2", "membrane"}, + {"E_R", "millivolt", "membrane"}, + {"g_L", "milliS_per_cm2", "leakage_current"}, + {"g_Na", "milliS_per_cm2", "sodium_channel"}, + {"g_K", "milliS_per_cm2", "potassium_channel"} }; const VariableInfo COMPUTED_CONSTANT_INFO[] = { - {"E_L", "millivolt", "leakage_current", COMPUTED_CONSTANT}, - {"E_Na", "millivolt", "sodium_channel", COMPUTED_CONSTANT}, - {"E_K", "millivolt", "potassium_channel", COMPUTED_CONSTANT} + {"E_L", "millivolt", "leakage_current"}, + {"E_Na", "millivolt", "sodium_channel"}, + {"E_K", "millivolt", "potassium_channel"} }; const VariableInfo ALGEBRAIC_INFO[] = { - {"i_L", "microA_per_cm2", "leakage_current", ALGEBRAIC}, - {"i_K", "microA_per_cm2", "potassium_channel", ALGEBRAIC}, - {"i_Na", "microA_per_cm2", "sodium_channel", ALGEBRAIC}, - {"alpha_m", "per_millisecond", "sodium_channel_m_gate", ALGEBRAIC}, - {"beta_m", "per_millisecond", "sodium_channel_m_gate", ALGEBRAIC}, - {"alpha_h", "per_millisecond", "sodium_channel_h_gate", ALGEBRAIC}, - {"beta_h", "per_millisecond", "sodium_channel_h_gate", ALGEBRAIC}, - {"alpha_n", "per_millisecond", "potassium_channel_n_gate", ALGEBRAIC} + {"i_L", "microA_per_cm2", "leakage_current"}, + {"i_K", "microA_per_cm2", "potassium_channel"}, + {"i_Na", "microA_per_cm2", "sodium_channel"}, + {"alpha_m", "per_millisecond", "sodium_channel_m_gate"}, + {"beta_m", "per_millisecond", "sodium_channel_m_gate"}, + {"alpha_h", "per_millisecond", "sodium_channel_h_gate"}, + {"beta_h", "per_millisecond", "sodium_channel_h_gate"}, + {"alpha_n", "per_millisecond", "potassium_channel_n_gate"} }; const VariableInfo EXTERNAL_INFO[] = { - {"i_Stim", "microA_per_cm2", "membrane", EXTERNAL}, - {"beta_n", "per_millisecond", "potassium_channel_n_gate", EXTERNAL} + {"i_Stim", "microA_per_cm2", "membrane"}, + {"beta_n", "per_millisecond", "potassium_channel_n_gate"} }; double * createStatesArray() diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.h index 5fb0b0dbc2..87c9d97a56 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.h +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.h @@ -13,20 +13,10 @@ extern const size_t COMPUTED_CONSTANT_COUNT; extern const size_t ALGEBRAIC_COUNT; extern const size_t EXTERNAL_COUNT; -typedef enum { - VARIABLE_OF_INTEGRATION, - STATE, - CONSTANT, - COMPUTED_CONSTANT, - ALGEBRAIC, - EXTERNAL -} VariableType; - typedef struct { char name[8]; char units[16]; char component[25]; - VariableType type; } VariableInfo; extern const VariableInfo VOI_INFO; diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.py index 715e2a036a..a03e31643a 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.py @@ -13,52 +13,42 @@ ALGEBRAIC_COUNT = 8 EXTERNAL_COUNT = 2 +VOI_INFO = {"name": "time", "units": "millisecond", "component": "environment"} -class VariableType(Enum): - VARIABLE_OF_INTEGRATION = 0 - STATE = 1 - CONSTANT = 2 - COMPUTED_CONSTANT = 3 - ALGEBRAIC = 4 - EXTERNAL = 5 - - -VOI_INFO = {"name": "time", "units": "millisecond", "component": "environment", "type": VariableType.VARIABLE_OF_INTEGRATION} - -STATE_INFO = {"name": "V", "units": "millivolt", "component": "membrane", "type": VariableType.STATE}, - {"name": "h", "units": "dimensionless", "component": "sodium_channel_h_gate", "type": VariableType.STATE}, - {"name": "m", "units": "dimensionless", "component": "sodium_channel_m_gate", "type": VariableType.STATE}, - {"name": "n", "units": "dimensionless", "component": "potassium_channel_n_gate", "type": VariableType.STATE} +STATE_INFO = {"name": "V", "units": "millivolt", "component": "membrane"}, + {"name": "h", "units": "dimensionless", "component": "sodium_channel_h_gate"}, + {"name": "m", "units": "dimensionless", "component": "sodium_channel_m_gate"}, + {"name": "n", "units": "dimensionless", "component": "potassium_channel_n_gate"} CONSTANT_INFO = [ - {"name": "Cm", "units": "microF_per_cm2", "component": "membrane", "type": VariableType.CONSTANT}, - {"name": "E_R", "units": "millivolt", "component": "membrane", "type": VariableType.CONSTANT}, - {"name": "g_L", "units": "milliS_per_cm2", "component": "leakage_current", "type": VariableType.CONSTANT}, - {"name": "g_Na", "units": "milliS_per_cm2", "component": "sodium_channel", "type": VariableType.CONSTANT}, - {"name": "g_K", "units": "milliS_per_cm2", "component": "potassium_channel", "type": VariableType.CONSTANT} + {"name": "Cm", "units": "microF_per_cm2", "component": "membrane"}, + {"name": "E_R", "units": "millivolt", "component": "membrane"}, + {"name": "g_L", "units": "milliS_per_cm2", "component": "leakage_current"}, + {"name": "g_Na", "units": "milliS_per_cm2", "component": "sodium_channel"}, + {"name": "g_K", "units": "milliS_per_cm2", "component": "potassium_channel"} ] COMPUTED_CONSTANT_INFO = [ - {"name": "E_L", "units": "millivolt", "component": "leakage_current", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "E_Na", "units": "millivolt", "component": "sodium_channel", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "E_K", "units": "millivolt", "component": "potassium_channel", "type": VariableType.COMPUTED_CONSTANT} + {"name": "E_L", "units": "millivolt", "component": "leakage_current"}, + {"name": "E_Na", "units": "millivolt", "component": "sodium_channel"}, + {"name": "E_K", "units": "millivolt", "component": "potassium_channel"} ] ALGEBRAIC_INFO = [ - {"name": "i_L", "units": "microA_per_cm2", "component": "leakage_current", "type": VariableType.ALGEBRAIC}, - {"name": "i_K", "units": "microA_per_cm2", "component": "potassium_channel", "type": VariableType.ALGEBRAIC}, - {"name": "i_Na", "units": "microA_per_cm2", "component": "sodium_channel", "type": VariableType.ALGEBRAIC}, - {"name": "alpha_m", "units": "per_millisecond", "component": "sodium_channel_m_gate", "type": VariableType.ALGEBRAIC}, - {"name": "beta_m", "units": "per_millisecond", "component": "sodium_channel_m_gate", "type": VariableType.ALGEBRAIC}, - {"name": "alpha_h", "units": "per_millisecond", "component": "sodium_channel_h_gate", "type": VariableType.ALGEBRAIC}, - {"name": "beta_h", "units": "per_millisecond", "component": "sodium_channel_h_gate", "type": VariableType.ALGEBRAIC}, - {"name": "alpha_n", "units": "per_millisecond", "component": "potassium_channel_n_gate", "type": VariableType.ALGEBRAIC} + {"name": "i_L", "units": "microA_per_cm2", "component": "leakage_current"}, + {"name": "i_K", "units": "microA_per_cm2", "component": "potassium_channel"}, + {"name": "i_Na", "units": "microA_per_cm2", "component": "sodium_channel"}, + {"name": "alpha_m", "units": "per_millisecond", "component": "sodium_channel_m_gate"}, + {"name": "beta_m", "units": "per_millisecond", "component": "sodium_channel_m_gate"}, + {"name": "alpha_h", "units": "per_millisecond", "component": "sodium_channel_h_gate"}, + {"name": "beta_h", "units": "per_millisecond", "component": "sodium_channel_h_gate"}, + {"name": "alpha_n", "units": "per_millisecond", "component": "potassium_channel_n_gate"} ] EXTERNAL_INFO = [ - {"name": "i_Stim", "units": "microA_per_cm2", "component": "membrane", "type": VariableType.EXTERNAL}, - {"name": "beta_n", "units": "per_millisecond", "component": "potassium_channel_n_gate", "type": VariableType.EXTERNAL} + {"name": "i_Stim", "units": "microA_per_cm2", "component": "membrane"}, + {"name": "beta_n", "units": "per_millisecond", "component": "potassium_channel_n_gate"} ] diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.c index c27fbd144f..d34a01efc1 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.c @@ -14,43 +14,43 @@ const size_t COMPUTED_CONSTANT_COUNT = 0; const size_t ALGEBRAIC_COUNT = 12; const size_t EXTERNAL_COUNT = 2; -const VariableInfo VOI_INFO = {"time", "millisecond", "environment", VARIABLE_OF_INTEGRATION}; +const VariableInfo VOI_INFO = {"time", "millisecond", "environment"}; const VariableInfo STATE_INFO[] = { - {"V", "millivolt", "membrane", STATE}, - {"h", "dimensionless", "sodium_channel_h_gate", STATE}, - {"m", "dimensionless", "sodium_channel_m_gate", STATE}, - {"n", "dimensionless", "potassium_channel_n_gate", STATE} + {"V", "millivolt", "membrane"}, + {"h", "dimensionless", "sodium_channel_h_gate"}, + {"m", "dimensionless", "sodium_channel_m_gate"}, + {"n", "dimensionless", "potassium_channel_n_gate"} }; const VariableInfo CONSTANT_INFO[] = { - {"Cm", "microF_per_cm2", "membrane", CONSTANT}, - {"g_L", "milliS_per_cm2", "leakage_current", CONSTANT}, - {"g_Na", "milliS_per_cm2", "sodium_channel", CONSTANT}, - {"g_K", "milliS_per_cm2", "potassium_channel", CONSTANT} + {"Cm", "microF_per_cm2", "membrane"}, + {"g_L", "milliS_per_cm2", "leakage_current"}, + {"g_Na", "milliS_per_cm2", "sodium_channel"}, + {"g_K", "milliS_per_cm2", "potassium_channel"} }; const VariableInfo COMPUTED_CONSTANT_INFO[] = { }; const VariableInfo ALGEBRAIC_INFO[] = { - {"i_Stim", "microA_per_cm2", "membrane", ALGEBRAIC}, - {"i_L", "microA_per_cm2", "leakage_current", ALGEBRAIC}, - {"i_K", "microA_per_cm2", "potassium_channel", ALGEBRAIC}, - {"i_Na", "microA_per_cm2", "sodium_channel", ALGEBRAIC}, - {"E_L", "millivolt", "leakage_current", ALGEBRAIC}, - {"E_Na", "millivolt", "sodium_channel", ALGEBRAIC}, - {"alpha_m", "per_millisecond", "sodium_channel_m_gate", ALGEBRAIC}, - {"beta_m", "per_millisecond", "sodium_channel_m_gate", ALGEBRAIC}, - {"alpha_h", "per_millisecond", "sodium_channel_h_gate", ALGEBRAIC}, - {"beta_h", "per_millisecond", "sodium_channel_h_gate", ALGEBRAIC}, - {"alpha_n", "per_millisecond", "potassium_channel_n_gate", ALGEBRAIC}, - {"beta_n", "per_millisecond", "potassium_channel_n_gate", ALGEBRAIC} + {"i_Stim", "microA_per_cm2", "membrane"}, + {"i_L", "microA_per_cm2", "leakage_current"}, + {"i_K", "microA_per_cm2", "potassium_channel"}, + {"i_Na", "microA_per_cm2", "sodium_channel"}, + {"E_L", "millivolt", "leakage_current"}, + {"E_Na", "millivolt", "sodium_channel"}, + {"alpha_m", "per_millisecond", "sodium_channel_m_gate"}, + {"beta_m", "per_millisecond", "sodium_channel_m_gate"}, + {"alpha_h", "per_millisecond", "sodium_channel_h_gate"}, + {"beta_h", "per_millisecond", "sodium_channel_h_gate"}, + {"alpha_n", "per_millisecond", "potassium_channel_n_gate"}, + {"beta_n", "per_millisecond", "potassium_channel_n_gate"} }; const VariableInfo EXTERNAL_INFO[] = { - {"E_R", "millivolt", "membrane", EXTERNAL}, - {"E_K", "millivolt", "potassium_channel", EXTERNAL} + {"E_R", "millivolt", "membrane"}, + {"E_K", "millivolt", "potassium_channel"} }; double * createStatesArray() diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.h index 5fb0b0dbc2..87c9d97a56 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.h +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.h @@ -13,20 +13,10 @@ extern const size_t COMPUTED_CONSTANT_COUNT; extern const size_t ALGEBRAIC_COUNT; extern const size_t EXTERNAL_COUNT; -typedef enum { - VARIABLE_OF_INTEGRATION, - STATE, - CONSTANT, - COMPUTED_CONSTANT, - ALGEBRAIC, - EXTERNAL -} VariableType; - typedef struct { char name[8]; char units[16]; char component[25]; - VariableType type; } VariableInfo; extern const VariableInfo VOI_INFO; diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.py index 4bd3875267..e655d50b53 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.py @@ -13,52 +13,42 @@ ALGEBRAIC_COUNT = 12 EXTERNAL_COUNT = 2 +VOI_INFO = {"name": "time", "units": "millisecond", "component": "environment"} -class VariableType(Enum): - VARIABLE_OF_INTEGRATION = 0 - STATE = 1 - CONSTANT = 2 - COMPUTED_CONSTANT = 3 - ALGEBRAIC = 4 - EXTERNAL = 5 - - -VOI_INFO = {"name": "time", "units": "millisecond", "component": "environment", "type": VariableType.VARIABLE_OF_INTEGRATION} - -STATE_INFO = {"name": "V", "units": "millivolt", "component": "membrane", "type": VariableType.STATE}, - {"name": "h", "units": "dimensionless", "component": "sodium_channel_h_gate", "type": VariableType.STATE}, - {"name": "m", "units": "dimensionless", "component": "sodium_channel_m_gate", "type": VariableType.STATE}, - {"name": "n", "units": "dimensionless", "component": "potassium_channel_n_gate", "type": VariableType.STATE} +STATE_INFO = {"name": "V", "units": "millivolt", "component": "membrane"}, + {"name": "h", "units": "dimensionless", "component": "sodium_channel_h_gate"}, + {"name": "m", "units": "dimensionless", "component": "sodium_channel_m_gate"}, + {"name": "n", "units": "dimensionless", "component": "potassium_channel_n_gate"} CONSTANT_INFO = [ - {"name": "Cm", "units": "microF_per_cm2", "component": "membrane", "type": VariableType.CONSTANT}, - {"name": "g_L", "units": "milliS_per_cm2", "component": "leakage_current", "type": VariableType.CONSTANT}, - {"name": "g_Na", "units": "milliS_per_cm2", "component": "sodium_channel", "type": VariableType.CONSTANT}, - {"name": "g_K", "units": "milliS_per_cm2", "component": "potassium_channel", "type": VariableType.CONSTANT} + {"name": "Cm", "units": "microF_per_cm2", "component": "membrane"}, + {"name": "g_L", "units": "milliS_per_cm2", "component": "leakage_current"}, + {"name": "g_Na", "units": "milliS_per_cm2", "component": "sodium_channel"}, + {"name": "g_K", "units": "milliS_per_cm2", "component": "potassium_channel"} ] COMPUTED_CONSTANT_INFO = [ ] ALGEBRAIC_INFO = [ - {"name": "i_Stim", "units": "microA_per_cm2", "component": "membrane", "type": VariableType.ALGEBRAIC}, - {"name": "i_L", "units": "microA_per_cm2", "component": "leakage_current", "type": VariableType.ALGEBRAIC}, - {"name": "i_K", "units": "microA_per_cm2", "component": "potassium_channel", "type": VariableType.ALGEBRAIC}, - {"name": "i_Na", "units": "microA_per_cm2", "component": "sodium_channel", "type": VariableType.ALGEBRAIC}, - {"name": "E_L", "units": "millivolt", "component": "leakage_current", "type": VariableType.ALGEBRAIC}, - {"name": "E_Na", "units": "millivolt", "component": "sodium_channel", "type": VariableType.ALGEBRAIC}, - {"name": "alpha_m", "units": "per_millisecond", "component": "sodium_channel_m_gate", "type": VariableType.ALGEBRAIC}, - {"name": "beta_m", "units": "per_millisecond", "component": "sodium_channel_m_gate", "type": VariableType.ALGEBRAIC}, - {"name": "alpha_h", "units": "per_millisecond", "component": "sodium_channel_h_gate", "type": VariableType.ALGEBRAIC}, - {"name": "beta_h", "units": "per_millisecond", "component": "sodium_channel_h_gate", "type": VariableType.ALGEBRAIC}, - {"name": "alpha_n", "units": "per_millisecond", "component": "potassium_channel_n_gate", "type": VariableType.ALGEBRAIC}, - {"name": "beta_n", "units": "per_millisecond", "component": "potassium_channel_n_gate", "type": VariableType.ALGEBRAIC} + {"name": "i_Stim", "units": "microA_per_cm2", "component": "membrane"}, + {"name": "i_L", "units": "microA_per_cm2", "component": "leakage_current"}, + {"name": "i_K", "units": "microA_per_cm2", "component": "potassium_channel"}, + {"name": "i_Na", "units": "microA_per_cm2", "component": "sodium_channel"}, + {"name": "E_L", "units": "millivolt", "component": "leakage_current"}, + {"name": "E_Na", "units": "millivolt", "component": "sodium_channel"}, + {"name": "alpha_m", "units": "per_millisecond", "component": "sodium_channel_m_gate"}, + {"name": "beta_m", "units": "per_millisecond", "component": "sodium_channel_m_gate"}, + {"name": "alpha_h", "units": "per_millisecond", "component": "sodium_channel_h_gate"}, + {"name": "beta_h", "units": "per_millisecond", "component": "sodium_channel_h_gate"}, + {"name": "alpha_n", "units": "per_millisecond", "component": "potassium_channel_n_gate"}, + {"name": "beta_n", "units": "per_millisecond", "component": "potassium_channel_n_gate"} ] EXTERNAL_INFO = [ - {"name": "E_R", "units": "millivolt", "component": "membrane", "type": VariableType.EXTERNAL}, - {"name": "E_K", "units": "millivolt", "component": "potassium_channel", "type": VariableType.EXTERNAL} + {"name": "E_R", "units": "millivolt", "component": "membrane"}, + {"name": "E_K", "units": "millivolt", "component": "potassium_channel"} ] diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.c index 125ae87227..c93e668a04 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.c @@ -14,43 +14,43 @@ const size_t COMPUTED_CONSTANT_COUNT = 3; const size_t ALGEBRAIC_COUNT = 10; const size_t EXTERNAL_COUNT = 2; -const VariableInfo VOI_INFO = {"time", "millisecond", "environment", VARIABLE_OF_INTEGRATION}; +const VariableInfo VOI_INFO = {"time", "millisecond", "environment"}; const VariableInfo STATE_INFO[] = { - {"V", "millivolt", "membrane", STATE}, - {"h", "dimensionless", "sodium_channel_h_gate", STATE}, - {"m", "dimensionless", "sodium_channel_m_gate", STATE}, - {"n", "dimensionless", "potassium_channel_n_gate", STATE} + {"V", "millivolt", "membrane"}, + {"h", "dimensionless", "sodium_channel_h_gate"}, + {"m", "dimensionless", "sodium_channel_m_gate"}, + {"n", "dimensionless", "potassium_channel_n_gate"} }; const VariableInfo CONSTANT_INFO[] = { - {"E_R", "millivolt", "membrane", CONSTANT}, - {"g_L", "milliS_per_cm2", "leakage_current", CONSTANT}, - {"g_K", "milliS_per_cm2", "potassium_channel", CONSTANT} + {"E_R", "millivolt", "membrane"}, + {"g_L", "milliS_per_cm2", "leakage_current"}, + {"g_K", "milliS_per_cm2", "potassium_channel"} }; const VariableInfo COMPUTED_CONSTANT_INFO[] = { - {"E_L", "millivolt", "leakage_current", COMPUTED_CONSTANT}, - {"E_Na", "millivolt", "sodium_channel", COMPUTED_CONSTANT}, - {"E_K", "millivolt", "potassium_channel", COMPUTED_CONSTANT} + {"E_L", "millivolt", "leakage_current"}, + {"E_Na", "millivolt", "sodium_channel"}, + {"E_K", "millivolt", "potassium_channel"} }; const VariableInfo ALGEBRAIC_INFO[] = { - {"i_Stim", "microA_per_cm2", "membrane", ALGEBRAIC}, - {"i_L", "microA_per_cm2", "leakage_current", ALGEBRAIC}, - {"i_K", "microA_per_cm2", "potassium_channel", ALGEBRAIC}, - {"i_Na", "microA_per_cm2", "sodium_channel", ALGEBRAIC}, - {"alpha_m", "per_millisecond", "sodium_channel_m_gate", ALGEBRAIC}, - {"beta_m", "per_millisecond", "sodium_channel_m_gate", ALGEBRAIC}, - {"alpha_h", "per_millisecond", "sodium_channel_h_gate", ALGEBRAIC}, - {"beta_h", "per_millisecond", "sodium_channel_h_gate", ALGEBRAIC}, - {"alpha_n", "per_millisecond", "potassium_channel_n_gate", ALGEBRAIC}, - {"beta_n", "per_millisecond", "potassium_channel_n_gate", ALGEBRAIC} + {"i_Stim", "microA_per_cm2", "membrane"}, + {"i_L", "microA_per_cm2", "leakage_current"}, + {"i_K", "microA_per_cm2", "potassium_channel"}, + {"i_Na", "microA_per_cm2", "sodium_channel"}, + {"alpha_m", "per_millisecond", "sodium_channel_m_gate"}, + {"beta_m", "per_millisecond", "sodium_channel_m_gate"}, + {"alpha_h", "per_millisecond", "sodium_channel_h_gate"}, + {"beta_h", "per_millisecond", "sodium_channel_h_gate"}, + {"alpha_n", "per_millisecond", "potassium_channel_n_gate"}, + {"beta_n", "per_millisecond", "potassium_channel_n_gate"} }; const VariableInfo EXTERNAL_INFO[] = { - {"Cm", "microF_per_cm2", "membrane", EXTERNAL}, - {"g_Na", "milliS_per_cm2", "sodium_channel", EXTERNAL} + {"Cm", "microF_per_cm2", "membrane"}, + {"g_Na", "milliS_per_cm2", "sodium_channel"} }; double * createStatesArray() diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.h index 5fb0b0dbc2..87c9d97a56 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.h +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.h @@ -13,20 +13,10 @@ extern const size_t COMPUTED_CONSTANT_COUNT; extern const size_t ALGEBRAIC_COUNT; extern const size_t EXTERNAL_COUNT; -typedef enum { - VARIABLE_OF_INTEGRATION, - STATE, - CONSTANT, - COMPUTED_CONSTANT, - ALGEBRAIC, - EXTERNAL -} VariableType; - typedef struct { char name[8]; char units[16]; char component[25]; - VariableType type; } VariableInfo; extern const VariableInfo VOI_INFO; diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.py index 78a627ae1d..bdb693b0de 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.py @@ -13,52 +13,42 @@ ALGEBRAIC_COUNT = 10 EXTERNAL_COUNT = 2 +VOI_INFO = {"name": "time", "units": "millisecond", "component": "environment"} -class VariableType(Enum): - VARIABLE_OF_INTEGRATION = 0 - STATE = 1 - CONSTANT = 2 - COMPUTED_CONSTANT = 3 - ALGEBRAIC = 4 - EXTERNAL = 5 - - -VOI_INFO = {"name": "time", "units": "millisecond", "component": "environment", "type": VariableType.VARIABLE_OF_INTEGRATION} - -STATE_INFO = {"name": "V", "units": "millivolt", "component": "membrane", "type": VariableType.STATE}, - {"name": "h", "units": "dimensionless", "component": "sodium_channel_h_gate", "type": VariableType.STATE}, - {"name": "m", "units": "dimensionless", "component": "sodium_channel_m_gate", "type": VariableType.STATE}, - {"name": "n", "units": "dimensionless", "component": "potassium_channel_n_gate", "type": VariableType.STATE} +STATE_INFO = {"name": "V", "units": "millivolt", "component": "membrane"}, + {"name": "h", "units": "dimensionless", "component": "sodium_channel_h_gate"}, + {"name": "m", "units": "dimensionless", "component": "sodium_channel_m_gate"}, + {"name": "n", "units": "dimensionless", "component": "potassium_channel_n_gate"} CONSTANT_INFO = [ - {"name": "E_R", "units": "millivolt", "component": "membrane", "type": VariableType.CONSTANT}, - {"name": "g_L", "units": "milliS_per_cm2", "component": "leakage_current", "type": VariableType.CONSTANT}, - {"name": "g_K", "units": "milliS_per_cm2", "component": "potassium_channel", "type": VariableType.CONSTANT} + {"name": "E_R", "units": "millivolt", "component": "membrane"}, + {"name": "g_L", "units": "milliS_per_cm2", "component": "leakage_current"}, + {"name": "g_K", "units": "milliS_per_cm2", "component": "potassium_channel"} ] COMPUTED_CONSTANT_INFO = [ - {"name": "E_L", "units": "millivolt", "component": "leakage_current", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "E_Na", "units": "millivolt", "component": "sodium_channel", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "E_K", "units": "millivolt", "component": "potassium_channel", "type": VariableType.COMPUTED_CONSTANT} + {"name": "E_L", "units": "millivolt", "component": "leakage_current"}, + {"name": "E_Na", "units": "millivolt", "component": "sodium_channel"}, + {"name": "E_K", "units": "millivolt", "component": "potassium_channel"} ] ALGEBRAIC_INFO = [ - {"name": "i_Stim", "units": "microA_per_cm2", "component": "membrane", "type": VariableType.ALGEBRAIC}, - {"name": "i_L", "units": "microA_per_cm2", "component": "leakage_current", "type": VariableType.ALGEBRAIC}, - {"name": "i_K", "units": "microA_per_cm2", "component": "potassium_channel", "type": VariableType.ALGEBRAIC}, - {"name": "i_Na", "units": "microA_per_cm2", "component": "sodium_channel", "type": VariableType.ALGEBRAIC}, - {"name": "alpha_m", "units": "per_millisecond", "component": "sodium_channel_m_gate", "type": VariableType.ALGEBRAIC}, - {"name": "beta_m", "units": "per_millisecond", "component": "sodium_channel_m_gate", "type": VariableType.ALGEBRAIC}, - {"name": "alpha_h", "units": "per_millisecond", "component": "sodium_channel_h_gate", "type": VariableType.ALGEBRAIC}, - {"name": "beta_h", "units": "per_millisecond", "component": "sodium_channel_h_gate", "type": VariableType.ALGEBRAIC}, - {"name": "alpha_n", "units": "per_millisecond", "component": "potassium_channel_n_gate", "type": VariableType.ALGEBRAIC}, - {"name": "beta_n", "units": "per_millisecond", "component": "potassium_channel_n_gate", "type": VariableType.ALGEBRAIC} + {"name": "i_Stim", "units": "microA_per_cm2", "component": "membrane"}, + {"name": "i_L", "units": "microA_per_cm2", "component": "leakage_current"}, + {"name": "i_K", "units": "microA_per_cm2", "component": "potassium_channel"}, + {"name": "i_Na", "units": "microA_per_cm2", "component": "sodium_channel"}, + {"name": "alpha_m", "units": "per_millisecond", "component": "sodium_channel_m_gate"}, + {"name": "beta_m", "units": "per_millisecond", "component": "sodium_channel_m_gate"}, + {"name": "alpha_h", "units": "per_millisecond", "component": "sodium_channel_h_gate"}, + {"name": "beta_h", "units": "per_millisecond", "component": "sodium_channel_h_gate"}, + {"name": "alpha_n", "units": "per_millisecond", "component": "potassium_channel_n_gate"}, + {"name": "beta_n", "units": "per_millisecond", "component": "potassium_channel_n_gate"} ] EXTERNAL_INFO = [ - {"name": "Cm", "units": "microF_per_cm2", "component": "membrane", "type": VariableType.EXTERNAL}, - {"name": "g_Na", "units": "milliS_per_cm2", "component": "sodium_channel", "type": VariableType.EXTERNAL} + {"name": "Cm", "units": "microF_per_cm2", "component": "membrane"}, + {"name": "g_Na", "units": "milliS_per_cm2", "component": "sodium_channel"} ] diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.c index f8caa76515..f7bfa5c34c 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.c @@ -14,43 +14,43 @@ const size_t COMPUTED_CONSTANT_COUNT = 3; const size_t ALGEBRAIC_COUNT = 10; const size_t EXTERNAL_COUNT = 2; -const VariableInfo VOI_INFO = {"time", "millisecond", "environment", VARIABLE_OF_INTEGRATION}; +const VariableInfo VOI_INFO = {"time", "millisecond", "environment"}; const VariableInfo STATE_INFO[] = { - {"h", "dimensionless", "sodium_channel_h_gate", STATE}, - {"n", "dimensionless", "potassium_channel_n_gate", STATE} + {"h", "dimensionless", "sodium_channel_h_gate"}, + {"n", "dimensionless", "potassium_channel_n_gate"} }; const VariableInfo CONSTANT_INFO[] = { - {"Cm", "microF_per_cm2", "membrane", CONSTANT}, - {"E_R", "millivolt", "membrane", CONSTANT}, - {"g_L", "milliS_per_cm2", "leakage_current", CONSTANT}, - {"g_Na", "milliS_per_cm2", "sodium_channel", CONSTANT}, - {"g_K", "milliS_per_cm2", "potassium_channel", CONSTANT} + {"Cm", "microF_per_cm2", "membrane"}, + {"E_R", "millivolt", "membrane"}, + {"g_L", "milliS_per_cm2", "leakage_current"}, + {"g_Na", "milliS_per_cm2", "sodium_channel"}, + {"g_K", "milliS_per_cm2", "potassium_channel"} }; const VariableInfo COMPUTED_CONSTANT_INFO[] = { - {"E_L", "millivolt", "leakage_current", COMPUTED_CONSTANT}, - {"E_Na", "millivolt", "sodium_channel", COMPUTED_CONSTANT}, - {"E_K", "millivolt", "potassium_channel", COMPUTED_CONSTANT} + {"E_L", "millivolt", "leakage_current"}, + {"E_Na", "millivolt", "sodium_channel"}, + {"E_K", "millivolt", "potassium_channel"} }; const VariableInfo ALGEBRAIC_INFO[] = { - {"i_Stim", "microA_per_cm2", "membrane", ALGEBRAIC}, - {"i_L", "microA_per_cm2", "leakage_current", ALGEBRAIC}, - {"i_K", "microA_per_cm2", "potassium_channel", ALGEBRAIC}, - {"i_Na", "microA_per_cm2", "sodium_channel", ALGEBRAIC}, - {"alpha_m", "per_millisecond", "sodium_channel_m_gate", ALGEBRAIC}, - {"beta_m", "per_millisecond", "sodium_channel_m_gate", ALGEBRAIC}, - {"alpha_h", "per_millisecond", "sodium_channel_h_gate", ALGEBRAIC}, - {"beta_h", "per_millisecond", "sodium_channel_h_gate", ALGEBRAIC}, - {"alpha_n", "per_millisecond", "potassium_channel_n_gate", ALGEBRAIC}, - {"beta_n", "per_millisecond", "potassium_channel_n_gate", ALGEBRAIC} + {"i_Stim", "microA_per_cm2", "membrane"}, + {"i_L", "microA_per_cm2", "leakage_current"}, + {"i_K", "microA_per_cm2", "potassium_channel"}, + {"i_Na", "microA_per_cm2", "sodium_channel"}, + {"alpha_m", "per_millisecond", "sodium_channel_m_gate"}, + {"beta_m", "per_millisecond", "sodium_channel_m_gate"}, + {"alpha_h", "per_millisecond", "sodium_channel_h_gate"}, + {"beta_h", "per_millisecond", "sodium_channel_h_gate"}, + {"alpha_n", "per_millisecond", "potassium_channel_n_gate"}, + {"beta_n", "per_millisecond", "potassium_channel_n_gate"} }; const VariableInfo EXTERNAL_INFO[] = { - {"V", "millivolt", "membrane", EXTERNAL}, - {"m", "dimensionless", "sodium_channel_m_gate", EXTERNAL} + {"V", "millivolt", "membrane"}, + {"m", "dimensionless", "sodium_channel_m_gate"} }; double * createStatesArray() diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.h index 5fb0b0dbc2..87c9d97a56 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.h +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.h @@ -13,20 +13,10 @@ extern const size_t COMPUTED_CONSTANT_COUNT; extern const size_t ALGEBRAIC_COUNT; extern const size_t EXTERNAL_COUNT; -typedef enum { - VARIABLE_OF_INTEGRATION, - STATE, - CONSTANT, - COMPUTED_CONSTANT, - ALGEBRAIC, - EXTERNAL -} VariableType; - typedef struct { char name[8]; char units[16]; char component[25]; - VariableType type; } VariableInfo; extern const VariableInfo VOI_INFO; diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.py index 6d926cf22d..ef8be939ed 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.py @@ -13,52 +13,42 @@ ALGEBRAIC_COUNT = 10 EXTERNAL_COUNT = 2 +VOI_INFO = {"name": "time", "units": "millisecond", "component": "environment"} -class VariableType(Enum): - VARIABLE_OF_INTEGRATION = 0 - STATE = 1 - CONSTANT = 2 - COMPUTED_CONSTANT = 3 - ALGEBRAIC = 4 - EXTERNAL = 5 - - -VOI_INFO = {"name": "time", "units": "millisecond", "component": "environment", "type": VariableType.VARIABLE_OF_INTEGRATION} - -STATE_INFO = {"name": "h", "units": "dimensionless", "component": "sodium_channel_h_gate", "type": VariableType.STATE}, - {"name": "n", "units": "dimensionless", "component": "potassium_channel_n_gate", "type": VariableType.STATE} +STATE_INFO = {"name": "h", "units": "dimensionless", "component": "sodium_channel_h_gate"}, + {"name": "n", "units": "dimensionless", "component": "potassium_channel_n_gate"} CONSTANT_INFO = [ - {"name": "Cm", "units": "microF_per_cm2", "component": "membrane", "type": VariableType.CONSTANT}, - {"name": "E_R", "units": "millivolt", "component": "membrane", "type": VariableType.CONSTANT}, - {"name": "g_L", "units": "milliS_per_cm2", "component": "leakage_current", "type": VariableType.CONSTANT}, - {"name": "g_Na", "units": "milliS_per_cm2", "component": "sodium_channel", "type": VariableType.CONSTANT}, - {"name": "g_K", "units": "milliS_per_cm2", "component": "potassium_channel", "type": VariableType.CONSTANT} + {"name": "Cm", "units": "microF_per_cm2", "component": "membrane"}, + {"name": "E_R", "units": "millivolt", "component": "membrane"}, + {"name": "g_L", "units": "milliS_per_cm2", "component": "leakage_current"}, + {"name": "g_Na", "units": "milliS_per_cm2", "component": "sodium_channel"}, + {"name": "g_K", "units": "milliS_per_cm2", "component": "potassium_channel"} ] COMPUTED_CONSTANT_INFO = [ - {"name": "E_L", "units": "millivolt", "component": "leakage_current", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "E_Na", "units": "millivolt", "component": "sodium_channel", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "E_K", "units": "millivolt", "component": "potassium_channel", "type": VariableType.COMPUTED_CONSTANT} + {"name": "E_L", "units": "millivolt", "component": "leakage_current"}, + {"name": "E_Na", "units": "millivolt", "component": "sodium_channel"}, + {"name": "E_K", "units": "millivolt", "component": "potassium_channel"} ] ALGEBRAIC_INFO = [ - {"name": "i_Stim", "units": "microA_per_cm2", "component": "membrane", "type": VariableType.ALGEBRAIC}, - {"name": "i_L", "units": "microA_per_cm2", "component": "leakage_current", "type": VariableType.ALGEBRAIC}, - {"name": "i_K", "units": "microA_per_cm2", "component": "potassium_channel", "type": VariableType.ALGEBRAIC}, - {"name": "i_Na", "units": "microA_per_cm2", "component": "sodium_channel", "type": VariableType.ALGEBRAIC}, - {"name": "alpha_m", "units": "per_millisecond", "component": "sodium_channel_m_gate", "type": VariableType.ALGEBRAIC}, - {"name": "beta_m", "units": "per_millisecond", "component": "sodium_channel_m_gate", "type": VariableType.ALGEBRAIC}, - {"name": "alpha_h", "units": "per_millisecond", "component": "sodium_channel_h_gate", "type": VariableType.ALGEBRAIC}, - {"name": "beta_h", "units": "per_millisecond", "component": "sodium_channel_h_gate", "type": VariableType.ALGEBRAIC}, - {"name": "alpha_n", "units": "per_millisecond", "component": "potassium_channel_n_gate", "type": VariableType.ALGEBRAIC}, - {"name": "beta_n", "units": "per_millisecond", "component": "potassium_channel_n_gate", "type": VariableType.ALGEBRAIC} + {"name": "i_Stim", "units": "microA_per_cm2", "component": "membrane"}, + {"name": "i_L", "units": "microA_per_cm2", "component": "leakage_current"}, + {"name": "i_K", "units": "microA_per_cm2", "component": "potassium_channel"}, + {"name": "i_Na", "units": "microA_per_cm2", "component": "sodium_channel"}, + {"name": "alpha_m", "units": "per_millisecond", "component": "sodium_channel_m_gate"}, + {"name": "beta_m", "units": "per_millisecond", "component": "sodium_channel_m_gate"}, + {"name": "alpha_h", "units": "per_millisecond", "component": "sodium_channel_h_gate"}, + {"name": "beta_h", "units": "per_millisecond", "component": "sodium_channel_h_gate"}, + {"name": "alpha_n", "units": "per_millisecond", "component": "potassium_channel_n_gate"}, + {"name": "beta_n", "units": "per_millisecond", "component": "potassium_channel_n_gate"} ] EXTERNAL_INFO = [ - {"name": "V", "units": "millivolt", "component": "membrane", "type": VariableType.EXTERNAL}, - {"name": "m", "units": "dimensionless", "component": "sodium_channel_m_gate", "type": VariableType.EXTERNAL} + {"name": "V", "units": "millivolt", "component": "membrane"}, + {"name": "m", "units": "dimensionless", "component": "sodium_channel_m_gate"} ] diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.c index c3b86c0a31..6682384a4b 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.c @@ -14,43 +14,43 @@ const size_t COMPUTED_CONSTANT_COUNT = 3; const size_t ALGEBRAIC_COUNT = 8; const size_t EXTERNAL_COUNT = 3; -const VariableInfo VOI_INFO = {"time", "millisecond", "environment", VARIABLE_OF_INTEGRATION}; +const VariableInfo VOI_INFO = {"time", "millisecond", "environment"}; const VariableInfo STATE_INFO[] = { - {"h", "dimensionless", "sodium_channel_h_gate", STATE}, - {"m", "dimensionless", "sodium_channel_m_gate", STATE}, - {"n", "dimensionless", "potassium_channel_n_gate", STATE} + {"h", "dimensionless", "sodium_channel_h_gate"}, + {"m", "dimensionless", "sodium_channel_m_gate"}, + {"n", "dimensionless", "potassium_channel_n_gate"} }; const VariableInfo CONSTANT_INFO[] = { - {"Cm", "microF_per_cm2", "membrane", CONSTANT}, - {"E_R", "millivolt", "membrane", CONSTANT}, - {"g_L", "milliS_per_cm2", "leakage_current", CONSTANT}, - {"g_Na", "milliS_per_cm2", "sodium_channel", CONSTANT}, - {"g_K", "milliS_per_cm2", "potassium_channel", CONSTANT} + {"Cm", "microF_per_cm2", "membrane"}, + {"E_R", "millivolt", "membrane"}, + {"g_L", "milliS_per_cm2", "leakage_current"}, + {"g_Na", "milliS_per_cm2", "sodium_channel"}, + {"g_K", "milliS_per_cm2", "potassium_channel"} }; const VariableInfo COMPUTED_CONSTANT_INFO[] = { - {"E_L", "millivolt", "leakage_current", COMPUTED_CONSTANT}, - {"E_Na", "millivolt", "sodium_channel", COMPUTED_CONSTANT}, - {"E_K", "millivolt", "potassium_channel", COMPUTED_CONSTANT} + {"E_L", "millivolt", "leakage_current"}, + {"E_Na", "millivolt", "sodium_channel"}, + {"E_K", "millivolt", "potassium_channel"} }; const VariableInfo ALGEBRAIC_INFO[] = { - {"i_Stim", "microA_per_cm2", "membrane", ALGEBRAIC}, - {"i_L", "microA_per_cm2", "leakage_current", ALGEBRAIC}, - {"i_K", "microA_per_cm2", "potassium_channel", ALGEBRAIC}, - {"alpha_m", "per_millisecond", "sodium_channel_m_gate", ALGEBRAIC}, - {"beta_m", "per_millisecond", "sodium_channel_m_gate", ALGEBRAIC}, - {"alpha_h", "per_millisecond", "sodium_channel_h_gate", ALGEBRAIC}, - {"beta_h", "per_millisecond", "sodium_channel_h_gate", ALGEBRAIC}, - {"beta_n", "per_millisecond", "potassium_channel_n_gate", ALGEBRAIC} + {"i_Stim", "microA_per_cm2", "membrane"}, + {"i_L", "microA_per_cm2", "leakage_current"}, + {"i_K", "microA_per_cm2", "potassium_channel"}, + {"alpha_m", "per_millisecond", "sodium_channel_m_gate"}, + {"beta_m", "per_millisecond", "sodium_channel_m_gate"}, + {"alpha_h", "per_millisecond", "sodium_channel_h_gate"}, + {"beta_h", "per_millisecond", "sodium_channel_h_gate"}, + {"beta_n", "per_millisecond", "potassium_channel_n_gate"} }; const VariableInfo EXTERNAL_INFO[] = { - {"V", "millivolt", "membrane", EXTERNAL}, - {"i_Na", "microA_per_cm2", "sodium_channel", EXTERNAL}, - {"alpha_n", "per_millisecond", "potassium_channel_n_gate", EXTERNAL} + {"V", "millivolt", "membrane"}, + {"i_Na", "microA_per_cm2", "sodium_channel"}, + {"alpha_n", "per_millisecond", "potassium_channel_n_gate"} }; double * createStatesArray() diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.h index 5fb0b0dbc2..87c9d97a56 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.h +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.h @@ -13,20 +13,10 @@ extern const size_t COMPUTED_CONSTANT_COUNT; extern const size_t ALGEBRAIC_COUNT; extern const size_t EXTERNAL_COUNT; -typedef enum { - VARIABLE_OF_INTEGRATION, - STATE, - CONSTANT, - COMPUTED_CONSTANT, - ALGEBRAIC, - EXTERNAL -} VariableType; - typedef struct { char name[8]; char units[16]; char component[25]; - VariableType type; } VariableInfo; extern const VariableInfo VOI_INFO; diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.py index 8ec0625cec..7a5b0bf19e 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.py @@ -13,52 +13,42 @@ ALGEBRAIC_COUNT = 8 EXTERNAL_COUNT = 3 +VOI_INFO = {"name": "time", "units": "millisecond", "component": "environment"} -class VariableType(Enum): - VARIABLE_OF_INTEGRATION = 0 - STATE = 1 - CONSTANT = 2 - COMPUTED_CONSTANT = 3 - ALGEBRAIC = 4 - EXTERNAL = 5 - - -VOI_INFO = {"name": "time", "units": "millisecond", "component": "environment", "type": VariableType.VARIABLE_OF_INTEGRATION} - -STATE_INFO = {"name": "h", "units": "dimensionless", "component": "sodium_channel_h_gate", "type": VariableType.STATE}, - {"name": "m", "units": "dimensionless", "component": "sodium_channel_m_gate", "type": VariableType.STATE}, - {"name": "n", "units": "dimensionless", "component": "potassium_channel_n_gate", "type": VariableType.STATE} +STATE_INFO = {"name": "h", "units": "dimensionless", "component": "sodium_channel_h_gate"}, + {"name": "m", "units": "dimensionless", "component": "sodium_channel_m_gate"}, + {"name": "n", "units": "dimensionless", "component": "potassium_channel_n_gate"} CONSTANT_INFO = [ - {"name": "Cm", "units": "microF_per_cm2", "component": "membrane", "type": VariableType.CONSTANT}, - {"name": "E_R", "units": "millivolt", "component": "membrane", "type": VariableType.CONSTANT}, - {"name": "g_L", "units": "milliS_per_cm2", "component": "leakage_current", "type": VariableType.CONSTANT}, - {"name": "g_Na", "units": "milliS_per_cm2", "component": "sodium_channel", "type": VariableType.CONSTANT}, - {"name": "g_K", "units": "milliS_per_cm2", "component": "potassium_channel", "type": VariableType.CONSTANT} + {"name": "Cm", "units": "microF_per_cm2", "component": "membrane"}, + {"name": "E_R", "units": "millivolt", "component": "membrane"}, + {"name": "g_L", "units": "milliS_per_cm2", "component": "leakage_current"}, + {"name": "g_Na", "units": "milliS_per_cm2", "component": "sodium_channel"}, + {"name": "g_K", "units": "milliS_per_cm2", "component": "potassium_channel"} ] COMPUTED_CONSTANT_INFO = [ - {"name": "E_L", "units": "millivolt", "component": "leakage_current", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "E_Na", "units": "millivolt", "component": "sodium_channel", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "E_K", "units": "millivolt", "component": "potassium_channel", "type": VariableType.COMPUTED_CONSTANT} + {"name": "E_L", "units": "millivolt", "component": "leakage_current"}, + {"name": "E_Na", "units": "millivolt", "component": "sodium_channel"}, + {"name": "E_K", "units": "millivolt", "component": "potassium_channel"} ] ALGEBRAIC_INFO = [ - {"name": "i_Stim", "units": "microA_per_cm2", "component": "membrane", "type": VariableType.ALGEBRAIC}, - {"name": "i_L", "units": "microA_per_cm2", "component": "leakage_current", "type": VariableType.ALGEBRAIC}, - {"name": "i_K", "units": "microA_per_cm2", "component": "potassium_channel", "type": VariableType.ALGEBRAIC}, - {"name": "alpha_m", "units": "per_millisecond", "component": "sodium_channel_m_gate", "type": VariableType.ALGEBRAIC}, - {"name": "beta_m", "units": "per_millisecond", "component": "sodium_channel_m_gate", "type": VariableType.ALGEBRAIC}, - {"name": "alpha_h", "units": "per_millisecond", "component": "sodium_channel_h_gate", "type": VariableType.ALGEBRAIC}, - {"name": "beta_h", "units": "per_millisecond", "component": "sodium_channel_h_gate", "type": VariableType.ALGEBRAIC}, - {"name": "beta_n", "units": "per_millisecond", "component": "potassium_channel_n_gate", "type": VariableType.ALGEBRAIC} + {"name": "i_Stim", "units": "microA_per_cm2", "component": "membrane"}, + {"name": "i_L", "units": "microA_per_cm2", "component": "leakage_current"}, + {"name": "i_K", "units": "microA_per_cm2", "component": "potassium_channel"}, + {"name": "alpha_m", "units": "per_millisecond", "component": "sodium_channel_m_gate"}, + {"name": "beta_m", "units": "per_millisecond", "component": "sodium_channel_m_gate"}, + {"name": "alpha_h", "units": "per_millisecond", "component": "sodium_channel_h_gate"}, + {"name": "beta_h", "units": "per_millisecond", "component": "sodium_channel_h_gate"}, + {"name": "beta_n", "units": "per_millisecond", "component": "potassium_channel_n_gate"} ] EXTERNAL_INFO = [ - {"name": "V", "units": "millivolt", "component": "membrane", "type": VariableType.EXTERNAL}, - {"name": "i_Na", "units": "microA_per_cm2", "component": "sodium_channel", "type": VariableType.EXTERNAL}, - {"name": "alpha_n", "units": "per_millisecond", "component": "potassium_channel_n_gate", "type": VariableType.EXTERNAL} + {"name": "V", "units": "millivolt", "component": "membrane"}, + {"name": "i_Na", "units": "microA_per_cm2", "component": "sodium_channel"}, + {"name": "alpha_n", "units": "per_millisecond", "component": "potassium_channel_n_gate"} ] diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.h index 7a76b71aff..d64d07bb62 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.h +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.h @@ -12,19 +12,10 @@ extern const size_t CONSTANT_COUNT; extern const size_t COMPUTED_CONSTANT_COUNT; extern const size_t ALGEBRAIC_COUNT; -typedef enum { - VARIABLE_OF_INTEGRATION, - STATE, - CONSTANT, - COMPUTED_CONSTANT, - ALGEBRAIC -} VariableType; - typedef struct { char name[8]; char units[16]; char component[25]; - VariableType type; } VariableInfo; extern const VariableInfo VOI_INFO; diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.py index 6f1ab2d372..161468ab22 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.py @@ -12,48 +12,39 @@ COMPUTED_CONSTANT_COUNT = 3 ALGEBRAIC_COUNT = 10 +VOI_INFO = {"name": "time", "units": "millisecond", "component": "environment"} -class VariableType(Enum): - VARIABLE_OF_INTEGRATION = 0 - STATE = 1 - CONSTANT = 2 - COMPUTED_CONSTANT = 3 - ALGEBRAIC = 4 - - -VOI_INFO = {"name": "time", "units": "millisecond", "component": "environment", "type": VariableType.VARIABLE_OF_INTEGRATION} - -STATE_INFO = {"name": "V", "units": "millivolt", "component": "membrane", "type": VariableType.STATE}, - {"name": "h", "units": "dimensionless", "component": "sodium_channel_h_gate", "type": VariableType.STATE}, - {"name": "m", "units": "dimensionless", "component": "sodium_channel_m_gate", "type": VariableType.STATE}, - {"name": "n", "units": "dimensionless", "component": "potassium_channel_n_gate", "type": VariableType.STATE} +STATE_INFO = {"name": "V", "units": "millivolt", "component": "membrane"}, + {"name": "h", "units": "dimensionless", "component": "sodium_channel_h_gate"}, + {"name": "m", "units": "dimensionless", "component": "sodium_channel_m_gate"}, + {"name": "n", "units": "dimensionless", "component": "potassium_channel_n_gate"} CONSTANT_INFO = [ - {"name": "Cm", "units": "microF_per_cm2", "component": "membrane", "type": VariableType.CONSTANT}, - {"name": "E_R", "units": "millivolt", "component": "membrane", "type": VariableType.CONSTANT}, - {"name": "g_L", "units": "milliS_per_cm2", "component": "leakage_current", "type": VariableType.CONSTANT}, - {"name": "g_Na", "units": "milliS_per_cm2", "component": "sodium_channel", "type": VariableType.CONSTANT}, - {"name": "g_K", "units": "milliS_per_cm2", "component": "potassium_channel", "type": VariableType.CONSTANT} + {"name": "Cm", "units": "microF_per_cm2", "component": "membrane"}, + {"name": "E_R", "units": "millivolt", "component": "membrane"}, + {"name": "g_L", "units": "milliS_per_cm2", "component": "leakage_current"}, + {"name": "g_Na", "units": "milliS_per_cm2", "component": "sodium_channel"}, + {"name": "g_K", "units": "milliS_per_cm2", "component": "potassium_channel"} ] COMPUTED_CONSTANT_INFO = [ - {"name": "E_L", "units": "millivolt", "component": "leakage_current", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "E_Na", "units": "millivolt", "component": "sodium_channel", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "E_K", "units": "millivolt", "component": "potassium_channel", "type": VariableType.COMPUTED_CONSTANT} + {"name": "E_L", "units": "millivolt", "component": "leakage_current"}, + {"name": "E_Na", "units": "millivolt", "component": "sodium_channel"}, + {"name": "E_K", "units": "millivolt", "component": "potassium_channel"} ] ALGEBRAIC_INFO = [ - {"name": "i_Stim", "units": "microA_per_cm2", "component": "membrane", "type": VariableType.ALGEBRAIC}, - {"name": "i_L", "units": "microA_per_cm2", "component": "leakage_current", "type": VariableType.ALGEBRAIC}, - {"name": "i_K", "units": "microA_per_cm2", "component": "potassium_channel", "type": VariableType.ALGEBRAIC}, - {"name": "i_Na", "units": "microA_per_cm2", "component": "sodium_channel", "type": VariableType.ALGEBRAIC}, - {"name": "alpha_m", "units": "per_millisecond", "component": "sodium_channel_m_gate", "type": VariableType.ALGEBRAIC}, - {"name": "beta_m", "units": "per_millisecond", "component": "sodium_channel_m_gate", "type": VariableType.ALGEBRAIC}, - {"name": "alpha_h", "units": "per_millisecond", "component": "sodium_channel_h_gate", "type": VariableType.ALGEBRAIC}, - {"name": "beta_h", "units": "per_millisecond", "component": "sodium_channel_h_gate", "type": VariableType.ALGEBRAIC}, - {"name": "alpha_n", "units": "per_millisecond", "component": "potassium_channel_n_gate", "type": VariableType.ALGEBRAIC}, - {"name": "beta_n", "units": "per_millisecond", "component": "potassium_channel_n_gate", "type": VariableType.ALGEBRAIC} + {"name": "i_Stim", "units": "microA_per_cm2", "component": "membrane"}, + {"name": "i_L", "units": "microA_per_cm2", "component": "leakage_current"}, + {"name": "i_K", "units": "microA_per_cm2", "component": "potassium_channel"}, + {"name": "i_Na", "units": "microA_per_cm2", "component": "sodium_channel"}, + {"name": "alpha_m", "units": "per_millisecond", "component": "sodium_channel_m_gate"}, + {"name": "beta_m", "units": "per_millisecond", "component": "sodium_channel_m_gate"}, + {"name": "alpha_h", "units": "per_millisecond", "component": "sodium_channel_h_gate"}, + {"name": "beta_h", "units": "per_millisecond", "component": "sodium_channel_h_gate"}, + {"name": "alpha_n", "units": "per_millisecond", "component": "potassium_channel_n_gate"}, + {"name": "beta_n", "units": "per_millisecond", "component": "potassium_channel_n_gate"} ] diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.c index 2492a86c03..69ac3783d6 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.c @@ -14,43 +14,43 @@ const size_t COMPUTED_CONSTANT_COUNT = 3; const size_t ALGEBRAIC_COUNT = 10; const size_t EXTERNAL_COUNT = 1; -const VariableInfo VOI_INFO = {"time", "millisecond", "environment", VARIABLE_OF_INTEGRATION}; +const VariableInfo VOI_INFO = {"time", "millisecond", "environment"}; const VariableInfo STATE_INFO[] = { - {"V", "millivolt", "membrane", STATE}, - {"h", "dimensionless", "sodium_channel_h_gate", STATE}, - {"n", "dimensionless", "potassium_channel_n_gate", STATE} + {"V", "millivolt", "membrane"}, + {"h", "dimensionless", "sodium_channel_h_gate"}, + {"n", "dimensionless", "potassium_channel_n_gate"} }; const VariableInfo CONSTANT_INFO[] = { - {"Cm", "microF_per_cm2", "membrane", CONSTANT}, - {"E_R", "millivolt", "membrane", CONSTANT}, - {"g_L", "milliS_per_cm2", "leakage_current", CONSTANT}, - {"g_Na", "milliS_per_cm2", "sodium_channel", CONSTANT}, - {"g_K", "milliS_per_cm2", "potassium_channel", CONSTANT} + {"Cm", "microF_per_cm2", "membrane"}, + {"E_R", "millivolt", "membrane"}, + {"g_L", "milliS_per_cm2", "leakage_current"}, + {"g_Na", "milliS_per_cm2", "sodium_channel"}, + {"g_K", "milliS_per_cm2", "potassium_channel"} }; const VariableInfo COMPUTED_CONSTANT_INFO[] = { - {"E_L", "millivolt", "leakage_current", COMPUTED_CONSTANT}, - {"E_Na", "millivolt", "sodium_channel", COMPUTED_CONSTANT}, - {"E_K", "millivolt", "potassium_channel", COMPUTED_CONSTANT} + {"E_L", "millivolt", "leakage_current"}, + {"E_Na", "millivolt", "sodium_channel"}, + {"E_K", "millivolt", "potassium_channel"} }; const VariableInfo ALGEBRAIC_INFO[] = { - {"i_Stim", "microA_per_cm2", "membrane", ALGEBRAIC}, - {"i_L", "microA_per_cm2", "leakage_current", ALGEBRAIC}, - {"i_K", "microA_per_cm2", "potassium_channel", ALGEBRAIC}, - {"i_Na", "microA_per_cm2", "sodium_channel", ALGEBRAIC}, - {"alpha_m", "per_millisecond", "sodium_channel_m_gate", ALGEBRAIC}, - {"beta_m", "per_millisecond", "sodium_channel_m_gate", ALGEBRAIC}, - {"alpha_h", "per_millisecond", "sodium_channel_h_gate", ALGEBRAIC}, - {"beta_h", "per_millisecond", "sodium_channel_h_gate", ALGEBRAIC}, - {"alpha_n", "per_millisecond", "potassium_channel_n_gate", ALGEBRAIC}, - {"beta_n", "per_millisecond", "potassium_channel_n_gate", ALGEBRAIC} + {"i_Stim", "microA_per_cm2", "membrane"}, + {"i_L", "microA_per_cm2", "leakage_current"}, + {"i_K", "microA_per_cm2", "potassium_channel"}, + {"i_Na", "microA_per_cm2", "sodium_channel"}, + {"alpha_m", "per_millisecond", "sodium_channel_m_gate"}, + {"beta_m", "per_millisecond", "sodium_channel_m_gate"}, + {"alpha_h", "per_millisecond", "sodium_channel_h_gate"}, + {"beta_h", "per_millisecond", "sodium_channel_h_gate"}, + {"alpha_n", "per_millisecond", "potassium_channel_n_gate"}, + {"beta_n", "per_millisecond", "potassium_channel_n_gate"} }; const VariableInfo EXTERNAL_INFO[] = { - {"m", "dimensionless", "sodium_channel_m_gate", EXTERNAL} + {"m", "dimensionless", "sodium_channel_m_gate"} }; double * createStatesArray() diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.h index 5fb0b0dbc2..87c9d97a56 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.h +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.h @@ -13,20 +13,10 @@ extern const size_t COMPUTED_CONSTANT_COUNT; extern const size_t ALGEBRAIC_COUNT; extern const size_t EXTERNAL_COUNT; -typedef enum { - VARIABLE_OF_INTEGRATION, - STATE, - CONSTANT, - COMPUTED_CONSTANT, - ALGEBRAIC, - EXTERNAL -} VariableType; - typedef struct { char name[8]; char units[16]; char component[25]; - VariableType type; } VariableInfo; extern const VariableInfo VOI_INFO; diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.py index 40c52077b9..1574fc8fd1 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.py @@ -13,52 +13,42 @@ ALGEBRAIC_COUNT = 10 EXTERNAL_COUNT = 1 +VOI_INFO = {"name": "time", "units": "millisecond", "component": "environment"} -class VariableType(Enum): - VARIABLE_OF_INTEGRATION = 0 - STATE = 1 - CONSTANT = 2 - COMPUTED_CONSTANT = 3 - ALGEBRAIC = 4 - EXTERNAL = 5 - - -VOI_INFO = {"name": "time", "units": "millisecond", "component": "environment", "type": VariableType.VARIABLE_OF_INTEGRATION} - -STATE_INFO = {"name": "V", "units": "millivolt", "component": "membrane", "type": VariableType.STATE}, - {"name": "h", "units": "dimensionless", "component": "sodium_channel_h_gate", "type": VariableType.STATE}, - {"name": "n", "units": "dimensionless", "component": "potassium_channel_n_gate", "type": VariableType.STATE} +STATE_INFO = {"name": "V", "units": "millivolt", "component": "membrane"}, + {"name": "h", "units": "dimensionless", "component": "sodium_channel_h_gate"}, + {"name": "n", "units": "dimensionless", "component": "potassium_channel_n_gate"} CONSTANT_INFO = [ - {"name": "Cm", "units": "microF_per_cm2", "component": "membrane", "type": VariableType.CONSTANT}, - {"name": "E_R", "units": "millivolt", "component": "membrane", "type": VariableType.CONSTANT}, - {"name": "g_L", "units": "milliS_per_cm2", "component": "leakage_current", "type": VariableType.CONSTANT}, - {"name": "g_Na", "units": "milliS_per_cm2", "component": "sodium_channel", "type": VariableType.CONSTANT}, - {"name": "g_K", "units": "milliS_per_cm2", "component": "potassium_channel", "type": VariableType.CONSTANT} + {"name": "Cm", "units": "microF_per_cm2", "component": "membrane"}, + {"name": "E_R", "units": "millivolt", "component": "membrane"}, + {"name": "g_L", "units": "milliS_per_cm2", "component": "leakage_current"}, + {"name": "g_Na", "units": "milliS_per_cm2", "component": "sodium_channel"}, + {"name": "g_K", "units": "milliS_per_cm2", "component": "potassium_channel"} ] COMPUTED_CONSTANT_INFO = [ - {"name": "E_L", "units": "millivolt", "component": "leakage_current", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "E_Na", "units": "millivolt", "component": "sodium_channel", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "E_K", "units": "millivolt", "component": "potassium_channel", "type": VariableType.COMPUTED_CONSTANT} + {"name": "E_L", "units": "millivolt", "component": "leakage_current"}, + {"name": "E_Na", "units": "millivolt", "component": "sodium_channel"}, + {"name": "E_K", "units": "millivolt", "component": "potassium_channel"} ] ALGEBRAIC_INFO = [ - {"name": "i_Stim", "units": "microA_per_cm2", "component": "membrane", "type": VariableType.ALGEBRAIC}, - {"name": "i_L", "units": "microA_per_cm2", "component": "leakage_current", "type": VariableType.ALGEBRAIC}, - {"name": "i_K", "units": "microA_per_cm2", "component": "potassium_channel", "type": VariableType.ALGEBRAIC}, - {"name": "i_Na", "units": "microA_per_cm2", "component": "sodium_channel", "type": VariableType.ALGEBRAIC}, - {"name": "alpha_m", "units": "per_millisecond", "component": "sodium_channel_m_gate", "type": VariableType.ALGEBRAIC}, - {"name": "beta_m", "units": "per_millisecond", "component": "sodium_channel_m_gate", "type": VariableType.ALGEBRAIC}, - {"name": "alpha_h", "units": "per_millisecond", "component": "sodium_channel_h_gate", "type": VariableType.ALGEBRAIC}, - {"name": "beta_h", "units": "per_millisecond", "component": "sodium_channel_h_gate", "type": VariableType.ALGEBRAIC}, - {"name": "alpha_n", "units": "per_millisecond", "component": "potassium_channel_n_gate", "type": VariableType.ALGEBRAIC}, - {"name": "beta_n", "units": "per_millisecond", "component": "potassium_channel_n_gate", "type": VariableType.ALGEBRAIC} + {"name": "i_Stim", "units": "microA_per_cm2", "component": "membrane"}, + {"name": "i_L", "units": "microA_per_cm2", "component": "leakage_current"}, + {"name": "i_K", "units": "microA_per_cm2", "component": "potassium_channel"}, + {"name": "i_Na", "units": "microA_per_cm2", "component": "sodium_channel"}, + {"name": "alpha_m", "units": "per_millisecond", "component": "sodium_channel_m_gate"}, + {"name": "beta_m", "units": "per_millisecond", "component": "sodium_channel_m_gate"}, + {"name": "alpha_h", "units": "per_millisecond", "component": "sodium_channel_h_gate"}, + {"name": "beta_h", "units": "per_millisecond", "component": "sodium_channel_h_gate"}, + {"name": "alpha_n", "units": "per_millisecond", "component": "potassium_channel_n_gate"}, + {"name": "beta_n", "units": "per_millisecond", "component": "potassium_channel_n_gate"} ] EXTERNAL_INFO = [ - {"name": "m", "units": "dimensionless", "component": "sodium_channel_m_gate", "type": VariableType.EXTERNAL} + {"name": "m", "units": "dimensionless", "component": "sodium_channel_m_gate"} ] diff --git a/tests/resources/generator/noble_model_1962/model.c b/tests/resources/generator/noble_model_1962/model.c index 7966221694..42e464392e 100644 --- a/tests/resources/generator/noble_model_1962/model.c +++ b/tests/resources/generator/noble_model_1962/model.c @@ -13,39 +13,39 @@ const size_t CONSTANT_COUNT = 5; const size_t COMPUTED_CONSTANT_COUNT = 0; const size_t ALGEBRAIC_COUNT = 12; -const VariableInfo VOI_INFO = {"time", "millisecond", "environment", VARIABLE_OF_INTEGRATION}; +const VariableInfo VOI_INFO = {"time", "millisecond", "environment"}; const VariableInfo STATE_INFO[] = { - {"V", "millivolt", "membrane", STATE}, - {"m", "dimensionless", "sodium_channel_m_gate", STATE}, - {"h", "dimensionless", "sodium_channel_h_gate", STATE}, - {"n", "dimensionless", "potassium_channel_n_gate", STATE} + {"V", "millivolt", "membrane"}, + {"m", "dimensionless", "sodium_channel_m_gate"}, + {"h", "dimensionless", "sodium_channel_h_gate"}, + {"n", "dimensionless", "potassium_channel_n_gate"} }; const VariableInfo CONSTANT_INFO[] = { - {"Cm", "microF_per_cm2", "membrane", CONSTANT}, - {"g_L", "milliS_per_cm2", "leakage_current", CONSTANT}, - {"E_L", "millivolt", "leakage_current", CONSTANT}, - {"g_Na_max", "milliS_per_cm2", "sodium_channel", CONSTANT}, - {"E_Na", "millivolt", "sodium_channel", CONSTANT} + {"Cm", "microF_per_cm2", "membrane"}, + {"g_L", "milliS_per_cm2", "leakage_current"}, + {"E_L", "millivolt", "leakage_current"}, + {"g_Na_max", "milliS_per_cm2", "sodium_channel"}, + {"E_Na", "millivolt", "sodium_channel"} }; const VariableInfo COMPUTED_CONSTANT_INFO[] = { }; const VariableInfo ALGEBRAIC_INFO[] = { - {"i_Na", "microA_per_cm2", "sodium_channel", ALGEBRAIC}, - {"i_Leak", "microA_per_cm2", "leakage_current", ALGEBRAIC}, - {"i_K", "microA_per_cm2", "potassium_channel", ALGEBRAIC}, - {"g_Na", "milliS_per_cm2", "sodium_channel", ALGEBRAIC}, - {"alpha_m", "per_millisecond", "sodium_channel_m_gate", ALGEBRAIC}, - {"beta_m", "per_millisecond", "sodium_channel_m_gate", ALGEBRAIC}, - {"alpha_h", "per_millisecond", "sodium_channel_h_gate", ALGEBRAIC}, - {"beta_h", "per_millisecond", "sodium_channel_h_gate", ALGEBRAIC}, - {"g_K1", "milliS_per_cm2", "potassium_channel", ALGEBRAIC}, - {"g_K2", "milliS_per_cm2", "potassium_channel", ALGEBRAIC}, - {"alpha_n", "per_millisecond", "potassium_channel_n_gate", ALGEBRAIC}, - {"beta_n", "per_millisecond", "potassium_channel_n_gate", ALGEBRAIC} + {"i_Na", "microA_per_cm2", "sodium_channel"}, + {"i_Leak", "microA_per_cm2", "leakage_current"}, + {"i_K", "microA_per_cm2", "potassium_channel"}, + {"g_Na", "milliS_per_cm2", "sodium_channel"}, + {"alpha_m", "per_millisecond", "sodium_channel_m_gate"}, + {"beta_m", "per_millisecond", "sodium_channel_m_gate"}, + {"alpha_h", "per_millisecond", "sodium_channel_h_gate"}, + {"beta_h", "per_millisecond", "sodium_channel_h_gate"}, + {"g_K1", "milliS_per_cm2", "potassium_channel"}, + {"g_K2", "milliS_per_cm2", "potassium_channel"}, + {"alpha_n", "per_millisecond", "potassium_channel_n_gate"}, + {"beta_n", "per_millisecond", "potassium_channel_n_gate"} }; double * createStatesArray() diff --git a/tests/resources/generator/noble_model_1962/model.h b/tests/resources/generator/noble_model_1962/model.h index 76e98a8542..a4c01ffa0c 100644 --- a/tests/resources/generator/noble_model_1962/model.h +++ b/tests/resources/generator/noble_model_1962/model.h @@ -12,19 +12,10 @@ extern const size_t CONSTANT_COUNT; extern const size_t COMPUTED_CONSTANT_COUNT; extern const size_t ALGEBRAIC_COUNT; -typedef enum { - VARIABLE_OF_INTEGRATION, - STATE, - CONSTANT, - COMPUTED_CONSTANT, - ALGEBRAIC -} VariableType; - typedef struct { char name[9]; char units[16]; char component[25]; - VariableType type; } VariableInfo; extern const VariableInfo VOI_INFO; diff --git a/tests/resources/generator/noble_model_1962/model.py b/tests/resources/generator/noble_model_1962/model.py index 7a19fb3e3f..0b75dd7778 100644 --- a/tests/resources/generator/noble_model_1962/model.py +++ b/tests/resources/generator/noble_model_1962/model.py @@ -12,47 +12,38 @@ COMPUTED_CONSTANT_COUNT = 0 ALGEBRAIC_COUNT = 12 +VOI_INFO = {"name": "time", "units": "millisecond", "component": "environment"} -class VariableType(Enum): - VARIABLE_OF_INTEGRATION = 0 - STATE = 1 - CONSTANT = 2 - COMPUTED_CONSTANT = 3 - ALGEBRAIC = 4 - - -VOI_INFO = {"name": "time", "units": "millisecond", "component": "environment", "type": VariableType.VARIABLE_OF_INTEGRATION} - -STATE_INFO = {"name": "V", "units": "millivolt", "component": "membrane", "type": VariableType.STATE}, - {"name": "m", "units": "dimensionless", "component": "sodium_channel_m_gate", "type": VariableType.STATE}, - {"name": "h", "units": "dimensionless", "component": "sodium_channel_h_gate", "type": VariableType.STATE}, - {"name": "n", "units": "dimensionless", "component": "potassium_channel_n_gate", "type": VariableType.STATE} +STATE_INFO = {"name": "V", "units": "millivolt", "component": "membrane"}, + {"name": "m", "units": "dimensionless", "component": "sodium_channel_m_gate"}, + {"name": "h", "units": "dimensionless", "component": "sodium_channel_h_gate"}, + {"name": "n", "units": "dimensionless", "component": "potassium_channel_n_gate"} CONSTANT_INFO = [ - {"name": "Cm", "units": "microF_per_cm2", "component": "membrane", "type": VariableType.CONSTANT}, - {"name": "g_L", "units": "milliS_per_cm2", "component": "leakage_current", "type": VariableType.CONSTANT}, - {"name": "E_L", "units": "millivolt", "component": "leakage_current", "type": VariableType.CONSTANT}, - {"name": "g_Na_max", "units": "milliS_per_cm2", "component": "sodium_channel", "type": VariableType.CONSTANT}, - {"name": "E_Na", "units": "millivolt", "component": "sodium_channel", "type": VariableType.CONSTANT} + {"name": "Cm", "units": "microF_per_cm2", "component": "membrane"}, + {"name": "g_L", "units": "milliS_per_cm2", "component": "leakage_current"}, + {"name": "E_L", "units": "millivolt", "component": "leakage_current"}, + {"name": "g_Na_max", "units": "milliS_per_cm2", "component": "sodium_channel"}, + {"name": "E_Na", "units": "millivolt", "component": "sodium_channel"} ] COMPUTED_CONSTANT_INFO = [ ] ALGEBRAIC_INFO = [ - {"name": "i_Na", "units": "microA_per_cm2", "component": "sodium_channel", "type": VariableType.ALGEBRAIC}, - {"name": "i_Leak", "units": "microA_per_cm2", "component": "leakage_current", "type": VariableType.ALGEBRAIC}, - {"name": "i_K", "units": "microA_per_cm2", "component": "potassium_channel", "type": VariableType.ALGEBRAIC}, - {"name": "g_Na", "units": "milliS_per_cm2", "component": "sodium_channel", "type": VariableType.ALGEBRAIC}, - {"name": "alpha_m", "units": "per_millisecond", "component": "sodium_channel_m_gate", "type": VariableType.ALGEBRAIC}, - {"name": "beta_m", "units": "per_millisecond", "component": "sodium_channel_m_gate", "type": VariableType.ALGEBRAIC}, - {"name": "alpha_h", "units": "per_millisecond", "component": "sodium_channel_h_gate", "type": VariableType.ALGEBRAIC}, - {"name": "beta_h", "units": "per_millisecond", "component": "sodium_channel_h_gate", "type": VariableType.ALGEBRAIC}, - {"name": "g_K1", "units": "milliS_per_cm2", "component": "potassium_channel", "type": VariableType.ALGEBRAIC}, - {"name": "g_K2", "units": "milliS_per_cm2", "component": "potassium_channel", "type": VariableType.ALGEBRAIC}, - {"name": "alpha_n", "units": "per_millisecond", "component": "potassium_channel_n_gate", "type": VariableType.ALGEBRAIC}, - {"name": "beta_n", "units": "per_millisecond", "component": "potassium_channel_n_gate", "type": VariableType.ALGEBRAIC} + {"name": "i_Na", "units": "microA_per_cm2", "component": "sodium_channel"}, + {"name": "i_Leak", "units": "microA_per_cm2", "component": "leakage_current"}, + {"name": "i_K", "units": "microA_per_cm2", "component": "potassium_channel"}, + {"name": "g_Na", "units": "milliS_per_cm2", "component": "sodium_channel"}, + {"name": "alpha_m", "units": "per_millisecond", "component": "sodium_channel_m_gate"}, + {"name": "beta_m", "units": "per_millisecond", "component": "sodium_channel_m_gate"}, + {"name": "alpha_h", "units": "per_millisecond", "component": "sodium_channel_h_gate"}, + {"name": "beta_h", "units": "per_millisecond", "component": "sodium_channel_h_gate"}, + {"name": "g_K1", "units": "milliS_per_cm2", "component": "potassium_channel"}, + {"name": "g_K2", "units": "milliS_per_cm2", "component": "potassium_channel"}, + {"name": "alpha_n", "units": "per_millisecond", "component": "potassium_channel_n_gate"}, + {"name": "beta_n", "units": "per_millisecond", "component": "potassium_channel_n_gate"} ] diff --git a/tests/resources/generator/ode_computed_var_on_rhs/model.c b/tests/resources/generator/ode_computed_var_on_rhs/model.c index 1aee953d69..abf35649d0 100644 --- a/tests/resources/generator/ode_computed_var_on_rhs/model.c +++ b/tests/resources/generator/ode_computed_var_on_rhs/model.c @@ -13,17 +13,17 @@ const size_t CONSTANT_COUNT = 0; const size_t COMPUTED_CONSTANT_COUNT = 1; const size_t ALGEBRAIC_COUNT = 0; -const VariableInfo VOI_INFO = {"t", "second", "environment", VARIABLE_OF_INTEGRATION}; +const VariableInfo VOI_INFO = {"t", "second", "environment"}; const VariableInfo STATE_INFO[] = { - {"x", "dimensionless", "my_ode", STATE} + {"x", "dimensionless", "my_ode"} }; const VariableInfo CONSTANT_INFO[] = { }; const VariableInfo COMPUTED_CONSTANT_INFO[] = { - {"a", "per_s", "my_ode", COMPUTED_CONSTANT} + {"a", "per_s", "my_ode"} }; const VariableInfo ALGEBRAIC_INFO[] = { diff --git a/tests/resources/generator/ode_computed_var_on_rhs/model.h b/tests/resources/generator/ode_computed_var_on_rhs/model.h index 35acb14707..8d446982d8 100644 --- a/tests/resources/generator/ode_computed_var_on_rhs/model.h +++ b/tests/resources/generator/ode_computed_var_on_rhs/model.h @@ -12,19 +12,10 @@ extern const size_t CONSTANT_COUNT; extern const size_t COMPUTED_CONSTANT_COUNT; extern const size_t ALGEBRAIC_COUNT; -typedef enum { - VARIABLE_OF_INTEGRATION, - STATE, - CONSTANT, - COMPUTED_CONSTANT, - ALGEBRAIC -} VariableType; - typedef struct { char name[2]; char units[14]; char component[12]; - VariableType type; } VariableInfo; extern const VariableInfo VOI_INFO; diff --git a/tests/resources/generator/ode_computed_var_on_rhs/model.py b/tests/resources/generator/ode_computed_var_on_rhs/model.py index a0eefbb103..81b6db4c1d 100644 --- a/tests/resources/generator/ode_computed_var_on_rhs/model.py +++ b/tests/resources/generator/ode_computed_var_on_rhs/model.py @@ -12,25 +12,16 @@ COMPUTED_CONSTANT_COUNT = 1 ALGEBRAIC_COUNT = 0 +VOI_INFO = {"name": "t", "units": "second", "component": "environment"} -class VariableType(Enum): - VARIABLE_OF_INTEGRATION = 0 - STATE = 1 - CONSTANT = 2 - COMPUTED_CONSTANT = 3 - ALGEBRAIC = 4 - - -VOI_INFO = {"name": "t", "units": "second", "component": "environment", "type": VariableType.VARIABLE_OF_INTEGRATION} - -STATE_INFO = {"name": "x", "units": "dimensionless", "component": "my_ode", "type": VariableType.STATE} +STATE_INFO = {"name": "x", "units": "dimensionless", "component": "my_ode"} CONSTANT_INFO = [ ] COMPUTED_CONSTANT_INFO = [ - {"name": "a", "units": "per_s", "component": "my_ode", "type": VariableType.COMPUTED_CONSTANT} + {"name": "a", "units": "per_s", "component": "my_ode"} ] ALGEBRAIC_INFO = [ diff --git a/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.c b/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.c index 5917645d36..e6eecbfdc7 100644 --- a/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.c +++ b/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.c @@ -13,17 +13,17 @@ const size_t CONSTANT_COUNT = 0; const size_t COMPUTED_CONSTANT_COUNT = 1; const size_t ALGEBRAIC_COUNT = 0; -const VariableInfo VOI_INFO = {"t", "second", "my_component", VARIABLE_OF_INTEGRATION}; +const VariableInfo VOI_INFO = {"t", "second", "my_component"}; const VariableInfo STATE_INFO[] = { - {"x", "dimensionless", "my_component", STATE} + {"x", "dimensionless", "my_component"} }; const VariableInfo CONSTANT_INFO[] = { }; const VariableInfo COMPUTED_CONSTANT_INFO[] = { - {"a", "per_s", "my_component", COMPUTED_CONSTANT} + {"a", "per_s", "my_component"} }; const VariableInfo ALGEBRAIC_INFO[] = { diff --git a/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.h b/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.h index ec10997670..1c36d8d5fc 100644 --- a/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.h +++ b/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.h @@ -12,19 +12,10 @@ extern const size_t CONSTANT_COUNT; extern const size_t COMPUTED_CONSTANT_COUNT; extern const size_t ALGEBRAIC_COUNT; -typedef enum { - VARIABLE_OF_INTEGRATION, - STATE, - CONSTANT, - COMPUTED_CONSTANT, - ALGEBRAIC -} VariableType; - typedef struct { char name[2]; char units[14]; char component[13]; - VariableType type; } VariableInfo; extern const VariableInfo VOI_INFO; diff --git a/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.py b/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.py index 694094710a..6f9c31e1eb 100644 --- a/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.py +++ b/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.py @@ -12,25 +12,16 @@ COMPUTED_CONSTANT_COUNT = 1 ALGEBRAIC_COUNT = 0 +VOI_INFO = {"name": "t", "units": "second", "component": "my_component"} -class VariableType(Enum): - VARIABLE_OF_INTEGRATION = 0 - STATE = 1 - CONSTANT = 2 - COMPUTED_CONSTANT = 3 - ALGEBRAIC = 4 - - -VOI_INFO = {"name": "t", "units": "second", "component": "my_component", "type": VariableType.VARIABLE_OF_INTEGRATION} - -STATE_INFO = {"name": "x", "units": "dimensionless", "component": "my_component", "type": VariableType.STATE} +STATE_INFO = {"name": "x", "units": "dimensionless", "component": "my_component"} CONSTANT_INFO = [ ] COMPUTED_CONSTANT_INFO = [ - {"name": "a", "units": "per_s", "component": "my_component", "type": VariableType.COMPUTED_CONSTANT} + {"name": "a", "units": "per_s", "component": "my_component"} ] ALGEBRAIC_INFO = [ diff --git a/tests/resources/generator/ode_const_var_on_rhs/model.c b/tests/resources/generator/ode_const_var_on_rhs/model.c index 9008822215..a0af88531e 100644 --- a/tests/resources/generator/ode_const_var_on_rhs/model.c +++ b/tests/resources/generator/ode_const_var_on_rhs/model.c @@ -13,14 +13,14 @@ const size_t CONSTANT_COUNT = 1; const size_t COMPUTED_CONSTANT_COUNT = 0; const size_t ALGEBRAIC_COUNT = 0; -const VariableInfo VOI_INFO = {"t", "second", "environment", VARIABLE_OF_INTEGRATION}; +const VariableInfo VOI_INFO = {"t", "second", "environment"}; const VariableInfo STATE_INFO[] = { - {"x", "dimensionless", "my_ode", STATE} + {"x", "dimensionless", "my_ode"} }; const VariableInfo CONSTANT_INFO[] = { - {"a", "per_s", "my_ode", CONSTANT} + {"a", "per_s", "my_ode"} }; const VariableInfo COMPUTED_CONSTANT_INFO[] = { diff --git a/tests/resources/generator/ode_const_var_on_rhs/model.h b/tests/resources/generator/ode_const_var_on_rhs/model.h index 35acb14707..8d446982d8 100644 --- a/tests/resources/generator/ode_const_var_on_rhs/model.h +++ b/tests/resources/generator/ode_const_var_on_rhs/model.h @@ -12,19 +12,10 @@ extern const size_t CONSTANT_COUNT; extern const size_t COMPUTED_CONSTANT_COUNT; extern const size_t ALGEBRAIC_COUNT; -typedef enum { - VARIABLE_OF_INTEGRATION, - STATE, - CONSTANT, - COMPUTED_CONSTANT, - ALGEBRAIC -} VariableType; - typedef struct { char name[2]; char units[14]; char component[12]; - VariableType type; } VariableInfo; extern const VariableInfo VOI_INFO; diff --git a/tests/resources/generator/ode_const_var_on_rhs/model.py b/tests/resources/generator/ode_const_var_on_rhs/model.py index 183abb260c..0bf4f4f64f 100644 --- a/tests/resources/generator/ode_const_var_on_rhs/model.py +++ b/tests/resources/generator/ode_const_var_on_rhs/model.py @@ -12,22 +12,13 @@ COMPUTED_CONSTANT_COUNT = 0 ALGEBRAIC_COUNT = 0 +VOI_INFO = {"name": "t", "units": "second", "component": "environment"} -class VariableType(Enum): - VARIABLE_OF_INTEGRATION = 0 - STATE = 1 - CONSTANT = 2 - COMPUTED_CONSTANT = 3 - ALGEBRAIC = 4 - - -VOI_INFO = {"name": "t", "units": "second", "component": "environment", "type": VariableType.VARIABLE_OF_INTEGRATION} - -STATE_INFO = {"name": "x", "units": "dimensionless", "component": "my_ode", "type": VariableType.STATE} +STATE_INFO = {"name": "x", "units": "dimensionless", "component": "my_ode"} CONSTANT_INFO = [ - {"name": "a", "units": "per_s", "component": "my_ode", "type": VariableType.CONSTANT} + {"name": "a", "units": "per_s", "component": "my_ode"} ] COMPUTED_CONSTANT_INFO = [ diff --git a/tests/resources/generator/ode_const_var_on_rhs_one_component/model.c b/tests/resources/generator/ode_const_var_on_rhs_one_component/model.c index c982a3aa03..043bda45b7 100644 --- a/tests/resources/generator/ode_const_var_on_rhs_one_component/model.c +++ b/tests/resources/generator/ode_const_var_on_rhs_one_component/model.c @@ -13,14 +13,14 @@ const size_t CONSTANT_COUNT = 1; const size_t COMPUTED_CONSTANT_COUNT = 0; const size_t ALGEBRAIC_COUNT = 0; -const VariableInfo VOI_INFO = {"t", "second", "my_component", VARIABLE_OF_INTEGRATION}; +const VariableInfo VOI_INFO = {"t", "second", "my_component"}; const VariableInfo STATE_INFO[] = { - {"x", "dimensionless", "my_component", STATE} + {"x", "dimensionless", "my_component"} }; const VariableInfo CONSTANT_INFO[] = { - {"a", "per_s", "my_component", CONSTANT} + {"a", "per_s", "my_component"} }; const VariableInfo COMPUTED_CONSTANT_INFO[] = { diff --git a/tests/resources/generator/ode_const_var_on_rhs_one_component/model.h b/tests/resources/generator/ode_const_var_on_rhs_one_component/model.h index ec10997670..1c36d8d5fc 100644 --- a/tests/resources/generator/ode_const_var_on_rhs_one_component/model.h +++ b/tests/resources/generator/ode_const_var_on_rhs_one_component/model.h @@ -12,19 +12,10 @@ extern const size_t CONSTANT_COUNT; extern const size_t COMPUTED_CONSTANT_COUNT; extern const size_t ALGEBRAIC_COUNT; -typedef enum { - VARIABLE_OF_INTEGRATION, - STATE, - CONSTANT, - COMPUTED_CONSTANT, - ALGEBRAIC -} VariableType; - typedef struct { char name[2]; char units[14]; char component[13]; - VariableType type; } VariableInfo; extern const VariableInfo VOI_INFO; diff --git a/tests/resources/generator/ode_const_var_on_rhs_one_component/model.py b/tests/resources/generator/ode_const_var_on_rhs_one_component/model.py index 7fe189c7a6..ea5912c7da 100644 --- a/tests/resources/generator/ode_const_var_on_rhs_one_component/model.py +++ b/tests/resources/generator/ode_const_var_on_rhs_one_component/model.py @@ -12,22 +12,13 @@ COMPUTED_CONSTANT_COUNT = 0 ALGEBRAIC_COUNT = 0 +VOI_INFO = {"name": "t", "units": "second", "component": "my_component"} -class VariableType(Enum): - VARIABLE_OF_INTEGRATION = 0 - STATE = 1 - CONSTANT = 2 - COMPUTED_CONSTANT = 3 - ALGEBRAIC = 4 - - -VOI_INFO = {"name": "t", "units": "second", "component": "my_component", "type": VariableType.VARIABLE_OF_INTEGRATION} - -STATE_INFO = {"name": "x", "units": "dimensionless", "component": "my_component", "type": VariableType.STATE} +STATE_INFO = {"name": "x", "units": "dimensionless", "component": "my_component"} CONSTANT_INFO = [ - {"name": "a", "units": "per_s", "component": "my_component", "type": VariableType.CONSTANT} + {"name": "a", "units": "per_s", "component": "my_component"} ] COMPUTED_CONSTANT_INFO = [ diff --git a/tests/resources/generator/ode_constant_on_rhs/model.c b/tests/resources/generator/ode_constant_on_rhs/model.c index d1981b0361..67645bc1c0 100644 --- a/tests/resources/generator/ode_constant_on_rhs/model.c +++ b/tests/resources/generator/ode_constant_on_rhs/model.c @@ -13,10 +13,10 @@ const size_t CONSTANT_COUNT = 0; const size_t COMPUTED_CONSTANT_COUNT = 0; const size_t ALGEBRAIC_COUNT = 0; -const VariableInfo VOI_INFO = {"t", "second", "environment", VARIABLE_OF_INTEGRATION}; +const VariableInfo VOI_INFO = {"t", "second", "environment"}; const VariableInfo STATE_INFO[] = { - {"x", "dimensionless", "my_ode", STATE} + {"x", "dimensionless", "my_ode"} }; const VariableInfo CONSTANT_INFO[] = { diff --git a/tests/resources/generator/ode_constant_on_rhs/model.h b/tests/resources/generator/ode_constant_on_rhs/model.h index 35acb14707..8d446982d8 100644 --- a/tests/resources/generator/ode_constant_on_rhs/model.h +++ b/tests/resources/generator/ode_constant_on_rhs/model.h @@ -12,19 +12,10 @@ extern const size_t CONSTANT_COUNT; extern const size_t COMPUTED_CONSTANT_COUNT; extern const size_t ALGEBRAIC_COUNT; -typedef enum { - VARIABLE_OF_INTEGRATION, - STATE, - CONSTANT, - COMPUTED_CONSTANT, - ALGEBRAIC -} VariableType; - typedef struct { char name[2]; char units[14]; char component[12]; - VariableType type; } VariableInfo; extern const VariableInfo VOI_INFO; diff --git a/tests/resources/generator/ode_constant_on_rhs/model.py b/tests/resources/generator/ode_constant_on_rhs/model.py index 1b1b18f967..9147b5ae65 100644 --- a/tests/resources/generator/ode_constant_on_rhs/model.py +++ b/tests/resources/generator/ode_constant_on_rhs/model.py @@ -12,18 +12,9 @@ COMPUTED_CONSTANT_COUNT = 0 ALGEBRAIC_COUNT = 0 +VOI_INFO = {"name": "t", "units": "second", "component": "environment"} -class VariableType(Enum): - VARIABLE_OF_INTEGRATION = 0 - STATE = 1 - CONSTANT = 2 - COMPUTED_CONSTANT = 3 - ALGEBRAIC = 4 - - -VOI_INFO = {"name": "t", "units": "second", "component": "environment", "type": VariableType.VARIABLE_OF_INTEGRATION} - -STATE_INFO = {"name": "x", "units": "dimensionless", "component": "my_ode", "type": VariableType.STATE} +STATE_INFO = {"name": "x", "units": "dimensionless", "component": "my_ode"} CONSTANT_INFO = [ diff --git a/tests/resources/generator/ode_constant_on_rhs_one_component/model.c b/tests/resources/generator/ode_constant_on_rhs_one_component/model.c index e299805f43..0745345648 100644 --- a/tests/resources/generator/ode_constant_on_rhs_one_component/model.c +++ b/tests/resources/generator/ode_constant_on_rhs_one_component/model.c @@ -13,10 +13,10 @@ const size_t CONSTANT_COUNT = 0; const size_t COMPUTED_CONSTANT_COUNT = 0; const size_t ALGEBRAIC_COUNT = 0; -const VariableInfo VOI_INFO = {"t", "second", "my_component", VARIABLE_OF_INTEGRATION}; +const VariableInfo VOI_INFO = {"t", "second", "my_component"}; const VariableInfo STATE_INFO[] = { - {"x", "dimensionless", "my_component", STATE} + {"x", "dimensionless", "my_component"} }; const VariableInfo CONSTANT_INFO[] = { diff --git a/tests/resources/generator/ode_constant_on_rhs_one_component/model.h b/tests/resources/generator/ode_constant_on_rhs_one_component/model.h index ec10997670..1c36d8d5fc 100644 --- a/tests/resources/generator/ode_constant_on_rhs_one_component/model.h +++ b/tests/resources/generator/ode_constant_on_rhs_one_component/model.h @@ -12,19 +12,10 @@ extern const size_t CONSTANT_COUNT; extern const size_t COMPUTED_CONSTANT_COUNT; extern const size_t ALGEBRAIC_COUNT; -typedef enum { - VARIABLE_OF_INTEGRATION, - STATE, - CONSTANT, - COMPUTED_CONSTANT, - ALGEBRAIC -} VariableType; - typedef struct { char name[2]; char units[14]; char component[13]; - VariableType type; } VariableInfo; extern const VariableInfo VOI_INFO; diff --git a/tests/resources/generator/ode_constant_on_rhs_one_component/model.py b/tests/resources/generator/ode_constant_on_rhs_one_component/model.py index 81899058c8..e159a2b5cb 100644 --- a/tests/resources/generator/ode_constant_on_rhs_one_component/model.py +++ b/tests/resources/generator/ode_constant_on_rhs_one_component/model.py @@ -12,18 +12,9 @@ COMPUTED_CONSTANT_COUNT = 0 ALGEBRAIC_COUNT = 0 +VOI_INFO = {"name": "t", "units": "second", "component": "my_component"} -class VariableType(Enum): - VARIABLE_OF_INTEGRATION = 0 - STATE = 1 - CONSTANT = 2 - COMPUTED_CONSTANT = 3 - ALGEBRAIC = 4 - - -VOI_INFO = {"name": "t", "units": "second", "component": "my_component", "type": VariableType.VARIABLE_OF_INTEGRATION} - -STATE_INFO = {"name": "x", "units": "dimensionless", "component": "my_component", "type": VariableType.STATE} +STATE_INFO = {"name": "x", "units": "dimensionless", "component": "my_component"} CONSTANT_INFO = [ diff --git a/tests/resources/generator/ode_multiple_dependent_odes/model.c b/tests/resources/generator/ode_multiple_dependent_odes/model.c index c43f947e75..861ca5c1ab 100644 --- a/tests/resources/generator/ode_multiple_dependent_odes/model.c +++ b/tests/resources/generator/ode_multiple_dependent_odes/model.c @@ -13,15 +13,15 @@ const size_t CONSTANT_COUNT = 1; const size_t COMPUTED_CONSTANT_COUNT = 0; const size_t ALGEBRAIC_COUNT = 0; -const VariableInfo VOI_INFO = {"t", "second", "environment", VARIABLE_OF_INTEGRATION}; +const VariableInfo VOI_INFO = {"t", "second", "environment"}; const VariableInfo STATE_INFO[] = { - {"x", "dimensionless", "my_x_ode", STATE}, - {"y", "dimensionless", "my_y_ode", STATE} + {"x", "dimensionless", "my_x_ode"}, + {"y", "dimensionless", "my_y_ode"} }; const VariableInfo CONSTANT_INFO[] = { - {"epsilon", "dimensionless", "my_y_ode", CONSTANT} + {"epsilon", "dimensionless", "my_y_ode"} }; const VariableInfo COMPUTED_CONSTANT_INFO[] = { diff --git a/tests/resources/generator/ode_multiple_dependent_odes/model.h b/tests/resources/generator/ode_multiple_dependent_odes/model.h index 82e013544d..6b58848d0c 100644 --- a/tests/resources/generator/ode_multiple_dependent_odes/model.h +++ b/tests/resources/generator/ode_multiple_dependent_odes/model.h @@ -12,19 +12,10 @@ extern const size_t CONSTANT_COUNT; extern const size_t COMPUTED_CONSTANT_COUNT; extern const size_t ALGEBRAIC_COUNT; -typedef enum { - VARIABLE_OF_INTEGRATION, - STATE, - CONSTANT, - COMPUTED_CONSTANT, - ALGEBRAIC -} VariableType; - typedef struct { char name[8]; char units[14]; char component[12]; - VariableType type; } VariableInfo; extern const VariableInfo VOI_INFO; diff --git a/tests/resources/generator/ode_multiple_dependent_odes/model.py b/tests/resources/generator/ode_multiple_dependent_odes/model.py index 6edcb43f76..5daabe1bca 100644 --- a/tests/resources/generator/ode_multiple_dependent_odes/model.py +++ b/tests/resources/generator/ode_multiple_dependent_odes/model.py @@ -12,23 +12,14 @@ COMPUTED_CONSTANT_COUNT = 0 ALGEBRAIC_COUNT = 0 +VOI_INFO = {"name": "t", "units": "second", "component": "environment"} -class VariableType(Enum): - VARIABLE_OF_INTEGRATION = 0 - STATE = 1 - CONSTANT = 2 - COMPUTED_CONSTANT = 3 - ALGEBRAIC = 4 - - -VOI_INFO = {"name": "t", "units": "second", "component": "environment", "type": VariableType.VARIABLE_OF_INTEGRATION} - -STATE_INFO = {"name": "x", "units": "dimensionless", "component": "my_x_ode", "type": VariableType.STATE}, - {"name": "y", "units": "dimensionless", "component": "my_y_ode", "type": VariableType.STATE} +STATE_INFO = {"name": "x", "units": "dimensionless", "component": "my_x_ode"}, + {"name": "y", "units": "dimensionless", "component": "my_y_ode"} CONSTANT_INFO = [ - {"name": "epsilon", "units": "dimensionless", "component": "my_y_ode", "type": VariableType.CONSTANT} + {"name": "epsilon", "units": "dimensionless", "component": "my_y_ode"} ] COMPUTED_CONSTANT_INFO = [ diff --git a/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.c b/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.c index 9e5d0e2959..f4347cdb63 100644 --- a/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.c +++ b/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.c @@ -13,15 +13,15 @@ const size_t CONSTANT_COUNT = 1; const size_t COMPUTED_CONSTANT_COUNT = 0; const size_t ALGEBRAIC_COUNT = 0; -const VariableInfo VOI_INFO = {"t", "second", "my_component", VARIABLE_OF_INTEGRATION}; +const VariableInfo VOI_INFO = {"t", "second", "my_component"}; const VariableInfo STATE_INFO[] = { - {"x", "dimensionless", "my_component", STATE}, - {"y", "dimensionless", "my_component", STATE} + {"x", "dimensionless", "my_component"}, + {"y", "dimensionless", "my_component"} }; const VariableInfo CONSTANT_INFO[] = { - {"epsilon", "dimensionless", "my_component", CONSTANT} + {"epsilon", "dimensionless", "my_component"} }; const VariableInfo COMPUTED_CONSTANT_INFO[] = { diff --git a/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.h b/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.h index 021fc35210..e4d23b9b6d 100644 --- a/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.h +++ b/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.h @@ -12,19 +12,10 @@ extern const size_t CONSTANT_COUNT; extern const size_t COMPUTED_CONSTANT_COUNT; extern const size_t ALGEBRAIC_COUNT; -typedef enum { - VARIABLE_OF_INTEGRATION, - STATE, - CONSTANT, - COMPUTED_CONSTANT, - ALGEBRAIC -} VariableType; - typedef struct { char name[8]; char units[14]; char component[13]; - VariableType type; } VariableInfo; extern const VariableInfo VOI_INFO; diff --git a/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.py b/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.py index adbe50fe77..073d05fac3 100644 --- a/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.py +++ b/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.py @@ -12,23 +12,14 @@ COMPUTED_CONSTANT_COUNT = 0 ALGEBRAIC_COUNT = 0 +VOI_INFO = {"name": "t", "units": "second", "component": "my_component"} -class VariableType(Enum): - VARIABLE_OF_INTEGRATION = 0 - STATE = 1 - CONSTANT = 2 - COMPUTED_CONSTANT = 3 - ALGEBRAIC = 4 - - -VOI_INFO = {"name": "t", "units": "second", "component": "my_component", "type": VariableType.VARIABLE_OF_INTEGRATION} - -STATE_INFO = {"name": "x", "units": "dimensionless", "component": "my_component", "type": VariableType.STATE}, - {"name": "y", "units": "dimensionless", "component": "my_component", "type": VariableType.STATE} +STATE_INFO = {"name": "x", "units": "dimensionless", "component": "my_component"}, + {"name": "y", "units": "dimensionless", "component": "my_component"} CONSTANT_INFO = [ - {"name": "epsilon", "units": "dimensionless", "component": "my_component", "type": VariableType.CONSTANT} + {"name": "epsilon", "units": "dimensionless", "component": "my_component"} ] COMPUTED_CONSTANT_INFO = [ diff --git a/tests/resources/generator/ode_multiple_odes_with_same_name/model.c b/tests/resources/generator/ode_multiple_odes_with_same_name/model.c index 4caef92311..140486722f 100644 --- a/tests/resources/generator/ode_multiple_odes_with_same_name/model.c +++ b/tests/resources/generator/ode_multiple_odes_with_same_name/model.c @@ -13,15 +13,15 @@ const size_t CONSTANT_COUNT = 1; const size_t COMPUTED_CONSTANT_COUNT = 0; const size_t ALGEBRAIC_COUNT = 0; -const VariableInfo VOI_INFO = {"t", "second", "environment", VARIABLE_OF_INTEGRATION}; +const VariableInfo VOI_INFO = {"t", "second", "environment"}; const VariableInfo STATE_INFO[] = { - {"x", "dimensionless", "my_first_ode", STATE}, - {"x", "dimensionless", "my_second_ode", STATE} + {"x", "dimensionless", "my_first_ode"}, + {"x", "dimensionless", "my_second_ode"} }; const VariableInfo CONSTANT_INFO[] = { - {"a", "per_s", "my_second_ode", CONSTANT} + {"a", "per_s", "my_second_ode"} }; const VariableInfo COMPUTED_CONSTANT_INFO[] = { diff --git a/tests/resources/generator/ode_multiple_odes_with_same_name/model.h b/tests/resources/generator/ode_multiple_odes_with_same_name/model.h index 41b1e7be52..5c800ad653 100644 --- a/tests/resources/generator/ode_multiple_odes_with_same_name/model.h +++ b/tests/resources/generator/ode_multiple_odes_with_same_name/model.h @@ -12,19 +12,10 @@ extern const size_t CONSTANT_COUNT; extern const size_t COMPUTED_CONSTANT_COUNT; extern const size_t ALGEBRAIC_COUNT; -typedef enum { - VARIABLE_OF_INTEGRATION, - STATE, - CONSTANT, - COMPUTED_CONSTANT, - ALGEBRAIC -} VariableType; - typedef struct { char name[2]; char units[14]; char component[14]; - VariableType type; } VariableInfo; extern const VariableInfo VOI_INFO; diff --git a/tests/resources/generator/ode_multiple_odes_with_same_name/model.py b/tests/resources/generator/ode_multiple_odes_with_same_name/model.py index d23db44675..ebce3e2e6c 100644 --- a/tests/resources/generator/ode_multiple_odes_with_same_name/model.py +++ b/tests/resources/generator/ode_multiple_odes_with_same_name/model.py @@ -12,23 +12,14 @@ COMPUTED_CONSTANT_COUNT = 0 ALGEBRAIC_COUNT = 0 +VOI_INFO = {"name": "t", "units": "second", "component": "environment"} -class VariableType(Enum): - VARIABLE_OF_INTEGRATION = 0 - STATE = 1 - CONSTANT = 2 - COMPUTED_CONSTANT = 3 - ALGEBRAIC = 4 - - -VOI_INFO = {"name": "t", "units": "second", "component": "environment", "type": VariableType.VARIABLE_OF_INTEGRATION} - -STATE_INFO = {"name": "x", "units": "dimensionless", "component": "my_first_ode", "type": VariableType.STATE}, - {"name": "x", "units": "dimensionless", "component": "my_second_ode", "type": VariableType.STATE} +STATE_INFO = {"name": "x", "units": "dimensionless", "component": "my_first_ode"}, + {"name": "x", "units": "dimensionless", "component": "my_second_ode"} CONSTANT_INFO = [ - {"name": "a", "units": "per_s", "component": "my_second_ode", "type": VariableType.CONSTANT} + {"name": "a", "units": "per_s", "component": "my_second_ode"} ] COMPUTED_CONSTANT_INFO = [ diff --git a/tests/resources/generator/ode_unknown_var_on_rhs/model.c b/tests/resources/generator/ode_unknown_var_on_rhs/model.c index ab500425be..a27eb2cf0b 100644 --- a/tests/resources/generator/ode_unknown_var_on_rhs/model.c +++ b/tests/resources/generator/ode_unknown_var_on_rhs/model.c @@ -13,11 +13,11 @@ const size_t CONSTANT_COUNT = 0; const size_t COMPUTED_CONSTANT_COUNT = 0; const size_t ALGEBRAIC_COUNT = 0; -const VariableInfo VOI_INFO = {"t", "second", "environment", VARIABLE_OF_INTEGRATION}; +const VariableInfo VOI_INFO = {"t", "second", "environment"}; const VariableInfo STATE_INFO[] = { - {"x", "dimensionless", "my_ode", STATE}, - {"y", "dimensionless", "my_ode", STATE} + {"x", "dimensionless", "my_ode"}, + {"y", "dimensionless", "my_ode"} }; const VariableInfo CONSTANT_INFO[] = { diff --git a/tests/resources/generator/ode_unknown_var_on_rhs/model.h b/tests/resources/generator/ode_unknown_var_on_rhs/model.h index 35acb14707..8d446982d8 100644 --- a/tests/resources/generator/ode_unknown_var_on_rhs/model.h +++ b/tests/resources/generator/ode_unknown_var_on_rhs/model.h @@ -12,19 +12,10 @@ extern const size_t CONSTANT_COUNT; extern const size_t COMPUTED_CONSTANT_COUNT; extern const size_t ALGEBRAIC_COUNT; -typedef enum { - VARIABLE_OF_INTEGRATION, - STATE, - CONSTANT, - COMPUTED_CONSTANT, - ALGEBRAIC -} VariableType; - typedef struct { char name[2]; char units[14]; char component[12]; - VariableType type; } VariableInfo; extern const VariableInfo VOI_INFO; diff --git a/tests/resources/generator/ode_unknown_var_on_rhs/model.py b/tests/resources/generator/ode_unknown_var_on_rhs/model.py index f7b81c3c3a..9e678173dd 100644 --- a/tests/resources/generator/ode_unknown_var_on_rhs/model.py +++ b/tests/resources/generator/ode_unknown_var_on_rhs/model.py @@ -12,19 +12,10 @@ COMPUTED_CONSTANT_COUNT = 0 ALGEBRAIC_COUNT = 0 +VOI_INFO = {"name": "t", "units": "second", "component": "environment"} -class VariableType(Enum): - VARIABLE_OF_INTEGRATION = 0 - STATE = 1 - CONSTANT = 2 - COMPUTED_CONSTANT = 3 - ALGEBRAIC = 4 - - -VOI_INFO = {"name": "t", "units": "second", "component": "environment", "type": VariableType.VARIABLE_OF_INTEGRATION} - -STATE_INFO = {"name": "x", "units": "dimensionless", "component": "my_ode", "type": VariableType.STATE}, - {"name": "y", "units": "dimensionless", "component": "my_ode", "type": VariableType.STATE} +STATE_INFO = {"name": "x", "units": "dimensionless", "component": "my_ode"}, + {"name": "y", "units": "dimensionless", "component": "my_ode"} CONSTANT_INFO = [ diff --git a/tests/resources/generator/robertson_model_1966/model.dae.c b/tests/resources/generator/robertson_model_1966/model.dae.c index 01a0c5db85..1c4dbb976a 100644 --- a/tests/resources/generator/robertson_model_1966/model.dae.c +++ b/tests/resources/generator/robertson_model_1966/model.dae.c @@ -13,25 +13,25 @@ const size_t CONSTANT_COUNT = 3; const size_t COMPUTED_CONSTANT_COUNT = 0; const size_t ALGEBRAIC_COUNT = 2; -const VariableInfo VOI_INFO = {"t", "dimensionless", "main", VARIABLE_OF_INTEGRATION}; +const VariableInfo VOI_INFO = {"t", "dimensionless", "main"}; const VariableInfo STATE_INFO[] = { - {"y1", "dimensionless", "main", STATE}, - {"y2", "dimensionless", "main", STATE} + {"y1", "dimensionless", "main"}, + {"y2", "dimensionless", "main"} }; const VariableInfo CONSTANT_INFO[] = { - {"k1", "dimensionless", "main", CONSTANT}, - {"k3", "dimensionless", "main", CONSTANT}, - {"k2", "dimensionless", "main", CONSTANT} + {"k1", "dimensionless", "main"}, + {"k3", "dimensionless", "main"}, + {"k2", "dimensionless", "main"} }; const VariableInfo COMPUTED_CONSTANT_INFO[] = { }; const VariableInfo ALGEBRAIC_INFO[] = { - {"y3", "dimensionless", "main", ALGEBRAIC}, - {"y2_scaled", "dimensionless", "main", ALGEBRAIC} + {"y3", "dimensionless", "main"}, + {"y2_scaled", "dimensionless", "main"} }; double * createStatesArray() diff --git a/tests/resources/generator/robertson_model_1966/model.dae.h b/tests/resources/generator/robertson_model_1966/model.dae.h index f41a8e9e90..03322f766b 100644 --- a/tests/resources/generator/robertson_model_1966/model.dae.h +++ b/tests/resources/generator/robertson_model_1966/model.dae.h @@ -12,19 +12,10 @@ extern const size_t CONSTANT_COUNT; extern const size_t COMPUTED_CONSTANT_COUNT; extern const size_t ALGEBRAIC_COUNT; -typedef enum { - VARIABLE_OF_INTEGRATION, - STATE, - CONSTANT, - COMPUTED_CONSTANT, - ALGEBRAIC -} VariableType; - typedef struct { char name[10]; char units[14]; char component[5]; - VariableType type; } VariableInfo; extern const VariableInfo VOI_INFO; diff --git a/tests/resources/generator/robertson_model_1966/model.dae.py b/tests/resources/generator/robertson_model_1966/model.dae.py index 41f161a812..83ae000499 100644 --- a/tests/resources/generator/robertson_model_1966/model.dae.py +++ b/tests/resources/generator/robertson_model_1966/model.dae.py @@ -12,33 +12,24 @@ COMPUTED_CONSTANT_COUNT = 0 ALGEBRAIC_COUNT = 2 +VOI_INFO = {"name": "t", "units": "dimensionless", "component": "main"} -class VariableType(Enum): - VARIABLE_OF_INTEGRATION = 0 - STATE = 1 - CONSTANT = 2 - COMPUTED_CONSTANT = 3 - ALGEBRAIC = 4 - - -VOI_INFO = {"name": "t", "units": "dimensionless", "component": "main", "type": VariableType.VARIABLE_OF_INTEGRATION} - -STATE_INFO = {"name": "y1", "units": "dimensionless", "component": "main", "type": VariableType.STATE}, - {"name": "y2", "units": "dimensionless", "component": "main", "type": VariableType.STATE} +STATE_INFO = {"name": "y1", "units": "dimensionless", "component": "main"}, + {"name": "y2", "units": "dimensionless", "component": "main"} CONSTANT_INFO = [ - {"name": "k1", "units": "dimensionless", "component": "main", "type": VariableType.CONSTANT}, - {"name": "k3", "units": "dimensionless", "component": "main", "type": VariableType.CONSTANT}, - {"name": "k2", "units": "dimensionless", "component": "main", "type": VariableType.CONSTANT} + {"name": "k1", "units": "dimensionless", "component": "main"}, + {"name": "k3", "units": "dimensionless", "component": "main"}, + {"name": "k2", "units": "dimensionless", "component": "main"} ] COMPUTED_CONSTANT_INFO = [ ] ALGEBRAIC_INFO = [ - {"name": "y3", "units": "dimensionless", "component": "main", "type": VariableType.ALGEBRAIC}, - {"name": "y2_scaled", "units": "dimensionless", "component": "main", "type": VariableType.ALGEBRAIC} + {"name": "y3", "units": "dimensionless", "component": "main"}, + {"name": "y2_scaled", "units": "dimensionless", "component": "main"} ] diff --git a/tests/resources/generator/robertson_model_1966/model.ode.c b/tests/resources/generator/robertson_model_1966/model.ode.c index fef5b5c53f..ead2f08800 100644 --- a/tests/resources/generator/robertson_model_1966/model.ode.c +++ b/tests/resources/generator/robertson_model_1966/model.ode.c @@ -13,25 +13,25 @@ const size_t CONSTANT_COUNT = 3; const size_t COMPUTED_CONSTANT_COUNT = 0; const size_t ALGEBRAIC_COUNT = 1; -const VariableInfo VOI_INFO = {"t", "dimensionless", "main", VARIABLE_OF_INTEGRATION}; +const VariableInfo VOI_INFO = {"t", "dimensionless", "main"}; const VariableInfo STATE_INFO[] = { - {"y1", "dimensionless", "main", STATE}, - {"y3", "dimensionless", "main", STATE}, - {"y2", "dimensionless", "main", STATE} + {"y1", "dimensionless", "main"}, + {"y3", "dimensionless", "main"}, + {"y2", "dimensionless", "main"} }; const VariableInfo CONSTANT_INFO[] = { - {"k1", "dimensionless", "main", CONSTANT}, - {"k3", "dimensionless", "main", CONSTANT}, - {"k2", "dimensionless", "main", CONSTANT} + {"k1", "dimensionless", "main"}, + {"k3", "dimensionless", "main"}, + {"k2", "dimensionless", "main"} }; const VariableInfo COMPUTED_CONSTANT_INFO[] = { }; const VariableInfo ALGEBRAIC_INFO[] = { - {"y2_scaled", "dimensionless", "main", ALGEBRAIC} + {"y2_scaled", "dimensionless", "main"} }; double * createStatesArray() diff --git a/tests/resources/generator/robertson_model_1966/model.ode.h b/tests/resources/generator/robertson_model_1966/model.ode.h index f41a8e9e90..03322f766b 100644 --- a/tests/resources/generator/robertson_model_1966/model.ode.h +++ b/tests/resources/generator/robertson_model_1966/model.ode.h @@ -12,19 +12,10 @@ extern const size_t CONSTANT_COUNT; extern const size_t COMPUTED_CONSTANT_COUNT; extern const size_t ALGEBRAIC_COUNT; -typedef enum { - VARIABLE_OF_INTEGRATION, - STATE, - CONSTANT, - COMPUTED_CONSTANT, - ALGEBRAIC -} VariableType; - typedef struct { char name[10]; char units[14]; char component[5]; - VariableType type; } VariableInfo; extern const VariableInfo VOI_INFO; diff --git a/tests/resources/generator/robertson_model_1966/model.ode.py b/tests/resources/generator/robertson_model_1966/model.ode.py index 832cb289de..6fd0e88e15 100644 --- a/tests/resources/generator/robertson_model_1966/model.ode.py +++ b/tests/resources/generator/robertson_model_1966/model.ode.py @@ -12,33 +12,24 @@ COMPUTED_CONSTANT_COUNT = 0 ALGEBRAIC_COUNT = 1 +VOI_INFO = {"name": "t", "units": "dimensionless", "component": "main"} -class VariableType(Enum): - VARIABLE_OF_INTEGRATION = 0 - STATE = 1 - CONSTANT = 2 - COMPUTED_CONSTANT = 3 - ALGEBRAIC = 4 - - -VOI_INFO = {"name": "t", "units": "dimensionless", "component": "main", "type": VariableType.VARIABLE_OF_INTEGRATION} - -STATE_INFO = {"name": "y1", "units": "dimensionless", "component": "main", "type": VariableType.STATE}, - {"name": "y3", "units": "dimensionless", "component": "main", "type": VariableType.STATE}, - {"name": "y2", "units": "dimensionless", "component": "main", "type": VariableType.STATE} +STATE_INFO = {"name": "y1", "units": "dimensionless", "component": "main"}, + {"name": "y3", "units": "dimensionless", "component": "main"}, + {"name": "y2", "units": "dimensionless", "component": "main"} CONSTANT_INFO = [ - {"name": "k1", "units": "dimensionless", "component": "main", "type": VariableType.CONSTANT}, - {"name": "k3", "units": "dimensionless", "component": "main", "type": VariableType.CONSTANT}, - {"name": "k2", "units": "dimensionless", "component": "main", "type": VariableType.CONSTANT} + {"name": "k1", "units": "dimensionless", "component": "main"}, + {"name": "k3", "units": "dimensionless", "component": "main"}, + {"name": "k2", "units": "dimensionless", "component": "main"} ] COMPUTED_CONSTANT_INFO = [ ] ALGEBRAIC_INFO = [ - {"name": "y2_scaled", "units": "dimensionless", "component": "main", "type": VariableType.ALGEBRAIC} + {"name": "y2_scaled", "units": "dimensionless", "component": "main"} ] diff --git a/tests/resources/generator/sine_model_imports/model.c b/tests/resources/generator/sine_model_imports/model.c index ddc2826b8c..d03b04f92f 100644 --- a/tests/resources/generator/sine_model_imports/model.c +++ b/tests/resources/generator/sine_model_imports/model.c @@ -13,29 +13,29 @@ const size_t CONSTANT_COUNT = 2; const size_t COMPUTED_CONSTANT_COUNT = 5; const size_t ALGEBRAIC_COUNT = 3; -const VariableInfo VOI_INFO = {"x", "dimensionless", "main", VARIABLE_OF_INTEGRATION}; +const VariableInfo VOI_INFO = {"x", "dimensionless", "main"}; const VariableInfo STATE_INFO[] = { - {"sin", "dimensionless", "deriv_approx_sin", STATE} + {"sin", "dimensionless", "deriv_approx_sin"} }; const VariableInfo CONSTANT_INFO[] = { - {"deriv_approx_initial_value", "dimensionless", "main", CONSTANT}, - {"C", "dimensionless", "main", CONSTANT} + {"deriv_approx_initial_value", "dimensionless", "main"}, + {"C", "dimensionless", "main"} }; const VariableInfo COMPUTED_CONSTANT_INFO[] = { - {"k2_oPi", "dimensionless", "parabolic_approx_sin", COMPUTED_CONSTANT}, - {"k2Pi", "dimensionless", "parabolic_approx_sin", COMPUTED_CONSTANT}, - {"kPi_2", "dimensionless", "parabolic_approx_sin", COMPUTED_CONSTANT}, - {"kPi", "dimensionless", "parabolic_approx_sin", COMPUTED_CONSTANT}, - {"kPi_32", "dimensionless", "parabolic_approx_sin", COMPUTED_CONSTANT} + {"k2_oPi", "dimensionless", "parabolic_approx_sin"}, + {"k2Pi", "dimensionless", "parabolic_approx_sin"}, + {"kPi_2", "dimensionless", "parabolic_approx_sin"}, + {"kPi", "dimensionless", "parabolic_approx_sin"}, + {"kPi_32", "dimensionless", "parabolic_approx_sin"} }; const VariableInfo ALGEBRAIC_INFO[] = { - {"sin", "dimensionless", "actual_sin", ALGEBRAIC}, - {"sin", "dimensionless", "parabolic_approx_sin", ALGEBRAIC}, - {"z", "dimensionless", "parabolic_approx_sin", ALGEBRAIC} + {"sin", "dimensionless", "actual_sin"}, + {"sin", "dimensionless", "parabolic_approx_sin"}, + {"z", "dimensionless", "parabolic_approx_sin"} }; double * createStatesArray() diff --git a/tests/resources/generator/sine_model_imports/model.h b/tests/resources/generator/sine_model_imports/model.h index fa49280dca..67daeb3450 100644 --- a/tests/resources/generator/sine_model_imports/model.h +++ b/tests/resources/generator/sine_model_imports/model.h @@ -12,19 +12,10 @@ extern const size_t CONSTANT_COUNT; extern const size_t COMPUTED_CONSTANT_COUNT; extern const size_t ALGEBRAIC_COUNT; -typedef enum { - VARIABLE_OF_INTEGRATION, - STATE, - CONSTANT, - COMPUTED_CONSTANT, - ALGEBRAIC -} VariableType; - typedef struct { char name[27]; char units[14]; char component[21]; - VariableType type; } VariableInfo; extern const VariableInfo VOI_INFO; diff --git a/tests/resources/generator/sine_model_imports/model.py b/tests/resources/generator/sine_model_imports/model.py index ed86aa9c59..73c276d42b 100644 --- a/tests/resources/generator/sine_model_imports/model.py +++ b/tests/resources/generator/sine_model_imports/model.py @@ -12,37 +12,28 @@ COMPUTED_CONSTANT_COUNT = 5 ALGEBRAIC_COUNT = 3 +VOI_INFO = {"name": "x", "units": "dimensionless", "component": "main"} -class VariableType(Enum): - VARIABLE_OF_INTEGRATION = 0 - STATE = 1 - CONSTANT = 2 - COMPUTED_CONSTANT = 3 - ALGEBRAIC = 4 - - -VOI_INFO = {"name": "x", "units": "dimensionless", "component": "main", "type": VariableType.VARIABLE_OF_INTEGRATION} - -STATE_INFO = {"name": "sin", "units": "dimensionless", "component": "deriv_approx_sin", "type": VariableType.STATE} +STATE_INFO = {"name": "sin", "units": "dimensionless", "component": "deriv_approx_sin"} CONSTANT_INFO = [ - {"name": "deriv_approx_initial_value", "units": "dimensionless", "component": "main", "type": VariableType.CONSTANT}, - {"name": "C", "units": "dimensionless", "component": "main", "type": VariableType.CONSTANT} + {"name": "deriv_approx_initial_value", "units": "dimensionless", "component": "main"}, + {"name": "C", "units": "dimensionless", "component": "main"} ] COMPUTED_CONSTANT_INFO = [ - {"name": "k2_oPi", "units": "dimensionless", "component": "parabolic_approx_sin", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "k2Pi", "units": "dimensionless", "component": "parabolic_approx_sin", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "kPi_2", "units": "dimensionless", "component": "parabolic_approx_sin", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "kPi", "units": "dimensionless", "component": "parabolic_approx_sin", "type": VariableType.COMPUTED_CONSTANT}, - {"name": "kPi_32", "units": "dimensionless", "component": "parabolic_approx_sin", "type": VariableType.COMPUTED_CONSTANT} + {"name": "k2_oPi", "units": "dimensionless", "component": "parabolic_approx_sin"}, + {"name": "k2Pi", "units": "dimensionless", "component": "parabolic_approx_sin"}, + {"name": "kPi_2", "units": "dimensionless", "component": "parabolic_approx_sin"}, + {"name": "kPi", "units": "dimensionless", "component": "parabolic_approx_sin"}, + {"name": "kPi_32", "units": "dimensionless", "component": "parabolic_approx_sin"} ] ALGEBRAIC_INFO = [ - {"name": "sin", "units": "dimensionless", "component": "actual_sin", "type": VariableType.ALGEBRAIC}, - {"name": "sin", "units": "dimensionless", "component": "parabolic_approx_sin", "type": VariableType.ALGEBRAIC}, - {"name": "z", "units": "dimensionless", "component": "parabolic_approx_sin", "type": VariableType.ALGEBRAIC} + {"name": "sin", "units": "dimensionless", "component": "actual_sin"}, + {"name": "sin", "units": "dimensionless", "component": "parabolic_approx_sin"}, + {"name": "z", "units": "dimensionless", "component": "parabolic_approx_sin"} ] diff --git a/tests/resources/generator/unknown_variable_as_external_variable/model.c b/tests/resources/generator/unknown_variable_as_external_variable/model.c index 8fb19598c7..7ca1689b4b 100644 --- a/tests/resources/generator/unknown_variable_as_external_variable/model.c +++ b/tests/resources/generator/unknown_variable_as_external_variable/model.c @@ -14,25 +14,25 @@ const size_t ALGEBRAIC_COUNT = 1; const size_t EXTERNAL_COUNT = 1; const VariableInfo CONSTANT_INFO[] = { - {"E", "fmol", "SLC_template3_ss", CONSTANT}, - {"P_0", "per_fmol_sec4", "SLC_template3_ss", CONSTANT}, - {"q_Ao", "fmol", "SLC_template3_ss", CONSTANT}, - {"P_1", "per_fmol_sec4", "SLC_template3_ss", CONSTANT}, - {"q_Ai", "fmol", "SLC_template3_ss", CONSTANT}, - {"P_2", "per_fmol_sec3", "SLC_template3_ss", CONSTANT}, - {"P_5", "per_sec3", "SLC_template3_ss", CONSTANT}, - {"P_4", "per_fmol2_sec3", "SLC_template3_ss", CONSTANT} + {"E", "fmol", "SLC_template3_ss"}, + {"P_0", "per_fmol_sec4", "SLC_template3_ss"}, + {"q_Ao", "fmol", "SLC_template3_ss"}, + {"P_1", "per_fmol_sec4", "SLC_template3_ss"}, + {"q_Ai", "fmol", "SLC_template3_ss"}, + {"P_2", "per_fmol_sec3", "SLC_template3_ss"}, + {"P_5", "per_sec3", "SLC_template3_ss"}, + {"P_4", "per_fmol2_sec3", "SLC_template3_ss"} }; const VariableInfo COMPUTED_CONSTANT_INFO[] = { }; const VariableInfo ALGEBRAIC_INFO[] = { - {"v", "fmol_per_sec", "SLC_template3_ss", ALGEBRAIC} + {"v", "fmol_per_sec", "SLC_template3_ss"} }; const VariableInfo EXTERNAL_INFO[] = { - {"P_3", "per_fmol_sec3", "SLC_template3_ss", EXTERNAL} + {"P_3", "per_fmol_sec3", "SLC_template3_ss"} }; double * createVariablesArray() diff --git a/tests/resources/generator/unknown_variable_as_external_variable/model.h b/tests/resources/generator/unknown_variable_as_external_variable/model.h index 19a59cbdf0..5cbdcf0fb9 100644 --- a/tests/resources/generator/unknown_variable_as_external_variable/model.h +++ b/tests/resources/generator/unknown_variable_as_external_variable/model.h @@ -12,18 +12,10 @@ extern const size_t COMPUTED_CONSTANT_COUNT; extern const size_t ALGEBRAIC_COUNT; extern const size_t EXTERNAL_COUNT; -typedef enum { - CONSTANT, - COMPUTED_CONSTANT, - ALGEBRAIC, - EXTERNAL -} VariableType; - typedef struct { char name[5]; char units[15]; char component[17]; - VariableType type; } VariableInfo; extern const VariableInfo CONSTANT_INFO[]; diff --git a/tests/resources/generator/unknown_variable_as_external_variable/model.py b/tests/resources/generator/unknown_variable_as_external_variable/model.py index f0888ac184..6b40d05ecf 100644 --- a/tests/resources/generator/unknown_variable_as_external_variable/model.py +++ b/tests/resources/generator/unknown_variable_as_external_variable/model.py @@ -12,34 +12,26 @@ ALGEBRAIC_COUNT = 1 EXTERNAL_COUNT = 1 - -class VariableType(Enum): - CONSTANT = 0 - COMPUTED_CONSTANT = 1 - ALGEBRAIC = 2 - EXTERNAL = 3 - - CONSTANT_INFO = [ - {"name": "E", "units": "fmol", "component": "SLC_template3_ss", "type": VariableType.CONSTANT}, - {"name": "P_0", "units": "per_fmol_sec4", "component": "SLC_template3_ss", "type": VariableType.CONSTANT}, - {"name": "q_Ao", "units": "fmol", "component": "SLC_template3_ss", "type": VariableType.CONSTANT}, - {"name": "P_1", "units": "per_fmol_sec4", "component": "SLC_template3_ss", "type": VariableType.CONSTANT}, - {"name": "q_Ai", "units": "fmol", "component": "SLC_template3_ss", "type": VariableType.CONSTANT}, - {"name": "P_2", "units": "per_fmol_sec3", "component": "SLC_template3_ss", "type": VariableType.CONSTANT}, - {"name": "P_5", "units": "per_sec3", "component": "SLC_template3_ss", "type": VariableType.CONSTANT}, - {"name": "P_4", "units": "per_fmol2_sec3", "component": "SLC_template3_ss", "type": VariableType.CONSTANT} + {"name": "E", "units": "fmol", "component": "SLC_template3_ss"}, + {"name": "P_0", "units": "per_fmol_sec4", "component": "SLC_template3_ss"}, + {"name": "q_Ao", "units": "fmol", "component": "SLC_template3_ss"}, + {"name": "P_1", "units": "per_fmol_sec4", "component": "SLC_template3_ss"}, + {"name": "q_Ai", "units": "fmol", "component": "SLC_template3_ss"}, + {"name": "P_2", "units": "per_fmol_sec3", "component": "SLC_template3_ss"}, + {"name": "P_5", "units": "per_sec3", "component": "SLC_template3_ss"}, + {"name": "P_4", "units": "per_fmol2_sec3", "component": "SLC_template3_ss"} ] COMPUTED_CONSTANT_INFO = [ ] ALGEBRAIC_INFO = [ - {"name": "v", "units": "fmol_per_sec", "component": "SLC_template3_ss", "type": VariableType.ALGEBRAIC} + {"name": "v", "units": "fmol_per_sec", "component": "SLC_template3_ss"} ] EXTERNAL_INFO = [ - {"name": "P_3", "units": "per_fmol_sec3", "component": "SLC_template3_ss", "type": VariableType.EXTERNAL} + {"name": "P_3", "units": "per_fmol_sec3", "component": "SLC_template3_ss"} ] diff --git a/tests/resources/generator/variable_initialised_using_a_constant/model.c b/tests/resources/generator/variable_initialised_using_a_constant/model.c index eecc37c615..f07d911126 100644 --- a/tests/resources/generator/variable_initialised_using_a_constant/model.c +++ b/tests/resources/generator/variable_initialised_using_a_constant/model.c @@ -13,14 +13,14 @@ const size_t CONSTANT_COUNT = 1; const size_t COMPUTED_CONSTANT_COUNT = 0; const size_t ALGEBRAIC_COUNT = 0; -const VariableInfo VOI_INFO = {"t", "second", "component_1", VARIABLE_OF_INTEGRATION}; +const VariableInfo VOI_INFO = {"t", "second", "component_1"}; const VariableInfo STATE_INFO[] = { - {"X", "dimensionless", "component_1", STATE} + {"X", "dimensionless", "component_1"} }; const VariableInfo CONSTANT_INFO[] = { - {"X_init", "dimensionless", "component_2", CONSTANT} + {"X_init", "dimensionless", "component_2"} }; const VariableInfo COMPUTED_CONSTANT_INFO[] = { diff --git a/tests/resources/generator/variable_initialised_using_a_constant/model.h b/tests/resources/generator/variable_initialised_using_a_constant/model.h index 0db53022c6..401821925f 100644 --- a/tests/resources/generator/variable_initialised_using_a_constant/model.h +++ b/tests/resources/generator/variable_initialised_using_a_constant/model.h @@ -12,19 +12,10 @@ extern const size_t CONSTANT_COUNT; extern const size_t COMPUTED_CONSTANT_COUNT; extern const size_t ALGEBRAIC_COUNT; -typedef enum { - VARIABLE_OF_INTEGRATION, - STATE, - CONSTANT, - COMPUTED_CONSTANT, - ALGEBRAIC -} VariableType; - typedef struct { char name[7]; char units[14]; char component[12]; - VariableType type; } VariableInfo; extern const VariableInfo VOI_INFO; diff --git a/tests/resources/generator/variable_initialised_using_a_constant/model.py b/tests/resources/generator/variable_initialised_using_a_constant/model.py index a2dd6a166e..c532e1007b 100644 --- a/tests/resources/generator/variable_initialised_using_a_constant/model.py +++ b/tests/resources/generator/variable_initialised_using_a_constant/model.py @@ -12,22 +12,13 @@ COMPUTED_CONSTANT_COUNT = 0 ALGEBRAIC_COUNT = 0 +VOI_INFO = {"name": "t", "units": "second", "component": "component_1"} -class VariableType(Enum): - VARIABLE_OF_INTEGRATION = 0 - STATE = 1 - CONSTANT = 2 - COMPUTED_CONSTANT = 3 - ALGEBRAIC = 4 - - -VOI_INFO = {"name": "t", "units": "second", "component": "component_1", "type": VariableType.VARIABLE_OF_INTEGRATION} - -STATE_INFO = {"name": "X", "units": "dimensionless", "component": "component_1", "type": VariableType.STATE} +STATE_INFO = {"name": "X", "units": "dimensionless", "component": "component_1"} CONSTANT_INFO = [ - {"name": "X_init", "units": "dimensionless", "component": "component_2", "type": VariableType.CONSTANT} + {"name": "X_init", "units": "dimensionless", "component": "component_2"} ] COMPUTED_CONSTANT_INFO = [ From 330f6d63a3c5a9a608ccfb28d5db5c81dcc2f79d Mon Sep 17 00:00:00 2001 From: Alan Garny Date: Wed, 14 Aug 2024 16:07:08 +0200 Subject: [PATCH 21/85] GeneratorProfile: extracted generator profile_p.h. --- src/CMakeLists.txt | 1 + src/generator.cpp | 6 +- src/generatorprofile.cpp | 282 +----------------------------------- src/generatorprofile_p.h | 302 +++++++++++++++++++++++++++++++++++++++ 4 files changed, 307 insertions(+), 284 deletions(-) create mode 100644 src/generatorprofile_p.h diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index eb748bf9aa..82d4676d18 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -133,6 +133,7 @@ set(GIT_HEADER_FILES ${CMAKE_CURRENT_SOURCE_DIR}/debug.h ${CMAKE_CURRENT_SOURCE_DIR}/entity_p.h ${CMAKE_CURRENT_SOURCE_DIR}/generator_p.h + ${CMAKE_CURRENT_SOURCE_DIR}/generatorprofile_p.h ${CMAKE_CURRENT_SOURCE_DIR}/generatorprofilesha1values.h ${CMAKE_CURRENT_SOURCE_DIR}/generatorprofiletools.h ${CMAKE_CURRENT_SOURCE_DIR}/internaltypes.h diff --git a/src/generator.cpp b/src/generator.cpp index 4c7b02d814..cf994f3e83 100644 --- a/src/generator.cpp +++ b/src/generator.cpp @@ -390,9 +390,9 @@ std::string Generator::GeneratorImpl::generateVariableInfoEntryCode(const std::s const std::string &component) const { return replace(replace(replace(mProfile->variableInfoEntryString(), - "[NAME]", name), - "[UNITS]", units), - "[COMPONENT]", component); + "[NAME]", name), + "[UNITS]", units), + "[COMPONENT]", component); } void Generator::GeneratorImpl::addInterfaceVariableInfoCode() diff --git a/src/generatorprofile.cpp b/src/generatorprofile.cpp index 843249297c..2655cce439 100644 --- a/src/generatorprofile.cpp +++ b/src/generatorprofile.cpp @@ -22,291 +22,11 @@ limitations under the License. #include +#include "generatorprofile_p.h" #include "utilities.h" namespace libcellml { -/** - * @brief The GeneratorProfile::GeneratorProfileImpl struct. - * - * The private implementation for the GeneratorProfile class. - */ -struct GeneratorProfile::GeneratorProfileImpl -{ - // Whether the profile is official. - - GeneratorProfile::Profile mProfile = Profile::C; - - // Whether the profile requires an interface to be generated. - - bool mHasInterface = true; - - // Equality. - - std::string mEqualityString; - - // Relational and logical operators. - - std::string mEqString; - std::string mNeqString; - std::string mLtString; - std::string mLeqString; - std::string mGtString; - std::string mGeqString; - std::string mAndString; - std::string mOrString; - std::string mXorString; - std::string mNotString; - - bool mHasEqOperator = true; - bool mHasNeqOperator = true; - bool mHasLtOperator = true; - bool mHasLeqOperator = true; - bool mHasGtOperator = true; - bool mHasGeqOperator = true; - bool mHasAndOperator = true; - bool mHasOrOperator = true; - bool mHasXorOperator = true; - bool mHasNotOperator = true; - - // Arithmetic operators. - - std::string mPlusString; - std::string mMinusString; - std::string mTimesString; - std::string mDivideString; - std::string mPowerString; - std::string mSquareRootString; - std::string mSquareString; - std::string mAbsoluteValueString; - std::string mExponentialString; - std::string mNaturalLogarithmString; - std::string mCommonLogarithmString; - std::string mCeilingString; - std::string mFloorString; - std::string mMinString; - std::string mMaxString; - std::string mRemString; - - bool mHasPowerOperator = false; - - // Trigonometric operators. - - std::string mSinString; - std::string mCosString; - std::string mTanString; - std::string mSecString; - std::string mCscString; - std::string mCotString; - std::string mSinhString; - std::string mCoshString; - std::string mTanhString; - std::string mSechString; - std::string mCschString; - std::string mCothString; - std::string mAsinString; - std::string mAcosString; - std::string mAtanString; - std::string mAsecString; - std::string mAcscString; - std::string mAcotString; - std::string mAsinhString; - std::string mAcoshString; - std::string mAtanhString; - std::string mAsechString; - std::string mAcschString; - std::string mAcothString; - - // Piecewise statement. - - std::string mConditionalOperatorIfString; - std::string mConditionalOperatorElseString; - std::string mPiecewiseIfString; - std::string mPiecewiseElseString; - - bool mHasConditionalOperator = true; - - // Constants. - - std::string mTrueString; - std::string mFalseString; - std::string mEString; - std::string mPiString; - std::string mInfString; - std::string mNanString; - - // Arithmetic functions. - - std::string mEqFunctionString; - std::string mNeqFunctionString; - std::string mLtFunctionString; - std::string mLeqFunctionString; - std::string mGtFunctionString; - std::string mGeqFunctionString; - std::string mAndFunctionString; - std::string mOrFunctionString; - std::string mXorFunctionString; - std::string mNotFunctionString; - std::string mMinFunctionString; - std::string mMaxFunctionString; - - // Trigonometric functions. - - std::string mSecFunctionString; - std::string mCscFunctionString; - std::string mCotFunctionString; - std::string mSechFunctionString; - std::string mCschFunctionString; - std::string mCothFunctionString; - std::string mAsecFunctionString; - std::string mAcscFunctionString; - std::string mAcotFunctionString; - std::string mAsechFunctionString; - std::string mAcschFunctionString; - std::string mAcothFunctionString; - - // Miscellaneous. - - std::string mCommentString; - std::string mOriginCommentString; - - std::string mInterfaceFileNameString; - - std::string mInterfaceHeaderString; - std::string mImplementationHeaderString; - - std::string mInterfaceVersionString; - std::string mImplementationVersionString; - - std::string mInterfaceLibcellmlVersionString; - std::string mImplementationLibcellmlVersionString; - - std::string mInterfaceStateCountString; - std::string mImplementationStateCountString; - - std::string mInterfaceConstantCountString; - std::string mImplementationConstantCountString; - - std::string mInterfaceComputedConstantCountString; - std::string mImplementationComputedConstantCountString; - - std::string mInterfaceAlgebraicCountString; - std::string mImplementationAlgebraicCountString; - - std::string mInterfaceExternalCountString; - std::string mImplementationExternalCountString; - - std::string mVariableInfoObjectString; - - std::string mInterfaceVoiInfoString; - std::string mImplementationVoiInfoString; - - std::string mInterfaceStateInfoString; - std::string mImplementationStateInfoString; - - std::string mInterfaceConstantInfoString; - std::string mImplementationConstantInfoString; - - std::string mInterfaceComputedConstantInfoString; - std::string mImplementationComputedConstantInfoString; - - std::string mInterfaceAlgebraicInfoString; - std::string mImplementationAlgebraicInfoString; - - std::string mInterfaceExternalInfoString; - std::string mImplementationExternalInfoString; - - std::string mVariableInfoEntryString; - - std::string mVoiString; - - std::string mStatesArrayString; - std::string mRatesArrayString; - std::string mConstantsArrayString; - std::string mComputedConstantsArrayString; - std::string mAlgebraicArrayString; - - std::string mExternalVariableMethodTypeDefinitionFamString; - std::string mExternalVariableMethodTypeDefinitionFdmString; - - std::string mExternalVariableMethodCallFamString; - std::string mExternalVariableMethodCallFdmString; - - std::string mRootFindingInfoObjectFamString; - std::string mRootFindingInfoObjectFdmString; - std::string mExternNlaSolveMethodString; - std::string mFindRootCallFamString; - std::string mFindRootCallFdmString; - std::string mFindRootMethodFamString; - std::string mFindRootMethodFdmString; - std::string mNlaSolveCallFamString; - std::string mNlaSolveCallFdmString; - std::string mObjectiveFunctionMethodFamString; - std::string mObjectiveFunctionMethodFdmString; - std::string mUArrayString; - std::string mFArrayString; - - std::string mInterfaceCreateStatesArrayMethodString; - std::string mImplementationCreateStatesArrayMethodString; - - std::string mInterfaceCreateVariablesArrayMethodString; - std::string mImplementationCreateVariablesArrayMethodString; - - std::string mInterfaceDeleteArrayMethodString; - std::string mImplementationDeleteArrayMethodString; - - std::string mInterfaceInitialiseVariablesMethodFamWoevString; - std::string mImplementationInitialiseVariablesMethodFamWoevString; - - std::string mInterfaceInitialiseVariablesMethodFamWevString; - std::string mImplementationInitialiseVariablesMethodFamWevString; - - std::string mInterfaceInitialiseVariablesMethodFdmWoevString; - std::string mImplementationInitialiseVariablesMethodFdmWoevString; - - std::string mInterfaceInitialiseVariablesMethodFdmWevString; - std::string mImplementationInitialiseVariablesMethodFdmWevString; - - std::string mInterfaceComputeComputedConstantsMethodString; - std::string mImplementationComputeComputedConstantsMethodString; - - std::string mInterfaceComputeRatesMethodWoevString; - std::string mImplementationComputeRatesMethodWoevString; - - std::string mInterfaceComputeRatesMethodWevString; - std::string mImplementationComputeRatesMethodWevString; - - std::string mInterfaceComputeVariablesMethodFamWoevString; - std::string mImplementationComputeVariablesMethodFamWoevString; - - std::string mInterfaceComputeVariablesMethodFamWevString; - std::string mImplementationComputeVariablesMethodFamWevString; - - std::string mInterfaceComputeVariablesMethodFdmWoevString; - std::string mImplementationComputeVariablesMethodFdmWoevString; - - std::string mInterfaceComputeVariablesMethodFdmWevString; - std::string mImplementationComputeVariablesMethodFdmWevString; - - std::string mEmptyMethodString; - - std::string mIndentString; - - std::string mOpenArrayInitialiserString; - std::string mCloseArrayInitialiserString; - - std::string mOpenArrayString; - std::string mCloseArrayString; - - std::string mArrayElementSeparatorString; - - std::string mStringDelimiterString; - - std::string mCommandSeparatorString; - - void loadProfile(GeneratorProfile::Profile profile); -}; - void GeneratorProfile::GeneratorProfileImpl::loadProfile(GeneratorProfile::Profile profile) { mProfile = profile; diff --git a/src/generatorprofile_p.h b/src/generatorprofile_p.h new file mode 100644 index 0000000000..e87a24da7c --- /dev/null +++ b/src/generatorprofile_p.h @@ -0,0 +1,302 @@ +/* +Copyright libCellML Contributors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +#include "libcellml/generatorprofile.h" + +namespace libcellml { + +/** + * @brief The GeneratorProfile::GeneratorProfileImpl struct. + * + * The private implementation for the GeneratorProfile class. + */ +struct GeneratorProfile::GeneratorProfileImpl +{ + // Whether the profile is official. + + GeneratorProfile::Profile mProfile = Profile::C; + + // Whether the profile requires an interface to be generated. + + bool mHasInterface = true; + + // Equality. + + std::string mEqualityString; + + // Relational and logical operators. + + std::string mEqString; + std::string mNeqString; + std::string mLtString; + std::string mLeqString; + std::string mGtString; + std::string mGeqString; + std::string mAndString; + std::string mOrString; + std::string mXorString; + std::string mNotString; + + bool mHasEqOperator = true; + bool mHasNeqOperator = true; + bool mHasLtOperator = true; + bool mHasLeqOperator = true; + bool mHasGtOperator = true; + bool mHasGeqOperator = true; + bool mHasAndOperator = true; + bool mHasOrOperator = true; + bool mHasXorOperator = true; + bool mHasNotOperator = true; + + // Arithmetic operators. + + std::string mPlusString; + std::string mMinusString; + std::string mTimesString; + std::string mDivideString; + std::string mPowerString; + std::string mSquareRootString; + std::string mSquareString; + std::string mAbsoluteValueString; + std::string mExponentialString; + std::string mNaturalLogarithmString; + std::string mCommonLogarithmString; + std::string mCeilingString; + std::string mFloorString; + std::string mMinString; + std::string mMaxString; + std::string mRemString; + + bool mHasPowerOperator = false; + + // Trigonometric operators. + + std::string mSinString; + std::string mCosString; + std::string mTanString; + std::string mSecString; + std::string mCscString; + std::string mCotString; + std::string mSinhString; + std::string mCoshString; + std::string mTanhString; + std::string mSechString; + std::string mCschString; + std::string mCothString; + std::string mAsinString; + std::string mAcosString; + std::string mAtanString; + std::string mAsecString; + std::string mAcscString; + std::string mAcotString; + std::string mAsinhString; + std::string mAcoshString; + std::string mAtanhString; + std::string mAsechString; + std::string mAcschString; + std::string mAcothString; + + // Piecewise statement. + + std::string mConditionalOperatorIfString; + std::string mConditionalOperatorElseString; + std::string mPiecewiseIfString; + std::string mPiecewiseElseString; + + bool mHasConditionalOperator = true; + + // Constants. + + std::string mTrueString; + std::string mFalseString; + std::string mEString; + std::string mPiString; + std::string mInfString; + std::string mNanString; + + // Arithmetic functions. + + std::string mEqFunctionString; + std::string mNeqFunctionString; + std::string mLtFunctionString; + std::string mLeqFunctionString; + std::string mGtFunctionString; + std::string mGeqFunctionString; + std::string mAndFunctionString; + std::string mOrFunctionString; + std::string mXorFunctionString; + std::string mNotFunctionString; + std::string mMinFunctionString; + std::string mMaxFunctionString; + + // Trigonometric functions. + + std::string mSecFunctionString; + std::string mCscFunctionString; + std::string mCotFunctionString; + std::string mSechFunctionString; + std::string mCschFunctionString; + std::string mCothFunctionString; + std::string mAsecFunctionString; + std::string mAcscFunctionString; + std::string mAcotFunctionString; + std::string mAsechFunctionString; + std::string mAcschFunctionString; + std::string mAcothFunctionString; + + // Miscellaneous. + + std::string mCommentString; + std::string mOriginCommentString; + + std::string mInterfaceFileNameString; + + std::string mInterfaceHeaderString; + std::string mImplementationHeaderString; + + std::string mInterfaceVersionString; + std::string mImplementationVersionString; + + std::string mInterfaceLibcellmlVersionString; + std::string mImplementationLibcellmlVersionString; + + std::string mInterfaceStateCountString; + std::string mImplementationStateCountString; + + std::string mInterfaceConstantCountString; + std::string mImplementationConstantCountString; + + std::string mInterfaceComputedConstantCountString; + std::string mImplementationComputedConstantCountString; + + std::string mInterfaceAlgebraicCountString; + std::string mImplementationAlgebraicCountString; + + std::string mInterfaceExternalCountString; + std::string mImplementationExternalCountString; + + std::string mVariableInfoObjectString; + + std::string mInterfaceVoiInfoString; + std::string mImplementationVoiInfoString; + + std::string mInterfaceStateInfoString; + std::string mImplementationStateInfoString; + + std::string mInterfaceConstantInfoString; + std::string mImplementationConstantInfoString; + + std::string mInterfaceComputedConstantInfoString; + std::string mImplementationComputedConstantInfoString; + + std::string mInterfaceAlgebraicInfoString; + std::string mImplementationAlgebraicInfoString; + + std::string mInterfaceExternalInfoString; + std::string mImplementationExternalInfoString; + + std::string mVariableInfoEntryString; + + std::string mVoiString; + + std::string mStatesArrayString; + std::string mRatesArrayString; + std::string mConstantsArrayString; + std::string mComputedConstantsArrayString; + std::string mAlgebraicArrayString; + + std::string mExternalVariableMethodTypeDefinitionFamString; + std::string mExternalVariableMethodTypeDefinitionFdmString; + + std::string mExternalVariableMethodCallFamString; + std::string mExternalVariableMethodCallFdmString; + + std::string mRootFindingInfoObjectFamString; + std::string mRootFindingInfoObjectFdmString; + std::string mExternNlaSolveMethodString; + std::string mFindRootCallFamString; + std::string mFindRootCallFdmString; + std::string mFindRootMethodFamString; + std::string mFindRootMethodFdmString; + std::string mNlaSolveCallFamString; + std::string mNlaSolveCallFdmString; + std::string mObjectiveFunctionMethodFamString; + std::string mObjectiveFunctionMethodFdmString; + std::string mUArrayString; + std::string mFArrayString; + + std::string mInterfaceCreateStatesArrayMethodString; + std::string mImplementationCreateStatesArrayMethodString; + + std::string mInterfaceCreateVariablesArrayMethodString; + std::string mImplementationCreateVariablesArrayMethodString; + + std::string mInterfaceDeleteArrayMethodString; + std::string mImplementationDeleteArrayMethodString; + + std::string mInterfaceInitialiseVariablesMethodFamWoevString; + std::string mImplementationInitialiseVariablesMethodFamWoevString; + + std::string mInterfaceInitialiseVariablesMethodFamWevString; + std::string mImplementationInitialiseVariablesMethodFamWevString; + + std::string mInterfaceInitialiseVariablesMethodFdmWoevString; + std::string mImplementationInitialiseVariablesMethodFdmWoevString; + + std::string mInterfaceInitialiseVariablesMethodFdmWevString; + std::string mImplementationInitialiseVariablesMethodFdmWevString; + + std::string mInterfaceComputeComputedConstantsMethodString; + std::string mImplementationComputeComputedConstantsMethodString; + + std::string mInterfaceComputeRatesMethodWoevString; + std::string mImplementationComputeRatesMethodWoevString; + + std::string mInterfaceComputeRatesMethodWevString; + std::string mImplementationComputeRatesMethodWevString; + + std::string mInterfaceComputeVariablesMethodFamWoevString; + std::string mImplementationComputeVariablesMethodFamWoevString; + + std::string mInterfaceComputeVariablesMethodFamWevString; + std::string mImplementationComputeVariablesMethodFamWevString; + + std::string mInterfaceComputeVariablesMethodFdmWoevString; + std::string mImplementationComputeVariablesMethodFdmWoevString; + + std::string mInterfaceComputeVariablesMethodFdmWevString; + std::string mImplementationComputeVariablesMethodFdmWevString; + + std::string mEmptyMethodString; + + std::string mIndentString; + + std::string mOpenArrayInitialiserString; + std::string mCloseArrayInitialiserString; + + std::string mOpenArrayString; + std::string mCloseArrayString; + + std::string mArrayElementSeparatorString; + + std::string mStringDelimiterString; + + std::string mCommandSeparatorString; + + void loadProfile(GeneratorProfile::Profile profile); +}; + +} // namespace libcellml From aaaeed39ed1b365dc2933430db7fa9aa0c0c3141 Mon Sep 17 00:00:00 2001 From: Alan Garny Date: Wed, 14 Aug 2024 16:31:42 +0200 Subject: [PATCH 22/85] Generator: updated the createXxxArray() methods. --- src/api/libcellml/generatorprofile.h | 171 ++++++++++++++++-- src/bindings/interface/generatorprofile.i | 62 ++++++- src/bindings/javascript/generatorprofile.cpp | 20 +- src/generator.cpp | 76 +++++--- src/generator_p.h | 5 +- src/generatorprofile.cpp | 143 +++++++++++++-- src/generatorprofile_p.h | 13 +- src/generatorprofilesha1values.h | 4 +- src/generatorprofiletools.cpp | 13 +- tests/bindings/javascript/generator.test.js | 4 +- .../javascript/generatorprofile.test.js | 48 ++++- .../bindings/python/test_generator_profile.py | 78 +++++++- tests/coverage/coverage.cpp | 8 +- tests/generator/generatorprofile.cpp | 120 +++++++++--- tests/resources/coverage/generator/model.c | 28 ++- tests/resources/coverage/generator/model.h | 5 +- .../generator/model.implementation.out | 28 ++- .../coverage/generator/model.interface.out | 5 +- .../generator/model.modified.profile.c | 28 ++- .../generator/model.modified.profile.h | 5 +- .../generator/model.modified.profile.py | 12 +- tests/resources/coverage/generator/model.py | 12 +- .../algebraic_eqn_computed_var_on_rhs/model.c | 28 ++- .../model.external.c | 39 +++- .../model.external.h | 6 +- .../model.external.py | 16 +- .../algebraic_eqn_computed_var_on_rhs/model.h | 5 +- .../model.py | 12 +- .../algebraic_eqn_const_var_on_rhs/model.c | 28 ++- .../algebraic_eqn_const_var_on_rhs/model.h | 5 +- .../algebraic_eqn_const_var_on_rhs/model.py | 12 +- .../algebraic_eqn_constant_on_rhs/model.c | 28 ++- .../algebraic_eqn_constant_on_rhs/model.h | 5 +- .../algebraic_eqn_constant_on_rhs/model.py | 12 +- .../algebraic_eqn_derivative_on_rhs/model.c | 28 ++- .../algebraic_eqn_derivative_on_rhs/model.h | 5 +- .../algebraic_eqn_derivative_on_rhs/model.py | 12 +- .../model.c | 28 ++- .../model.h | 5 +- .../model.py | 12 +- .../algebraic_eqn_state_var_on_rhs/model.c | 28 ++- .../algebraic_eqn_state_var_on_rhs/model.h | 5 +- .../algebraic_eqn_state_var_on_rhs/model.py | 12 +- .../model.c | 28 ++- .../model.h | 5 +- .../model.py | 12 +- .../model.c | 28 ++- .../model.external.c | 39 +++- .../model.external.h | 6 +- .../model.external.py | 16 +- .../model.h | 5 +- .../model.py | 12 +- .../model.c | 28 ++- .../model.h | 5 +- .../model.py | 12 +- .../model.three.externals.c | 39 +++- .../model.three.externals.h | 6 +- .../model.three.externals.py | 16 +- .../model.not.ordered.c | 28 ++- .../model.not.ordered.h | 5 +- .../model.not.ordered.py | 12 +- .../model.ordered.c | 28 ++- .../model.ordered.h | 5 +- .../model.ordered.py | 12 +- .../algebraic_unknown_var_on_rhs/model.c | 28 ++- .../algebraic_unknown_var_on_rhs/model.h | 5 +- .../algebraic_unknown_var_on_rhs/model.py | 12 +- .../generator/cell_geometry_model/model.c | 28 ++- .../cell_geometry_model/model.external.c | 39 +++- .../cell_geometry_model/model.external.h | 6 +- .../cell_geometry_model/model.external.py | 16 +- .../generator/cell_geometry_model/model.h | 5 +- .../generator/cell_geometry_model/model.py | 12 +- .../model.c | 28 ++- .../model.h | 5 +- .../model.py | 12 +- .../generator/cellml_slc_example/model.py | 12 +- .../model.c | 28 ++- .../model.h | 5 +- .../model.py | 12 +- .../cellml_unit_scaling_constant/model.c | 28 ++- .../cellml_unit_scaling_constant/model.h | 5 +- .../cellml_unit_scaling_constant/model.py | 12 +- .../cellml_unit_scaling_rate/model.c | 28 ++- .../cellml_unit_scaling_rate/model.h | 5 +- .../cellml_unit_scaling_rate/model.py | 12 +- .../cellml_unit_scaling_state/model.c | 28 ++- .../cellml_unit_scaling_state/model.h | 5 +- .../cellml_unit_scaling_state/model.py | 12 +- .../model.c | 28 ++- .../model.h | 5 +- .../model.py | 12 +- .../model.c | 28 ++- .../model.h | 5 +- .../model.py | 12 +- .../cellml_unit_scaling_voi_direct/model.c | 28 ++- .../cellml_unit_scaling_voi_direct/model.h | 5 +- .../cellml_unit_scaling_voi_direct/model.py | 12 +- .../cellml_unit_scaling_voi_indirect/model.c | 28 ++- .../cellml_unit_scaling_voi_indirect/model.h | 5 +- .../cellml_unit_scaling_voi_indirect/model.py | 12 +- .../generator/dae_cellml_1_1_model/model.c | 28 ++- .../generator/dae_cellml_1_1_model/model.h | 5 +- .../generator/dae_cellml_1_1_model/model.py | 12 +- .../generator/dependent_eqns/model.c | 28 ++- .../generator/dependent_eqns/model.h | 5 +- .../generator/dependent_eqns/model.py | 12 +- .../model.c | 28 ++- .../model.h | 5 +- .../model.py | 12 +- .../model.c | 28 ++- .../model.h | 5 +- .../model.py | 12 +- .../model.algebraic.c | 39 +++- .../model.algebraic.h | 6 +- .../model.algebraic.py | 16 +- .../model.c | 28 ++- .../model.computed.constant.c | 39 +++- .../model.computed.constant.h | 6 +- .../model.computed.constant.py | 16 +- .../model.constant.c | 39 +++- .../model.constant.h | 6 +- .../model.constant.py | 16 +- .../model.dae.c | 28 ++- .../model.dae.h | 5 +- .../model.dae.py | 12 +- .../model.dependent.algebraic.c | 39 +++- .../model.dependent.algebraic.h | 6 +- .../model.dependent.algebraic.py | 16 +- .../model.dependent.computed.constant.c | 39 +++- .../model.dependent.computed.constant.h | 6 +- .../model.dependent.computed.constant.py | 16 +- .../model.dependent.constant.c | 39 +++- .../model.dependent.constant.h | 6 +- .../model.dependent.constant.py | 16 +- .../model.dependent.state.c | 39 +++- .../model.dependent.state.h | 6 +- .../model.dependent.state.py | 16 +- .../model.external.c | 39 +++- .../model.external.h | 6 +- .../model.external.py | 16 +- .../model.h | 5 +- .../model.py | 12 +- .../model.state.c | 39 +++- .../model.state.h | 6 +- .../model.state.py | 16 +- .../generator/noble_model_1962/model.c | 28 ++- .../generator/noble_model_1962/model.h | 5 +- .../generator/noble_model_1962/model.py | 12 +- .../generator/ode_computed_var_on_rhs/model.c | 28 ++- .../generator/ode_computed_var_on_rhs/model.h | 5 +- .../ode_computed_var_on_rhs/model.py | 12 +- .../model.c | 28 ++- .../model.h | 5 +- .../model.py | 12 +- .../generator/ode_const_var_on_rhs/model.c | 28 ++- .../generator/ode_const_var_on_rhs/model.h | 5 +- .../generator/ode_const_var_on_rhs/model.py | 12 +- .../model.c | 28 ++- .../model.h | 5 +- .../model.py | 12 +- .../generator/ode_constant_on_rhs/model.c | 28 ++- .../generator/ode_constant_on_rhs/model.h | 5 +- .../generator/ode_constant_on_rhs/model.py | 12 +- .../ode_constant_on_rhs_one_component/model.c | 28 ++- .../ode_constant_on_rhs_one_component/model.h | 5 +- .../model.py | 12 +- .../ode_multiple_dependent_odes/model.c | 28 ++- .../ode_multiple_dependent_odes/model.h | 5 +- .../ode_multiple_dependent_odes/model.py | 12 +- .../model.c | 28 ++- .../model.h | 5 +- .../model.py | 12 +- .../ode_multiple_odes_with_same_name/model.c | 28 ++- .../ode_multiple_odes_with_same_name/model.h | 5 +- .../ode_multiple_odes_with_same_name/model.py | 12 +- .../generator/ode_unknown_var_on_rhs/model.c | 28 ++- .../generator/ode_unknown_var_on_rhs/model.h | 5 +- .../generator/ode_unknown_var_on_rhs/model.py | 12 +- .../robertson_model_1966/model.dae.c | 28 ++- .../robertson_model_1966/model.dae.h | 5 +- .../robertson_model_1966/model.dae.py | 12 +- .../robertson_model_1966/model.ode.c | 28 ++- .../robertson_model_1966/model.ode.h | 5 +- .../robertson_model_1966/model.ode.py | 12 +- .../generator/sine_model_imports/model.c | 28 ++- .../generator/sine_model_imports/model.h | 5 +- .../generator/sine_model_imports/model.py | 12 +- .../model.c | 39 +++- .../model.h | 6 +- .../model.py | 16 +- .../model.c | 28 ++- .../model.h | 5 +- .../model.py | 12 +- 194 files changed, 3195 insertions(+), 494 deletions(-) diff --git a/src/api/libcellml/generatorprofile.h b/src/api/libcellml/generatorprofile.h index 69a00d263a..943eca8013 100644 --- a/src/api/libcellml/generatorprofile.h +++ b/src/api/libcellml/generatorprofile.h @@ -3447,49 +3447,180 @@ class LIBCELLML_EXPORT GeneratorProfile void setImplementationCreateStatesArrayMethodString(const std::string &implementationCreateStatesArrayMethodString); /** - * @brief Get the @c std::string for the interface to create variables + * @brief Get the @c std::string for the interface to create the constants * array. * - * Return the @c std::string for the interface to create variables array. + * Return the @c std::string for the interface to create the constants array. * - * @return The @c std::string for the interface to create variables array. + * @return The @c std::string for the interface to create the constants array. */ - std::string interfaceCreateVariablesArrayMethodString() const; + std::string interfaceCreateConstantsArrayMethodString() const; /** - * @brief Set the @c std::string for the interface to create variables + * @brief Set the @c std::string for the interface to create the constants * array. * - * Set the @c std::string for the interface to create variables array. + * Set the @c std::string for the interface to create the constants array. * - * @param interfaceCreateVariablesArrayMethodString The @c std::string to - * use for the interface to create variables array. + * @param interfaceCreateConstantsArrayMethodString The @c std::string to use + * for the interface to create the constants array. */ - void setInterfaceCreateVariablesArrayMethodString(const std::string &interfaceCreateVariablesArrayMethodString); + void setInterfaceCreateConstantsArrayMethodString(const std::string &interfaceCreateConstantsArrayMethodString); /** - * @brief Get the @c std::string for the implementation to create the - * variables array. + * @brief Get the @c std::string for the implementation to create the constants + * array. + * + * Return the @c std::string for the implementation to create the constants + * array. + * + * @return The @c std::string for the implementation to create the constants + * array. + */ + std::string implementationCreateConstantsArrayMethodString() const; + + /** + * @brief Set the @c std::string for the implementation to create the constants + * array. + * + * Set the @c std::string for the implementation to create the constants array. + * + * @param implementationCreateConstantsArrayMethodString The @c std::string to + * use for the implementation to create the constants array. + */ + void setImplementationCreateConstantsArrayMethodString(const std::string &implementationCreateConstantsArrayMethodString); + + /** + * @brief Get the @c std::string for the interface to create the computed constants + * array. + * + * Return the @c std::string for the interface to create the computed constants array. + * + * @return The @c std::string for the interface to create the computed constants array. + */ + std::string interfaceCreateComputedConstantsArrayMethodString() const; + + /** + * @brief Set the @c std::string for the interface to create the computed constants + * array. + * + * Set the @c std::string for the interface to create the computed constants array. + * + * @param interfaceCreateComputedConstantsArrayMethodString The @c std::string to use + * for the interface to create the computed constants array. + */ + void setInterfaceCreateComputedConstantsArrayMethodString(const std::string &interfaceCreateComputedConstantsArrayMethodString); + + /** + * @brief Get the @c std::string for the implementation to create the computed constants + * array. * - * Return the @c std::string for the implementation to create the variables + * Return the @c std::string for the implementation to create the computed constants * array. * - * @return The @c std::string for the implementation to create the variables + * @return The @c std::string for the implementation to create the computed constants + * array. + */ + std::string implementationCreateComputedConstantsArrayMethodString() const; + + /** + * @brief Set the @c std::string for the implementation to create the computed constants * array. + * + * Set the @c std::string for the implementation to create the computed constants array. + * + * @param implementationCreateComputedConstantsArrayMethodString The @c std::string to + * use for the implementation to create the computed constants array. */ - std::string implementationCreateVariablesArrayMethodString() const; + void setImplementationCreateComputedConstantsArrayMethodString(const std::string &implementationCreateComputedConstantsArrayMethodString); /** - * @brief Set the @c std::string for the implementation to create the - * variables array. + * @brief Get the @c std::string for the interface to create the algebraic variables + * array. + * + * Return the @c std::string for the interface to create the algebraic variables array. * - * Set the @c std::string for the implementation to create the variables + * @return The @c std::string for the interface to create the algebraic variables array. + */ + std::string interfaceCreateAlgebraicArrayMethodString() const; + + /** + * @brief Set the @c std::string for the interface to create the algebraic variables * array. * - * @param implementationCreateVariablesArrayMethodString The @c std::string - * to use for the implementation to create the variables array. + * Set the @c std::string for the interface to create the algebraic variables array. + * + * @param interfaceCreateAlgebraicArrayMethodString The @c std::string to use + * for the interface to create the algebraic variables array. + */ + void setInterfaceCreateAlgebraicArrayMethodString(const std::string &interfaceCreateAlgebraicArrayMethodString); + + /** + * @brief Get the @c std::string for the implementation to create the algebraic variables + * array. + * + * Return the @c std::string for the implementation to create the algebraic variables + * array. + * + * @return The @c std::string for the implementation to create the algebraic variables + * array. + */ + std::string implementationCreateAlgebraicArrayMethodString() const; + + /** + * @brief Set the @c std::string for the implementation to create the algebraic variables + * array. + * + * Set the @c std::string for the implementation to create the algebraic variables array. + * + * @param implementationCreateAlgebraicArrayMethodString The @c std::string to + * use for the implementation to create the algebraic variables array. + */ + void setImplementationCreateAlgebraicArrayMethodString(const std::string &implementationCreateAlgebraicArrayMethodString); + + /** + * @brief Get the @c std::string for the interface to create the external variables + * array. + * + * Return the @c std::string for the interface to create the external variables array. + * + * @return The @c std::string for the interface to create the external variables array. + */ + std::string interfaceCreateExternalsArrayMethodString() const; + + /** + * @brief Set the @c std::string for the interface to create the external variables + * array. + * + * Set the @c std::string for the interface to create the external variables array. + * + * @param interfaceCreateExternalsArrayMethodString The @c std::string to use + * for the interface to create the external variables array. + */ + void setInterfaceCreateExternalsArrayMethodString(const std::string &interfaceCreateExternalsArrayMethodString); + + /** + * @brief Get the @c std::string for the implementation to create the external variables + * array. + * + * Return the @c std::string for the implementation to create the external variables + * array. + * + * @return The @c std::string for the implementation to create the external variables + * array. + */ + std::string implementationCreateExternalsArrayMethodString() const; + + /** + * @brief Set the @c std::string for the implementation to create the external variables + * array. + * + * Set the @c std::string for the implementation to create the external variables array. + * + * @param implementationCreateExternalsArrayMethodString The @c std::string to + * use for the implementation to create the external variables array. */ - void setImplementationCreateVariablesArrayMethodString(const std::string &implementationCreateVariablesArrayMethodString); + void setImplementationCreateExternalsArrayMethodString(const std::string &implementationCreateExternalsArrayMethodString); /** * @brief Get the @c std::string for the interface to delete an array. diff --git a/src/bindings/interface/generatorprofile.i b/src/bindings/interface/generatorprofile.i index 712e2198a8..23fc7a9b99 100644 --- a/src/bindings/interface/generatorprofile.i +++ b/src/bindings/interface/generatorprofile.i @@ -938,19 +938,61 @@ tag, which will be replaced with some code to create the states array."; "Sets the string for the implementation to create the states array. To be useful, the string should contain the tag, which will be replaced with some code to create the states array."; -%feature("docstring") libcellml::GeneratorProfile::interfaceCreateVariablesArrayMethodString -"Returns the string for the interface to create variables array."; +%feature("docstring") libcellml::GeneratorProfile::interfaceCreateConstantsArrayMethodString +"Returns the string for the interface to create the constants array."; -%feature("docstring") libcellml::GeneratorProfile::setInterfaceCreateVariablesArrayMethodString -"Sets the string for the interface to create variables array. To be useful, the string should contain the -tag, which will be replaced with some code to create the variables array."; +%feature("docstring") libcellml::GeneratorProfile::setInterfaceCreateConstantsArrayMethodString +"Sets the string for the interface to create the constants array. To be useful, the string should contain the +tag, which will be replaced with some code to create the constants array."; -%feature("docstring") libcellml::GeneratorProfile::implementationCreateVariablesArrayMethodString -"Returns the string for the implementation to create the variables array."; +%feature("docstring") libcellml::GeneratorProfile::implementationCreateConstantsArrayMethodString +"Returns the string for the implementation to create the constants array."; -%feature("docstring") libcellml::GeneratorProfile::setImplementationCreateVariablesArrayMethodString -"Sets the string for the implementation to create the variables array. To be useful, the string should contain the - tag, which will be replaced with some code to create the variables array."; +%feature("docstring") libcellml::GeneratorProfile::setImplementationCreateConstantsArrayMethodString +"Sets the string for the implementation to create the constants array. To be useful, the string should contain the + tag, which will be replaced with some code to create the constants array."; + +%feature("docstring") libcellml::GeneratorProfile::interfaceCreateComputedConstantsArrayMethodString +"Returns the string for the interface to create the computed constants array."; + +%feature("docstring") libcellml::GeneratorProfile::setInterfaceCreateComputedConstantsArrayMethodString +"Sets the string for the interface to create the computed constants array. To be useful, the string should contain the +tag, which will be replaced with some code to create the computed constants array."; + +%feature("docstring") libcellml::GeneratorProfile::implementationCreateComputedConstantsArrayMethodString +"Returns the string for the implementation to create the computed constants array."; + +%feature("docstring") libcellml::GeneratorProfile::setImplementationCreateComputedConstantsArrayMethodString +"Sets the string for the implementation to create the computed constants array. To be useful, the string should contain the + tag, which will be replaced with some code to create the computed constants array."; + +%feature("docstring") libcellml::GeneratorProfile::interfaceCreateAlgebraicArrayMethodString +"Returns the string for the interface to create the algebraic array."; + +%feature("docstring") libcellml::GeneratorProfile::setInterfaceCreateAlgebraicArrayMethodString +"Sets the string for the interface to create the algebraic array. To be useful, the string should contain the +tag, which will be replaced with some code to create the algebraic array."; + +%feature("docstring") libcellml::GeneratorProfile::implementationCreateAlgebraicArrayMethodString +"Returns the string for the implementation to create the algebraic array."; + +%feature("docstring") libcellml::GeneratorProfile::setImplementationCreateAlgebraicArrayMethodString +"Sets the string for the implementation to create the algebraic array. To be useful, the string should contain the + tag, which will be replaced with some code to create the algebraic array."; + +%feature("docstring") libcellml::GeneratorProfile::interfaceCreateExternalsArrayMethodString +"Returns the string for the interface to create the externals array."; + +%feature("docstring") libcellml::GeneratorProfile::setInterfaceCreateExternalsArrayMethodString +"Sets the string for the interface to create the externals array. To be useful, the string should contain the +tag, which will be replaced with some code to create the externals array."; + +%feature("docstring") libcellml::GeneratorProfile::implementationCreateExternalsArrayMethodString +"Returns the string for the implementation to create the externals array."; + +%feature("docstring") libcellml::GeneratorProfile::setImplementationCreateExternalsArrayMethodString +"Sets the string for the implementation to create the externals array. To be useful, the string should contain the + tag, which will be replaced with some code to create the externals array."; %feature("docstring") libcellml::GeneratorProfile::interfaceDeleteArrayMethodString "Returns the string for the interface to delete an array."; diff --git a/src/bindings/javascript/generatorprofile.cpp b/src/bindings/javascript/generatorprofile.cpp index 5a28e6cac2..1f4d57997b 100644 --- a/src/bindings/javascript/generatorprofile.cpp +++ b/src/bindings/javascript/generatorprofile.cpp @@ -331,10 +331,22 @@ EMSCRIPTEN_BINDINGS(libcellml_generatorprofile) .function("setInterfaceCreateStatesArrayMethodString", &libcellml::GeneratorProfile::setInterfaceCreateStatesArrayMethodString) .function("implementationCreateStatesArrayMethodString", &libcellml::GeneratorProfile::implementationCreateStatesArrayMethodString) .function("setImplementationCreateStatesArrayMethodString", &libcellml::GeneratorProfile::setImplementationCreateStatesArrayMethodString) - .function("interfaceCreateVariablesArrayMethodString", &libcellml::GeneratorProfile::interfaceCreateVariablesArrayMethodString) - .function("setInterfaceCreateVariablesArrayMethodString", &libcellml::GeneratorProfile::setInterfaceCreateVariablesArrayMethodString) - .function("implementationCreateVariablesArrayMethodString", &libcellml::GeneratorProfile::implementationCreateVariablesArrayMethodString) - .function("setImplementationCreateVariablesArrayMethodString", &libcellml::GeneratorProfile::setImplementationCreateVariablesArrayMethodString) + .function("interfaceCreateConstantsArrayMethodString", &libcellml::GeneratorProfile::interfaceCreateConstantsArrayMethodString) + .function("setInterfaceCreateConstantsArrayMethodString", &libcellml::GeneratorProfile::setInterfaceCreateConstantsArrayMethodString) + .function("implementationCreateConstantsArrayMethodString", &libcellml::GeneratorProfile::implementationCreateConstantsArrayMethodString) + .function("setImplementationCreateConstantsArrayMethodString", &libcellml::GeneratorProfile::setImplementationCreateConstantsArrayMethodString) + .function("interfaceCreateComputedConstantsArrayMethodString", &libcellml::GeneratorProfile::interfaceCreateComputedConstantsArrayMethodString) + .function("setInterfaceCreateComputedConstantsArrayMethodString", &libcellml::GeneratorProfile::setInterfaceCreateComputedConstantsArrayMethodString) + .function("implementationCreateComputedConstantsArrayMethodString", &libcellml::GeneratorProfile::implementationCreateComputedConstantsArrayMethodString) + .function("setImplementationCreateComputedConstantsArrayMethodString", &libcellml::GeneratorProfile::setImplementationCreateComputedConstantsArrayMethodString) + .function("interfaceCreateAlgebraicArrayMethodString", &libcellml::GeneratorProfile::interfaceCreateAlgebraicArrayMethodString) + .function("setInterfaceCreateAlgebraicArrayMethodString", &libcellml::GeneratorProfile::setInterfaceCreateAlgebraicArrayMethodString) + .function("implementationCreateAlgebraicArrayMethodString", &libcellml::GeneratorProfile::implementationCreateAlgebraicArrayMethodString) + .function("setImplementationCreateAlgebraicArrayMethodString", &libcellml::GeneratorProfile::setImplementationCreateAlgebraicArrayMethodString) + .function("interfaceCreateExternalsArrayMethodString", &libcellml::GeneratorProfile::interfaceCreateExternalsArrayMethodString) + .function("setInterfaceCreateExternalsArrayMethodString", &libcellml::GeneratorProfile::setInterfaceCreateExternalsArrayMethodString) + .function("implementationCreateExternalsArrayMethodString", &libcellml::GeneratorProfile::implementationCreateExternalsArrayMethodString) + .function("setImplementationCreateExternalsArrayMethodString", &libcellml::GeneratorProfile::setImplementationCreateExternalsArrayMethodString) .function("interfaceDeleteArrayMethodString", &libcellml::GeneratorProfile::interfaceDeleteArrayMethodString) .function("setInterfaceDeleteArrayMethodString", &libcellml::GeneratorProfile::setInterfaceDeleteArrayMethodString) .function("implementationDeleteArrayMethodString", &libcellml::GeneratorProfile::implementationDeleteArrayMethodString) diff --git a/src/generator.cpp b/src/generator.cpp index cf994f3e83..d47bdf7ce1 100644 --- a/src/generator.cpp +++ b/src/generator.cpp @@ -648,12 +648,26 @@ void Generator::GeneratorImpl::addInterfaceCreateDeleteArrayMethodsCode() code += mProfile->interfaceCreateStatesArrayMethodString(); } - if (!mProfile->interfaceCreateVariablesArrayMethodString().empty()) { - code += mProfile->interfaceCreateVariablesArrayMethodString(); + if (!mProfile->interfaceCreateConstantsArrayMethodString().empty()) { + code += mProfile->interfaceCreateConstantsArrayMethodString(); + } + + if (!mProfile->interfaceCreateComputedConstantsArrayMethodString().empty()) { + code += mProfile->interfaceCreateComputedConstantsArrayMethodString(); + } + + if (!mProfile->interfaceCreateAlgebraicArrayMethodString().empty()) { + code += mProfile->interfaceCreateAlgebraicArrayMethodString(); + } + + if (mModel->hasExternalVariables() + && !mProfile->interfaceCreateExternalsArrayMethodString().empty()) { + code += mProfile->interfaceCreateExternalsArrayMethodString(); } if (!mProfile->interfaceDeleteArrayMethodString().empty()) { - code += mProfile->interfaceDeleteArrayMethodString(); + code += "\n" + + mProfile->interfaceDeleteArrayMethodString(); } if (!code.empty()) { @@ -663,43 +677,53 @@ void Generator::GeneratorImpl::addInterfaceCreateDeleteArrayMethodsCode() mCode += code; } -void Generator::GeneratorImpl::addExternalVariableMethodTypeDefinitionCode() -{ - if (mModel->hasExternalVariables()) { - auto externalVariableMethodTypeDefinitionString = mProfile->externalVariableMethodTypeDefinitionString(modelHasOdes()); - - if (!externalVariableMethodTypeDefinitionString.empty()) { - mCode += "\n" - + externalVariableMethodTypeDefinitionString; - } - } -} - -void Generator::GeneratorImpl::addImplementationCreateStatesArrayMethodCode() +void Generator::GeneratorImpl::addImplementationCreateDeleteArrayMethodsCode() { if (modelHasOdes() && !mProfile->implementationCreateStatesArrayMethodString().empty()) { mCode += newLineIfNeeded() + mProfile->implementationCreateStatesArrayMethodString(); } -} -void Generator::GeneratorImpl::addImplementationCreateVariablesArrayMethodCode() -{ - if (!mProfile->implementationCreateVariablesArrayMethodString().empty()) { + if (!mProfile->implementationCreateConstantsArrayMethodString().empty()) { mCode += newLineIfNeeded() - + mProfile->implementationCreateVariablesArrayMethodString(); + + mProfile->implementationCreateConstantsArrayMethodString(); + } + + if (!mProfile->implementationCreateComputedConstantsArrayMethodString().empty()) { + mCode += newLineIfNeeded() + + mProfile->implementationCreateComputedConstantsArrayMethodString(); + } + + if (!mProfile->implementationCreateAlgebraicArrayMethodString().empty()) { + mCode += newLineIfNeeded() + + mProfile->implementationCreateAlgebraicArrayMethodString(); + } + + if (mModel->hasExternalVariables() + && !mProfile->implementationCreateExternalsArrayMethodString().empty()) { + mCode += newLineIfNeeded() + + mProfile->implementationCreateExternalsArrayMethodString(); } -} -void Generator::GeneratorImpl::addImplementationDeleteArrayMethodCode() -{ if (!mProfile->implementationDeleteArrayMethodString().empty()) { mCode += newLineIfNeeded() + mProfile->implementationDeleteArrayMethodString(); } } +void Generator::GeneratorImpl::addExternalVariableMethodTypeDefinitionCode() +{ + if (mModel->hasExternalVariables()) { + auto externalVariableMethodTypeDefinitionString = mProfile->externalVariableMethodTypeDefinitionString(modelHasOdes()); + + if (!externalVariableMethodTypeDefinitionString.empty()) { + mCode += "\n" + + externalVariableMethodTypeDefinitionString; + } + } +} + void Generator::GeneratorImpl::addRootFindingInfoObjectCode() { if (modelHasNlas() @@ -2066,9 +2090,7 @@ std::string Generator::implementationCode() const // Add code for the implementation to create and delete arrays. - mPimpl->addImplementationCreateStatesArrayMethodCode(); - mPimpl->addImplementationCreateVariablesArrayMethodCode(); - mPimpl->addImplementationDeleteArrayMethodCode(); + mPimpl->addImplementationCreateDeleteArrayMethodsCode(); // Add code for the NLA solver. diff --git a/src/generator_p.h b/src/generator_p.h index 02c6fdf5a5..05c3298a65 100644 --- a/src/generator_p.h +++ b/src/generator_p.h @@ -100,10 +100,9 @@ struct Generator::GeneratorImpl void addTrigonometricFunctionsCode(); void addInterfaceCreateDeleteArrayMethodsCode(); + void addImplementationCreateDeleteArrayMethodsCode(); + void addExternalVariableMethodTypeDefinitionCode(); - void addImplementationCreateStatesArrayMethodCode(); - void addImplementationCreateVariablesArrayMethodCode(); - void addImplementationDeleteArrayMethodCode(); void addRootFindingInfoObjectCode(); void addExternNlaSolveMethodCode(); diff --git a/src/generatorprofile.cpp b/src/generatorprofile.cpp index 2655cce439..bf01698d5e 100644 --- a/src/generatorprofile.cpp +++ b/src/generatorprofile.cpp @@ -354,12 +354,48 @@ void GeneratorProfile::GeneratorProfileImpl::loadProfile(GeneratorProfile::Profi " return res;\n" "}\n"; - mInterfaceCreateVariablesArrayMethodString = "double * createVariablesArray();\n"; - mImplementationCreateVariablesArrayMethodString = "double * createVariablesArray()\n" + mInterfaceCreateConstantsArrayMethodString = "double * createConstantsArray();\n"; + mImplementationCreateConstantsArrayMethodString = "double * createConstantsArray()\n" "{\n" - " double *res = (double *) malloc(VARIABLE_COUNT*sizeof(double));\n" + " double *res = (double *) malloc(CONSTANT_COUNT*sizeof(double));\n" "\n" - " for (size_t i = 0; i < VARIABLE_COUNT; ++i) {\n" + " for (size_t i = 0; i < CONSTANT_COUNT; ++i) {\n" + " res[i] = NAN;\n" + " }\n" + "\n" + " return res;\n" + "}\n"; + + mInterfaceCreateComputedConstantsArrayMethodString = "double * createComputedConstantsArray();\n"; + mImplementationCreateComputedConstantsArrayMethodString = "double * createComputedConstantsArray()\n" + "{\n" + " double *res = (double *) malloc(COMPUTED_CONSTANT_COUNT*sizeof(double));\n" + "\n" + " for (size_t i = 0; i < COMPUTED_CONSTANT_COUNT; ++i) {\n" + " res[i] = NAN;\n" + " }\n" + "\n" + " return res;\n" + "}\n"; + + mInterfaceCreateAlgebraicArrayMethodString = "double * createAlgebraicArray();\n"; + mImplementationCreateAlgebraicArrayMethodString = "double * createAlgebraicArray()\n" + "{\n" + " double *res = (double *) malloc(ALGEBRAIC_COUNT*sizeof(double));\n" + "\n" + " for (size_t i = 0; i < ALGEBRAIC_COUNT; ++i) {\n" + " res[i] = NAN;\n" + " }\n" + "\n" + " return res;\n" + "}\n"; + + mInterfaceCreateExternalsArrayMethodString = "double * createExternalsArray();\n"; + mImplementationCreateExternalsArrayMethodString = "double * createExternalsArray()\n" + "{\n" + " double *res = (double *) malloc(EXTERNAL_COUNT*sizeof(double));\n" + "\n" + " for (size_t i = 0; i < EXTERNAL_COUNT; ++i) {\n" " res[i] = NAN;\n" " }\n" "\n" @@ -749,10 +785,25 @@ void GeneratorProfile::GeneratorProfileImpl::loadProfile(GeneratorProfile::Profi "def create_states_array():\n" " return [nan]*STATE_COUNT\n"; - mInterfaceCreateVariablesArrayMethodString = ""; - mImplementationCreateVariablesArrayMethodString = "\n" - "def create_variables_array():\n" - " return [nan]*VARIABLE_COUNT\n"; + mInterfaceCreateConstantsArrayMethodString = ""; + mImplementationCreateConstantsArrayMethodString = "\n" + "def create_constants_array():\n" + " return [nan]*CONSTANT_COUNT\n"; + + mInterfaceCreateComputedConstantsArrayMethodString = ""; + mImplementationCreateComputedConstantsArrayMethodString = "\n" + "def create_computed_constants_array():\n" + " return [nan]*COMPUTED_CONSTANT_COUNT\n"; + + mInterfaceCreateAlgebraicArrayMethodString = ""; + mImplementationCreateAlgebraicArrayMethodString = "\n" + "def create_algebraic_array():\n" + " return [nan]*ALGEBRAIC_COUNT\n"; + + mInterfaceCreateExternalsArrayMethodString = ""; + mImplementationCreateExternalsArrayMethodString = "\n" + "def create_externals_array():\n" + " return [nan]*EXTERNAL_COUNT\n"; mInterfaceDeleteArrayMethodString = ""; mImplementationDeleteArrayMethodString = ""; @@ -2418,24 +2469,84 @@ void GeneratorProfile::setImplementationCreateStatesArrayMethodString(const std: mPimpl->mImplementationCreateStatesArrayMethodString = implementationCreateStatesArrayMethodString; } -std::string GeneratorProfile::interfaceCreateVariablesArrayMethodString() const +std::string GeneratorProfile::interfaceCreateConstantsArrayMethodString() const +{ + return mPimpl->mInterfaceCreateConstantsArrayMethodString; +} + +void GeneratorProfile::setInterfaceCreateConstantsArrayMethodString(const std::string &interfaceCreateConstantsArrayMethodString) +{ + mPimpl->mInterfaceCreateConstantsArrayMethodString = interfaceCreateConstantsArrayMethodString; +} + +std::string GeneratorProfile::implementationCreateConstantsArrayMethodString() const +{ + return mPimpl->mImplementationCreateConstantsArrayMethodString; +} + +void GeneratorProfile::setImplementationCreateConstantsArrayMethodString(const std::string &implementationCreateConstantsArrayMethodString) +{ + mPimpl->mImplementationCreateConstantsArrayMethodString = implementationCreateConstantsArrayMethodString; +} + +std::string GeneratorProfile::interfaceCreateComputedConstantsArrayMethodString() const +{ + return mPimpl->mInterfaceCreateComputedConstantsArrayMethodString; +} + +void GeneratorProfile::setInterfaceCreateComputedConstantsArrayMethodString(const std::string &interfaceCreateComputedConstantsArrayMethodString) +{ + mPimpl->mInterfaceCreateComputedConstantsArrayMethodString = interfaceCreateComputedConstantsArrayMethodString; +} + +std::string GeneratorProfile::implementationCreateComputedConstantsArrayMethodString() const +{ + return mPimpl->mImplementationCreateComputedConstantsArrayMethodString; +} + +void GeneratorProfile::setImplementationCreateComputedConstantsArrayMethodString(const std::string &implementationCreateComputedConstantsArrayMethodString) +{ + mPimpl->mImplementationCreateComputedConstantsArrayMethodString = implementationCreateComputedConstantsArrayMethodString; +} + +std::string GeneratorProfile::interfaceCreateAlgebraicArrayMethodString() const +{ + return mPimpl->mInterfaceCreateAlgebraicArrayMethodString; +} + +void GeneratorProfile::setInterfaceCreateAlgebraicArrayMethodString(const std::string &interfaceCreateAlgebraicArrayMethodString) +{ + mPimpl->mInterfaceCreateAlgebraicArrayMethodString = interfaceCreateAlgebraicArrayMethodString; +} + +std::string GeneratorProfile::implementationCreateAlgebraicArrayMethodString() const +{ + return mPimpl->mImplementationCreateAlgebraicArrayMethodString; +} + +void GeneratorProfile::setImplementationCreateAlgebraicArrayMethodString(const std::string &implementationCreateAlgebraicArrayMethodString) +{ + mPimpl->mImplementationCreateAlgebraicArrayMethodString = implementationCreateAlgebraicArrayMethodString; +} + +std::string GeneratorProfile::interfaceCreateExternalsArrayMethodString() const { - return mPimpl->mInterfaceCreateVariablesArrayMethodString; + return mPimpl->mInterfaceCreateExternalsArrayMethodString; } -void GeneratorProfile::setInterfaceCreateVariablesArrayMethodString(const std::string &interfaceCreateVariablesArrayMethodString) +void GeneratorProfile::setInterfaceCreateExternalsArrayMethodString(const std::string &interfaceCreateExternalsArrayMethodString) { - mPimpl->mInterfaceCreateVariablesArrayMethodString = interfaceCreateVariablesArrayMethodString; + mPimpl->mInterfaceCreateExternalsArrayMethodString = interfaceCreateExternalsArrayMethodString; } -std::string GeneratorProfile::implementationCreateVariablesArrayMethodString() const +std::string GeneratorProfile::implementationCreateExternalsArrayMethodString() const { - return mPimpl->mImplementationCreateVariablesArrayMethodString; + return mPimpl->mImplementationCreateExternalsArrayMethodString; } -void GeneratorProfile::setImplementationCreateVariablesArrayMethodString(const std::string &implementationCreateVariablesArrayMethodString) +void GeneratorProfile::setImplementationCreateExternalsArrayMethodString(const std::string &implementationCreateExternalsArrayMethodString) { - mPimpl->mImplementationCreateVariablesArrayMethodString = implementationCreateVariablesArrayMethodString; + mPimpl->mImplementationCreateExternalsArrayMethodString = implementationCreateExternalsArrayMethodString; } std::string GeneratorProfile::interfaceDeleteArrayMethodString() const diff --git a/src/generatorprofile_p.h b/src/generatorprofile_p.h index e87a24da7c..286edca8e7 100644 --- a/src/generatorprofile_p.h +++ b/src/generatorprofile_p.h @@ -241,8 +241,17 @@ struct GeneratorProfile::GeneratorProfileImpl std::string mInterfaceCreateStatesArrayMethodString; std::string mImplementationCreateStatesArrayMethodString; - std::string mInterfaceCreateVariablesArrayMethodString; - std::string mImplementationCreateVariablesArrayMethodString; + std::string mInterfaceCreateConstantsArrayMethodString; + std::string mImplementationCreateConstantsArrayMethodString; + + std::string mInterfaceCreateComputedConstantsArrayMethodString; + std::string mImplementationCreateComputedConstantsArrayMethodString; + + std::string mInterfaceCreateAlgebraicArrayMethodString; + std::string mImplementationCreateAlgebraicArrayMethodString; + + std::string mInterfaceCreateExternalsArrayMethodString; + std::string mImplementationCreateExternalsArrayMethodString; std::string mInterfaceDeleteArrayMethodString; std::string mImplementationDeleteArrayMethodString; diff --git a/src/generatorprofilesha1values.h b/src/generatorprofilesha1values.h index 577df6a27e..6c33678d7f 100644 --- a/src/generatorprofilesha1values.h +++ b/src/generatorprofilesha1values.h @@ -24,7 +24,7 @@ namespace libcellml { * The content of this file is generated, do not edit this file directly. * See docs/dev_utilities.rst for further information. */ -static const char C_GENERATOR_PROFILE_SHA1[] = "14c2693a5338e70419f230e375f49acef40a68ce"; -static const char PYTHON_GENERATOR_PROFILE_SHA1[] = "23ed0dcff0e9015280889861f4d75420fd14c211"; +static const char C_GENERATOR_PROFILE_SHA1[] = "4b3052f697b7b57e1ffeb50a6a43d332e87fad35"; +static const char PYTHON_GENERATOR_PROFILE_SHA1[] = "17d32a31120c2c7ce57a85e08402419e1509e330"; } // namespace libcellml diff --git a/src/generatorprofiletools.cpp b/src/generatorprofiletools.cpp index 9891778cee..d74e462bee 100644 --- a/src/generatorprofiletools.cpp +++ b/src/generatorprofiletools.cpp @@ -507,8 +507,17 @@ std::string generatorProfileAsString(const GeneratorProfilePtr &generatorProfile profileContents += generatorProfile->interfaceCreateStatesArrayMethodString() + generatorProfile->implementationCreateStatesArrayMethodString(); - profileContents += generatorProfile->interfaceCreateVariablesArrayMethodString() - + generatorProfile->implementationCreateVariablesArrayMethodString(); + profileContents += generatorProfile->interfaceCreateConstantsArrayMethodString() + + generatorProfile->implementationCreateConstantsArrayMethodString(); + + profileContents += generatorProfile->interfaceCreateComputedConstantsArrayMethodString() + + generatorProfile->implementationCreateComputedConstantsArrayMethodString(); + + profileContents += generatorProfile->interfaceCreateAlgebraicArrayMethodString() + + generatorProfile->implementationCreateAlgebraicArrayMethodString(); + + profileContents += generatorProfile->interfaceCreateExternalsArrayMethodString() + + generatorProfile->implementationCreateExternalsArrayMethodString(); profileContents += generatorProfile->interfaceDeleteArrayMethodString() + generatorProfile->implementationDeleteArrayMethodString(); diff --git a/tests/bindings/javascript/generator.test.js b/tests/bindings/javascript/generator.test.js index 112ca913e3..b5860fd01d 100644 --- a/tests/bindings/javascript/generator.test.js +++ b/tests/bindings/javascript/generator.test.js @@ -62,10 +62,10 @@ describe("Generator tests", () => { g.setModel(a.model()) const interface_lines = g.interfaceCode().split('\n') - expect(interface_lines.length).toBe(44) + expect(interface_lines.length).toBe(37) const implementation_lines = g.implementationCode().split('\n') - expect(implementation_lines.length).toBe(66) + expect(implementation_lines.length).toBe(97) const equation_line_1 = libcellml.Generator.equationCode(a.model().equation(0).ast()) expect(equation_line_1.length).toBe(14) diff --git a/tests/bindings/javascript/generatorprofile.test.js b/tests/bindings/javascript/generatorprofile.test.js index 6aa7460ee7..81b1b13ff1 100644 --- a/tests/bindings/javascript/generatorprofile.test.js +++ b/tests/bindings/javascript/generatorprofile.test.js @@ -945,17 +945,53 @@ describe("GeneratorProfile tests", () => { x.setImplementationCreateStatesArrayMethodString("something") expect(x.implementationCreateStatesArrayMethodString()).toBe("something") }); - test("Checking GeneratorProfile.interfaceCreateVariablesArrayMethodString.", () => { + test("Checking GeneratorProfile.interfaceCreateConstantsArrayMethodString.", () => { const x = new libcellml.GeneratorProfile(libcellml.GeneratorProfile.Profile.C) - x.setInterfaceCreateVariablesArrayMethodString("something") - expect(x.interfaceCreateVariablesArrayMethodString()).toBe("something") + x.setInterfaceCreateConstantsArrayMethodString("something") + expect(x.interfaceCreateConstantsArrayMethodString()).toBe("something") }); - test("Checking GeneratorProfile.implementationCreateVariablesArrayMethodString.", () => { + test("Checking GeneratorProfile.implementationCreateConstantsArrayMethodString.", () => { const x = new libcellml.GeneratorProfile(libcellml.GeneratorProfile.Profile.C) - x.setImplementationCreateVariablesArrayMethodString("something") - expect(x.implementationCreateVariablesArrayMethodString()).toBe("something") + x.setImplementationCreateConstantsArrayMethodString("something") + expect(x.implementationCreateConstantsArrayMethodString()).toBe("something") + }); + test("Checking GeneratorProfile.interfaceCreateComputedConstantsArrayMethodString.", () => { + const x = new libcellml.GeneratorProfile(libcellml.GeneratorProfile.Profile.C) + + x.setInterfaceCreateComputedConstantsArrayMethodString("something") + expect(x.interfaceCreateComputedConstantsArrayMethodString()).toBe("something") + }); + test("Checking GeneratorProfile.implementationCreateComputedConstantsArrayMethodString.", () => { + const x = new libcellml.GeneratorProfile(libcellml.GeneratorProfile.Profile.C) + + x.setImplementationCreateComputedConstantsArrayMethodString("something") + expect(x.implementationCreateComputedConstantsArrayMethodString()).toBe("something") + }); + test("Checking GeneratorProfile.interfaceCreateAlgebraicArrayMethodString.", () => { + const x = new libcellml.GeneratorProfile(libcellml.GeneratorProfile.Profile.C) + + x.setInterfaceCreateAlgebraicArrayMethodString("something") + expect(x.interfaceCreateAlgebraicArrayMethodString()).toBe("something") + }); + test("Checking GeneratorProfile.implementationCreateAlgebraicArrayMethodString.", () => { + const x = new libcellml.GeneratorProfile(libcellml.GeneratorProfile.Profile.C) + + x.setImplementationCreateAlgebraicArrayMethodString("something") + expect(x.implementationCreateAlgebraicArrayMethodString()).toBe("something") + }); + test("Checking GeneratorProfile.interfaceCreateExternalsArrayMethodString.", () => { + const x = new libcellml.GeneratorProfile(libcellml.GeneratorProfile.Profile.C) + + x.setInterfaceCreateExternalsArrayMethodString("something") + expect(x.interfaceCreateExternalsArrayMethodString()).toBe("something") + }); + test("Checking GeneratorProfile.implementationCreateExternalsArrayMethodString.", () => { + const x = new libcellml.GeneratorProfile(libcellml.GeneratorProfile.Profile.C) + + x.setImplementationCreateExternalsArrayMethodString("something") + expect(x.implementationCreateExternalsArrayMethodString()).toBe("something") }); test("Checking GeneratorProfile.interfaceDeleteArrayMethodString.", () => { const x = new libcellml.GeneratorProfile(libcellml.GeneratorProfile.Profile.C) diff --git a/tests/bindings/python/test_generator_profile.py b/tests/bindings/python/test_generator_profile.py index cf532b8a6f..d4dfabfa50 100644 --- a/tests/bindings/python/test_generator_profile.py +++ b/tests/bindings/python/test_generator_profile.py @@ -769,16 +769,49 @@ def test_implementation_create_states_array_method_string(self): g.setImplementationCreateStatesArrayMethodString(GeneratorProfileTestCase.VALUE) self.assertEqual(GeneratorProfileTestCase.VALUE, g.implementationCreateStatesArrayMethodString()) - def test_implementation_create_variables_array_method_string(self): + def test_implementation_create_constants_array_method_string(self): from libcellml import GeneratorProfile g = GeneratorProfile() self.assertEqual( - 'double * createVariablesArray()\n{\n double *res = (double *) malloc(VARIABLE_COUNT*sizeof(double));\n\n for (size_t i = 0; i < VARIABLE_COUNT; ++i) {\n res[i] = NAN;\n }\n\n return res;\n}\n', - g.implementationCreateVariablesArrayMethodString()) - g.setImplementationCreateVariablesArrayMethodString(GeneratorProfileTestCase.VALUE) - self.assertEqual(GeneratorProfileTestCase.VALUE, g.implementationCreateVariablesArrayMethodString()) + 'double * createConstantsArray()\n{\n double *res = (double *) malloc(CONSTANT_COUNT*sizeof(double));\n\n for (size_t i = 0; i < CONSTANT_COUNT; ++i) {\n res[i] = NAN;\n }\n\n return res;\n}\n', + g.implementationCreateConstantsArrayMethodString()) + g.setImplementationCreateConstantsArrayMethodString(GeneratorProfileTestCase.VALUE) + self.assertEqual(GeneratorProfileTestCase.VALUE, g.implementationCreateConstantsArrayMethodString()) + + def test_implementation_create_computed_constants_array_method_string(self): + from libcellml import GeneratorProfile + + g = GeneratorProfile() + + self.assertEqual( + 'double * createComputedConstantsArray()\n{\n double *res = (double *) malloc(COMPUTED_CONSTANT_COUNT*sizeof(double));\n\n for (size_t i = 0; i < COMPUTED_CONSTANT_COUNT; ++i) {\n res[i] = NAN;\n }\n\n return res;\n}\n', + g.implementationCreateComputedConstantsArrayMethodString()) + g.setImplementationCreateComputedConstantsArrayMethodString(GeneratorProfileTestCase.VALUE) + self.assertEqual(GeneratorProfileTestCase.VALUE, g.implementationCreateComputedConstantsArrayMethodString()) + + def test_implementation_create_algebraic_array_method_string(self): + from libcellml import GeneratorProfile + + g = GeneratorProfile() + + self.assertEqual( + 'double * createAlgebraicArray()\n{\n double *res = (double *) malloc(ALGEBRAIC_COUNT*sizeof(double));\n\n for (size_t i = 0; i < ALGEBRAIC_COUNT; ++i) {\n res[i] = NAN;\n }\n\n return res;\n}\n', + g.implementationCreateAlgebraicArrayMethodString()) + g.setImplementationCreateAlgebraicArrayMethodString(GeneratorProfileTestCase.VALUE) + self.assertEqual(GeneratorProfileTestCase.VALUE, g.implementationCreateAlgebraicArrayMethodString()) + + def test_implementation_create_externals_array_method_string(self): + from libcellml import GeneratorProfile + + g = GeneratorProfile() + + self.assertEqual( + 'double * createExternalsArray()\n{\n double *res = (double *) malloc(EXTERNAL_COUNT*sizeof(double));\n\n for (size_t i = 0; i < EXTERNAL_COUNT; ++i) {\n res[i] = NAN;\n }\n\n return res;\n}\n', + g.implementationCreateExternalsArrayMethodString()) + g.setImplementationCreateExternalsArrayMethodString(GeneratorProfileTestCase.VALUE) + self.assertEqual(GeneratorProfileTestCase.VALUE, g.implementationCreateExternalsArrayMethodString()) def test_implementation_delete_array_method_string(self): from libcellml import GeneratorProfile @@ -1026,14 +1059,41 @@ def test_interface_create_states_array_method_string(self): g.setInterfaceCreateStatesArrayMethodString(GeneratorProfileTestCase.VALUE) self.assertEqual(GeneratorProfileTestCase.VALUE, g.interfaceCreateStatesArrayMethodString()) - def test_interface_create_variables_array_method_string(self): + def test_interface_create_constants_array_method_string(self): + from libcellml import GeneratorProfile + + g = GeneratorProfile() + + self.assertEqual('double * createConstantsArray();\n', g.interfaceCreateConstantsArrayMethodString()) + g.setInterfaceCreateConstantsArrayMethodString(GeneratorProfileTestCase.VALUE) + self.assertEqual(GeneratorProfileTestCase.VALUE, g.interfaceCreateConstantsArrayMethodString()) + + def test_interface_create_computed_constants_array_method_string(self): + from libcellml import GeneratorProfile + + g = GeneratorProfile() + + self.assertEqual('double * createComputedConstantsArray();\n', g.interfaceCreateComputedConstantsArrayMethodString()) + g.setInterfaceCreateComputedConstantsArrayMethodString(GeneratorProfileTestCase.VALUE) + self.assertEqual(GeneratorProfileTestCase.VALUE, g.interfaceCreateComputedConstantsArrayMethodString()) + + def test_interface_create_algebraic_array_method_string(self): + from libcellml import GeneratorProfile + + g = GeneratorProfile() + + self.assertEqual('double * createAlgebraicArray();\n', g.interfaceCreateAlgebraicArrayMethodString()) + g.setInterfaceCreateAlgebraicArrayMethodString(GeneratorProfileTestCase.VALUE) + self.assertEqual(GeneratorProfileTestCase.VALUE, g.interfaceCreateAlgebraicArrayMethodString()) + + def test_interface_create_externals_array_method_string(self): from libcellml import GeneratorProfile g = GeneratorProfile() - self.assertEqual('double * createVariablesArray();\n', g.interfaceCreateVariablesArrayMethodString()) - g.setInterfaceCreateVariablesArrayMethodString(GeneratorProfileTestCase.VALUE) - self.assertEqual(GeneratorProfileTestCase.VALUE, g.interfaceCreateVariablesArrayMethodString()) + self.assertEqual('double * createExternalsArray();\n', g.interfaceCreateExternalsArrayMethodString()) + g.setInterfaceCreateExternalsArrayMethodString(GeneratorProfileTestCase.VALUE) + self.assertEqual(GeneratorProfileTestCase.VALUE, g.interfaceCreateExternalsArrayMethodString()) def test_interface_delete_array_method_string(self): from libcellml import GeneratorProfile diff --git a/tests/coverage/coverage.cpp b/tests/coverage/coverage.cpp index b2e37fbab4..097dcdaccd 100644 --- a/tests/coverage/coverage.cpp +++ b/tests/coverage/coverage.cpp @@ -736,7 +736,13 @@ TEST(Coverage, generator) profile->setImplementationCreateStatesArrayMethodString(""); - profile->setImplementationCreateVariablesArrayMethodString(""); + profile->setImplementationCreateConstantsArrayMethodString(""); + + profile->setImplementationCreateComputedConstantsArrayMethodString(""); + + profile->setImplementationCreateAlgebraicArrayMethodString(""); + + profile->setImplementationCreateExternalsArrayMethodString(""); profile->setImplementationDeleteArrayMethodString(""); diff --git a/tests/generator/generatorprofile.cpp b/tests/generator/generatorprofile.cpp index 97cba41273..cf556ec3f9 100644 --- a/tests/generator/generatorprofile.cpp +++ b/tests/generator/generatorprofile.cpp @@ -347,20 +347,6 @@ TEST(GeneratorProfile, defaultMiscellaneousValues) EXPECT_EQ("externalVariable(variables, [INDEX])", generatorProfile->externalVariableMethodCallString(false)); EXPECT_EQ("externalVariable(voi, states, rates, variables, [INDEX])", generatorProfile->externalVariableMethodCallString(true)); - EXPECT_EQ("double * createStatesArray();\n", - generatorProfile->interfaceCreateStatesArrayMethodString()); - EXPECT_EQ("double * createStatesArray()\n" - "{\n" - " double *res = (double *) malloc(STATE_COUNT*sizeof(double));\n" - "\n" - " for (size_t i = 0; i < STATE_COUNT; ++i) {\n" - " res[i] = NAN;\n" - " }\n" - "\n" - " return res;\n" - "}\n", - generatorProfile->implementationCreateStatesArrayMethodString()); - EXPECT_EQ("typedef struct {\n" " double *variables;\n" "} RootFindingInfo;\n", @@ -421,19 +407,75 @@ TEST(GeneratorProfile, defaultMiscellaneousValues) EXPECT_EQ("f", generatorProfile->fArrayString()); - EXPECT_EQ("double * createVariablesArray();\n", - generatorProfile->interfaceCreateVariablesArrayMethodString()); - EXPECT_EQ("double * createVariablesArray()\n" + EXPECT_EQ("double * createStatesArray();\n", + generatorProfile->interfaceCreateStatesArrayMethodString()); + EXPECT_EQ("double * createStatesArray()\n" + "{\n" + " double *res = (double *) malloc(STATE_COUNT*sizeof(double));\n" + "\n" + " for (size_t i = 0; i < STATE_COUNT; ++i) {\n" + " res[i] = NAN;\n" + " }\n" + "\n" + " return res;\n" + "}\n", + generatorProfile->implementationCreateStatesArrayMethodString()); + + EXPECT_EQ("double * createConstantsArray();\n", + generatorProfile->interfaceCreateConstantsArrayMethodString()); + EXPECT_EQ("double * createConstantsArray()\n" + "{\n" + " double *res = (double *) malloc(CONSTANT_COUNT*sizeof(double));\n" + "\n" + " for (size_t i = 0; i < CONSTANT_COUNT; ++i) {\n" + " res[i] = NAN;\n" + " }\n" + "\n" + " return res;\n" + "}\n", + generatorProfile->implementationCreateConstantsArrayMethodString()); + + EXPECT_EQ("double * createComputedConstantsArray();\n", + generatorProfile->interfaceCreateComputedConstantsArrayMethodString()); + EXPECT_EQ("double * createComputedConstantsArray()\n" + "{\n" + " double *res = (double *) malloc(COMPUTED_CONSTANT_COUNT*sizeof(double));\n" + "\n" + " for (size_t i = 0; i < COMPUTED_CONSTANT_COUNT; ++i) {\n" + " res[i] = NAN;\n" + " }\n" + "\n" + " return res;\n" + "}\n", + generatorProfile->implementationCreateComputedConstantsArrayMethodString()); + + EXPECT_EQ("double * createAlgebraicArray();\n", + generatorProfile->interfaceCreateAlgebraicArrayMethodString()); + EXPECT_EQ("double * createAlgebraicArray()\n" "{\n" - " double *res = (double *) malloc(VARIABLE_COUNT*sizeof(double));\n" + " double *res = (double *) malloc(ALGEBRAIC_COUNT*sizeof(double));\n" "\n" - " for (size_t i = 0; i < VARIABLE_COUNT; ++i) {\n" + " for (size_t i = 0; i < ALGEBRAIC_COUNT; ++i) {\n" " res[i] = NAN;\n" " }\n" "\n" " return res;\n" "}\n", - generatorProfile->implementationCreateVariablesArrayMethodString()); + generatorProfile->implementationCreateAlgebraicArrayMethodString()); + + EXPECT_EQ("double * createExternalsArray();\n", + generatorProfile->interfaceCreateExternalsArrayMethodString()); + EXPECT_EQ("double * createExternalsArray()\n" + "{\n" + " double *res = (double *) malloc(EXTERNAL_COUNT*sizeof(double));\n" + "\n" + " for (size_t i = 0; i < EXTERNAL_COUNT; ++i) {\n" + " res[i] = NAN;\n" + " }\n" + "\n" + " return res;\n" + "}\n", + generatorProfile->implementationCreateExternalsArrayMethodString()); EXPECT_EQ("void deleteArray(double *array);\n", generatorProfile->interfaceDeleteArrayMethodString()); @@ -903,9 +945,6 @@ TEST(GeneratorProfile, miscellaneous) generatorProfile->setExternalVariableMethodCallString(false, value); generatorProfile->setExternalVariableMethodCallString(true, value); - generatorProfile->setInterfaceCreateStatesArrayMethodString(value); - generatorProfile->setImplementationCreateStatesArrayMethodString(value); - generatorProfile->setRootFindingInfoObjectString(false, value); generatorProfile->setRootFindingInfoObjectString(true, value); generatorProfile->setExternNlaSolveMethodString(value); @@ -920,8 +959,20 @@ TEST(GeneratorProfile, miscellaneous) generatorProfile->setUArrayString(value); generatorProfile->setFArrayString(value); - generatorProfile->setInterfaceCreateVariablesArrayMethodString(value); - generatorProfile->setImplementationCreateVariablesArrayMethodString(value); + generatorProfile->setInterfaceCreateStatesArrayMethodString(value); + generatorProfile->setImplementationCreateStatesArrayMethodString(value); + + generatorProfile->setInterfaceCreateConstantsArrayMethodString(value); + generatorProfile->setImplementationCreateConstantsArrayMethodString(value); + + generatorProfile->setInterfaceCreateComputedConstantsArrayMethodString(value); + generatorProfile->setImplementationCreateComputedConstantsArrayMethodString(value); + + generatorProfile->setInterfaceCreateAlgebraicArrayMethodString(value); + generatorProfile->setImplementationCreateAlgebraicArrayMethodString(value); + + generatorProfile->setInterfaceCreateExternalsArrayMethodString(value); + generatorProfile->setImplementationCreateExternalsArrayMethodString(value); generatorProfile->setInterfaceDeleteArrayMethodString(value); generatorProfile->setImplementationDeleteArrayMethodString(value); @@ -1040,9 +1091,6 @@ TEST(GeneratorProfile, miscellaneous) EXPECT_EQ(value, generatorProfile->externalVariableMethodCallString(false)); EXPECT_EQ(value, generatorProfile->externalVariableMethodCallString(true)); - EXPECT_EQ(value, generatorProfile->interfaceCreateStatesArrayMethodString()); - EXPECT_EQ(value, generatorProfile->implementationCreateStatesArrayMethodString()); - EXPECT_EQ(value, generatorProfile->rootFindingInfoObjectString(false)); EXPECT_EQ(value, generatorProfile->rootFindingInfoObjectString(true)); EXPECT_EQ(value, generatorProfile->externNlaSolveMethodString()); @@ -1057,8 +1105,20 @@ TEST(GeneratorProfile, miscellaneous) EXPECT_EQ(value, generatorProfile->uArrayString()); EXPECT_EQ(value, generatorProfile->fArrayString()); - EXPECT_EQ(value, generatorProfile->interfaceCreateVariablesArrayMethodString()); - EXPECT_EQ(value, generatorProfile->implementationCreateVariablesArrayMethodString()); + EXPECT_EQ(value, generatorProfile->interfaceCreateStatesArrayMethodString()); + EXPECT_EQ(value, generatorProfile->implementationCreateStatesArrayMethodString()); + + EXPECT_EQ(value, generatorProfile->interfaceCreateConstantsArrayMethodString()); + EXPECT_EQ(value, generatorProfile->implementationCreateConstantsArrayMethodString()); + + EXPECT_EQ(value, generatorProfile->interfaceCreateComputedConstantsArrayMethodString()); + EXPECT_EQ(value, generatorProfile->implementationCreateComputedConstantsArrayMethodString()); + + EXPECT_EQ(value, generatorProfile->interfaceCreateAlgebraicArrayMethodString()); + EXPECT_EQ(value, generatorProfile->implementationCreateAlgebraicArrayMethodString()); + + EXPECT_EQ(value, generatorProfile->interfaceCreateExternalsArrayMethodString()); + EXPECT_EQ(value, generatorProfile->implementationCreateExternalsArrayMethodString()); EXPECT_EQ(value, generatorProfile->interfaceDeleteArrayMethodString()); EXPECT_EQ(value, generatorProfile->implementationDeleteArrayMethodString()); diff --git a/tests/resources/coverage/generator/model.c b/tests/resources/coverage/generator/model.c index e65de4ae99..ada5039d47 100644 --- a/tests/resources/coverage/generator/model.c +++ b/tests/resources/coverage/generator/model.c @@ -329,11 +329,33 @@ double * createStatesArray() return res; } -double * createVariablesArray() +double * createConstantsArray() { - double *res = (double *) malloc(VARIABLE_COUNT*sizeof(double)); + double *res = (double *) malloc(CONSTANT_COUNT*sizeof(double)); - for (size_t i = 0; i < VARIABLE_COUNT; ++i) { + for (size_t i = 0; i < CONSTANT_COUNT; ++i) { + res[i] = NAN; + } + + return res; +} + +double * createComputedConstantsArray() +{ + double *res = (double *) malloc(COMPUTED_CONSTANT_COUNT*sizeof(double)); + + for (size_t i = 0; i < COMPUTED_CONSTANT_COUNT; ++i) { + res[i] = NAN; + } + + return res; +} + +double * createAlgebraicArray() +{ + double *res = (double *) malloc(ALGEBRAIC_COUNT*sizeof(double)); + + for (size_t i = 0; i < ALGEBRAIC_COUNT; ++i) { res[i] = NAN; } diff --git a/tests/resources/coverage/generator/model.h b/tests/resources/coverage/generator/model.h index f394f95039..8b62b74a83 100644 --- a/tests/resources/coverage/generator/model.h +++ b/tests/resources/coverage/generator/model.h @@ -25,7 +25,10 @@ extern const VariableInfo COMPUTED_CONSTANT_INFO[]; extern const VariableInfo ALGEBRAIC_INFO[]; double * createStatesArray(); -double * createVariablesArray(); +double * createConstantsArray(); +double * createComputedConstantsArray(); +double * createAlgebraicArray(); + void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *constants); diff --git a/tests/resources/coverage/generator/model.implementation.out b/tests/resources/coverage/generator/model.implementation.out index 03233d9176..9201225b73 100644 --- a/tests/resources/coverage/generator/model.implementation.out +++ b/tests/resources/coverage/generator/model.implementation.out @@ -92,11 +92,33 @@ double * createStatesArray() return res; } -double * createVariablesArray() +double * createConstantsArray() { - double *res = (double *) malloc(VARIABLE_COUNT*sizeof(double)); + double *res = (double *) malloc(CONSTANT_COUNT*sizeof(double)); - for (size_t i = 0; i < VARIABLE_COUNT; ++i) { + for (size_t i = 0; i < CONSTANT_COUNT; ++i) { + res[i] = NAN; + } + + return res; +} + +double * createComputedConstantsArray() +{ + double *res = (double *) malloc(COMPUTED_CONSTANT_COUNT*sizeof(double)); + + for (size_t i = 0; i < COMPUTED_CONSTANT_COUNT; ++i) { + res[i] = NAN; + } + + return res; +} + +double * createAlgebraicArray() +{ + double *res = (double *) malloc(ALGEBRAIC_COUNT*sizeof(double)); + + for (size_t i = 0; i < ALGEBRAIC_COUNT; ++i) { res[i] = NAN; } diff --git a/tests/resources/coverage/generator/model.interface.out b/tests/resources/coverage/generator/model.interface.out index ecc8522e29..e461b70adc 100644 --- a/tests/resources/coverage/generator/model.interface.out +++ b/tests/resources/coverage/generator/model.interface.out @@ -5,7 +5,10 @@ #include double * createStatesArray(); -double * createVariablesArray(); +double * createConstantsArray(); +double * createComputedConstantsArray(); +double * createAlgebraicArray(); + void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *constants); diff --git a/tests/resources/coverage/generator/model.modified.profile.c b/tests/resources/coverage/generator/model.modified.profile.c index d63bb27d2b..a31b1d6fb4 100644 --- a/tests/resources/coverage/generator/model.modified.profile.c +++ b/tests/resources/coverage/generator/model.modified.profile.c @@ -329,11 +329,33 @@ double * createStatesVector() return res; } -double * createVariablesArray() +double * createConstantsArray() { - double *res = (double *) malloc(VARIABLE_COUNT*sizeof(double)); + double *res = (double *) malloc(CONSTANT_COUNT*sizeof(double)); - for (size_t i = 0; i < VARIABLE_COUNT; ++i) { + for (size_t i = 0; i < CONSTANT_COUNT; ++i) { + res[i] = NAN; + } + + return res; +} + +double * createComputedConstantsArray() +{ + double *res = (double *) malloc(COMPUTED_CONSTANT_COUNT*sizeof(double)); + + for (size_t i = 0; i < COMPUTED_CONSTANT_COUNT; ++i) { + res[i] = NAN; + } + + return res; +} + +double * createAlgebraicArray() +{ + double *res = (double *) malloc(ALGEBRAIC_COUNT*sizeof(double)); + + for (size_t i = 0; i < ALGEBRAIC_COUNT; ++i) { res[i] = NAN; } diff --git a/tests/resources/coverage/generator/model.modified.profile.h b/tests/resources/coverage/generator/model.modified.profile.h index fb41e8e19d..ead7dbbbdc 100644 --- a/tests/resources/coverage/generator/model.modified.profile.h +++ b/tests/resources/coverage/generator/model.modified.profile.h @@ -25,7 +25,10 @@ extern const VariableInfo COMPUTED_CONSTANT_INFO[]; extern const VariableInfo ALGEBRAIC_INFO[]; double * createStatesVector(); -double * createVariablesArray(); +double * createConstantsArray(); +double * createComputedConstantsArray(); +double * createAlgebraicArray(); + void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *constants); diff --git a/tests/resources/coverage/generator/model.modified.profile.py b/tests/resources/coverage/generator/model.modified.profile.py index 450b761364..91b686c183 100644 --- a/tests/resources/coverage/generator/model.modified.profile.py +++ b/tests/resources/coverage/generator/model.modified.profile.py @@ -342,8 +342,16 @@ def create_states_vector(): return [nan]*STATE_COUNT -def create_variables_array(): - return [nan]*VARIABLE_COUNT +def create_constants_array(): + return [nan]*CONSTANT_COUNT + + +def create_computed_constants_array(): + return [nan]*COMPUTED_CONSTANT_COUNT + + +def create_algebraic_array(): + return [nan]*ALGEBRAIC_COUNT from nlasolver import nla_solve diff --git a/tests/resources/coverage/generator/model.py b/tests/resources/coverage/generator/model.py index 0ddd0fe1ec..11f1633e87 100644 --- a/tests/resources/coverage/generator/model.py +++ b/tests/resources/coverage/generator/model.py @@ -342,8 +342,16 @@ def create_states_array(): return [nan]*STATE_COUNT -def create_variables_array(): - return [nan]*VARIABLE_COUNT +def create_constants_array(): + return [nan]*CONSTANT_COUNT + + +def create_computed_constants_array(): + return [nan]*COMPUTED_CONSTANT_COUNT + + +def create_algebraic_array(): + return [nan]*ALGEBRAIC_COUNT from nlasolver import nla_solve diff --git a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.c b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.c index d3373bd80c..8fe7fe5afb 100644 --- a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.c +++ b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.c @@ -23,11 +23,33 @@ const VariableInfo COMPUTED_CONSTANT_INFO[] = { const VariableInfo ALGEBRAIC_INFO[] = { }; -double * createVariablesArray() +double * createConstantsArray() { - double *res = (double *) malloc(VARIABLE_COUNT*sizeof(double)); + double *res = (double *) malloc(CONSTANT_COUNT*sizeof(double)); - for (size_t i = 0; i < VARIABLE_COUNT; ++i) { + for (size_t i = 0; i < CONSTANT_COUNT; ++i) { + res[i] = NAN; + } + + return res; +} + +double * createComputedConstantsArray() +{ + double *res = (double *) malloc(COMPUTED_CONSTANT_COUNT*sizeof(double)); + + for (size_t i = 0; i < COMPUTED_CONSTANT_COUNT; ++i) { + res[i] = NAN; + } + + return res; +} + +double * createAlgebraicArray() +{ + double *res = (double *) malloc(ALGEBRAIC_COUNT*sizeof(double)); + + for (size_t i = 0; i < ALGEBRAIC_COUNT; ++i) { res[i] = NAN; } diff --git a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.c b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.c index fcac8daa35..726d2e4dfa 100644 --- a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.c +++ b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.c @@ -27,11 +27,44 @@ const VariableInfo EXTERNAL_INFO[] = { {"a", "dimensionless", "my_algebraic_eqn"} }; -double * createVariablesArray() +double * createConstantsArray() { - double *res = (double *) malloc(VARIABLE_COUNT*sizeof(double)); + double *res = (double *) malloc(CONSTANT_COUNT*sizeof(double)); - for (size_t i = 0; i < VARIABLE_COUNT; ++i) { + for (size_t i = 0; i < CONSTANT_COUNT; ++i) { + res[i] = NAN; + } + + return res; +} + +double * createComputedConstantsArray() +{ + double *res = (double *) malloc(COMPUTED_CONSTANT_COUNT*sizeof(double)); + + for (size_t i = 0; i < COMPUTED_CONSTANT_COUNT; ++i) { + res[i] = NAN; + } + + return res; +} + +double * createAlgebraicArray() +{ + double *res = (double *) malloc(ALGEBRAIC_COUNT*sizeof(double)); + + for (size_t i = 0; i < ALGEBRAIC_COUNT; ++i) { + res[i] = NAN; + } + + return res; +} + +double * createExternalsArray() +{ + double *res = (double *) malloc(EXTERNAL_COUNT*sizeof(double)); + + for (size_t i = 0; i < EXTERNAL_COUNT; ++i) { res[i] = NAN; } diff --git a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.h b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.h index ae517dbae9..f2e5f8beac 100644 --- a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.h +++ b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.h @@ -23,7 +23,11 @@ extern const VariableInfo COMPUTED_CONSTANT_INFO[]; extern const VariableInfo ALGEBRAIC_INFO[]; extern const VariableInfo EXTERNAL_INFO[]; -double * createVariablesArray(); +double * createConstantsArray(); +double * createComputedConstantsArray(); +double * createAlgebraicArray(); +double * createExternalsArray(); + void deleteArray(double *array); typedef double (* ExternalVariable)(double *variables, size_t index); diff --git a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.py b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.py index 5aad8e9322..85f1fc1c37 100644 --- a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.py +++ b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.py @@ -27,8 +27,20 @@ ] -def create_variables_array(): - return [nan]*VARIABLE_COUNT +def create_constants_array(): + return [nan]*CONSTANT_COUNT + + +def create_computed_constants_array(): + return [nan]*COMPUTED_CONSTANT_COUNT + + +def create_algebraic_array(): + return [nan]*ALGEBRAIC_COUNT + + +def create_externals_array(): + return [nan]*EXTERNAL_COUNT def initialise_variables(constants, external_variable): diff --git a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.h b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.h index e7483121b5..09bd540e1b 100644 --- a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.h +++ b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.h @@ -21,7 +21,10 @@ extern const VariableInfo CONSTANT_INFO[]; extern const VariableInfo COMPUTED_CONSTANT_INFO[]; extern const VariableInfo ALGEBRAIC_INFO[]; -double * createVariablesArray(); +double * createConstantsArray(); +double * createComputedConstantsArray(); +double * createAlgebraicArray(); + void deleteArray(double *array); void initialiseVariables(double *constants); diff --git a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.py b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.py index 5b2757c655..ccb33cdae6 100644 --- a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.py +++ b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.py @@ -23,8 +23,16 @@ ] -def create_variables_array(): - return [nan]*VARIABLE_COUNT +def create_constants_array(): + return [nan]*CONSTANT_COUNT + + +def create_computed_constants_array(): + return [nan]*COMPUTED_CONSTANT_COUNT + + +def create_algebraic_array(): + return [nan]*ALGEBRAIC_COUNT def initialise_variables(constants): diff --git a/tests/resources/generator/algebraic_eqn_const_var_on_rhs/model.c b/tests/resources/generator/algebraic_eqn_const_var_on_rhs/model.c index f1a027bb90..4fec075e21 100644 --- a/tests/resources/generator/algebraic_eqn_const_var_on_rhs/model.c +++ b/tests/resources/generator/algebraic_eqn_const_var_on_rhs/model.c @@ -23,11 +23,33 @@ const VariableInfo COMPUTED_CONSTANT_INFO[] = { const VariableInfo ALGEBRAIC_INFO[] = { }; -double * createVariablesArray() +double * createConstantsArray() { - double *res = (double *) malloc(VARIABLE_COUNT*sizeof(double)); + double *res = (double *) malloc(CONSTANT_COUNT*sizeof(double)); - for (size_t i = 0; i < VARIABLE_COUNT; ++i) { + for (size_t i = 0; i < CONSTANT_COUNT; ++i) { + res[i] = NAN; + } + + return res; +} + +double * createComputedConstantsArray() +{ + double *res = (double *) malloc(COMPUTED_CONSTANT_COUNT*sizeof(double)); + + for (size_t i = 0; i < COMPUTED_CONSTANT_COUNT; ++i) { + res[i] = NAN; + } + + return res; +} + +double * createAlgebraicArray() +{ + double *res = (double *) malloc(ALGEBRAIC_COUNT*sizeof(double)); + + for (size_t i = 0; i < ALGEBRAIC_COUNT; ++i) { res[i] = NAN; } diff --git a/tests/resources/generator/algebraic_eqn_const_var_on_rhs/model.h b/tests/resources/generator/algebraic_eqn_const_var_on_rhs/model.h index e7483121b5..09bd540e1b 100644 --- a/tests/resources/generator/algebraic_eqn_const_var_on_rhs/model.h +++ b/tests/resources/generator/algebraic_eqn_const_var_on_rhs/model.h @@ -21,7 +21,10 @@ extern const VariableInfo CONSTANT_INFO[]; extern const VariableInfo COMPUTED_CONSTANT_INFO[]; extern const VariableInfo ALGEBRAIC_INFO[]; -double * createVariablesArray(); +double * createConstantsArray(); +double * createComputedConstantsArray(); +double * createAlgebraicArray(); + void deleteArray(double *array); void initialiseVariables(double *constants); diff --git a/tests/resources/generator/algebraic_eqn_const_var_on_rhs/model.py b/tests/resources/generator/algebraic_eqn_const_var_on_rhs/model.py index 11f3c989c7..44cf1813a3 100644 --- a/tests/resources/generator/algebraic_eqn_const_var_on_rhs/model.py +++ b/tests/resources/generator/algebraic_eqn_const_var_on_rhs/model.py @@ -23,8 +23,16 @@ ] -def create_variables_array(): - return [nan]*VARIABLE_COUNT +def create_constants_array(): + return [nan]*CONSTANT_COUNT + + +def create_computed_constants_array(): + return [nan]*COMPUTED_CONSTANT_COUNT + + +def create_algebraic_array(): + return [nan]*ALGEBRAIC_COUNT def initialise_variables(constants): diff --git a/tests/resources/generator/algebraic_eqn_constant_on_rhs/model.c b/tests/resources/generator/algebraic_eqn_constant_on_rhs/model.c index d675f0bf54..496cd753d1 100644 --- a/tests/resources/generator/algebraic_eqn_constant_on_rhs/model.c +++ b/tests/resources/generator/algebraic_eqn_constant_on_rhs/model.c @@ -22,11 +22,33 @@ const VariableInfo COMPUTED_CONSTANT_INFO[] = { const VariableInfo ALGEBRAIC_INFO[] = { }; -double * createVariablesArray() +double * createConstantsArray() { - double *res = (double *) malloc(VARIABLE_COUNT*sizeof(double)); + double *res = (double *) malloc(CONSTANT_COUNT*sizeof(double)); - for (size_t i = 0; i < VARIABLE_COUNT; ++i) { + for (size_t i = 0; i < CONSTANT_COUNT; ++i) { + res[i] = NAN; + } + + return res; +} + +double * createComputedConstantsArray() +{ + double *res = (double *) malloc(COMPUTED_CONSTANT_COUNT*sizeof(double)); + + for (size_t i = 0; i < COMPUTED_CONSTANT_COUNT; ++i) { + res[i] = NAN; + } + + return res; +} + +double * createAlgebraicArray() +{ + double *res = (double *) malloc(ALGEBRAIC_COUNT*sizeof(double)); + + for (size_t i = 0; i < ALGEBRAIC_COUNT; ++i) { res[i] = NAN; } diff --git a/tests/resources/generator/algebraic_eqn_constant_on_rhs/model.h b/tests/resources/generator/algebraic_eqn_constant_on_rhs/model.h index c22b338947..9b095efd77 100644 --- a/tests/resources/generator/algebraic_eqn_constant_on_rhs/model.h +++ b/tests/resources/generator/algebraic_eqn_constant_on_rhs/model.h @@ -21,7 +21,10 @@ extern const VariableInfo CONSTANT_INFO[]; extern const VariableInfo COMPUTED_CONSTANT_INFO[]; extern const VariableInfo ALGEBRAIC_INFO[]; -double * createVariablesArray(); +double * createConstantsArray(); +double * createComputedConstantsArray(); +double * createAlgebraicArray(); + void deleteArray(double *array); void initialiseVariables(double *constants); diff --git a/tests/resources/generator/algebraic_eqn_constant_on_rhs/model.py b/tests/resources/generator/algebraic_eqn_constant_on_rhs/model.py index 32441f8f5c..09de22b378 100644 --- a/tests/resources/generator/algebraic_eqn_constant_on_rhs/model.py +++ b/tests/resources/generator/algebraic_eqn_constant_on_rhs/model.py @@ -22,8 +22,16 @@ ] -def create_variables_array(): - return [nan]*VARIABLE_COUNT +def create_constants_array(): + return [nan]*CONSTANT_COUNT + + +def create_computed_constants_array(): + return [nan]*COMPUTED_CONSTANT_COUNT + + +def create_algebraic_array(): + return [nan]*ALGEBRAIC_COUNT def initialise_variables(constants): diff --git a/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.c b/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.c index b74b04c00c..50204c6366 100644 --- a/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.c +++ b/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.c @@ -41,11 +41,33 @@ double * createStatesArray() return res; } -double * createVariablesArray() +double * createConstantsArray() { - double *res = (double *) malloc(VARIABLE_COUNT*sizeof(double)); + double *res = (double *) malloc(CONSTANT_COUNT*sizeof(double)); - for (size_t i = 0; i < VARIABLE_COUNT; ++i) { + for (size_t i = 0; i < CONSTANT_COUNT; ++i) { + res[i] = NAN; + } + + return res; +} + +double * createComputedConstantsArray() +{ + double *res = (double *) malloc(COMPUTED_CONSTANT_COUNT*sizeof(double)); + + for (size_t i = 0; i < COMPUTED_CONSTANT_COUNT; ++i) { + res[i] = NAN; + } + + return res; +} + +double * createAlgebraicArray() +{ + double *res = (double *) malloc(ALGEBRAIC_COUNT*sizeof(double)); + + for (size_t i = 0; i < ALGEBRAIC_COUNT; ++i) { res[i] = NAN; } diff --git a/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.h b/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.h index 897ad01fb4..8f773b6902 100644 --- a/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.h +++ b/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.h @@ -25,7 +25,10 @@ extern const VariableInfo COMPUTED_CONSTANT_INFO[]; extern const VariableInfo ALGEBRAIC_INFO[]; double * createStatesArray(); -double * createVariablesArray(); +double * createConstantsArray(); +double * createComputedConstantsArray(); +double * createAlgebraicArray(); + void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *constants); diff --git a/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.py b/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.py index 50a4280dd6..24dc85a5d7 100644 --- a/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.py +++ b/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.py @@ -33,8 +33,16 @@ def create_states_array(): return [nan]*STATE_COUNT -def create_variables_array(): - return [nan]*VARIABLE_COUNT +def create_constants_array(): + return [nan]*CONSTANT_COUNT + + +def create_computed_constants_array(): + return [nan]*COMPUTED_CONSTANT_COUNT + + +def create_algebraic_array(): + return [nan]*ALGEBRAIC_COUNT def initialise_variables(states, rates, constants): diff --git a/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.c b/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.c index b5dfae2720..4350ef5f0f 100644 --- a/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.c +++ b/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.c @@ -41,11 +41,33 @@ double * createStatesArray() return res; } -double * createVariablesArray() +double * createConstantsArray() { - double *res = (double *) malloc(VARIABLE_COUNT*sizeof(double)); + double *res = (double *) malloc(CONSTANT_COUNT*sizeof(double)); - for (size_t i = 0; i < VARIABLE_COUNT; ++i) { + for (size_t i = 0; i < CONSTANT_COUNT; ++i) { + res[i] = NAN; + } + + return res; +} + +double * createComputedConstantsArray() +{ + double *res = (double *) malloc(COMPUTED_CONSTANT_COUNT*sizeof(double)); + + for (size_t i = 0; i < COMPUTED_CONSTANT_COUNT; ++i) { + res[i] = NAN; + } + + return res; +} + +double * createAlgebraicArray() +{ + double *res = (double *) malloc(ALGEBRAIC_COUNT*sizeof(double)); + + for (size_t i = 0; i < ALGEBRAIC_COUNT; ++i) { res[i] = NAN; } diff --git a/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.h b/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.h index 1c36d8d5fc..83c0783867 100644 --- a/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.h +++ b/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.h @@ -25,7 +25,10 @@ extern const VariableInfo COMPUTED_CONSTANT_INFO[]; extern const VariableInfo ALGEBRAIC_INFO[]; double * createStatesArray(); -double * createVariablesArray(); +double * createConstantsArray(); +double * createComputedConstantsArray(); +double * createAlgebraicArray(); + void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *constants); diff --git a/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.py b/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.py index 03b8c76bcd..710d4a6bd8 100644 --- a/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.py +++ b/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.py @@ -33,8 +33,16 @@ def create_states_array(): return [nan]*STATE_COUNT -def create_variables_array(): - return [nan]*VARIABLE_COUNT +def create_constants_array(): + return [nan]*CONSTANT_COUNT + + +def create_computed_constants_array(): + return [nan]*COMPUTED_CONSTANT_COUNT + + +def create_algebraic_array(): + return [nan]*ALGEBRAIC_COUNT def initialise_variables(states, rates, constants): diff --git a/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.c b/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.c index 5d8fd74b97..3f88fde85e 100644 --- a/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.c +++ b/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.c @@ -41,11 +41,33 @@ double * createStatesArray() return res; } -double * createVariablesArray() +double * createConstantsArray() { - double *res = (double *) malloc(VARIABLE_COUNT*sizeof(double)); + double *res = (double *) malloc(CONSTANT_COUNT*sizeof(double)); - for (size_t i = 0; i < VARIABLE_COUNT; ++i) { + for (size_t i = 0; i < CONSTANT_COUNT; ++i) { + res[i] = NAN; + } + + return res; +} + +double * createComputedConstantsArray() +{ + double *res = (double *) malloc(COMPUTED_CONSTANT_COUNT*sizeof(double)); + + for (size_t i = 0; i < COMPUTED_CONSTANT_COUNT; ++i) { + res[i] = NAN; + } + + return res; +} + +double * createAlgebraicArray() +{ + double *res = (double *) malloc(ALGEBRAIC_COUNT*sizeof(double)); + + for (size_t i = 0; i < ALGEBRAIC_COUNT; ++i) { res[i] = NAN; } diff --git a/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.h b/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.h index 5d58dcfbbe..8fb87aae18 100644 --- a/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.h +++ b/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.h @@ -25,7 +25,10 @@ extern const VariableInfo COMPUTED_CONSTANT_INFO[]; extern const VariableInfo ALGEBRAIC_INFO[]; double * createStatesArray(); -double * createVariablesArray(); +double * createConstantsArray(); +double * createComputedConstantsArray(); +double * createAlgebraicArray(); + void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *constants); diff --git a/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.py b/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.py index 20c3b72475..0527bf97d2 100644 --- a/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.py +++ b/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.py @@ -33,8 +33,16 @@ def create_states_array(): return [nan]*STATE_COUNT -def create_variables_array(): - return [nan]*VARIABLE_COUNT +def create_constants_array(): + return [nan]*CONSTANT_COUNT + + +def create_computed_constants_array(): + return [nan]*COMPUTED_CONSTANT_COUNT + + +def create_algebraic_array(): + return [nan]*ALGEBRAIC_COUNT def initialise_variables(states, rates, constants): diff --git a/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.c b/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.c index 9312cbe361..bff87c2756 100644 --- a/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.c +++ b/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.c @@ -41,11 +41,33 @@ double * createStatesArray() return res; } -double * createVariablesArray() +double * createConstantsArray() { - double *res = (double *) malloc(VARIABLE_COUNT*sizeof(double)); + double *res = (double *) malloc(CONSTANT_COUNT*sizeof(double)); - for (size_t i = 0; i < VARIABLE_COUNT; ++i) { + for (size_t i = 0; i < CONSTANT_COUNT; ++i) { + res[i] = NAN; + } + + return res; +} + +double * createComputedConstantsArray() +{ + double *res = (double *) malloc(COMPUTED_CONSTANT_COUNT*sizeof(double)); + + for (size_t i = 0; i < COMPUTED_CONSTANT_COUNT; ++i) { + res[i] = NAN; + } + + return res; +} + +double * createAlgebraicArray() +{ + double *res = (double *) malloc(ALGEBRAIC_COUNT*sizeof(double)); + + for (size_t i = 0; i < ALGEBRAIC_COUNT; ++i) { res[i] = NAN; } diff --git a/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.h b/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.h index de15f76cf9..c473a17f56 100644 --- a/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.h +++ b/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.h @@ -25,7 +25,10 @@ extern const VariableInfo COMPUTED_CONSTANT_INFO[]; extern const VariableInfo ALGEBRAIC_INFO[]; double * createStatesArray(); -double * createVariablesArray(); +double * createConstantsArray(); +double * createComputedConstantsArray(); +double * createAlgebraicArray(); + void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *constants); diff --git a/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.py b/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.py index b20a4ecffb..c17f55153a 100644 --- a/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.py +++ b/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.py @@ -33,8 +33,16 @@ def create_states_array(): return [nan]*STATE_COUNT -def create_variables_array(): - return [nan]*VARIABLE_COUNT +def create_constants_array(): + return [nan]*CONSTANT_COUNT + + +def create_computed_constants_array(): + return [nan]*COMPUTED_CONSTANT_COUNT + + +def create_algebraic_array(): + return [nan]*ALGEBRAIC_COUNT def initialise_variables(states, rates, constants): diff --git a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.c b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.c index c03fdb7147..7cad553503 100644 --- a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.c +++ b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.c @@ -25,11 +25,33 @@ const VariableInfo ALGEBRAIC_INFO[] = { {"a", "dimensionless", "my_algebraic_eqn"} }; -double * createVariablesArray() +double * createConstantsArray() { - double *res = (double *) malloc(VARIABLE_COUNT*sizeof(double)); + double *res = (double *) malloc(CONSTANT_COUNT*sizeof(double)); - for (size_t i = 0; i < VARIABLE_COUNT; ++i) { + for (size_t i = 0; i < CONSTANT_COUNT; ++i) { + res[i] = NAN; + } + + return res; +} + +double * createComputedConstantsArray() +{ + double *res = (double *) malloc(COMPUTED_CONSTANT_COUNT*sizeof(double)); + + for (size_t i = 0; i < COMPUTED_CONSTANT_COUNT; ++i) { + res[i] = NAN; + } + + return res; +} + +double * createAlgebraicArray() +{ + double *res = (double *) malloc(ALGEBRAIC_COUNT*sizeof(double)); + + for (size_t i = 0; i < ALGEBRAIC_COUNT; ++i) { res[i] = NAN; } diff --git a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.c b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.c index dfeff7ef99..bfb49ec7cc 100644 --- a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.c +++ b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.c @@ -29,11 +29,44 @@ const VariableInfo EXTERNAL_INFO[] = { {"a", "dimensionless", "my_algebraic_eqn"} }; -double * createVariablesArray() +double * createConstantsArray() { - double *res = (double *) malloc(VARIABLE_COUNT*sizeof(double)); + double *res = (double *) malloc(CONSTANT_COUNT*sizeof(double)); - for (size_t i = 0; i < VARIABLE_COUNT; ++i) { + for (size_t i = 0; i < CONSTANT_COUNT; ++i) { + res[i] = NAN; + } + + return res; +} + +double * createComputedConstantsArray() +{ + double *res = (double *) malloc(COMPUTED_CONSTANT_COUNT*sizeof(double)); + + for (size_t i = 0; i < COMPUTED_CONSTANT_COUNT; ++i) { + res[i] = NAN; + } + + return res; +} + +double * createAlgebraicArray() +{ + double *res = (double *) malloc(ALGEBRAIC_COUNT*sizeof(double)); + + for (size_t i = 0; i < ALGEBRAIC_COUNT; ++i) { + res[i] = NAN; + } + + return res; +} + +double * createExternalsArray() +{ + double *res = (double *) malloc(EXTERNAL_COUNT*sizeof(double)); + + for (size_t i = 0; i < EXTERNAL_COUNT; ++i) { res[i] = NAN; } diff --git a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.h b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.h index ae517dbae9..f2e5f8beac 100644 --- a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.h +++ b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.h @@ -23,7 +23,11 @@ extern const VariableInfo COMPUTED_CONSTANT_INFO[]; extern const VariableInfo ALGEBRAIC_INFO[]; extern const VariableInfo EXTERNAL_INFO[]; -double * createVariablesArray(); +double * createConstantsArray(); +double * createComputedConstantsArray(); +double * createAlgebraicArray(); +double * createExternalsArray(); + void deleteArray(double *array); typedef double (* ExternalVariable)(double *variables, size_t index); diff --git a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.py b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.py index c63f98fa9b..c50b814262 100644 --- a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.py +++ b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.py @@ -29,8 +29,20 @@ ] -def create_variables_array(): - return [nan]*VARIABLE_COUNT +def create_constants_array(): + return [nan]*CONSTANT_COUNT + + +def create_computed_constants_array(): + return [nan]*COMPUTED_CONSTANT_COUNT + + +def create_algebraic_array(): + return [nan]*ALGEBRAIC_COUNT + + +def create_externals_array(): + return [nan]*EXTERNAL_COUNT def initialise_variables(constants, external_variable): diff --git a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.h b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.h index e7483121b5..09bd540e1b 100644 --- a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.h +++ b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.h @@ -21,7 +21,10 @@ extern const VariableInfo CONSTANT_INFO[]; extern const VariableInfo COMPUTED_CONSTANT_INFO[]; extern const VariableInfo ALGEBRAIC_INFO[]; -double * createVariablesArray(); +double * createConstantsArray(); +double * createComputedConstantsArray(); +double * createAlgebraicArray(); + void deleteArray(double *array); void initialiseVariables(double *constants); diff --git a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.py b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.py index ac5049aa04..36471b5192 100644 --- a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.py +++ b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.py @@ -25,8 +25,16 @@ ] -def create_variables_array(): - return [nan]*VARIABLE_COUNT +def create_constants_array(): + return [nan]*CONSTANT_COUNT + + +def create_computed_constants_array(): + return [nan]*COMPUTED_CONSTANT_COUNT + + +def create_algebraic_array(): + return [nan]*ALGEBRAIC_COUNT from nlasolver import nla_solve diff --git a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.c b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.c index 650710a25f..8c0c46b904 100644 --- a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.c +++ b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.c @@ -24,11 +24,33 @@ const VariableInfo ALGEBRAIC_INFO[] = { {"z", "dimensionless", "my_algebraic_system"} }; -double * createVariablesArray() +double * createConstantsArray() { - double *res = (double *) malloc(VARIABLE_COUNT*sizeof(double)); + double *res = (double *) malloc(CONSTANT_COUNT*sizeof(double)); - for (size_t i = 0; i < VARIABLE_COUNT; ++i) { + for (size_t i = 0; i < CONSTANT_COUNT; ++i) { + res[i] = NAN; + } + + return res; +} + +double * createComputedConstantsArray() +{ + double *res = (double *) malloc(COMPUTED_CONSTANT_COUNT*sizeof(double)); + + for (size_t i = 0; i < COMPUTED_CONSTANT_COUNT; ++i) { + res[i] = NAN; + } + + return res; +} + +double * createAlgebraicArray() +{ + double *res = (double *) malloc(ALGEBRAIC_COUNT*sizeof(double)); + + for (size_t i = 0; i < ALGEBRAIC_COUNT; ++i) { res[i] = NAN; } diff --git a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.h b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.h index a8b4dbbcc0..9c4390a458 100644 --- a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.h +++ b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.h @@ -21,7 +21,10 @@ extern const VariableInfo CONSTANT_INFO[]; extern const VariableInfo COMPUTED_CONSTANT_INFO[]; extern const VariableInfo ALGEBRAIC_INFO[]; -double * createVariablesArray(); +double * createConstantsArray(); +double * createComputedConstantsArray(); +double * createAlgebraicArray(); + void deleteArray(double *array); void initialiseVariables(double *constants); diff --git a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.py b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.py index 00c16f3985..5152bedc3b 100644 --- a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.py +++ b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.py @@ -24,8 +24,16 @@ ] -def create_variables_array(): - return [nan]*VARIABLE_COUNT +def create_constants_array(): + return [nan]*CONSTANT_COUNT + + +def create_computed_constants_array(): + return [nan]*COMPUTED_CONSTANT_COUNT + + +def create_algebraic_array(): + return [nan]*ALGEBRAIC_COUNT from nlasolver import nla_solve diff --git a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.c b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.c index d2d15bfa5d..f4891c4a70 100644 --- a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.c +++ b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.c @@ -28,11 +28,44 @@ const VariableInfo EXTERNAL_INFO[] = { {"z", "dimensionless", "my_algebraic_system"} }; -double * createVariablesArray() +double * createConstantsArray() { - double *res = (double *) malloc(VARIABLE_COUNT*sizeof(double)); + double *res = (double *) malloc(CONSTANT_COUNT*sizeof(double)); - for (size_t i = 0; i < VARIABLE_COUNT; ++i) { + for (size_t i = 0; i < CONSTANT_COUNT; ++i) { + res[i] = NAN; + } + + return res; +} + +double * createComputedConstantsArray() +{ + double *res = (double *) malloc(COMPUTED_CONSTANT_COUNT*sizeof(double)); + + for (size_t i = 0; i < COMPUTED_CONSTANT_COUNT; ++i) { + res[i] = NAN; + } + + return res; +} + +double * createAlgebraicArray() +{ + double *res = (double *) malloc(ALGEBRAIC_COUNT*sizeof(double)); + + for (size_t i = 0; i < ALGEBRAIC_COUNT; ++i) { + res[i] = NAN; + } + + return res; +} + +double * createExternalsArray() +{ + double *res = (double *) malloc(EXTERNAL_COUNT*sizeof(double)); + + for (size_t i = 0; i < EXTERNAL_COUNT; ++i) { res[i] = NAN; } diff --git a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.h b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.h index 7e21388caa..4a61d58c7d 100644 --- a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.h +++ b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.h @@ -23,7 +23,11 @@ extern const VariableInfo COMPUTED_CONSTANT_INFO[]; extern const VariableInfo ALGEBRAIC_INFO[]; extern const VariableInfo EXTERNAL_INFO[]; -double * createVariablesArray(); +double * createConstantsArray(); +double * createComputedConstantsArray(); +double * createAlgebraicArray(); +double * createExternalsArray(); + void deleteArray(double *array); typedef double (* ExternalVariable)(double *variables, size_t index); diff --git a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.py b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.py index bc87f93445..c485809612 100644 --- a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.py +++ b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.py @@ -28,8 +28,20 @@ ] -def create_variables_array(): - return [nan]*VARIABLE_COUNT +def create_constants_array(): + return [nan]*CONSTANT_COUNT + + +def create_computed_constants_array(): + return [nan]*COMPUTED_CONSTANT_COUNT + + +def create_algebraic_array(): + return [nan]*ALGEBRAIC_COUNT + + +def create_externals_array(): + return [nan]*EXTERNAL_COUNT def initialise_variables(constants, external_variable): diff --git a/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.c b/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.c index feb3430edb..6ec8b16701 100644 --- a/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.c +++ b/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.c @@ -27,11 +27,33 @@ const VariableInfo ALGEBRAIC_INFO[] = { {"c", "dimensionless", "my_algebraic_system"} }; -double * createVariablesArray() +double * createConstantsArray() { - double *res = (double *) malloc(VARIABLE_COUNT*sizeof(double)); + double *res = (double *) malloc(CONSTANT_COUNT*sizeof(double)); - for (size_t i = 0; i < VARIABLE_COUNT; ++i) { + for (size_t i = 0; i < CONSTANT_COUNT; ++i) { + res[i] = NAN; + } + + return res; +} + +double * createComputedConstantsArray() +{ + double *res = (double *) malloc(COMPUTED_CONSTANT_COUNT*sizeof(double)); + + for (size_t i = 0; i < COMPUTED_CONSTANT_COUNT; ++i) { + res[i] = NAN; + } + + return res; +} + +double * createAlgebraicArray() +{ + double *res = (double *) malloc(ALGEBRAIC_COUNT*sizeof(double)); + + for (size_t i = 0; i < ALGEBRAIC_COUNT; ++i) { res[i] = NAN; } diff --git a/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.h b/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.h index a8b4dbbcc0..9c4390a458 100644 --- a/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.h +++ b/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.h @@ -21,7 +21,10 @@ extern const VariableInfo CONSTANT_INFO[]; extern const VariableInfo COMPUTED_CONSTANT_INFO[]; extern const VariableInfo ALGEBRAIC_INFO[]; -double * createVariablesArray(); +double * createConstantsArray(); +double * createComputedConstantsArray(); +double * createAlgebraicArray(); + void deleteArray(double *array); void initialiseVariables(double *constants); diff --git a/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.py b/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.py index 4c438c3f1b..4b3aefa550 100644 --- a/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.py +++ b/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.py @@ -27,8 +27,16 @@ ] -def create_variables_array(): - return [nan]*VARIABLE_COUNT +def create_constants_array(): + return [nan]*CONSTANT_COUNT + + +def create_computed_constants_array(): + return [nan]*COMPUTED_CONSTANT_COUNT + + +def create_algebraic_array(): + return [nan]*ALGEBRAIC_COUNT from nlasolver import nla_solve diff --git a/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.c b/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.c index 48ed210ade..374b6387cc 100644 --- a/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.c +++ b/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.c @@ -27,11 +27,33 @@ const VariableInfo ALGEBRAIC_INFO[] = { {"d", "dimensionless", "my_algebraic_system"} }; -double * createVariablesArray() +double * createConstantsArray() { - double *res = (double *) malloc(VARIABLE_COUNT*sizeof(double)); + double *res = (double *) malloc(CONSTANT_COUNT*sizeof(double)); - for (size_t i = 0; i < VARIABLE_COUNT; ++i) { + for (size_t i = 0; i < CONSTANT_COUNT; ++i) { + res[i] = NAN; + } + + return res; +} + +double * createComputedConstantsArray() +{ + double *res = (double *) malloc(COMPUTED_CONSTANT_COUNT*sizeof(double)); + + for (size_t i = 0; i < COMPUTED_CONSTANT_COUNT; ++i) { + res[i] = NAN; + } + + return res; +} + +double * createAlgebraicArray() +{ + double *res = (double *) malloc(ALGEBRAIC_COUNT*sizeof(double)); + + for (size_t i = 0; i < ALGEBRAIC_COUNT; ++i) { res[i] = NAN; } diff --git a/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.h b/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.h index a8b4dbbcc0..9c4390a458 100644 --- a/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.h +++ b/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.h @@ -21,7 +21,10 @@ extern const VariableInfo CONSTANT_INFO[]; extern const VariableInfo COMPUTED_CONSTANT_INFO[]; extern const VariableInfo ALGEBRAIC_INFO[]; -double * createVariablesArray(); +double * createConstantsArray(); +double * createComputedConstantsArray(); +double * createAlgebraicArray(); + void deleteArray(double *array); void initialiseVariables(double *constants); diff --git a/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.py b/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.py index d58855d92d..26d826e4c2 100644 --- a/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.py +++ b/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.py @@ -27,8 +27,16 @@ ] -def create_variables_array(): - return [nan]*VARIABLE_COUNT +def create_constants_array(): + return [nan]*CONSTANT_COUNT + + +def create_computed_constants_array(): + return [nan]*COMPUTED_CONSTANT_COUNT + + +def create_algebraic_array(): + return [nan]*ALGEBRAIC_COUNT from nlasolver import nla_solve diff --git a/tests/resources/generator/algebraic_unknown_var_on_rhs/model.c b/tests/resources/generator/algebraic_unknown_var_on_rhs/model.c index 8bfb7a585d..9aa43b5ee4 100644 --- a/tests/resources/generator/algebraic_unknown_var_on_rhs/model.c +++ b/tests/resources/generator/algebraic_unknown_var_on_rhs/model.c @@ -23,11 +23,33 @@ const VariableInfo COMPUTED_CONSTANT_INFO[] = { const VariableInfo ALGEBRAIC_INFO[] = { }; -double * createVariablesArray() +double * createConstantsArray() { - double *res = (double *) malloc(VARIABLE_COUNT*sizeof(double)); + double *res = (double *) malloc(CONSTANT_COUNT*sizeof(double)); - for (size_t i = 0; i < VARIABLE_COUNT; ++i) { + for (size_t i = 0; i < CONSTANT_COUNT; ++i) { + res[i] = NAN; + } + + return res; +} + +double * createComputedConstantsArray() +{ + double *res = (double *) malloc(COMPUTED_CONSTANT_COUNT*sizeof(double)); + + for (size_t i = 0; i < COMPUTED_CONSTANT_COUNT; ++i) { + res[i] = NAN; + } + + return res; +} + +double * createAlgebraicArray() +{ + double *res = (double *) malloc(ALGEBRAIC_COUNT*sizeof(double)); + + for (size_t i = 0; i < ALGEBRAIC_COUNT; ++i) { res[i] = NAN; } diff --git a/tests/resources/generator/algebraic_unknown_var_on_rhs/model.h b/tests/resources/generator/algebraic_unknown_var_on_rhs/model.h index c22b338947..9b095efd77 100644 --- a/tests/resources/generator/algebraic_unknown_var_on_rhs/model.h +++ b/tests/resources/generator/algebraic_unknown_var_on_rhs/model.h @@ -21,7 +21,10 @@ extern const VariableInfo CONSTANT_INFO[]; extern const VariableInfo COMPUTED_CONSTANT_INFO[]; extern const VariableInfo ALGEBRAIC_INFO[]; -double * createVariablesArray(); +double * createConstantsArray(); +double * createComputedConstantsArray(); +double * createAlgebraicArray(); + void deleteArray(double *array); void initialiseVariables(double *constants); diff --git a/tests/resources/generator/algebraic_unknown_var_on_rhs/model.py b/tests/resources/generator/algebraic_unknown_var_on_rhs/model.py index 0740ee0de4..2d80710550 100644 --- a/tests/resources/generator/algebraic_unknown_var_on_rhs/model.py +++ b/tests/resources/generator/algebraic_unknown_var_on_rhs/model.py @@ -23,8 +23,16 @@ ] -def create_variables_array(): - return [nan]*VARIABLE_COUNT +def create_constants_array(): + return [nan]*CONSTANT_COUNT + + +def create_computed_constants_array(): + return [nan]*COMPUTED_CONSTANT_COUNT + + +def create_algebraic_array(): + return [nan]*ALGEBRAIC_COUNT def initialise_variables(constants): diff --git a/tests/resources/generator/cell_geometry_model/model.c b/tests/resources/generator/cell_geometry_model/model.c index a4bb58334d..4fb93ec8e1 100644 --- a/tests/resources/generator/cell_geometry_model/model.c +++ b/tests/resources/generator/cell_geometry_model/model.c @@ -25,11 +25,33 @@ const VariableInfo COMPUTED_CONSTANT_INFO[] = { const VariableInfo ALGEBRAIC_INFO[] = { }; -double * createVariablesArray() +double * createConstantsArray() { - double *res = (double *) malloc(VARIABLE_COUNT*sizeof(double)); + double *res = (double *) malloc(CONSTANT_COUNT*sizeof(double)); - for (size_t i = 0; i < VARIABLE_COUNT; ++i) { + for (size_t i = 0; i < CONSTANT_COUNT; ++i) { + res[i] = NAN; + } + + return res; +} + +double * createComputedConstantsArray() +{ + double *res = (double *) malloc(COMPUTED_CONSTANT_COUNT*sizeof(double)); + + for (size_t i = 0; i < COMPUTED_CONSTANT_COUNT; ++i) { + res[i] = NAN; + } + + return res; +} + +double * createAlgebraicArray() +{ + double *res = (double *) malloc(ALGEBRAIC_COUNT*sizeof(double)); + + for (size_t i = 0; i < ALGEBRAIC_COUNT; ++i) { res[i] = NAN; } diff --git a/tests/resources/generator/cell_geometry_model/model.external.c b/tests/resources/generator/cell_geometry_model/model.external.c index 7a5964bc53..2cf2258cea 100644 --- a/tests/resources/generator/cell_geometry_model/model.external.c +++ b/tests/resources/generator/cell_geometry_model/model.external.c @@ -29,11 +29,44 @@ const VariableInfo EXTERNAL_INFO[] = { {"rad", "centimeter", "cell_geometry"} }; -double * createVariablesArray() +double * createConstantsArray() { - double *res = (double *) malloc(VARIABLE_COUNT*sizeof(double)); + double *res = (double *) malloc(CONSTANT_COUNT*sizeof(double)); - for (size_t i = 0; i < VARIABLE_COUNT; ++i) { + for (size_t i = 0; i < CONSTANT_COUNT; ++i) { + res[i] = NAN; + } + + return res; +} + +double * createComputedConstantsArray() +{ + double *res = (double *) malloc(COMPUTED_CONSTANT_COUNT*sizeof(double)); + + for (size_t i = 0; i < COMPUTED_CONSTANT_COUNT; ++i) { + res[i] = NAN; + } + + return res; +} + +double * createAlgebraicArray() +{ + double *res = (double *) malloc(ALGEBRAIC_COUNT*sizeof(double)); + + for (size_t i = 0; i < ALGEBRAIC_COUNT; ++i) { + res[i] = NAN; + } + + return res; +} + +double * createExternalsArray() +{ + double *res = (double *) malloc(EXTERNAL_COUNT*sizeof(double)); + + for (size_t i = 0; i < EXTERNAL_COUNT; ++i) { res[i] = NAN; } diff --git a/tests/resources/generator/cell_geometry_model/model.external.h b/tests/resources/generator/cell_geometry_model/model.external.h index 36d3e18222..60a5dac8ec 100644 --- a/tests/resources/generator/cell_geometry_model/model.external.h +++ b/tests/resources/generator/cell_geometry_model/model.external.h @@ -23,7 +23,11 @@ extern const VariableInfo COMPUTED_CONSTANT_INFO[]; extern const VariableInfo ALGEBRAIC_INFO[]; extern const VariableInfo EXTERNAL_INFO[]; -double * createVariablesArray(); +double * createConstantsArray(); +double * createComputedConstantsArray(); +double * createAlgebraicArray(); +double * createExternalsArray(); + void deleteArray(double *array); typedef double (* ExternalVariable)(double *variables, size_t index); diff --git a/tests/resources/generator/cell_geometry_model/model.external.py b/tests/resources/generator/cell_geometry_model/model.external.py index aa3d00363b..60c18b4a8a 100644 --- a/tests/resources/generator/cell_geometry_model/model.external.py +++ b/tests/resources/generator/cell_geometry_model/model.external.py @@ -29,8 +29,20 @@ ] -def create_variables_array(): - return [nan]*VARIABLE_COUNT +def create_constants_array(): + return [nan]*CONSTANT_COUNT + + +def create_computed_constants_array(): + return [nan]*COMPUTED_CONSTANT_COUNT + + +def create_algebraic_array(): + return [nan]*ALGEBRAIC_COUNT + + +def create_externals_array(): + return [nan]*EXTERNAL_COUNT def initialise_variables(constants, external_variable): diff --git a/tests/resources/generator/cell_geometry_model/model.h b/tests/resources/generator/cell_geometry_model/model.h index 687403023c..adc63ee0de 100644 --- a/tests/resources/generator/cell_geometry_model/model.h +++ b/tests/resources/generator/cell_geometry_model/model.h @@ -21,7 +21,10 @@ extern const VariableInfo CONSTANT_INFO[]; extern const VariableInfo COMPUTED_CONSTANT_INFO[]; extern const VariableInfo ALGEBRAIC_INFO[]; -double * createVariablesArray(); +double * createConstantsArray(); +double * createComputedConstantsArray(); +double * createAlgebraicArray(); + void deleteArray(double *array); void initialiseVariables(double *constants); diff --git a/tests/resources/generator/cell_geometry_model/model.py b/tests/resources/generator/cell_geometry_model/model.py index 4ba53cbccb..632242c002 100644 --- a/tests/resources/generator/cell_geometry_model/model.py +++ b/tests/resources/generator/cell_geometry_model/model.py @@ -25,8 +25,16 @@ ] -def create_variables_array(): - return [nan]*VARIABLE_COUNT +def create_constants_array(): + return [nan]*CONSTANT_COUNT + + +def create_computed_constants_array(): + return [nan]*COMPUTED_CONSTANT_COUNT + + +def create_algebraic_array(): + return [nan]*ALGEBRAIC_COUNT def initialise_variables(constants): diff --git a/tests/resources/generator/cellml_mappings_and_encapsulations/model.c b/tests/resources/generator/cellml_mappings_and_encapsulations/model.c index 5bb0dea81b..f37a28dea9 100644 --- a/tests/resources/generator/cellml_mappings_and_encapsulations/model.c +++ b/tests/resources/generator/cellml_mappings_and_encapsulations/model.c @@ -42,11 +42,33 @@ double * createStatesArray() return res; } -double * createVariablesArray() +double * createConstantsArray() { - double *res = (double *) malloc(VARIABLE_COUNT*sizeof(double)); + double *res = (double *) malloc(CONSTANT_COUNT*sizeof(double)); - for (size_t i = 0; i < VARIABLE_COUNT; ++i) { + for (size_t i = 0; i < CONSTANT_COUNT; ++i) { + res[i] = NAN; + } + + return res; +} + +double * createComputedConstantsArray() +{ + double *res = (double *) malloc(COMPUTED_CONSTANT_COUNT*sizeof(double)); + + for (size_t i = 0; i < COMPUTED_CONSTANT_COUNT; ++i) { + res[i] = NAN; + } + + return res; +} + +double * createAlgebraicArray() +{ + double *res = (double *) malloc(ALGEBRAIC_COUNT*sizeof(double)); + + for (size_t i = 0; i < ALGEBRAIC_COUNT; ++i) { res[i] = NAN; } diff --git a/tests/resources/generator/cellml_mappings_and_encapsulations/model.h b/tests/resources/generator/cellml_mappings_and_encapsulations/model.h index ad9e483ac2..d33f9c169b 100644 --- a/tests/resources/generator/cellml_mappings_and_encapsulations/model.h +++ b/tests/resources/generator/cellml_mappings_and_encapsulations/model.h @@ -25,7 +25,10 @@ extern const VariableInfo COMPUTED_CONSTANT_INFO[]; extern const VariableInfo ALGEBRAIC_INFO[]; double * createStatesArray(); -double * createVariablesArray(); +double * createConstantsArray(); +double * createComputedConstantsArray(); +double * createAlgebraicArray(); + void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *constants); diff --git a/tests/resources/generator/cellml_mappings_and_encapsulations/model.py b/tests/resources/generator/cellml_mappings_and_encapsulations/model.py index 21fd05b38f..ce2e8a5f31 100644 --- a/tests/resources/generator/cellml_mappings_and_encapsulations/model.py +++ b/tests/resources/generator/cellml_mappings_and_encapsulations/model.py @@ -34,8 +34,16 @@ def create_states_array(): return [nan]*STATE_COUNT -def create_variables_array(): - return [nan]*VARIABLE_COUNT +def create_constants_array(): + return [nan]*CONSTANT_COUNT + + +def create_computed_constants_array(): + return [nan]*COMPUTED_CONSTANT_COUNT + + +def create_algebraic_array(): + return [nan]*ALGEBRAIC_COUNT def initialise_variables(states, rates, constants): diff --git a/tests/resources/generator/cellml_slc_example/model.py b/tests/resources/generator/cellml_slc_example/model.py index e75683666e..9c4aec544b 100644 --- a/tests/resources/generator/cellml_slc_example/model.py +++ b/tests/resources/generator/cellml_slc_example/model.py @@ -31,8 +31,16 @@ ] -def create_variables_array(): - return [nan]*VARIABLE_COUNT +def create_constants_array(): + return [nan]*CONSTANT_COUNT + + +def create_computed_constants_array(): + return [nan]*COMPUTED_CONSTANT_COUNT + + +def create_algebraic_array(): + return [nan]*ALGEBRAIC_COUNT def initialise_variables(constants): diff --git a/tests/resources/generator/cellml_state_initialised_using_variable/model.c b/tests/resources/generator/cellml_state_initialised_using_variable/model.c index 074a5a21bd..121c73290b 100644 --- a/tests/resources/generator/cellml_state_initialised_using_variable/model.c +++ b/tests/resources/generator/cellml_state_initialised_using_variable/model.c @@ -40,11 +40,33 @@ double * createStatesArray() return res; } -double * createVariablesArray() +double * createConstantsArray() { - double *res = (double *) malloc(VARIABLE_COUNT*sizeof(double)); + double *res = (double *) malloc(CONSTANT_COUNT*sizeof(double)); - for (size_t i = 0; i < VARIABLE_COUNT; ++i) { + for (size_t i = 0; i < CONSTANT_COUNT; ++i) { + res[i] = NAN; + } + + return res; +} + +double * createComputedConstantsArray() +{ + double *res = (double *) malloc(COMPUTED_CONSTANT_COUNT*sizeof(double)); + + for (size_t i = 0; i < COMPUTED_CONSTANT_COUNT; ++i) { + res[i] = NAN; + } + + return res; +} + +double * createAlgebraicArray() +{ + double *res = (double *) malloc(ALGEBRAIC_COUNT*sizeof(double)); + + for (size_t i = 0; i < ALGEBRAIC_COUNT; ++i) { res[i] = NAN; } diff --git a/tests/resources/generator/cellml_state_initialised_using_variable/model.h b/tests/resources/generator/cellml_state_initialised_using_variable/model.h index b05828f9b0..b5e1553fdd 100644 --- a/tests/resources/generator/cellml_state_initialised_using_variable/model.h +++ b/tests/resources/generator/cellml_state_initialised_using_variable/model.h @@ -25,7 +25,10 @@ extern const VariableInfo COMPUTED_CONSTANT_INFO[]; extern const VariableInfo ALGEBRAIC_INFO[]; double * createStatesArray(); -double * createVariablesArray(); +double * createConstantsArray(); +double * createComputedConstantsArray(); +double * createAlgebraicArray(); + void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *constants); diff --git a/tests/resources/generator/cellml_state_initialised_using_variable/model.py b/tests/resources/generator/cellml_state_initialised_using_variable/model.py index 0a0aa2864f..8f685b2ab3 100644 --- a/tests/resources/generator/cellml_state_initialised_using_variable/model.py +++ b/tests/resources/generator/cellml_state_initialised_using_variable/model.py @@ -32,8 +32,16 @@ def create_states_array(): return [nan]*STATE_COUNT -def create_variables_array(): - return [nan]*VARIABLE_COUNT +def create_constants_array(): + return [nan]*CONSTANT_COUNT + + +def create_computed_constants_array(): + return [nan]*COMPUTED_CONSTANT_COUNT + + +def create_algebraic_array(): + return [nan]*ALGEBRAIC_COUNT def initialise_variables(states, rates, constants): diff --git a/tests/resources/generator/cellml_unit_scaling_constant/model.c b/tests/resources/generator/cellml_unit_scaling_constant/model.c index cabb1e7285..89d15758a6 100644 --- a/tests/resources/generator/cellml_unit_scaling_constant/model.c +++ b/tests/resources/generator/cellml_unit_scaling_constant/model.c @@ -24,11 +24,33 @@ const VariableInfo COMPUTED_CONSTANT_INFO[] = { const VariableInfo ALGEBRAIC_INFO[] = { }; -double * createVariablesArray() +double * createConstantsArray() { - double *res = (double *) malloc(VARIABLE_COUNT*sizeof(double)); + double *res = (double *) malloc(CONSTANT_COUNT*sizeof(double)); - for (size_t i = 0; i < VARIABLE_COUNT; ++i) { + for (size_t i = 0; i < CONSTANT_COUNT; ++i) { + res[i] = NAN; + } + + return res; +} + +double * createComputedConstantsArray() +{ + double *res = (double *) malloc(COMPUTED_CONSTANT_COUNT*sizeof(double)); + + for (size_t i = 0; i < COMPUTED_CONSTANT_COUNT; ++i) { + res[i] = NAN; + } + + return res; +} + +double * createAlgebraicArray() +{ + double *res = (double *) malloc(ALGEBRAIC_COUNT*sizeof(double)); + + for (size_t i = 0; i < ALGEBRAIC_COUNT; ++i) { res[i] = NAN; } diff --git a/tests/resources/generator/cellml_unit_scaling_constant/model.h b/tests/resources/generator/cellml_unit_scaling_constant/model.h index 1fff52ad98..57ef15ccdd 100644 --- a/tests/resources/generator/cellml_unit_scaling_constant/model.h +++ b/tests/resources/generator/cellml_unit_scaling_constant/model.h @@ -21,7 +21,10 @@ extern const VariableInfo CONSTANT_INFO[]; extern const VariableInfo COMPUTED_CONSTANT_INFO[]; extern const VariableInfo ALGEBRAIC_INFO[]; -double * createVariablesArray(); +double * createConstantsArray(); +double * createComputedConstantsArray(); +double * createAlgebraicArray(); + void deleteArray(double *array); void initialiseVariables(double *constants); diff --git a/tests/resources/generator/cellml_unit_scaling_constant/model.py b/tests/resources/generator/cellml_unit_scaling_constant/model.py index 02d595b20a..179fc7bf58 100644 --- a/tests/resources/generator/cellml_unit_scaling_constant/model.py +++ b/tests/resources/generator/cellml_unit_scaling_constant/model.py @@ -24,8 +24,16 @@ ] -def create_variables_array(): - return [nan]*VARIABLE_COUNT +def create_constants_array(): + return [nan]*CONSTANT_COUNT + + +def create_computed_constants_array(): + return [nan]*COMPUTED_CONSTANT_COUNT + + +def create_algebraic_array(): + return [nan]*ALGEBRAIC_COUNT def initialise_variables(constants): diff --git a/tests/resources/generator/cellml_unit_scaling_rate/model.c b/tests/resources/generator/cellml_unit_scaling_rate/model.c index c0529e1dc5..cc090e14df 100644 --- a/tests/resources/generator/cellml_unit_scaling_rate/model.c +++ b/tests/resources/generator/cellml_unit_scaling_rate/model.c @@ -41,11 +41,33 @@ double * createStatesArray() return res; } -double * createVariablesArray() +double * createConstantsArray() { - double *res = (double *) malloc(VARIABLE_COUNT*sizeof(double)); + double *res = (double *) malloc(CONSTANT_COUNT*sizeof(double)); - for (size_t i = 0; i < VARIABLE_COUNT; ++i) { + for (size_t i = 0; i < CONSTANT_COUNT; ++i) { + res[i] = NAN; + } + + return res; +} + +double * createComputedConstantsArray() +{ + double *res = (double *) malloc(COMPUTED_CONSTANT_COUNT*sizeof(double)); + + for (size_t i = 0; i < COMPUTED_CONSTANT_COUNT; ++i) { + res[i] = NAN; + } + + return res; +} + +double * createAlgebraicArray() +{ + double *res = (double *) malloc(ALGEBRAIC_COUNT*sizeof(double)); + + for (size_t i = 0; i < ALGEBRAIC_COUNT; ++i) { res[i] = NAN; } diff --git a/tests/resources/generator/cellml_unit_scaling_rate/model.h b/tests/resources/generator/cellml_unit_scaling_rate/model.h index b05828f9b0..b5e1553fdd 100644 --- a/tests/resources/generator/cellml_unit_scaling_rate/model.h +++ b/tests/resources/generator/cellml_unit_scaling_rate/model.h @@ -25,7 +25,10 @@ extern const VariableInfo COMPUTED_CONSTANT_INFO[]; extern const VariableInfo ALGEBRAIC_INFO[]; double * createStatesArray(); -double * createVariablesArray(); +double * createConstantsArray(); +double * createComputedConstantsArray(); +double * createAlgebraicArray(); + void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *constants); diff --git a/tests/resources/generator/cellml_unit_scaling_rate/model.py b/tests/resources/generator/cellml_unit_scaling_rate/model.py index 536b041ddc..db91581c91 100644 --- a/tests/resources/generator/cellml_unit_scaling_rate/model.py +++ b/tests/resources/generator/cellml_unit_scaling_rate/model.py @@ -33,8 +33,16 @@ def create_states_array(): return [nan]*STATE_COUNT -def create_variables_array(): - return [nan]*VARIABLE_COUNT +def create_constants_array(): + return [nan]*CONSTANT_COUNT + + +def create_computed_constants_array(): + return [nan]*COMPUTED_CONSTANT_COUNT + + +def create_algebraic_array(): + return [nan]*ALGEBRAIC_COUNT def initialise_variables(states, rates, constants): diff --git a/tests/resources/generator/cellml_unit_scaling_state/model.c b/tests/resources/generator/cellml_unit_scaling_state/model.c index f2664b5fae..7129623ca7 100644 --- a/tests/resources/generator/cellml_unit_scaling_state/model.c +++ b/tests/resources/generator/cellml_unit_scaling_state/model.c @@ -41,11 +41,33 @@ double * createStatesArray() return res; } -double * createVariablesArray() +double * createConstantsArray() { - double *res = (double *) malloc(VARIABLE_COUNT*sizeof(double)); + double *res = (double *) malloc(CONSTANT_COUNT*sizeof(double)); - for (size_t i = 0; i < VARIABLE_COUNT; ++i) { + for (size_t i = 0; i < CONSTANT_COUNT; ++i) { + res[i] = NAN; + } + + return res; +} + +double * createComputedConstantsArray() +{ + double *res = (double *) malloc(COMPUTED_CONSTANT_COUNT*sizeof(double)); + + for (size_t i = 0; i < COMPUTED_CONSTANT_COUNT; ++i) { + res[i] = NAN; + } + + return res; +} + +double * createAlgebraicArray() +{ + double *res = (double *) malloc(ALGEBRAIC_COUNT*sizeof(double)); + + for (size_t i = 0; i < ALGEBRAIC_COUNT; ++i) { res[i] = NAN; } diff --git a/tests/resources/generator/cellml_unit_scaling_state/model.h b/tests/resources/generator/cellml_unit_scaling_state/model.h index b05828f9b0..b5e1553fdd 100644 --- a/tests/resources/generator/cellml_unit_scaling_state/model.h +++ b/tests/resources/generator/cellml_unit_scaling_state/model.h @@ -25,7 +25,10 @@ extern const VariableInfo COMPUTED_CONSTANT_INFO[]; extern const VariableInfo ALGEBRAIC_INFO[]; double * createStatesArray(); -double * createVariablesArray(); +double * createConstantsArray(); +double * createComputedConstantsArray(); +double * createAlgebraicArray(); + void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *constants); diff --git a/tests/resources/generator/cellml_unit_scaling_state/model.py b/tests/resources/generator/cellml_unit_scaling_state/model.py index 3a560fa48c..efe00b6e48 100644 --- a/tests/resources/generator/cellml_unit_scaling_state/model.py +++ b/tests/resources/generator/cellml_unit_scaling_state/model.py @@ -33,8 +33,16 @@ def create_states_array(): return [nan]*STATE_COUNT -def create_variables_array(): - return [nan]*VARIABLE_COUNT +def create_constants_array(): + return [nan]*CONSTANT_COUNT + + +def create_computed_constants_array(): + return [nan]*COMPUTED_CONSTANT_COUNT + + +def create_algebraic_array(): + return [nan]*ALGEBRAIC_COUNT def initialise_variables(states, rates, constants): diff --git a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.c b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.c index 94efa316a3..27254205ce 100644 --- a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.c +++ b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.c @@ -40,11 +40,33 @@ double * createStatesArray() return res; } -double * createVariablesArray() +double * createConstantsArray() { - double *res = (double *) malloc(VARIABLE_COUNT*sizeof(double)); + double *res = (double *) malloc(CONSTANT_COUNT*sizeof(double)); - for (size_t i = 0; i < VARIABLE_COUNT; ++i) { + for (size_t i = 0; i < CONSTANT_COUNT; ++i) { + res[i] = NAN; + } + + return res; +} + +double * createComputedConstantsArray() +{ + double *res = (double *) malloc(COMPUTED_CONSTANT_COUNT*sizeof(double)); + + for (size_t i = 0; i < COMPUTED_CONSTANT_COUNT; ++i) { + res[i] = NAN; + } + + return res; +} + +double * createAlgebraicArray() +{ + double *res = (double *) malloc(ALGEBRAIC_COUNT*sizeof(double)); + + for (size_t i = 0; i < ALGEBRAIC_COUNT; ++i) { res[i] = NAN; } diff --git a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.h b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.h index b889cfc43e..6a5fb14884 100644 --- a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.h +++ b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.h @@ -25,7 +25,10 @@ extern const VariableInfo COMPUTED_CONSTANT_INFO[]; extern const VariableInfo ALGEBRAIC_INFO[]; double * createStatesArray(); -double * createVariablesArray(); +double * createConstantsArray(); +double * createComputedConstantsArray(); +double * createAlgebraicArray(); + void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *constants); diff --git a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.py b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.py index dce4e92ce1..bc50269541 100644 --- a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.py +++ b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.py @@ -32,8 +32,16 @@ def create_states_array(): return [nan]*STATE_COUNT -def create_variables_array(): - return [nan]*VARIABLE_COUNT +def create_constants_array(): + return [nan]*CONSTANT_COUNT + + +def create_computed_constants_array(): + return [nan]*COMPUTED_CONSTANT_COUNT + + +def create_algebraic_array(): + return [nan]*ALGEBRAIC_COUNT def initialise_variables(states, rates, constants): diff --git a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.c b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.c index 52c79b1c7c..c7b46d5af1 100644 --- a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.c +++ b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.c @@ -42,11 +42,33 @@ double * createStatesArray() return res; } -double * createVariablesArray() +double * createConstantsArray() { - double *res = (double *) malloc(VARIABLE_COUNT*sizeof(double)); + double *res = (double *) malloc(CONSTANT_COUNT*sizeof(double)); - for (size_t i = 0; i < VARIABLE_COUNT; ++i) { + for (size_t i = 0; i < CONSTANT_COUNT; ++i) { + res[i] = NAN; + } + + return res; +} + +double * createComputedConstantsArray() +{ + double *res = (double *) malloc(COMPUTED_CONSTANT_COUNT*sizeof(double)); + + for (size_t i = 0; i < COMPUTED_CONSTANT_COUNT; ++i) { + res[i] = NAN; + } + + return res; +} + +double * createAlgebraicArray() +{ + double *res = (double *) malloc(ALGEBRAIC_COUNT*sizeof(double)); + + for (size_t i = 0; i < ALGEBRAIC_COUNT; ++i) { res[i] = NAN; } diff --git a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.h b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.h index 59b9535ec8..5ca5788bc9 100644 --- a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.h +++ b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.h @@ -25,7 +25,10 @@ extern const VariableInfo COMPUTED_CONSTANT_INFO[]; extern const VariableInfo ALGEBRAIC_INFO[]; double * createStatesArray(); -double * createVariablesArray(); +double * createConstantsArray(); +double * createComputedConstantsArray(); +double * createAlgebraicArray(); + void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *constants); diff --git a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.py b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.py index 98b669a5f5..5e1c748cd2 100644 --- a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.py +++ b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.py @@ -34,8 +34,16 @@ def create_states_array(): return [nan]*STATE_COUNT -def create_variables_array(): - return [nan]*VARIABLE_COUNT +def create_constants_array(): + return [nan]*CONSTANT_COUNT + + +def create_computed_constants_array(): + return [nan]*COMPUTED_CONSTANT_COUNT + + +def create_algebraic_array(): + return [nan]*ALGEBRAIC_COUNT def initialise_variables(states, rates, constants): diff --git a/tests/resources/generator/cellml_unit_scaling_voi_direct/model.c b/tests/resources/generator/cellml_unit_scaling_voi_direct/model.c index 63f8794d12..93a512d31f 100644 --- a/tests/resources/generator/cellml_unit_scaling_voi_direct/model.c +++ b/tests/resources/generator/cellml_unit_scaling_voi_direct/model.c @@ -40,11 +40,33 @@ double * createStatesArray() return res; } -double * createVariablesArray() +double * createConstantsArray() { - double *res = (double *) malloc(VARIABLE_COUNT*sizeof(double)); + double *res = (double *) malloc(CONSTANT_COUNT*sizeof(double)); - for (size_t i = 0; i < VARIABLE_COUNT; ++i) { + for (size_t i = 0; i < CONSTANT_COUNT; ++i) { + res[i] = NAN; + } + + return res; +} + +double * createComputedConstantsArray() +{ + double *res = (double *) malloc(COMPUTED_CONSTANT_COUNT*sizeof(double)); + + for (size_t i = 0; i < COMPUTED_CONSTANT_COUNT; ++i) { + res[i] = NAN; + } + + return res; +} + +double * createAlgebraicArray() +{ + double *res = (double *) malloc(ALGEBRAIC_COUNT*sizeof(double)); + + for (size_t i = 0; i < ALGEBRAIC_COUNT; ++i) { res[i] = NAN; } diff --git a/tests/resources/generator/cellml_unit_scaling_voi_direct/model.h b/tests/resources/generator/cellml_unit_scaling_voi_direct/model.h index 8d446982d8..319a116d0f 100644 --- a/tests/resources/generator/cellml_unit_scaling_voi_direct/model.h +++ b/tests/resources/generator/cellml_unit_scaling_voi_direct/model.h @@ -25,7 +25,10 @@ extern const VariableInfo COMPUTED_CONSTANT_INFO[]; extern const VariableInfo ALGEBRAIC_INFO[]; double * createStatesArray(); -double * createVariablesArray(); +double * createConstantsArray(); +double * createComputedConstantsArray(); +double * createAlgebraicArray(); + void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *constants); diff --git a/tests/resources/generator/cellml_unit_scaling_voi_direct/model.py b/tests/resources/generator/cellml_unit_scaling_voi_direct/model.py index b8ff408e52..8ec3b32d45 100644 --- a/tests/resources/generator/cellml_unit_scaling_voi_direct/model.py +++ b/tests/resources/generator/cellml_unit_scaling_voi_direct/model.py @@ -32,8 +32,16 @@ def create_states_array(): return [nan]*STATE_COUNT -def create_variables_array(): - return [nan]*VARIABLE_COUNT +def create_constants_array(): + return [nan]*CONSTANT_COUNT + + +def create_computed_constants_array(): + return [nan]*COMPUTED_CONSTANT_COUNT + + +def create_algebraic_array(): + return [nan]*ALGEBRAIC_COUNT def initialise_variables(states, rates, constants): diff --git a/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.c b/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.c index d3b8f3522a..c8fa6eabe8 100644 --- a/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.c +++ b/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.c @@ -41,11 +41,33 @@ double * createStatesArray() return res; } -double * createVariablesArray() +double * createConstantsArray() { - double *res = (double *) malloc(VARIABLE_COUNT*sizeof(double)); + double *res = (double *) malloc(CONSTANT_COUNT*sizeof(double)); - for (size_t i = 0; i < VARIABLE_COUNT; ++i) { + for (size_t i = 0; i < CONSTANT_COUNT; ++i) { + res[i] = NAN; + } + + return res; +} + +double * createComputedConstantsArray() +{ + double *res = (double *) malloc(COMPUTED_CONSTANT_COUNT*sizeof(double)); + + for (size_t i = 0; i < COMPUTED_CONSTANT_COUNT; ++i) { + res[i] = NAN; + } + + return res; +} + +double * createAlgebraicArray() +{ + double *res = (double *) malloc(ALGEBRAIC_COUNT*sizeof(double)); + + for (size_t i = 0; i < ALGEBRAIC_COUNT; ++i) { res[i] = NAN; } diff --git a/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.h b/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.h index 749c14ce79..52fda2a3bd 100644 --- a/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.h +++ b/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.h @@ -25,7 +25,10 @@ extern const VariableInfo COMPUTED_CONSTANT_INFO[]; extern const VariableInfo ALGEBRAIC_INFO[]; double * createStatesArray(); -double * createVariablesArray(); +double * createConstantsArray(); +double * createComputedConstantsArray(); +double * createAlgebraicArray(); + void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *constants); diff --git a/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.py b/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.py index c651290c65..a5d2a5ec0d 100644 --- a/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.py +++ b/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.py @@ -33,8 +33,16 @@ def create_states_array(): return [nan]*STATE_COUNT -def create_variables_array(): - return [nan]*VARIABLE_COUNT +def create_constants_array(): + return [nan]*CONSTANT_COUNT + + +def create_computed_constants_array(): + return [nan]*COMPUTED_CONSTANT_COUNT + + +def create_algebraic_array(): + return [nan]*ALGEBRAIC_COUNT def initialise_variables(states, rates, constants): diff --git a/tests/resources/generator/dae_cellml_1_1_model/model.c b/tests/resources/generator/dae_cellml_1_1_model/model.c index 1ebd5e5fb5..a21add9d87 100644 --- a/tests/resources/generator/dae_cellml_1_1_model/model.c +++ b/tests/resources/generator/dae_cellml_1_1_model/model.c @@ -50,11 +50,33 @@ double * createStatesArray() return res; } -double * createVariablesArray() +double * createConstantsArray() { - double *res = (double *) malloc(VARIABLE_COUNT*sizeof(double)); + double *res = (double *) malloc(CONSTANT_COUNT*sizeof(double)); - for (size_t i = 0; i < VARIABLE_COUNT; ++i) { + for (size_t i = 0; i < CONSTANT_COUNT; ++i) { + res[i] = NAN; + } + + return res; +} + +double * createComputedConstantsArray() +{ + double *res = (double *) malloc(COMPUTED_CONSTANT_COUNT*sizeof(double)); + + for (size_t i = 0; i < COMPUTED_CONSTANT_COUNT; ++i) { + res[i] = NAN; + } + + return res; +} + +double * createAlgebraicArray() +{ + double *res = (double *) malloc(ALGEBRAIC_COUNT*sizeof(double)); + + for (size_t i = 0; i < ALGEBRAIC_COUNT; ++i) { res[i] = NAN; } diff --git a/tests/resources/generator/dae_cellml_1_1_model/model.h b/tests/resources/generator/dae_cellml_1_1_model/model.h index b6b9e63d2d..7a1968fd68 100644 --- a/tests/resources/generator/dae_cellml_1_1_model/model.h +++ b/tests/resources/generator/dae_cellml_1_1_model/model.h @@ -25,7 +25,10 @@ extern const VariableInfo COMPUTED_CONSTANT_INFO[]; extern const VariableInfo ALGEBRAIC_INFO[]; double * createStatesArray(); -double * createVariablesArray(); +double * createConstantsArray(); +double * createComputedConstantsArray(); +double * createAlgebraicArray(); + void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *constants); diff --git a/tests/resources/generator/dae_cellml_1_1_model/model.py b/tests/resources/generator/dae_cellml_1_1_model/model.py index ec7692c381..f1bef75dca 100644 --- a/tests/resources/generator/dae_cellml_1_1_model/model.py +++ b/tests/resources/generator/dae_cellml_1_1_model/model.py @@ -42,8 +42,16 @@ def create_states_array(): return [nan]*STATE_COUNT -def create_variables_array(): - return [nan]*VARIABLE_COUNT +def create_constants_array(): + return [nan]*CONSTANT_COUNT + + +def create_computed_constants_array(): + return [nan]*COMPUTED_CONSTANT_COUNT + + +def create_algebraic_array(): + return [nan]*ALGEBRAIC_COUNT from nlasolver import nla_solve diff --git a/tests/resources/generator/dependent_eqns/model.c b/tests/resources/generator/dependent_eqns/model.c index abaa47ae6c..9367b233ff 100644 --- a/tests/resources/generator/dependent_eqns/model.c +++ b/tests/resources/generator/dependent_eqns/model.c @@ -41,11 +41,33 @@ double * createStatesArray() return res; } -double * createVariablesArray() +double * createConstantsArray() { - double *res = (double *) malloc(VARIABLE_COUNT*sizeof(double)); + double *res = (double *) malloc(CONSTANT_COUNT*sizeof(double)); - for (size_t i = 0; i < VARIABLE_COUNT; ++i) { + for (size_t i = 0; i < CONSTANT_COUNT; ++i) { + res[i] = NAN; + } + + return res; +} + +double * createComputedConstantsArray() +{ + double *res = (double *) malloc(COMPUTED_CONSTANT_COUNT*sizeof(double)); + + for (size_t i = 0; i < COMPUTED_CONSTANT_COUNT; ++i) { + res[i] = NAN; + } + + return res; +} + +double * createAlgebraicArray() +{ + double *res = (double *) malloc(ALGEBRAIC_COUNT*sizeof(double)); + + for (size_t i = 0; i < ALGEBRAIC_COUNT; ++i) { res[i] = NAN; } diff --git a/tests/resources/generator/dependent_eqns/model.h b/tests/resources/generator/dependent_eqns/model.h index 31a196c76d..006a4093e9 100644 --- a/tests/resources/generator/dependent_eqns/model.h +++ b/tests/resources/generator/dependent_eqns/model.h @@ -25,7 +25,10 @@ extern const VariableInfo COMPUTED_CONSTANT_INFO[]; extern const VariableInfo ALGEBRAIC_INFO[]; double * createStatesArray(); -double * createVariablesArray(); +double * createConstantsArray(); +double * createComputedConstantsArray(); +double * createAlgebraicArray(); + void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *constants); diff --git a/tests/resources/generator/dependent_eqns/model.py b/tests/resources/generator/dependent_eqns/model.py index a2d3b99f8f..b60c94ccfc 100644 --- a/tests/resources/generator/dependent_eqns/model.py +++ b/tests/resources/generator/dependent_eqns/model.py @@ -33,8 +33,16 @@ def create_states_array(): return [nan]*STATE_COUNT -def create_variables_array(): - return [nan]*VARIABLE_COUNT +def create_constants_array(): + return [nan]*CONSTANT_COUNT + + +def create_computed_constants_array(): + return [nan]*COMPUTED_CONSTANT_COUNT + + +def create_algebraic_array(): + return [nan]*ALGEBRAIC_COUNT def initialise_variables(states, rates, constants): diff --git a/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.c b/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.c index a382c211ba..40f092eb99 100644 --- a/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.c +++ b/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.c @@ -288,11 +288,33 @@ double * createStatesArray() return res; } -double * createVariablesArray() +double * createConstantsArray() { - double *res = (double *) malloc(VARIABLE_COUNT*sizeof(double)); + double *res = (double *) malloc(CONSTANT_COUNT*sizeof(double)); - for (size_t i = 0; i < VARIABLE_COUNT; ++i) { + for (size_t i = 0; i < CONSTANT_COUNT; ++i) { + res[i] = NAN; + } + + return res; +} + +double * createComputedConstantsArray() +{ + double *res = (double *) malloc(COMPUTED_CONSTANT_COUNT*sizeof(double)); + + for (size_t i = 0; i < COMPUTED_CONSTANT_COUNT; ++i) { + res[i] = NAN; + } + + return res; +} + +double * createAlgebraicArray() +{ + double *res = (double *) malloc(ALGEBRAIC_COUNT*sizeof(double)); + + for (size_t i = 0; i < ALGEBRAIC_COUNT; ++i) { res[i] = NAN; } diff --git a/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.h b/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.h index 72b9004c18..559cb88d64 100644 --- a/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.h +++ b/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.h @@ -25,7 +25,10 @@ extern const VariableInfo COMPUTED_CONSTANT_INFO[]; extern const VariableInfo ALGEBRAIC_INFO[]; double * createStatesArray(); -double * createVariablesArray(); +double * createConstantsArray(); +double * createComputedConstantsArray(); +double * createAlgebraicArray(); + void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *constants); diff --git a/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.py b/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.py index 41c3234100..e216fc6a49 100644 --- a/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.py +++ b/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.py @@ -300,8 +300,16 @@ def create_states_array(): return [nan]*STATE_COUNT -def create_variables_array(): - return [nan]*VARIABLE_COUNT +def create_constants_array(): + return [nan]*CONSTANT_COUNT + + +def create_computed_constants_array(): + return [nan]*COMPUTED_CONSTANT_COUNT + + +def create_algebraic_array(): + return [nan]*ALGEBRAIC_COUNT def initialise_variables(states, rates, constants): diff --git a/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.c b/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.c index cd6dbc4de0..51a8f5289f 100644 --- a/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.c +++ b/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.c @@ -238,11 +238,33 @@ double * createStatesArray() return res; } -double * createVariablesArray() +double * createConstantsArray() { - double *res = (double *) malloc(VARIABLE_COUNT*sizeof(double)); + double *res = (double *) malloc(CONSTANT_COUNT*sizeof(double)); - for (size_t i = 0; i < VARIABLE_COUNT; ++i) { + for (size_t i = 0; i < CONSTANT_COUNT; ++i) { + res[i] = NAN; + } + + return res; +} + +double * createComputedConstantsArray() +{ + double *res = (double *) malloc(COMPUTED_CONSTANT_COUNT*sizeof(double)); + + for (size_t i = 0; i < COMPUTED_CONSTANT_COUNT; ++i) { + res[i] = NAN; + } + + return res; +} + +double * createAlgebraicArray() +{ + double *res = (double *) malloc(ALGEBRAIC_COUNT*sizeof(double)); + + for (size_t i = 0; i < ALGEBRAIC_COUNT; ++i) { res[i] = NAN; } diff --git a/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.h b/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.h index 4edb4f7200..5aca23091a 100644 --- a/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.h +++ b/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.h @@ -25,7 +25,10 @@ extern const VariableInfo COMPUTED_CONSTANT_INFO[]; extern const VariableInfo ALGEBRAIC_INFO[]; double * createStatesArray(); -double * createVariablesArray(); +double * createConstantsArray(); +double * createComputedConstantsArray(); +double * createAlgebraicArray(); + void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *constants); diff --git a/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.py b/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.py index a10fd42ef1..8eda5b4204 100644 --- a/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.py +++ b/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.py @@ -238,8 +238,16 @@ def create_states_array(): return [nan]*STATE_COUNT -def create_variables_array(): - return [nan]*VARIABLE_COUNT +def create_constants_array(): + return [nan]*CONSTANT_COUNT + + +def create_computed_constants_array(): + return [nan]*COMPUTED_CONSTANT_COUNT + + +def create_algebraic_array(): + return [nan]*ALGEBRAIC_COUNT def initialise_variables(states, rates, constants): diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.c index 8bb5523780..27a20813d9 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.c @@ -64,11 +64,44 @@ double * createStatesArray() return res; } -double * createVariablesArray() +double * createConstantsArray() { - double *res = (double *) malloc(VARIABLE_COUNT*sizeof(double)); + double *res = (double *) malloc(CONSTANT_COUNT*sizeof(double)); - for (size_t i = 0; i < VARIABLE_COUNT; ++i) { + for (size_t i = 0; i < CONSTANT_COUNT; ++i) { + res[i] = NAN; + } + + return res; +} + +double * createComputedConstantsArray() +{ + double *res = (double *) malloc(COMPUTED_CONSTANT_COUNT*sizeof(double)); + + for (size_t i = 0; i < COMPUTED_CONSTANT_COUNT; ++i) { + res[i] = NAN; + } + + return res; +} + +double * createAlgebraicArray() +{ + double *res = (double *) malloc(ALGEBRAIC_COUNT*sizeof(double)); + + for (size_t i = 0; i < ALGEBRAIC_COUNT; ++i) { + res[i] = NAN; + } + + return res; +} + +double * createExternalsArray() +{ + double *res = (double *) malloc(EXTERNAL_COUNT*sizeof(double)); + + for (size_t i = 0; i < EXTERNAL_COUNT; ++i) { res[i] = NAN; } diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.h index 87c9d97a56..e30a552fd7 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.h +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.h @@ -27,7 +27,11 @@ extern const VariableInfo ALGEBRAIC_INFO[]; extern const VariableInfo EXTERNAL_INFO[]; double * createStatesArray(); -double * createVariablesArray(); +double * createConstantsArray(); +double * createComputedConstantsArray(); +double * createAlgebraicArray(); +double * createExternalsArray(); + void deleteArray(double *array); typedef double (* ExternalVariable)(double voi, double *states, double *rates, double *variables, size_t index); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.py index 1b9d75ed20..30ad480ead 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.py @@ -68,8 +68,20 @@ def create_states_array(): return [nan]*STATE_COUNT -def create_variables_array(): - return [nan]*VARIABLE_COUNT +def create_constants_array(): + return [nan]*CONSTANT_COUNT + + +def create_computed_constants_array(): + return [nan]*COMPUTED_CONSTANT_COUNT + + +def create_algebraic_array(): + return [nan]*ALGEBRAIC_COUNT + + +def create_externals_array(): + return [nan]*EXTERNAL_COUNT def initialise_variables(voi, states, rates, constants, external_variable): diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.c index 77ac9b4bec..7a9b63a34e 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.c @@ -60,11 +60,33 @@ double * createStatesArray() return res; } -double * createVariablesArray() +double * createConstantsArray() { - double *res = (double *) malloc(VARIABLE_COUNT*sizeof(double)); + double *res = (double *) malloc(CONSTANT_COUNT*sizeof(double)); - for (size_t i = 0; i < VARIABLE_COUNT; ++i) { + for (size_t i = 0; i < CONSTANT_COUNT; ++i) { + res[i] = NAN; + } + + return res; +} + +double * createComputedConstantsArray() +{ + double *res = (double *) malloc(COMPUTED_CONSTANT_COUNT*sizeof(double)); + + for (size_t i = 0; i < COMPUTED_CONSTANT_COUNT; ++i) { + res[i] = NAN; + } + + return res; +} + +double * createAlgebraicArray() +{ + double *res = (double *) malloc(ALGEBRAIC_COUNT*sizeof(double)); + + for (size_t i = 0; i < ALGEBRAIC_COUNT; ++i) { res[i] = NAN; } diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.c index b478980248..2f1d436b51 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.c @@ -64,11 +64,44 @@ double * createStatesArray() return res; } -double * createVariablesArray() +double * createConstantsArray() { - double *res = (double *) malloc(VARIABLE_COUNT*sizeof(double)); + double *res = (double *) malloc(CONSTANT_COUNT*sizeof(double)); - for (size_t i = 0; i < VARIABLE_COUNT; ++i) { + for (size_t i = 0; i < CONSTANT_COUNT; ++i) { + res[i] = NAN; + } + + return res; +} + +double * createComputedConstantsArray() +{ + double *res = (double *) malloc(COMPUTED_CONSTANT_COUNT*sizeof(double)); + + for (size_t i = 0; i < COMPUTED_CONSTANT_COUNT; ++i) { + res[i] = NAN; + } + + return res; +} + +double * createAlgebraicArray() +{ + double *res = (double *) malloc(ALGEBRAIC_COUNT*sizeof(double)); + + for (size_t i = 0; i < ALGEBRAIC_COUNT; ++i) { + res[i] = NAN; + } + + return res; +} + +double * createExternalsArray() +{ + double *res = (double *) malloc(EXTERNAL_COUNT*sizeof(double)); + + for (size_t i = 0; i < EXTERNAL_COUNT; ++i) { res[i] = NAN; } diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.h index 87c9d97a56..e30a552fd7 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.h +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.h @@ -27,7 +27,11 @@ extern const VariableInfo ALGEBRAIC_INFO[]; extern const VariableInfo EXTERNAL_INFO[]; double * createStatesArray(); -double * createVariablesArray(); +double * createConstantsArray(); +double * createComputedConstantsArray(); +double * createAlgebraicArray(); +double * createExternalsArray(); + void deleteArray(double *array); typedef double (* ExternalVariable)(double voi, double *states, double *rates, double *variables, size_t index); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.py index 45f4360d8c..a8489aee69 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.py @@ -68,8 +68,20 @@ def create_states_array(): return [nan]*STATE_COUNT -def create_variables_array(): - return [nan]*VARIABLE_COUNT +def create_constants_array(): + return [nan]*CONSTANT_COUNT + + +def create_computed_constants_array(): + return [nan]*COMPUTED_CONSTANT_COUNT + + +def create_algebraic_array(): + return [nan]*ALGEBRAIC_COUNT + + +def create_externals_array(): + return [nan]*EXTERNAL_COUNT def initialise_variables(voi, states, rates, constants, external_variable): diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.c index 7de8288be3..13e2f75179 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.c @@ -64,11 +64,44 @@ double * createStatesArray() return res; } -double * createVariablesArray() +double * createConstantsArray() { - double *res = (double *) malloc(VARIABLE_COUNT*sizeof(double)); + double *res = (double *) malloc(CONSTANT_COUNT*sizeof(double)); - for (size_t i = 0; i < VARIABLE_COUNT; ++i) { + for (size_t i = 0; i < CONSTANT_COUNT; ++i) { + res[i] = NAN; + } + + return res; +} + +double * createComputedConstantsArray() +{ + double *res = (double *) malloc(COMPUTED_CONSTANT_COUNT*sizeof(double)); + + for (size_t i = 0; i < COMPUTED_CONSTANT_COUNT; ++i) { + res[i] = NAN; + } + + return res; +} + +double * createAlgebraicArray() +{ + double *res = (double *) malloc(ALGEBRAIC_COUNT*sizeof(double)); + + for (size_t i = 0; i < ALGEBRAIC_COUNT; ++i) { + res[i] = NAN; + } + + return res; +} + +double * createExternalsArray() +{ + double *res = (double *) malloc(EXTERNAL_COUNT*sizeof(double)); + + for (size_t i = 0; i < EXTERNAL_COUNT; ++i) { res[i] = NAN; } diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.h index 87c9d97a56..e30a552fd7 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.h +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.h @@ -27,7 +27,11 @@ extern const VariableInfo ALGEBRAIC_INFO[]; extern const VariableInfo EXTERNAL_INFO[]; double * createStatesArray(); -double * createVariablesArray(); +double * createConstantsArray(); +double * createComputedConstantsArray(); +double * createAlgebraicArray(); +double * createExternalsArray(); + void deleteArray(double *array); typedef double (* ExternalVariable)(double voi, double *states, double *rates, double *variables, size_t index); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.py index 96c8a1f6e5..378af0a1b0 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.py @@ -68,8 +68,20 @@ def create_states_array(): return [nan]*STATE_COUNT -def create_variables_array(): - return [nan]*VARIABLE_COUNT +def create_constants_array(): + return [nan]*CONSTANT_COUNT + + +def create_computed_constants_array(): + return [nan]*COMPUTED_CONSTANT_COUNT + + +def create_algebraic_array(): + return [nan]*ALGEBRAIC_COUNT + + +def create_externals_array(): + return [nan]*EXTERNAL_COUNT def initialise_variables(voi, states, rates, constants, external_variable): diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.c index d15936a8ac..543ff0e577 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.c @@ -60,11 +60,33 @@ double * createStatesArray() return res; } -double * createVariablesArray() +double * createConstantsArray() { - double *res = (double *) malloc(VARIABLE_COUNT*sizeof(double)); + double *res = (double *) malloc(CONSTANT_COUNT*sizeof(double)); - for (size_t i = 0; i < VARIABLE_COUNT; ++i) { + for (size_t i = 0; i < CONSTANT_COUNT; ++i) { + res[i] = NAN; + } + + return res; +} + +double * createComputedConstantsArray() +{ + double *res = (double *) malloc(COMPUTED_CONSTANT_COUNT*sizeof(double)); + + for (size_t i = 0; i < COMPUTED_CONSTANT_COUNT; ++i) { + res[i] = NAN; + } + + return res; +} + +double * createAlgebraicArray() +{ + double *res = (double *) malloc(ALGEBRAIC_COUNT*sizeof(double)); + + for (size_t i = 0; i < ALGEBRAIC_COUNT; ++i) { res[i] = NAN; } diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.h index d64d07bb62..ea730f3439 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.h +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.h @@ -25,7 +25,10 @@ extern const VariableInfo COMPUTED_CONSTANT_INFO[]; extern const VariableInfo ALGEBRAIC_INFO[]; double * createStatesArray(); -double * createVariablesArray(); +double * createConstantsArray(); +double * createComputedConstantsArray(); +double * createAlgebraicArray(); + void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *constants); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.py index 9293f1936a..258d847eae 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.py @@ -64,8 +64,16 @@ def create_states_array(): return [nan]*STATE_COUNT -def create_variables_array(): - return [nan]*VARIABLE_COUNT +def create_constants_array(): + return [nan]*CONSTANT_COUNT + + +def create_computed_constants_array(): + return [nan]*COMPUTED_CONSTANT_COUNT + + +def create_algebraic_array(): + return [nan]*ALGEBRAIC_COUNT from nlasolver import nla_solve diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.c index 070a92f7be..8c59caf7df 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.c @@ -64,11 +64,44 @@ double * createStatesArray() return res; } -double * createVariablesArray() +double * createConstantsArray() { - double *res = (double *) malloc(VARIABLE_COUNT*sizeof(double)); + double *res = (double *) malloc(CONSTANT_COUNT*sizeof(double)); - for (size_t i = 0; i < VARIABLE_COUNT; ++i) { + for (size_t i = 0; i < CONSTANT_COUNT; ++i) { + res[i] = NAN; + } + + return res; +} + +double * createComputedConstantsArray() +{ + double *res = (double *) malloc(COMPUTED_CONSTANT_COUNT*sizeof(double)); + + for (size_t i = 0; i < COMPUTED_CONSTANT_COUNT; ++i) { + res[i] = NAN; + } + + return res; +} + +double * createAlgebraicArray() +{ + double *res = (double *) malloc(ALGEBRAIC_COUNT*sizeof(double)); + + for (size_t i = 0; i < ALGEBRAIC_COUNT; ++i) { + res[i] = NAN; + } + + return res; +} + +double * createExternalsArray() +{ + double *res = (double *) malloc(EXTERNAL_COUNT*sizeof(double)); + + for (size_t i = 0; i < EXTERNAL_COUNT; ++i) { res[i] = NAN; } diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.h index 87c9d97a56..e30a552fd7 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.h +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.h @@ -27,7 +27,11 @@ extern const VariableInfo ALGEBRAIC_INFO[]; extern const VariableInfo EXTERNAL_INFO[]; double * createStatesArray(); -double * createVariablesArray(); +double * createConstantsArray(); +double * createComputedConstantsArray(); +double * createAlgebraicArray(); +double * createExternalsArray(); + void deleteArray(double *array); typedef double (* ExternalVariable)(double voi, double *states, double *rates, double *variables, size_t index); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.py index a03e31643a..4664272cf8 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.py @@ -68,8 +68,20 @@ def create_states_array(): return [nan]*STATE_COUNT -def create_variables_array(): - return [nan]*VARIABLE_COUNT +def create_constants_array(): + return [nan]*CONSTANT_COUNT + + +def create_computed_constants_array(): + return [nan]*COMPUTED_CONSTANT_COUNT + + +def create_algebraic_array(): + return [nan]*ALGEBRAIC_COUNT + + +def create_externals_array(): + return [nan]*EXTERNAL_COUNT def initialise_variables(voi, states, rates, constants, external_variable): diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.c index d34a01efc1..327f50b3b3 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.c @@ -64,11 +64,44 @@ double * createStatesArray() return res; } -double * createVariablesArray() +double * createConstantsArray() { - double *res = (double *) malloc(VARIABLE_COUNT*sizeof(double)); + double *res = (double *) malloc(CONSTANT_COUNT*sizeof(double)); - for (size_t i = 0; i < VARIABLE_COUNT; ++i) { + for (size_t i = 0; i < CONSTANT_COUNT; ++i) { + res[i] = NAN; + } + + return res; +} + +double * createComputedConstantsArray() +{ + double *res = (double *) malloc(COMPUTED_CONSTANT_COUNT*sizeof(double)); + + for (size_t i = 0; i < COMPUTED_CONSTANT_COUNT; ++i) { + res[i] = NAN; + } + + return res; +} + +double * createAlgebraicArray() +{ + double *res = (double *) malloc(ALGEBRAIC_COUNT*sizeof(double)); + + for (size_t i = 0; i < ALGEBRAIC_COUNT; ++i) { + res[i] = NAN; + } + + return res; +} + +double * createExternalsArray() +{ + double *res = (double *) malloc(EXTERNAL_COUNT*sizeof(double)); + + for (size_t i = 0; i < EXTERNAL_COUNT; ++i) { res[i] = NAN; } diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.h index 87c9d97a56..e30a552fd7 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.h +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.h @@ -27,7 +27,11 @@ extern const VariableInfo ALGEBRAIC_INFO[]; extern const VariableInfo EXTERNAL_INFO[]; double * createStatesArray(); -double * createVariablesArray(); +double * createConstantsArray(); +double * createComputedConstantsArray(); +double * createAlgebraicArray(); +double * createExternalsArray(); + void deleteArray(double *array); typedef double (* ExternalVariable)(double voi, double *states, double *rates, double *variables, size_t index); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.py index e655d50b53..70ef952df6 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.py @@ -68,8 +68,20 @@ def create_states_array(): return [nan]*STATE_COUNT -def create_variables_array(): - return [nan]*VARIABLE_COUNT +def create_constants_array(): + return [nan]*CONSTANT_COUNT + + +def create_computed_constants_array(): + return [nan]*COMPUTED_CONSTANT_COUNT + + +def create_algebraic_array(): + return [nan]*ALGEBRAIC_COUNT + + +def create_externals_array(): + return [nan]*EXTERNAL_COUNT def initialise_variables(voi, states, rates, constants, external_variable): diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.c index c93e668a04..c8ecad99e8 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.c @@ -64,11 +64,44 @@ double * createStatesArray() return res; } -double * createVariablesArray() +double * createConstantsArray() { - double *res = (double *) malloc(VARIABLE_COUNT*sizeof(double)); + double *res = (double *) malloc(CONSTANT_COUNT*sizeof(double)); - for (size_t i = 0; i < VARIABLE_COUNT; ++i) { + for (size_t i = 0; i < CONSTANT_COUNT; ++i) { + res[i] = NAN; + } + + return res; +} + +double * createComputedConstantsArray() +{ + double *res = (double *) malloc(COMPUTED_CONSTANT_COUNT*sizeof(double)); + + for (size_t i = 0; i < COMPUTED_CONSTANT_COUNT; ++i) { + res[i] = NAN; + } + + return res; +} + +double * createAlgebraicArray() +{ + double *res = (double *) malloc(ALGEBRAIC_COUNT*sizeof(double)); + + for (size_t i = 0; i < ALGEBRAIC_COUNT; ++i) { + res[i] = NAN; + } + + return res; +} + +double * createExternalsArray() +{ + double *res = (double *) malloc(EXTERNAL_COUNT*sizeof(double)); + + for (size_t i = 0; i < EXTERNAL_COUNT; ++i) { res[i] = NAN; } diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.h index 87c9d97a56..e30a552fd7 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.h +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.h @@ -27,7 +27,11 @@ extern const VariableInfo ALGEBRAIC_INFO[]; extern const VariableInfo EXTERNAL_INFO[]; double * createStatesArray(); -double * createVariablesArray(); +double * createConstantsArray(); +double * createComputedConstantsArray(); +double * createAlgebraicArray(); +double * createExternalsArray(); + void deleteArray(double *array); typedef double (* ExternalVariable)(double voi, double *states, double *rates, double *variables, size_t index); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.py index bdb693b0de..308af32966 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.py @@ -68,8 +68,20 @@ def create_states_array(): return [nan]*STATE_COUNT -def create_variables_array(): - return [nan]*VARIABLE_COUNT +def create_constants_array(): + return [nan]*CONSTANT_COUNT + + +def create_computed_constants_array(): + return [nan]*COMPUTED_CONSTANT_COUNT + + +def create_algebraic_array(): + return [nan]*ALGEBRAIC_COUNT + + +def create_externals_array(): + return [nan]*EXTERNAL_COUNT def initialise_variables(voi, states, rates, constants, external_variable): diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.c index f7bfa5c34c..02e6af377e 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.c @@ -64,11 +64,44 @@ double * createStatesArray() return res; } -double * createVariablesArray() +double * createConstantsArray() { - double *res = (double *) malloc(VARIABLE_COUNT*sizeof(double)); + double *res = (double *) malloc(CONSTANT_COUNT*sizeof(double)); - for (size_t i = 0; i < VARIABLE_COUNT; ++i) { + for (size_t i = 0; i < CONSTANT_COUNT; ++i) { + res[i] = NAN; + } + + return res; +} + +double * createComputedConstantsArray() +{ + double *res = (double *) malloc(COMPUTED_CONSTANT_COUNT*sizeof(double)); + + for (size_t i = 0; i < COMPUTED_CONSTANT_COUNT; ++i) { + res[i] = NAN; + } + + return res; +} + +double * createAlgebraicArray() +{ + double *res = (double *) malloc(ALGEBRAIC_COUNT*sizeof(double)); + + for (size_t i = 0; i < ALGEBRAIC_COUNT; ++i) { + res[i] = NAN; + } + + return res; +} + +double * createExternalsArray() +{ + double *res = (double *) malloc(EXTERNAL_COUNT*sizeof(double)); + + for (size_t i = 0; i < EXTERNAL_COUNT; ++i) { res[i] = NAN; } diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.h index 87c9d97a56..e30a552fd7 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.h +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.h @@ -27,7 +27,11 @@ extern const VariableInfo ALGEBRAIC_INFO[]; extern const VariableInfo EXTERNAL_INFO[]; double * createStatesArray(); -double * createVariablesArray(); +double * createConstantsArray(); +double * createComputedConstantsArray(); +double * createAlgebraicArray(); +double * createExternalsArray(); + void deleteArray(double *array); typedef double (* ExternalVariable)(double voi, double *states, double *rates, double *variables, size_t index); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.py index ef8be939ed..428ac2d5c6 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.py @@ -68,8 +68,20 @@ def create_states_array(): return [nan]*STATE_COUNT -def create_variables_array(): - return [nan]*VARIABLE_COUNT +def create_constants_array(): + return [nan]*CONSTANT_COUNT + + +def create_computed_constants_array(): + return [nan]*COMPUTED_CONSTANT_COUNT + + +def create_algebraic_array(): + return [nan]*ALGEBRAIC_COUNT + + +def create_externals_array(): + return [nan]*EXTERNAL_COUNT def initialise_variables(voi, states, rates, constants, external_variable): diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.c index 6682384a4b..cd8f102401 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.c @@ -64,11 +64,44 @@ double * createStatesArray() return res; } -double * createVariablesArray() +double * createConstantsArray() { - double *res = (double *) malloc(VARIABLE_COUNT*sizeof(double)); + double *res = (double *) malloc(CONSTANT_COUNT*sizeof(double)); - for (size_t i = 0; i < VARIABLE_COUNT; ++i) { + for (size_t i = 0; i < CONSTANT_COUNT; ++i) { + res[i] = NAN; + } + + return res; +} + +double * createComputedConstantsArray() +{ + double *res = (double *) malloc(COMPUTED_CONSTANT_COUNT*sizeof(double)); + + for (size_t i = 0; i < COMPUTED_CONSTANT_COUNT; ++i) { + res[i] = NAN; + } + + return res; +} + +double * createAlgebraicArray() +{ + double *res = (double *) malloc(ALGEBRAIC_COUNT*sizeof(double)); + + for (size_t i = 0; i < ALGEBRAIC_COUNT; ++i) { + res[i] = NAN; + } + + return res; +} + +double * createExternalsArray() +{ + double *res = (double *) malloc(EXTERNAL_COUNT*sizeof(double)); + + for (size_t i = 0; i < EXTERNAL_COUNT; ++i) { res[i] = NAN; } diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.h index 87c9d97a56..e30a552fd7 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.h +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.h @@ -27,7 +27,11 @@ extern const VariableInfo ALGEBRAIC_INFO[]; extern const VariableInfo EXTERNAL_INFO[]; double * createStatesArray(); -double * createVariablesArray(); +double * createConstantsArray(); +double * createComputedConstantsArray(); +double * createAlgebraicArray(); +double * createExternalsArray(); + void deleteArray(double *array); typedef double (* ExternalVariable)(double voi, double *states, double *rates, double *variables, size_t index); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.py index 7a5b0bf19e..f4e5fa7cee 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.py @@ -68,8 +68,20 @@ def create_states_array(): return [nan]*STATE_COUNT -def create_variables_array(): - return [nan]*VARIABLE_COUNT +def create_constants_array(): + return [nan]*CONSTANT_COUNT + + +def create_computed_constants_array(): + return [nan]*COMPUTED_CONSTANT_COUNT + + +def create_algebraic_array(): + return [nan]*ALGEBRAIC_COUNT + + +def create_externals_array(): + return [nan]*EXTERNAL_COUNT def initialise_variables(voi, states, rates, constants, external_variable): diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.h index d64d07bb62..ea730f3439 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.h +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.h @@ -25,7 +25,10 @@ extern const VariableInfo COMPUTED_CONSTANT_INFO[]; extern const VariableInfo ALGEBRAIC_INFO[]; double * createStatesArray(); -double * createVariablesArray(); +double * createConstantsArray(); +double * createComputedConstantsArray(); +double * createAlgebraicArray(); + void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *constants); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.py index 161468ab22..a87129a9a2 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.py @@ -64,8 +64,16 @@ def create_states_array(): return [nan]*STATE_COUNT -def create_variables_array(): - return [nan]*VARIABLE_COUNT +def create_constants_array(): + return [nan]*CONSTANT_COUNT + + +def create_computed_constants_array(): + return [nan]*COMPUTED_CONSTANT_COUNT + + +def create_algebraic_array(): + return [nan]*ALGEBRAIC_COUNT def initialise_variables(states, rates, constants): diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.c index 69ac3783d6..c159999cd3 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.c @@ -64,11 +64,44 @@ double * createStatesArray() return res; } -double * createVariablesArray() +double * createConstantsArray() { - double *res = (double *) malloc(VARIABLE_COUNT*sizeof(double)); + double *res = (double *) malloc(CONSTANT_COUNT*sizeof(double)); - for (size_t i = 0; i < VARIABLE_COUNT; ++i) { + for (size_t i = 0; i < CONSTANT_COUNT; ++i) { + res[i] = NAN; + } + + return res; +} + +double * createComputedConstantsArray() +{ + double *res = (double *) malloc(COMPUTED_CONSTANT_COUNT*sizeof(double)); + + for (size_t i = 0; i < COMPUTED_CONSTANT_COUNT; ++i) { + res[i] = NAN; + } + + return res; +} + +double * createAlgebraicArray() +{ + double *res = (double *) malloc(ALGEBRAIC_COUNT*sizeof(double)); + + for (size_t i = 0; i < ALGEBRAIC_COUNT; ++i) { + res[i] = NAN; + } + + return res; +} + +double * createExternalsArray() +{ + double *res = (double *) malloc(EXTERNAL_COUNT*sizeof(double)); + + for (size_t i = 0; i < EXTERNAL_COUNT; ++i) { res[i] = NAN; } diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.h index 87c9d97a56..e30a552fd7 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.h +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.h @@ -27,7 +27,11 @@ extern const VariableInfo ALGEBRAIC_INFO[]; extern const VariableInfo EXTERNAL_INFO[]; double * createStatesArray(); -double * createVariablesArray(); +double * createConstantsArray(); +double * createComputedConstantsArray(); +double * createAlgebraicArray(); +double * createExternalsArray(); + void deleteArray(double *array); typedef double (* ExternalVariable)(double voi, double *states, double *rates, double *variables, size_t index); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.py index 1574fc8fd1..1e33ef6169 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.py @@ -68,8 +68,20 @@ def create_states_array(): return [nan]*STATE_COUNT -def create_variables_array(): - return [nan]*VARIABLE_COUNT +def create_constants_array(): + return [nan]*CONSTANT_COUNT + + +def create_computed_constants_array(): + return [nan]*COMPUTED_CONSTANT_COUNT + + +def create_algebraic_array(): + return [nan]*ALGEBRAIC_COUNT + + +def create_externals_array(): + return [nan]*EXTERNAL_COUNT def initialise_variables(voi, states, rates, constants, external_variable): diff --git a/tests/resources/generator/noble_model_1962/model.c b/tests/resources/generator/noble_model_1962/model.c index 42e464392e..edde742db4 100644 --- a/tests/resources/generator/noble_model_1962/model.c +++ b/tests/resources/generator/noble_model_1962/model.c @@ -59,11 +59,33 @@ double * createStatesArray() return res; } -double * createVariablesArray() +double * createConstantsArray() { - double *res = (double *) malloc(VARIABLE_COUNT*sizeof(double)); + double *res = (double *) malloc(CONSTANT_COUNT*sizeof(double)); - for (size_t i = 0; i < VARIABLE_COUNT; ++i) { + for (size_t i = 0; i < CONSTANT_COUNT; ++i) { + res[i] = NAN; + } + + return res; +} + +double * createComputedConstantsArray() +{ + double *res = (double *) malloc(COMPUTED_CONSTANT_COUNT*sizeof(double)); + + for (size_t i = 0; i < COMPUTED_CONSTANT_COUNT; ++i) { + res[i] = NAN; + } + + return res; +} + +double * createAlgebraicArray() +{ + double *res = (double *) malloc(ALGEBRAIC_COUNT*sizeof(double)); + + for (size_t i = 0; i < ALGEBRAIC_COUNT; ++i) { res[i] = NAN; } diff --git a/tests/resources/generator/noble_model_1962/model.h b/tests/resources/generator/noble_model_1962/model.h index a4c01ffa0c..c8b91de020 100644 --- a/tests/resources/generator/noble_model_1962/model.h +++ b/tests/resources/generator/noble_model_1962/model.h @@ -25,7 +25,10 @@ extern const VariableInfo COMPUTED_CONSTANT_INFO[]; extern const VariableInfo ALGEBRAIC_INFO[]; double * createStatesArray(); -double * createVariablesArray(); +double * createConstantsArray(); +double * createComputedConstantsArray(); +double * createAlgebraicArray(); + void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *constants); diff --git a/tests/resources/generator/noble_model_1962/model.py b/tests/resources/generator/noble_model_1962/model.py index 0b75dd7778..00c9d24e7b 100644 --- a/tests/resources/generator/noble_model_1962/model.py +++ b/tests/resources/generator/noble_model_1962/model.py @@ -51,8 +51,16 @@ def create_states_array(): return [nan]*STATE_COUNT -def create_variables_array(): - return [nan]*VARIABLE_COUNT +def create_constants_array(): + return [nan]*CONSTANT_COUNT + + +def create_computed_constants_array(): + return [nan]*COMPUTED_CONSTANT_COUNT + + +def create_algebraic_array(): + return [nan]*ALGEBRAIC_COUNT def initialise_variables(states, rates, constants): diff --git a/tests/resources/generator/ode_computed_var_on_rhs/model.c b/tests/resources/generator/ode_computed_var_on_rhs/model.c index abf35649d0..abdd008791 100644 --- a/tests/resources/generator/ode_computed_var_on_rhs/model.c +++ b/tests/resources/generator/ode_computed_var_on_rhs/model.c @@ -40,11 +40,33 @@ double * createStatesArray() return res; } -double * createVariablesArray() +double * createConstantsArray() { - double *res = (double *) malloc(VARIABLE_COUNT*sizeof(double)); + double *res = (double *) malloc(CONSTANT_COUNT*sizeof(double)); - for (size_t i = 0; i < VARIABLE_COUNT; ++i) { + for (size_t i = 0; i < CONSTANT_COUNT; ++i) { + res[i] = NAN; + } + + return res; +} + +double * createComputedConstantsArray() +{ + double *res = (double *) malloc(COMPUTED_CONSTANT_COUNT*sizeof(double)); + + for (size_t i = 0; i < COMPUTED_CONSTANT_COUNT; ++i) { + res[i] = NAN; + } + + return res; +} + +double * createAlgebraicArray() +{ + double *res = (double *) malloc(ALGEBRAIC_COUNT*sizeof(double)); + + for (size_t i = 0; i < ALGEBRAIC_COUNT; ++i) { res[i] = NAN; } diff --git a/tests/resources/generator/ode_computed_var_on_rhs/model.h b/tests/resources/generator/ode_computed_var_on_rhs/model.h index 8d446982d8..319a116d0f 100644 --- a/tests/resources/generator/ode_computed_var_on_rhs/model.h +++ b/tests/resources/generator/ode_computed_var_on_rhs/model.h @@ -25,7 +25,10 @@ extern const VariableInfo COMPUTED_CONSTANT_INFO[]; extern const VariableInfo ALGEBRAIC_INFO[]; double * createStatesArray(); -double * createVariablesArray(); +double * createConstantsArray(); +double * createComputedConstantsArray(); +double * createAlgebraicArray(); + void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *constants); diff --git a/tests/resources/generator/ode_computed_var_on_rhs/model.py b/tests/resources/generator/ode_computed_var_on_rhs/model.py index 81b6db4c1d..775459ff5d 100644 --- a/tests/resources/generator/ode_computed_var_on_rhs/model.py +++ b/tests/resources/generator/ode_computed_var_on_rhs/model.py @@ -32,8 +32,16 @@ def create_states_array(): return [nan]*STATE_COUNT -def create_variables_array(): - return [nan]*VARIABLE_COUNT +def create_constants_array(): + return [nan]*CONSTANT_COUNT + + +def create_computed_constants_array(): + return [nan]*COMPUTED_CONSTANT_COUNT + + +def create_algebraic_array(): + return [nan]*ALGEBRAIC_COUNT def initialise_variables(states, rates, constants): diff --git a/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.c b/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.c index e6eecbfdc7..ca6456d26e 100644 --- a/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.c +++ b/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.c @@ -40,11 +40,33 @@ double * createStatesArray() return res; } -double * createVariablesArray() +double * createConstantsArray() { - double *res = (double *) malloc(VARIABLE_COUNT*sizeof(double)); + double *res = (double *) malloc(CONSTANT_COUNT*sizeof(double)); - for (size_t i = 0; i < VARIABLE_COUNT; ++i) { + for (size_t i = 0; i < CONSTANT_COUNT; ++i) { + res[i] = NAN; + } + + return res; +} + +double * createComputedConstantsArray() +{ + double *res = (double *) malloc(COMPUTED_CONSTANT_COUNT*sizeof(double)); + + for (size_t i = 0; i < COMPUTED_CONSTANT_COUNT; ++i) { + res[i] = NAN; + } + + return res; +} + +double * createAlgebraicArray() +{ + double *res = (double *) malloc(ALGEBRAIC_COUNT*sizeof(double)); + + for (size_t i = 0; i < ALGEBRAIC_COUNT; ++i) { res[i] = NAN; } diff --git a/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.h b/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.h index 1c36d8d5fc..83c0783867 100644 --- a/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.h +++ b/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.h @@ -25,7 +25,10 @@ extern const VariableInfo COMPUTED_CONSTANT_INFO[]; extern const VariableInfo ALGEBRAIC_INFO[]; double * createStatesArray(); -double * createVariablesArray(); +double * createConstantsArray(); +double * createComputedConstantsArray(); +double * createAlgebraicArray(); + void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *constants); diff --git a/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.py b/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.py index 6f9c31e1eb..e6a977d946 100644 --- a/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.py +++ b/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.py @@ -32,8 +32,16 @@ def create_states_array(): return [nan]*STATE_COUNT -def create_variables_array(): - return [nan]*VARIABLE_COUNT +def create_constants_array(): + return [nan]*CONSTANT_COUNT + + +def create_computed_constants_array(): + return [nan]*COMPUTED_CONSTANT_COUNT + + +def create_algebraic_array(): + return [nan]*ALGEBRAIC_COUNT def initialise_variables(states, rates, constants): diff --git a/tests/resources/generator/ode_const_var_on_rhs/model.c b/tests/resources/generator/ode_const_var_on_rhs/model.c index a0af88531e..bc63cf66f4 100644 --- a/tests/resources/generator/ode_const_var_on_rhs/model.c +++ b/tests/resources/generator/ode_const_var_on_rhs/model.c @@ -40,11 +40,33 @@ double * createStatesArray() return res; } -double * createVariablesArray() +double * createConstantsArray() { - double *res = (double *) malloc(VARIABLE_COUNT*sizeof(double)); + double *res = (double *) malloc(CONSTANT_COUNT*sizeof(double)); - for (size_t i = 0; i < VARIABLE_COUNT; ++i) { + for (size_t i = 0; i < CONSTANT_COUNT; ++i) { + res[i] = NAN; + } + + return res; +} + +double * createComputedConstantsArray() +{ + double *res = (double *) malloc(COMPUTED_CONSTANT_COUNT*sizeof(double)); + + for (size_t i = 0; i < COMPUTED_CONSTANT_COUNT; ++i) { + res[i] = NAN; + } + + return res; +} + +double * createAlgebraicArray() +{ + double *res = (double *) malloc(ALGEBRAIC_COUNT*sizeof(double)); + + for (size_t i = 0; i < ALGEBRAIC_COUNT; ++i) { res[i] = NAN; } diff --git a/tests/resources/generator/ode_const_var_on_rhs/model.h b/tests/resources/generator/ode_const_var_on_rhs/model.h index 8d446982d8..319a116d0f 100644 --- a/tests/resources/generator/ode_const_var_on_rhs/model.h +++ b/tests/resources/generator/ode_const_var_on_rhs/model.h @@ -25,7 +25,10 @@ extern const VariableInfo COMPUTED_CONSTANT_INFO[]; extern const VariableInfo ALGEBRAIC_INFO[]; double * createStatesArray(); -double * createVariablesArray(); +double * createConstantsArray(); +double * createComputedConstantsArray(); +double * createAlgebraicArray(); + void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *constants); diff --git a/tests/resources/generator/ode_const_var_on_rhs/model.py b/tests/resources/generator/ode_const_var_on_rhs/model.py index 0bf4f4f64f..bb910e5e47 100644 --- a/tests/resources/generator/ode_const_var_on_rhs/model.py +++ b/tests/resources/generator/ode_const_var_on_rhs/model.py @@ -32,8 +32,16 @@ def create_states_array(): return [nan]*STATE_COUNT -def create_variables_array(): - return [nan]*VARIABLE_COUNT +def create_constants_array(): + return [nan]*CONSTANT_COUNT + + +def create_computed_constants_array(): + return [nan]*COMPUTED_CONSTANT_COUNT + + +def create_algebraic_array(): + return [nan]*ALGEBRAIC_COUNT def initialise_variables(states, rates, constants): diff --git a/tests/resources/generator/ode_const_var_on_rhs_one_component/model.c b/tests/resources/generator/ode_const_var_on_rhs_one_component/model.c index 043bda45b7..e5fe086ff9 100644 --- a/tests/resources/generator/ode_const_var_on_rhs_one_component/model.c +++ b/tests/resources/generator/ode_const_var_on_rhs_one_component/model.c @@ -40,11 +40,33 @@ double * createStatesArray() return res; } -double * createVariablesArray() +double * createConstantsArray() { - double *res = (double *) malloc(VARIABLE_COUNT*sizeof(double)); + double *res = (double *) malloc(CONSTANT_COUNT*sizeof(double)); - for (size_t i = 0; i < VARIABLE_COUNT; ++i) { + for (size_t i = 0; i < CONSTANT_COUNT; ++i) { + res[i] = NAN; + } + + return res; +} + +double * createComputedConstantsArray() +{ + double *res = (double *) malloc(COMPUTED_CONSTANT_COUNT*sizeof(double)); + + for (size_t i = 0; i < COMPUTED_CONSTANT_COUNT; ++i) { + res[i] = NAN; + } + + return res; +} + +double * createAlgebraicArray() +{ + double *res = (double *) malloc(ALGEBRAIC_COUNT*sizeof(double)); + + for (size_t i = 0; i < ALGEBRAIC_COUNT; ++i) { res[i] = NAN; } diff --git a/tests/resources/generator/ode_const_var_on_rhs_one_component/model.h b/tests/resources/generator/ode_const_var_on_rhs_one_component/model.h index 1c36d8d5fc..83c0783867 100644 --- a/tests/resources/generator/ode_const_var_on_rhs_one_component/model.h +++ b/tests/resources/generator/ode_const_var_on_rhs_one_component/model.h @@ -25,7 +25,10 @@ extern const VariableInfo COMPUTED_CONSTANT_INFO[]; extern const VariableInfo ALGEBRAIC_INFO[]; double * createStatesArray(); -double * createVariablesArray(); +double * createConstantsArray(); +double * createComputedConstantsArray(); +double * createAlgebraicArray(); + void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *constants); diff --git a/tests/resources/generator/ode_const_var_on_rhs_one_component/model.py b/tests/resources/generator/ode_const_var_on_rhs_one_component/model.py index ea5912c7da..6c83ec466c 100644 --- a/tests/resources/generator/ode_const_var_on_rhs_one_component/model.py +++ b/tests/resources/generator/ode_const_var_on_rhs_one_component/model.py @@ -32,8 +32,16 @@ def create_states_array(): return [nan]*STATE_COUNT -def create_variables_array(): - return [nan]*VARIABLE_COUNT +def create_constants_array(): + return [nan]*CONSTANT_COUNT + + +def create_computed_constants_array(): + return [nan]*COMPUTED_CONSTANT_COUNT + + +def create_algebraic_array(): + return [nan]*ALGEBRAIC_COUNT def initialise_variables(states, rates, constants): diff --git a/tests/resources/generator/ode_constant_on_rhs/model.c b/tests/resources/generator/ode_constant_on_rhs/model.c index 67645bc1c0..ef1c80b1de 100644 --- a/tests/resources/generator/ode_constant_on_rhs/model.c +++ b/tests/resources/generator/ode_constant_on_rhs/model.c @@ -39,11 +39,33 @@ double * createStatesArray() return res; } -double * createVariablesArray() +double * createConstantsArray() { - double *res = (double *) malloc(VARIABLE_COUNT*sizeof(double)); + double *res = (double *) malloc(CONSTANT_COUNT*sizeof(double)); - for (size_t i = 0; i < VARIABLE_COUNT; ++i) { + for (size_t i = 0; i < CONSTANT_COUNT; ++i) { + res[i] = NAN; + } + + return res; +} + +double * createComputedConstantsArray() +{ + double *res = (double *) malloc(COMPUTED_CONSTANT_COUNT*sizeof(double)); + + for (size_t i = 0; i < COMPUTED_CONSTANT_COUNT; ++i) { + res[i] = NAN; + } + + return res; +} + +double * createAlgebraicArray() +{ + double *res = (double *) malloc(ALGEBRAIC_COUNT*sizeof(double)); + + for (size_t i = 0; i < ALGEBRAIC_COUNT; ++i) { res[i] = NAN; } diff --git a/tests/resources/generator/ode_constant_on_rhs/model.h b/tests/resources/generator/ode_constant_on_rhs/model.h index 8d446982d8..319a116d0f 100644 --- a/tests/resources/generator/ode_constant_on_rhs/model.h +++ b/tests/resources/generator/ode_constant_on_rhs/model.h @@ -25,7 +25,10 @@ extern const VariableInfo COMPUTED_CONSTANT_INFO[]; extern const VariableInfo ALGEBRAIC_INFO[]; double * createStatesArray(); -double * createVariablesArray(); +double * createConstantsArray(); +double * createComputedConstantsArray(); +double * createAlgebraicArray(); + void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *constants); diff --git a/tests/resources/generator/ode_constant_on_rhs/model.py b/tests/resources/generator/ode_constant_on_rhs/model.py index 9147b5ae65..34d1e7d853 100644 --- a/tests/resources/generator/ode_constant_on_rhs/model.py +++ b/tests/resources/generator/ode_constant_on_rhs/model.py @@ -31,8 +31,16 @@ def create_states_array(): return [nan]*STATE_COUNT -def create_variables_array(): - return [nan]*VARIABLE_COUNT +def create_constants_array(): + return [nan]*CONSTANT_COUNT + + +def create_computed_constants_array(): + return [nan]*COMPUTED_CONSTANT_COUNT + + +def create_algebraic_array(): + return [nan]*ALGEBRAIC_COUNT def initialise_variables(states, rates, constants): diff --git a/tests/resources/generator/ode_constant_on_rhs_one_component/model.c b/tests/resources/generator/ode_constant_on_rhs_one_component/model.c index 0745345648..796d807b38 100644 --- a/tests/resources/generator/ode_constant_on_rhs_one_component/model.c +++ b/tests/resources/generator/ode_constant_on_rhs_one_component/model.c @@ -39,11 +39,33 @@ double * createStatesArray() return res; } -double * createVariablesArray() +double * createConstantsArray() { - double *res = (double *) malloc(VARIABLE_COUNT*sizeof(double)); + double *res = (double *) malloc(CONSTANT_COUNT*sizeof(double)); - for (size_t i = 0; i < VARIABLE_COUNT; ++i) { + for (size_t i = 0; i < CONSTANT_COUNT; ++i) { + res[i] = NAN; + } + + return res; +} + +double * createComputedConstantsArray() +{ + double *res = (double *) malloc(COMPUTED_CONSTANT_COUNT*sizeof(double)); + + for (size_t i = 0; i < COMPUTED_CONSTANT_COUNT; ++i) { + res[i] = NAN; + } + + return res; +} + +double * createAlgebraicArray() +{ + double *res = (double *) malloc(ALGEBRAIC_COUNT*sizeof(double)); + + for (size_t i = 0; i < ALGEBRAIC_COUNT; ++i) { res[i] = NAN; } diff --git a/tests/resources/generator/ode_constant_on_rhs_one_component/model.h b/tests/resources/generator/ode_constant_on_rhs_one_component/model.h index 1c36d8d5fc..83c0783867 100644 --- a/tests/resources/generator/ode_constant_on_rhs_one_component/model.h +++ b/tests/resources/generator/ode_constant_on_rhs_one_component/model.h @@ -25,7 +25,10 @@ extern const VariableInfo COMPUTED_CONSTANT_INFO[]; extern const VariableInfo ALGEBRAIC_INFO[]; double * createStatesArray(); -double * createVariablesArray(); +double * createConstantsArray(); +double * createComputedConstantsArray(); +double * createAlgebraicArray(); + void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *constants); diff --git a/tests/resources/generator/ode_constant_on_rhs_one_component/model.py b/tests/resources/generator/ode_constant_on_rhs_one_component/model.py index e159a2b5cb..bb143cbb1c 100644 --- a/tests/resources/generator/ode_constant_on_rhs_one_component/model.py +++ b/tests/resources/generator/ode_constant_on_rhs_one_component/model.py @@ -31,8 +31,16 @@ def create_states_array(): return [nan]*STATE_COUNT -def create_variables_array(): - return [nan]*VARIABLE_COUNT +def create_constants_array(): + return [nan]*CONSTANT_COUNT + + +def create_computed_constants_array(): + return [nan]*COMPUTED_CONSTANT_COUNT + + +def create_algebraic_array(): + return [nan]*ALGEBRAIC_COUNT def initialise_variables(states, rates, constants): diff --git a/tests/resources/generator/ode_multiple_dependent_odes/model.c b/tests/resources/generator/ode_multiple_dependent_odes/model.c index 861ca5c1ab..f1165a8a12 100644 --- a/tests/resources/generator/ode_multiple_dependent_odes/model.c +++ b/tests/resources/generator/ode_multiple_dependent_odes/model.c @@ -41,11 +41,33 @@ double * createStatesArray() return res; } -double * createVariablesArray() +double * createConstantsArray() { - double *res = (double *) malloc(VARIABLE_COUNT*sizeof(double)); + double *res = (double *) malloc(CONSTANT_COUNT*sizeof(double)); - for (size_t i = 0; i < VARIABLE_COUNT; ++i) { + for (size_t i = 0; i < CONSTANT_COUNT; ++i) { + res[i] = NAN; + } + + return res; +} + +double * createComputedConstantsArray() +{ + double *res = (double *) malloc(COMPUTED_CONSTANT_COUNT*sizeof(double)); + + for (size_t i = 0; i < COMPUTED_CONSTANT_COUNT; ++i) { + res[i] = NAN; + } + + return res; +} + +double * createAlgebraicArray() +{ + double *res = (double *) malloc(ALGEBRAIC_COUNT*sizeof(double)); + + for (size_t i = 0; i < ALGEBRAIC_COUNT; ++i) { res[i] = NAN; } diff --git a/tests/resources/generator/ode_multiple_dependent_odes/model.h b/tests/resources/generator/ode_multiple_dependent_odes/model.h index 6b58848d0c..f46f3ac1be 100644 --- a/tests/resources/generator/ode_multiple_dependent_odes/model.h +++ b/tests/resources/generator/ode_multiple_dependent_odes/model.h @@ -25,7 +25,10 @@ extern const VariableInfo COMPUTED_CONSTANT_INFO[]; extern const VariableInfo ALGEBRAIC_INFO[]; double * createStatesArray(); -double * createVariablesArray(); +double * createConstantsArray(); +double * createComputedConstantsArray(); +double * createAlgebraicArray(); + void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *constants); diff --git a/tests/resources/generator/ode_multiple_dependent_odes/model.py b/tests/resources/generator/ode_multiple_dependent_odes/model.py index 5daabe1bca..b442e1d9fb 100644 --- a/tests/resources/generator/ode_multiple_dependent_odes/model.py +++ b/tests/resources/generator/ode_multiple_dependent_odes/model.py @@ -33,8 +33,16 @@ def create_states_array(): return [nan]*STATE_COUNT -def create_variables_array(): - return [nan]*VARIABLE_COUNT +def create_constants_array(): + return [nan]*CONSTANT_COUNT + + +def create_computed_constants_array(): + return [nan]*COMPUTED_CONSTANT_COUNT + + +def create_algebraic_array(): + return [nan]*ALGEBRAIC_COUNT def initialise_variables(states, rates, constants): diff --git a/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.c b/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.c index f4347cdb63..7cfa8679f2 100644 --- a/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.c +++ b/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.c @@ -41,11 +41,33 @@ double * createStatesArray() return res; } -double * createVariablesArray() +double * createConstantsArray() { - double *res = (double *) malloc(VARIABLE_COUNT*sizeof(double)); + double *res = (double *) malloc(CONSTANT_COUNT*sizeof(double)); - for (size_t i = 0; i < VARIABLE_COUNT; ++i) { + for (size_t i = 0; i < CONSTANT_COUNT; ++i) { + res[i] = NAN; + } + + return res; +} + +double * createComputedConstantsArray() +{ + double *res = (double *) malloc(COMPUTED_CONSTANT_COUNT*sizeof(double)); + + for (size_t i = 0; i < COMPUTED_CONSTANT_COUNT; ++i) { + res[i] = NAN; + } + + return res; +} + +double * createAlgebraicArray() +{ + double *res = (double *) malloc(ALGEBRAIC_COUNT*sizeof(double)); + + for (size_t i = 0; i < ALGEBRAIC_COUNT; ++i) { res[i] = NAN; } diff --git a/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.h b/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.h index e4d23b9b6d..96b38288f0 100644 --- a/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.h +++ b/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.h @@ -25,7 +25,10 @@ extern const VariableInfo COMPUTED_CONSTANT_INFO[]; extern const VariableInfo ALGEBRAIC_INFO[]; double * createStatesArray(); -double * createVariablesArray(); +double * createConstantsArray(); +double * createComputedConstantsArray(); +double * createAlgebraicArray(); + void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *constants); diff --git a/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.py b/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.py index 073d05fac3..8dccc27dd4 100644 --- a/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.py +++ b/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.py @@ -33,8 +33,16 @@ def create_states_array(): return [nan]*STATE_COUNT -def create_variables_array(): - return [nan]*VARIABLE_COUNT +def create_constants_array(): + return [nan]*CONSTANT_COUNT + + +def create_computed_constants_array(): + return [nan]*COMPUTED_CONSTANT_COUNT + + +def create_algebraic_array(): + return [nan]*ALGEBRAIC_COUNT def initialise_variables(states, rates, constants): diff --git a/tests/resources/generator/ode_multiple_odes_with_same_name/model.c b/tests/resources/generator/ode_multiple_odes_with_same_name/model.c index 140486722f..17f5507aea 100644 --- a/tests/resources/generator/ode_multiple_odes_with_same_name/model.c +++ b/tests/resources/generator/ode_multiple_odes_with_same_name/model.c @@ -41,11 +41,33 @@ double * createStatesArray() return res; } -double * createVariablesArray() +double * createConstantsArray() { - double *res = (double *) malloc(VARIABLE_COUNT*sizeof(double)); + double *res = (double *) malloc(CONSTANT_COUNT*sizeof(double)); - for (size_t i = 0; i < VARIABLE_COUNT; ++i) { + for (size_t i = 0; i < CONSTANT_COUNT; ++i) { + res[i] = NAN; + } + + return res; +} + +double * createComputedConstantsArray() +{ + double *res = (double *) malloc(COMPUTED_CONSTANT_COUNT*sizeof(double)); + + for (size_t i = 0; i < COMPUTED_CONSTANT_COUNT; ++i) { + res[i] = NAN; + } + + return res; +} + +double * createAlgebraicArray() +{ + double *res = (double *) malloc(ALGEBRAIC_COUNT*sizeof(double)); + + for (size_t i = 0; i < ALGEBRAIC_COUNT; ++i) { res[i] = NAN; } diff --git a/tests/resources/generator/ode_multiple_odes_with_same_name/model.h b/tests/resources/generator/ode_multiple_odes_with_same_name/model.h index 5c800ad653..0f14d5268c 100644 --- a/tests/resources/generator/ode_multiple_odes_with_same_name/model.h +++ b/tests/resources/generator/ode_multiple_odes_with_same_name/model.h @@ -25,7 +25,10 @@ extern const VariableInfo COMPUTED_CONSTANT_INFO[]; extern const VariableInfo ALGEBRAIC_INFO[]; double * createStatesArray(); -double * createVariablesArray(); +double * createConstantsArray(); +double * createComputedConstantsArray(); +double * createAlgebraicArray(); + void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *constants); diff --git a/tests/resources/generator/ode_multiple_odes_with_same_name/model.py b/tests/resources/generator/ode_multiple_odes_with_same_name/model.py index ebce3e2e6c..7d64e5d32e 100644 --- a/tests/resources/generator/ode_multiple_odes_with_same_name/model.py +++ b/tests/resources/generator/ode_multiple_odes_with_same_name/model.py @@ -33,8 +33,16 @@ def create_states_array(): return [nan]*STATE_COUNT -def create_variables_array(): - return [nan]*VARIABLE_COUNT +def create_constants_array(): + return [nan]*CONSTANT_COUNT + + +def create_computed_constants_array(): + return [nan]*COMPUTED_CONSTANT_COUNT + + +def create_algebraic_array(): + return [nan]*ALGEBRAIC_COUNT def initialise_variables(states, rates, constants): diff --git a/tests/resources/generator/ode_unknown_var_on_rhs/model.c b/tests/resources/generator/ode_unknown_var_on_rhs/model.c index a27eb2cf0b..69a88e2436 100644 --- a/tests/resources/generator/ode_unknown_var_on_rhs/model.c +++ b/tests/resources/generator/ode_unknown_var_on_rhs/model.c @@ -40,11 +40,33 @@ double * createStatesArray() return res; } -double * createVariablesArray() +double * createConstantsArray() { - double *res = (double *) malloc(VARIABLE_COUNT*sizeof(double)); + double *res = (double *) malloc(CONSTANT_COUNT*sizeof(double)); - for (size_t i = 0; i < VARIABLE_COUNT; ++i) { + for (size_t i = 0; i < CONSTANT_COUNT; ++i) { + res[i] = NAN; + } + + return res; +} + +double * createComputedConstantsArray() +{ + double *res = (double *) malloc(COMPUTED_CONSTANT_COUNT*sizeof(double)); + + for (size_t i = 0; i < COMPUTED_CONSTANT_COUNT; ++i) { + res[i] = NAN; + } + + return res; +} + +double * createAlgebraicArray() +{ + double *res = (double *) malloc(ALGEBRAIC_COUNT*sizeof(double)); + + for (size_t i = 0; i < ALGEBRAIC_COUNT; ++i) { res[i] = NAN; } diff --git a/tests/resources/generator/ode_unknown_var_on_rhs/model.h b/tests/resources/generator/ode_unknown_var_on_rhs/model.h index 8d446982d8..319a116d0f 100644 --- a/tests/resources/generator/ode_unknown_var_on_rhs/model.h +++ b/tests/resources/generator/ode_unknown_var_on_rhs/model.h @@ -25,7 +25,10 @@ extern const VariableInfo COMPUTED_CONSTANT_INFO[]; extern const VariableInfo ALGEBRAIC_INFO[]; double * createStatesArray(); -double * createVariablesArray(); +double * createConstantsArray(); +double * createComputedConstantsArray(); +double * createAlgebraicArray(); + void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *constants); diff --git a/tests/resources/generator/ode_unknown_var_on_rhs/model.py b/tests/resources/generator/ode_unknown_var_on_rhs/model.py index 9e678173dd..0e06f10510 100644 --- a/tests/resources/generator/ode_unknown_var_on_rhs/model.py +++ b/tests/resources/generator/ode_unknown_var_on_rhs/model.py @@ -32,8 +32,16 @@ def create_states_array(): return [nan]*STATE_COUNT -def create_variables_array(): - return [nan]*VARIABLE_COUNT +def create_constants_array(): + return [nan]*CONSTANT_COUNT + + +def create_computed_constants_array(): + return [nan]*COMPUTED_CONSTANT_COUNT + + +def create_algebraic_array(): + return [nan]*ALGEBRAIC_COUNT def initialise_variables(states, rates, constants): diff --git a/tests/resources/generator/robertson_model_1966/model.dae.c b/tests/resources/generator/robertson_model_1966/model.dae.c index 1c4dbb976a..a25eebb914 100644 --- a/tests/resources/generator/robertson_model_1966/model.dae.c +++ b/tests/resources/generator/robertson_model_1966/model.dae.c @@ -45,11 +45,33 @@ double * createStatesArray() return res; } -double * createVariablesArray() +double * createConstantsArray() { - double *res = (double *) malloc(VARIABLE_COUNT*sizeof(double)); + double *res = (double *) malloc(CONSTANT_COUNT*sizeof(double)); - for (size_t i = 0; i < VARIABLE_COUNT; ++i) { + for (size_t i = 0; i < CONSTANT_COUNT; ++i) { + res[i] = NAN; + } + + return res; +} + +double * createComputedConstantsArray() +{ + double *res = (double *) malloc(COMPUTED_CONSTANT_COUNT*sizeof(double)); + + for (size_t i = 0; i < COMPUTED_CONSTANT_COUNT; ++i) { + res[i] = NAN; + } + + return res; +} + +double * createAlgebraicArray() +{ + double *res = (double *) malloc(ALGEBRAIC_COUNT*sizeof(double)); + + for (size_t i = 0; i < ALGEBRAIC_COUNT; ++i) { res[i] = NAN; } diff --git a/tests/resources/generator/robertson_model_1966/model.dae.h b/tests/resources/generator/robertson_model_1966/model.dae.h index 03322f766b..bffe009c7c 100644 --- a/tests/resources/generator/robertson_model_1966/model.dae.h +++ b/tests/resources/generator/robertson_model_1966/model.dae.h @@ -25,7 +25,10 @@ extern const VariableInfo COMPUTED_CONSTANT_INFO[]; extern const VariableInfo ALGEBRAIC_INFO[]; double * createStatesArray(); -double * createVariablesArray(); +double * createConstantsArray(); +double * createComputedConstantsArray(); +double * createAlgebraicArray(); + void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *constants); diff --git a/tests/resources/generator/robertson_model_1966/model.dae.py b/tests/resources/generator/robertson_model_1966/model.dae.py index 83ae000499..bab387d15a 100644 --- a/tests/resources/generator/robertson_model_1966/model.dae.py +++ b/tests/resources/generator/robertson_model_1966/model.dae.py @@ -37,8 +37,16 @@ def create_states_array(): return [nan]*STATE_COUNT -def create_variables_array(): - return [nan]*VARIABLE_COUNT +def create_constants_array(): + return [nan]*CONSTANT_COUNT + + +def create_computed_constants_array(): + return [nan]*COMPUTED_CONSTANT_COUNT + + +def create_algebraic_array(): + return [nan]*ALGEBRAIC_COUNT from nlasolver import nla_solve diff --git a/tests/resources/generator/robertson_model_1966/model.ode.c b/tests/resources/generator/robertson_model_1966/model.ode.c index ead2f08800..403affc055 100644 --- a/tests/resources/generator/robertson_model_1966/model.ode.c +++ b/tests/resources/generator/robertson_model_1966/model.ode.c @@ -45,11 +45,33 @@ double * createStatesArray() return res; } -double * createVariablesArray() +double * createConstantsArray() { - double *res = (double *) malloc(VARIABLE_COUNT*sizeof(double)); + double *res = (double *) malloc(CONSTANT_COUNT*sizeof(double)); - for (size_t i = 0; i < VARIABLE_COUNT; ++i) { + for (size_t i = 0; i < CONSTANT_COUNT; ++i) { + res[i] = NAN; + } + + return res; +} + +double * createComputedConstantsArray() +{ + double *res = (double *) malloc(COMPUTED_CONSTANT_COUNT*sizeof(double)); + + for (size_t i = 0; i < COMPUTED_CONSTANT_COUNT; ++i) { + res[i] = NAN; + } + + return res; +} + +double * createAlgebraicArray() +{ + double *res = (double *) malloc(ALGEBRAIC_COUNT*sizeof(double)); + + for (size_t i = 0; i < ALGEBRAIC_COUNT; ++i) { res[i] = NAN; } diff --git a/tests/resources/generator/robertson_model_1966/model.ode.h b/tests/resources/generator/robertson_model_1966/model.ode.h index 03322f766b..bffe009c7c 100644 --- a/tests/resources/generator/robertson_model_1966/model.ode.h +++ b/tests/resources/generator/robertson_model_1966/model.ode.h @@ -25,7 +25,10 @@ extern const VariableInfo COMPUTED_CONSTANT_INFO[]; extern const VariableInfo ALGEBRAIC_INFO[]; double * createStatesArray(); -double * createVariablesArray(); +double * createConstantsArray(); +double * createComputedConstantsArray(); +double * createAlgebraicArray(); + void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *constants); diff --git a/tests/resources/generator/robertson_model_1966/model.ode.py b/tests/resources/generator/robertson_model_1966/model.ode.py index 6fd0e88e15..1faef1ab5a 100644 --- a/tests/resources/generator/robertson_model_1966/model.ode.py +++ b/tests/resources/generator/robertson_model_1966/model.ode.py @@ -37,8 +37,16 @@ def create_states_array(): return [nan]*STATE_COUNT -def create_variables_array(): - return [nan]*VARIABLE_COUNT +def create_constants_array(): + return [nan]*CONSTANT_COUNT + + +def create_computed_constants_array(): + return [nan]*COMPUTED_CONSTANT_COUNT + + +def create_algebraic_array(): + return [nan]*ALGEBRAIC_COUNT def initialise_variables(states, rates, constants): diff --git a/tests/resources/generator/sine_model_imports/model.c b/tests/resources/generator/sine_model_imports/model.c index d03b04f92f..d13cfac716 100644 --- a/tests/resources/generator/sine_model_imports/model.c +++ b/tests/resources/generator/sine_model_imports/model.c @@ -49,11 +49,33 @@ double * createStatesArray() return res; } -double * createVariablesArray() +double * createConstantsArray() { - double *res = (double *) malloc(VARIABLE_COUNT*sizeof(double)); + double *res = (double *) malloc(CONSTANT_COUNT*sizeof(double)); - for (size_t i = 0; i < VARIABLE_COUNT; ++i) { + for (size_t i = 0; i < CONSTANT_COUNT; ++i) { + res[i] = NAN; + } + + return res; +} + +double * createComputedConstantsArray() +{ + double *res = (double *) malloc(COMPUTED_CONSTANT_COUNT*sizeof(double)); + + for (size_t i = 0; i < COMPUTED_CONSTANT_COUNT; ++i) { + res[i] = NAN; + } + + return res; +} + +double * createAlgebraicArray() +{ + double *res = (double *) malloc(ALGEBRAIC_COUNT*sizeof(double)); + + for (size_t i = 0; i < ALGEBRAIC_COUNT; ++i) { res[i] = NAN; } diff --git a/tests/resources/generator/sine_model_imports/model.h b/tests/resources/generator/sine_model_imports/model.h index 67daeb3450..d6150b9fc7 100644 --- a/tests/resources/generator/sine_model_imports/model.h +++ b/tests/resources/generator/sine_model_imports/model.h @@ -25,7 +25,10 @@ extern const VariableInfo COMPUTED_CONSTANT_INFO[]; extern const VariableInfo ALGEBRAIC_INFO[]; double * createStatesArray(); -double * createVariablesArray(); +double * createConstantsArray(); +double * createComputedConstantsArray(); +double * createAlgebraicArray(); + void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *constants); diff --git a/tests/resources/generator/sine_model_imports/model.py b/tests/resources/generator/sine_model_imports/model.py index 73c276d42b..98456bf5fc 100644 --- a/tests/resources/generator/sine_model_imports/model.py +++ b/tests/resources/generator/sine_model_imports/model.py @@ -45,8 +45,16 @@ def create_states_array(): return [nan]*STATE_COUNT -def create_variables_array(): - return [nan]*VARIABLE_COUNT +def create_constants_array(): + return [nan]*CONSTANT_COUNT + + +def create_computed_constants_array(): + return [nan]*COMPUTED_CONSTANT_COUNT + + +def create_algebraic_array(): + return [nan]*ALGEBRAIC_COUNT def initialise_variables(states, rates, constants): diff --git a/tests/resources/generator/unknown_variable_as_external_variable/model.c b/tests/resources/generator/unknown_variable_as_external_variable/model.c index 7ca1689b4b..a99d9f1467 100644 --- a/tests/resources/generator/unknown_variable_as_external_variable/model.c +++ b/tests/resources/generator/unknown_variable_as_external_variable/model.c @@ -35,11 +35,44 @@ const VariableInfo EXTERNAL_INFO[] = { {"P_3", "per_fmol_sec3", "SLC_template3_ss"} }; -double * createVariablesArray() +double * createConstantsArray() { - double *res = (double *) malloc(VARIABLE_COUNT*sizeof(double)); + double *res = (double *) malloc(CONSTANT_COUNT*sizeof(double)); - for (size_t i = 0; i < VARIABLE_COUNT; ++i) { + for (size_t i = 0; i < CONSTANT_COUNT; ++i) { + res[i] = NAN; + } + + return res; +} + +double * createComputedConstantsArray() +{ + double *res = (double *) malloc(COMPUTED_CONSTANT_COUNT*sizeof(double)); + + for (size_t i = 0; i < COMPUTED_CONSTANT_COUNT; ++i) { + res[i] = NAN; + } + + return res; +} + +double * createAlgebraicArray() +{ + double *res = (double *) malloc(ALGEBRAIC_COUNT*sizeof(double)); + + for (size_t i = 0; i < ALGEBRAIC_COUNT; ++i) { + res[i] = NAN; + } + + return res; +} + +double * createExternalsArray() +{ + double *res = (double *) malloc(EXTERNAL_COUNT*sizeof(double)); + + for (size_t i = 0; i < EXTERNAL_COUNT; ++i) { res[i] = NAN; } diff --git a/tests/resources/generator/unknown_variable_as_external_variable/model.h b/tests/resources/generator/unknown_variable_as_external_variable/model.h index 5cbdcf0fb9..7ddf985528 100644 --- a/tests/resources/generator/unknown_variable_as_external_variable/model.h +++ b/tests/resources/generator/unknown_variable_as_external_variable/model.h @@ -23,7 +23,11 @@ extern const VariableInfo COMPUTED_CONSTANT_INFO[]; extern const VariableInfo ALGEBRAIC_INFO[]; extern const VariableInfo EXTERNAL_INFO[]; -double * createVariablesArray(); +double * createConstantsArray(); +double * createComputedConstantsArray(); +double * createAlgebraicArray(); +double * createExternalsArray(); + void deleteArray(double *array); typedef double (* ExternalVariable)(double *variables, size_t index); diff --git a/tests/resources/generator/unknown_variable_as_external_variable/model.py b/tests/resources/generator/unknown_variable_as_external_variable/model.py index 6b40d05ecf..06195b207b 100644 --- a/tests/resources/generator/unknown_variable_as_external_variable/model.py +++ b/tests/resources/generator/unknown_variable_as_external_variable/model.py @@ -35,8 +35,20 @@ ] -def create_variables_array(): - return [nan]*VARIABLE_COUNT +def create_constants_array(): + return [nan]*CONSTANT_COUNT + + +def create_computed_constants_array(): + return [nan]*COMPUTED_CONSTANT_COUNT + + +def create_algebraic_array(): + return [nan]*ALGEBRAIC_COUNT + + +def create_externals_array(): + return [nan]*EXTERNAL_COUNT def initialise_variables(constants, external_variable): diff --git a/tests/resources/generator/variable_initialised_using_a_constant/model.c b/tests/resources/generator/variable_initialised_using_a_constant/model.c index f07d911126..0c99f7c241 100644 --- a/tests/resources/generator/variable_initialised_using_a_constant/model.c +++ b/tests/resources/generator/variable_initialised_using_a_constant/model.c @@ -40,11 +40,33 @@ double * createStatesArray() return res; } -double * createVariablesArray() +double * createConstantsArray() { - double *res = (double *) malloc(VARIABLE_COUNT*sizeof(double)); + double *res = (double *) malloc(CONSTANT_COUNT*sizeof(double)); - for (size_t i = 0; i < VARIABLE_COUNT; ++i) { + for (size_t i = 0; i < CONSTANT_COUNT; ++i) { + res[i] = NAN; + } + + return res; +} + +double * createComputedConstantsArray() +{ + double *res = (double *) malloc(COMPUTED_CONSTANT_COUNT*sizeof(double)); + + for (size_t i = 0; i < COMPUTED_CONSTANT_COUNT; ++i) { + res[i] = NAN; + } + + return res; +} + +double * createAlgebraicArray() +{ + double *res = (double *) malloc(ALGEBRAIC_COUNT*sizeof(double)); + + for (size_t i = 0; i < ALGEBRAIC_COUNT; ++i) { res[i] = NAN; } diff --git a/tests/resources/generator/variable_initialised_using_a_constant/model.h b/tests/resources/generator/variable_initialised_using_a_constant/model.h index 401821925f..18bcd588e1 100644 --- a/tests/resources/generator/variable_initialised_using_a_constant/model.h +++ b/tests/resources/generator/variable_initialised_using_a_constant/model.h @@ -25,7 +25,10 @@ extern const VariableInfo COMPUTED_CONSTANT_INFO[]; extern const VariableInfo ALGEBRAIC_INFO[]; double * createStatesArray(); -double * createVariablesArray(); +double * createConstantsArray(); +double * createComputedConstantsArray(); +double * createAlgebraicArray(); + void deleteArray(double *array); void initialiseVariables(double *states, double *rates, double *constants); diff --git a/tests/resources/generator/variable_initialised_using_a_constant/model.py b/tests/resources/generator/variable_initialised_using_a_constant/model.py index c532e1007b..e1fdff4331 100644 --- a/tests/resources/generator/variable_initialised_using_a_constant/model.py +++ b/tests/resources/generator/variable_initialised_using_a_constant/model.py @@ -32,8 +32,16 @@ def create_states_array(): return [nan]*STATE_COUNT -def create_variables_array(): - return [nan]*VARIABLE_COUNT +def create_constants_array(): + return [nan]*CONSTANT_COUNT + + +def create_computed_constants_array(): + return [nan]*COMPUTED_CONSTANT_COUNT + + +def create_algebraic_array(): + return [nan]*ALGEBRAIC_COUNT def initialise_variables(states, rates, constants): From 46e4e939cb64afb77fc908b1d66e0ecd48412e49 Mon Sep 17 00:00:00 2001 From: Alan Garny Date: Thu, 15 Aug 2024 11:22:58 +0200 Subject: [PATCH 23/85] Generator: updated the signature of our initialiseVariables() method. --- src/generatorprofile.cpp | 24 +++++++++---------- src/generatorprofilesha1values.h | 4 ++-- .../bindings/python/test_generator_profile.py | 16 ++++++------- tests/generator/generatorprofile.cpp | 16 ++++++------- tests/resources/coverage/generator/model.c | 2 +- tests/resources/coverage/generator/model.h | 2 +- .../generator/model.implementation.out | 2 +- .../coverage/generator/model.interface.out | 2 +- .../generator/model.modified.profile.c | 2 +- .../generator/model.modified.profile.h | 2 +- .../generator/model.modified.profile.py | 2 +- tests/resources/coverage/generator/model.out | 2 +- tests/resources/coverage/generator/model.py | 2 +- .../algebraic_eqn_computed_var_on_rhs/model.c | 2 +- .../model.external.c | 2 +- .../model.external.h | 2 +- .../model.external.py | 2 +- .../algebraic_eqn_computed_var_on_rhs/model.h | 2 +- .../model.py | 2 +- .../algebraic_eqn_const_var_on_rhs/model.c | 2 +- .../algebraic_eqn_const_var_on_rhs/model.h | 2 +- .../algebraic_eqn_const_var_on_rhs/model.py | 2 +- .../algebraic_eqn_constant_on_rhs/model.c | 2 +- .../algebraic_eqn_constant_on_rhs/model.h | 2 +- .../algebraic_eqn_constant_on_rhs/model.py | 2 +- .../algebraic_eqn_derivative_on_rhs/model.c | 2 +- .../algebraic_eqn_derivative_on_rhs/model.h | 2 +- .../algebraic_eqn_derivative_on_rhs/model.py | 2 +- .../model.c | 2 +- .../model.h | 2 +- .../model.py | 2 +- .../algebraic_eqn_state_var_on_rhs/model.c | 2 +- .../algebraic_eqn_state_var_on_rhs/model.h | 2 +- .../algebraic_eqn_state_var_on_rhs/model.py | 2 +- .../model.c | 2 +- .../model.h | 2 +- .../model.py | 2 +- .../model.c | 2 +- .../model.external.c | 2 +- .../model.external.h | 2 +- .../model.external.py | 2 +- .../model.h | 2 +- .../model.py | 2 +- .../model.c | 2 +- .../model.h | 2 +- .../model.py | 2 +- .../model.three.externals.c | 2 +- .../model.three.externals.h | 2 +- .../model.three.externals.py | 2 +- .../model.not.ordered.c | 2 +- .../model.not.ordered.h | 2 +- .../model.not.ordered.py | 2 +- .../model.ordered.c | 2 +- .../model.ordered.h | 2 +- .../model.ordered.py | 2 +- .../algebraic_unknown_var_on_rhs/model.c | 2 +- .../algebraic_unknown_var_on_rhs/model.h | 2 +- .../algebraic_unknown_var_on_rhs/model.py | 2 +- .../generator/cell_geometry_model/model.c | 2 +- .../cell_geometry_model/model.external.c | 2 +- .../cell_geometry_model/model.external.h | 2 +- .../cell_geometry_model/model.external.py | 2 +- .../generator/cell_geometry_model/model.h | 2 +- .../generator/cell_geometry_model/model.py | 2 +- .../model.c | 2 +- .../model.h | 2 +- .../model.py | 2 +- .../generator/cellml_slc_example/model.py | 2 +- .../model.c | 2 +- .../model.h | 2 +- .../model.py | 2 +- .../cellml_unit_scaling_constant/model.c | 2 +- .../cellml_unit_scaling_constant/model.h | 2 +- .../cellml_unit_scaling_constant/model.py | 2 +- .../cellml_unit_scaling_rate/model.c | 2 +- .../cellml_unit_scaling_rate/model.h | 2 +- .../cellml_unit_scaling_rate/model.py | 2 +- .../cellml_unit_scaling_state/model.c | 2 +- .../cellml_unit_scaling_state/model.h | 2 +- .../cellml_unit_scaling_state/model.py | 2 +- .../model.c | 2 +- .../model.h | 2 +- .../model.py | 2 +- .../model.c | 2 +- .../model.h | 2 +- .../model.py | 2 +- .../cellml_unit_scaling_voi_direct/model.c | 2 +- .../cellml_unit_scaling_voi_direct/model.h | 2 +- .../cellml_unit_scaling_voi_direct/model.py | 2 +- .../cellml_unit_scaling_voi_indirect/model.c | 2 +- .../cellml_unit_scaling_voi_indirect/model.h | 2 +- .../cellml_unit_scaling_voi_indirect/model.py | 2 +- .../generator/dae_cellml_1_1_model/model.c | 2 +- .../generator/dae_cellml_1_1_model/model.h | 2 +- .../generator/dae_cellml_1_1_model/model.py | 2 +- .../generator/dependent_eqns/model.c | 2 +- .../generator/dependent_eqns/model.h | 2 +- .../generator/dependent_eqns/model.py | 2 +- .../model.c | 2 +- .../model.h | 2 +- .../model.py | 2 +- .../model.c | 2 +- .../model.h | 2 +- .../model.py | 2 +- .../model.algebraic.c | 2 +- .../model.algebraic.h | 2 +- .../model.algebraic.py | 2 +- .../model.c | 2 +- .../model.computed.constant.c | 2 +- .../model.computed.constant.h | 2 +- .../model.computed.constant.py | 2 +- .../model.constant.c | 2 +- .../model.constant.h | 2 +- .../model.constant.py | 2 +- .../model.dae.c | 2 +- .../model.dae.h | 2 +- .../model.dae.py | 2 +- .../model.dependent.algebraic.c | 2 +- .../model.dependent.algebraic.h | 2 +- .../model.dependent.algebraic.py | 2 +- .../model.dependent.computed.constant.c | 2 +- .../model.dependent.computed.constant.h | 2 +- .../model.dependent.computed.constant.py | 2 +- .../model.dependent.constant.c | 2 +- .../model.dependent.constant.h | 2 +- .../model.dependent.constant.py | 2 +- .../model.dependent.state.c | 2 +- .../model.dependent.state.h | 2 +- .../model.dependent.state.py | 2 +- .../model.external.c | 2 +- .../model.external.h | 2 +- .../model.external.py | 2 +- .../model.h | 2 +- .../model.py | 2 +- .../model.state.c | 2 +- .../model.state.h | 2 +- .../model.state.py | 2 +- .../generator/noble_model_1962/model.c | 2 +- .../generator/noble_model_1962/model.h | 2 +- .../generator/noble_model_1962/model.py | 2 +- .../generator/ode_computed_var_on_rhs/model.c | 2 +- .../generator/ode_computed_var_on_rhs/model.h | 2 +- .../ode_computed_var_on_rhs/model.py | 2 +- .../model.c | 2 +- .../model.h | 2 +- .../model.py | 2 +- .../generator/ode_const_var_on_rhs/model.c | 2 +- .../generator/ode_const_var_on_rhs/model.h | 2 +- .../generator/ode_const_var_on_rhs/model.py | 2 +- .../model.c | 2 +- .../model.h | 2 +- .../model.py | 2 +- .../generator/ode_constant_on_rhs/model.c | 2 +- .../generator/ode_constant_on_rhs/model.h | 2 +- .../generator/ode_constant_on_rhs/model.py | 2 +- .../ode_constant_on_rhs_one_component/model.c | 2 +- .../ode_constant_on_rhs_one_component/model.h | 2 +- .../model.py | 2 +- .../ode_multiple_dependent_odes/model.c | 2 +- .../ode_multiple_dependent_odes/model.h | 2 +- .../ode_multiple_dependent_odes/model.py | 2 +- .../model.c | 2 +- .../model.h | 2 +- .../model.py | 2 +- .../ode_multiple_odes_with_same_name/model.c | 2 +- .../ode_multiple_odes_with_same_name/model.h | 2 +- .../ode_multiple_odes_with_same_name/model.py | 2 +- .../generator/ode_unknown_var_on_rhs/model.c | 2 +- .../generator/ode_unknown_var_on_rhs/model.h | 2 +- .../generator/ode_unknown_var_on_rhs/model.py | 2 +- .../robertson_model_1966/model.dae.c | 2 +- .../robertson_model_1966/model.dae.h | 2 +- .../robertson_model_1966/model.dae.py | 2 +- .../robertson_model_1966/model.ode.c | 2 +- .../robertson_model_1966/model.ode.h | 2 +- .../robertson_model_1966/model.ode.py | 2 +- .../generator/sine_model_imports/model.c | 2 +- .../generator/sine_model_imports/model.h | 2 +- .../generator/sine_model_imports/model.py | 2 +- .../model.c | 2 +- .../model.h | 2 +- .../model.py | 2 +- .../model.c | 2 +- .../model.h | 2 +- .../model.py | 2 +- 185 files changed, 211 insertions(+), 211 deletions(-) diff --git a/src/generatorprofile.cpp b/src/generatorprofile.cpp index bf01698d5e..18d29dc32b 100644 --- a/src/generatorprofile.cpp +++ b/src/generatorprofile.cpp @@ -408,26 +408,26 @@ void GeneratorProfile::GeneratorProfileImpl::loadProfile(GeneratorProfile::Profi " free(array);\n" "}\n"; - mInterfaceInitialiseVariablesMethodFamWoevString = "void initialiseVariables(double *constants);\n"; - mImplementationInitialiseVariablesMethodFamWoevString = "void initialiseVariables(double *constants)\n" + mInterfaceInitialiseVariablesMethodFamWoevString = "void initialiseVariables(double *constants, double *algebraic);\n"; + mImplementationInitialiseVariablesMethodFamWoevString = "void initialiseVariables(double *constants, double *algebraic)\n" "{\n" "[CODE]" "}\n"; - mInterfaceInitialiseVariablesMethodFamWevString = "void initialiseVariables(double *constants, ExternalVariable externalVariable);\n"; - mImplementationInitialiseVariablesMethodFamWevString = "void initialiseVariables(double *constants, ExternalVariable externalVariable)\n" + mInterfaceInitialiseVariablesMethodFamWevString = "void initialiseVariables(double *constants, double *algebraic, ExternalVariable externalVariable);\n"; + mImplementationInitialiseVariablesMethodFamWevString = "void initialiseVariables(double *constants, double *algebraic, ExternalVariable externalVariable)\n" "{\n" "[CODE]" "}\n"; - mInterfaceInitialiseVariablesMethodFdmWoevString = "void initialiseVariables(double *states, double *rates, double *constants);\n"; - mImplementationInitialiseVariablesMethodFdmWoevString = "void initialiseVariables(double *states, double *rates, double *constants)\n" + mInterfaceInitialiseVariablesMethodFdmWoevString = "void initialiseVariables(double *states, double *rates, double *constants, double *algebraic);\n"; + mImplementationInitialiseVariablesMethodFdmWoevString = "void initialiseVariables(double *states, double *rates, double *constants, double *algebraic)\n" "{\n" "[CODE]" "}\n"; - mInterfaceInitialiseVariablesMethodFdmWevString = "void initialiseVariables(double voi, double *states, double *rates, double *constants, ExternalVariable externalVariable);\n"; - mImplementationInitialiseVariablesMethodFdmWevString = "void initialiseVariables(double voi, double *states, double *rates, double *constants, ExternalVariable externalVariable)\n" + mInterfaceInitialiseVariablesMethodFdmWevString = "void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic, ExternalVariable externalVariable);\n"; + mImplementationInitialiseVariablesMethodFdmWevString = "void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic, ExternalVariable externalVariable)\n" "{\n" "[CODE]" "}\n"; @@ -810,22 +810,22 @@ void GeneratorProfile::GeneratorProfileImpl::loadProfile(GeneratorProfile::Profi mInterfaceInitialiseVariablesMethodFamWoevString = ""; mImplementationInitialiseVariablesMethodFamWoevString = "\n" - "def initialise_variables(constants):\n" + "def initialise_variables(constants, algebraic):\n" "[CODE]"; mInterfaceInitialiseVariablesMethodFamWevString = ""; mImplementationInitialiseVariablesMethodFamWevString = "\n" - "def initialise_variables(constants, external_variable):\n" + "def initialise_variables(constants, algebraic, external_variable):\n" "[CODE]"; mInterfaceInitialiseVariablesMethodFdmWoevString = ""; mImplementationInitialiseVariablesMethodFdmWoevString = "\n" - "def initialise_variables(states, rates, constants):\n" + "def initialise_variables(states, rates, constants, algebraic):\n" "[CODE]"; mInterfaceInitialiseVariablesMethodFdmWevString = ""; mImplementationInitialiseVariablesMethodFdmWevString = "\n" - "def initialise_variables(voi, states, rates, constants, external_variable):\n" + "def initialise_variables(voi, states, rates, constants, algebraic, external_variable):\n" "[CODE]"; mInterfaceComputeComputedConstantsMethodString = ""; diff --git a/src/generatorprofilesha1values.h b/src/generatorprofilesha1values.h index 6c33678d7f..2b82901571 100644 --- a/src/generatorprofilesha1values.h +++ b/src/generatorprofilesha1values.h @@ -24,7 +24,7 @@ namespace libcellml { * The content of this file is generated, do not edit this file directly. * See docs/dev_utilities.rst for further information. */ -static const char C_GENERATOR_PROFILE_SHA1[] = "4b3052f697b7b57e1ffeb50a6a43d332e87fad35"; -static const char PYTHON_GENERATOR_PROFILE_SHA1[] = "17d32a31120c2c7ce57a85e08402419e1509e330"; +static const char C_GENERATOR_PROFILE_SHA1[] = "2d4d14df0a454d95e32e1172503d529834c42588"; +static const char PYTHON_GENERATOR_PROFILE_SHA1[] = "9f79e69847b6ec2faeb7f56f476ef2542a901b1f"; } // namespace libcellml diff --git a/tests/bindings/python/test_generator_profile.py b/tests/bindings/python/test_generator_profile.py index d4dfabfa50..7c97f547d1 100644 --- a/tests/bindings/python/test_generator_profile.py +++ b/tests/bindings/python/test_generator_profile.py @@ -838,22 +838,22 @@ def test_implementation_initialise_constants_method_string(self): g = GeneratorProfile() - self.assertEqual('void initialiseVariables(double *constants)\n{\n[CODE]}\n', + self.assertEqual('void initialiseVariables(double *constants, double *algebraic)\n{\n[CODE]}\n', g.implementationInitialiseVariablesMethodString(False, False)) g.setImplementationInitialiseVariablesMethodString(False, False, GeneratorProfileTestCase.VALUE) self.assertEqual(GeneratorProfileTestCase.VALUE, g.implementationInitialiseVariablesMethodString(False, False)) - self.assertEqual('void initialiseVariables(double *constants, ExternalVariable externalVariable)\n{\n[CODE]}\n', + self.assertEqual('void initialiseVariables(double *constants, double *algebraic, ExternalVariable externalVariable)\n{\n[CODE]}\n', g.implementationInitialiseVariablesMethodString(False, True)) g.setImplementationInitialiseVariablesMethodString(False, True, GeneratorProfileTestCase.VALUE) self.assertEqual(GeneratorProfileTestCase.VALUE, g.implementationInitialiseVariablesMethodString(False, True)) - self.assertEqual('void initialiseVariables(double *states, double *rates, double *constants)\n{\n[CODE]}\n', + self.assertEqual('void initialiseVariables(double *states, double *rates, double *constants, double *algebraic)\n{\n[CODE]}\n', g.implementationInitialiseVariablesMethodString(True, False)) g.setImplementationInitialiseVariablesMethodString(True, False, GeneratorProfileTestCase.VALUE) self.assertEqual(GeneratorProfileTestCase.VALUE, g.implementationInitialiseVariablesMethodString(True, False)) - self.assertEqual('void initialiseVariables(double voi, double *states, double *rates, double *constants, ExternalVariable externalVariable)\n{\n[CODE]}\n', + self.assertEqual('void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic, ExternalVariable externalVariable)\n{\n[CODE]}\n', g.implementationInitialiseVariablesMethodString(True, True)) g.setImplementationInitialiseVariablesMethodString(True, True, GeneratorProfileTestCase.VALUE) self.assertEqual(GeneratorProfileTestCase.VALUE, g.implementationInitialiseVariablesMethodString(True, True)) @@ -1127,22 +1127,22 @@ def test_interface_initialise_constants_method_string(self): g = GeneratorProfile() - self.assertEqual('void initialiseVariables(double *constants);\n', + self.assertEqual('void initialiseVariables(double *constants, double *algebraic);\n', g.interfaceInitialiseVariablesMethodString(False, False)) g.setInterfaceInitialiseVariablesMethodString(False, False, GeneratorProfileTestCase.VALUE) self.assertEqual(GeneratorProfileTestCase.VALUE, g.interfaceInitialiseVariablesMethodString(False, False)) - self.assertEqual('void initialiseVariables(double *constants, ExternalVariable externalVariable);\n', + self.assertEqual('void initialiseVariables(double *constants, double *algebraic, ExternalVariable externalVariable);\n', g.interfaceInitialiseVariablesMethodString(False, True)) g.setInterfaceInitialiseVariablesMethodString(False, True, GeneratorProfileTestCase.VALUE) self.assertEqual(GeneratorProfileTestCase.VALUE, g.interfaceInitialiseVariablesMethodString(False, True)) - self.assertEqual('void initialiseVariables(double *states, double *rates, double *constants);\n', + self.assertEqual('void initialiseVariables(double *states, double *rates, double *constants, double *algebraic);\n', g.interfaceInitialiseVariablesMethodString(True, False)) g.setInterfaceInitialiseVariablesMethodString(True, False, GeneratorProfileTestCase.VALUE) self.assertEqual(GeneratorProfileTestCase.VALUE, g.interfaceInitialiseVariablesMethodString(True, False)) - self.assertEqual('void initialiseVariables(double voi, double *states, double *rates, double *constants, ExternalVariable externalVariable);\n', + self.assertEqual('void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic, ExternalVariable externalVariable);\n', g.interfaceInitialiseVariablesMethodString(True, True)) g.setInterfaceInitialiseVariablesMethodString(True, True, GeneratorProfileTestCase.VALUE) self.assertEqual(GeneratorProfileTestCase.VALUE, g.interfaceInitialiseVariablesMethodString(True, True)) diff --git a/tests/generator/generatorprofile.cpp b/tests/generator/generatorprofile.cpp index cf556ec3f9..1e8b33b534 100644 --- a/tests/generator/generatorprofile.cpp +++ b/tests/generator/generatorprofile.cpp @@ -485,33 +485,33 @@ TEST(GeneratorProfile, defaultMiscellaneousValues) "}\n", generatorProfile->implementationDeleteArrayMethodString()); - EXPECT_EQ("void initialiseVariables(double *constants);\n", + EXPECT_EQ("void initialiseVariables(double *constants, double *algebraic);\n", generatorProfile->interfaceInitialiseVariablesMethodString(false, false)); - EXPECT_EQ("void initialiseVariables(double *constants)\n" + EXPECT_EQ("void initialiseVariables(double *constants, double *algebraic)\n" "{\n" "[CODE]" "}\n", generatorProfile->implementationInitialiseVariablesMethodString(false, false)); - EXPECT_EQ("void initialiseVariables(double *constants, ExternalVariable externalVariable);\n", + EXPECT_EQ("void initialiseVariables(double *constants, double *algebraic, ExternalVariable externalVariable);\n", generatorProfile->interfaceInitialiseVariablesMethodString(false, true)); - EXPECT_EQ("void initialiseVariables(double *constants, ExternalVariable externalVariable)\n" + EXPECT_EQ("void initialiseVariables(double *constants, double *algebraic, ExternalVariable externalVariable)\n" "{\n" "[CODE]" "}\n", generatorProfile->implementationInitialiseVariablesMethodString(false, true)); - EXPECT_EQ("void initialiseVariables(double *states, double *rates, double *constants);\n", + EXPECT_EQ("void initialiseVariables(double *states, double *rates, double *constants, double *algebraic);\n", generatorProfile->interfaceInitialiseVariablesMethodString(true, false)); - EXPECT_EQ("void initialiseVariables(double *states, double *rates, double *constants)\n" + EXPECT_EQ("void initialiseVariables(double *states, double *rates, double *constants, double *algebraic)\n" "{\n" "[CODE]" "}\n", generatorProfile->implementationInitialiseVariablesMethodString(true, false)); - EXPECT_EQ("void initialiseVariables(double voi, double *states, double *rates, double *constants, ExternalVariable externalVariable);\n", + EXPECT_EQ("void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic, ExternalVariable externalVariable);\n", generatorProfile->interfaceInitialiseVariablesMethodString(true, true)); - EXPECT_EQ("void initialiseVariables(double voi, double *states, double *rates, double *constants, ExternalVariable externalVariable)\n" + EXPECT_EQ("void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic, ExternalVariable externalVariable)\n" "{\n" "[CODE]" "}\n", diff --git a/tests/resources/coverage/generator/model.c b/tests/resources/coverage/generator/model.c index ada5039d47..95cb0e4fba 100644 --- a/tests/resources/coverage/generator/model.c +++ b/tests/resources/coverage/generator/model.c @@ -405,7 +405,7 @@ void findRoot0(double voi, double *states, double *rates, double *variables) algebraic[1] = u[1]; } -void initialiseVariables(double *states, double *rates, double *constants) +void initialiseVariables(double *states, double *rates, double *constants, double *algebraic) { constants[0] = 1.0; constants[1] = 2.0; diff --git a/tests/resources/coverage/generator/model.h b/tests/resources/coverage/generator/model.h index 8b62b74a83..f41310108d 100644 --- a/tests/resources/coverage/generator/model.h +++ b/tests/resources/coverage/generator/model.h @@ -31,7 +31,7 @@ double * createAlgebraicArray(); void deleteArray(double *array); -void initialiseVariables(double *states, double *rates, double *constants); +void initialiseVariables(double *states, double *rates, double *constants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/coverage/generator/model.implementation.out b/tests/resources/coverage/generator/model.implementation.out index 9201225b73..1bd2a352f3 100644 --- a/tests/resources/coverage/generator/model.implementation.out +++ b/tests/resources/coverage/generator/model.implementation.out @@ -168,7 +168,7 @@ void findRoot0(double voi, double *states, double *rates, double *variables) algebraic[1] = u[1]; } -void initialiseVariables(double *states, double *rates, double *constants) +void initialiseVariables(double *states, double *rates, double *constants, double *algebraic) { constants[0] = 1.0; constants[1] = 2.0; diff --git a/tests/resources/coverage/generator/model.interface.out b/tests/resources/coverage/generator/model.interface.out index e461b70adc..bd773bffa8 100644 --- a/tests/resources/coverage/generator/model.interface.out +++ b/tests/resources/coverage/generator/model.interface.out @@ -11,7 +11,7 @@ double * createAlgebraicArray(); void deleteArray(double *array); -void initialiseVariables(double *states, double *rates, double *constants); +void initialiseVariables(double *states, double *rates, double *constants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/coverage/generator/model.modified.profile.c b/tests/resources/coverage/generator/model.modified.profile.c index a31b1d6fb4..8b95e5994f 100644 --- a/tests/resources/coverage/generator/model.modified.profile.c +++ b/tests/resources/coverage/generator/model.modified.profile.c @@ -405,7 +405,7 @@ void findRoot0(double voi, double *states, double *rates, double *variables) algebraic[1] = u[1]; } -void initialiseVariables(double *states, double *rates, double *constants) +void initialiseVariables(double *states, double *rates, double *constants, double *algebraic) { constants[0] = 1.0; constants[1] = 2.0; diff --git a/tests/resources/coverage/generator/model.modified.profile.h b/tests/resources/coverage/generator/model.modified.profile.h index ead7dbbbdc..482f4f6c31 100644 --- a/tests/resources/coverage/generator/model.modified.profile.h +++ b/tests/resources/coverage/generator/model.modified.profile.h @@ -31,7 +31,7 @@ double * createAlgebraicArray(); void deleteArray(double *array); -void initialiseVariables(double *states, double *rates, double *constants); +void initialiseVariables(double *states, double *rates, double *constants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/coverage/generator/model.modified.profile.py b/tests/resources/coverage/generator/model.modified.profile.py index 91b686c183..97288e284c 100644 --- a/tests/resources/coverage/generator/model.modified.profile.py +++ b/tests/resources/coverage/generator/model.modified.profile.py @@ -382,7 +382,7 @@ def find_root_0(voi, states, rates, variables): algebraic[1] = u[1] -def initialise_variables(states, rates, constants): +def initialise_variables(states, rates, constants, algebraic): constants[0] = 1.0 constants[1] = 2.0 constants[2] = 3.0 diff --git a/tests/resources/coverage/generator/model.out b/tests/resources/coverage/generator/model.out index 97c8f00378..087fc8b7b5 100644 --- a/tests/resources/coverage/generator/model.out +++ b/tests/resources/coverage/generator/model.out @@ -116,7 +116,7 @@ void findRoot0(double voi, double *states, double *rates, double *variables) algebraic[1] = u[1]; } -void initialiseVariables(double *states, double *rates, double *constants) +void initialiseVariables(double *states, double *rates, double *constants, double *algebraic) { constants[0] = 1.0; constants[1] = 2.0; diff --git a/tests/resources/coverage/generator/model.py b/tests/resources/coverage/generator/model.py index 11f1633e87..87832d45cb 100644 --- a/tests/resources/coverage/generator/model.py +++ b/tests/resources/coverage/generator/model.py @@ -382,7 +382,7 @@ def find_root_0(voi, states, rates, variables): algebraic[1] = u[1] -def initialise_variables(states, rates, constants): +def initialise_variables(states, rates, constants, algebraic): constants[0] = 1.0 constants[1] = 2.0 constants[2] = 3.0 diff --git a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.c b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.c index 8fe7fe5afb..a3c00b62dd 100644 --- a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.c +++ b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.c @@ -61,7 +61,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double *constants) +void initialiseVariables(double *constants, double *algebraic) { computedConstants[1] = 1.0; } diff --git a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.c b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.c index 726d2e4dfa..06d47e8fe4 100644 --- a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.c +++ b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.c @@ -76,7 +76,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double *constants, ExternalVariable externalVariable) +void initialiseVariables(double *constants, double *algebraic, ExternalVariable externalVariable) { algebraic[1] = externalVariable(variables, 1); } diff --git a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.h b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.h index f2e5f8beac..3aea6ecead 100644 --- a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.h +++ b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.h @@ -32,6 +32,6 @@ void deleteArray(double *array); typedef double (* ExternalVariable)(double *variables, size_t index); -void initialiseVariables(double *constants, ExternalVariable externalVariable); +void initialiseVariables(double *constants, double *algebraic, ExternalVariable externalVariable); void computeComputedConstants(double *constants, double *computedConstants); void computeVariables(double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); diff --git a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.py b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.py index 85f1fc1c37..94691a7c9d 100644 --- a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.py +++ b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.py @@ -43,7 +43,7 @@ def create_externals_array(): return [nan]*EXTERNAL_COUNT -def initialise_variables(constants, external_variable): +def initialise_variables(constants, algebraic, external_variable): algebraic[1] = external_variable(variables, 1) diff --git a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.h b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.h index 09bd540e1b..1f34a6c517 100644 --- a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.h +++ b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.h @@ -27,6 +27,6 @@ double * createAlgebraicArray(); void deleteArray(double *array); -void initialiseVariables(double *constants); +void initialiseVariables(double *constants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeVariables(double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.py b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.py index ccb33cdae6..e16ebcdbb6 100644 --- a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.py +++ b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.py @@ -35,7 +35,7 @@ def create_algebraic_array(): return [nan]*ALGEBRAIC_COUNT -def initialise_variables(constants): +def initialise_variables(constants, algebraic): computed_constants[1] = 1.0 diff --git a/tests/resources/generator/algebraic_eqn_const_var_on_rhs/model.c b/tests/resources/generator/algebraic_eqn_const_var_on_rhs/model.c index 4fec075e21..844244bab2 100644 --- a/tests/resources/generator/algebraic_eqn_const_var_on_rhs/model.c +++ b/tests/resources/generator/algebraic_eqn_const_var_on_rhs/model.c @@ -61,7 +61,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double *constants) +void initialiseVariables(double *constants, double *algebraic) { constants[0] = 1.0; } diff --git a/tests/resources/generator/algebraic_eqn_const_var_on_rhs/model.h b/tests/resources/generator/algebraic_eqn_const_var_on_rhs/model.h index 09bd540e1b..1f34a6c517 100644 --- a/tests/resources/generator/algebraic_eqn_const_var_on_rhs/model.h +++ b/tests/resources/generator/algebraic_eqn_const_var_on_rhs/model.h @@ -27,6 +27,6 @@ double * createAlgebraicArray(); void deleteArray(double *array); -void initialiseVariables(double *constants); +void initialiseVariables(double *constants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeVariables(double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/algebraic_eqn_const_var_on_rhs/model.py b/tests/resources/generator/algebraic_eqn_const_var_on_rhs/model.py index 44cf1813a3..1f58e7d6f4 100644 --- a/tests/resources/generator/algebraic_eqn_const_var_on_rhs/model.py +++ b/tests/resources/generator/algebraic_eqn_const_var_on_rhs/model.py @@ -35,7 +35,7 @@ def create_algebraic_array(): return [nan]*ALGEBRAIC_COUNT -def initialise_variables(constants): +def initialise_variables(constants, algebraic): constants[0] = 1.0 diff --git a/tests/resources/generator/algebraic_eqn_constant_on_rhs/model.c b/tests/resources/generator/algebraic_eqn_constant_on_rhs/model.c index 496cd753d1..f4791714af 100644 --- a/tests/resources/generator/algebraic_eqn_constant_on_rhs/model.c +++ b/tests/resources/generator/algebraic_eqn_constant_on_rhs/model.c @@ -60,7 +60,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double *constants) +void initialiseVariables(double *constants, double *algebraic) { computedConstants[0] = 1.0; } diff --git a/tests/resources/generator/algebraic_eqn_constant_on_rhs/model.h b/tests/resources/generator/algebraic_eqn_constant_on_rhs/model.h index 9b095efd77..214a248c0b 100644 --- a/tests/resources/generator/algebraic_eqn_constant_on_rhs/model.h +++ b/tests/resources/generator/algebraic_eqn_constant_on_rhs/model.h @@ -27,6 +27,6 @@ double * createAlgebraicArray(); void deleteArray(double *array); -void initialiseVariables(double *constants); +void initialiseVariables(double *constants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeVariables(double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/algebraic_eqn_constant_on_rhs/model.py b/tests/resources/generator/algebraic_eqn_constant_on_rhs/model.py index 09de22b378..af04c489bc 100644 --- a/tests/resources/generator/algebraic_eqn_constant_on_rhs/model.py +++ b/tests/resources/generator/algebraic_eqn_constant_on_rhs/model.py @@ -34,7 +34,7 @@ def create_algebraic_array(): return [nan]*ALGEBRAIC_COUNT -def initialise_variables(constants): +def initialise_variables(constants, algebraic): computed_constants[0] = 1.0 diff --git a/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.c b/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.c index 50204c6366..be8b6b29a4 100644 --- a/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.c +++ b/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.c @@ -79,7 +79,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double *states, double *rates, double *constants) +void initialiseVariables(double *states, double *rates, double *constants, double *algebraic) { computedConstants[0] = 1.0; states[0] = 1.0; diff --git a/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.h b/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.h index 8f773b6902..a78dbb906d 100644 --- a/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.h +++ b/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.h @@ -31,7 +31,7 @@ double * createAlgebraicArray(); void deleteArray(double *array); -void initialiseVariables(double *states, double *rates, double *constants); +void initialiseVariables(double *states, double *rates, double *constants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.py b/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.py index 24dc85a5d7..273c43ba43 100644 --- a/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.py +++ b/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.py @@ -45,7 +45,7 @@ def create_algebraic_array(): return [nan]*ALGEBRAIC_COUNT -def initialise_variables(states, rates, constants): +def initialise_variables(states, rates, constants, algebraic): computed_constants[0] = 1.0 states[0] = 1.0 diff --git a/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.c b/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.c index 4350ef5f0f..fba3aa00f2 100644 --- a/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.c +++ b/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.c @@ -79,7 +79,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double *states, double *rates, double *constants) +void initialiseVariables(double *states, double *rates, double *constants, double *algebraic) { computedConstants[0] = 1.0; states[0] = 1.0; diff --git a/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.h b/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.h index 83c0783867..e05d298461 100644 --- a/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.h +++ b/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.h @@ -31,7 +31,7 @@ double * createAlgebraicArray(); void deleteArray(double *array); -void initialiseVariables(double *states, double *rates, double *constants); +void initialiseVariables(double *states, double *rates, double *constants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.py b/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.py index 710d4a6bd8..eb6e7b4244 100644 --- a/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.py +++ b/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.py @@ -45,7 +45,7 @@ def create_algebraic_array(): return [nan]*ALGEBRAIC_COUNT -def initialise_variables(states, rates, constants): +def initialise_variables(states, rates, constants, algebraic): computed_constants[0] = 1.0 states[0] = 1.0 diff --git a/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.c b/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.c index 3f88fde85e..212c1b6f5f 100644 --- a/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.c +++ b/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.c @@ -79,7 +79,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double *states, double *rates, double *constants) +void initialiseVariables(double *states, double *rates, double *constants, double *algebraic) { computedConstants[0] = 1.0; states[0] = 1.0; diff --git a/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.h b/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.h index 8fb87aae18..ba0e44b676 100644 --- a/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.h +++ b/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.h @@ -31,7 +31,7 @@ double * createAlgebraicArray(); void deleteArray(double *array); -void initialiseVariables(double *states, double *rates, double *constants); +void initialiseVariables(double *states, double *rates, double *constants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.py b/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.py index 0527bf97d2..2407fcadf3 100644 --- a/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.py +++ b/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.py @@ -45,7 +45,7 @@ def create_algebraic_array(): return [nan]*ALGEBRAIC_COUNT -def initialise_variables(states, rates, constants): +def initialise_variables(states, rates, constants, algebraic): computed_constants[0] = 1.0 states[0] = 1.0 diff --git a/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.c b/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.c index bff87c2756..a8b8f710fc 100644 --- a/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.c +++ b/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.c @@ -79,7 +79,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double *states, double *rates, double *constants) +void initialiseVariables(double *states, double *rates, double *constants, double *algebraic) { computedConstants[0] = 1.0; states[0] = 1.0; diff --git a/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.h b/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.h index c473a17f56..a33a6c6009 100644 --- a/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.h +++ b/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.h @@ -31,7 +31,7 @@ double * createAlgebraicArray(); void deleteArray(double *array); -void initialiseVariables(double *states, double *rates, double *constants); +void initialiseVariables(double *states, double *rates, double *constants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.py b/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.py index c17f55153a..4eda262a83 100644 --- a/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.py +++ b/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.py @@ -45,7 +45,7 @@ def create_algebraic_array(): return [nan]*ALGEBRAIC_COUNT -def initialise_variables(states, rates, constants): +def initialise_variables(states, rates, constants, algebraic): computed_constants[0] = 1.0 states[0] = 1.0 diff --git a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.c b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.c index 7cad553503..105a0833d9 100644 --- a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.c +++ b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.c @@ -91,7 +91,7 @@ void findRoot0(double *variables) algebraic[0] = u[0]; } -void initialiseVariables(double *constants) +void initialiseVariables(double *constants, double *algebraic) { algebraic[0] = 1.0; computedConstants[0] = 3.0; diff --git a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.c b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.c index bfb49ec7cc..d38d0c08ed 100644 --- a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.c +++ b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.c @@ -78,7 +78,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double *constants, ExternalVariable externalVariable) +void initialiseVariables(double *constants, double *algebraic, ExternalVariable externalVariable) { computedConstants[0] = 3.0; computedConstants[1] = 5.0; diff --git a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.h b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.h index f2e5f8beac..3aea6ecead 100644 --- a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.h +++ b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.h @@ -32,6 +32,6 @@ void deleteArray(double *array); typedef double (* ExternalVariable)(double *variables, size_t index); -void initialiseVariables(double *constants, ExternalVariable externalVariable); +void initialiseVariables(double *constants, double *algebraic, ExternalVariable externalVariable); void computeComputedConstants(double *constants, double *computedConstants); void computeVariables(double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); diff --git a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.py b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.py index c50b814262..15e43a6c7a 100644 --- a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.py +++ b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.py @@ -45,7 +45,7 @@ def create_externals_array(): return [nan]*EXTERNAL_COUNT -def initialise_variables(constants, external_variable): +def initialise_variables(constants, algebraic, external_variable): computed_constants[0] = 3.0 computed_constants[1] = 5.0 computed_constants[2] = 7.0 diff --git a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.h b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.h index 09bd540e1b..1f34a6c517 100644 --- a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.h +++ b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.h @@ -27,6 +27,6 @@ double * createAlgebraicArray(); void deleteArray(double *array); -void initialiseVariables(double *constants); +void initialiseVariables(double *constants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeVariables(double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.py b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.py index 36471b5192..df36f9d08e 100644 --- a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.py +++ b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.py @@ -58,7 +58,7 @@ def find_root_0(variables): algebraic[0] = u[0] -def initialise_variables(constants): +def initialise_variables(constants, algebraic): algebraic[0] = 1.0 computed_constants[0] = 3.0 computed_constants[1] = 5.0 diff --git a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.c b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.c index 8c0c46b904..0dbe3d9a82 100644 --- a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.c +++ b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.c @@ -98,7 +98,7 @@ void findRoot0(double *variables) algebraic[2] = u[2]; } -void initialiseVariables(double *constants) +void initialiseVariables(double *constants, double *algebraic) { algebraic[0] = 1.0; algebraic[1] = 1.0; diff --git a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.h b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.h index 9c4390a458..20d7d3dd9d 100644 --- a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.h +++ b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.h @@ -27,6 +27,6 @@ double * createAlgebraicArray(); void deleteArray(double *array); -void initialiseVariables(double *constants); +void initialiseVariables(double *constants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeVariables(double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.py b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.py index 5152bedc3b..2e9fe582ce 100644 --- a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.py +++ b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.py @@ -65,7 +65,7 @@ def find_root_0(variables): algebraic[2] = u[2] -def initialise_variables(constants): +def initialise_variables(constants, algebraic): algebraic[0] = 1.0 algebraic[1] = 1.0 algebraic[2] = 1.0 diff --git a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.c b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.c index f4891c4a70..14f3025e22 100644 --- a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.c +++ b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.c @@ -77,7 +77,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double *constants, ExternalVariable externalVariable) +void initialiseVariables(double *constants, double *algebraic, ExternalVariable externalVariable) { algebraic[0] = externalVariable(variables, 0); algebraic[1] = externalVariable(variables, 1); diff --git a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.h b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.h index 4a61d58c7d..ec5b81c772 100644 --- a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.h +++ b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.h @@ -32,6 +32,6 @@ void deleteArray(double *array); typedef double (* ExternalVariable)(double *variables, size_t index); -void initialiseVariables(double *constants, ExternalVariable externalVariable); +void initialiseVariables(double *constants, double *algebraic, ExternalVariable externalVariable); void computeComputedConstants(double *constants, double *computedConstants); void computeVariables(double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); diff --git a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.py b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.py index c485809612..b7f5d99b65 100644 --- a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.py +++ b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.py @@ -44,7 +44,7 @@ def create_externals_array(): return [nan]*EXTERNAL_COUNT -def initialise_variables(constants, external_variable): +def initialise_variables(constants, algebraic, external_variable): algebraic[0] = external_variable(variables, 0) algebraic[1] = external_variable(variables, 1) algebraic[2] = external_variable(variables, 2) diff --git a/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.c b/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.c index 6ec8b16701..dec7a49535 100644 --- a/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.c +++ b/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.c @@ -97,7 +97,7 @@ void findRoot0(double *variables) algebraic[1] = u[1]; } -void initialiseVariables(double *constants) +void initialiseVariables(double *constants, double *algebraic) { constants[0] = 3.0; constants[1] = 5.0; diff --git a/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.h b/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.h index 9c4390a458..20d7d3dd9d 100644 --- a/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.h +++ b/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.h @@ -27,6 +27,6 @@ double * createAlgebraicArray(); void deleteArray(double *array); -void initialiseVariables(double *constants); +void initialiseVariables(double *constants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeVariables(double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.py b/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.py index 4b3aefa550..a38ce9d1ec 100644 --- a/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.py +++ b/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.py @@ -64,7 +64,7 @@ def find_root_0(variables): algebraic[1] = u[1] -def initialise_variables(constants): +def initialise_variables(constants, algebraic): constants[0] = 3.0 constants[1] = 5.0 algebraic[1] = 1.0 diff --git a/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.c b/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.c index 374b6387cc..1cfcef8403 100644 --- a/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.c +++ b/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.c @@ -97,7 +97,7 @@ void findRoot0(double *variables) algebraic[1] = u[1]; } -void initialiseVariables(double *constants) +void initialiseVariables(double *constants, double *algebraic) { constants[0] = 3.0; constants[1] = 5.0; diff --git a/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.h b/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.h index 9c4390a458..20d7d3dd9d 100644 --- a/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.h +++ b/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.h @@ -27,6 +27,6 @@ double * createAlgebraicArray(); void deleteArray(double *array); -void initialiseVariables(double *constants); +void initialiseVariables(double *constants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeVariables(double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.py b/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.py index 26d826e4c2..a7badc9535 100644 --- a/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.py +++ b/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.py @@ -64,7 +64,7 @@ def find_root_0(variables): algebraic[1] = u[1] -def initialise_variables(constants): +def initialise_variables(constants, algebraic): constants[0] = 3.0 constants[1] = 5.0 algebraic[0] = 1.0 diff --git a/tests/resources/generator/algebraic_unknown_var_on_rhs/model.c b/tests/resources/generator/algebraic_unknown_var_on_rhs/model.c index 9aa43b5ee4..48c8e8533a 100644 --- a/tests/resources/generator/algebraic_unknown_var_on_rhs/model.c +++ b/tests/resources/generator/algebraic_unknown_var_on_rhs/model.c @@ -61,7 +61,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double *constants) +void initialiseVariables(double *constants, double *algebraic) { computedConstants[0] = 1.0; } diff --git a/tests/resources/generator/algebraic_unknown_var_on_rhs/model.h b/tests/resources/generator/algebraic_unknown_var_on_rhs/model.h index 9b095efd77..214a248c0b 100644 --- a/tests/resources/generator/algebraic_unknown_var_on_rhs/model.h +++ b/tests/resources/generator/algebraic_unknown_var_on_rhs/model.h @@ -27,6 +27,6 @@ double * createAlgebraicArray(); void deleteArray(double *array); -void initialiseVariables(double *constants); +void initialiseVariables(double *constants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeVariables(double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/algebraic_unknown_var_on_rhs/model.py b/tests/resources/generator/algebraic_unknown_var_on_rhs/model.py index 2d80710550..34185c7ef1 100644 --- a/tests/resources/generator/algebraic_unknown_var_on_rhs/model.py +++ b/tests/resources/generator/algebraic_unknown_var_on_rhs/model.py @@ -35,7 +35,7 @@ def create_algebraic_array(): return [nan]*ALGEBRAIC_COUNT -def initialise_variables(constants): +def initialise_variables(constants, algebraic): computed_constants[0] = 1.0 diff --git a/tests/resources/generator/cell_geometry_model/model.c b/tests/resources/generator/cell_geometry_model/model.c index 4fb93ec8e1..5e019e3e4e 100644 --- a/tests/resources/generator/cell_geometry_model/model.c +++ b/tests/resources/generator/cell_geometry_model/model.c @@ -63,7 +63,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double *constants) +void initialiseVariables(double *constants, double *algebraic) { constants[0] = 0.01; constants[1] = 0.0011; diff --git a/tests/resources/generator/cell_geometry_model/model.external.c b/tests/resources/generator/cell_geometry_model/model.external.c index 2cf2258cea..daa7e04476 100644 --- a/tests/resources/generator/cell_geometry_model/model.external.c +++ b/tests/resources/generator/cell_geometry_model/model.external.c @@ -78,7 +78,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double *constants, ExternalVariable externalVariable) +void initialiseVariables(double *constants, double *algebraic, ExternalVariable externalVariable) { algebraic[1] = externalVariable(variables, 1); algebraic[2] = externalVariable(variables, 2); diff --git a/tests/resources/generator/cell_geometry_model/model.external.h b/tests/resources/generator/cell_geometry_model/model.external.h index 60a5dac8ec..c7ef02ef15 100644 --- a/tests/resources/generator/cell_geometry_model/model.external.h +++ b/tests/resources/generator/cell_geometry_model/model.external.h @@ -32,6 +32,6 @@ void deleteArray(double *array); typedef double (* ExternalVariable)(double *variables, size_t index); -void initialiseVariables(double *constants, ExternalVariable externalVariable); +void initialiseVariables(double *constants, double *algebraic, ExternalVariable externalVariable); void computeComputedConstants(double *constants, double *computedConstants); void computeVariables(double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); diff --git a/tests/resources/generator/cell_geometry_model/model.external.py b/tests/resources/generator/cell_geometry_model/model.external.py index 60c18b4a8a..3d16a465a2 100644 --- a/tests/resources/generator/cell_geometry_model/model.external.py +++ b/tests/resources/generator/cell_geometry_model/model.external.py @@ -45,7 +45,7 @@ def create_externals_array(): return [nan]*EXTERNAL_COUNT -def initialise_variables(constants, external_variable): +def initialise_variables(constants, algebraic, external_variable): algebraic[1] = external_variable(variables, 1) algebraic[2] = external_variable(variables, 2) diff --git a/tests/resources/generator/cell_geometry_model/model.h b/tests/resources/generator/cell_geometry_model/model.h index adc63ee0de..01b945a3ae 100644 --- a/tests/resources/generator/cell_geometry_model/model.h +++ b/tests/resources/generator/cell_geometry_model/model.h @@ -27,6 +27,6 @@ double * createAlgebraicArray(); void deleteArray(double *array); -void initialiseVariables(double *constants); +void initialiseVariables(double *constants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeVariables(double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/cell_geometry_model/model.py b/tests/resources/generator/cell_geometry_model/model.py index 632242c002..a8a99bf87f 100644 --- a/tests/resources/generator/cell_geometry_model/model.py +++ b/tests/resources/generator/cell_geometry_model/model.py @@ -37,7 +37,7 @@ def create_algebraic_array(): return [nan]*ALGEBRAIC_COUNT -def initialise_variables(constants): +def initialise_variables(constants, algebraic): constants[0] = 0.01 constants[1] = 0.0011 diff --git a/tests/resources/generator/cellml_mappings_and_encapsulations/model.c b/tests/resources/generator/cellml_mappings_and_encapsulations/model.c index f37a28dea9..4e23c77de8 100644 --- a/tests/resources/generator/cellml_mappings_and_encapsulations/model.c +++ b/tests/resources/generator/cellml_mappings_and_encapsulations/model.c @@ -80,7 +80,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double *states, double *rates, double *constants) +void initialiseVariables(double *states, double *rates, double *constants, double *algebraic) { states[0] = 1.0; states[1] = 0.0; diff --git a/tests/resources/generator/cellml_mappings_and_encapsulations/model.h b/tests/resources/generator/cellml_mappings_and_encapsulations/model.h index d33f9c169b..e55d0f0e3c 100644 --- a/tests/resources/generator/cellml_mappings_and_encapsulations/model.h +++ b/tests/resources/generator/cellml_mappings_and_encapsulations/model.h @@ -31,7 +31,7 @@ double * createAlgebraicArray(); void deleteArray(double *array); -void initialiseVariables(double *states, double *rates, double *constants); +void initialiseVariables(double *states, double *rates, double *constants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/cellml_mappings_and_encapsulations/model.py b/tests/resources/generator/cellml_mappings_and_encapsulations/model.py index ce2e8a5f31..ce8c7b28a4 100644 --- a/tests/resources/generator/cellml_mappings_and_encapsulations/model.py +++ b/tests/resources/generator/cellml_mappings_and_encapsulations/model.py @@ -46,7 +46,7 @@ def create_algebraic_array(): return [nan]*ALGEBRAIC_COUNT -def initialise_variables(states, rates, constants): +def initialise_variables(states, rates, constants, algebraic): states[0] = 1.0 states[1] = 0.0 diff --git a/tests/resources/generator/cellml_slc_example/model.py b/tests/resources/generator/cellml_slc_example/model.py index 9c4aec544b..f7fd19efad 100644 --- a/tests/resources/generator/cellml_slc_example/model.py +++ b/tests/resources/generator/cellml_slc_example/model.py @@ -43,7 +43,7 @@ def create_algebraic_array(): return [nan]*ALGEBRAIC_COUNT -def initialise_variables(constants): +def initialise_variables(constants, algebraic): constants[0] = 1.1 constants[1] = 21262500.0 constants[2] = 150.0 diff --git a/tests/resources/generator/cellml_state_initialised_using_variable/model.c b/tests/resources/generator/cellml_state_initialised_using_variable/model.c index 121c73290b..d9a740db51 100644 --- a/tests/resources/generator/cellml_state_initialised_using_variable/model.c +++ b/tests/resources/generator/cellml_state_initialised_using_variable/model.c @@ -78,7 +78,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double *states, double *rates, double *constants) +void initialiseVariables(double *states, double *rates, double *constants, double *algebraic) { constants[0] = 123.0; states[0] = constants[0]; diff --git a/tests/resources/generator/cellml_state_initialised_using_variable/model.h b/tests/resources/generator/cellml_state_initialised_using_variable/model.h index b5e1553fdd..c7fc1bb53b 100644 --- a/tests/resources/generator/cellml_state_initialised_using_variable/model.h +++ b/tests/resources/generator/cellml_state_initialised_using_variable/model.h @@ -31,7 +31,7 @@ double * createAlgebraicArray(); void deleteArray(double *array); -void initialiseVariables(double *states, double *rates, double *constants); +void initialiseVariables(double *states, double *rates, double *constants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/cellml_state_initialised_using_variable/model.py b/tests/resources/generator/cellml_state_initialised_using_variable/model.py index 8f685b2ab3..ec5d060f27 100644 --- a/tests/resources/generator/cellml_state_initialised_using_variable/model.py +++ b/tests/resources/generator/cellml_state_initialised_using_variable/model.py @@ -44,7 +44,7 @@ def create_algebraic_array(): return [nan]*ALGEBRAIC_COUNT -def initialise_variables(states, rates, constants): +def initialise_variables(states, rates, constants, algebraic): constants[0] = 123.0 states[0] = constants[0] diff --git a/tests/resources/generator/cellml_unit_scaling_constant/model.c b/tests/resources/generator/cellml_unit_scaling_constant/model.c index 89d15758a6..096f850647 100644 --- a/tests/resources/generator/cellml_unit_scaling_constant/model.c +++ b/tests/resources/generator/cellml_unit_scaling_constant/model.c @@ -62,7 +62,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double *constants) +void initialiseVariables(double *constants, double *algebraic) { constants[0] = 123.0; } diff --git a/tests/resources/generator/cellml_unit_scaling_constant/model.h b/tests/resources/generator/cellml_unit_scaling_constant/model.h index 57ef15ccdd..d7919125ee 100644 --- a/tests/resources/generator/cellml_unit_scaling_constant/model.h +++ b/tests/resources/generator/cellml_unit_scaling_constant/model.h @@ -27,6 +27,6 @@ double * createAlgebraicArray(); void deleteArray(double *array); -void initialiseVariables(double *constants); +void initialiseVariables(double *constants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeVariables(double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/cellml_unit_scaling_constant/model.py b/tests/resources/generator/cellml_unit_scaling_constant/model.py index 179fc7bf58..b6ea3f00d7 100644 --- a/tests/resources/generator/cellml_unit_scaling_constant/model.py +++ b/tests/resources/generator/cellml_unit_scaling_constant/model.py @@ -36,7 +36,7 @@ def create_algebraic_array(): return [nan]*ALGEBRAIC_COUNT -def initialise_variables(constants): +def initialise_variables(constants, algebraic): constants[0] = 123.0 diff --git a/tests/resources/generator/cellml_unit_scaling_rate/model.c b/tests/resources/generator/cellml_unit_scaling_rate/model.c index cc090e14df..053937550a 100644 --- a/tests/resources/generator/cellml_unit_scaling_rate/model.c +++ b/tests/resources/generator/cellml_unit_scaling_rate/model.c @@ -79,7 +79,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double *states, double *rates, double *constants) +void initialiseVariables(double *states, double *rates, double *constants, double *algebraic) { states[0] = 123.0; } diff --git a/tests/resources/generator/cellml_unit_scaling_rate/model.h b/tests/resources/generator/cellml_unit_scaling_rate/model.h index b5e1553fdd..c7fc1bb53b 100644 --- a/tests/resources/generator/cellml_unit_scaling_rate/model.h +++ b/tests/resources/generator/cellml_unit_scaling_rate/model.h @@ -31,7 +31,7 @@ double * createAlgebraicArray(); void deleteArray(double *array); -void initialiseVariables(double *states, double *rates, double *constants); +void initialiseVariables(double *states, double *rates, double *constants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/cellml_unit_scaling_rate/model.py b/tests/resources/generator/cellml_unit_scaling_rate/model.py index db91581c91..3be023c6f6 100644 --- a/tests/resources/generator/cellml_unit_scaling_rate/model.py +++ b/tests/resources/generator/cellml_unit_scaling_rate/model.py @@ -45,7 +45,7 @@ def create_algebraic_array(): return [nan]*ALGEBRAIC_COUNT -def initialise_variables(states, rates, constants): +def initialise_variables(states, rates, constants, algebraic): states[0] = 123.0 diff --git a/tests/resources/generator/cellml_unit_scaling_state/model.c b/tests/resources/generator/cellml_unit_scaling_state/model.c index 7129623ca7..4ebce78ef1 100644 --- a/tests/resources/generator/cellml_unit_scaling_state/model.c +++ b/tests/resources/generator/cellml_unit_scaling_state/model.c @@ -79,7 +79,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double *states, double *rates, double *constants) +void initialiseVariables(double *states, double *rates, double *constants, double *algebraic) { states[0] = 123.0; } diff --git a/tests/resources/generator/cellml_unit_scaling_state/model.h b/tests/resources/generator/cellml_unit_scaling_state/model.h index b5e1553fdd..c7fc1bb53b 100644 --- a/tests/resources/generator/cellml_unit_scaling_state/model.h +++ b/tests/resources/generator/cellml_unit_scaling_state/model.h @@ -31,7 +31,7 @@ double * createAlgebraicArray(); void deleteArray(double *array); -void initialiseVariables(double *states, double *rates, double *constants); +void initialiseVariables(double *states, double *rates, double *constants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/cellml_unit_scaling_state/model.py b/tests/resources/generator/cellml_unit_scaling_state/model.py index efe00b6e48..8ee327e2a5 100644 --- a/tests/resources/generator/cellml_unit_scaling_state/model.py +++ b/tests/resources/generator/cellml_unit_scaling_state/model.py @@ -45,7 +45,7 @@ def create_algebraic_array(): return [nan]*ALGEBRAIC_COUNT -def initialise_variables(states, rates, constants): +def initialise_variables(states, rates, constants, algebraic): states[0] = 123.0 diff --git a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.c b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.c index 27254205ce..4ae30b4c25 100644 --- a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.c +++ b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.c @@ -78,7 +78,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double *states, double *rates, double *constants) +void initialiseVariables(double *states, double *rates, double *constants, double *algebraic) { states[0] = 123.0; states[1] = 0.001*789.0; diff --git a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.h b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.h index 6a5fb14884..dd0b1fd5cd 100644 --- a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.h +++ b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.h @@ -31,7 +31,7 @@ double * createAlgebraicArray(); void deleteArray(double *array); -void initialiseVariables(double *states, double *rates, double *constants); +void initialiseVariables(double *states, double *rates, double *constants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.py b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.py index bc50269541..f406773578 100644 --- a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.py +++ b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.py @@ -44,7 +44,7 @@ def create_algebraic_array(): return [nan]*ALGEBRAIC_COUNT -def initialise_variables(states, rates, constants): +def initialise_variables(states, rates, constants, algebraic): states[0] = 123.0 states[1] = 0.001*789.0 diff --git a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.c b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.c index c7b46d5af1..53f3416882 100644 --- a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.c +++ b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.c @@ -80,7 +80,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double *states, double *rates, double *constants) +void initialiseVariables(double *states, double *rates, double *constants, double *algebraic) { constants[0] = 123.0; constants[1] = 789.0; diff --git a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.h b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.h index 5ca5788bc9..7267fab5d8 100644 --- a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.h +++ b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.h @@ -31,7 +31,7 @@ double * createAlgebraicArray(); void deleteArray(double *array); -void initialiseVariables(double *states, double *rates, double *constants); +void initialiseVariables(double *states, double *rates, double *constants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.py b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.py index 5e1c748cd2..aff5ec527d 100644 --- a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.py +++ b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.py @@ -46,7 +46,7 @@ def create_algebraic_array(): return [nan]*ALGEBRAIC_COUNT -def initialise_variables(states, rates, constants): +def initialise_variables(states, rates, constants, algebraic): constants[0] = 123.0 constants[1] = 789.0 states[0] = constants[0] diff --git a/tests/resources/generator/cellml_unit_scaling_voi_direct/model.c b/tests/resources/generator/cellml_unit_scaling_voi_direct/model.c index 93a512d31f..3f3b30f11b 100644 --- a/tests/resources/generator/cellml_unit_scaling_voi_direct/model.c +++ b/tests/resources/generator/cellml_unit_scaling_voi_direct/model.c @@ -78,7 +78,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double *states, double *rates, double *constants) +void initialiseVariables(double *states, double *rates, double *constants, double *algebraic) { states[0] = 3.0; states[1] = 5.0; diff --git a/tests/resources/generator/cellml_unit_scaling_voi_direct/model.h b/tests/resources/generator/cellml_unit_scaling_voi_direct/model.h index 319a116d0f..351e9dc86f 100644 --- a/tests/resources/generator/cellml_unit_scaling_voi_direct/model.h +++ b/tests/resources/generator/cellml_unit_scaling_voi_direct/model.h @@ -31,7 +31,7 @@ double * createAlgebraicArray(); void deleteArray(double *array); -void initialiseVariables(double *states, double *rates, double *constants); +void initialiseVariables(double *states, double *rates, double *constants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/cellml_unit_scaling_voi_direct/model.py b/tests/resources/generator/cellml_unit_scaling_voi_direct/model.py index 8ec3b32d45..bd8f7d2534 100644 --- a/tests/resources/generator/cellml_unit_scaling_voi_direct/model.py +++ b/tests/resources/generator/cellml_unit_scaling_voi_direct/model.py @@ -44,7 +44,7 @@ def create_algebraic_array(): return [nan]*ALGEBRAIC_COUNT -def initialise_variables(states, rates, constants): +def initialise_variables(states, rates, constants, algebraic): states[0] = 3.0 states[1] = 5.0 diff --git a/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.c b/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.c index c8fa6eabe8..cc52751060 100644 --- a/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.c +++ b/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.c @@ -79,7 +79,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double *states, double *rates, double *constants) +void initialiseVariables(double *states, double *rates, double *constants, double *algebraic) { states[0] = 3.0; states[1] = 7.0; diff --git a/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.h b/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.h index 52fda2a3bd..487f6a7483 100644 --- a/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.h +++ b/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.h @@ -31,7 +31,7 @@ double * createAlgebraicArray(); void deleteArray(double *array); -void initialiseVariables(double *states, double *rates, double *constants); +void initialiseVariables(double *states, double *rates, double *constants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.py b/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.py index a5d2a5ec0d..110dcd6ff9 100644 --- a/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.py +++ b/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.py @@ -45,7 +45,7 @@ def create_algebraic_array(): return [nan]*ALGEBRAIC_COUNT -def initialise_variables(states, rates, constants): +def initialise_variables(states, rates, constants, algebraic): states[0] = 3.0 states[1] = 7.0 states[2] = 11.0 diff --git a/tests/resources/generator/dae_cellml_1_1_model/model.c b/tests/resources/generator/dae_cellml_1_1_model/model.c index a21add9d87..0490c23751 100644 --- a/tests/resources/generator/dae_cellml_1_1_model/model.c +++ b/tests/resources/generator/dae_cellml_1_1_model/model.c @@ -146,7 +146,7 @@ void findRoot1(double voi, double *states, double *rates, double *variables) algebraic[4] = u[0]; } -void initialiseVariables(double *states, double *rates, double *constants) +void initialiseVariables(double *states, double *rates, double *constants, double *algebraic) { constants[0] = 1.0; constants[1] = 1.0; diff --git a/tests/resources/generator/dae_cellml_1_1_model/model.h b/tests/resources/generator/dae_cellml_1_1_model/model.h index 7a1968fd68..f4325a88b0 100644 --- a/tests/resources/generator/dae_cellml_1_1_model/model.h +++ b/tests/resources/generator/dae_cellml_1_1_model/model.h @@ -31,7 +31,7 @@ double * createAlgebraicArray(); void deleteArray(double *array); -void initialiseVariables(double *states, double *rates, double *constants); +void initialiseVariables(double *states, double *rates, double *constants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/dae_cellml_1_1_model/model.py b/tests/resources/generator/dae_cellml_1_1_model/model.py index f1bef75dca..9746c76a65 100644 --- a/tests/resources/generator/dae_cellml_1_1_model/model.py +++ b/tests/resources/generator/dae_cellml_1_1_model/model.py @@ -99,7 +99,7 @@ def find_root_1(voi, states, rates, variables): algebraic[4] = u[0] -def initialise_variables(states, rates, constants): +def initialise_variables(states, rates, constants, algebraic): constants[0] = 1.0 constants[1] = 1.0 constants[2] = 20.0 diff --git a/tests/resources/generator/dependent_eqns/model.c b/tests/resources/generator/dependent_eqns/model.c index 9367b233ff..da657936cb 100644 --- a/tests/resources/generator/dependent_eqns/model.c +++ b/tests/resources/generator/dependent_eqns/model.c @@ -79,7 +79,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double *states, double *rates, double *constants) +void initialiseVariables(double *states, double *rates, double *constants, double *algebraic) { states[0] = 0.0; } diff --git a/tests/resources/generator/dependent_eqns/model.h b/tests/resources/generator/dependent_eqns/model.h index 006a4093e9..2a63e4ec51 100644 --- a/tests/resources/generator/dependent_eqns/model.h +++ b/tests/resources/generator/dependent_eqns/model.h @@ -31,7 +31,7 @@ double * createAlgebraicArray(); void deleteArray(double *array); -void initialiseVariables(double *states, double *rates, double *constants); +void initialiseVariables(double *states, double *rates, double *constants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/dependent_eqns/model.py b/tests/resources/generator/dependent_eqns/model.py index b60c94ccfc..8330f78656 100644 --- a/tests/resources/generator/dependent_eqns/model.py +++ b/tests/resources/generator/dependent_eqns/model.py @@ -45,7 +45,7 @@ def create_algebraic_array(): return [nan]*ALGEBRAIC_COUNT -def initialise_variables(states, rates, constants): +def initialise_variables(states, rates, constants, algebraic): states[0] = 0.0 diff --git a/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.c b/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.c index 40f092eb99..c55ad5533f 100644 --- a/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.c +++ b/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.c @@ -326,7 +326,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double *states, double *rates, double *constants) +void initialiseVariables(double *states, double *rates, double *constants, double *algebraic) { constants[0] = 0.0; constants[1] = 0.0; diff --git a/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.h b/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.h index 559cb88d64..91a04ff7d2 100644 --- a/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.h +++ b/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.h @@ -31,7 +31,7 @@ double * createAlgebraicArray(); void deleteArray(double *array); -void initialiseVariables(double *states, double *rates, double *constants); +void initialiseVariables(double *states, double *rates, double *constants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.py b/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.py index e216fc6a49..bad1cbbfc0 100644 --- a/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.py +++ b/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.py @@ -312,7 +312,7 @@ def create_algebraic_array(): return [nan]*ALGEBRAIC_COUNT -def initialise_variables(states, rates, constants): +def initialise_variables(states, rates, constants, algebraic): constants[0] = 0.0 constants[1] = 0.0 constants[2] = 140.0 diff --git a/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.c b/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.c index 51a8f5289f..4a91f69bee 100644 --- a/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.c +++ b/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.c @@ -276,7 +276,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double *states, double *rates, double *constants) +void initialiseVariables(double *states, double *rates, double *constants, double *algebraic) { constants[0] = 0.0; constants[1] = 1.0; diff --git a/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.h b/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.h index 5aca23091a..96bd8c9d2e 100644 --- a/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.h +++ b/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.h @@ -31,7 +31,7 @@ double * createAlgebraicArray(); void deleteArray(double *array); -void initialiseVariables(double *states, double *rates, double *constants); +void initialiseVariables(double *states, double *rates, double *constants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.py b/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.py index 8eda5b4204..ae144daccf 100644 --- a/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.py +++ b/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.py @@ -250,7 +250,7 @@ def create_algebraic_array(): return [nan]*ALGEBRAIC_COUNT -def initialise_variables(states, rates, constants): +def initialise_variables(states, rates, constants, algebraic): constants[0] = 0.0 constants[1] = 1.0 constants[2] = 1.0309347 diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.c index 27a20813d9..014c80f3fa 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.c @@ -113,7 +113,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double voi, double *states, double *rates, double *constants, ExternalVariable externalVariable) +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic, ExternalVariable externalVariable) { constants[0] = 1.0; constants[1] = 0.0; diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.h index e30a552fd7..543f64ae8d 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.h +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.h @@ -36,7 +36,7 @@ void deleteArray(double *array); typedef double (* ExternalVariable)(double voi, double *states, double *rates, double *variables, size_t index); -void initialiseVariables(double voi, double *states, double *rates, double *constants, ExternalVariable externalVariable); +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic, ExternalVariable externalVariable); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.py index 30ad480ead..b5a866b3e9 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.py @@ -84,7 +84,7 @@ def create_externals_array(): return [nan]*EXTERNAL_COUNT -def initialise_variables(voi, states, rates, constants, external_variable): +def initialise_variables(voi, states, rates, constants, algebraic, external_variable): constants[0] = 1.0 constants[1] = 0.0 constants[2] = 0.3 diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.c index 7a9b63a34e..c6bbfef2c0 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.c @@ -98,7 +98,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double *states, double *rates, double *constants) +void initialiseVariables(double *states, double *rates, double *constants, double *algebraic) { constants[0] = 1.0; constants[1] = 0.0; diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.c index 2f1d436b51..65b7980a70 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.c @@ -113,7 +113,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double voi, double *states, double *rates, double *constants, ExternalVariable externalVariable) +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic, ExternalVariable externalVariable) { constants[0] = 1.0; constants[1] = 0.0; diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.h index e30a552fd7..543f64ae8d 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.h +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.h @@ -36,7 +36,7 @@ void deleteArray(double *array); typedef double (* ExternalVariable)(double voi, double *states, double *rates, double *variables, size_t index); -void initialiseVariables(double voi, double *states, double *rates, double *constants, ExternalVariable externalVariable); +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic, ExternalVariable externalVariable); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.py index a8489aee69..814ad44aa5 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.py @@ -84,7 +84,7 @@ def create_externals_array(): return [nan]*EXTERNAL_COUNT -def initialise_variables(voi, states, rates, constants, external_variable): +def initialise_variables(voi, states, rates, constants, algebraic, external_variable): constants[0] = 1.0 constants[1] = 0.0 constants[2] = 0.3 diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.c index 13e2f75179..c55dd78a0c 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.c @@ -113,7 +113,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double voi, double *states, double *rates, double *constants, ExternalVariable externalVariable) +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic, ExternalVariable externalVariable) { constants[0] = 0.0; constants[1] = 0.3; diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.h index e30a552fd7..543f64ae8d 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.h +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.h @@ -36,7 +36,7 @@ void deleteArray(double *array); typedef double (* ExternalVariable)(double voi, double *states, double *rates, double *variables, size_t index); -void initialiseVariables(double voi, double *states, double *rates, double *constants, ExternalVariable externalVariable); +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic, ExternalVariable externalVariable); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.py index 378af0a1b0..601f71d5c5 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.py @@ -84,7 +84,7 @@ def create_externals_array(): return [nan]*EXTERNAL_COUNT -def initialise_variables(voi, states, rates, constants, external_variable): +def initialise_variables(voi, states, rates, constants, algebraic, external_variable): constants[0] = 0.0 constants[1] = 0.3 constants[2] = 120.0 diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.c index 543ff0e577..fb3b5d646c 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.c @@ -516,7 +516,7 @@ void findRoot16(double voi, double *states, double *rates, double *variables) rates[3] = u[0]; } -void initialiseVariables(double *states, double *rates, double *constants) +void initialiseVariables(double *states, double *rates, double *constants, double *algebraic) { constants[0] = 1.0; constants[1] = 0.0; diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.h index ea730f3439..6dead540ca 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.h +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.h @@ -31,7 +31,7 @@ double * createAlgebraicArray(); void deleteArray(double *array); -void initialiseVariables(double *states, double *rates, double *constants); +void initialiseVariables(double *states, double *rates, double *constants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.py index 258d847eae..39a4dddc73 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.py @@ -436,7 +436,7 @@ def find_root_16(voi, states, rates, variables): rates[3] = u[0] -def initialise_variables(states, rates, constants): +def initialise_variables(states, rates, constants, algebraic): constants[0] = 1.0 constants[1] = 0.0 constants[2] = 0.3 diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.c index 8c59caf7df..63e497727e 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.c @@ -113,7 +113,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double voi, double *states, double *rates, double *constants, ExternalVariable externalVariable) +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic, ExternalVariable externalVariable) { constants[0] = 1.0; constants[1] = 0.0; diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.h index e30a552fd7..543f64ae8d 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.h +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.h @@ -36,7 +36,7 @@ void deleteArray(double *array); typedef double (* ExternalVariable)(double voi, double *states, double *rates, double *variables, size_t index); -void initialiseVariables(double voi, double *states, double *rates, double *constants, ExternalVariable externalVariable); +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic, ExternalVariable externalVariable); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.py index 4664272cf8..e30ee484bc 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.py @@ -84,7 +84,7 @@ def create_externals_array(): return [nan]*EXTERNAL_COUNT -def initialise_variables(voi, states, rates, constants, external_variable): +def initialise_variables(voi, states, rates, constants, algebraic, external_variable): constants[0] = 1.0 constants[1] = 0.0 constants[2] = 0.3 diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.c index 327f50b3b3..b32cc398f3 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.c @@ -113,7 +113,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double voi, double *states, double *rates, double *constants, ExternalVariable externalVariable) +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic, ExternalVariable externalVariable) { constants[0] = 1.0; constants[1] = 0.3; diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.h index e30a552fd7..543f64ae8d 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.h +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.h @@ -36,7 +36,7 @@ void deleteArray(double *array); typedef double (* ExternalVariable)(double voi, double *states, double *rates, double *variables, size_t index); -void initialiseVariables(double voi, double *states, double *rates, double *constants, ExternalVariable externalVariable); +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic, ExternalVariable externalVariable); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.py index 70ef952df6..5c83fafb02 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.py @@ -84,7 +84,7 @@ def create_externals_array(): return [nan]*EXTERNAL_COUNT -def initialise_variables(voi, states, rates, constants, external_variable): +def initialise_variables(voi, states, rates, constants, algebraic, external_variable): constants[0] = 1.0 constants[1] = 0.3 constants[2] = 120.0 diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.c index c8ecad99e8..65138ecb45 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.c @@ -113,7 +113,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double voi, double *states, double *rates, double *constants, ExternalVariable externalVariable) +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic, ExternalVariable externalVariable) { constants[0] = 0.0; constants[1] = 0.3; diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.h index e30a552fd7..543f64ae8d 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.h +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.h @@ -36,7 +36,7 @@ void deleteArray(double *array); typedef double (* ExternalVariable)(double voi, double *states, double *rates, double *variables, size_t index); -void initialiseVariables(double voi, double *states, double *rates, double *constants, ExternalVariable externalVariable); +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic, ExternalVariable externalVariable); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.py index 308af32966..11c18b3eb3 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.py @@ -84,7 +84,7 @@ def create_externals_array(): return [nan]*EXTERNAL_COUNT -def initialise_variables(voi, states, rates, constants, external_variable): +def initialise_variables(voi, states, rates, constants, algebraic, external_variable): constants[0] = 0.0 constants[1] = 0.3 constants[2] = 36.0 diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.c index 02e6af377e..4345ee1fe9 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.c @@ -113,7 +113,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double voi, double *states, double *rates, double *constants, ExternalVariable externalVariable) +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic, ExternalVariable externalVariable) { constants[0] = 1.0; constants[1] = 0.0; diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.h index e30a552fd7..543f64ae8d 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.h +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.h @@ -36,7 +36,7 @@ void deleteArray(double *array); typedef double (* ExternalVariable)(double voi, double *states, double *rates, double *variables, size_t index); -void initialiseVariables(double voi, double *states, double *rates, double *constants, ExternalVariable externalVariable); +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic, ExternalVariable externalVariable); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.py index 428ac2d5c6..72335596c2 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.py @@ -84,7 +84,7 @@ def create_externals_array(): return [nan]*EXTERNAL_COUNT -def initialise_variables(voi, states, rates, constants, external_variable): +def initialise_variables(voi, states, rates, constants, algebraic, external_variable): constants[0] = 1.0 constants[1] = 0.0 constants[2] = 0.3 diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.c index cd8f102401..83766cef78 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.c @@ -113,7 +113,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double voi, double *states, double *rates, double *constants, ExternalVariable externalVariable) +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic, ExternalVariable externalVariable) { constants[0] = 1.0; constants[1] = 0.0; diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.h index e30a552fd7..543f64ae8d 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.h +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.h @@ -36,7 +36,7 @@ void deleteArray(double *array); typedef double (* ExternalVariable)(double voi, double *states, double *rates, double *variables, size_t index); -void initialiseVariables(double voi, double *states, double *rates, double *constants, ExternalVariable externalVariable); +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic, ExternalVariable externalVariable); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.py index f4e5fa7cee..e61d980168 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.py @@ -84,7 +84,7 @@ def create_externals_array(): return [nan]*EXTERNAL_COUNT -def initialise_variables(voi, states, rates, constants, external_variable): +def initialise_variables(voi, states, rates, constants, algebraic, external_variable): constants[0] = 1.0 constants[1] = 0.0 constants[2] = 0.3 diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.h index ea730f3439..6dead540ca 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.h +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.h @@ -31,7 +31,7 @@ double * createAlgebraicArray(); void deleteArray(double *array); -void initialiseVariables(double *states, double *rates, double *constants); +void initialiseVariables(double *states, double *rates, double *constants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.py index a87129a9a2..f8e93fd7e1 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.py @@ -76,7 +76,7 @@ def create_algebraic_array(): return [nan]*ALGEBRAIC_COUNT -def initialise_variables(states, rates, constants): +def initialise_variables(states, rates, constants, algebraic): constants[0] = 1.0 constants[1] = 0.0 constants[2] = 0.3 diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.c index c159999cd3..373332828f 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.c @@ -113,7 +113,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double voi, double *states, double *rates, double *constants, ExternalVariable externalVariable) +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic, ExternalVariable externalVariable) { constants[0] = 1.0; constants[1] = 0.0; diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.h index e30a552fd7..543f64ae8d 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.h +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.h @@ -36,7 +36,7 @@ void deleteArray(double *array); typedef double (* ExternalVariable)(double voi, double *states, double *rates, double *variables, size_t index); -void initialiseVariables(double voi, double *states, double *rates, double *constants, ExternalVariable externalVariable); +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic, ExternalVariable externalVariable); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.py index 1e33ef6169..465f5eeecb 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.py @@ -84,7 +84,7 @@ def create_externals_array(): return [nan]*EXTERNAL_COUNT -def initialise_variables(voi, states, rates, constants, external_variable): +def initialise_variables(voi, states, rates, constants, algebraic, external_variable): constants[0] = 1.0 constants[1] = 0.0 constants[2] = 0.3 diff --git a/tests/resources/generator/noble_model_1962/model.c b/tests/resources/generator/noble_model_1962/model.c index edde742db4..f1ddf05938 100644 --- a/tests/resources/generator/noble_model_1962/model.c +++ b/tests/resources/generator/noble_model_1962/model.c @@ -97,7 +97,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double *states, double *rates, double *constants) +void initialiseVariables(double *states, double *rates, double *constants, double *algebraic) { constants[0] = 12.0; constants[1] = 0.075; diff --git a/tests/resources/generator/noble_model_1962/model.h b/tests/resources/generator/noble_model_1962/model.h index c8b91de020..3814979f5b 100644 --- a/tests/resources/generator/noble_model_1962/model.h +++ b/tests/resources/generator/noble_model_1962/model.h @@ -31,7 +31,7 @@ double * createAlgebraicArray(); void deleteArray(double *array); -void initialiseVariables(double *states, double *rates, double *constants); +void initialiseVariables(double *states, double *rates, double *constants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/noble_model_1962/model.py b/tests/resources/generator/noble_model_1962/model.py index 00c9d24e7b..085181f77e 100644 --- a/tests/resources/generator/noble_model_1962/model.py +++ b/tests/resources/generator/noble_model_1962/model.py @@ -63,7 +63,7 @@ def create_algebraic_array(): return [nan]*ALGEBRAIC_COUNT -def initialise_variables(states, rates, constants): +def initialise_variables(states, rates, constants, algebraic): constants[0] = 12.0 constants[1] = 0.075 constants[2] = -60.0 diff --git a/tests/resources/generator/ode_computed_var_on_rhs/model.c b/tests/resources/generator/ode_computed_var_on_rhs/model.c index abdd008791..60f3dd752c 100644 --- a/tests/resources/generator/ode_computed_var_on_rhs/model.c +++ b/tests/resources/generator/ode_computed_var_on_rhs/model.c @@ -78,7 +78,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double *states, double *rates, double *constants) +void initialiseVariables(double *states, double *rates, double *constants, double *algebraic) { computedConstants[0] = 1.0; states[0] = 1.0; diff --git a/tests/resources/generator/ode_computed_var_on_rhs/model.h b/tests/resources/generator/ode_computed_var_on_rhs/model.h index 319a116d0f..351e9dc86f 100644 --- a/tests/resources/generator/ode_computed_var_on_rhs/model.h +++ b/tests/resources/generator/ode_computed_var_on_rhs/model.h @@ -31,7 +31,7 @@ double * createAlgebraicArray(); void deleteArray(double *array); -void initialiseVariables(double *states, double *rates, double *constants); +void initialiseVariables(double *states, double *rates, double *constants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/ode_computed_var_on_rhs/model.py b/tests/resources/generator/ode_computed_var_on_rhs/model.py index 775459ff5d..8588749b92 100644 --- a/tests/resources/generator/ode_computed_var_on_rhs/model.py +++ b/tests/resources/generator/ode_computed_var_on_rhs/model.py @@ -44,7 +44,7 @@ def create_algebraic_array(): return [nan]*ALGEBRAIC_COUNT -def initialise_variables(states, rates, constants): +def initialise_variables(states, rates, constants, algebraic): computed_constants[0] = 1.0 states[0] = 1.0 diff --git a/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.c b/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.c index ca6456d26e..c8b4178409 100644 --- a/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.c +++ b/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.c @@ -78,7 +78,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double *states, double *rates, double *constants) +void initialiseVariables(double *states, double *rates, double *constants, double *algebraic) { computedConstants[0] = 1.0; states[0] = 1.0; diff --git a/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.h b/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.h index 83c0783867..e05d298461 100644 --- a/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.h +++ b/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.h @@ -31,7 +31,7 @@ double * createAlgebraicArray(); void deleteArray(double *array); -void initialiseVariables(double *states, double *rates, double *constants); +void initialiseVariables(double *states, double *rates, double *constants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.py b/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.py index e6a977d946..c6e079a20a 100644 --- a/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.py +++ b/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.py @@ -44,7 +44,7 @@ def create_algebraic_array(): return [nan]*ALGEBRAIC_COUNT -def initialise_variables(states, rates, constants): +def initialise_variables(states, rates, constants, algebraic): computed_constants[0] = 1.0 states[0] = 1.0 diff --git a/tests/resources/generator/ode_const_var_on_rhs/model.c b/tests/resources/generator/ode_const_var_on_rhs/model.c index bc63cf66f4..3e90ce4181 100644 --- a/tests/resources/generator/ode_const_var_on_rhs/model.c +++ b/tests/resources/generator/ode_const_var_on_rhs/model.c @@ -78,7 +78,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double *states, double *rates, double *constants) +void initialiseVariables(double *states, double *rates, double *constants, double *algebraic) { constants[0] = 1.0; states[0] = 1.0; diff --git a/tests/resources/generator/ode_const_var_on_rhs/model.h b/tests/resources/generator/ode_const_var_on_rhs/model.h index 319a116d0f..351e9dc86f 100644 --- a/tests/resources/generator/ode_const_var_on_rhs/model.h +++ b/tests/resources/generator/ode_const_var_on_rhs/model.h @@ -31,7 +31,7 @@ double * createAlgebraicArray(); void deleteArray(double *array); -void initialiseVariables(double *states, double *rates, double *constants); +void initialiseVariables(double *states, double *rates, double *constants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/ode_const_var_on_rhs/model.py b/tests/resources/generator/ode_const_var_on_rhs/model.py index bb910e5e47..d55e85d838 100644 --- a/tests/resources/generator/ode_const_var_on_rhs/model.py +++ b/tests/resources/generator/ode_const_var_on_rhs/model.py @@ -44,7 +44,7 @@ def create_algebraic_array(): return [nan]*ALGEBRAIC_COUNT -def initialise_variables(states, rates, constants): +def initialise_variables(states, rates, constants, algebraic): constants[0] = 1.0 states[0] = 1.0 diff --git a/tests/resources/generator/ode_const_var_on_rhs_one_component/model.c b/tests/resources/generator/ode_const_var_on_rhs_one_component/model.c index e5fe086ff9..b5cd5dc86b 100644 --- a/tests/resources/generator/ode_const_var_on_rhs_one_component/model.c +++ b/tests/resources/generator/ode_const_var_on_rhs_one_component/model.c @@ -78,7 +78,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double *states, double *rates, double *constants) +void initialiseVariables(double *states, double *rates, double *constants, double *algebraic) { constants[0] = 1.0; states[0] = 1.0; diff --git a/tests/resources/generator/ode_const_var_on_rhs_one_component/model.h b/tests/resources/generator/ode_const_var_on_rhs_one_component/model.h index 83c0783867..e05d298461 100644 --- a/tests/resources/generator/ode_const_var_on_rhs_one_component/model.h +++ b/tests/resources/generator/ode_const_var_on_rhs_one_component/model.h @@ -31,7 +31,7 @@ double * createAlgebraicArray(); void deleteArray(double *array); -void initialiseVariables(double *states, double *rates, double *constants); +void initialiseVariables(double *states, double *rates, double *constants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/ode_const_var_on_rhs_one_component/model.py b/tests/resources/generator/ode_const_var_on_rhs_one_component/model.py index 6c83ec466c..b8dcc5c700 100644 --- a/tests/resources/generator/ode_const_var_on_rhs_one_component/model.py +++ b/tests/resources/generator/ode_const_var_on_rhs_one_component/model.py @@ -44,7 +44,7 @@ def create_algebraic_array(): return [nan]*ALGEBRAIC_COUNT -def initialise_variables(states, rates, constants): +def initialise_variables(states, rates, constants, algebraic): constants[0] = 1.0 states[0] = 1.0 diff --git a/tests/resources/generator/ode_constant_on_rhs/model.c b/tests/resources/generator/ode_constant_on_rhs/model.c index ef1c80b1de..1809eb460d 100644 --- a/tests/resources/generator/ode_constant_on_rhs/model.c +++ b/tests/resources/generator/ode_constant_on_rhs/model.c @@ -77,7 +77,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double *states, double *rates, double *constants) +void initialiseVariables(double *states, double *rates, double *constants, double *algebraic) { states[0] = 1.0; } diff --git a/tests/resources/generator/ode_constant_on_rhs/model.h b/tests/resources/generator/ode_constant_on_rhs/model.h index 319a116d0f..351e9dc86f 100644 --- a/tests/resources/generator/ode_constant_on_rhs/model.h +++ b/tests/resources/generator/ode_constant_on_rhs/model.h @@ -31,7 +31,7 @@ double * createAlgebraicArray(); void deleteArray(double *array); -void initialiseVariables(double *states, double *rates, double *constants); +void initialiseVariables(double *states, double *rates, double *constants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/ode_constant_on_rhs/model.py b/tests/resources/generator/ode_constant_on_rhs/model.py index 34d1e7d853..fc48945d12 100644 --- a/tests/resources/generator/ode_constant_on_rhs/model.py +++ b/tests/resources/generator/ode_constant_on_rhs/model.py @@ -43,7 +43,7 @@ def create_algebraic_array(): return [nan]*ALGEBRAIC_COUNT -def initialise_variables(states, rates, constants): +def initialise_variables(states, rates, constants, algebraic): states[0] = 1.0 diff --git a/tests/resources/generator/ode_constant_on_rhs_one_component/model.c b/tests/resources/generator/ode_constant_on_rhs_one_component/model.c index 796d807b38..900aefa1a5 100644 --- a/tests/resources/generator/ode_constant_on_rhs_one_component/model.c +++ b/tests/resources/generator/ode_constant_on_rhs_one_component/model.c @@ -77,7 +77,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double *states, double *rates, double *constants) +void initialiseVariables(double *states, double *rates, double *constants, double *algebraic) { states[0] = 1.0; } diff --git a/tests/resources/generator/ode_constant_on_rhs_one_component/model.h b/tests/resources/generator/ode_constant_on_rhs_one_component/model.h index 83c0783867..e05d298461 100644 --- a/tests/resources/generator/ode_constant_on_rhs_one_component/model.h +++ b/tests/resources/generator/ode_constant_on_rhs_one_component/model.h @@ -31,7 +31,7 @@ double * createAlgebraicArray(); void deleteArray(double *array); -void initialiseVariables(double *states, double *rates, double *constants); +void initialiseVariables(double *states, double *rates, double *constants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/ode_constant_on_rhs_one_component/model.py b/tests/resources/generator/ode_constant_on_rhs_one_component/model.py index bb143cbb1c..c9165859be 100644 --- a/tests/resources/generator/ode_constant_on_rhs_one_component/model.py +++ b/tests/resources/generator/ode_constant_on_rhs_one_component/model.py @@ -43,7 +43,7 @@ def create_algebraic_array(): return [nan]*ALGEBRAIC_COUNT -def initialise_variables(states, rates, constants): +def initialise_variables(states, rates, constants, algebraic): states[0] = 1.0 diff --git a/tests/resources/generator/ode_multiple_dependent_odes/model.c b/tests/resources/generator/ode_multiple_dependent_odes/model.c index f1165a8a12..c335d5c5ab 100644 --- a/tests/resources/generator/ode_multiple_dependent_odes/model.c +++ b/tests/resources/generator/ode_multiple_dependent_odes/model.c @@ -79,7 +79,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double *states, double *rates, double *constants) +void initialiseVariables(double *states, double *rates, double *constants, double *algebraic) { constants[0] = 1.0; states[0] = -2.0; diff --git a/tests/resources/generator/ode_multiple_dependent_odes/model.h b/tests/resources/generator/ode_multiple_dependent_odes/model.h index f46f3ac1be..c97d6682e3 100644 --- a/tests/resources/generator/ode_multiple_dependent_odes/model.h +++ b/tests/resources/generator/ode_multiple_dependent_odes/model.h @@ -31,7 +31,7 @@ double * createAlgebraicArray(); void deleteArray(double *array); -void initialiseVariables(double *states, double *rates, double *constants); +void initialiseVariables(double *states, double *rates, double *constants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/ode_multiple_dependent_odes/model.py b/tests/resources/generator/ode_multiple_dependent_odes/model.py index b442e1d9fb..3126c9e263 100644 --- a/tests/resources/generator/ode_multiple_dependent_odes/model.py +++ b/tests/resources/generator/ode_multiple_dependent_odes/model.py @@ -45,7 +45,7 @@ def create_algebraic_array(): return [nan]*ALGEBRAIC_COUNT -def initialise_variables(states, rates, constants): +def initialise_variables(states, rates, constants, algebraic): constants[0] = 1.0 states[0] = -2.0 states[1] = 0.0 diff --git a/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.c b/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.c index 7cfa8679f2..57ea6044a4 100644 --- a/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.c +++ b/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.c @@ -79,7 +79,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double *states, double *rates, double *constants) +void initialiseVariables(double *states, double *rates, double *constants, double *algebraic) { constants[0] = 1.0; states[0] = -2.0; diff --git a/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.h b/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.h index 96b38288f0..04133c21ef 100644 --- a/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.h +++ b/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.h @@ -31,7 +31,7 @@ double * createAlgebraicArray(); void deleteArray(double *array); -void initialiseVariables(double *states, double *rates, double *constants); +void initialiseVariables(double *states, double *rates, double *constants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.py b/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.py index 8dccc27dd4..20083c6594 100644 --- a/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.py +++ b/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.py @@ -45,7 +45,7 @@ def create_algebraic_array(): return [nan]*ALGEBRAIC_COUNT -def initialise_variables(states, rates, constants): +def initialise_variables(states, rates, constants, algebraic): constants[0] = 1.0 states[0] = -2.0 states[1] = 0.0 diff --git a/tests/resources/generator/ode_multiple_odes_with_same_name/model.c b/tests/resources/generator/ode_multiple_odes_with_same_name/model.c index 17f5507aea..fe2854380e 100644 --- a/tests/resources/generator/ode_multiple_odes_with_same_name/model.c +++ b/tests/resources/generator/ode_multiple_odes_with_same_name/model.c @@ -79,7 +79,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double *states, double *rates, double *constants) +void initialiseVariables(double *states, double *rates, double *constants, double *algebraic) { constants[0] = 1.0; states[0] = 1.0; diff --git a/tests/resources/generator/ode_multiple_odes_with_same_name/model.h b/tests/resources/generator/ode_multiple_odes_with_same_name/model.h index 0f14d5268c..83e1465e4d 100644 --- a/tests/resources/generator/ode_multiple_odes_with_same_name/model.h +++ b/tests/resources/generator/ode_multiple_odes_with_same_name/model.h @@ -31,7 +31,7 @@ double * createAlgebraicArray(); void deleteArray(double *array); -void initialiseVariables(double *states, double *rates, double *constants); +void initialiseVariables(double *states, double *rates, double *constants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/ode_multiple_odes_with_same_name/model.py b/tests/resources/generator/ode_multiple_odes_with_same_name/model.py index 7d64e5d32e..4c4eb266c3 100644 --- a/tests/resources/generator/ode_multiple_odes_with_same_name/model.py +++ b/tests/resources/generator/ode_multiple_odes_with_same_name/model.py @@ -45,7 +45,7 @@ def create_algebraic_array(): return [nan]*ALGEBRAIC_COUNT -def initialise_variables(states, rates, constants): +def initialise_variables(states, rates, constants, algebraic): constants[0] = 1.0 states[0] = 1.0 states[1] = 1.0 diff --git a/tests/resources/generator/ode_unknown_var_on_rhs/model.c b/tests/resources/generator/ode_unknown_var_on_rhs/model.c index 69a88e2436..9885566370 100644 --- a/tests/resources/generator/ode_unknown_var_on_rhs/model.c +++ b/tests/resources/generator/ode_unknown_var_on_rhs/model.c @@ -78,7 +78,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double *states, double *rates, double *constants) +void initialiseVariables(double *states, double *rates, double *constants, double *algebraic) { states[0] = 1.0; states[1] = 1.0; diff --git a/tests/resources/generator/ode_unknown_var_on_rhs/model.h b/tests/resources/generator/ode_unknown_var_on_rhs/model.h index 319a116d0f..351e9dc86f 100644 --- a/tests/resources/generator/ode_unknown_var_on_rhs/model.h +++ b/tests/resources/generator/ode_unknown_var_on_rhs/model.h @@ -31,7 +31,7 @@ double * createAlgebraicArray(); void deleteArray(double *array); -void initialiseVariables(double *states, double *rates, double *constants); +void initialiseVariables(double *states, double *rates, double *constants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/ode_unknown_var_on_rhs/model.py b/tests/resources/generator/ode_unknown_var_on_rhs/model.py index 0e06f10510..38df6674b7 100644 --- a/tests/resources/generator/ode_unknown_var_on_rhs/model.py +++ b/tests/resources/generator/ode_unknown_var_on_rhs/model.py @@ -44,7 +44,7 @@ def create_algebraic_array(): return [nan]*ALGEBRAIC_COUNT -def initialise_variables(states, rates, constants): +def initialise_variables(states, rates, constants, algebraic): states[0] = 1.0 states[1] = 1.0 diff --git a/tests/resources/generator/robertson_model_1966/model.dae.c b/tests/resources/generator/robertson_model_1966/model.dae.c index a25eebb914..f1bdfd8f01 100644 --- a/tests/resources/generator/robertson_model_1966/model.dae.c +++ b/tests/resources/generator/robertson_model_1966/model.dae.c @@ -117,7 +117,7 @@ void findRoot0(double voi, double *states, double *rates, double *variables) algebraic[0] = u[0]; } -void initialiseVariables(double *states, double *rates, double *constants) +void initialiseVariables(double *states, double *rates, double *constants, double *algebraic) { constants[0] = 0.04; constants[1] = 1.0e4; diff --git a/tests/resources/generator/robertson_model_1966/model.dae.h b/tests/resources/generator/robertson_model_1966/model.dae.h index bffe009c7c..c329027254 100644 --- a/tests/resources/generator/robertson_model_1966/model.dae.h +++ b/tests/resources/generator/robertson_model_1966/model.dae.h @@ -31,7 +31,7 @@ double * createAlgebraicArray(); void deleteArray(double *array); -void initialiseVariables(double *states, double *rates, double *constants); +void initialiseVariables(double *states, double *rates, double *constants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/robertson_model_1966/model.dae.py b/tests/resources/generator/robertson_model_1966/model.dae.py index bab387d15a..97b1fa627a 100644 --- a/tests/resources/generator/robertson_model_1966/model.dae.py +++ b/tests/resources/generator/robertson_model_1966/model.dae.py @@ -73,7 +73,7 @@ def find_root_0(voi, states, rates, variables): algebraic[0] = u[0] -def initialise_variables(states, rates, constants): +def initialise_variables(states, rates, constants, algebraic): constants[0] = 0.04 constants[1] = 1.0e4 constants[2] = 3.0e7 diff --git a/tests/resources/generator/robertson_model_1966/model.ode.c b/tests/resources/generator/robertson_model_1966/model.ode.c index 403affc055..d304b17f9f 100644 --- a/tests/resources/generator/robertson_model_1966/model.ode.c +++ b/tests/resources/generator/robertson_model_1966/model.ode.c @@ -83,7 +83,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double *states, double *rates, double *constants) +void initialiseVariables(double *states, double *rates, double *constants, double *algebraic) { constants[0] = 0.04; constants[1] = 1.0e4; diff --git a/tests/resources/generator/robertson_model_1966/model.ode.h b/tests/resources/generator/robertson_model_1966/model.ode.h index bffe009c7c..c329027254 100644 --- a/tests/resources/generator/robertson_model_1966/model.ode.h +++ b/tests/resources/generator/robertson_model_1966/model.ode.h @@ -31,7 +31,7 @@ double * createAlgebraicArray(); void deleteArray(double *array); -void initialiseVariables(double *states, double *rates, double *constants); +void initialiseVariables(double *states, double *rates, double *constants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/robertson_model_1966/model.ode.py b/tests/resources/generator/robertson_model_1966/model.ode.py index 1faef1ab5a..c4401eb268 100644 --- a/tests/resources/generator/robertson_model_1966/model.ode.py +++ b/tests/resources/generator/robertson_model_1966/model.ode.py @@ -49,7 +49,7 @@ def create_algebraic_array(): return [nan]*ALGEBRAIC_COUNT -def initialise_variables(states, rates, constants): +def initialise_variables(states, rates, constants, algebraic): constants[0] = 0.04 constants[1] = 1.0e4 constants[2] = 3.0e7 diff --git a/tests/resources/generator/sine_model_imports/model.c b/tests/resources/generator/sine_model_imports/model.c index d13cfac716..afc9fc26ab 100644 --- a/tests/resources/generator/sine_model_imports/model.c +++ b/tests/resources/generator/sine_model_imports/model.c @@ -87,7 +87,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double *states, double *rates, double *constants) +void initialiseVariables(double *states, double *rates, double *constants, double *algebraic) { constants[0] = 0.0; constants[1] = 0.75; diff --git a/tests/resources/generator/sine_model_imports/model.h b/tests/resources/generator/sine_model_imports/model.h index d6150b9fc7..b3f715a2b6 100644 --- a/tests/resources/generator/sine_model_imports/model.h +++ b/tests/resources/generator/sine_model_imports/model.h @@ -31,7 +31,7 @@ double * createAlgebraicArray(); void deleteArray(double *array); -void initialiseVariables(double *states, double *rates, double *constants); +void initialiseVariables(double *states, double *rates, double *constants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/sine_model_imports/model.py b/tests/resources/generator/sine_model_imports/model.py index 98456bf5fc..ae30609e47 100644 --- a/tests/resources/generator/sine_model_imports/model.py +++ b/tests/resources/generator/sine_model_imports/model.py @@ -57,7 +57,7 @@ def create_algebraic_array(): return [nan]*ALGEBRAIC_COUNT -def initialise_variables(states, rates, constants): +def initialise_variables(states, rates, constants, algebraic): constants[0] = 0.0 constants[1] = 0.75 computed_constants[0] = 2.0/3.14159265358979 diff --git a/tests/resources/generator/unknown_variable_as_external_variable/model.c b/tests/resources/generator/unknown_variable_as_external_variable/model.c index a99d9f1467..0103461a2c 100644 --- a/tests/resources/generator/unknown_variable_as_external_variable/model.c +++ b/tests/resources/generator/unknown_variable_as_external_variable/model.c @@ -84,7 +84,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double *constants, ExternalVariable externalVariable) +void initialiseVariables(double *constants, double *algebraic, ExternalVariable externalVariable) { constants[0] = 1.1; constants[1] = 21262500.0; diff --git a/tests/resources/generator/unknown_variable_as_external_variable/model.h b/tests/resources/generator/unknown_variable_as_external_variable/model.h index 7ddf985528..2bb86e6fb2 100644 --- a/tests/resources/generator/unknown_variable_as_external_variable/model.h +++ b/tests/resources/generator/unknown_variable_as_external_variable/model.h @@ -32,6 +32,6 @@ void deleteArray(double *array); typedef double (* ExternalVariable)(double *variables, size_t index); -void initialiseVariables(double *constants, ExternalVariable externalVariable); +void initialiseVariables(double *constants, double *algebraic, ExternalVariable externalVariable); void computeComputedConstants(double *constants, double *computedConstants); void computeVariables(double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); diff --git a/tests/resources/generator/unknown_variable_as_external_variable/model.py b/tests/resources/generator/unknown_variable_as_external_variable/model.py index 06195b207b..48f6272965 100644 --- a/tests/resources/generator/unknown_variable_as_external_variable/model.py +++ b/tests/resources/generator/unknown_variable_as_external_variable/model.py @@ -51,7 +51,7 @@ def create_externals_array(): return [nan]*EXTERNAL_COUNT -def initialise_variables(constants, external_variable): +def initialise_variables(constants, algebraic, external_variable): constants[0] = 1.1 constants[1] = 21262500.0 constants[2] = 150.0 diff --git a/tests/resources/generator/variable_initialised_using_a_constant/model.c b/tests/resources/generator/variable_initialised_using_a_constant/model.c index 0c99f7c241..778e44ef94 100644 --- a/tests/resources/generator/variable_initialised_using_a_constant/model.c +++ b/tests/resources/generator/variable_initialised_using_a_constant/model.c @@ -78,7 +78,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double *states, double *rates, double *constants) +void initialiseVariables(double *states, double *rates, double *constants, double *algebraic) { constants[0] = 7.0; states[0] = constants[0]; diff --git a/tests/resources/generator/variable_initialised_using_a_constant/model.h b/tests/resources/generator/variable_initialised_using_a_constant/model.h index 18bcd588e1..dac6bf5784 100644 --- a/tests/resources/generator/variable_initialised_using_a_constant/model.h +++ b/tests/resources/generator/variable_initialised_using_a_constant/model.h @@ -31,7 +31,7 @@ double * createAlgebraicArray(); void deleteArray(double *array); -void initialiseVariables(double *states, double *rates, double *constants); +void initialiseVariables(double *states, double *rates, double *constants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/variable_initialised_using_a_constant/model.py b/tests/resources/generator/variable_initialised_using_a_constant/model.py index e1fdff4331..34bcc5c3a8 100644 --- a/tests/resources/generator/variable_initialised_using_a_constant/model.py +++ b/tests/resources/generator/variable_initialised_using_a_constant/model.py @@ -44,7 +44,7 @@ def create_algebraic_array(): return [nan]*ALGEBRAIC_COUNT -def initialise_variables(states, rates, constants): +def initialise_variables(states, rates, constants, algebraic): constants[0] = 7.0 states[0] = constants[0] From fa807fb43ec1240abb34237d20e2667a14c6d6f0 Mon Sep 17 00:00:00 2001 From: Alan Garny Date: Thu, 15 Aug 2024 11:30:29 +0200 Subject: [PATCH 24/85] GeneratorProfile: fixed a small issue with our Python profile. --- src/generatorprofile.cpp | 4 +++- src/generatorprofilesha1values.h | 2 +- tests/resources/coverage/generator/model.modified.profile.py | 5 +++-- tests/resources/coverage/generator/model.py | 5 +++-- .../generator/algebraic_eqn_derivative_on_rhs/model.py | 5 +++-- .../algebraic_eqn_derivative_on_rhs_one_component/model.py | 5 +++-- .../generator/algebraic_eqn_state_var_on_rhs/model.py | 5 +++-- .../algebraic_eqn_state_var_on_rhs_one_component/model.py | 5 +++-- .../generator/cellml_mappings_and_encapsulations/model.py | 5 +++-- .../cellml_state_initialised_using_variable/model.py | 5 +++-- tests/resources/generator/cellml_unit_scaling_rate/model.py | 5 +++-- tests/resources/generator/cellml_unit_scaling_state/model.py | 5 +++-- .../model.py | 5 +++-- .../model.py | 5 +++-- .../generator/cellml_unit_scaling_voi_direct/model.py | 5 +++-- .../generator/cellml_unit_scaling_voi_indirect/model.py | 5 +++-- tests/resources/generator/dae_cellml_1_1_model/model.py | 5 +++-- tests/resources/generator/dependent_eqns/model.py | 5 +++-- .../model.py | 5 +++-- .../model.py | 5 +++-- .../hodgkin_huxley_squid_axon_model_1952/model.algebraic.py | 5 +++-- .../model.computed.constant.py | 5 +++-- .../hodgkin_huxley_squid_axon_model_1952/model.constant.py | 5 +++-- .../hodgkin_huxley_squid_axon_model_1952/model.dae.py | 5 +++-- .../model.dependent.algebraic.py | 5 +++-- .../model.dependent.computed.constant.py | 5 +++-- .../model.dependent.constant.py | 5 +++-- .../model.dependent.state.py | 5 +++-- .../hodgkin_huxley_squid_axon_model_1952/model.external.py | 5 +++-- .../generator/hodgkin_huxley_squid_axon_model_1952/model.py | 5 +++-- .../hodgkin_huxley_squid_axon_model_1952/model.state.py | 5 +++-- tests/resources/generator/noble_model_1962/model.py | 5 +++-- tests/resources/generator/ode_computed_var_on_rhs/model.py | 5 +++-- .../generator/ode_computed_var_on_rhs_one_component/model.py | 5 +++-- tests/resources/generator/ode_const_var_on_rhs/model.py | 5 +++-- .../generator/ode_const_var_on_rhs_one_component/model.py | 5 +++-- tests/resources/generator/ode_constant_on_rhs/model.py | 5 +++-- .../generator/ode_constant_on_rhs_one_component/model.py | 5 +++-- .../resources/generator/ode_multiple_dependent_odes/model.py | 5 +++-- .../ode_multiple_dependent_odes_one_component/model.py | 5 +++-- .../generator/ode_multiple_odes_with_same_name/model.py | 5 +++-- tests/resources/generator/ode_unknown_var_on_rhs/model.py | 5 +++-- tests/resources/generator/robertson_model_1966/model.dae.py | 5 +++-- tests/resources/generator/robertson_model_1966/model.ode.py | 5 +++-- tests/resources/generator/sine_model_imports/model.py | 5 +++-- .../generator/variable_initialised_using_a_constant/model.py | 5 +++-- 46 files changed, 136 insertions(+), 90 deletions(-) diff --git a/src/generatorprofile.cpp b/src/generatorprofile.cpp index 18d29dc32b..997fa4bfbc 100644 --- a/src/generatorprofile.cpp +++ b/src/generatorprofile.cpp @@ -707,7 +707,9 @@ void GeneratorProfile::GeneratorProfileImpl::loadProfile(GeneratorProfile::Profi mImplementationVoiInfoString = "VOI_INFO = [CODE]\n"; mInterfaceStateInfoString = ""; - mImplementationStateInfoString = "STATE_INFO = [CODE]\n"; + mImplementationStateInfoString = "STATE_INFO = [\n" + "[CODE]" + "]\n"; mInterfaceConstantInfoString = ""; mImplementationConstantInfoString = "CONSTANT_INFO = [\n" diff --git a/src/generatorprofilesha1values.h b/src/generatorprofilesha1values.h index 2b82901571..cf522db03f 100644 --- a/src/generatorprofilesha1values.h +++ b/src/generatorprofilesha1values.h @@ -25,6 +25,6 @@ namespace libcellml { * See docs/dev_utilities.rst for further information. */ static const char C_GENERATOR_PROFILE_SHA1[] = "2d4d14df0a454d95e32e1172503d529834c42588"; -static const char PYTHON_GENERATOR_PROFILE_SHA1[] = "9f79e69847b6ec2faeb7f56f476ef2542a901b1f"; +static const char PYTHON_GENERATOR_PROFILE_SHA1[] = "5ff1e7cc237b3e7eb1153b6d421df842731c6394"; } // namespace libcellml diff --git a/tests/resources/coverage/generator/model.modified.profile.py b/tests/resources/coverage/generator/model.modified.profile.py index 97288e284c..0ebd3706cc 100644 --- a/tests/resources/coverage/generator/model.modified.profile.py +++ b/tests/resources/coverage/generator/model.modified.profile.py @@ -14,8 +14,9 @@ VOI_INFO = {"name": "t", "units": "second", "component": "my_component"} -STATE_INFO = {"name": "x", "units": "dimensionless", "component": "my_component"} - +STATE_INFO = [ + {"name": "x", "units": "dimensionless", "component": "my_component"} +] CONSTANT_INFO = [ {"name": "m", "units": "dimensionless", "component": "my_component"}, diff --git a/tests/resources/coverage/generator/model.py b/tests/resources/coverage/generator/model.py index 87832d45cb..41f5145cd5 100644 --- a/tests/resources/coverage/generator/model.py +++ b/tests/resources/coverage/generator/model.py @@ -14,8 +14,9 @@ VOI_INFO = {"name": "t", "units": "second", "component": "my_component"} -STATE_INFO = {"name": "x", "units": "dimensionless", "component": "my_component"} - +STATE_INFO = [ + {"name": "x", "units": "dimensionless", "component": "my_component"} +] CONSTANT_INFO = [ {"name": "m", "units": "dimensionless", "component": "my_component"}, diff --git a/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.py b/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.py index 273c43ba43..c209063f4f 100644 --- a/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.py +++ b/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.py @@ -14,8 +14,9 @@ VOI_INFO = {"name": "t", "units": "second", "component": "environment"} -STATE_INFO = {"name": "v", "units": "dimensionless", "component": "my_ode"} - +STATE_INFO = [ + {"name": "v", "units": "dimensionless", "component": "my_ode"} +] CONSTANT_INFO = [ ] diff --git a/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.py b/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.py index eb6e7b4244..bf7e73949b 100644 --- a/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.py +++ b/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.py @@ -14,8 +14,9 @@ VOI_INFO = {"name": "t", "units": "second", "component": "my_component"} -STATE_INFO = {"name": "v", "units": "dimensionless", "component": "my_component"} - +STATE_INFO = [ + {"name": "v", "units": "dimensionless", "component": "my_component"} +] CONSTANT_INFO = [ ] diff --git a/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.py b/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.py index 2407fcadf3..461603beaf 100644 --- a/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.py +++ b/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.py @@ -14,8 +14,9 @@ VOI_INFO = {"name": "t", "units": "second", "component": "environment"} -STATE_INFO = {"name": "x", "units": "dimensionless", "component": "my_ode"} - +STATE_INFO = [ + {"name": "x", "units": "dimensionless", "component": "my_ode"} +] CONSTANT_INFO = [ ] diff --git a/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.py b/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.py index 4eda262a83..626e04c14f 100644 --- a/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.py +++ b/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.py @@ -14,8 +14,9 @@ VOI_INFO = {"name": "t", "units": "second", "component": "my_model"} -STATE_INFO = {"name": "x", "units": "dimensionless", "component": "my_model"} - +STATE_INFO = [ + {"name": "x", "units": "dimensionless", "component": "my_model"} +] CONSTANT_INFO = [ ] diff --git a/tests/resources/generator/cellml_mappings_and_encapsulations/model.py b/tests/resources/generator/cellml_mappings_and_encapsulations/model.py index ce8c7b28a4..cc23dc6d18 100644 --- a/tests/resources/generator/cellml_mappings_and_encapsulations/model.py +++ b/tests/resources/generator/cellml_mappings_and_encapsulations/model.py @@ -14,9 +14,10 @@ VOI_INFO = {"name": "t", "units": "ms", "component": "environment"} -STATE_INFO = {"name": "y", "units": "mM", "component": "circle_y_implementation"}, +STATE_INFO = [ + {"name": "y", "units": "mM", "component": "circle_y_implementation"}, {"name": "x", "units": "mM", "component": "circle_x"} - +] CONSTANT_INFO = [ ] diff --git a/tests/resources/generator/cellml_state_initialised_using_variable/model.py b/tests/resources/generator/cellml_state_initialised_using_variable/model.py index ec5d060f27..c05b32ce6b 100644 --- a/tests/resources/generator/cellml_state_initialised_using_variable/model.py +++ b/tests/resources/generator/cellml_state_initialised_using_variable/model.py @@ -14,8 +14,9 @@ VOI_INFO = {"name": "t", "units": "ms", "component": "environment"} -STATE_INFO = {"name": "x", "units": "mV", "component": "main"} - +STATE_INFO = [ + {"name": "x", "units": "mV", "component": "main"} +] CONSTANT_INFO = [ {"name": "k", "units": "mV", "component": "constants"} diff --git a/tests/resources/generator/cellml_unit_scaling_rate/model.py b/tests/resources/generator/cellml_unit_scaling_rate/model.py index 3be023c6f6..1e36dfbf75 100644 --- a/tests/resources/generator/cellml_unit_scaling_rate/model.py +++ b/tests/resources/generator/cellml_unit_scaling_rate/model.py @@ -14,8 +14,9 @@ VOI_INFO = {"name": "t", "units": "ms", "component": "environment"} -STATE_INFO = {"name": "k", "units": "mM", "component": "states"} - +STATE_INFO = [ + {"name": "k", "units": "mM", "component": "states"} +] CONSTANT_INFO = [ ] diff --git a/tests/resources/generator/cellml_unit_scaling_state/model.py b/tests/resources/generator/cellml_unit_scaling_state/model.py index 8ee327e2a5..b76901fc5b 100644 --- a/tests/resources/generator/cellml_unit_scaling_state/model.py +++ b/tests/resources/generator/cellml_unit_scaling_state/model.py @@ -14,8 +14,9 @@ VOI_INFO = {"name": "t", "units": "ms", "component": "environment"} -STATE_INFO = {"name": "k", "units": "mM", "component": "states"} - +STATE_INFO = [ + {"name": "k", "units": "mM", "component": "states"} +] CONSTANT_INFO = [ ] diff --git a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.py b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.py index f406773578..212fca2d8a 100644 --- a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.py +++ b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.py @@ -14,9 +14,10 @@ VOI_INFO = {"name": "t", "units": "ms", "component": "environment"} -STATE_INFO = {"name": "k1", "units": "mM", "component": "main"}, +STATE_INFO = [ + {"name": "k1", "units": "mM", "component": "main"}, {"name": "k2", "units": "M", "component": "main"} - +] CONSTANT_INFO = [ ] diff --git a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.py b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.py index aff5ec527d..9f1c08de9a 100644 --- a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.py +++ b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.py @@ -14,9 +14,10 @@ VOI_INFO = {"name": "t", "units": "ms", "component": "environment"} -STATE_INFO = {"name": "k1", "units": "mM", "component": "main"}, +STATE_INFO = [ + {"name": "k1", "units": "mM", "component": "main"}, {"name": "k2", "units": "M", "component": "main"} - +] CONSTANT_INFO = [ {"name": "k1_cst", "units": "mM", "component": "constants"}, diff --git a/tests/resources/generator/cellml_unit_scaling_voi_direct/model.py b/tests/resources/generator/cellml_unit_scaling_voi_direct/model.py index bd8f7d2534..bed26c2782 100644 --- a/tests/resources/generator/cellml_unit_scaling_voi_direct/model.py +++ b/tests/resources/generator/cellml_unit_scaling_voi_direct/model.py @@ -14,9 +14,10 @@ VOI_INFO = {"name": "t", "units": "ms", "component": "environment"} -STATE_INFO = {"name": "x", "units": "dimensionless", "component": "main"}, +STATE_INFO = [ + {"name": "x", "units": "dimensionless", "component": "main"}, {"name": "y", "units": "dimensionless", "component": "main"} - +] CONSTANT_INFO = [ ] diff --git a/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.py b/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.py index 110dcd6ff9..5d5db39450 100644 --- a/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.py +++ b/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.py @@ -14,10 +14,11 @@ VOI_INFO = {"name": "t", "units": "second", "component": "environment"} -STATE_INFO = {"name": "x", "units": "metre", "component": "t_in_s"}, +STATE_INFO = [ + {"name": "x", "units": "metre", "component": "t_in_s"}, {"name": "x", "units": "metre", "component": "t_in_ms"}, {"name": "x", "units": "metre", "component": "t_in_ks"} - +] CONSTANT_INFO = [ ] diff --git a/tests/resources/generator/dae_cellml_1_1_model/model.py b/tests/resources/generator/dae_cellml_1_1_model/model.py index 9746c76a65..4b0ae9b510 100644 --- a/tests/resources/generator/dae_cellml_1_1_model/model.py +++ b/tests/resources/generator/dae_cellml_1_1_model/model.py @@ -14,9 +14,10 @@ VOI_INFO = {"name": "t", "units": "second", "component": "main"} -STATE_INFO = {"name": "q_1", "units": "coulomb", "component": "main"}, +STATE_INFO = [ + {"name": "q_1", "units": "coulomb", "component": "main"}, {"name": "v_3", "units": "C_per_s", "component": "main"} - +] CONSTANT_INFO = [ {"name": "v_in", "units": "C_per_s", "component": "main"}, diff --git a/tests/resources/generator/dependent_eqns/model.py b/tests/resources/generator/dependent_eqns/model.py index 8330f78656..b415fdb96b 100644 --- a/tests/resources/generator/dependent_eqns/model.py +++ b/tests/resources/generator/dependent_eqns/model.py @@ -14,8 +14,9 @@ VOI_INFO = {"name": "time", "units": "second", "component": "my_component"} -STATE_INFO = {"name": "x", "units": "dimensionless", "component": "my_component"} - +STATE_INFO = [ + {"name": "x", "units": "dimensionless", "component": "my_component"} +] CONSTANT_INFO = [ ] diff --git a/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.py b/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.py index bad1cbbfc0..0a32422fcc 100644 --- a/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.py +++ b/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.py @@ -14,7 +14,8 @@ VOI_INFO = {"name": "time", "units": "second", "component": "environment"} -STATE_INFO = {"name": "Ca_sub", "units": "millimolar", "component": "Ca_dynamics"}, +STATE_INFO = [ + {"name": "Ca_sub", "units": "millimolar", "component": "Ca_dynamics"}, {"name": "Nai_", "units": "millimolar", "component": "Nai_concentration"}, {"name": "Ca_jsr", "units": "millimolar", "component": "Ca_dynamics"}, {"name": "O", "units": "dimensionless", "component": "Ca_SR_release"}, @@ -47,7 +48,7 @@ {"name": "paS", "units": "dimensionless", "component": "i_Kr_pa_gate"}, {"name": "n", "units": "dimensionless", "component": "i_Ks_n_gate"}, {"name": "a", "units": "dimensionless", "component": "i_KACh_a_gate"} - +] CONSTANT_INFO = [ {"name": "ACh", "units": "millimolar", "component": "Rate_modulation_experiments"}, diff --git a/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.py b/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.py index ae144daccf..5366a19b31 100644 --- a/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.py +++ b/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.py @@ -14,7 +14,8 @@ VOI_INFO = {"name": "time", "units": "second", "component": "environment"} -STATE_INFO = {"name": "V", "units": "millivolt", "component": "membrane"}, +STATE_INFO = [ + {"name": "V", "units": "millivolt", "component": "membrane"}, {"name": "m", "units": "dimensionless", "component": "sodium_current_m_gate"}, {"name": "h1", "units": "dimensionless", "component": "sodium_current_h_gate"}, {"name": "h2", "units": "dimensionless", "component": "sodium_current_h_gate"}, @@ -29,7 +30,7 @@ {"name": "P_as", "units": "dimensionless", "component": "rapid_delayed_rectifying_potassium_current_P_as_gate"}, {"name": "xs", "units": "dimensionless", "component": "slow_delayed_rectifying_potassium_current_xs_gate"}, {"name": "y", "units": "dimensionless", "component": "hyperpolarisation_activated_current_y_gate"} - +] CONSTANT_INFO = [ {"name": "dCell", "units": "dimensionless", "component": "membrane"}, diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.py index b5a866b3e9..456ad3deb4 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.py @@ -15,11 +15,12 @@ VOI_INFO = {"name": "time", "units": "millisecond", "component": "environment"} -STATE_INFO = {"name": "V", "units": "millivolt", "component": "membrane"}, +STATE_INFO = [ + {"name": "V", "units": "millivolt", "component": "membrane"}, {"name": "h", "units": "dimensionless", "component": "sodium_channel_h_gate"}, {"name": "m", "units": "dimensionless", "component": "sodium_channel_m_gate"}, {"name": "n", "units": "dimensionless", "component": "potassium_channel_n_gate"} - +] CONSTANT_INFO = [ {"name": "Cm", "units": "microF_per_cm2", "component": "membrane"}, diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.py index 814ad44aa5..aa2ab1b23a 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.py @@ -15,11 +15,12 @@ VOI_INFO = {"name": "time", "units": "millisecond", "component": "environment"} -STATE_INFO = {"name": "V", "units": "millivolt", "component": "membrane"}, +STATE_INFO = [ + {"name": "V", "units": "millivolt", "component": "membrane"}, {"name": "h", "units": "dimensionless", "component": "sodium_channel_h_gate"}, {"name": "m", "units": "dimensionless", "component": "sodium_channel_m_gate"}, {"name": "n", "units": "dimensionless", "component": "potassium_channel_n_gate"} - +] CONSTANT_INFO = [ {"name": "Cm", "units": "microF_per_cm2", "component": "membrane"}, diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.py index 601f71d5c5..fabc48c20f 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.py @@ -15,11 +15,12 @@ VOI_INFO = {"name": "time", "units": "millisecond", "component": "environment"} -STATE_INFO = {"name": "V", "units": "millivolt", "component": "membrane"}, +STATE_INFO = [ + {"name": "V", "units": "millivolt", "component": "membrane"}, {"name": "h", "units": "dimensionless", "component": "sodium_channel_h_gate"}, {"name": "m", "units": "dimensionless", "component": "sodium_channel_m_gate"}, {"name": "n", "units": "dimensionless", "component": "potassium_channel_n_gate"} - +] CONSTANT_INFO = [ {"name": "E_R", "units": "millivolt", "component": "membrane"}, diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.py index 39a4dddc73..d1fba9fff0 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.py @@ -14,11 +14,12 @@ VOI_INFO = {"name": "time", "units": "millisecond", "component": "environment"} -STATE_INFO = {"name": "V", "units": "millivolt", "component": "membrane"}, +STATE_INFO = [ + {"name": "V", "units": "millivolt", "component": "membrane"}, {"name": "h", "units": "dimensionless", "component": "sodium_channel_h_gate"}, {"name": "m", "units": "dimensionless", "component": "sodium_channel_m_gate"}, {"name": "n", "units": "dimensionless", "component": "potassium_channel_n_gate"} - +] CONSTANT_INFO = [ {"name": "Cm", "units": "microF_per_cm2", "component": "membrane"}, diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.py index e30ee484bc..81e680d3de 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.py @@ -15,11 +15,12 @@ VOI_INFO = {"name": "time", "units": "millisecond", "component": "environment"} -STATE_INFO = {"name": "V", "units": "millivolt", "component": "membrane"}, +STATE_INFO = [ + {"name": "V", "units": "millivolt", "component": "membrane"}, {"name": "h", "units": "dimensionless", "component": "sodium_channel_h_gate"}, {"name": "m", "units": "dimensionless", "component": "sodium_channel_m_gate"}, {"name": "n", "units": "dimensionless", "component": "potassium_channel_n_gate"} - +] CONSTANT_INFO = [ {"name": "Cm", "units": "microF_per_cm2", "component": "membrane"}, diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.py index 5c83fafb02..9cf6ce4c14 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.py @@ -15,11 +15,12 @@ VOI_INFO = {"name": "time", "units": "millisecond", "component": "environment"} -STATE_INFO = {"name": "V", "units": "millivolt", "component": "membrane"}, +STATE_INFO = [ + {"name": "V", "units": "millivolt", "component": "membrane"}, {"name": "h", "units": "dimensionless", "component": "sodium_channel_h_gate"}, {"name": "m", "units": "dimensionless", "component": "sodium_channel_m_gate"}, {"name": "n", "units": "dimensionless", "component": "potassium_channel_n_gate"} - +] CONSTANT_INFO = [ {"name": "Cm", "units": "microF_per_cm2", "component": "membrane"}, diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.py index 11c18b3eb3..1dde1527f6 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.py @@ -15,11 +15,12 @@ VOI_INFO = {"name": "time", "units": "millisecond", "component": "environment"} -STATE_INFO = {"name": "V", "units": "millivolt", "component": "membrane"}, +STATE_INFO = [ + {"name": "V", "units": "millivolt", "component": "membrane"}, {"name": "h", "units": "dimensionless", "component": "sodium_channel_h_gate"}, {"name": "m", "units": "dimensionless", "component": "sodium_channel_m_gate"}, {"name": "n", "units": "dimensionless", "component": "potassium_channel_n_gate"} - +] CONSTANT_INFO = [ {"name": "E_R", "units": "millivolt", "component": "membrane"}, diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.py index 72335596c2..9fd00c61bd 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.py @@ -15,9 +15,10 @@ VOI_INFO = {"name": "time", "units": "millisecond", "component": "environment"} -STATE_INFO = {"name": "h", "units": "dimensionless", "component": "sodium_channel_h_gate"}, +STATE_INFO = [ + {"name": "h", "units": "dimensionless", "component": "sodium_channel_h_gate"}, {"name": "n", "units": "dimensionless", "component": "potassium_channel_n_gate"} - +] CONSTANT_INFO = [ {"name": "Cm", "units": "microF_per_cm2", "component": "membrane"}, diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.py index e61d980168..8813c2b024 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.py @@ -15,10 +15,11 @@ VOI_INFO = {"name": "time", "units": "millisecond", "component": "environment"} -STATE_INFO = {"name": "h", "units": "dimensionless", "component": "sodium_channel_h_gate"}, +STATE_INFO = [ + {"name": "h", "units": "dimensionless", "component": "sodium_channel_h_gate"}, {"name": "m", "units": "dimensionless", "component": "sodium_channel_m_gate"}, {"name": "n", "units": "dimensionless", "component": "potassium_channel_n_gate"} - +] CONSTANT_INFO = [ {"name": "Cm", "units": "microF_per_cm2", "component": "membrane"}, diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.py index f8e93fd7e1..82b0b193e9 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.py @@ -14,11 +14,12 @@ VOI_INFO = {"name": "time", "units": "millisecond", "component": "environment"} -STATE_INFO = {"name": "V", "units": "millivolt", "component": "membrane"}, +STATE_INFO = [ + {"name": "V", "units": "millivolt", "component": "membrane"}, {"name": "h", "units": "dimensionless", "component": "sodium_channel_h_gate"}, {"name": "m", "units": "dimensionless", "component": "sodium_channel_m_gate"}, {"name": "n", "units": "dimensionless", "component": "potassium_channel_n_gate"} - +] CONSTANT_INFO = [ {"name": "Cm", "units": "microF_per_cm2", "component": "membrane"}, diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.py index 465f5eeecb..c13120d5c4 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.py @@ -15,10 +15,11 @@ VOI_INFO = {"name": "time", "units": "millisecond", "component": "environment"} -STATE_INFO = {"name": "V", "units": "millivolt", "component": "membrane"}, +STATE_INFO = [ + {"name": "V", "units": "millivolt", "component": "membrane"}, {"name": "h", "units": "dimensionless", "component": "sodium_channel_h_gate"}, {"name": "n", "units": "dimensionless", "component": "potassium_channel_n_gate"} - +] CONSTANT_INFO = [ {"name": "Cm", "units": "microF_per_cm2", "component": "membrane"}, diff --git a/tests/resources/generator/noble_model_1962/model.py b/tests/resources/generator/noble_model_1962/model.py index 085181f77e..04b15d26b7 100644 --- a/tests/resources/generator/noble_model_1962/model.py +++ b/tests/resources/generator/noble_model_1962/model.py @@ -14,11 +14,12 @@ VOI_INFO = {"name": "time", "units": "millisecond", "component": "environment"} -STATE_INFO = {"name": "V", "units": "millivolt", "component": "membrane"}, +STATE_INFO = [ + {"name": "V", "units": "millivolt", "component": "membrane"}, {"name": "m", "units": "dimensionless", "component": "sodium_channel_m_gate"}, {"name": "h", "units": "dimensionless", "component": "sodium_channel_h_gate"}, {"name": "n", "units": "dimensionless", "component": "potassium_channel_n_gate"} - +] CONSTANT_INFO = [ {"name": "Cm", "units": "microF_per_cm2", "component": "membrane"}, diff --git a/tests/resources/generator/ode_computed_var_on_rhs/model.py b/tests/resources/generator/ode_computed_var_on_rhs/model.py index 8588749b92..607d6c441e 100644 --- a/tests/resources/generator/ode_computed_var_on_rhs/model.py +++ b/tests/resources/generator/ode_computed_var_on_rhs/model.py @@ -14,8 +14,9 @@ VOI_INFO = {"name": "t", "units": "second", "component": "environment"} -STATE_INFO = {"name": "x", "units": "dimensionless", "component": "my_ode"} - +STATE_INFO = [ + {"name": "x", "units": "dimensionless", "component": "my_ode"} +] CONSTANT_INFO = [ ] diff --git a/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.py b/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.py index c6e079a20a..11486d4f88 100644 --- a/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.py +++ b/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.py @@ -14,8 +14,9 @@ VOI_INFO = {"name": "t", "units": "second", "component": "my_component"} -STATE_INFO = {"name": "x", "units": "dimensionless", "component": "my_component"} - +STATE_INFO = [ + {"name": "x", "units": "dimensionless", "component": "my_component"} +] CONSTANT_INFO = [ ] diff --git a/tests/resources/generator/ode_const_var_on_rhs/model.py b/tests/resources/generator/ode_const_var_on_rhs/model.py index d55e85d838..95b5ade5f5 100644 --- a/tests/resources/generator/ode_const_var_on_rhs/model.py +++ b/tests/resources/generator/ode_const_var_on_rhs/model.py @@ -14,8 +14,9 @@ VOI_INFO = {"name": "t", "units": "second", "component": "environment"} -STATE_INFO = {"name": "x", "units": "dimensionless", "component": "my_ode"} - +STATE_INFO = [ + {"name": "x", "units": "dimensionless", "component": "my_ode"} +] CONSTANT_INFO = [ {"name": "a", "units": "per_s", "component": "my_ode"} diff --git a/tests/resources/generator/ode_const_var_on_rhs_one_component/model.py b/tests/resources/generator/ode_const_var_on_rhs_one_component/model.py index b8dcc5c700..4da1db0897 100644 --- a/tests/resources/generator/ode_const_var_on_rhs_one_component/model.py +++ b/tests/resources/generator/ode_const_var_on_rhs_one_component/model.py @@ -14,8 +14,9 @@ VOI_INFO = {"name": "t", "units": "second", "component": "my_component"} -STATE_INFO = {"name": "x", "units": "dimensionless", "component": "my_component"} - +STATE_INFO = [ + {"name": "x", "units": "dimensionless", "component": "my_component"} +] CONSTANT_INFO = [ {"name": "a", "units": "per_s", "component": "my_component"} diff --git a/tests/resources/generator/ode_constant_on_rhs/model.py b/tests/resources/generator/ode_constant_on_rhs/model.py index fc48945d12..f9e8d5488b 100644 --- a/tests/resources/generator/ode_constant_on_rhs/model.py +++ b/tests/resources/generator/ode_constant_on_rhs/model.py @@ -14,8 +14,9 @@ VOI_INFO = {"name": "t", "units": "second", "component": "environment"} -STATE_INFO = {"name": "x", "units": "dimensionless", "component": "my_ode"} - +STATE_INFO = [ + {"name": "x", "units": "dimensionless", "component": "my_ode"} +] CONSTANT_INFO = [ ] diff --git a/tests/resources/generator/ode_constant_on_rhs_one_component/model.py b/tests/resources/generator/ode_constant_on_rhs_one_component/model.py index c9165859be..e32e47341e 100644 --- a/tests/resources/generator/ode_constant_on_rhs_one_component/model.py +++ b/tests/resources/generator/ode_constant_on_rhs_one_component/model.py @@ -14,8 +14,9 @@ VOI_INFO = {"name": "t", "units": "second", "component": "my_component"} -STATE_INFO = {"name": "x", "units": "dimensionless", "component": "my_component"} - +STATE_INFO = [ + {"name": "x", "units": "dimensionless", "component": "my_component"} +] CONSTANT_INFO = [ ] diff --git a/tests/resources/generator/ode_multiple_dependent_odes/model.py b/tests/resources/generator/ode_multiple_dependent_odes/model.py index 3126c9e263..d3a7b6a539 100644 --- a/tests/resources/generator/ode_multiple_dependent_odes/model.py +++ b/tests/resources/generator/ode_multiple_dependent_odes/model.py @@ -14,9 +14,10 @@ VOI_INFO = {"name": "t", "units": "second", "component": "environment"} -STATE_INFO = {"name": "x", "units": "dimensionless", "component": "my_x_ode"}, +STATE_INFO = [ + {"name": "x", "units": "dimensionless", "component": "my_x_ode"}, {"name": "y", "units": "dimensionless", "component": "my_y_ode"} - +] CONSTANT_INFO = [ {"name": "epsilon", "units": "dimensionless", "component": "my_y_ode"} diff --git a/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.py b/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.py index 20083c6594..28fe3ff9db 100644 --- a/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.py +++ b/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.py @@ -14,9 +14,10 @@ VOI_INFO = {"name": "t", "units": "second", "component": "my_component"} -STATE_INFO = {"name": "x", "units": "dimensionless", "component": "my_component"}, +STATE_INFO = [ + {"name": "x", "units": "dimensionless", "component": "my_component"}, {"name": "y", "units": "dimensionless", "component": "my_component"} - +] CONSTANT_INFO = [ {"name": "epsilon", "units": "dimensionless", "component": "my_component"} diff --git a/tests/resources/generator/ode_multiple_odes_with_same_name/model.py b/tests/resources/generator/ode_multiple_odes_with_same_name/model.py index 4c4eb266c3..c9ff7906f2 100644 --- a/tests/resources/generator/ode_multiple_odes_with_same_name/model.py +++ b/tests/resources/generator/ode_multiple_odes_with_same_name/model.py @@ -14,9 +14,10 @@ VOI_INFO = {"name": "t", "units": "second", "component": "environment"} -STATE_INFO = {"name": "x", "units": "dimensionless", "component": "my_first_ode"}, +STATE_INFO = [ + {"name": "x", "units": "dimensionless", "component": "my_first_ode"}, {"name": "x", "units": "dimensionless", "component": "my_second_ode"} - +] CONSTANT_INFO = [ {"name": "a", "units": "per_s", "component": "my_second_ode"} diff --git a/tests/resources/generator/ode_unknown_var_on_rhs/model.py b/tests/resources/generator/ode_unknown_var_on_rhs/model.py index 38df6674b7..825591ba22 100644 --- a/tests/resources/generator/ode_unknown_var_on_rhs/model.py +++ b/tests/resources/generator/ode_unknown_var_on_rhs/model.py @@ -14,9 +14,10 @@ VOI_INFO = {"name": "t", "units": "second", "component": "environment"} -STATE_INFO = {"name": "x", "units": "dimensionless", "component": "my_ode"}, +STATE_INFO = [ + {"name": "x", "units": "dimensionless", "component": "my_ode"}, {"name": "y", "units": "dimensionless", "component": "my_ode"} - +] CONSTANT_INFO = [ ] diff --git a/tests/resources/generator/robertson_model_1966/model.dae.py b/tests/resources/generator/robertson_model_1966/model.dae.py index 97b1fa627a..fdf9916959 100644 --- a/tests/resources/generator/robertson_model_1966/model.dae.py +++ b/tests/resources/generator/robertson_model_1966/model.dae.py @@ -14,9 +14,10 @@ VOI_INFO = {"name": "t", "units": "dimensionless", "component": "main"} -STATE_INFO = {"name": "y1", "units": "dimensionless", "component": "main"}, +STATE_INFO = [ + {"name": "y1", "units": "dimensionless", "component": "main"}, {"name": "y2", "units": "dimensionless", "component": "main"} - +] CONSTANT_INFO = [ {"name": "k1", "units": "dimensionless", "component": "main"}, diff --git a/tests/resources/generator/robertson_model_1966/model.ode.py b/tests/resources/generator/robertson_model_1966/model.ode.py index c4401eb268..0da019dd39 100644 --- a/tests/resources/generator/robertson_model_1966/model.ode.py +++ b/tests/resources/generator/robertson_model_1966/model.ode.py @@ -14,10 +14,11 @@ VOI_INFO = {"name": "t", "units": "dimensionless", "component": "main"} -STATE_INFO = {"name": "y1", "units": "dimensionless", "component": "main"}, +STATE_INFO = [ + {"name": "y1", "units": "dimensionless", "component": "main"}, {"name": "y3", "units": "dimensionless", "component": "main"}, {"name": "y2", "units": "dimensionless", "component": "main"} - +] CONSTANT_INFO = [ {"name": "k1", "units": "dimensionless", "component": "main"}, diff --git a/tests/resources/generator/sine_model_imports/model.py b/tests/resources/generator/sine_model_imports/model.py index ae30609e47..68dbffb339 100644 --- a/tests/resources/generator/sine_model_imports/model.py +++ b/tests/resources/generator/sine_model_imports/model.py @@ -14,8 +14,9 @@ VOI_INFO = {"name": "x", "units": "dimensionless", "component": "main"} -STATE_INFO = {"name": "sin", "units": "dimensionless", "component": "deriv_approx_sin"} - +STATE_INFO = [ + {"name": "sin", "units": "dimensionless", "component": "deriv_approx_sin"} +] CONSTANT_INFO = [ {"name": "deriv_approx_initial_value", "units": "dimensionless", "component": "main"}, diff --git a/tests/resources/generator/variable_initialised_using_a_constant/model.py b/tests/resources/generator/variable_initialised_using_a_constant/model.py index 34bcc5c3a8..4be9384a6e 100644 --- a/tests/resources/generator/variable_initialised_using_a_constant/model.py +++ b/tests/resources/generator/variable_initialised_using_a_constant/model.py @@ -14,8 +14,9 @@ VOI_INFO = {"name": "t", "units": "second", "component": "component_1"} -STATE_INFO = {"name": "X", "units": "dimensionless", "component": "component_1"} - +STATE_INFO = [ + {"name": "X", "units": "dimensionless", "component": "component_1"} +] CONSTANT_INFO = [ {"name": "X_init", "units": "dimensionless", "component": "component_2"} From 71ae73b36db19365cf1646f21b9655beece6c9f6 Mon Sep 17 00:00:00 2001 From: Alan Garny Date: Thu, 15 Aug 2024 16:08:03 +0200 Subject: [PATCH 25/85] Generator: initialise things in initialiseVariables() in the order of its parameters. --- src/generator.cpp | 34 +++++----- tests/resources/coverage/generator/model.c | 2 +- .../generator/model.implementation.out | 2 +- .../generator/model.modified.profile.c | 2 +- .../generator/model.modified.profile.py | 2 +- tests/resources/coverage/generator/model.out | 2 +- tests/resources/coverage/generator/model.py | 2 +- .../algebraic_eqn_derivative_on_rhs/model.c | 2 +- .../algebraic_eqn_derivative_on_rhs/model.py | 2 +- .../model.c | 2 +- .../model.py | 2 +- .../algebraic_eqn_state_var_on_rhs/model.c | 2 +- .../algebraic_eqn_state_var_on_rhs/model.py | 2 +- .../model.c | 2 +- .../model.py | 2 +- .../model.c | 2 +- .../model.py | 2 +- .../model.c | 4 +- .../model.py | 4 +- .../generator/dae_cellml_1_1_model/model.c | 4 +- .../generator/dae_cellml_1_1_model/model.py | 4 +- .../model.c | 66 +++++++++---------- .../model.py | 66 +++++++++---------- .../model.c | 30 ++++----- .../model.py | 30 ++++----- .../model.algebraic.c | 8 +-- .../model.algebraic.py | 8 +-- .../model.c | 8 +-- .../model.computed.constant.c | 8 +-- .../model.computed.constant.py | 8 +-- .../model.constant.c | 8 +-- .../model.constant.py | 8 +-- .../model.dae.c | 16 ++--- .../model.dae.py | 16 ++--- .../model.dependent.algebraic.c | 8 +-- .../model.dependent.algebraic.py | 8 +-- .../model.dependent.computed.constant.c | 8 +-- .../model.dependent.computed.constant.py | 8 +-- .../model.dependent.constant.c | 6 +- .../model.dependent.constant.py | 6 +- .../model.dependent.state.c | 4 +- .../model.dependent.state.py | 4 +- .../model.external.c | 6 +- .../model.external.py | 6 +- .../model.py | 8 +-- .../model.state.c | 6 +- .../model.state.py | 6 +- .../generator/noble_model_1962/model.c | 8 +-- .../generator/noble_model_1962/model.py | 8 +-- .../generator/ode_computed_var_on_rhs/model.c | 2 +- .../ode_computed_var_on_rhs/model.py | 2 +- .../model.c | 2 +- .../model.py | 2 +- .../generator/ode_const_var_on_rhs/model.c | 2 +- .../generator/ode_const_var_on_rhs/model.py | 2 +- .../model.c | 2 +- .../model.py | 2 +- .../ode_multiple_dependent_odes/model.c | 2 +- .../ode_multiple_dependent_odes/model.py | 2 +- .../model.c | 2 +- .../model.py | 2 +- .../ode_multiple_odes_with_same_name/model.c | 2 +- .../ode_multiple_odes_with_same_name/model.py | 2 +- .../robertson_model_1966/model.dae.c | 4 +- .../robertson_model_1966/model.dae.py | 4 +- .../robertson_model_1966/model.ode.c | 6 +- .../robertson_model_1966/model.ode.py | 6 +- .../generator/sine_model_imports/model.c | 2 +- .../generator/sine_model_imports/model.py | 2 +- .../model.c | 2 +- .../model.py | 2 +- 71 files changed, 259 insertions(+), 259 deletions(-) diff --git a/src/generator.cpp b/src/generator.cpp index d47bdf7ce1..0404698ab3 100644 --- a/src/generator.cpp +++ b/src/generator.cpp @@ -1807,6 +1807,23 @@ void Generator::GeneratorImpl::addImplementationInitialiseVariablesMethodCode(st mModel->hasExternalVariables()); if (!implementationInitialiseVariablesMethodString.empty()) { + // Initialise our states. + + std::string methodBody; + + for (const auto &state : mModel->states()) { + methodBody += generateInitialisationCode(state); + } + + // Use an initial guess of zero for rates computed using an NLA system + // (see the note below). + + for (const auto &state : mModel->states()) { + if (state->equation(0)->type() == AnalyserEquation::Type::NLA) { + methodBody += generateZeroInitialisationCode(state); + } + } + // Initialise our constants and our algebraic variables that have an // initial value. Also use an initial guess of zero for computed // constants and algebraic variables computed using an NLA system. @@ -1817,8 +1834,6 @@ void Generator::GeneratorImpl::addImplementationInitialiseVariablesMethodCode(st // guess. We use an initial guess of zero, which is fine since // such an NLA system has only one solution. - std::string methodBody; - for (const auto &variable : variables(mModel)) { switch (variable->type()) { case AnalyserVariable::Type::CONSTANT: @@ -1849,21 +1864,6 @@ void Generator::GeneratorImpl::addImplementationInitialiseVariablesMethodCode(st } } - // Initialise our states. - - for (const auto &state : mModel->states()) { - methodBody += generateInitialisationCode(state); - } - - // Use an initial guess of zero for rates computed using an NLA system - // (see the note above). - - for (const auto &state : mModel->states()) { - if (state->equation(0)->type() == AnalyserEquation::Type::NLA) { - methodBody += generateZeroInitialisationCode(state); - } - } - // Initialise our external variables. if (mModel->hasExternalVariables()) { diff --git a/tests/resources/coverage/generator/model.c b/tests/resources/coverage/generator/model.c index 95cb0e4fba..b6479b2b85 100644 --- a/tests/resources/coverage/generator/model.c +++ b/tests/resources/coverage/generator/model.c @@ -407,6 +407,7 @@ void findRoot0(double voi, double *states, double *rates, double *variables) void initialiseVariables(double *states, double *rates, double *constants, double *algebraic) { + states[0] = 0.0; constants[0] = 1.0; constants[1] = 2.0; constants[2] = 3.0; @@ -428,7 +429,6 @@ void initialiseVariables(double *states, double *rates, double *constants, doubl computedConstants[187] = NAN; computedConstants[198] = 1.0; computedConstants[199] = 3.0; - states[0] = 0.0; } void computeComputedConstants(double *constants, double *computedConstants) diff --git a/tests/resources/coverage/generator/model.implementation.out b/tests/resources/coverage/generator/model.implementation.out index 1bd2a352f3..ab220a0b3d 100644 --- a/tests/resources/coverage/generator/model.implementation.out +++ b/tests/resources/coverage/generator/model.implementation.out @@ -170,6 +170,7 @@ void findRoot0(double voi, double *states, double *rates, double *variables) void initialiseVariables(double *states, double *rates, double *constants, double *algebraic) { + states[0] = 0.0; constants[0] = 1.0; constants[1] = 2.0; constants[2] = 3.0; @@ -191,7 +192,6 @@ void initialiseVariables(double *states, double *rates, double *constants, doubl computedConstants[187] = NAN; computedConstants[198] = 1.0; computedConstants[199] = 3.0; - states[0] = 0.0; } void computeComputedConstants(double *constants, double *computedConstants) diff --git a/tests/resources/coverage/generator/model.modified.profile.c b/tests/resources/coverage/generator/model.modified.profile.c index 8b95e5994f..96320e6c00 100644 --- a/tests/resources/coverage/generator/model.modified.profile.c +++ b/tests/resources/coverage/generator/model.modified.profile.c @@ -407,6 +407,7 @@ void findRoot0(double voi, double *states, double *rates, double *variables) void initialiseVariables(double *states, double *rates, double *constants, double *algebraic) { + states[0] = 0.0; constants[0] = 1.0; constants[1] = 2.0; constants[2] = 3.0; @@ -428,7 +429,6 @@ void initialiseVariables(double *states, double *rates, double *constants, doubl computedConstants[187] = NAN; computedConstants[198] = 1.0; computedConstants[199] = 3.0; - states[0] = 0.0; } void computeComputedConstants(double *constants, double *computedConstants) diff --git a/tests/resources/coverage/generator/model.modified.profile.py b/tests/resources/coverage/generator/model.modified.profile.py index 0ebd3706cc..eea22df56c 100644 --- a/tests/resources/coverage/generator/model.modified.profile.py +++ b/tests/resources/coverage/generator/model.modified.profile.py @@ -384,6 +384,7 @@ def find_root_0(voi, states, rates, variables): def initialise_variables(states, rates, constants, algebraic): + states[0] = 0.0 constants[0] = 1.0 constants[1] = 2.0 constants[2] = 3.0 @@ -405,7 +406,6 @@ def initialise_variables(states, rates, constants, algebraic): computed_constants[187] = nan computed_constants[198] = 1.0 computed_constants[199] = 3.0 - states[0] = 0.0 def compute_computed_constants(constants, computed_constants): diff --git a/tests/resources/coverage/generator/model.out b/tests/resources/coverage/generator/model.out index 087fc8b7b5..3f57e2f5c7 100644 --- a/tests/resources/coverage/generator/model.out +++ b/tests/resources/coverage/generator/model.out @@ -118,6 +118,7 @@ void findRoot0(double voi, double *states, double *rates, double *variables) void initialiseVariables(double *states, double *rates, double *constants, double *algebraic) { + states[0] = 0.0; constants[0] = 1.0; constants[1] = 2.0; constants[2] = 3.0; @@ -139,7 +140,6 @@ void initialiseVariables(double *states, double *rates, double *constants, doubl computedConstants[187] = NAN; computedConstants[198] = 1.0; computedConstants[199] = 3.0; - states[0] = 0.0; } void computeComputedConstants(double *constants, double *computedConstants) diff --git a/tests/resources/coverage/generator/model.py b/tests/resources/coverage/generator/model.py index 41f5145cd5..8e305579fd 100644 --- a/tests/resources/coverage/generator/model.py +++ b/tests/resources/coverage/generator/model.py @@ -384,6 +384,7 @@ def find_root_0(voi, states, rates, variables): def initialise_variables(states, rates, constants, algebraic): + states[0] = 0.0 constants[0] = 1.0 constants[1] = 2.0 constants[2] = 3.0 @@ -405,7 +406,6 @@ def initialise_variables(states, rates, constants, algebraic): computed_constants[187] = nan computed_constants[198] = 1.0 computed_constants[199] = 3.0 - states[0] = 0.0 def compute_computed_constants(constants, computed_constants): diff --git a/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.c b/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.c index be8b6b29a4..3461133232 100644 --- a/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.c +++ b/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.c @@ -81,8 +81,8 @@ void deleteArray(double *array) void initialiseVariables(double *states, double *rates, double *constants, double *algebraic) { - computedConstants[0] = 1.0; states[0] = 1.0; + computedConstants[0] = 1.0; } void computeComputedConstants(double *constants, double *computedConstants) diff --git a/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.py b/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.py index c209063f4f..4c38d6136d 100644 --- a/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.py +++ b/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.py @@ -47,8 +47,8 @@ def create_algebraic_array(): def initialise_variables(states, rates, constants, algebraic): - computed_constants[0] = 1.0 states[0] = 1.0 + computed_constants[0] = 1.0 def compute_computed_constants(constants, computed_constants): diff --git a/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.c b/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.c index fba3aa00f2..b986dc2765 100644 --- a/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.c +++ b/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.c @@ -81,8 +81,8 @@ void deleteArray(double *array) void initialiseVariables(double *states, double *rates, double *constants, double *algebraic) { - computedConstants[0] = 1.0; states[0] = 1.0; + computedConstants[0] = 1.0; } void computeComputedConstants(double *constants, double *computedConstants) diff --git a/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.py b/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.py index bf7e73949b..45d1c49bf0 100644 --- a/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.py +++ b/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.py @@ -47,8 +47,8 @@ def create_algebraic_array(): def initialise_variables(states, rates, constants, algebraic): - computed_constants[0] = 1.0 states[0] = 1.0 + computed_constants[0] = 1.0 def compute_computed_constants(constants, computed_constants): diff --git a/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.c b/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.c index 212c1b6f5f..2435f13f62 100644 --- a/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.c +++ b/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.c @@ -81,8 +81,8 @@ void deleteArray(double *array) void initialiseVariables(double *states, double *rates, double *constants, double *algebraic) { - computedConstants[0] = 1.0; states[0] = 1.0; + computedConstants[0] = 1.0; } void computeComputedConstants(double *constants, double *computedConstants) diff --git a/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.py b/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.py index 461603beaf..3f90782054 100644 --- a/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.py +++ b/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.py @@ -47,8 +47,8 @@ def create_algebraic_array(): def initialise_variables(states, rates, constants, algebraic): - computed_constants[0] = 1.0 states[0] = 1.0 + computed_constants[0] = 1.0 def compute_computed_constants(constants, computed_constants): diff --git a/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.c b/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.c index a8b8f710fc..1c1013f49a 100644 --- a/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.c +++ b/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.c @@ -81,8 +81,8 @@ void deleteArray(double *array) void initialiseVariables(double *states, double *rates, double *constants, double *algebraic) { - computedConstants[0] = 1.0; states[0] = 1.0; + computedConstants[0] = 1.0; } void computeComputedConstants(double *constants, double *computedConstants) diff --git a/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.py b/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.py index 626e04c14f..921b10db41 100644 --- a/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.py +++ b/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.py @@ -47,8 +47,8 @@ def create_algebraic_array(): def initialise_variables(states, rates, constants, algebraic): - computed_constants[0] = 1.0 states[0] = 1.0 + computed_constants[0] = 1.0 def compute_computed_constants(constants, computed_constants): diff --git a/tests/resources/generator/cellml_state_initialised_using_variable/model.c b/tests/resources/generator/cellml_state_initialised_using_variable/model.c index d9a740db51..311dad8ea8 100644 --- a/tests/resources/generator/cellml_state_initialised_using_variable/model.c +++ b/tests/resources/generator/cellml_state_initialised_using_variable/model.c @@ -80,8 +80,8 @@ void deleteArray(double *array) void initialiseVariables(double *states, double *rates, double *constants, double *algebraic) { - constants[0] = 123.0; states[0] = constants[0]; + constants[0] = 123.0; } void computeComputedConstants(double *constants, double *computedConstants) diff --git a/tests/resources/generator/cellml_state_initialised_using_variable/model.py b/tests/resources/generator/cellml_state_initialised_using_variable/model.py index c05b32ce6b..7da7403e91 100644 --- a/tests/resources/generator/cellml_state_initialised_using_variable/model.py +++ b/tests/resources/generator/cellml_state_initialised_using_variable/model.py @@ -46,8 +46,8 @@ def create_algebraic_array(): def initialise_variables(states, rates, constants, algebraic): - constants[0] = 123.0 states[0] = constants[0] + constants[0] = 123.0 def compute_computed_constants(constants, computed_constants): diff --git a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.c b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.c index 53f3416882..d4036cd8fe 100644 --- a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.c +++ b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.c @@ -82,10 +82,10 @@ void deleteArray(double *array) void initialiseVariables(double *states, double *rates, double *constants, double *algebraic) { - constants[0] = 123.0; - constants[1] = 789.0; states[0] = constants[0]; states[1] = 0.001*constants[1]; + constants[0] = 123.0; + constants[1] = 789.0; } void computeComputedConstants(double *constants, double *computedConstants) diff --git a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.py b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.py index 9f1c08de9a..f60e5e970a 100644 --- a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.py +++ b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.py @@ -48,10 +48,10 @@ def create_algebraic_array(): def initialise_variables(states, rates, constants, algebraic): - constants[0] = 123.0 - constants[1] = 789.0 states[0] = constants[0] states[1] = 0.001*constants[1] + constants[0] = 123.0 + constants[1] = 789.0 def compute_computed_constants(constants, computed_constants): diff --git a/tests/resources/generator/dae_cellml_1_1_model/model.c b/tests/resources/generator/dae_cellml_1_1_model/model.c index 0490c23751..d32cd7b90e 100644 --- a/tests/resources/generator/dae_cellml_1_1_model/model.c +++ b/tests/resources/generator/dae_cellml_1_1_model/model.c @@ -148,6 +148,8 @@ void findRoot1(double voi, double *states, double *rates, double *variables) void initialiseVariables(double *states, double *rates, double *constants, double *algebraic) { + states[0] = 1.0; + states[1] = 0.0; constants[0] = 1.0; constants[1] = 1.0; constants[2] = 20.0; @@ -155,8 +157,6 @@ void initialiseVariables(double *states, double *rates, double *constants, doubl constants[4] = 10.0; algebraic[0] = 0.0; algebraic[4] = 0.0; - states[0] = 1.0; - states[1] = 0.0; } void computeComputedConstants(double *constants, double *computedConstants) diff --git a/tests/resources/generator/dae_cellml_1_1_model/model.py b/tests/resources/generator/dae_cellml_1_1_model/model.py index 4b0ae9b510..a65bd29329 100644 --- a/tests/resources/generator/dae_cellml_1_1_model/model.py +++ b/tests/resources/generator/dae_cellml_1_1_model/model.py @@ -101,6 +101,8 @@ def find_root_1(voi, states, rates, variables): def initialise_variables(states, rates, constants, algebraic): + states[0] = 1.0 + states[1] = 0.0 constants[0] = 1.0 constants[1] = 1.0 constants[2] = 20.0 @@ -108,8 +110,6 @@ def initialise_variables(states, rates, constants, algebraic): constants[4] = 10.0 algebraic[0] = 0.0 algebraic[4] = 0.0 - states[0] = 1.0 - states[1] = 0.0 def compute_computed_constants(constants, computed_constants): diff --git a/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.c b/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.c index c55ad5533f..20d93a9cc0 100644 --- a/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.c +++ b/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.c @@ -328,6 +328,39 @@ void deleteArray(double *array) void initialiseVariables(double *states, double *rates, double *constants, double *algebraic) { + states[0] = 6.226104e-5; + states[1] = 5.0; + states[2] = 0.409551; + states[3] = 6.181512e-9; + states[4] = 0.9308; + states[5] = 0.069199; + states[6] = 4.595622e-10; + states[7] = 9.15641e-6; + states[8] = 0.435148; + states[9] = 0.017929; + states[10] = 0.259947; + states[11] = 0.653777; + states[12] = 0.217311; + states[13] = 0.158521; + states[14] = 0.138975; + states[15] = -47.787168; + states[16] = 0.009508; + states[17] = 0.003058; + states[18] = 0.447724; + states[19] = 0.845304; + states[20] = 0.011845; + states[21] = 0.844449; + states[22] = 0.846702; + states[23] = 0.001921; + states[24] = 0.020484; + states[25] = 0.268909; + states[26] = 0.014523; + states[27] = 0.430836; + states[28] = 0.709051; + states[29] = 0.011068; + states[30] = 0.283185; + states[31] = 0.1162; + states[32] = 0.00277; constants[0] = 0.0; constants[1] = 0.0; constants[2] = 140.0; @@ -419,39 +452,6 @@ void initialiseVariables(double *states, double *rates, double *constants, doubl constants[88] = 0.00065; constants[89] = 1.0; constants[90] = 0.00345; - states[0] = 6.226104e-5; - states[1] = 5.0; - states[2] = 0.409551; - states[3] = 6.181512e-9; - states[4] = 0.9308; - states[5] = 0.069199; - states[6] = 4.595622e-10; - states[7] = 9.15641e-6; - states[8] = 0.435148; - states[9] = 0.017929; - states[10] = 0.259947; - states[11] = 0.653777; - states[12] = 0.217311; - states[13] = 0.158521; - states[14] = 0.138975; - states[15] = -47.787168; - states[16] = 0.009508; - states[17] = 0.003058; - states[18] = 0.447724; - states[19] = 0.845304; - states[20] = 0.011845; - states[21] = 0.844449; - states[22] = 0.846702; - states[23] = 0.001921; - states[24] = 0.020484; - states[25] = 0.268909; - states[26] = 0.014523; - states[27] = 0.430836; - states[28] = 0.709051; - states[29] = 0.011068; - states[30] = 0.283185; - states[31] = 0.1162; - states[32] = 0.00277; } void computeComputedConstants(double *constants, double *computedConstants) diff --git a/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.py b/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.py index 0a32422fcc..379a01e73d 100644 --- a/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.py +++ b/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.py @@ -314,6 +314,39 @@ def create_algebraic_array(): def initialise_variables(states, rates, constants, algebraic): + states[0] = 6.226104e-5 + states[1] = 5.0 + states[2] = 0.409551 + states[3] = 6.181512e-9 + states[4] = 0.9308 + states[5] = 0.069199 + states[6] = 4.595622e-10 + states[7] = 9.15641e-6 + states[8] = 0.435148 + states[9] = 0.017929 + states[10] = 0.259947 + states[11] = 0.653777 + states[12] = 0.217311 + states[13] = 0.158521 + states[14] = 0.138975 + states[15] = -47.787168 + states[16] = 0.009508 + states[17] = 0.003058 + states[18] = 0.447724 + states[19] = 0.845304 + states[20] = 0.011845 + states[21] = 0.844449 + states[22] = 0.846702 + states[23] = 0.001921 + states[24] = 0.020484 + states[25] = 0.268909 + states[26] = 0.014523 + states[27] = 0.430836 + states[28] = 0.709051 + states[29] = 0.011068 + states[30] = 0.283185 + states[31] = 0.1162 + states[32] = 0.00277 constants[0] = 0.0 constants[1] = 0.0 constants[2] = 140.0 @@ -405,39 +438,6 @@ def initialise_variables(states, rates, constants, algebraic): constants[88] = 0.00065 constants[89] = 1.0 constants[90] = 0.00345 - states[0] = 6.226104e-5 - states[1] = 5.0 - states[2] = 0.409551 - states[3] = 6.181512e-9 - states[4] = 0.9308 - states[5] = 0.069199 - states[6] = 4.595622e-10 - states[7] = 9.15641e-6 - states[8] = 0.435148 - states[9] = 0.017929 - states[10] = 0.259947 - states[11] = 0.653777 - states[12] = 0.217311 - states[13] = 0.158521 - states[14] = 0.138975 - states[15] = -47.787168 - states[16] = 0.009508 - states[17] = 0.003058 - states[18] = 0.447724 - states[19] = 0.845304 - states[20] = 0.011845 - states[21] = 0.844449 - states[22] = 0.846702 - states[23] = 0.001921 - states[24] = 0.020484 - states[25] = 0.268909 - states[26] = 0.014523 - states[27] = 0.430836 - states[28] = 0.709051 - states[29] = 0.011068 - states[30] = 0.283185 - states[31] = 0.1162 - states[32] = 0.00277 def compute_computed_constants(constants, computed_constants): diff --git a/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.c b/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.c index 4a91f69bee..95cebcd3a3 100644 --- a/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.c +++ b/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.c @@ -278,6 +278,21 @@ void deleteArray(double *array) void initialiseVariables(double *states, double *rates, double *constants, double *algebraic) { + states[0] = -39.013558536; + states[1] = 0.092361701692; + states[2] = 0.015905380261; + states[3] = 0.01445216109; + states[4] = 0.48779845203; + states[5] = 0.04804900895; + states[6] = 0.038968420558; + states[7] = 0.42074047435; + states[8] = 0.064402950262; + states[9] = 0.29760539675; + states[10] = 0.87993375273; + states[11] = 0.13034201158; + states[12] = 0.46960956028; + states[13] = 0.082293827208; + states[14] = 0.03889291759; constants[0] = 0.0; constants[1] = 1.0; constants[2] = 1.0309347; @@ -388,21 +403,6 @@ void initialiseVariables(double *states, double *rates, double *constants, doubl constants[107] = 0.0055; constants[108] = 0.0005465; constants[109] = 0.006875; - states[0] = -39.013558536; - states[1] = 0.092361701692; - states[2] = 0.015905380261; - states[3] = 0.01445216109; - states[4] = 0.48779845203; - states[5] = 0.04804900895; - states[6] = 0.038968420558; - states[7] = 0.42074047435; - states[8] = 0.064402950262; - states[9] = 0.29760539675; - states[10] = 0.87993375273; - states[11] = 0.13034201158; - states[12] = 0.46960956028; - states[13] = 0.082293827208; - states[14] = 0.03889291759; } void computeComputedConstants(double *constants, double *computedConstants) diff --git a/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.py b/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.py index 5366a19b31..0b6a2012ad 100644 --- a/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.py +++ b/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.py @@ -252,6 +252,21 @@ def create_algebraic_array(): def initialise_variables(states, rates, constants, algebraic): + states[0] = -39.013558536 + states[1] = 0.092361701692 + states[2] = 0.015905380261 + states[3] = 0.01445216109 + states[4] = 0.48779845203 + states[5] = 0.04804900895 + states[6] = 0.038968420558 + states[7] = 0.42074047435 + states[8] = 0.064402950262 + states[9] = 0.29760539675 + states[10] = 0.87993375273 + states[11] = 0.13034201158 + states[12] = 0.46960956028 + states[13] = 0.082293827208 + states[14] = 0.03889291759 constants[0] = 0.0 constants[1] = 1.0 constants[2] = 1.0309347 @@ -362,21 +377,6 @@ def initialise_variables(states, rates, constants, algebraic): constants[107] = 0.0055 constants[108] = 0.0005465 constants[109] = 0.006875 - states[0] = -39.013558536 - states[1] = 0.092361701692 - states[2] = 0.015905380261 - states[3] = 0.01445216109 - states[4] = 0.48779845203 - states[5] = 0.04804900895 - states[6] = 0.038968420558 - states[7] = 0.42074047435 - states[8] = 0.064402950262 - states[9] = 0.29760539675 - states[10] = 0.87993375273 - states[11] = 0.13034201158 - states[12] = 0.46960956028 - states[13] = 0.082293827208 - states[14] = 0.03889291759 def compute_computed_constants(constants, computed_constants): diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.c index 014c80f3fa..79638165e9 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.c @@ -115,15 +115,15 @@ void deleteArray(double *array) void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic, ExternalVariable externalVariable) { + states[0] = 0.0; + states[1] = 0.6; + states[2] = 0.05; + states[3] = 0.325; constants[0] = 1.0; constants[1] = 0.0; constants[2] = 0.3; constants[3] = 120.0; constants[4] = 36.0; - states[0] = 0.0; - states[1] = 0.6; - states[2] = 0.05; - states[3] = 0.325; algebraic[0] = externalVariable(voi, states, rates, variables, 0); } diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.py index 456ad3deb4..9d302d2515 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.py @@ -86,15 +86,15 @@ def create_externals_array(): def initialise_variables(voi, states, rates, constants, algebraic, external_variable): + states[0] = 0.0 + states[1] = 0.6 + states[2] = 0.05 + states[3] = 0.325 constants[0] = 1.0 constants[1] = 0.0 constants[2] = 0.3 constants[3] = 120.0 constants[4] = 36.0 - states[0] = 0.0 - states[1] = 0.6 - states[2] = 0.05 - states[3] = 0.325 algebraic[0] = external_variable(voi, states, rates, variables, 0) diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.c index c6bbfef2c0..055c697965 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.c @@ -100,15 +100,15 @@ void deleteArray(double *array) void initialiseVariables(double *states, double *rates, double *constants, double *algebraic) { + states[0] = 0.0; + states[1] = 0.6; + states[2] = 0.05; + states[3] = 0.325; constants[0] = 1.0; constants[1] = 0.0; constants[2] = 0.3; constants[3] = 120.0; constants[4] = 36.0; - states[0] = 0.0; - states[1] = 0.6; - states[2] = 0.05; - states[3] = 0.325; } void computeComputedConstants(double *constants, double *computedConstants) diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.c index 65b7980a70..30d273c85a 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.c @@ -115,15 +115,15 @@ void deleteArray(double *array) void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic, ExternalVariable externalVariable) { + states[0] = 0.0; + states[1] = 0.6; + states[2] = 0.05; + states[3] = 0.325; constants[0] = 1.0; constants[1] = 0.0; constants[2] = 0.3; constants[3] = 120.0; constants[4] = 36.0; - states[0] = 0.0; - states[1] = 0.6; - states[2] = 0.05; - states[3] = 0.325; algebraic[4] = externalVariable(voi, states, rates, variables, 4); } diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.py index aa2ab1b23a..110c67f6c2 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.py @@ -86,15 +86,15 @@ def create_externals_array(): def initialise_variables(voi, states, rates, constants, algebraic, external_variable): + states[0] = 0.0 + states[1] = 0.6 + states[2] = 0.05 + states[3] = 0.325 constants[0] = 1.0 constants[1] = 0.0 constants[2] = 0.3 constants[3] = 120.0 constants[4] = 36.0 - states[0] = 0.0 - states[1] = 0.6 - states[2] = 0.05 - states[3] = 0.325 algebraic[4] = external_variable(voi, states, rates, variables, 4) diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.c index c55dd78a0c..e006edcb52 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.c @@ -115,14 +115,14 @@ void deleteArray(double *array) void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic, ExternalVariable externalVariable) { - constants[0] = 0.0; - constants[1] = 0.3; - constants[2] = 120.0; - constants[3] = 36.0; states[0] = 0.0; states[1] = 0.6; states[2] = 0.05; states[3] = 0.325; + constants[0] = 0.0; + constants[1] = 0.3; + constants[2] = 120.0; + constants[3] = 36.0; algebraic[4] = externalVariable(voi, states, rates, variables, 4); } diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.py index fabc48c20f..95ab1649b7 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.py @@ -86,14 +86,14 @@ def create_externals_array(): def initialise_variables(voi, states, rates, constants, algebraic, external_variable): - constants[0] = 0.0 - constants[1] = 0.3 - constants[2] = 120.0 - constants[3] = 36.0 states[0] = 0.0 states[1] = 0.6 states[2] = 0.05 states[3] = 0.325 + constants[0] = 0.0 + constants[1] = 0.3 + constants[2] = 120.0 + constants[3] = 36.0 algebraic[4] = external_variable(voi, states, rates, variables, 4) diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.c index fb3b5d646c..0e805880e8 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.c @@ -518,6 +518,14 @@ void findRoot16(double voi, double *states, double *rates, double *variables) void initialiseVariables(double *states, double *rates, double *constants, double *algebraic) { + states[0] = 0.0; + states[1] = 0.6; + states[2] = 0.05; + states[3] = 0.325; + rates[0] = 0.0; + rates[1] = 0.0; + rates[2] = 0.0; + rates[3] = 0.0; constants[0] = 1.0; constants[1] = 0.0; constants[2] = 0.3; @@ -536,14 +544,6 @@ void initialiseVariables(double *states, double *rates, double *constants, doubl algebraic[7] = 0.0; algebraic[8] = 0.0; algebraic[9] = 0.0; - states[0] = 0.0; - states[1] = 0.6; - states[2] = 0.05; - states[3] = 0.325; - rates[0] = 0.0; - rates[1] = 0.0; - rates[2] = 0.0; - rates[3] = 0.0; } void computeComputedConstants(double *constants, double *computedConstants) diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.py index d1fba9fff0..d42b47c116 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.py @@ -438,6 +438,14 @@ def find_root_16(voi, states, rates, variables): def initialise_variables(states, rates, constants, algebraic): + states[0] = 0.0 + states[1] = 0.6 + states[2] = 0.05 + states[3] = 0.325 + rates[0] = 0.0 + rates[1] = 0.0 + rates[2] = 0.0 + rates[3] = 0.0 constants[0] = 1.0 constants[1] = 0.0 constants[2] = 0.3 @@ -456,14 +464,6 @@ def initialise_variables(states, rates, constants, algebraic): algebraic[7] = 0.0 algebraic[8] = 0.0 algebraic[9] = 0.0 - states[0] = 0.0 - states[1] = 0.6 - states[2] = 0.05 - states[3] = 0.325 - rates[0] = 0.0 - rates[1] = 0.0 - rates[2] = 0.0 - rates[3] = 0.0 def compute_computed_constants(constants, computed_constants): diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.c index 63e497727e..c2349a9090 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.c @@ -115,15 +115,15 @@ void deleteArray(double *array) void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic, ExternalVariable externalVariable) { + states[0] = 0.0; + states[1] = 0.6; + states[2] = 0.05; + states[3] = 0.325; constants[0] = 1.0; constants[1] = 0.0; constants[2] = 0.3; constants[3] = 120.0; constants[4] = 36.0; - states[0] = 0.0; - states[1] = 0.6; - states[2] = 0.05; - states[3] = 0.325; algebraic[9] = externalVariable(voi, states, rates, variables, 9); algebraic[0] = externalVariable(voi, states, rates, variables, 0); } diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.py index 81e680d3de..a7da904728 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.py @@ -86,15 +86,15 @@ def create_externals_array(): def initialise_variables(voi, states, rates, constants, algebraic, external_variable): + states[0] = 0.0 + states[1] = 0.6 + states[2] = 0.05 + states[3] = 0.325 constants[0] = 1.0 constants[1] = 0.0 constants[2] = 0.3 constants[3] = 120.0 constants[4] = 36.0 - states[0] = 0.0 - states[1] = 0.6 - states[2] = 0.05 - states[3] = 0.325 algebraic[9] = external_variable(voi, states, rates, variables, 9) algebraic[0] = external_variable(voi, states, rates, variables, 0) diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.c index b32cc398f3..9ae267b458 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.c @@ -115,14 +115,14 @@ void deleteArray(double *array) void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic, ExternalVariable externalVariable) { - constants[0] = 1.0; - constants[1] = 0.3; - constants[2] = 120.0; - constants[3] = 36.0; states[0] = 0.0; states[1] = 0.6; states[2] = 0.05; states[3] = 0.325; + constants[0] = 1.0; + constants[1] = 0.3; + constants[2] = 120.0; + constants[3] = 36.0; algebraic[11] = externalVariable(voi, states, rates, variables, 11); algebraic[4] = externalVariable(voi, states, rates, variables, 4); } diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.py index 9cf6ce4c14..8ecf9444b0 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.py @@ -86,14 +86,14 @@ def create_externals_array(): def initialise_variables(voi, states, rates, constants, algebraic, external_variable): - constants[0] = 1.0 - constants[1] = 0.3 - constants[2] = 120.0 - constants[3] = 36.0 states[0] = 0.0 states[1] = 0.6 states[2] = 0.05 states[3] = 0.325 + constants[0] = 1.0 + constants[1] = 0.3 + constants[2] = 120.0 + constants[3] = 36.0 algebraic[11] = external_variable(voi, states, rates, variables, 11) algebraic[4] = external_variable(voi, states, rates, variables, 4) diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.c index 65138ecb45..7e67473638 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.c @@ -115,13 +115,13 @@ void deleteArray(double *array) void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic, ExternalVariable externalVariable) { - constants[0] = 0.0; - constants[1] = 0.3; - constants[2] = 36.0; states[0] = 0.0; states[1] = 0.6; states[2] = 0.05; states[3] = 0.325; + constants[0] = 0.0; + constants[1] = 0.3; + constants[2] = 36.0; algebraic[5] = externalVariable(voi, states, rates, variables, 5); algebraic[4] = externalVariable(voi, states, rates, variables, 4); } diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.py index 1dde1527f6..64f4a8c1f7 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.py @@ -86,13 +86,13 @@ def create_externals_array(): def initialise_variables(voi, states, rates, constants, algebraic, external_variable): - constants[0] = 0.0 - constants[1] = 0.3 - constants[2] = 36.0 states[0] = 0.0 states[1] = 0.6 states[2] = 0.05 states[3] = 0.325 + constants[0] = 0.0 + constants[1] = 0.3 + constants[2] = 36.0 algebraic[5] = external_variable(voi, states, rates, variables, 5) algebraic[4] = external_variable(voi, states, rates, variables, 4) diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.c index 4345ee1fe9..7d42c647f7 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.c @@ -115,13 +115,13 @@ void deleteArray(double *array) void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic, ExternalVariable externalVariable) { + states[0] = 0.6; + states[1] = 0.325; constants[0] = 1.0; constants[1] = 0.0; constants[2] = 0.3; constants[3] = 120.0; constants[4] = 36.0; - states[0] = 0.6; - states[1] = 0.325; algebraic[1] = externalVariable(voi, states, rates, variables, 1); algebraic[5] = externalVariable(voi, states, rates, variables, 5); } diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.py index 9fd00c61bd..d9285aa420 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.py @@ -86,13 +86,13 @@ def create_externals_array(): def initialise_variables(voi, states, rates, constants, algebraic, external_variable): + states[0] = 0.6 + states[1] = 0.325 constants[0] = 1.0 constants[1] = 0.0 constants[2] = 0.3 constants[3] = 120.0 constants[4] = 36.0 - states[0] = 0.6 - states[1] = 0.325 algebraic[1] = external_variable(voi, states, rates, variables, 1) algebraic[5] = external_variable(voi, states, rates, variables, 5) diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.c index 83766cef78..bb4ff207fc 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.c @@ -115,14 +115,14 @@ void deleteArray(double *array) void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic, ExternalVariable externalVariable) { + states[0] = 0.6; + states[1] = 0.05; + states[2] = 0.325; constants[0] = 1.0; constants[1] = 0.0; constants[2] = 0.3; constants[3] = 120.0; constants[4] = 36.0; - states[0] = 0.6; - states[1] = 0.05; - states[2] = 0.325; algebraic[1] = externalVariable(voi, states, rates, variables, 1); algebraic[9] = externalVariable(voi, states, rates, variables, 9); algebraic[4] = externalVariable(voi, states, rates, variables, 4); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.py index 8813c2b024..e3b132256f 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.py @@ -86,14 +86,14 @@ def create_externals_array(): def initialise_variables(voi, states, rates, constants, algebraic, external_variable): + states[0] = 0.6 + states[1] = 0.05 + states[2] = 0.325 constants[0] = 1.0 constants[1] = 0.0 constants[2] = 0.3 constants[3] = 120.0 constants[4] = 36.0 - states[0] = 0.6 - states[1] = 0.05 - states[2] = 0.325 algebraic[1] = external_variable(voi, states, rates, variables, 1) algebraic[9] = external_variable(voi, states, rates, variables, 9) algebraic[4] = external_variable(voi, states, rates, variables, 4) diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.py index 82b0b193e9..7aaf3feb17 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.py @@ -78,15 +78,15 @@ def create_algebraic_array(): def initialise_variables(states, rates, constants, algebraic): + states[0] = 0.0 + states[1] = 0.6 + states[2] = 0.05 + states[3] = 0.325 constants[0] = 1.0 constants[1] = 0.0 constants[2] = 0.3 constants[3] = 120.0 constants[4] = 36.0 - states[0] = 0.0 - states[1] = 0.6 - states[2] = 0.05 - states[3] = 0.325 def compute_computed_constants(constants, computed_constants): diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.c index 373332828f..fff1a06f0b 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.c @@ -115,14 +115,14 @@ void deleteArray(double *array) void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic, ExternalVariable externalVariable) { + states[0] = 0.0; + states[1] = 0.6; + states[2] = 0.325; constants[0] = 1.0; constants[1] = 0.0; constants[2] = 0.3; constants[3] = 120.0; constants[4] = 36.0; - states[0] = 0.0; - states[1] = 0.6; - states[2] = 0.325; algebraic[4] = externalVariable(voi, states, rates, variables, 4); } diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.py index c13120d5c4..c9fd022750 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.py @@ -86,14 +86,14 @@ def create_externals_array(): def initialise_variables(voi, states, rates, constants, algebraic, external_variable): + states[0] = 0.0 + states[1] = 0.6 + states[2] = 0.325 constants[0] = 1.0 constants[1] = 0.0 constants[2] = 0.3 constants[3] = 120.0 constants[4] = 36.0 - states[0] = 0.0 - states[1] = 0.6 - states[2] = 0.325 algebraic[4] = external_variable(voi, states, rates, variables, 4) diff --git a/tests/resources/generator/noble_model_1962/model.c b/tests/resources/generator/noble_model_1962/model.c index f1ddf05938..7b978a5a76 100644 --- a/tests/resources/generator/noble_model_1962/model.c +++ b/tests/resources/generator/noble_model_1962/model.c @@ -99,15 +99,15 @@ void deleteArray(double *array) void initialiseVariables(double *states, double *rates, double *constants, double *algebraic) { + states[0] = -87.0; + states[1] = 0.01; + states[2] = 0.8; + states[3] = 0.01; constants[0] = 12.0; constants[1] = 0.075; constants[2] = -60.0; constants[3] = 400.0; constants[4] = 40.0; - states[0] = -87.0; - states[1] = 0.01; - states[2] = 0.8; - states[3] = 0.01; } void computeComputedConstants(double *constants, double *computedConstants) diff --git a/tests/resources/generator/noble_model_1962/model.py b/tests/resources/generator/noble_model_1962/model.py index 04b15d26b7..998e70942a 100644 --- a/tests/resources/generator/noble_model_1962/model.py +++ b/tests/resources/generator/noble_model_1962/model.py @@ -65,15 +65,15 @@ def create_algebraic_array(): def initialise_variables(states, rates, constants, algebraic): + states[0] = -87.0 + states[1] = 0.01 + states[2] = 0.8 + states[3] = 0.01 constants[0] = 12.0 constants[1] = 0.075 constants[2] = -60.0 constants[3] = 400.0 constants[4] = 40.0 - states[0] = -87.0 - states[1] = 0.01 - states[2] = 0.8 - states[3] = 0.01 def compute_computed_constants(constants, computed_constants): diff --git a/tests/resources/generator/ode_computed_var_on_rhs/model.c b/tests/resources/generator/ode_computed_var_on_rhs/model.c index 60f3dd752c..acf5f9b717 100644 --- a/tests/resources/generator/ode_computed_var_on_rhs/model.c +++ b/tests/resources/generator/ode_computed_var_on_rhs/model.c @@ -80,8 +80,8 @@ void deleteArray(double *array) void initialiseVariables(double *states, double *rates, double *constants, double *algebraic) { - computedConstants[0] = 1.0; states[0] = 1.0; + computedConstants[0] = 1.0; } void computeComputedConstants(double *constants, double *computedConstants) diff --git a/tests/resources/generator/ode_computed_var_on_rhs/model.py b/tests/resources/generator/ode_computed_var_on_rhs/model.py index 607d6c441e..e4b0565e7a 100644 --- a/tests/resources/generator/ode_computed_var_on_rhs/model.py +++ b/tests/resources/generator/ode_computed_var_on_rhs/model.py @@ -46,8 +46,8 @@ def create_algebraic_array(): def initialise_variables(states, rates, constants, algebraic): - computed_constants[0] = 1.0 states[0] = 1.0 + computed_constants[0] = 1.0 def compute_computed_constants(constants, computed_constants): diff --git a/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.c b/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.c index c8b4178409..c1700a4972 100644 --- a/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.c +++ b/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.c @@ -80,8 +80,8 @@ void deleteArray(double *array) void initialiseVariables(double *states, double *rates, double *constants, double *algebraic) { - computedConstants[0] = 1.0; states[0] = 1.0; + computedConstants[0] = 1.0; } void computeComputedConstants(double *constants, double *computedConstants) diff --git a/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.py b/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.py index 11486d4f88..aa95574b4f 100644 --- a/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.py +++ b/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.py @@ -46,8 +46,8 @@ def create_algebraic_array(): def initialise_variables(states, rates, constants, algebraic): - computed_constants[0] = 1.0 states[0] = 1.0 + computed_constants[0] = 1.0 def compute_computed_constants(constants, computed_constants): diff --git a/tests/resources/generator/ode_const_var_on_rhs/model.c b/tests/resources/generator/ode_const_var_on_rhs/model.c index 3e90ce4181..f201c2cb4d 100644 --- a/tests/resources/generator/ode_const_var_on_rhs/model.c +++ b/tests/resources/generator/ode_const_var_on_rhs/model.c @@ -80,8 +80,8 @@ void deleteArray(double *array) void initialiseVariables(double *states, double *rates, double *constants, double *algebraic) { - constants[0] = 1.0; states[0] = 1.0; + constants[0] = 1.0; } void computeComputedConstants(double *constants, double *computedConstants) diff --git a/tests/resources/generator/ode_const_var_on_rhs/model.py b/tests/resources/generator/ode_const_var_on_rhs/model.py index 95b5ade5f5..17b950ef3b 100644 --- a/tests/resources/generator/ode_const_var_on_rhs/model.py +++ b/tests/resources/generator/ode_const_var_on_rhs/model.py @@ -46,8 +46,8 @@ def create_algebraic_array(): def initialise_variables(states, rates, constants, algebraic): - constants[0] = 1.0 states[0] = 1.0 + constants[0] = 1.0 def compute_computed_constants(constants, computed_constants): diff --git a/tests/resources/generator/ode_const_var_on_rhs_one_component/model.c b/tests/resources/generator/ode_const_var_on_rhs_one_component/model.c index b5cd5dc86b..19f3ea08f0 100644 --- a/tests/resources/generator/ode_const_var_on_rhs_one_component/model.c +++ b/tests/resources/generator/ode_const_var_on_rhs_one_component/model.c @@ -80,8 +80,8 @@ void deleteArray(double *array) void initialiseVariables(double *states, double *rates, double *constants, double *algebraic) { - constants[0] = 1.0; states[0] = 1.0; + constants[0] = 1.0; } void computeComputedConstants(double *constants, double *computedConstants) diff --git a/tests/resources/generator/ode_const_var_on_rhs_one_component/model.py b/tests/resources/generator/ode_const_var_on_rhs_one_component/model.py index 4da1db0897..4179fad784 100644 --- a/tests/resources/generator/ode_const_var_on_rhs_one_component/model.py +++ b/tests/resources/generator/ode_const_var_on_rhs_one_component/model.py @@ -46,8 +46,8 @@ def create_algebraic_array(): def initialise_variables(states, rates, constants, algebraic): - constants[0] = 1.0 states[0] = 1.0 + constants[0] = 1.0 def compute_computed_constants(constants, computed_constants): diff --git a/tests/resources/generator/ode_multiple_dependent_odes/model.c b/tests/resources/generator/ode_multiple_dependent_odes/model.c index c335d5c5ab..50b5e525bc 100644 --- a/tests/resources/generator/ode_multiple_dependent_odes/model.c +++ b/tests/resources/generator/ode_multiple_dependent_odes/model.c @@ -81,9 +81,9 @@ void deleteArray(double *array) void initialiseVariables(double *states, double *rates, double *constants, double *algebraic) { - constants[0] = 1.0; states[0] = -2.0; states[1] = 0.0; + constants[0] = 1.0; } void computeComputedConstants(double *constants, double *computedConstants) diff --git a/tests/resources/generator/ode_multiple_dependent_odes/model.py b/tests/resources/generator/ode_multiple_dependent_odes/model.py index d3a7b6a539..cfe8f9dbb3 100644 --- a/tests/resources/generator/ode_multiple_dependent_odes/model.py +++ b/tests/resources/generator/ode_multiple_dependent_odes/model.py @@ -47,9 +47,9 @@ def create_algebraic_array(): def initialise_variables(states, rates, constants, algebraic): - constants[0] = 1.0 states[0] = -2.0 states[1] = 0.0 + constants[0] = 1.0 def compute_computed_constants(constants, computed_constants): diff --git a/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.c b/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.c index 57ea6044a4..69cb46ef08 100644 --- a/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.c +++ b/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.c @@ -81,9 +81,9 @@ void deleteArray(double *array) void initialiseVariables(double *states, double *rates, double *constants, double *algebraic) { - constants[0] = 1.0; states[0] = -2.0; states[1] = 0.0; + constants[0] = 1.0; } void computeComputedConstants(double *constants, double *computedConstants) diff --git a/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.py b/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.py index 28fe3ff9db..d6823483bb 100644 --- a/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.py +++ b/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.py @@ -47,9 +47,9 @@ def create_algebraic_array(): def initialise_variables(states, rates, constants, algebraic): - constants[0] = 1.0 states[0] = -2.0 states[1] = 0.0 + constants[0] = 1.0 def compute_computed_constants(constants, computed_constants): diff --git a/tests/resources/generator/ode_multiple_odes_with_same_name/model.c b/tests/resources/generator/ode_multiple_odes_with_same_name/model.c index fe2854380e..67a376b764 100644 --- a/tests/resources/generator/ode_multiple_odes_with_same_name/model.c +++ b/tests/resources/generator/ode_multiple_odes_with_same_name/model.c @@ -81,9 +81,9 @@ void deleteArray(double *array) void initialiseVariables(double *states, double *rates, double *constants, double *algebraic) { - constants[0] = 1.0; states[0] = 1.0; states[1] = 1.0; + constants[0] = 1.0; } void computeComputedConstants(double *constants, double *computedConstants) diff --git a/tests/resources/generator/ode_multiple_odes_with_same_name/model.py b/tests/resources/generator/ode_multiple_odes_with_same_name/model.py index c9ff7906f2..3fc06a3ab8 100644 --- a/tests/resources/generator/ode_multiple_odes_with_same_name/model.py +++ b/tests/resources/generator/ode_multiple_odes_with_same_name/model.py @@ -47,9 +47,9 @@ def create_algebraic_array(): def initialise_variables(states, rates, constants, algebraic): - constants[0] = 1.0 states[0] = 1.0 states[1] = 1.0 + constants[0] = 1.0 def compute_computed_constants(constants, computed_constants): diff --git a/tests/resources/generator/robertson_model_1966/model.dae.c b/tests/resources/generator/robertson_model_1966/model.dae.c index f1bdfd8f01..026a8322f9 100644 --- a/tests/resources/generator/robertson_model_1966/model.dae.c +++ b/tests/resources/generator/robertson_model_1966/model.dae.c @@ -119,12 +119,12 @@ void findRoot0(double voi, double *states, double *rates, double *variables) void initialiseVariables(double *states, double *rates, double *constants, double *algebraic) { + states[0] = 1.0; + states[1] = 0.0; constants[0] = 0.04; constants[1] = 1.0e4; constants[2] = 3.0e7; algebraic[0] = 0.0; - states[0] = 1.0; - states[1] = 0.0; } void computeComputedConstants(double *constants, double *computedConstants) diff --git a/tests/resources/generator/robertson_model_1966/model.dae.py b/tests/resources/generator/robertson_model_1966/model.dae.py index fdf9916959..ab43813892 100644 --- a/tests/resources/generator/robertson_model_1966/model.dae.py +++ b/tests/resources/generator/robertson_model_1966/model.dae.py @@ -75,12 +75,12 @@ def find_root_0(voi, states, rates, variables): def initialise_variables(states, rates, constants, algebraic): + states[0] = 1.0 + states[1] = 0.0 constants[0] = 0.04 constants[1] = 1.0e4 constants[2] = 3.0e7 algebraic[0] = 0.0 - states[0] = 1.0 - states[1] = 0.0 def compute_computed_constants(constants, computed_constants): diff --git a/tests/resources/generator/robertson_model_1966/model.ode.c b/tests/resources/generator/robertson_model_1966/model.ode.c index d304b17f9f..6685a416ad 100644 --- a/tests/resources/generator/robertson_model_1966/model.ode.c +++ b/tests/resources/generator/robertson_model_1966/model.ode.c @@ -85,12 +85,12 @@ void deleteArray(double *array) void initialiseVariables(double *states, double *rates, double *constants, double *algebraic) { - constants[0] = 0.04; - constants[1] = 1.0e4; - constants[2] = 3.0e7; states[0] = 1.0; states[1] = 0.0; states[2] = 0.0; + constants[0] = 0.04; + constants[1] = 1.0e4; + constants[2] = 3.0e7; } void computeComputedConstants(double *constants, double *computedConstants) diff --git a/tests/resources/generator/robertson_model_1966/model.ode.py b/tests/resources/generator/robertson_model_1966/model.ode.py index 0da019dd39..d6da1199a5 100644 --- a/tests/resources/generator/robertson_model_1966/model.ode.py +++ b/tests/resources/generator/robertson_model_1966/model.ode.py @@ -51,12 +51,12 @@ def create_algebraic_array(): def initialise_variables(states, rates, constants, algebraic): - constants[0] = 0.04 - constants[1] = 1.0e4 - constants[2] = 3.0e7 states[0] = 1.0 states[1] = 0.0 states[2] = 0.0 + constants[0] = 0.04 + constants[1] = 1.0e4 + constants[2] = 3.0e7 def compute_computed_constants(constants, computed_constants): diff --git a/tests/resources/generator/sine_model_imports/model.c b/tests/resources/generator/sine_model_imports/model.c index afc9fc26ab..1f9180682d 100644 --- a/tests/resources/generator/sine_model_imports/model.c +++ b/tests/resources/generator/sine_model_imports/model.c @@ -89,6 +89,7 @@ void deleteArray(double *array) void initialiseVariables(double *states, double *rates, double *constants, double *algebraic) { + states[0] = constants[0]; constants[0] = 0.0; constants[1] = 0.75; computedConstants[0] = 2.0/3.14159265358979; @@ -96,7 +97,6 @@ void initialiseVariables(double *states, double *rates, double *constants, doubl computedConstants[2] = 3.14159265358979/2.0; computedConstants[3] = 3.14159265358979; computedConstants[4] = 3.0*3.14159265358979/2.0; - states[0] = constants[0]; } void computeComputedConstants(double *constants, double *computedConstants) diff --git a/tests/resources/generator/sine_model_imports/model.py b/tests/resources/generator/sine_model_imports/model.py index 68dbffb339..454eb64938 100644 --- a/tests/resources/generator/sine_model_imports/model.py +++ b/tests/resources/generator/sine_model_imports/model.py @@ -59,6 +59,7 @@ def create_algebraic_array(): def initialise_variables(states, rates, constants, algebraic): + states[0] = constants[0] constants[0] = 0.0 constants[1] = 0.75 computed_constants[0] = 2.0/3.14159265358979 @@ -66,7 +67,6 @@ def initialise_variables(states, rates, constants, algebraic): computed_constants[2] = 3.14159265358979/2.0 computed_constants[3] = 3.14159265358979 computed_constants[4] = 3.0*3.14159265358979/2.0 - states[0] = constants[0] def compute_computed_constants(constants, computed_constants): diff --git a/tests/resources/generator/variable_initialised_using_a_constant/model.c b/tests/resources/generator/variable_initialised_using_a_constant/model.c index 778e44ef94..e230aecdb3 100644 --- a/tests/resources/generator/variable_initialised_using_a_constant/model.c +++ b/tests/resources/generator/variable_initialised_using_a_constant/model.c @@ -80,8 +80,8 @@ void deleteArray(double *array) void initialiseVariables(double *states, double *rates, double *constants, double *algebraic) { - constants[0] = 7.0; states[0] = constants[0]; + constants[0] = 7.0; } void computeComputedConstants(double *constants, double *computedConstants) diff --git a/tests/resources/generator/variable_initialised_using_a_constant/model.py b/tests/resources/generator/variable_initialised_using_a_constant/model.py index 4be9384a6e..814cd74a79 100644 --- a/tests/resources/generator/variable_initialised_using_a_constant/model.py +++ b/tests/resources/generator/variable_initialised_using_a_constant/model.py @@ -46,8 +46,8 @@ def create_algebraic_array(): def initialise_variables(states, rates, constants, algebraic): - constants[0] = 7.0 states[0] = constants[0] + constants[0] = 7.0 def compute_computed_constants(constants, computed_constants): From b1b753624b8d3565383c41820af51050286fba12 Mon Sep 17 00:00:00 2001 From: Alan Garny Date: Thu, 15 Aug 2024 16:44:42 +0200 Subject: [PATCH 26/85] Generator: initialise all computed constants in computeComputedConstants(). --- src/generator.cpp | 17 ++++++++++--- tests/resources/coverage/generator/model.c | 24 +++++++++---------- .../generator/model.implementation.out | 24 +++++++++---------- .../generator/model.modified.profile.c | 24 +++++++++---------- .../generator/model.modified.profile.py | 24 +++++++++---------- tests/resources/coverage/generator/model.out | 24 +++++++++---------- tests/resources/coverage/generator/model.py | 24 +++++++++---------- .../algebraic_eqn_computed_var_on_rhs/model.c | 2 +- .../model.py | 3 ++- .../algebraic_eqn_constant_on_rhs/model.c | 2 +- .../algebraic_eqn_constant_on_rhs/model.py | 4 ++-- .../algebraic_eqn_derivative_on_rhs/model.c | 2 +- .../algebraic_eqn_derivative_on_rhs/model.py | 3 +-- .../model.c | 2 +- .../model.py | 3 +-- .../algebraic_eqn_state_var_on_rhs/model.c | 2 +- .../algebraic_eqn_state_var_on_rhs/model.py | 3 +-- .../model.c | 2 +- .../model.py | 3 +-- .../model.c | 6 ++--- .../model.external.c | 6 ++--- .../model.external.py | 7 +++--- .../model.py | 7 +++--- .../algebraic_unknown_var_on_rhs/model.c | 2 +- .../algebraic_unknown_var_on_rhs/model.py | 3 ++- .../generator/ode_computed_var_on_rhs/model.c | 2 +- .../ode_computed_var_on_rhs/model.py | 3 +-- .../model.c | 2 +- .../model.py | 3 +-- .../generator/sine_model_imports/model.c | 8 +++---- .../generator/sine_model_imports/model.py | 7 +++--- 31 files changed, 126 insertions(+), 122 deletions(-) diff --git a/src/generator.cpp b/src/generator.cpp index 0404698ab3..95b8bba402 100644 --- a/src/generator.cpp +++ b/src/generator.cpp @@ -1854,12 +1854,16 @@ void Generator::GeneratorImpl::addImplementationInitialiseVariablesMethodCode(st } } - // Initialise our true constants. + // Initialise our (initialised) true constants. + // Note: this means that we don't initialise (computed) constants that are initialised using a true constant + // through an equation (e.g., x = 3 rather than x with an initial value of 3), hence we test the number + // of constants in the equation. auto equations = mModel->equations(); for (const auto &equation : equations) { - if (equation->type() == AnalyserEquation::Type::TRUE_CONSTANT) { + if ((equation->constantCount() == 1) + && (equation->type() == AnalyserEquation::Type::TRUE_CONSTANT)) { methodBody += generateEquationCode(equation, remainingEquations); } } @@ -1889,10 +1893,17 @@ void Generator::GeneratorImpl::addImplementationInitialiseVariablesMethodCode(st void Generator::GeneratorImpl::addImplementationComputeComputedConstantsMethodCode(std::vector &remainingEquations) { if (!mProfile->implementationComputeComputedConstantsMethodString().empty()) { + // Initialise all our computed constants. + // Note: this means (computed) constants that are initialised using an equation that relies on constant + // variables (e.g., x = a + b, with a and b being constants), as well as (computed) constants that are + // initialised using a true constant through an equation (e.g., x = 3 rather than x with an initial value + // of 3). + std::string methodBody; for (const auto &equation : mModel->equations()) { - if (equation->type() == AnalyserEquation::Type::VARIABLE_BASED_CONSTANT) { + if ((equation->type() == AnalyserEquation::Type::TRUE_CONSTANT) + || (equation->type() == AnalyserEquation::Type::VARIABLE_BASED_CONSTANT)) { methodBody += generateEquationCode(equation, remainingEquations); } } diff --git a/tests/resources/coverage/generator/model.c b/tests/resources/coverage/generator/model.c index b6479b2b85..8ba9f8fd41 100644 --- a/tests/resources/coverage/generator/model.c +++ b/tests/resources/coverage/generator/model.c @@ -417,18 +417,6 @@ void initialiseVariables(double *states, double *rates, double *constants, doubl constants[6] = 7.0; algebraic[0] = 1.0; algebraic[1] = 2.0; - computedConstants[177] = 123.0; - computedConstants[178] = 123.456789; - computedConstants[179] = 123.0e99; - computedConstants[180] = 123.456789e99; - computedConstants[182] = 1.0; - computedConstants[183] = 0.0; - computedConstants[184] = 2.71828182845905; - computedConstants[185] = 3.14159265358979; - computedConstants[186] = INFINITY; - computedConstants[187] = NAN; - computedConstants[198] = 1.0; - computedConstants[199] = 3.0; } void computeComputedConstants(double *constants, double *computedConstants) @@ -610,7 +598,17 @@ void computeComputedConstants(double *constants, double *computedConstants) computedConstants[174] = (constants[0] > constants[1])?constants[0]:(constants[2] > constants[3])?constants[2]:(constants[4] > constants[5])?constants[4]:NAN; computedConstants[175] = (constants[0] > constants[1])?constants[0]:(constants[2] > constants[3])?constants[2]:(constants[4] > constants[5])?constants[4]:constants[6]; computedConstants[176] = 123.0+((constants[0] > constants[1])?constants[0]:NAN); + computedConstants[177] = 123.0; + computedConstants[178] = 123.456789; + computedConstants[179] = 123.0e99; + computedConstants[180] = 123.456789e99; computedConstants[181] = constants[0]; + computedConstants[182] = 1.0; + computedConstants[183] = 0.0; + computedConstants[184] = 2.71828182845905; + computedConstants[185] = 3.14159265358979; + computedConstants[186] = INFINITY; + computedConstants[187] = NAN; computedConstants[188] = (constants[0] && constants[1])+((constants[2] > constants[3])?constants[1]:NAN)+constants[4]+(constants[5] && constants[6]); computedConstants[189] = (constants[0] && constants[1])-(((constants[2] > constants[3])?constants[1]:NAN)-(constants[4]-((constants[2] > constants[3])?constants[1]:NAN)))-(constants[5] && constants[6]); computedConstants[190] = (constants[0] && constants[1])*((constants[2] > constants[3])?constants[1]:NAN)*constants[4]*((constants[2] > constants[3])?constants[1]:NAN)*(constants[5] && constants[6]); @@ -621,6 +619,8 @@ void computeComputedConstants(double *constants, double *computedConstants) computedConstants[195] = pow(constants[0] && constants[1], pow((constants[2] > constants[3])?constants[1]:NAN, pow(pow(constants[4], (constants[2] > constants[3])?constants[1]:NAN), constants[0] && constants[1]))); computedConstants[196] = pow(pow(pow(constants[0] && constants[1], 1.0/pow((constants[2] > constants[3])?constants[1]:NAN, 1.0/constants[4])), 1.0/((constants[2] > constants[3])?constants[1]:NAN)), 1.0/(constants[0] && constants[1])); computedConstants[197] = -(constants[0] && constants[1])+-((constants[2] > constants[3])?constants[1]:NAN); + computedConstants[198] = 1.0; + computedConstants[199] = 3.0; } void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) diff --git a/tests/resources/coverage/generator/model.implementation.out b/tests/resources/coverage/generator/model.implementation.out index ab220a0b3d..4e3c752330 100644 --- a/tests/resources/coverage/generator/model.implementation.out +++ b/tests/resources/coverage/generator/model.implementation.out @@ -180,18 +180,6 @@ void initialiseVariables(double *states, double *rates, double *constants, doubl constants[6] = 7.0; algebraic[0] = 1.0; algebraic[1] = 2.0; - computedConstants[177] = 123.0; - computedConstants[178] = 123.456789; - computedConstants[179] = 123.0e99; - computedConstants[180] = 123.456789e99; - computedConstants[182] = 1.0; - computedConstants[183] = 0.0; - computedConstants[184] = 2.71828182845905; - computedConstants[185] = 3.14159265358979; - computedConstants[186] = INFINITY; - computedConstants[187] = NAN; - computedConstants[198] = 1.0; - computedConstants[199] = 3.0; } void computeComputedConstants(double *constants, double *computedConstants) @@ -373,7 +361,17 @@ void computeComputedConstants(double *constants, double *computedConstants) computedConstants[174] = (gt(constants[0], constants[1]))?constants[0]:(gt(constants[2], constants[3]))?constants[2]:(gt(constants[4], constants[5]))?constants[4]:NAN; computedConstants[175] = (gt(constants[0], constants[1]))?constants[0]:(gt(constants[2], constants[3]))?constants[2]:(gt(constants[4], constants[5]))?constants[4]:constants[6]; computedConstants[176] = 123.0+((gt(constants[0], constants[1]))?constants[0]:NAN); + computedConstants[177] = 123.0; + computedConstants[178] = 123.456789; + computedConstants[179] = 123.0e99; + computedConstants[180] = 123.456789e99; computedConstants[181] = constants[0]; + computedConstants[182] = 1.0; + computedConstants[183] = 0.0; + computedConstants[184] = 2.71828182845905; + computedConstants[185] = 3.14159265358979; + computedConstants[186] = INFINITY; + computedConstants[187] = NAN; computedConstants[188] = and(constants[0], constants[1])+((gt(constants[2], constants[3]))?constants[1]:NAN)+constants[4]+and(constants[5], constants[6]); computedConstants[189] = and(constants[0], constants[1])-(((gt(constants[2], constants[3]))?constants[1]:NAN)-(constants[4]-((gt(constants[2], constants[3]))?constants[1]:NAN)))-and(constants[5], constants[6]); computedConstants[190] = and(constants[0], constants[1])*((gt(constants[2], constants[3]))?constants[1]:NAN)*constants[4]*((gt(constants[2], constants[3]))?constants[1]:NAN)*and(constants[5], constants[6]); @@ -384,6 +382,8 @@ void computeComputedConstants(double *constants, double *computedConstants) computedConstants[195] = pow(and(constants[0], constants[1]), pow((gt(constants[2], constants[3]))?constants[1]:NAN, pow(pow(constants[4], (gt(constants[2], constants[3]))?constants[1]:NAN), and(constants[0], constants[1])))); computedConstants[196] = pow(pow(pow(and(constants[0], constants[1]), 1.0/pow((gt(constants[2], constants[3]))?constants[1]:NAN, 1.0/constants[4])), 1.0/((gt(constants[2], constants[3]))?constants[1]:NAN)), 1.0/and(constants[0], constants[1])); computedConstants[197] = -and(constants[0], constants[1])+-((gt(constants[2], constants[3]))?constants[1]:NAN); + computedConstants[198] = 1.0; + computedConstants[199] = 3.0; } void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) diff --git a/tests/resources/coverage/generator/model.modified.profile.c b/tests/resources/coverage/generator/model.modified.profile.c index 96320e6c00..32e5b78d5b 100644 --- a/tests/resources/coverage/generator/model.modified.profile.c +++ b/tests/resources/coverage/generator/model.modified.profile.c @@ -417,18 +417,6 @@ void initialiseVariables(double *states, double *rates, double *constants, doubl constants[6] = 7.0; algebraic[0] = 1.0; algebraic[1] = 2.0; - computedConstants[177] = 123.0; - computedConstants[178] = 123.456789; - computedConstants[179] = 123.0e99; - computedConstants[180] = 123.456789e99; - computedConstants[182] = 1.0; - computedConstants[183] = 0.0; - computedConstants[184] = 2.71828182845905; - computedConstants[185] = 3.14159265358979; - computedConstants[186] = INFINITY; - computedConstants[187] = NAN; - computedConstants[198] = 1.0; - computedConstants[199] = 3.0; } void computeComputedConstants(double *constants, double *computedConstants) @@ -610,7 +598,17 @@ void computeComputedConstants(double *constants, double *computedConstants) computedConstants[174] = (constants[0] > constants[1])?constants[0]:(constants[2] > constants[3])?constants[2]:(constants[4] > constants[5])?constants[4]:NAN; computedConstants[175] = (constants[0] > constants[1])?constants[0]:(constants[2] > constants[3])?constants[2]:(constants[4] > constants[5])?constants[4]:constants[6]; computedConstants[176] = 123.0+((constants[0] > constants[1])?constants[0]:NAN); + computedConstants[177] = 123.0; + computedConstants[178] = 123.456789; + computedConstants[179] = 123.0e99; + computedConstants[180] = 123.456789e99; computedConstants[181] = constants[0]; + computedConstants[182] = 1.0; + computedConstants[183] = 0.0; + computedConstants[184] = 2.71828182845905; + computedConstants[185] = 3.14159265358979; + computedConstants[186] = INFINITY; + computedConstants[187] = NAN; computedConstants[188] = (constants[0] && constants[1])+((constants[2] > constants[3])?constants[1]:NAN)+constants[4]+(constants[5] && constants[6]); computedConstants[189] = (constants[0] && constants[1])-(((constants[2] > constants[3])?constants[1]:NAN)-(constants[4]-((constants[2] > constants[3])?constants[1]:NAN)))-(constants[5] && constants[6]); computedConstants[190] = (constants[0] && constants[1])*((constants[2] > constants[3])?constants[1]:NAN)*constants[4]*((constants[2] > constants[3])?constants[1]:NAN)*(constants[5] && constants[6]); @@ -621,6 +619,8 @@ void computeComputedConstants(double *constants, double *computedConstants) computedConstants[195] = pow(constants[0] && constants[1], pow((constants[2] > constants[3])?constants[1]:NAN, pow(pow(constants[4], (constants[2] > constants[3])?constants[1]:NAN), constants[0] && constants[1]))); computedConstants[196] = pow(pow(pow(constants[0] && constants[1], 1.0/pow((constants[2] > constants[3])?constants[1]:NAN, 1.0/constants[4])), 1.0/((constants[2] > constants[3])?constants[1]:NAN)), 1.0/(constants[0] && constants[1])); computedConstants[197] = -(constants[0] && constants[1])+-((constants[2] > constants[3])?constants[1]:NAN); + computedConstants[198] = 1.0; + computedConstants[199] = 3.0; } void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) diff --git a/tests/resources/coverage/generator/model.modified.profile.py b/tests/resources/coverage/generator/model.modified.profile.py index eea22df56c..5c5e36cbd6 100644 --- a/tests/resources/coverage/generator/model.modified.profile.py +++ b/tests/resources/coverage/generator/model.modified.profile.py @@ -394,18 +394,6 @@ def initialise_variables(states, rates, constants, algebraic): constants[6] = 7.0 algebraic[0] = 1.0 algebraic[1] = 2.0 - computed_constants[177] = 123.0 - computed_constants[178] = 123.456789 - computed_constants[179] = 123.0e99 - computed_constants[180] = 123.456789e99 - computed_constants[182] = 1.0 - computed_constants[183] = 0.0 - computed_constants[184] = 2.71828182845905 - computed_constants[185] = 3.14159265358979 - computed_constants[186] = inf - computed_constants[187] = nan - computed_constants[198] = 1.0 - computed_constants[199] = 3.0 def compute_computed_constants(constants, computed_constants): @@ -586,7 +574,17 @@ def compute_computed_constants(constants, computed_constants): computed_constants[174] = constants[0] if gt_func(constants[0], constants[1]) else constants[2] if gt_func(constants[2], constants[3]) else constants[4] if gt_func(constants[4], constants[5]) else nan computed_constants[175] = constants[0] if gt_func(constants[0], constants[1]) else constants[2] if gt_func(constants[2], constants[3]) else constants[4] if gt_func(constants[4], constants[5]) else constants[6] computed_constants[176] = 123.0+(constants[0] if gt_func(constants[0], constants[1]) else nan) + computed_constants[177] = 123.0 + computed_constants[178] = 123.456789 + computed_constants[179] = 123.0e99 + computed_constants[180] = 123.456789e99 computed_constants[181] = constants[0] + computed_constants[182] = 1.0 + computed_constants[183] = 0.0 + computed_constants[184] = 2.71828182845905 + computed_constants[185] = 3.14159265358979 + computed_constants[186] = inf + computed_constants[187] = nan computed_constants[188] = and_func(constants[0], constants[1])+(constants[1] if gt_func(constants[2], constants[3]) else nan)+constants[4]+and_func(constants[5], constants[6]) computed_constants[189] = and_func(constants[0], constants[1])-((constants[1] if gt_func(constants[2], constants[3]) else nan)-(constants[4]-(constants[1] if gt_func(constants[2], constants[3]) else nan)))-and_func(constants[5], constants[6]) computed_constants[190] = and_func(constants[0], constants[1])*(constants[1] if gt_func(constants[2], constants[3]) else nan)*constants[4]*(constants[1] if gt_func(constants[2], constants[3]) else nan)*and_func(constants[5], constants[6]) @@ -597,6 +595,8 @@ def compute_computed_constants(constants, computed_constants): computed_constants[195] = pow(and_func(constants[0], constants[1]), pow(constants[1] if gt_func(constants[2], constants[3]) else nan, pow(pow(constants[4], constants[1] if gt_func(constants[2], constants[3]) else nan), and_func(constants[0], constants[1])))) computed_constants[196] = pow(pow(pow(and_func(constants[0], constants[1]), 1.0/pow(constants[1] if gt_func(constants[2], constants[3]) else nan, 1.0/constants[4])), 1.0/(constants[1] if gt_func(constants[2], constants[3]) else nan)), 1.0/and_func(constants[0], constants[1])) computed_constants[197] = -and_func(constants[0], constants[1])+-(constants[1] if gt_func(constants[2], constants[3]) else nan) + computed_constants[198] = 1.0 + computed_constants[199] = 3.0 def compute_rates(voi, states, rates, constants, computed_constants, algebraic): diff --git a/tests/resources/coverage/generator/model.out b/tests/resources/coverage/generator/model.out index 3f57e2f5c7..63ed9abc24 100644 --- a/tests/resources/coverage/generator/model.out +++ b/tests/resources/coverage/generator/model.out @@ -128,18 +128,6 @@ void initialiseVariables(double *states, double *rates, double *constants, doubl constants[6] = 7.0; algebraic[0] = 1.0; algebraic[1] = 2.0; - computedConstants[177] = 123.0; - computedConstants[178] = 123.456789; - computedConstants[179] = 123.0e99; - computedConstants[180] = 123.456789e99; - computedConstants[182] = 1.0; - computedConstants[183] = 0.0; - computedConstants[184] = 2.71828182845905; - computedConstants[185] = 3.14159265358979; - computedConstants[186] = INFINITY; - computedConstants[187] = NAN; - computedConstants[198] = 1.0; - computedConstants[199] = 3.0; } void computeComputedConstants(double *constants, double *computedConstants) @@ -321,7 +309,17 @@ void computeComputedConstants(double *constants, double *computedConstants) computedConstants[174] = piecewise(constants[0] > constants[1], constants[0], piecewise(constants[2] > constants[3], constants[2], piecewise(constants[4] > constants[5], constants[4], NAN))); computedConstants[175] = piecewise(constants[0] > constants[1], constants[0], piecewise(constants[2] > constants[3], constants[2], piecewise(constants[4] > constants[5], constants[4], constants[6]))); computedConstants[176] = 123.0+piecewise(constants[0] > constants[1], constants[0], NAN); + computedConstants[177] = 123.0; + computedConstants[178] = 123.456789; + computedConstants[179] = 123.0e99; + computedConstants[180] = 123.456789e99; computedConstants[181] = constants[0]; + computedConstants[182] = 1.0; + computedConstants[183] = 0.0; + computedConstants[184] = 2.71828182845905; + computedConstants[185] = 3.14159265358979; + computedConstants[186] = INFINITY; + computedConstants[187] = NAN; computedConstants[188] = (constants[0] && constants[1])+piecewise(constants[2] > constants[3], constants[1], NAN)+constants[4]+(constants[5] && constants[6]); computedConstants[189] = (constants[0] && constants[1])-(piecewise(constants[2] > constants[3], constants[1], NAN)-(constants[4]-piecewise(constants[2] > constants[3], constants[1], NAN)))-(constants[5] && constants[6]); computedConstants[190] = (constants[0] && constants[1])*piecewise(constants[2] > constants[3], constants[1], NAN)*constants[4]*piecewise(constants[2] > constants[3], constants[1], NAN)*(constants[5] && constants[6]); @@ -332,6 +330,8 @@ void computeComputedConstants(double *constants, double *computedConstants) computedConstants[195] = (constants[0] && constants[1])^^(piecewise(constants[2] > constants[3], constants[1], NAN)^^(constants[4]^^piecewise(constants[2] > constants[3], constants[1], NAN)^^(constants[0] && constants[1]))); computedConstants[196] = (constants[0] && constants[1])^^(1.0/(piecewise(constants[2] > constants[3], constants[1], NAN)^^(1.0/constants[4])))^^(1.0/piecewise(constants[2] > constants[3], constants[1], NAN))^^(1.0/(constants[0] && constants[1])); computedConstants[197] = -(constants[0] && constants[1])+-piecewise(constants[2] > constants[3], constants[1], NAN); + computedConstants[198] = 1.0; + computedConstants[199] = 3.0; } void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) diff --git a/tests/resources/coverage/generator/model.py b/tests/resources/coverage/generator/model.py index 8e305579fd..b36dad8dea 100644 --- a/tests/resources/coverage/generator/model.py +++ b/tests/resources/coverage/generator/model.py @@ -394,18 +394,6 @@ def initialise_variables(states, rates, constants, algebraic): constants[6] = 7.0 algebraic[0] = 1.0 algebraic[1] = 2.0 - computed_constants[177] = 123.0 - computed_constants[178] = 123.456789 - computed_constants[179] = 123.0e99 - computed_constants[180] = 123.456789e99 - computed_constants[182] = 1.0 - computed_constants[183] = 0.0 - computed_constants[184] = 2.71828182845905 - computed_constants[185] = 3.14159265358979 - computed_constants[186] = inf - computed_constants[187] = nan - computed_constants[198] = 1.0 - computed_constants[199] = 3.0 def compute_computed_constants(constants, computed_constants): @@ -586,7 +574,17 @@ def compute_computed_constants(constants, computed_constants): computed_constants[174] = constants[0] if gt_func(constants[0], constants[1]) else constants[2] if gt_func(constants[2], constants[3]) else constants[4] if gt_func(constants[4], constants[5]) else nan computed_constants[175] = constants[0] if gt_func(constants[0], constants[1]) else constants[2] if gt_func(constants[2], constants[3]) else constants[4] if gt_func(constants[4], constants[5]) else constants[6] computed_constants[176] = 123.0+(constants[0] if gt_func(constants[0], constants[1]) else nan) + computed_constants[177] = 123.0 + computed_constants[178] = 123.456789 + computed_constants[179] = 123.0e99 + computed_constants[180] = 123.456789e99 computed_constants[181] = constants[0] + computed_constants[182] = 1.0 + computed_constants[183] = 0.0 + computed_constants[184] = 2.71828182845905 + computed_constants[185] = 3.14159265358979 + computed_constants[186] = inf + computed_constants[187] = nan computed_constants[188] = and_func(constants[0], constants[1])+(constants[1] if gt_func(constants[2], constants[3]) else nan)+constants[4]+and_func(constants[5], constants[6]) computed_constants[189] = and_func(constants[0], constants[1])-((constants[1] if gt_func(constants[2], constants[3]) else nan)-(constants[4]-(constants[1] if gt_func(constants[2], constants[3]) else nan)))-and_func(constants[5], constants[6]) computed_constants[190] = and_func(constants[0], constants[1])*(constants[1] if gt_func(constants[2], constants[3]) else nan)*constants[4]*(constants[1] if gt_func(constants[2], constants[3]) else nan)*and_func(constants[5], constants[6]) @@ -597,6 +595,8 @@ def compute_computed_constants(constants, computed_constants): computed_constants[195] = pow(and_func(constants[0], constants[1]), pow(constants[1] if gt_func(constants[2], constants[3]) else nan, pow(pow(constants[4], constants[1] if gt_func(constants[2], constants[3]) else nan), and_func(constants[0], constants[1])))) computed_constants[196] = pow(pow(pow(and_func(constants[0], constants[1]), 1.0/pow(constants[1] if gt_func(constants[2], constants[3]) else nan, 1.0/constants[4])), 1.0/(constants[1] if gt_func(constants[2], constants[3]) else nan)), 1.0/and_func(constants[0], constants[1])) computed_constants[197] = -and_func(constants[0], constants[1])+-(constants[1] if gt_func(constants[2], constants[3]) else nan) + computed_constants[198] = 1.0 + computed_constants[199] = 3.0 def compute_rates(voi, states, rates, constants, computed_constants, algebraic): diff --git a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.c b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.c index a3c00b62dd..77864fe754 100644 --- a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.c +++ b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.c @@ -63,12 +63,12 @@ void deleteArray(double *array) void initialiseVariables(double *constants, double *algebraic) { - computedConstants[1] = 1.0; } void computeComputedConstants(double *constants, double *computedConstants) { computedConstants[0] = computedConstants[1]; + computedConstants[1] = 1.0; } void computeVariables(double *constants, double *computedConstants, double *algebraic) diff --git a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.py b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.py index e16ebcdbb6..7478720bdc 100644 --- a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.py +++ b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.py @@ -36,11 +36,12 @@ def create_algebraic_array(): def initialise_variables(constants, algebraic): - computed_constants[1] = 1.0 + pass def compute_computed_constants(constants, computed_constants): computed_constants[0] = computed_constants[1] + computed_constants[1] = 1.0 def compute_variables(constants, computed_constants, algebraic): diff --git a/tests/resources/generator/algebraic_eqn_constant_on_rhs/model.c b/tests/resources/generator/algebraic_eqn_constant_on_rhs/model.c index f4791714af..44c462e66e 100644 --- a/tests/resources/generator/algebraic_eqn_constant_on_rhs/model.c +++ b/tests/resources/generator/algebraic_eqn_constant_on_rhs/model.c @@ -62,11 +62,11 @@ void deleteArray(double *array) void initialiseVariables(double *constants, double *algebraic) { - computedConstants[0] = 1.0; } void computeComputedConstants(double *constants, double *computedConstants) { + computedConstants[0] = 1.0; } void computeVariables(double *constants, double *computedConstants, double *algebraic) diff --git a/tests/resources/generator/algebraic_eqn_constant_on_rhs/model.py b/tests/resources/generator/algebraic_eqn_constant_on_rhs/model.py index af04c489bc..ec6d22f69c 100644 --- a/tests/resources/generator/algebraic_eqn_constant_on_rhs/model.py +++ b/tests/resources/generator/algebraic_eqn_constant_on_rhs/model.py @@ -35,11 +35,11 @@ def create_algebraic_array(): def initialise_variables(constants, algebraic): - computed_constants[0] = 1.0 + pass def compute_computed_constants(constants, computed_constants): - pass + computed_constants[0] = 1.0 def compute_variables(constants, computed_constants, algebraic): diff --git a/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.c b/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.c index 3461133232..8050184e0f 100644 --- a/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.c +++ b/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.c @@ -82,11 +82,11 @@ void deleteArray(double *array) void initialiseVariables(double *states, double *rates, double *constants, double *algebraic) { states[0] = 1.0; - computedConstants[0] = 1.0; } void computeComputedConstants(double *constants, double *computedConstants) { + computedConstants[0] = 1.0; } void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) diff --git a/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.py b/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.py index 4c38d6136d..0da204aecf 100644 --- a/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.py +++ b/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.py @@ -48,11 +48,10 @@ def create_algebraic_array(): def initialise_variables(states, rates, constants, algebraic): states[0] = 1.0 - computed_constants[0] = 1.0 def compute_computed_constants(constants, computed_constants): - pass + computed_constants[0] = 1.0 def compute_rates(voi, states, rates, constants, computed_constants, algebraic): diff --git a/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.c b/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.c index b986dc2765..37466c2814 100644 --- a/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.c +++ b/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.c @@ -82,11 +82,11 @@ void deleteArray(double *array) void initialiseVariables(double *states, double *rates, double *constants, double *algebraic) { states[0] = 1.0; - computedConstants[0] = 1.0; } void computeComputedConstants(double *constants, double *computedConstants) { + computedConstants[0] = 1.0; } void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) diff --git a/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.py b/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.py index 45d1c49bf0..ffb5d2a000 100644 --- a/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.py +++ b/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.py @@ -48,11 +48,10 @@ def create_algebraic_array(): def initialise_variables(states, rates, constants, algebraic): states[0] = 1.0 - computed_constants[0] = 1.0 def compute_computed_constants(constants, computed_constants): - pass + computed_constants[0] = 1.0 def compute_rates(voi, states, rates, constants, computed_constants, algebraic): diff --git a/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.c b/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.c index 2435f13f62..9c9f2695d7 100644 --- a/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.c +++ b/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.c @@ -82,11 +82,11 @@ void deleteArray(double *array) void initialiseVariables(double *states, double *rates, double *constants, double *algebraic) { states[0] = 1.0; - computedConstants[0] = 1.0; } void computeComputedConstants(double *constants, double *computedConstants) { + computedConstants[0] = 1.0; } void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) diff --git a/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.py b/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.py index 3f90782054..1c3a92bcd3 100644 --- a/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.py +++ b/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.py @@ -48,11 +48,10 @@ def create_algebraic_array(): def initialise_variables(states, rates, constants, algebraic): states[0] = 1.0 - computed_constants[0] = 1.0 def compute_computed_constants(constants, computed_constants): - pass + computed_constants[0] = 1.0 def compute_rates(voi, states, rates, constants, computed_constants, algebraic): diff --git a/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.c b/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.c index 1c1013f49a..f8e0f2101e 100644 --- a/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.c +++ b/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.c @@ -82,11 +82,11 @@ void deleteArray(double *array) void initialiseVariables(double *states, double *rates, double *constants, double *algebraic) { states[0] = 1.0; - computedConstants[0] = 1.0; } void computeComputedConstants(double *constants, double *computedConstants) { + computedConstants[0] = 1.0; } void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) diff --git a/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.py b/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.py index 921b10db41..e1d0ff1171 100644 --- a/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.py +++ b/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.py @@ -48,11 +48,10 @@ def create_algebraic_array(): def initialise_variables(states, rates, constants, algebraic): states[0] = 1.0 - computed_constants[0] = 1.0 def compute_computed_constants(constants, computed_constants): - pass + computed_constants[0] = 1.0 def compute_rates(voi, states, rates, constants, computed_constants, algebraic): diff --git a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.c b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.c index 105a0833d9..f197a0f5da 100644 --- a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.c +++ b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.c @@ -94,13 +94,13 @@ void findRoot0(double *variables) void initialiseVariables(double *constants, double *algebraic) { algebraic[0] = 1.0; - computedConstants[0] = 3.0; - computedConstants[1] = 5.0; - computedConstants[2] = 7.0; } void computeComputedConstants(double *constants, double *computedConstants) { + computedConstants[0] = 3.0; + computedConstants[1] = 5.0; + computedConstants[2] = 7.0; } void computeVariables(double *constants, double *computedConstants, double *algebraic) diff --git a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.c b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.c index d38d0c08ed..e6176a519a 100644 --- a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.c +++ b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.c @@ -80,14 +80,14 @@ void deleteArray(double *array) void initialiseVariables(double *constants, double *algebraic, ExternalVariable externalVariable) { - computedConstants[0] = 3.0; - computedConstants[1] = 5.0; - computedConstants[2] = 7.0; algebraic[0] = externalVariable(variables, 0); } void computeComputedConstants(double *constants, double *computedConstants) { + computedConstants[0] = 3.0; + computedConstants[1] = 5.0; + computedConstants[2] = 7.0; } void computeVariables(double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) diff --git a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.py b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.py index 15e43a6c7a..a3b14cd851 100644 --- a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.py +++ b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.py @@ -46,14 +46,13 @@ def create_externals_array(): def initialise_variables(constants, algebraic, external_variable): - computed_constants[0] = 3.0 - computed_constants[1] = 5.0 - computed_constants[2] = 7.0 algebraic[0] = external_variable(variables, 0) def compute_computed_constants(constants, computed_constants): - pass + computed_constants[0] = 3.0 + computed_constants[1] = 5.0 + computed_constants[2] = 7.0 def compute_variables(constants, computed_constants, algebraic, external_variable): diff --git a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.py b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.py index df36f9d08e..d0b04d108b 100644 --- a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.py +++ b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.py @@ -60,13 +60,12 @@ def find_root_0(variables): def initialise_variables(constants, algebraic): algebraic[0] = 1.0 - computed_constants[0] = 3.0 - computed_constants[1] = 5.0 - computed_constants[2] = 7.0 def compute_computed_constants(constants, computed_constants): - pass + computed_constants[0] = 3.0 + computed_constants[1] = 5.0 + computed_constants[2] = 7.0 def compute_variables(constants, computed_constants, algebraic): diff --git a/tests/resources/generator/algebraic_unknown_var_on_rhs/model.c b/tests/resources/generator/algebraic_unknown_var_on_rhs/model.c index 48c8e8533a..dc329bd29b 100644 --- a/tests/resources/generator/algebraic_unknown_var_on_rhs/model.c +++ b/tests/resources/generator/algebraic_unknown_var_on_rhs/model.c @@ -63,11 +63,11 @@ void deleteArray(double *array) void initialiseVariables(double *constants, double *algebraic) { - computedConstants[0] = 1.0; } void computeComputedConstants(double *constants, double *computedConstants) { + computedConstants[0] = 1.0; computedConstants[1] = computedConstants[0]; } diff --git a/tests/resources/generator/algebraic_unknown_var_on_rhs/model.py b/tests/resources/generator/algebraic_unknown_var_on_rhs/model.py index 34185c7ef1..56ec81b7ef 100644 --- a/tests/resources/generator/algebraic_unknown_var_on_rhs/model.py +++ b/tests/resources/generator/algebraic_unknown_var_on_rhs/model.py @@ -36,10 +36,11 @@ def create_algebraic_array(): def initialise_variables(constants, algebraic): - computed_constants[0] = 1.0 + pass def compute_computed_constants(constants, computed_constants): + computed_constants[0] = 1.0 computed_constants[1] = computed_constants[0] diff --git a/tests/resources/generator/ode_computed_var_on_rhs/model.c b/tests/resources/generator/ode_computed_var_on_rhs/model.c index acf5f9b717..fb2e5ed243 100644 --- a/tests/resources/generator/ode_computed_var_on_rhs/model.c +++ b/tests/resources/generator/ode_computed_var_on_rhs/model.c @@ -81,11 +81,11 @@ void deleteArray(double *array) void initialiseVariables(double *states, double *rates, double *constants, double *algebraic) { states[0] = 1.0; - computedConstants[0] = 1.0; } void computeComputedConstants(double *constants, double *computedConstants) { + computedConstants[0] = 1.0; } void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) diff --git a/tests/resources/generator/ode_computed_var_on_rhs/model.py b/tests/resources/generator/ode_computed_var_on_rhs/model.py index e4b0565e7a..4d2a9c43ca 100644 --- a/tests/resources/generator/ode_computed_var_on_rhs/model.py +++ b/tests/resources/generator/ode_computed_var_on_rhs/model.py @@ -47,11 +47,10 @@ def create_algebraic_array(): def initialise_variables(states, rates, constants, algebraic): states[0] = 1.0 - computed_constants[0] = 1.0 def compute_computed_constants(constants, computed_constants): - pass + computed_constants[0] = 1.0 def compute_rates(voi, states, rates, constants, computed_constants, algebraic): diff --git a/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.c b/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.c index c1700a4972..8c03c4af6d 100644 --- a/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.c +++ b/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.c @@ -81,11 +81,11 @@ void deleteArray(double *array) void initialiseVariables(double *states, double *rates, double *constants, double *algebraic) { states[0] = 1.0; - computedConstants[0] = 1.0; } void computeComputedConstants(double *constants, double *computedConstants) { + computedConstants[0] = 1.0; } void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) diff --git a/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.py b/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.py index aa95574b4f..b475ed2af5 100644 --- a/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.py +++ b/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.py @@ -47,11 +47,10 @@ def create_algebraic_array(): def initialise_variables(states, rates, constants, algebraic): states[0] = 1.0 - computed_constants[0] = 1.0 def compute_computed_constants(constants, computed_constants): - pass + computed_constants[0] = 1.0 def compute_rates(voi, states, rates, constants, computed_constants, algebraic): diff --git a/tests/resources/generator/sine_model_imports/model.c b/tests/resources/generator/sine_model_imports/model.c index 1f9180682d..b253483188 100644 --- a/tests/resources/generator/sine_model_imports/model.c +++ b/tests/resources/generator/sine_model_imports/model.c @@ -92,6 +92,10 @@ void initialiseVariables(double *states, double *rates, double *constants, doubl states[0] = constants[0]; constants[0] = 0.0; constants[1] = 0.75; +} + +void computeComputedConstants(double *constants, double *computedConstants) +{ computedConstants[0] = 2.0/3.14159265358979; computedConstants[1] = 2.0*3.14159265358979; computedConstants[2] = 3.14159265358979/2.0; @@ -99,10 +103,6 @@ void initialiseVariables(double *states, double *rates, double *constants, doubl computedConstants[4] = 3.0*3.14159265358979/2.0; } -void computeComputedConstants(double *constants, double *computedConstants) -{ -} - void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { rates[0] = cos(voi); diff --git a/tests/resources/generator/sine_model_imports/model.py b/tests/resources/generator/sine_model_imports/model.py index 454eb64938..35bb474abe 100644 --- a/tests/resources/generator/sine_model_imports/model.py +++ b/tests/resources/generator/sine_model_imports/model.py @@ -62,6 +62,9 @@ def initialise_variables(states, rates, constants, algebraic): states[0] = constants[0] constants[0] = 0.0 constants[1] = 0.75 + + +def compute_computed_constants(constants, computed_constants): computed_constants[0] = 2.0/3.14159265358979 computed_constants[1] = 2.0*3.14159265358979 computed_constants[2] = 3.14159265358979/2.0 @@ -69,10 +72,6 @@ def initialise_variables(states, rates, constants, algebraic): computed_constants[4] = 3.0*3.14159265358979/2.0 -def compute_computed_constants(constants, computed_constants): - pass - - def compute_rates(voi, states, rates, constants, computed_constants, algebraic): rates[0] = cos(voi) From a46dbca50366735b5f130e5693d6c2bfd5771610 Mon Sep 17 00:00:00 2001 From: Alan Garny Date: Fri, 16 Aug 2024 10:13:22 +0200 Subject: [PATCH 27/85] GeneratorProfile: added the external array string. --- src/api/libcellml/generatorprofile.h | 19 +++++++++++ src/bindings/interface/generatorprofile.i | 6 ++++ src/bindings/javascript/generatorprofile.cpp | 2 ++ src/generator.cpp | 16 +++++++--- src/generatorprofile.cpp | 12 +++++++ src/generatorprofile_p.h | 1 + src/generatorprofilesha1values.h | 4 +-- src/generatorprofiletools.cpp | 3 +- tests/bindings/javascript/generator.test.js | 2 +- .../javascript/generatorprofile.test.js | 6 ++++ .../bindings/python/test_generator_profile.py | 9 ++++++ tests/generator/generatorprofile.cpp | 3 ++ .../model.external.c | 6 ++-- .../model.external.py | 6 ++-- .../model.external.c | 4 +-- .../model.external.py | 4 +-- .../model.three.externals.c | 12 +++---- .../model.three.externals.py | 12 +++---- .../cell_geometry_model/model.external.c | 10 +++--- .../cell_geometry_model/model.external.py | 10 +++--- .../model.algebraic.c | 8 ++--- .../model.algebraic.py | 8 ++--- .../model.computed.constant.c | 10 +++--- .../model.computed.constant.py | 10 +++--- .../model.constant.c | 8 ++--- .../model.constant.py | 8 ++--- .../model.dae.c | 12 +++---- .../model.dae.py | 12 +++---- .../model.dependent.algebraic.c | 16 +++++----- .../model.dependent.algebraic.py | 16 +++++----- .../model.dependent.computed.constant.c | 24 +++++++------- .../model.dependent.computed.constant.py | 24 +++++++------- .../model.dependent.constant.c | 18 +++++------ .../model.dependent.constant.py | 18 +++++------ .../model.dependent.state.c | 28 ++++++++-------- .../model.dependent.state.py | 28 ++++++++-------- .../model.external.c | 32 +++++++++---------- .../model.external.py | 32 +++++++++---------- .../model.state.c | 10 +++--- .../model.state.py | 10 +++--- .../model.c | 6 ++-- .../model.py | 6 ++-- 42 files changed, 279 insertions(+), 212 deletions(-) diff --git a/src/api/libcellml/generatorprofile.h b/src/api/libcellml/generatorprofile.h index 943eca8013..ae367e295a 100644 --- a/src/api/libcellml/generatorprofile.h +++ b/src/api/libcellml/generatorprofile.h @@ -3122,6 +3122,25 @@ class LIBCELLML_EXPORT GeneratorProfile */ void setAlgebraicArrayString(const std::string &algebraicArrayString); + /** + * @brief Get the @c std::string for the name of the external array. + * + * Return the @c std::string for the name of the external array. + * + * @return The @c std::string for the name of the external array. + */ + std::string externalArrayString() const; + + /** + * @brief Set the @c std::string for the name of the external array. + * + * Set the @c std::string for the name of the external array. + * + * @param externalArrayString The @c std::string to use for the name of the + * external array. + */ + void setExternalArrayString(const std::string &externalArrayString); + /** * @brief Get the @c std::string for the type definition of an external * variable method. diff --git a/src/bindings/interface/generatorprofile.i b/src/bindings/interface/generatorprofile.i index 23fc7a9b99..426cd08a21 100644 --- a/src/bindings/interface/generatorprofile.i +++ b/src/bindings/interface/generatorprofile.i @@ -860,6 +860,12 @@ and units of a variable respectively."; %feature("docstring") libcellml::GeneratorProfile::setAlgebraicArrayString "Sets the string for the name of the algebraic array."; +%feature("docstring") libcellml::GeneratorProfile::externalArrayString +"Returns the string for the name of the external array."; + +%feature("docstring") libcellml::GeneratorProfile::setExternalArrayString +"Sets the string for the name of the external array."; + %feature("docstring") libcellml::GeneratorProfile::externalVariableMethodTypeDefinitionString "Returns the string for the type definition of an external variable method."; diff --git a/src/bindings/javascript/generatorprofile.cpp b/src/bindings/javascript/generatorprofile.cpp index 1f4d57997b..e981e701ee 100644 --- a/src/bindings/javascript/generatorprofile.cpp +++ b/src/bindings/javascript/generatorprofile.cpp @@ -307,6 +307,8 @@ EMSCRIPTEN_BINDINGS(libcellml_generatorprofile) .function("setComputedConstantsArrayString", &libcellml::GeneratorProfile::setComputedConstantsArrayString) .function("algebraicArrayString", &libcellml::GeneratorProfile::algebraicArrayString) .function("setAlgebraicArrayString", &libcellml::GeneratorProfile::setAlgebraicArrayString) + .function("externalArrayString", &libcellml::GeneratorProfile::externalArrayString) + .function("setExternalArrayString", &libcellml::GeneratorProfile::setExternalArrayString) .function("externalVariableMethodTypeDefinitionString", &libcellml::GeneratorProfile::externalVariableMethodTypeDefinitionString) .function("setExternalVariableMethodTypeDefinitionString", &libcellml::GeneratorProfile::setExternalVariableMethodTypeDefinitionString) .function("externalVariableMethodCallString", &libcellml::GeneratorProfile::externalVariableMethodCallString) diff --git a/src/generator.cpp b/src/generator.cpp index 95b8bba402..ce6cc531f2 100644 --- a/src/generator.cpp +++ b/src/generator.cpp @@ -764,7 +764,9 @@ void Generator::GeneratorImpl::addNlaSystemsCode() mProfile->constantsArrayString() : (variable->type() == AnalyserVariable::Type::COMPUTED_CONSTANT) ? mProfile->computedConstantsArrayString() : - mProfile->algebraicArrayString(); + (variable->type() == AnalyserVariable::Type::ALGEBRAIC) ? + mProfile->algebraicArrayString() : + mProfile->externalArrayString(); methodBody += mProfile->indentString() + arrayString + mProfile->openArrayString() + convertToString(variable->index()) + mProfile->closeArrayString() @@ -807,7 +809,9 @@ void Generator::GeneratorImpl::addNlaSystemsCode() for (const auto &variable : variables) { auto arrayString = (variable->type() == AnalyserVariable::Type::STATE) ? mProfile->ratesArrayString() : - mProfile->algebraicArrayString(); + (variable->type() == AnalyserVariable::Type::ALGEBRAIC) ? + mProfile->algebraicArrayString() : + mProfile->externalArrayString(); methodBody += mProfile->indentString() + mProfile->uArrayString() + mProfile->openArrayString() + convertToString(++i) + mProfile->closeArrayString() @@ -831,7 +835,9 @@ void Generator::GeneratorImpl::addNlaSystemsCode() for (const auto &variable : variables) { auto arrayString = (variable->type() == AnalyserVariable::Type::STATE) ? mProfile->ratesArrayString() : - mProfile->algebraicArrayString(); + (variable->type() == AnalyserVariable::Type::ALGEBRAIC) ? + mProfile->algebraicArrayString() : + mProfile->externalArrayString(); methodBody += mProfile->indentString() + arrayString + mProfile->openArrayString() + convertToString(variable->index()) + mProfile->closeArrayString() @@ -914,8 +920,10 @@ std::string Generator::GeneratorImpl::generateVariableNameCode(const VariablePtr arrayName = mProfile->constantsArrayString(); } else if (analyserVariable->type() == AnalyserVariable::Type::COMPUTED_CONSTANT) { arrayName = mProfile->computedConstantsArrayString(); - } else { + } else if (analyserVariable->type() == AnalyserVariable::Type::ALGEBRAIC) { arrayName = mProfile->algebraicArrayString(); + } else { + arrayName = mProfile->externalArrayString(); } return arrayName + mProfile->openArrayString() + convertToString(analyserVariable->index()) + mProfile->closeArrayString(); diff --git a/src/generatorprofile.cpp b/src/generatorprofile.cpp index 997fa4bfbc..bc191920b7 100644 --- a/src/generatorprofile.cpp +++ b/src/generatorprofile.cpp @@ -288,6 +288,7 @@ void GeneratorProfile::GeneratorProfileImpl::loadProfile(GeneratorProfile::Profi mConstantsArrayString = "constants"; mComputedConstantsArrayString = "computedConstants"; mAlgebraicArrayString = "algebraic"; + mExternalArrayString = "external"; mExternalVariableMethodTypeDefinitionFamString = "typedef double (* ExternalVariable)(double *variables, size_t index);\n"; mExternalVariableMethodTypeDefinitionFdmString = "typedef double (* ExternalVariable)(double voi, double *states, double *rates, double *variables, size_t index);\n"; @@ -740,6 +741,7 @@ void GeneratorProfile::GeneratorProfileImpl::loadProfile(GeneratorProfile::Profi mConstantsArrayString = "constants"; mComputedConstantsArrayString = "computed_constants"; mAlgebraicArrayString = "algebraic"; + mExternalArrayString = "external"; mExternalVariableMethodTypeDefinitionFamString = ""; mExternalVariableMethodTypeDefinitionFdmString = ""; @@ -2288,6 +2290,16 @@ void GeneratorProfile::setAlgebraicArrayString(const std::string &algebraicArray mPimpl->mAlgebraicArrayString = algebraicArrayString; } +std::string GeneratorProfile::externalArrayString() const +{ + return mPimpl->mExternalArrayString; +} + +void GeneratorProfile::setExternalArrayString(const std::string &externalArrayString) +{ + mPimpl->mExternalArrayString = externalArrayString; +} + std::string GeneratorProfile::externalVariableMethodTypeDefinitionString(bool forDifferentialModel) const { if (forDifferentialModel) { diff --git a/src/generatorprofile_p.h b/src/generatorprofile_p.h index 286edca8e7..167f8ab236 100644 --- a/src/generatorprofile_p.h +++ b/src/generatorprofile_p.h @@ -217,6 +217,7 @@ struct GeneratorProfile::GeneratorProfileImpl std::string mConstantsArrayString; std::string mComputedConstantsArrayString; std::string mAlgebraicArrayString; + std::string mExternalArrayString; std::string mExternalVariableMethodTypeDefinitionFamString; std::string mExternalVariableMethodTypeDefinitionFdmString; diff --git a/src/generatorprofilesha1values.h b/src/generatorprofilesha1values.h index cf522db03f..c96cffaf20 100644 --- a/src/generatorprofilesha1values.h +++ b/src/generatorprofilesha1values.h @@ -24,7 +24,7 @@ namespace libcellml { * The content of this file is generated, do not edit this file directly. * See docs/dev_utilities.rst for further information. */ -static const char C_GENERATOR_PROFILE_SHA1[] = "2d4d14df0a454d95e32e1172503d529834c42588"; -static const char PYTHON_GENERATOR_PROFILE_SHA1[] = "5ff1e7cc237b3e7eb1153b6d421df842731c6394"; +static const char C_GENERATOR_PROFILE_SHA1[] = "54ee603459d7878ee469890e77de4f3dbb5452ad"; +static const char PYTHON_GENERATOR_PROFILE_SHA1[] = "bf42c06955e401096d76d059a28ed1a5cb1ccc01"; } // namespace libcellml diff --git a/src/generatorprofiletools.cpp b/src/generatorprofiletools.cpp index d74e462bee..5fa6093923 100644 --- a/src/generatorprofiletools.cpp +++ b/src/generatorprofiletools.cpp @@ -482,7 +482,8 @@ std::string generatorProfileAsString(const GeneratorProfilePtr &generatorProfile + generatorProfile->ratesArrayString() + generatorProfile->constantsArrayString() + generatorProfile->computedConstantsArrayString() - + generatorProfile->algebraicArrayString(); + + generatorProfile->algebraicArrayString() + + generatorProfile->externalArrayString(); profileContents += generatorProfile->externalVariableMethodTypeDefinitionString(false) + generatorProfile->externalVariableMethodTypeDefinitionString(true); diff --git a/tests/bindings/javascript/generator.test.js b/tests/bindings/javascript/generator.test.js index b5860fd01d..802b479413 100644 --- a/tests/bindings/javascript/generator.test.js +++ b/tests/bindings/javascript/generator.test.js @@ -62,7 +62,7 @@ describe("Generator tests", () => { g.setModel(a.model()) const interface_lines = g.interfaceCode().split('\n') - expect(interface_lines.length).toBe(37) + expect(interface_lines.length).toBe(38) const implementation_lines = g.implementationCode().split('\n') expect(implementation_lines.length).toBe(97) diff --git a/tests/bindings/javascript/generatorprofile.test.js b/tests/bindings/javascript/generatorprofile.test.js index 81b1b13ff1..e1f63eee41 100644 --- a/tests/bindings/javascript/generatorprofile.test.js +++ b/tests/bindings/javascript/generatorprofile.test.js @@ -915,6 +915,12 @@ describe("GeneratorProfile tests", () => { x.setAlgebraicArrayString("something") expect(x.algebraicArrayString()).toBe("something") }); + test("Checking GeneratorProfile.externalArrayString.", () => { + const x = new libcellml.GeneratorProfile(libcellml.GeneratorProfile.Profile.C) + + x.setExternalArrayString("something") + expect(x.externalArrayString()).toBe("something") + }); test("Checking GeneratorProfile.externalVariableMethodTypeDefinitionString.", () => { const x = new libcellml.GeneratorProfile(libcellml.GeneratorProfile.Profile.C) diff --git a/tests/bindings/python/test_generator_profile.py b/tests/bindings/python/test_generator_profile.py index 7c97f547d1..51d67a7239 100644 --- a/tests/bindings/python/test_generator_profile.py +++ b/tests/bindings/python/test_generator_profile.py @@ -1682,6 +1682,15 @@ def test_algebraic_array_string(self): g.setAlgebraicArrayString(GeneratorProfileTestCase.VALUE) self.assertEqual(GeneratorProfileTestCase.VALUE, g.algebraicArrayString()) + def test_external_array_string(self): + from libcellml import GeneratorProfile + + g = GeneratorProfile() + + self.assertEqual('external', g.externalArrayString()) + g.setExternalArrayString(GeneratorProfileTestCase.VALUE) + self.assertEqual(GeneratorProfileTestCase.VALUE, g.externalArrayString()) + def test_external_variable_method_type_definition_string(self): from libcellml import GeneratorProfile diff --git a/tests/generator/generatorprofile.cpp b/tests/generator/generatorprofile.cpp index 1e8b33b534..aa91c910aa 100644 --- a/tests/generator/generatorprofile.cpp +++ b/tests/generator/generatorprofile.cpp @@ -340,6 +340,7 @@ TEST(GeneratorProfile, defaultMiscellaneousValues) EXPECT_EQ("constants", generatorProfile->constantsArrayString()); EXPECT_EQ("computedConstants", generatorProfile->computedConstantsArrayString()); EXPECT_EQ("algebraic", generatorProfile->algebraicArrayString()); + EXPECT_EQ("external", generatorProfile->externalArrayString()); EXPECT_EQ("typedef double (* ExternalVariable)(double *variables, size_t index);\n", generatorProfile->externalVariableMethodTypeDefinitionString(false)); EXPECT_EQ("typedef double (* ExternalVariable)(double voi, double *states, double *rates, double *variables, size_t index);\n", generatorProfile->externalVariableMethodTypeDefinitionString(true)); @@ -938,6 +939,7 @@ TEST(GeneratorProfile, miscellaneous) generatorProfile->setConstantsArrayString(value); generatorProfile->setComputedConstantsArrayString(value); generatorProfile->setAlgebraicArrayString(value); + generatorProfile->setExternalArrayString(value); generatorProfile->setExternalVariableMethodTypeDefinitionString(false, value); generatorProfile->setExternalVariableMethodTypeDefinitionString(true, value); @@ -1084,6 +1086,7 @@ TEST(GeneratorProfile, miscellaneous) EXPECT_EQ(value, generatorProfile->constantsArrayString()); EXPECT_EQ(value, generatorProfile->computedConstantsArrayString()); EXPECT_EQ(value, generatorProfile->algebraicArrayString()); + EXPECT_EQ(value, generatorProfile->externalArrayString()); EXPECT_EQ(value, generatorProfile->externalVariableMethodTypeDefinitionString(false)); EXPECT_EQ(value, generatorProfile->externalVariableMethodTypeDefinitionString(true)); diff --git a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.c b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.c index 06d47e8fe4..9dc5931425 100644 --- a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.c +++ b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.c @@ -78,7 +78,7 @@ void deleteArray(double *array) void initialiseVariables(double *constants, double *algebraic, ExternalVariable externalVariable) { - algebraic[1] = externalVariable(variables, 1); + external[1] = externalVariable(variables, 1); } void computeComputedConstants(double *constants, double *computedConstants) @@ -87,6 +87,6 @@ void computeComputedConstants(double *constants, double *computedConstants) void computeVariables(double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) { - algebraic[1] = externalVariable(variables, 1); - algebraic[0] = algebraic[1]; + external[1] = externalVariable(variables, 1); + algebraic[0] = external[1]; } diff --git a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.py b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.py index 94691a7c9d..56bde48d88 100644 --- a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.py +++ b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.py @@ -44,7 +44,7 @@ def create_externals_array(): def initialise_variables(constants, algebraic, external_variable): - algebraic[1] = external_variable(variables, 1) + external[1] = external_variable(variables, 1) def compute_computed_constants(constants, computed_constants): @@ -52,5 +52,5 @@ def compute_computed_constants(constants, computed_constants): def compute_variables(constants, computed_constants, algebraic, external_variable): - algebraic[1] = external_variable(variables, 1) - algebraic[0] = algebraic[1] + external[1] = external_variable(variables, 1) + algebraic[0] = external[1] diff --git a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.c b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.c index e6176a519a..fcf0650ffd 100644 --- a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.c +++ b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.c @@ -80,7 +80,7 @@ void deleteArray(double *array) void initialiseVariables(double *constants, double *algebraic, ExternalVariable externalVariable) { - algebraic[0] = externalVariable(variables, 0); + external[0] = externalVariable(variables, 0); } void computeComputedConstants(double *constants, double *computedConstants) @@ -92,5 +92,5 @@ void computeComputedConstants(double *constants, double *computedConstants) void computeVariables(double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) { - algebraic[0] = externalVariable(variables, 0); + external[0] = externalVariable(variables, 0); } diff --git a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.py b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.py index a3b14cd851..c55a3656bd 100644 --- a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.py +++ b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.py @@ -46,7 +46,7 @@ def create_externals_array(): def initialise_variables(constants, algebraic, external_variable): - algebraic[0] = external_variable(variables, 0) + external[0] = external_variable(variables, 0) def compute_computed_constants(constants, computed_constants): @@ -56,4 +56,4 @@ def compute_computed_constants(constants, computed_constants): def compute_variables(constants, computed_constants, algebraic, external_variable): - algebraic[0] = external_variable(variables, 0) + external[0] = external_variable(variables, 0) diff --git a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.c b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.c index 14f3025e22..1a1de087c7 100644 --- a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.c +++ b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.c @@ -79,9 +79,9 @@ void deleteArray(double *array) void initialiseVariables(double *constants, double *algebraic, ExternalVariable externalVariable) { - algebraic[0] = externalVariable(variables, 0); - algebraic[1] = externalVariable(variables, 1); - algebraic[2] = externalVariable(variables, 2); + external[0] = externalVariable(variables, 0); + external[1] = externalVariable(variables, 1); + external[2] = externalVariable(variables, 2); } void computeComputedConstants(double *constants, double *computedConstants) @@ -90,7 +90,7 @@ void computeComputedConstants(double *constants, double *computedConstants) void computeVariables(double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) { - algebraic[0] = externalVariable(variables, 0); - algebraic[1] = externalVariable(variables, 1); - algebraic[2] = externalVariable(variables, 2); + external[0] = externalVariable(variables, 0); + external[1] = externalVariable(variables, 1); + external[2] = externalVariable(variables, 2); } diff --git a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.py b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.py index b7f5d99b65..f83da06d0a 100644 --- a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.py +++ b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.py @@ -45,9 +45,9 @@ def create_externals_array(): def initialise_variables(constants, algebraic, external_variable): - algebraic[0] = external_variable(variables, 0) - algebraic[1] = external_variable(variables, 1) - algebraic[2] = external_variable(variables, 2) + external[0] = external_variable(variables, 0) + external[1] = external_variable(variables, 1) + external[2] = external_variable(variables, 2) def compute_computed_constants(constants, computed_constants): @@ -55,6 +55,6 @@ def compute_computed_constants(constants, computed_constants): def compute_variables(constants, computed_constants, algebraic, external_variable): - algebraic[0] = external_variable(variables, 0) - algebraic[1] = external_variable(variables, 1) - algebraic[2] = external_variable(variables, 2) + external[0] = external_variable(variables, 0) + external[1] = external_variable(variables, 1) + external[2] = external_variable(variables, 2) diff --git a/tests/resources/generator/cell_geometry_model/model.external.c b/tests/resources/generator/cell_geometry_model/model.external.c index daa7e04476..9443a62226 100644 --- a/tests/resources/generator/cell_geometry_model/model.external.c +++ b/tests/resources/generator/cell_geometry_model/model.external.c @@ -80,8 +80,8 @@ void deleteArray(double *array) void initialiseVariables(double *constants, double *algebraic, ExternalVariable externalVariable) { - algebraic[1] = externalVariable(variables, 1); - algebraic[2] = externalVariable(variables, 2); + external[1] = externalVariable(variables, 1); + external[2] = externalVariable(variables, 2); } void computeComputedConstants(double *constants, double *computedConstants) @@ -90,8 +90,8 @@ void computeComputedConstants(double *constants, double *computedConstants) void computeVariables(double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) { - algebraic[1] = externalVariable(variables, 1); - algebraic[2] = externalVariable(variables, 2); - algebraic[0] = 1000.0*3.14*algebraic[2]*algebraic[2]*algebraic[1]; + external[1] = externalVariable(variables, 1); + external[2] = externalVariable(variables, 2); + algebraic[0] = 1000.0*3.14*external[2]*external[2]*external[1]; algebraic[3] = 0.02*algebraic[0]; } diff --git a/tests/resources/generator/cell_geometry_model/model.external.py b/tests/resources/generator/cell_geometry_model/model.external.py index 3d16a465a2..5549575c37 100644 --- a/tests/resources/generator/cell_geometry_model/model.external.py +++ b/tests/resources/generator/cell_geometry_model/model.external.py @@ -46,8 +46,8 @@ def create_externals_array(): def initialise_variables(constants, algebraic, external_variable): - algebraic[1] = external_variable(variables, 1) - algebraic[2] = external_variable(variables, 2) + external[1] = external_variable(variables, 1) + external[2] = external_variable(variables, 2) def compute_computed_constants(constants, computed_constants): @@ -55,7 +55,7 @@ def compute_computed_constants(constants, computed_constants): def compute_variables(constants, computed_constants, algebraic, external_variable): - algebraic[1] = external_variable(variables, 1) - algebraic[2] = external_variable(variables, 2) - algebraic[0] = 1000.0*3.14*algebraic[2]*algebraic[2]*algebraic[1] + external[1] = external_variable(variables, 1) + external[2] = external_variable(variables, 2) + algebraic[0] = 1000.0*3.14*external[2]*external[2]*external[1] algebraic[3] = 0.02*algebraic[0] diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.c index 79638165e9..e0dcf3cb10 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.c @@ -124,7 +124,7 @@ void initialiseVariables(double voi, double *states, double *rates, double *cons constants[2] = 0.3; constants[3] = 120.0; constants[4] = 36.0; - algebraic[0] = externalVariable(voi, states, rates, variables, 0); + external[0] = externalVariable(voi, states, rates, variables, 0); } void computeComputedConstants(double *constants, double *computedConstants) @@ -136,11 +136,11 @@ void computeComputedConstants(double *constants, double *computedConstants) void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) { - algebraic[0] = externalVariable(voi, states, rates, variables, 0); + external[0] = externalVariable(voi, states, rates, variables, 0); algebraic[1] = constants[2]*(states[0]-computedConstants[0]); algebraic[2] = constants[4]*pow(states[3], 4.0)*(states[0]-computedConstants[2]); algebraic[3] = constants[3]*pow(states[2], 3.0)*states[1]*(states[0]-computedConstants[1]); - rates[0] = -(-algebraic[0]+algebraic[3]+algebraic[2]+algebraic[1])/constants[0]; + rates[0] = -(-external[0]+algebraic[3]+algebraic[2]+algebraic[1])/constants[0]; algebraic[4] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0); algebraic[5] = 4.0*exp(states[0]/18.0); rates[2] = algebraic[4]*(1.0-states[2])-algebraic[5]*states[2]; @@ -154,7 +154,7 @@ void computeRates(double voi, double *states, double *rates, double *constants, void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) { - algebraic[0] = externalVariable(voi, states, rates, variables, 0); + external[0] = externalVariable(voi, states, rates, variables, 0); algebraic[1] = constants[2]*(states[0]-computedConstants[0]); algebraic[3] = constants[3]*pow(states[2], 3.0)*states[1]*(states[0]-computedConstants[1]); algebraic[4] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.py index 9d302d2515..264db7750e 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.py @@ -95,7 +95,7 @@ def initialise_variables(voi, states, rates, constants, algebraic, external_vari constants[2] = 0.3 constants[3] = 120.0 constants[4] = 36.0 - algebraic[0] = external_variable(voi, states, rates, variables, 0) + external[0] = external_variable(voi, states, rates, variables, 0) def compute_computed_constants(constants, computed_constants): @@ -105,11 +105,11 @@ def compute_computed_constants(constants, computed_constants): def compute_rates(voi, states, rates, constants, computed_constants, algebraic, external_variable): - algebraic[0] = external_variable(voi, states, rates, variables, 0) + external[0] = external_variable(voi, states, rates, variables, 0) algebraic[1] = constants[2]*(states[0]-computed_constants[0]) algebraic[2] = constants[4]*pow(states[3], 4.0)*(states[0]-computed_constants[2]) algebraic[3] = constants[3]*pow(states[2], 3.0)*states[1]*(states[0]-computed_constants[1]) - rates[0] = -(-algebraic[0]+algebraic[3]+algebraic[2]+algebraic[1])/constants[0] + rates[0] = -(-external[0]+algebraic[3]+algebraic[2]+algebraic[1])/constants[0] algebraic[4] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0) algebraic[5] = 4.0*exp(states[0]/18.0) rates[2] = algebraic[4]*(1.0-states[2])-algebraic[5]*states[2] @@ -122,7 +122,7 @@ def compute_rates(voi, states, rates, constants, computed_constants, algebraic, def compute_variables(voi, states, rates, constants, computed_constants, algebraic, external_variable): - algebraic[0] = external_variable(voi, states, rates, variables, 0) + external[0] = external_variable(voi, states, rates, variables, 0) algebraic[1] = constants[2]*(states[0]-computed_constants[0]) algebraic[3] = constants[3]*pow(states[2], 3.0)*states[1]*(states[0]-computed_constants[1]) algebraic[4] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0) diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.c index 30d273c85a..f5534292ab 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.c @@ -124,7 +124,7 @@ void initialiseVariables(double voi, double *states, double *rates, double *cons constants[2] = 0.3; constants[3] = 120.0; constants[4] = 36.0; - algebraic[4] = externalVariable(voi, states, rates, variables, 4); + external[4] = externalVariable(voi, states, rates, variables, 4); } void computeComputedConstants(double *constants, double *computedConstants) @@ -136,8 +136,8 @@ void computeComputedConstants(double *constants, double *computedConstants) void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) { algebraic[0] = ((voi >= 10.0) && (voi <= 10.5))?-20.0:0.0; - algebraic[4] = externalVariable(voi, states, rates, variables, 4); - algebraic[1] = constants[2]*(states[0]-algebraic[4]); + external[4] = externalVariable(voi, states, rates, variables, 4); + algebraic[1] = constants[2]*(states[0]-external[4]); algebraic[2] = constants[4]*pow(states[3], 4.0)*(states[0]-computedConstants[1]); algebraic[3] = constants[3]*pow(states[2], 3.0)*states[1]*(states[0]-computedConstants[0]); rates[0] = -(-algebraic[0]+algebraic[3]+algebraic[2]+algebraic[1])/constants[0]; @@ -154,8 +154,8 @@ void computeRates(double voi, double *states, double *rates, double *constants, void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) { - algebraic[4] = externalVariable(voi, states, rates, variables, 4); - algebraic[1] = constants[2]*(states[0]-algebraic[4]); + external[4] = externalVariable(voi, states, rates, variables, 4); + algebraic[1] = constants[2]*(states[0]-external[4]); algebraic[3] = constants[3]*pow(states[2], 3.0)*states[1]*(states[0]-computedConstants[0]); algebraic[5] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0); algebraic[6] = 4.0*exp(states[0]/18.0); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.py index 110c67f6c2..825c30cc95 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.py @@ -95,7 +95,7 @@ def initialise_variables(voi, states, rates, constants, algebraic, external_vari constants[2] = 0.3 constants[3] = 120.0 constants[4] = 36.0 - algebraic[4] = external_variable(voi, states, rates, variables, 4) + external[4] = external_variable(voi, states, rates, variables, 4) def compute_computed_constants(constants, computed_constants): @@ -105,8 +105,8 @@ def compute_computed_constants(constants, computed_constants): def compute_rates(voi, states, rates, constants, computed_constants, algebraic, external_variable): algebraic[0] = -20.0 if and_func(geq_func(voi, 10.0), leq_func(voi, 10.5)) else 0.0 - algebraic[4] = external_variable(voi, states, rates, variables, 4) - algebraic[1] = constants[2]*(states[0]-algebraic[4]) + external[4] = external_variable(voi, states, rates, variables, 4) + algebraic[1] = constants[2]*(states[0]-external[4]) algebraic[2] = constants[4]*pow(states[3], 4.0)*(states[0]-computed_constants[1]) algebraic[3] = constants[3]*pow(states[2], 3.0)*states[1]*(states[0]-computed_constants[0]) rates[0] = -(-algebraic[0]+algebraic[3]+algebraic[2]+algebraic[1])/constants[0] @@ -122,8 +122,8 @@ def compute_rates(voi, states, rates, constants, computed_constants, algebraic, def compute_variables(voi, states, rates, constants, computed_constants, algebraic, external_variable): - algebraic[4] = external_variable(voi, states, rates, variables, 4) - algebraic[1] = constants[2]*(states[0]-algebraic[4]) + external[4] = external_variable(voi, states, rates, variables, 4) + algebraic[1] = constants[2]*(states[0]-external[4]) algebraic[3] = constants[3]*pow(states[2], 3.0)*states[1]*(states[0]-computed_constants[0]) algebraic[5] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0) algebraic[6] = 4.0*exp(states[0]/18.0) diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.c index e006edcb52..7d34125683 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.c @@ -123,7 +123,7 @@ void initialiseVariables(double voi, double *states, double *rates, double *cons constants[1] = 0.3; constants[2] = 120.0; constants[3] = 36.0; - algebraic[4] = externalVariable(voi, states, rates, variables, 4); + external[4] = externalVariable(voi, states, rates, variables, 4); } void computeComputedConstants(double *constants, double *computedConstants) @@ -136,11 +136,11 @@ void computeComputedConstants(double *constants, double *computedConstants) void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) { algebraic[0] = ((voi >= 10.0) && (voi <= 10.5))?-20.0:0.0; - algebraic[4] = externalVariable(voi, states, rates, variables, 4); + external[4] = externalVariable(voi, states, rates, variables, 4); algebraic[1] = constants[1]*(states[0]-computedConstants[0]); algebraic[2] = constants[3]*pow(states[3], 4.0)*(states[0]-computedConstants[2]); algebraic[3] = constants[2]*pow(states[2], 3.0)*states[1]*(states[0]-computedConstants[1]); - rates[0] = -(-algebraic[0]+algebraic[3]+algebraic[2]+algebraic[1])/algebraic[4]; + rates[0] = -(-algebraic[0]+algebraic[3]+algebraic[2]+algebraic[1])/external[4]; algebraic[5] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0); algebraic[6] = 4.0*exp(states[0]/18.0); rates[2] = algebraic[5]*(1.0-states[2])-algebraic[6]*states[2]; @@ -163,5 +163,5 @@ void computeVariables(double voi, double *states, double *rates, double *constan algebraic[2] = constants[3]*pow(states[3], 4.0)*(states[0]-computedConstants[2]); algebraic[9] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0); algebraic[10] = 0.125*exp(states[0]/80.0); - algebraic[4] = externalVariable(voi, states, rates, variables, 4); + external[4] = externalVariable(voi, states, rates, variables, 4); } diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.py index 95ab1649b7..32d9a44ba7 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.py @@ -94,7 +94,7 @@ def initialise_variables(voi, states, rates, constants, algebraic, external_vari constants[1] = 0.3 constants[2] = 120.0 constants[3] = 36.0 - algebraic[4] = external_variable(voi, states, rates, variables, 4) + external[4] = external_variable(voi, states, rates, variables, 4) def compute_computed_constants(constants, computed_constants): @@ -105,11 +105,11 @@ def compute_computed_constants(constants, computed_constants): def compute_rates(voi, states, rates, constants, computed_constants, algebraic, external_variable): algebraic[0] = -20.0 if and_func(geq_func(voi, 10.0), leq_func(voi, 10.5)) else 0.0 - algebraic[4] = external_variable(voi, states, rates, variables, 4) + external[4] = external_variable(voi, states, rates, variables, 4) algebraic[1] = constants[1]*(states[0]-computed_constants[0]) algebraic[2] = constants[3]*pow(states[3], 4.0)*(states[0]-computed_constants[2]) algebraic[3] = constants[2]*pow(states[2], 3.0)*states[1]*(states[0]-computed_constants[1]) - rates[0] = -(-algebraic[0]+algebraic[3]+algebraic[2]+algebraic[1])/algebraic[4] + rates[0] = -(-algebraic[0]+algebraic[3]+algebraic[2]+algebraic[1])/external[4] algebraic[5] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0) algebraic[6] = 4.0*exp(states[0]/18.0) rates[2] = algebraic[5]*(1.0-states[2])-algebraic[6]*states[2] @@ -131,4 +131,4 @@ def compute_variables(voi, states, rates, constants, computed_constants, algebra algebraic[2] = constants[3]*pow(states[3], 4.0)*(states[0]-computed_constants[2]) algebraic[9] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0) algebraic[10] = 0.125*exp(states[0]/80.0) - algebraic[4] = external_variable(voi, states, rates, variables, 4) + external[4] = external_variable(voi, states, rates, variables, 4) diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.c index 0e805880e8..f929e387f7 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.c @@ -173,11 +173,11 @@ void findRoot2(double voi, double *states, double *rates, double *variables) RootFindingInfo rfi = { voi, states, rates, variables }; double u[1]; - u[0] = algebraic[0]; + u[0] = external[0]; nlaSolve(objectiveFunction2, u, 1, &rfi); - algebraic[0] = u[0]; + external[0] = u[0]; } void objectiveFunction3(double *u, double *f, void *data) @@ -221,11 +221,11 @@ void findRoot4(double voi, double *states, double *rates, double *variables) RootFindingInfo rfi = { voi, states, rates, variables }; double u[1]; - u[0] = algebraic[1]; + u[0] = external[1]; nlaSolve(objectiveFunction4, u, 1, &rfi); - algebraic[1] = u[0]; + external[1] = u[0]; } void objectiveFunction5(double *u, double *f, void *data) @@ -413,11 +413,11 @@ void findRoot12(double voi, double *states, double *rates, double *variables) RootFindingInfo rfi = { voi, states, rates, variables }; double u[1]; - u[0] = algebraic[2]; + u[0] = external[2]; nlaSolve(objectiveFunction12, u, 1, &rfi); - algebraic[2] = u[0]; + external[2] = u[0]; } void objectiveFunction13(double *u, double *f, void *data) diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.py index d42b47c116..4dc6719376 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.py @@ -136,11 +136,11 @@ def objective_function_2(u, f, data): def find_root_2(voi, states, rates, variables): u = [nan]*1 - u[0] = algebraic[0] + u[0] = external[0] u = nla_solve(objective_function_2, u, 1, [voi, states, rates, variables]) - algebraic[0] = u[0] + external[0] = u[0] def objective_function_3(u, f, data): @@ -178,11 +178,11 @@ def objective_function_4(u, f, data): def find_root_4(voi, states, rates, variables): u = [nan]*1 - u[0] = algebraic[1] + u[0] = external[1] u = nla_solve(objective_function_4, u, 1, [voi, states, rates, variables]) - algebraic[1] = u[0] + external[1] = u[0] def objective_function_5(u, f, data): @@ -346,11 +346,11 @@ def objective_function_12(u, f, data): def find_root_12(voi, states, rates, variables): u = [nan]*1 - u[0] = algebraic[2] + u[0] = external[2] u = nla_solve(objective_function_12, u, 1, [voi, states, rates, variables]) - algebraic[2] = u[0] + external[2] = u[0] def objective_function_13(u, f, data): diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.c index c2349a9090..b91929dbd9 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.c @@ -124,8 +124,8 @@ void initialiseVariables(double voi, double *states, double *rates, double *cons constants[2] = 0.3; constants[3] = 120.0; constants[4] = 36.0; - algebraic[9] = externalVariable(voi, states, rates, variables, 9); - algebraic[0] = externalVariable(voi, states, rates, variables, 0); + external[9] = externalVariable(voi, states, rates, variables, 9); + external[0] = externalVariable(voi, states, rates, variables, 0); } void computeComputedConstants(double *constants, double *computedConstants) @@ -137,12 +137,12 @@ void computeComputedConstants(double *constants, double *computedConstants) void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) { - algebraic[9] = externalVariable(voi, states, rates, variables, 9); - algebraic[0] = externalVariable(voi, states, rates, variables, 0); + external[9] = externalVariable(voi, states, rates, variables, 9); + external[0] = externalVariable(voi, states, rates, variables, 0); algebraic[1] = constants[2]*(states[0]-computedConstants[0]); algebraic[2] = constants[4]*pow(states[3], 4.0)*(states[0]-computedConstants[2]); algebraic[3] = constants[3]*pow(states[2], 3.0)*states[1]*(states[0]-computedConstants[1]); - rates[0] = -(-algebraic[0]+algebraic[3]+algebraic[2]+algebraic[1])/constants[0]; + rates[0] = -(-external[0]+algebraic[3]+algebraic[2]+algebraic[1])/constants[0]; algebraic[4] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0); algebraic[5] = 4.0*exp(states[0]/18.0); rates[2] = algebraic[4]*(1.0-states[2])-algebraic[5]*states[2]; @@ -150,13 +150,13 @@ void computeRates(double voi, double *states, double *rates, double *constants, algebraic[7] = 1.0/(exp((states[0]+30.0)/10.0)+1.0); rates[1] = algebraic[6]*(1.0-states[1])-algebraic[7]*states[1]; algebraic[8] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0); - rates[3] = algebraic[8]*(1.0-states[3])-algebraic[9]*states[3]; + rates[3] = algebraic[8]*(1.0-states[3])-external[9]*states[3]; } void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) { - algebraic[9] = externalVariable(voi, states, rates, variables, 9); - algebraic[0] = externalVariable(voi, states, rates, variables, 0); + external[9] = externalVariable(voi, states, rates, variables, 9); + external[0] = externalVariable(voi, states, rates, variables, 0); algebraic[1] = constants[2]*(states[0]-computedConstants[0]); algebraic[3] = constants[3]*pow(states[2], 3.0)*states[1]*(states[0]-computedConstants[1]); algebraic[4] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.py index a7da904728..243b736f05 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.py @@ -95,8 +95,8 @@ def initialise_variables(voi, states, rates, constants, algebraic, external_vari constants[2] = 0.3 constants[3] = 120.0 constants[4] = 36.0 - algebraic[9] = external_variable(voi, states, rates, variables, 9) - algebraic[0] = external_variable(voi, states, rates, variables, 0) + external[9] = external_variable(voi, states, rates, variables, 9) + external[0] = external_variable(voi, states, rates, variables, 0) def compute_computed_constants(constants, computed_constants): @@ -106,12 +106,12 @@ def compute_computed_constants(constants, computed_constants): def compute_rates(voi, states, rates, constants, computed_constants, algebraic, external_variable): - algebraic[9] = external_variable(voi, states, rates, variables, 9) - algebraic[0] = external_variable(voi, states, rates, variables, 0) + external[9] = external_variable(voi, states, rates, variables, 9) + external[0] = external_variable(voi, states, rates, variables, 0) algebraic[1] = constants[2]*(states[0]-computed_constants[0]) algebraic[2] = constants[4]*pow(states[3], 4.0)*(states[0]-computed_constants[2]) algebraic[3] = constants[3]*pow(states[2], 3.0)*states[1]*(states[0]-computed_constants[1]) - rates[0] = -(-algebraic[0]+algebraic[3]+algebraic[2]+algebraic[1])/constants[0] + rates[0] = -(-external[0]+algebraic[3]+algebraic[2]+algebraic[1])/constants[0] algebraic[4] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0) algebraic[5] = 4.0*exp(states[0]/18.0) rates[2] = algebraic[4]*(1.0-states[2])-algebraic[5]*states[2] @@ -119,12 +119,12 @@ def compute_rates(voi, states, rates, constants, computed_constants, algebraic, algebraic[7] = 1.0/(exp((states[0]+30.0)/10.0)+1.0) rates[1] = algebraic[6]*(1.0-states[1])-algebraic[7]*states[1] algebraic[8] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0) - rates[3] = algebraic[8]*(1.0-states[3])-algebraic[9]*states[3] + rates[3] = algebraic[8]*(1.0-states[3])-external[9]*states[3] def compute_variables(voi, states, rates, constants, computed_constants, algebraic, external_variable): - algebraic[9] = external_variable(voi, states, rates, variables, 9) - algebraic[0] = external_variable(voi, states, rates, variables, 0) + external[9] = external_variable(voi, states, rates, variables, 9) + external[0] = external_variable(voi, states, rates, variables, 0) algebraic[1] = constants[2]*(states[0]-computed_constants[0]) algebraic[3] = constants[3]*pow(states[2], 3.0)*states[1]*(states[0]-computed_constants[1]) algebraic[4] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0) diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.c index 9ae267b458..35de38cb56 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.c @@ -123,8 +123,8 @@ void initialiseVariables(double voi, double *states, double *rates, double *cons constants[1] = 0.3; constants[2] = 120.0; constants[3] = 36.0; - algebraic[11] = externalVariable(voi, states, rates, variables, 11); - algebraic[4] = externalVariable(voi, states, rates, variables, 4); + external[11] = externalVariable(voi, states, rates, variables, 11); + external[4] = externalVariable(voi, states, rates, variables, 4); } void computeComputedConstants(double *constants, double *computedConstants) @@ -134,12 +134,12 @@ void computeComputedConstants(double *constants, double *computedConstants) void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) { algebraic[0] = ((voi >= 10.0) && (voi <= 10.5))?-20.0:0.0; - algebraic[11] = externalVariable(voi, states, rates, variables, 11); - algebraic[4] = externalVariable(voi, states, rates, variables, 4); - algebraic[5] = algebraic[4]-10.613; + external[11] = externalVariable(voi, states, rates, variables, 11); + external[4] = externalVariable(voi, states, rates, variables, 4); + algebraic[5] = external[4]-10.613; algebraic[1] = constants[1]*(states[0]-algebraic[5]); - algebraic[2] = constants[3]*pow(states[3], 4.0)*(states[0]-algebraic[11]); - algebraic[6] = algebraic[4]-115.0; + algebraic[2] = constants[3]*pow(states[3], 4.0)*(states[0]-external[11]); + algebraic[6] = external[4]-115.0; algebraic[3] = constants[2]*pow(states[2], 3.0)*states[1]*(states[0]-algebraic[6]); rates[0] = -(-algebraic[0]+algebraic[3]+algebraic[2]+algebraic[1])/constants[0]; algebraic[7] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0); @@ -155,17 +155,17 @@ void computeRates(double voi, double *states, double *rates, double *constants, void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) { - algebraic[11] = externalVariable(voi, states, rates, variables, 11); - algebraic[4] = externalVariable(voi, states, rates, variables, 4); - algebraic[5] = algebraic[4]-10.613; + external[11] = externalVariable(voi, states, rates, variables, 11); + external[4] = externalVariable(voi, states, rates, variables, 4); + algebraic[5] = external[4]-10.613; algebraic[1] = constants[1]*(states[0]-algebraic[5]); - algebraic[6] = algebraic[4]-115.0; + algebraic[6] = external[4]-115.0; algebraic[3] = constants[2]*pow(states[2], 3.0)*states[1]*(states[0]-algebraic[6]); algebraic[7] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0); algebraic[8] = 4.0*exp(states[0]/18.0); algebraic[9] = 0.07*exp(states[0]/20.0); algebraic[10] = 1.0/(exp((states[0]+30.0)/10.0)+1.0); - algebraic[2] = constants[3]*pow(states[3], 4.0)*(states[0]-algebraic[11]); + algebraic[2] = constants[3]*pow(states[3], 4.0)*(states[0]-external[11]); algebraic[12] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0); algebraic[13] = 0.125*exp(states[0]/80.0); } diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.py index 8ecf9444b0..0da4974b20 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.py @@ -94,8 +94,8 @@ def initialise_variables(voi, states, rates, constants, algebraic, external_vari constants[1] = 0.3 constants[2] = 120.0 constants[3] = 36.0 - algebraic[11] = external_variable(voi, states, rates, variables, 11) - algebraic[4] = external_variable(voi, states, rates, variables, 4) + external[11] = external_variable(voi, states, rates, variables, 11) + external[4] = external_variable(voi, states, rates, variables, 4) def compute_computed_constants(constants, computed_constants): @@ -104,12 +104,12 @@ def compute_computed_constants(constants, computed_constants): def compute_rates(voi, states, rates, constants, computed_constants, algebraic, external_variable): algebraic[0] = -20.0 if and_func(geq_func(voi, 10.0), leq_func(voi, 10.5)) else 0.0 - algebraic[11] = external_variable(voi, states, rates, variables, 11) - algebraic[4] = external_variable(voi, states, rates, variables, 4) - algebraic[5] = algebraic[4]-10.613 + external[11] = external_variable(voi, states, rates, variables, 11) + external[4] = external_variable(voi, states, rates, variables, 4) + algebraic[5] = external[4]-10.613 algebraic[1] = constants[1]*(states[0]-algebraic[5]) - algebraic[2] = constants[3]*pow(states[3], 4.0)*(states[0]-algebraic[11]) - algebraic[6] = algebraic[4]-115.0 + algebraic[2] = constants[3]*pow(states[3], 4.0)*(states[0]-external[11]) + algebraic[6] = external[4]-115.0 algebraic[3] = constants[2]*pow(states[2], 3.0)*states[1]*(states[0]-algebraic[6]) rates[0] = -(-algebraic[0]+algebraic[3]+algebraic[2]+algebraic[1])/constants[0] algebraic[7] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0) @@ -124,16 +124,16 @@ def compute_rates(voi, states, rates, constants, computed_constants, algebraic, def compute_variables(voi, states, rates, constants, computed_constants, algebraic, external_variable): - algebraic[11] = external_variable(voi, states, rates, variables, 11) - algebraic[4] = external_variable(voi, states, rates, variables, 4) - algebraic[5] = algebraic[4]-10.613 + external[11] = external_variable(voi, states, rates, variables, 11) + external[4] = external_variable(voi, states, rates, variables, 4) + algebraic[5] = external[4]-10.613 algebraic[1] = constants[1]*(states[0]-algebraic[5]) - algebraic[6] = algebraic[4]-115.0 + algebraic[6] = external[4]-115.0 algebraic[3] = constants[2]*pow(states[2], 3.0)*states[1]*(states[0]-algebraic[6]) algebraic[7] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0) algebraic[8] = 4.0*exp(states[0]/18.0) algebraic[9] = 0.07*exp(states[0]/20.0) algebraic[10] = 1.0/(exp((states[0]+30.0)/10.0)+1.0) - algebraic[2] = constants[3]*pow(states[3], 4.0)*(states[0]-algebraic[11]) + algebraic[2] = constants[3]*pow(states[3], 4.0)*(states[0]-external[11]) algebraic[12] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0) algebraic[13] = 0.125*exp(states[0]/80.0) diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.c index 7e67473638..cc74be6ce6 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.c @@ -122,8 +122,8 @@ void initialiseVariables(double voi, double *states, double *rates, double *cons constants[0] = 0.0; constants[1] = 0.3; constants[2] = 36.0; - algebraic[5] = externalVariable(voi, states, rates, variables, 5); - algebraic[4] = externalVariable(voi, states, rates, variables, 4); + external[5] = externalVariable(voi, states, rates, variables, 5); + external[4] = externalVariable(voi, states, rates, variables, 4); } void computeComputedConstants(double *constants, double *computedConstants) @@ -136,12 +136,12 @@ void computeComputedConstants(double *constants, double *computedConstants) void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) { algebraic[0] = ((voi >= 10.0) && (voi <= 10.5))?-20.0:0.0; - algebraic[5] = externalVariable(voi, states, rates, variables, 5); - algebraic[4] = externalVariable(voi, states, rates, variables, 4); + external[5] = externalVariable(voi, states, rates, variables, 5); + external[4] = externalVariable(voi, states, rates, variables, 4); algebraic[1] = constants[1]*(states[0]-computedConstants[0]); algebraic[2] = constants[2]*pow(states[3], 4.0)*(states[0]-computedConstants[2]); - algebraic[3] = algebraic[5]*pow(states[2], 3.0)*states[1]*(states[0]-computedConstants[1]); - rates[0] = -(-algebraic[0]+algebraic[3]+algebraic[2]+algebraic[1])/algebraic[4]; + algebraic[3] = external[5]*pow(states[2], 3.0)*states[1]*(states[0]-computedConstants[1]); + rates[0] = -(-algebraic[0]+algebraic[3]+algebraic[2]+algebraic[1])/external[4]; algebraic[6] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0); algebraic[7] = 4.0*exp(states[0]/18.0); rates[2] = algebraic[6]*(1.0-states[2])-algebraic[7]*states[2]; @@ -156,8 +156,8 @@ void computeRates(double voi, double *states, double *rates, double *constants, void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) { algebraic[1] = constants[1]*(states[0]-computedConstants[0]); - algebraic[5] = externalVariable(voi, states, rates, variables, 5); - algebraic[3] = algebraic[5]*pow(states[2], 3.0)*states[1]*(states[0]-computedConstants[1]); + external[5] = externalVariable(voi, states, rates, variables, 5); + algebraic[3] = external[5]*pow(states[2], 3.0)*states[1]*(states[0]-computedConstants[1]); algebraic[6] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0); algebraic[7] = 4.0*exp(states[0]/18.0); algebraic[8] = 0.07*exp(states[0]/20.0); @@ -165,5 +165,5 @@ void computeVariables(double voi, double *states, double *rates, double *constan algebraic[2] = constants[2]*pow(states[3], 4.0)*(states[0]-computedConstants[2]); algebraic[10] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0); algebraic[11] = 0.125*exp(states[0]/80.0); - algebraic[4] = externalVariable(voi, states, rates, variables, 4); + external[4] = externalVariable(voi, states, rates, variables, 4); } diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.py index 64f4a8c1f7..9ffe1b12aa 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.py @@ -93,8 +93,8 @@ def initialise_variables(voi, states, rates, constants, algebraic, external_vari constants[0] = 0.0 constants[1] = 0.3 constants[2] = 36.0 - algebraic[5] = external_variable(voi, states, rates, variables, 5) - algebraic[4] = external_variable(voi, states, rates, variables, 4) + external[5] = external_variable(voi, states, rates, variables, 5) + external[4] = external_variable(voi, states, rates, variables, 4) def compute_computed_constants(constants, computed_constants): @@ -105,12 +105,12 @@ def compute_computed_constants(constants, computed_constants): def compute_rates(voi, states, rates, constants, computed_constants, algebraic, external_variable): algebraic[0] = -20.0 if and_func(geq_func(voi, 10.0), leq_func(voi, 10.5)) else 0.0 - algebraic[5] = external_variable(voi, states, rates, variables, 5) - algebraic[4] = external_variable(voi, states, rates, variables, 4) + external[5] = external_variable(voi, states, rates, variables, 5) + external[4] = external_variable(voi, states, rates, variables, 4) algebraic[1] = constants[1]*(states[0]-computed_constants[0]) algebraic[2] = constants[2]*pow(states[3], 4.0)*(states[0]-computed_constants[2]) - algebraic[3] = algebraic[5]*pow(states[2], 3.0)*states[1]*(states[0]-computed_constants[1]) - rates[0] = -(-algebraic[0]+algebraic[3]+algebraic[2]+algebraic[1])/algebraic[4] + algebraic[3] = external[5]*pow(states[2], 3.0)*states[1]*(states[0]-computed_constants[1]) + rates[0] = -(-algebraic[0]+algebraic[3]+algebraic[2]+algebraic[1])/external[4] algebraic[6] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0) algebraic[7] = 4.0*exp(states[0]/18.0) rates[2] = algebraic[6]*(1.0-states[2])-algebraic[7]*states[2] @@ -124,8 +124,8 @@ def compute_rates(voi, states, rates, constants, computed_constants, algebraic, def compute_variables(voi, states, rates, constants, computed_constants, algebraic, external_variable): algebraic[1] = constants[1]*(states[0]-computed_constants[0]) - algebraic[5] = external_variable(voi, states, rates, variables, 5) - algebraic[3] = algebraic[5]*pow(states[2], 3.0)*states[1]*(states[0]-computed_constants[1]) + external[5] = external_variable(voi, states, rates, variables, 5) + algebraic[3] = external[5]*pow(states[2], 3.0)*states[1]*(states[0]-computed_constants[1]) algebraic[6] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0) algebraic[7] = 4.0*exp(states[0]/18.0) algebraic[8] = 0.07*exp(states[0]/20.0) @@ -133,4 +133,4 @@ def compute_variables(voi, states, rates, constants, computed_constants, algebra algebraic[2] = constants[2]*pow(states[3], 4.0)*(states[0]-computed_constants[2]) algebraic[10] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0) algebraic[11] = 0.125*exp(states[0]/80.0) - algebraic[4] = external_variable(voi, states, rates, variables, 4) + external[4] = external_variable(voi, states, rates, variables, 4) diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.c index 7d42c647f7..3f7fde0861 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.c @@ -122,8 +122,8 @@ void initialiseVariables(double voi, double *states, double *rates, double *cons constants[2] = 0.3; constants[3] = 120.0; constants[4] = 36.0; - algebraic[1] = externalVariable(voi, states, rates, variables, 1); - algebraic[5] = externalVariable(voi, states, rates, variables, 5); + external[1] = externalVariable(voi, states, rates, variables, 1); + external[5] = externalVariable(voi, states, rates, variables, 5); } void computeComputedConstants(double *constants, double *computedConstants) @@ -135,23 +135,23 @@ void computeComputedConstants(double *constants, double *computedConstants) void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) { - algebraic[1] = externalVariable(voi, states, rates, variables, 1); - algebraic[8] = 0.07*exp(algebraic[1]/20.0); - algebraic[9] = 1.0/(exp((algebraic[1]+30.0)/10.0)+1.0); + external[1] = externalVariable(voi, states, rates, variables, 1); + algebraic[8] = 0.07*exp(external[1]/20.0); + algebraic[9] = 1.0/(exp((external[1]+30.0)/10.0)+1.0); rates[0] = algebraic[8]*(1.0-states[0])-algebraic[9]*states[0]; - algebraic[10] = 0.01*(algebraic[1]+10.0)/(exp((algebraic[1]+10.0)/10.0)-1.0); - algebraic[11] = 0.125*exp(algebraic[1]/80.0); + algebraic[10] = 0.01*(external[1]+10.0)/(exp((external[1]+10.0)/10.0)-1.0); + algebraic[11] = 0.125*exp(external[1]/80.0); rates[1] = algebraic[10]*(1.0-states[1])-algebraic[11]*states[1]; } void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) { algebraic[0] = ((voi >= 10.0) && (voi <= 10.5))?-20.0:0.0; - algebraic[1] = externalVariable(voi, states, rates, variables, 1); - algebraic[2] = constants[2]*(algebraic[1]-computedConstants[0]); - algebraic[5] = externalVariable(voi, states, rates, variables, 5); - algebraic[4] = constants[3]*pow(algebraic[5], 3.0)*states[0]*(algebraic[1]-computedConstants[1]); - algebraic[6] = 0.1*(algebraic[1]+25.0)/(exp((algebraic[1]+25.0)/10.0)-1.0); - algebraic[7] = 4.0*exp(algebraic[1]/18.0); - algebraic[3] = constants[4]*pow(states[1], 4.0)*(algebraic[1]-computedConstants[2]); + external[1] = externalVariable(voi, states, rates, variables, 1); + algebraic[2] = constants[2]*(external[1]-computedConstants[0]); + external[5] = externalVariable(voi, states, rates, variables, 5); + algebraic[4] = constants[3]*pow(external[5], 3.0)*states[0]*(external[1]-computedConstants[1]); + algebraic[6] = 0.1*(external[1]+25.0)/(exp((external[1]+25.0)/10.0)-1.0); + algebraic[7] = 4.0*exp(external[1]/18.0); + algebraic[3] = constants[4]*pow(states[1], 4.0)*(external[1]-computedConstants[2]); } diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.py index d9285aa420..a4fb36996a 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.py @@ -93,8 +93,8 @@ def initialise_variables(voi, states, rates, constants, algebraic, external_vari constants[2] = 0.3 constants[3] = 120.0 constants[4] = 36.0 - algebraic[1] = external_variable(voi, states, rates, variables, 1) - algebraic[5] = external_variable(voi, states, rates, variables, 5) + external[1] = external_variable(voi, states, rates, variables, 1) + external[5] = external_variable(voi, states, rates, variables, 5) def compute_computed_constants(constants, computed_constants): @@ -104,21 +104,21 @@ def compute_computed_constants(constants, computed_constants): def compute_rates(voi, states, rates, constants, computed_constants, algebraic, external_variable): - algebraic[1] = external_variable(voi, states, rates, variables, 1) - algebraic[8] = 0.07*exp(algebraic[1]/20.0) - algebraic[9] = 1.0/(exp((algebraic[1]+30.0)/10.0)+1.0) + external[1] = external_variable(voi, states, rates, variables, 1) + algebraic[8] = 0.07*exp(external[1]/20.0) + algebraic[9] = 1.0/(exp((external[1]+30.0)/10.0)+1.0) rates[0] = algebraic[8]*(1.0-states[0])-algebraic[9]*states[0] - algebraic[10] = 0.01*(algebraic[1]+10.0)/(exp((algebraic[1]+10.0)/10.0)-1.0) - algebraic[11] = 0.125*exp(algebraic[1]/80.0) + algebraic[10] = 0.01*(external[1]+10.0)/(exp((external[1]+10.0)/10.0)-1.0) + algebraic[11] = 0.125*exp(external[1]/80.0) rates[1] = algebraic[10]*(1.0-states[1])-algebraic[11]*states[1] def compute_variables(voi, states, rates, constants, computed_constants, algebraic, external_variable): algebraic[0] = -20.0 if and_func(geq_func(voi, 10.0), leq_func(voi, 10.5)) else 0.0 - algebraic[1] = external_variable(voi, states, rates, variables, 1) - algebraic[2] = constants[2]*(algebraic[1]-computed_constants[0]) - algebraic[5] = external_variable(voi, states, rates, variables, 5) - algebraic[4] = constants[3]*pow(algebraic[5], 3.0)*states[0]*(algebraic[1]-computed_constants[1]) - algebraic[6] = 0.1*(algebraic[1]+25.0)/(exp((algebraic[1]+25.0)/10.0)-1.0) - algebraic[7] = 4.0*exp(algebraic[1]/18.0) - algebraic[3] = constants[4]*pow(states[1], 4.0)*(algebraic[1]-computed_constants[2]) + external[1] = external_variable(voi, states, rates, variables, 1) + algebraic[2] = constants[2]*(external[1]-computed_constants[0]) + external[5] = external_variable(voi, states, rates, variables, 5) + algebraic[4] = constants[3]*pow(external[5], 3.0)*states[0]*(external[1]-computed_constants[1]) + algebraic[6] = 0.1*(external[1]+25.0)/(exp((external[1]+25.0)/10.0)-1.0) + algebraic[7] = 4.0*exp(external[1]/18.0) + algebraic[3] = constants[4]*pow(states[1], 4.0)*(external[1]-computed_constants[2]) diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.c index bb4ff207fc..c2572f6cf8 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.c @@ -123,9 +123,9 @@ void initialiseVariables(double voi, double *states, double *rates, double *cons constants[2] = 0.3; constants[3] = 120.0; constants[4] = 36.0; - algebraic[1] = externalVariable(voi, states, rates, variables, 1); - algebraic[9] = externalVariable(voi, states, rates, variables, 9); - algebraic[4] = externalVariable(voi, states, rates, variables, 4); + external[1] = externalVariable(voi, states, rates, variables, 1); + external[9] = externalVariable(voi, states, rates, variables, 9); + external[4] = externalVariable(voi, states, rates, variables, 4); } void computeComputedConstants(double *constants, double *computedConstants) @@ -137,24 +137,24 @@ void computeComputedConstants(double *constants, double *computedConstants) void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) { - algebraic[1] = externalVariable(voi, states, rates, variables, 1); - algebraic[5] = 0.1*(algebraic[1]+25.0)/(exp((algebraic[1]+25.0)/10.0)-1.0); - algebraic[6] = 4.0*exp(algebraic[1]/18.0); + external[1] = externalVariable(voi, states, rates, variables, 1); + algebraic[5] = 0.1*(external[1]+25.0)/(exp((external[1]+25.0)/10.0)-1.0); + algebraic[6] = 4.0*exp(external[1]/18.0); rates[1] = algebraic[5]*(1.0-states[1])-algebraic[6]*states[1]; - algebraic[7] = 0.07*exp(algebraic[1]/20.0); - algebraic[8] = 1.0/(exp((algebraic[1]+30.0)/10.0)+1.0); + algebraic[7] = 0.07*exp(external[1]/20.0); + algebraic[8] = 1.0/(exp((external[1]+30.0)/10.0)+1.0); rates[0] = algebraic[7]*(1.0-states[0])-algebraic[8]*states[0]; - algebraic[9] = externalVariable(voi, states, rates, variables, 9); - algebraic[10] = 0.125*exp(algebraic[1]/80.0); - rates[2] = algebraic[9]*(1.0-states[2])-algebraic[10]*states[2]; + external[9] = externalVariable(voi, states, rates, variables, 9); + algebraic[10] = 0.125*exp(external[1]/80.0); + rates[2] = external[9]*(1.0-states[2])-algebraic[10]*states[2]; } void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) { algebraic[0] = ((voi >= 10.0) && (voi <= 10.5))?-20.0:0.0; - algebraic[1] = externalVariable(voi, states, rates, variables, 1); - algebraic[2] = constants[2]*(algebraic[1]-computedConstants[0]); - algebraic[9] = externalVariable(voi, states, rates, variables, 9); - algebraic[4] = externalVariable(voi, states, rates, variables, 4); - algebraic[3] = constants[4]*pow(states[2], 4.0)*(algebraic[1]-computedConstants[2]); + external[1] = externalVariable(voi, states, rates, variables, 1); + algebraic[2] = constants[2]*(external[1]-computedConstants[0]); + external[9] = externalVariable(voi, states, rates, variables, 9); + external[4] = externalVariable(voi, states, rates, variables, 4); + algebraic[3] = constants[4]*pow(states[2], 4.0)*(external[1]-computedConstants[2]); } diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.py index e3b132256f..5fefa1e030 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.py @@ -94,9 +94,9 @@ def initialise_variables(voi, states, rates, constants, algebraic, external_vari constants[2] = 0.3 constants[3] = 120.0 constants[4] = 36.0 - algebraic[1] = external_variable(voi, states, rates, variables, 1) - algebraic[9] = external_variable(voi, states, rates, variables, 9) - algebraic[4] = external_variable(voi, states, rates, variables, 4) + external[1] = external_variable(voi, states, rates, variables, 1) + external[9] = external_variable(voi, states, rates, variables, 9) + external[4] = external_variable(voi, states, rates, variables, 4) def compute_computed_constants(constants, computed_constants): @@ -106,22 +106,22 @@ def compute_computed_constants(constants, computed_constants): def compute_rates(voi, states, rates, constants, computed_constants, algebraic, external_variable): - algebraic[1] = external_variable(voi, states, rates, variables, 1) - algebraic[5] = 0.1*(algebraic[1]+25.0)/(exp((algebraic[1]+25.0)/10.0)-1.0) - algebraic[6] = 4.0*exp(algebraic[1]/18.0) + external[1] = external_variable(voi, states, rates, variables, 1) + algebraic[5] = 0.1*(external[1]+25.0)/(exp((external[1]+25.0)/10.0)-1.0) + algebraic[6] = 4.0*exp(external[1]/18.0) rates[1] = algebraic[5]*(1.0-states[1])-algebraic[6]*states[1] - algebraic[7] = 0.07*exp(algebraic[1]/20.0) - algebraic[8] = 1.0/(exp((algebraic[1]+30.0)/10.0)+1.0) + algebraic[7] = 0.07*exp(external[1]/20.0) + algebraic[8] = 1.0/(exp((external[1]+30.0)/10.0)+1.0) rates[0] = algebraic[7]*(1.0-states[0])-algebraic[8]*states[0] - algebraic[9] = external_variable(voi, states, rates, variables, 9) - algebraic[10] = 0.125*exp(algebraic[1]/80.0) - rates[2] = algebraic[9]*(1.0-states[2])-algebraic[10]*states[2] + external[9] = external_variable(voi, states, rates, variables, 9) + algebraic[10] = 0.125*exp(external[1]/80.0) + rates[2] = external[9]*(1.0-states[2])-algebraic[10]*states[2] def compute_variables(voi, states, rates, constants, computed_constants, algebraic, external_variable): algebraic[0] = -20.0 if and_func(geq_func(voi, 10.0), leq_func(voi, 10.5)) else 0.0 - algebraic[1] = external_variable(voi, states, rates, variables, 1) - algebraic[2] = constants[2]*(algebraic[1]-computed_constants[0]) - algebraic[9] = external_variable(voi, states, rates, variables, 9) - algebraic[4] = external_variable(voi, states, rates, variables, 4) - algebraic[3] = constants[4]*pow(states[2], 4.0)*(algebraic[1]-computed_constants[2]) + external[1] = external_variable(voi, states, rates, variables, 1) + algebraic[2] = constants[2]*(external[1]-computed_constants[0]) + external[9] = external_variable(voi, states, rates, variables, 9) + external[4] = external_variable(voi, states, rates, variables, 4) + algebraic[3] = constants[4]*pow(states[2], 4.0)*(external[1]-computed_constants[2]) diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.c index fff1a06f0b..f5d0d0929d 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.c @@ -123,7 +123,7 @@ void initialiseVariables(double voi, double *states, double *rates, double *cons constants[2] = 0.3; constants[3] = 120.0; constants[4] = 36.0; - algebraic[4] = externalVariable(voi, states, rates, variables, 4); + external[4] = externalVariable(voi, states, rates, variables, 4); } void computeComputedConstants(double *constants, double *computedConstants) @@ -138,8 +138,8 @@ void computeRates(double voi, double *states, double *rates, double *constants, algebraic[0] = ((voi >= 10.0) && (voi <= 10.5))?-20.0:0.0; algebraic[1] = constants[2]*(states[0]-computedConstants[0]); algebraic[2] = constants[4]*pow(states[2], 4.0)*(states[0]-computedConstants[2]); - algebraic[4] = externalVariable(voi, states, rates, variables, 4); - algebraic[3] = constants[3]*pow(algebraic[4], 3.0)*states[1]*(states[0]-computedConstants[1]); + external[4] = externalVariable(voi, states, rates, variables, 4); + algebraic[3] = constants[3]*pow(external[4], 3.0)*states[1]*(states[0]-computedConstants[1]); rates[0] = -(-algebraic[0]+algebraic[3]+algebraic[2]+algebraic[1])/constants[0]; algebraic[7] = 0.07*exp(states[0]/20.0); algebraic[8] = 1.0/(exp((states[0]+30.0)/10.0)+1.0); @@ -152,8 +152,8 @@ void computeRates(double voi, double *states, double *rates, double *constants, void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) { algebraic[1] = constants[2]*(states[0]-computedConstants[0]); - algebraic[4] = externalVariable(voi, states, rates, variables, 4); - algebraic[3] = constants[3]*pow(algebraic[4], 3.0)*states[1]*(states[0]-computedConstants[1]); + external[4] = externalVariable(voi, states, rates, variables, 4); + algebraic[3] = constants[3]*pow(external[4], 3.0)*states[1]*(states[0]-computedConstants[1]); algebraic[5] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0); algebraic[6] = 4.0*exp(states[0]/18.0); algebraic[7] = 0.07*exp(states[0]/20.0); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.py index c9fd022750..27d1d496a2 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.py @@ -94,7 +94,7 @@ def initialise_variables(voi, states, rates, constants, algebraic, external_vari constants[2] = 0.3 constants[3] = 120.0 constants[4] = 36.0 - algebraic[4] = external_variable(voi, states, rates, variables, 4) + external[4] = external_variable(voi, states, rates, variables, 4) def compute_computed_constants(constants, computed_constants): @@ -107,8 +107,8 @@ def compute_rates(voi, states, rates, constants, computed_constants, algebraic, algebraic[0] = -20.0 if and_func(geq_func(voi, 10.0), leq_func(voi, 10.5)) else 0.0 algebraic[1] = constants[2]*(states[0]-computed_constants[0]) algebraic[2] = constants[4]*pow(states[2], 4.0)*(states[0]-computed_constants[2]) - algebraic[4] = external_variable(voi, states, rates, variables, 4) - algebraic[3] = constants[3]*pow(algebraic[4], 3.0)*states[1]*(states[0]-computed_constants[1]) + external[4] = external_variable(voi, states, rates, variables, 4) + algebraic[3] = constants[3]*pow(external[4], 3.0)*states[1]*(states[0]-computed_constants[1]) rates[0] = -(-algebraic[0]+algebraic[3]+algebraic[2]+algebraic[1])/constants[0] algebraic[7] = 0.07*exp(states[0]/20.0) algebraic[8] = 1.0/(exp((states[0]+30.0)/10.0)+1.0) @@ -120,8 +120,8 @@ def compute_rates(voi, states, rates, constants, computed_constants, algebraic, def compute_variables(voi, states, rates, constants, computed_constants, algebraic, external_variable): algebraic[1] = constants[2]*(states[0]-computed_constants[0]) - algebraic[4] = external_variable(voi, states, rates, variables, 4) - algebraic[3] = constants[3]*pow(algebraic[4], 3.0)*states[1]*(states[0]-computed_constants[1]) + external[4] = external_variable(voi, states, rates, variables, 4) + algebraic[3] = constants[3]*pow(external[4], 3.0)*states[1]*(states[0]-computed_constants[1]) algebraic[5] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0) algebraic[6] = 4.0*exp(states[0]/18.0) algebraic[7] = 0.07*exp(states[0]/20.0) diff --git a/tests/resources/generator/unknown_variable_as_external_variable/model.c b/tests/resources/generator/unknown_variable_as_external_variable/model.c index 0103461a2c..1c1f84b89a 100644 --- a/tests/resources/generator/unknown_variable_as_external_variable/model.c +++ b/tests/resources/generator/unknown_variable_as_external_variable/model.c @@ -94,7 +94,7 @@ void initialiseVariables(double *constants, double *algebraic, ExternalVariable constants[5] = 2902500.0; constants[6] = 810000.0; constants[7] = 247140.0; - algebraic[1] = externalVariable(variables, 1); + external[1] = externalVariable(variables, 1); } void computeComputedConstants(double *constants, double *computedConstants) @@ -103,6 +103,6 @@ void computeComputedConstants(double *constants, double *computedConstants) void computeVariables(double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) { - algebraic[1] = externalVariable(variables, 1); - algebraic[0] = constants[0]*(constants[1]*constants[2]-constants[3]*constants[4])/(constants[5]*constants[4]+algebraic[1]*constants[2]+constants[7]*constants[4]*constants[2]+constants[6]); + external[1] = externalVariable(variables, 1); + algebraic[0] = constants[0]*(constants[1]*constants[2]-constants[3]*constants[4])/(constants[5]*constants[4]+external[1]*constants[2]+constants[7]*constants[4]*constants[2]+constants[6]); } diff --git a/tests/resources/generator/unknown_variable_as_external_variable/model.py b/tests/resources/generator/unknown_variable_as_external_variable/model.py index 48f6272965..74427a055c 100644 --- a/tests/resources/generator/unknown_variable_as_external_variable/model.py +++ b/tests/resources/generator/unknown_variable_as_external_variable/model.py @@ -60,7 +60,7 @@ def initialise_variables(constants, algebraic, external_variable): constants[5] = 2902500.0 constants[6] = 810000.0 constants[7] = 247140.0 - algebraic[1] = external_variable(variables, 1) + external[1] = external_variable(variables, 1) def compute_computed_constants(constants, computed_constants): @@ -68,5 +68,5 @@ def compute_computed_constants(constants, computed_constants): def compute_variables(constants, computed_constants, algebraic, external_variable): - algebraic[1] = external_variable(variables, 1) - algebraic[0] = constants[0]*(constants[1]*constants[2]-constants[3]*constants[4])/(constants[5]*constants[4]+algebraic[1]*constants[2]+constants[7]*constants[4]*constants[2]+constants[6]) + external[1] = external_variable(variables, 1) + algebraic[0] = constants[0]*(constants[1]*constants[2]-constants[3]*constants[4])/(constants[5]*constants[4]+external[1]*constants[2]+constants[7]*constants[4]*constants[2]+constants[6]) From 0a05ef9bc427bf2154e85bf6b54ddf221ee93f2a Mon Sep 17 00:00:00 2001 From: Alan Garny Date: Fri, 16 Aug 2024 13:49:16 +0200 Subject: [PATCH 28/85] Generator: don't initialise our external variables in initialiseVariables(). There was never a need to initialise them there in the first place. In fact, an external variable is effectively an algebraic variable which is computed by an end user. So, it needs to be computed in computeRates() (if available) and in computeVariables(). Also fixed an issue with initialiseVariables() not always including the VOI. --- src/api/libcellml/generatorprofile.h | 16 +-- src/generator.cpp | 22 +--- src/generatorprofile.cpp | 116 +++++------------- src/generatorprofile_p.h | 14 +-- src/generatorprofilesha1values.h | 4 +- src/generatorprofiletools.cpp | 14 +-- .../javascript/generatorprofile.test.js | 28 ++--- .../bindings/python/test_generator_profile.py | 50 +++----- tests/coverage/coverage.cpp | 1 - tests/generator/generatorprofile.cpp | 56 +++------ tests/resources/coverage/generator/model.c | 2 +- tests/resources/coverage/generator/model.h | 2 +- .../generator/model.implementation.out | 2 +- .../coverage/generator/model.interface.out | 2 +- .../generator/model.modified.profile.c | 2 +- .../generator/model.modified.profile.h | 2 +- .../generator/model.modified.profile.py | 2 +- tests/resources/coverage/generator/model.out | 2 +- tests/resources/coverage/generator/model.py | 2 +- .../model.external.c | 3 +- .../model.external.h | 2 +- .../model.external.py | 4 +- .../algebraic_eqn_derivative_on_rhs/model.c | 2 +- .../algebraic_eqn_derivative_on_rhs/model.h | 2 +- .../algebraic_eqn_derivative_on_rhs/model.py | 2 +- .../model.c | 2 +- .../model.h | 2 +- .../model.py | 2 +- .../algebraic_eqn_state_var_on_rhs/model.c | 2 +- .../algebraic_eqn_state_var_on_rhs/model.h | 2 +- .../algebraic_eqn_state_var_on_rhs/model.py | 2 +- .../model.c | 2 +- .../model.h | 2 +- .../model.py | 2 +- .../model.external.c | 3 +- .../model.external.h | 2 +- .../model.external.py | 4 +- .../model.three.externals.c | 5 +- .../model.three.externals.h | 2 +- .../model.three.externals.py | 6 +- .../cell_geometry_model/model.external.c | 4 +- .../cell_geometry_model/model.external.h | 2 +- .../cell_geometry_model/model.external.py | 5 +- .../model.c | 2 +- .../model.h | 2 +- .../model.py | 2 +- .../model.c | 2 +- .../model.h | 2 +- .../model.py | 2 +- .../cellml_unit_scaling_rate/model.c | 2 +- .../cellml_unit_scaling_rate/model.h | 2 +- .../cellml_unit_scaling_rate/model.py | 2 +- .../cellml_unit_scaling_state/model.c | 2 +- .../cellml_unit_scaling_state/model.h | 2 +- .../cellml_unit_scaling_state/model.py | 2 +- .../model.c | 2 +- .../model.h | 2 +- .../model.py | 2 +- .../model.c | 2 +- .../model.h | 2 +- .../model.py | 2 +- .../cellml_unit_scaling_voi_direct/model.c | 2 +- .../cellml_unit_scaling_voi_direct/model.h | 2 +- .../cellml_unit_scaling_voi_direct/model.py | 2 +- .../cellml_unit_scaling_voi_indirect/model.c | 2 +- .../cellml_unit_scaling_voi_indirect/model.h | 2 +- .../cellml_unit_scaling_voi_indirect/model.py | 2 +- .../generator/dae_cellml_1_1_model/model.c | 2 +- .../generator/dae_cellml_1_1_model/model.h | 2 +- .../generator/dae_cellml_1_1_model/model.py | 2 +- .../generator/dependent_eqns/model.c | 2 +- .../generator/dependent_eqns/model.h | 2 +- .../generator/dependent_eqns/model.py | 2 +- .../model.c | 2 +- .../model.h | 2 +- .../model.py | 2 +- .../model.c | 2 +- .../model.h | 2 +- .../model.py | 2 +- .../model.algebraic.c | 3 +- .../model.algebraic.h | 2 +- .../model.algebraic.py | 3 +- .../model.c | 2 +- .../model.computed.constant.c | 3 +- .../model.computed.constant.h | 2 +- .../model.computed.constant.py | 3 +- .../model.constant.c | 3 +- .../model.constant.h | 2 +- .../model.constant.py | 3 +- .../model.dae.c | 2 +- .../model.dae.h | 2 +- .../model.dae.py | 2 +- .../model.dependent.algebraic.c | 4 +- .../model.dependent.algebraic.h | 2 +- .../model.dependent.algebraic.py | 4 +- .../model.dependent.computed.constant.c | 4 +- .../model.dependent.computed.constant.h | 2 +- .../model.dependent.computed.constant.py | 4 +- .../model.dependent.constant.c | 4 +- .../model.dependent.constant.h | 2 +- .../model.dependent.constant.py | 4 +- .../model.dependent.state.c | 4 +- .../model.dependent.state.h | 2 +- .../model.dependent.state.py | 4 +- .../model.external.c | 5 +- .../model.external.h | 2 +- .../model.external.py | 5 +- .../model.h | 2 +- .../model.py | 2 +- .../model.state.c | 3 +- .../model.state.h | 2 +- .../model.state.py | 3 +- .../generator/noble_model_1962/model.c | 2 +- .../generator/noble_model_1962/model.h | 2 +- .../generator/noble_model_1962/model.py | 2 +- .../generator/ode_computed_var_on_rhs/model.c | 2 +- .../generator/ode_computed_var_on_rhs/model.h | 2 +- .../ode_computed_var_on_rhs/model.py | 2 +- .../model.c | 2 +- .../model.h | 2 +- .../model.py | 2 +- .../generator/ode_const_var_on_rhs/model.c | 2 +- .../generator/ode_const_var_on_rhs/model.h | 2 +- .../generator/ode_const_var_on_rhs/model.py | 2 +- .../model.c | 2 +- .../model.h | 2 +- .../model.py | 2 +- .../generator/ode_constant_on_rhs/model.c | 2 +- .../generator/ode_constant_on_rhs/model.h | 2 +- .../generator/ode_constant_on_rhs/model.py | 2 +- .../ode_constant_on_rhs_one_component/model.c | 2 +- .../ode_constant_on_rhs_one_component/model.h | 2 +- .../model.py | 2 +- .../ode_multiple_dependent_odes/model.c | 2 +- .../ode_multiple_dependent_odes/model.h | 2 +- .../ode_multiple_dependent_odes/model.py | 2 +- .../model.c | 2 +- .../model.h | 2 +- .../model.py | 2 +- .../ode_multiple_odes_with_same_name/model.c | 2 +- .../ode_multiple_odes_with_same_name/model.h | 2 +- .../ode_multiple_odes_with_same_name/model.py | 2 +- .../generator/ode_unknown_var_on_rhs/model.c | 2 +- .../generator/ode_unknown_var_on_rhs/model.h | 2 +- .../generator/ode_unknown_var_on_rhs/model.py | 2 +- .../robertson_model_1966/model.dae.c | 2 +- .../robertson_model_1966/model.dae.h | 2 +- .../robertson_model_1966/model.dae.py | 2 +- .../robertson_model_1966/model.ode.c | 2 +- .../robertson_model_1966/model.ode.h | 2 +- .../robertson_model_1966/model.ode.py | 2 +- .../generator/sine_model_imports/model.c | 2 +- .../generator/sine_model_imports/model.h | 2 +- .../generator/sine_model_imports/model.py | 2 +- .../model.c | 3 +- .../model.h | 2 +- .../model.py | 3 +- .../model.c | 2 +- .../model.h | 2 +- .../model.py | 2 +- 160 files changed, 234 insertions(+), 437 deletions(-) diff --git a/src/api/libcellml/generatorprofile.h b/src/api/libcellml/generatorprofile.h index ae367e295a..33b889c117 100644 --- a/src/api/libcellml/generatorprofile.h +++ b/src/api/libcellml/generatorprofile.h @@ -3686,13 +3686,10 @@ class LIBCELLML_EXPORT GeneratorProfile * * @param forDifferentialModel Whether the interface to initialise variables * is for a differential model, as opposed to an algebraic model. - * @param withExternalVariables Whether the interface to initialise - * variables is for a model with external variables. * * @return The @c std::string for the interface to initialise variables. */ - std::string interfaceInitialiseVariablesMethodString(bool forDifferentialModel, - bool withExternalVariables) const; + std::string interfaceInitialiseVariablesMethodString(bool forDifferentialModel) const; /** * @brief Set the @c std::string for the interface to initialise variables. @@ -3701,13 +3698,10 @@ class LIBCELLML_EXPORT GeneratorProfile * * @param forDifferentialModel Whether the interface to initialise variables * is for a differential model, as opposed to an algebraic model. - * @param withExternalVariables Whether the interface to initialise - * variables is for a model with external variables. * @param interfaceInitialiseVariablesMethodString The @c std::string to use * for the interface to initialise variables. */ void setInterfaceInitialiseVariablesMethodString(bool forDifferentialModel, - bool withExternalVariables, const std::string &interfaceInitialiseVariablesMethodString); /** @@ -3718,14 +3712,11 @@ class LIBCELLML_EXPORT GeneratorProfile * * @param forDifferentialModel Whether the implementation to initialise * variables is for a differential model, as opposed to an algebraic model. - * @param withExternalVariables Whether the implementation to initialise - * variables is for a model with external variables. * * @return The @c std::string for the implementation to initialise * variables. */ - std::string implementationInitialiseVariablesMethodString(bool forDifferentialModel, - bool withExternalVariables) const; + std::string implementationInitialiseVariablesMethodString(bool forDifferentialModel) const; /** * @brief Set the @c std::string for the implementation to initialise @@ -3737,13 +3728,10 @@ class LIBCELLML_EXPORT GeneratorProfile * * @param forDifferentialModel Whether the implementation to initialise * variables is for a differential model, as opposed to an algebraic model. - * @param withExternalVariables Whether the implementation to initialise - * variables is for a model with external variables. * @param implementationInitialiseVariablesMethodString The @c std::string * to use for the implementation to initialise variables. */ void setImplementationInitialiseVariablesMethodString(bool forDifferentialModel, - bool withExternalVariables, const std::string &implementationInitialiseVariablesMethodString); /** diff --git a/src/generator.cpp b/src/generator.cpp index ce6cc531f2..23a46e90d8 100644 --- a/src/generator.cpp +++ b/src/generator.cpp @@ -1776,8 +1776,7 @@ std::string Generator::GeneratorImpl::generateEquationCode(const AnalyserEquatio void Generator::GeneratorImpl::addInterfaceComputeModelMethodsCode() { - auto interfaceInitialiseVariablesMethodString = mProfile->interfaceInitialiseVariablesMethodString(modelHasOdes(), - mModel->hasExternalVariables()); + auto interfaceInitialiseVariablesMethodString = mProfile->interfaceInitialiseVariablesMethodString(modelHasOdes()); std::string code; if (!interfaceInitialiseVariablesMethodString.empty()) { @@ -1811,8 +1810,7 @@ void Generator::GeneratorImpl::addInterfaceComputeModelMethodsCode() void Generator::GeneratorImpl::addImplementationInitialiseVariablesMethodCode(std::vector &remainingEquations) { - auto implementationInitialiseVariablesMethodString = mProfile->implementationInitialiseVariablesMethodString(modelHasOdes(), - mModel->hasExternalVariables()); + auto implementationInitialiseVariablesMethodString = mProfile->implementationInitialiseVariablesMethodString(modelHasOdes()); if (!implementationInitialiseVariablesMethodString.empty()) { // Initialise our states. @@ -1876,22 +1874,6 @@ void Generator::GeneratorImpl::addImplementationInitialiseVariablesMethodCode(st } } - // Initialise our external variables. - - if (mModel->hasExternalVariables()) { - std::vector remainingExternalEquations; - - std::copy_if(equations.begin(), equations.end(), - std::back_inserter(remainingExternalEquations), - [](const AnalyserEquationPtr &equation) { return equation->type() == AnalyserEquation::Type::EXTERNAL; }); - - for (const auto &equation : equations) { - if (equation->type() == AnalyserEquation::Type::EXTERNAL) { - methodBody += generateEquationCode(equation, remainingExternalEquations); - } - } - } - mCode += newLineIfNeeded() + replace(implementationInitialiseVariablesMethodString, "[CODE]", generateMethodBodyCode(methodBody)); diff --git a/src/generatorprofile.cpp b/src/generatorprofile.cpp index bc191920b7..8de812817c 100644 --- a/src/generatorprofile.cpp +++ b/src/generatorprofile.cpp @@ -409,29 +409,17 @@ void GeneratorProfile::GeneratorProfileImpl::loadProfile(GeneratorProfile::Profi " free(array);\n" "}\n"; - mInterfaceInitialiseVariablesMethodFamWoevString = "void initialiseVariables(double *constants, double *algebraic);\n"; - mImplementationInitialiseVariablesMethodFamWoevString = "void initialiseVariables(double *constants, double *algebraic)\n" - "{\n" - "[CODE]" - "}\n"; - - mInterfaceInitialiseVariablesMethodFamWevString = "void initialiseVariables(double *constants, double *algebraic, ExternalVariable externalVariable);\n"; - mImplementationInitialiseVariablesMethodFamWevString = "void initialiseVariables(double *constants, double *algebraic, ExternalVariable externalVariable)\n" - "{\n" - "[CODE]" - "}\n"; - - mInterfaceInitialiseVariablesMethodFdmWoevString = "void initialiseVariables(double *states, double *rates, double *constants, double *algebraic);\n"; - mImplementationInitialiseVariablesMethodFdmWoevString = "void initialiseVariables(double *states, double *rates, double *constants, double *algebraic)\n" - "{\n" - "[CODE]" - "}\n"; - - mInterfaceInitialiseVariablesMethodFdmWevString = "void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic, ExternalVariable externalVariable);\n"; - mImplementationInitialiseVariablesMethodFdmWevString = "void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic, ExternalVariable externalVariable)\n" - "{\n" - "[CODE]" - "}\n"; + mInterfaceInitialiseVariablesMethodFamString = "void initialiseVariables(double *constants, double *algebraic);\n"; + mImplementationInitialiseVariablesMethodFamString = "void initialiseVariables(double *constants, double *algebraic)\n" + "{\n" + "[CODE]" + "}\n"; + + mInterfaceInitialiseVariablesMethodFdmString = "void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic);\n"; + mImplementationInitialiseVariablesMethodFdmString = "void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic)\n" + "{\n" + "[CODE]" + "}\n"; mInterfaceComputeComputedConstantsMethodString = "void computeComputedConstants(double *constants, double *computedConstants);\n"; mImplementationComputeComputedConstantsMethodString = "void computeComputedConstants(double *constants, double *computedConstants)\n" @@ -812,25 +800,15 @@ void GeneratorProfile::GeneratorProfileImpl::loadProfile(GeneratorProfile::Profi mInterfaceDeleteArrayMethodString = ""; mImplementationDeleteArrayMethodString = ""; - mInterfaceInitialiseVariablesMethodFamWoevString = ""; - mImplementationInitialiseVariablesMethodFamWoevString = "\n" - "def initialise_variables(constants, algebraic):\n" - "[CODE]"; - - mInterfaceInitialiseVariablesMethodFamWevString = ""; - mImplementationInitialiseVariablesMethodFamWevString = "\n" - "def initialise_variables(constants, algebraic, external_variable):\n" - "[CODE]"; - - mInterfaceInitialiseVariablesMethodFdmWoevString = ""; - mImplementationInitialiseVariablesMethodFdmWoevString = "\n" - "def initialise_variables(states, rates, constants, algebraic):\n" - "[CODE]"; + mInterfaceInitialiseVariablesMethodFamString = ""; + mImplementationInitialiseVariablesMethodFamString = "\n" + "def initialise_variables(constants, algebraic):\n" + "[CODE]"; - mInterfaceInitialiseVariablesMethodFdmWevString = ""; - mImplementationInitialiseVariablesMethodFdmWevString = "\n" - "def initialise_variables(voi, states, rates, constants, algebraic, external_variable):\n" - "[CODE]"; + mInterfaceInitialiseVariablesMethodFdmString = ""; + mImplementationInitialiseVariablesMethodFdmString = "\n" + "def initialise_variables(voi, states, rates, constants, algebraic):\n" + "[CODE]"; mInterfaceComputeComputedConstantsMethodString = ""; mImplementationComputeComputedConstantsMethodString = "\n" @@ -2583,77 +2561,41 @@ void GeneratorProfile::setImplementationDeleteArrayMethodString(const std::strin mPimpl->mImplementationDeleteArrayMethodString = implementationDeleteArrayMethodString; } -std::string GeneratorProfile::interfaceInitialiseVariablesMethodString(bool forDifferentialModel, - bool withExternalVariables) const +std::string GeneratorProfile::interfaceInitialiseVariablesMethodString(bool forDifferentialModel) const { if (forDifferentialModel) { - if (withExternalVariables) { - return mPimpl->mInterfaceInitialiseVariablesMethodFdmWevString; - } - - return mPimpl->mInterfaceInitialiseVariablesMethodFdmWoevString; + return mPimpl->mInterfaceInitialiseVariablesMethodFdmString; } - if (withExternalVariables) { - return mPimpl->mInterfaceInitialiseVariablesMethodFamWevString; - } - - return mPimpl->mInterfaceInitialiseVariablesMethodFamWoevString; + return mPimpl->mInterfaceInitialiseVariablesMethodFamString; } void GeneratorProfile::setInterfaceInitialiseVariablesMethodString(bool forDifferentialModel, - bool withExternalVariables, const std::string &interfaceInitialiseVariablesMethodString) { if (forDifferentialModel) { - if (withExternalVariables) { - mPimpl->mInterfaceInitialiseVariablesMethodFdmWevString = interfaceInitialiseVariablesMethodString; - } else { - mPimpl->mInterfaceInitialiseVariablesMethodFdmWoevString = interfaceInitialiseVariablesMethodString; - } + mPimpl->mInterfaceInitialiseVariablesMethodFdmString = interfaceInitialiseVariablesMethodString; } else { - if (withExternalVariables) { - mPimpl->mInterfaceInitialiseVariablesMethodFamWevString = interfaceInitialiseVariablesMethodString; - } else { - mPimpl->mInterfaceInitialiseVariablesMethodFamWoevString = interfaceInitialiseVariablesMethodString; - } + mPimpl->mInterfaceInitialiseVariablesMethodFamString = interfaceInitialiseVariablesMethodString; } } -std::string GeneratorProfile::implementationInitialiseVariablesMethodString(bool forDifferentialModel, - bool withExternalVariables) const +std::string GeneratorProfile::implementationInitialiseVariablesMethodString(bool forDifferentialModel) const { if (forDifferentialModel) { - if (withExternalVariables) { - return mPimpl->mImplementationInitialiseVariablesMethodFdmWevString; - } - - return mPimpl->mImplementationInitialiseVariablesMethodFdmWoevString; + return mPimpl->mImplementationInitialiseVariablesMethodFdmString; } - if (withExternalVariables) { - return mPimpl->mImplementationInitialiseVariablesMethodFamWevString; - } - - return mPimpl->mImplementationInitialiseVariablesMethodFamWoevString; + return mPimpl->mImplementationInitialiseVariablesMethodFamString; } void GeneratorProfile::setImplementationInitialiseVariablesMethodString(bool forDifferentialModel, - bool withExternalVariables, const std::string &implementationInitialiseVariablesMethodString) { if (forDifferentialModel) { - if (withExternalVariables) { - mPimpl->mImplementationInitialiseVariablesMethodFdmWevString = implementationInitialiseVariablesMethodString; - } else { - mPimpl->mImplementationInitialiseVariablesMethodFdmWoevString = implementationInitialiseVariablesMethodString; - } + mPimpl->mImplementationInitialiseVariablesMethodFdmString = implementationInitialiseVariablesMethodString; } else { - if (withExternalVariables) { - mPimpl->mImplementationInitialiseVariablesMethodFamWevString = implementationInitialiseVariablesMethodString; - } else { - mPimpl->mImplementationInitialiseVariablesMethodFamWoevString = implementationInitialiseVariablesMethodString; - } + mPimpl->mImplementationInitialiseVariablesMethodFamString = implementationInitialiseVariablesMethodString; } } diff --git a/src/generatorprofile_p.h b/src/generatorprofile_p.h index 167f8ab236..5ab7bb5a7b 100644 --- a/src/generatorprofile_p.h +++ b/src/generatorprofile_p.h @@ -257,17 +257,11 @@ struct GeneratorProfile::GeneratorProfileImpl std::string mInterfaceDeleteArrayMethodString; std::string mImplementationDeleteArrayMethodString; - std::string mInterfaceInitialiseVariablesMethodFamWoevString; - std::string mImplementationInitialiseVariablesMethodFamWoevString; + std::string mInterfaceInitialiseVariablesMethodFamString; + std::string mImplementationInitialiseVariablesMethodFamString; - std::string mInterfaceInitialiseVariablesMethodFamWevString; - std::string mImplementationInitialiseVariablesMethodFamWevString; - - std::string mInterfaceInitialiseVariablesMethodFdmWoevString; - std::string mImplementationInitialiseVariablesMethodFdmWoevString; - - std::string mInterfaceInitialiseVariablesMethodFdmWevString; - std::string mImplementationInitialiseVariablesMethodFdmWevString; + std::string mInterfaceInitialiseVariablesMethodFdmString; + std::string mImplementationInitialiseVariablesMethodFdmString; std::string mInterfaceComputeComputedConstantsMethodString; std::string mImplementationComputeComputedConstantsMethodString; diff --git a/src/generatorprofilesha1values.h b/src/generatorprofilesha1values.h index c96cffaf20..dacc0b264f 100644 --- a/src/generatorprofilesha1values.h +++ b/src/generatorprofilesha1values.h @@ -24,7 +24,7 @@ namespace libcellml { * The content of this file is generated, do not edit this file directly. * See docs/dev_utilities.rst for further information. */ -static const char C_GENERATOR_PROFILE_SHA1[] = "54ee603459d7878ee469890e77de4f3dbb5452ad"; -static const char PYTHON_GENERATOR_PROFILE_SHA1[] = "bf42c06955e401096d76d059a28ed1a5cb1ccc01"; +static const char C_GENERATOR_PROFILE_SHA1[] = "323f0e5824d5c794c28f34dda5e7410efc836e62"; +static const char PYTHON_GENERATOR_PROFILE_SHA1[] = "3f6672212636b5179b23b9664cead525f54f665f"; } // namespace libcellml diff --git a/src/generatorprofiletools.cpp b/src/generatorprofiletools.cpp index 5fa6093923..d68bb59bc5 100644 --- a/src/generatorprofiletools.cpp +++ b/src/generatorprofiletools.cpp @@ -523,17 +523,11 @@ std::string generatorProfileAsString(const GeneratorProfilePtr &generatorProfile profileContents += generatorProfile->interfaceDeleteArrayMethodString() + generatorProfile->implementationDeleteArrayMethodString(); - profileContents += generatorProfile->interfaceInitialiseVariablesMethodString(false, false) - + generatorProfile->implementationInitialiseVariablesMethodString(false, false); + profileContents += generatorProfile->interfaceInitialiseVariablesMethodString(false) + + generatorProfile->implementationInitialiseVariablesMethodString(false); - profileContents += generatorProfile->interfaceInitialiseVariablesMethodString(false, true) - + generatorProfile->implementationInitialiseVariablesMethodString(false, true); - - profileContents += generatorProfile->interfaceInitialiseVariablesMethodString(true, false) - + generatorProfile->implementationInitialiseVariablesMethodString(true, false); - - profileContents += generatorProfile->interfaceInitialiseVariablesMethodString(true, true) - + generatorProfile->implementationInitialiseVariablesMethodString(true, true); + profileContents += generatorProfile->interfaceInitialiseVariablesMethodString(true) + + generatorProfile->implementationInitialiseVariablesMethodString(true); profileContents += generatorProfile->interfaceComputeComputedConstantsMethodString() + generatorProfile->implementationComputeComputedConstantsMethodString(); diff --git a/tests/bindings/javascript/generatorprofile.test.js b/tests/bindings/javascript/generatorprofile.test.js index e1f63eee41..7d1a1cc841 100644 --- a/tests/bindings/javascript/generatorprofile.test.js +++ b/tests/bindings/javascript/generatorprofile.test.js @@ -1014,32 +1014,20 @@ describe("GeneratorProfile tests", () => { test("Checking GeneratorProfile.interfaceInitialiseVariablesMethodString.", () => { const x = new libcellml.GeneratorProfile(libcellml.GeneratorProfile.Profile.C) - x.setInterfaceInitialiseVariablesMethodString(false, false, "something") - expect(x.interfaceInitialiseVariablesMethodString(false, false)).toBe("something") + x.setInterfaceInitialiseVariablesMethodString(false, "something") + expect(x.interfaceInitialiseVariablesMethodString(false)).toBe("something") - x.setInterfaceInitialiseVariablesMethodString(false, true, "something") - expect(x.interfaceInitialiseVariablesMethodString(false, true)).toBe("something") - - x.setInterfaceInitialiseVariablesMethodString(true, false, "something") - expect(x.interfaceInitialiseVariablesMethodString(true, false)).toBe("something") - - x.setInterfaceInitialiseVariablesMethodString(true, true, "something") - expect(x.interfaceInitialiseVariablesMethodString(true, true)).toBe("something") + x.setInterfaceInitialiseVariablesMethodString(true, "something") + expect(x.interfaceInitialiseVariablesMethodString(true)).toBe("something") }); test("Checking GeneratorProfile.implementationInitialiseVariablesMethodString.", () => { const x = new libcellml.GeneratorProfile(libcellml.GeneratorProfile.Profile.C) - x.setImplementationInitialiseVariablesMethodString(false, false, "something") - expect(x.implementationInitialiseVariablesMethodString(false, false)).toBe("something") - - x.setImplementationInitialiseVariablesMethodString(false, true, "something") - expect(x.implementationInitialiseVariablesMethodString(false, true)).toBe("something") - - x.setImplementationInitialiseVariablesMethodString(true, false, "something") - expect(x.implementationInitialiseVariablesMethodString(true, false)).toBe("something") + x.setImplementationInitialiseVariablesMethodString(false, "something") + expect(x.implementationInitialiseVariablesMethodString(false)).toBe("something") - x.setImplementationInitialiseVariablesMethodString(true, true, "something") - expect(x.implementationInitialiseVariablesMethodString(true, true)).toBe("something") + x.setImplementationInitialiseVariablesMethodString(true, "something") + expect(x.implementationInitialiseVariablesMethodString(true)).toBe("something") }); test("Checking GeneratorProfile.interfaceComputeComputedConstantsMethodString.", () => { const x = new libcellml.GeneratorProfile(libcellml.GeneratorProfile.Profile.C) diff --git a/tests/bindings/python/test_generator_profile.py b/tests/bindings/python/test_generator_profile.py index 51d67a7239..c030ba9c8b 100644 --- a/tests/bindings/python/test_generator_profile.py +++ b/tests/bindings/python/test_generator_profile.py @@ -839,24 +839,14 @@ def test_implementation_initialise_constants_method_string(self): g = GeneratorProfile() self.assertEqual('void initialiseVariables(double *constants, double *algebraic)\n{\n[CODE]}\n', - g.implementationInitialiseVariablesMethodString(False, False)) - g.setImplementationInitialiseVariablesMethodString(False, False, GeneratorProfileTestCase.VALUE) - self.assertEqual(GeneratorProfileTestCase.VALUE, g.implementationInitialiseVariablesMethodString(False, False)) + g.implementationInitialiseVariablesMethodString(False)) + g.setImplementationInitialiseVariablesMethodString(False, GeneratorProfileTestCase.VALUE) + self.assertEqual(GeneratorProfileTestCase.VALUE, g.implementationInitialiseVariablesMethodString(False)) - self.assertEqual('void initialiseVariables(double *constants, double *algebraic, ExternalVariable externalVariable)\n{\n[CODE]}\n', - g.implementationInitialiseVariablesMethodString(False, True)) - g.setImplementationInitialiseVariablesMethodString(False, True, GeneratorProfileTestCase.VALUE) - self.assertEqual(GeneratorProfileTestCase.VALUE, g.implementationInitialiseVariablesMethodString(False, True)) - - self.assertEqual('void initialiseVariables(double *states, double *rates, double *constants, double *algebraic)\n{\n[CODE]}\n', - g.implementationInitialiseVariablesMethodString(True, False)) - g.setImplementationInitialiseVariablesMethodString(True, False, GeneratorProfileTestCase.VALUE) - self.assertEqual(GeneratorProfileTestCase.VALUE, g.implementationInitialiseVariablesMethodString(True, False)) - - self.assertEqual('void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic, ExternalVariable externalVariable)\n{\n[CODE]}\n', - g.implementationInitialiseVariablesMethodString(True, True)) - g.setImplementationInitialiseVariablesMethodString(True, True, GeneratorProfileTestCase.VALUE) - self.assertEqual(GeneratorProfileTestCase.VALUE, g.implementationInitialiseVariablesMethodString(True, True)) + self.assertEqual('void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic)\n{\n[CODE]}\n', + g.implementationInitialiseVariablesMethodString(True)) + g.setImplementationInitialiseVariablesMethodString(True, GeneratorProfileTestCase.VALUE) + self.assertEqual(GeneratorProfileTestCase.VALUE, g.implementationInitialiseVariablesMethodString(True)) def test_implementation_libcellml_version_string(self): from libcellml import GeneratorProfile @@ -1128,24 +1118,14 @@ def test_interface_initialise_constants_method_string(self): g = GeneratorProfile() self.assertEqual('void initialiseVariables(double *constants, double *algebraic);\n', - g.interfaceInitialiseVariablesMethodString(False, False)) - g.setInterfaceInitialiseVariablesMethodString(False, False, GeneratorProfileTestCase.VALUE) - self.assertEqual(GeneratorProfileTestCase.VALUE, g.interfaceInitialiseVariablesMethodString(False, False)) - - self.assertEqual('void initialiseVariables(double *constants, double *algebraic, ExternalVariable externalVariable);\n', - g.interfaceInitialiseVariablesMethodString(False, True)) - g.setInterfaceInitialiseVariablesMethodString(False, True, GeneratorProfileTestCase.VALUE) - self.assertEqual(GeneratorProfileTestCase.VALUE, g.interfaceInitialiseVariablesMethodString(False, True)) - - self.assertEqual('void initialiseVariables(double *states, double *rates, double *constants, double *algebraic);\n', - g.interfaceInitialiseVariablesMethodString(True, False)) - g.setInterfaceInitialiseVariablesMethodString(True, False, GeneratorProfileTestCase.VALUE) - self.assertEqual(GeneratorProfileTestCase.VALUE, g.interfaceInitialiseVariablesMethodString(True, False)) - - self.assertEqual('void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic, ExternalVariable externalVariable);\n', - g.interfaceInitialiseVariablesMethodString(True, True)) - g.setInterfaceInitialiseVariablesMethodString(True, True, GeneratorProfileTestCase.VALUE) - self.assertEqual(GeneratorProfileTestCase.VALUE, g.interfaceInitialiseVariablesMethodString(True, True)) + g.interfaceInitialiseVariablesMethodString(False)) + g.setInterfaceInitialiseVariablesMethodString(False, GeneratorProfileTestCase.VALUE) + self.assertEqual(GeneratorProfileTestCase.VALUE, g.interfaceInitialiseVariablesMethodString(False)) + + self.assertEqual('void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic);\n', + g.interfaceInitialiseVariablesMethodString(True)) + g.setInterfaceInitialiseVariablesMethodString(True, GeneratorProfileTestCase.VALUE) + self.assertEqual(GeneratorProfileTestCase.VALUE, g.interfaceInitialiseVariablesMethodString(True)) def test_interface_libcellml_version_string(self): from libcellml import GeneratorProfile diff --git a/tests/coverage/coverage.cpp b/tests/coverage/coverage.cpp index 097dcdaccd..cd9654184a 100644 --- a/tests/coverage/coverage.cpp +++ b/tests/coverage/coverage.cpp @@ -875,7 +875,6 @@ TEST(Coverage, generator) profile->setImplementationComputeComputedConstantsMethodString(""); profile->setImplementationComputeRatesMethodString(true, ""); profile->setImplementationHeaderString("[INTERFACE_FILE_NAME]"); - profile->setImplementationInitialiseVariablesMethodString(true, true, ""); profile->setInterfaceFileNameString(""); profile->setInterfaceHeaderString(""); profile->setMaxFunctionString(""); diff --git a/tests/generator/generatorprofile.cpp b/tests/generator/generatorprofile.cpp index aa91c910aa..155af5a07e 100644 --- a/tests/generator/generatorprofile.cpp +++ b/tests/generator/generatorprofile.cpp @@ -487,36 +487,20 @@ TEST(GeneratorProfile, defaultMiscellaneousValues) generatorProfile->implementationDeleteArrayMethodString()); EXPECT_EQ("void initialiseVariables(double *constants, double *algebraic);\n", - generatorProfile->interfaceInitialiseVariablesMethodString(false, false)); + generatorProfile->interfaceInitialiseVariablesMethodString(false)); EXPECT_EQ("void initialiseVariables(double *constants, double *algebraic)\n" "{\n" "[CODE]" "}\n", - generatorProfile->implementationInitialiseVariablesMethodString(false, false)); + generatorProfile->implementationInitialiseVariablesMethodString(false)); - EXPECT_EQ("void initialiseVariables(double *constants, double *algebraic, ExternalVariable externalVariable);\n", - generatorProfile->interfaceInitialiseVariablesMethodString(false, true)); - EXPECT_EQ("void initialiseVariables(double *constants, double *algebraic, ExternalVariable externalVariable)\n" + EXPECT_EQ("void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic);\n", + generatorProfile->interfaceInitialiseVariablesMethodString(true)); + EXPECT_EQ("void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic)\n" "{\n" "[CODE]" "}\n", - generatorProfile->implementationInitialiseVariablesMethodString(false, true)); - - EXPECT_EQ("void initialiseVariables(double *states, double *rates, double *constants, double *algebraic);\n", - generatorProfile->interfaceInitialiseVariablesMethodString(true, false)); - EXPECT_EQ("void initialiseVariables(double *states, double *rates, double *constants, double *algebraic)\n" - "{\n" - "[CODE]" - "}\n", - generatorProfile->implementationInitialiseVariablesMethodString(true, false)); - - EXPECT_EQ("void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic, ExternalVariable externalVariable);\n", - generatorProfile->interfaceInitialiseVariablesMethodString(true, true)); - EXPECT_EQ("void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic, ExternalVariable externalVariable)\n" - "{\n" - "[CODE]" - "}\n", - generatorProfile->implementationInitialiseVariablesMethodString(true, true)); + generatorProfile->implementationInitialiseVariablesMethodString(true)); EXPECT_EQ("void computeComputedConstants(double *constants, double *computedConstants);\n", generatorProfile->interfaceComputeComputedConstantsMethodString()); @@ -979,17 +963,11 @@ TEST(GeneratorProfile, miscellaneous) generatorProfile->setInterfaceDeleteArrayMethodString(value); generatorProfile->setImplementationDeleteArrayMethodString(value); - generatorProfile->setInterfaceInitialiseVariablesMethodString(false, false, value); - generatorProfile->setImplementationInitialiseVariablesMethodString(false, false, value); - - generatorProfile->setInterfaceInitialiseVariablesMethodString(false, true, value); - generatorProfile->setImplementationInitialiseVariablesMethodString(false, true, value); + generatorProfile->setInterfaceInitialiseVariablesMethodString(false, value); + generatorProfile->setImplementationInitialiseVariablesMethodString(false, value); - generatorProfile->setInterfaceInitialiseVariablesMethodString(true, false, value); - generatorProfile->setImplementationInitialiseVariablesMethodString(true, false, value); - - generatorProfile->setInterfaceInitialiseVariablesMethodString(true, true, value); - generatorProfile->setImplementationInitialiseVariablesMethodString(true, true, value); + generatorProfile->setInterfaceInitialiseVariablesMethodString(true, value); + generatorProfile->setImplementationInitialiseVariablesMethodString(true, value); generatorProfile->setInterfaceComputeComputedConstantsMethodString(value); generatorProfile->setImplementationComputeComputedConstantsMethodString(value); @@ -1126,17 +1104,11 @@ TEST(GeneratorProfile, miscellaneous) EXPECT_EQ(value, generatorProfile->interfaceDeleteArrayMethodString()); EXPECT_EQ(value, generatorProfile->implementationDeleteArrayMethodString()); - EXPECT_EQ(value, generatorProfile->interfaceInitialiseVariablesMethodString(false, false)); - EXPECT_EQ(value, generatorProfile->implementationInitialiseVariablesMethodString(false, false)); - - EXPECT_EQ(value, generatorProfile->interfaceInitialiseVariablesMethodString(false, true)); - EXPECT_EQ(value, generatorProfile->implementationInitialiseVariablesMethodString(false, true)); - - EXPECT_EQ(value, generatorProfile->interfaceInitialiseVariablesMethodString(true, false)); - EXPECT_EQ(value, generatorProfile->implementationInitialiseVariablesMethodString(true, false)); + EXPECT_EQ(value, generatorProfile->interfaceInitialiseVariablesMethodString(false)); + EXPECT_EQ(value, generatorProfile->implementationInitialiseVariablesMethodString(false)); - EXPECT_EQ(value, generatorProfile->interfaceInitialiseVariablesMethodString(true, true)); - EXPECT_EQ(value, generatorProfile->implementationInitialiseVariablesMethodString(true, true)); + EXPECT_EQ(value, generatorProfile->interfaceInitialiseVariablesMethodString(true)); + EXPECT_EQ(value, generatorProfile->implementationInitialiseVariablesMethodString(true)); EXPECT_EQ(value, generatorProfile->interfaceComputeComputedConstantsMethodString()); EXPECT_EQ(value, generatorProfile->implementationComputeComputedConstantsMethodString()); diff --git a/tests/resources/coverage/generator/model.c b/tests/resources/coverage/generator/model.c index 8ba9f8fd41..72b66e639a 100644 --- a/tests/resources/coverage/generator/model.c +++ b/tests/resources/coverage/generator/model.c @@ -405,7 +405,7 @@ void findRoot0(double voi, double *states, double *rates, double *variables) algebraic[1] = u[1]; } -void initialiseVariables(double *states, double *rates, double *constants, double *algebraic) +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic) { states[0] = 0.0; constants[0] = 1.0; diff --git a/tests/resources/coverage/generator/model.h b/tests/resources/coverage/generator/model.h index f41310108d..5d9a4cbdc0 100644 --- a/tests/resources/coverage/generator/model.h +++ b/tests/resources/coverage/generator/model.h @@ -31,7 +31,7 @@ double * createAlgebraicArray(); void deleteArray(double *array); -void initialiseVariables(double *states, double *rates, double *constants, double *algebraic); +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/coverage/generator/model.implementation.out b/tests/resources/coverage/generator/model.implementation.out index 4e3c752330..9879365ae9 100644 --- a/tests/resources/coverage/generator/model.implementation.out +++ b/tests/resources/coverage/generator/model.implementation.out @@ -168,7 +168,7 @@ void findRoot0(double voi, double *states, double *rates, double *variables) algebraic[1] = u[1]; } -void initialiseVariables(double *states, double *rates, double *constants, double *algebraic) +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic) { states[0] = 0.0; constants[0] = 1.0; diff --git a/tests/resources/coverage/generator/model.interface.out b/tests/resources/coverage/generator/model.interface.out index bd773bffa8..5fa121175b 100644 --- a/tests/resources/coverage/generator/model.interface.out +++ b/tests/resources/coverage/generator/model.interface.out @@ -11,7 +11,7 @@ double * createAlgebraicArray(); void deleteArray(double *array); -void initialiseVariables(double *states, double *rates, double *constants, double *algebraic); +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/coverage/generator/model.modified.profile.c b/tests/resources/coverage/generator/model.modified.profile.c index 32e5b78d5b..4d98fe81bd 100644 --- a/tests/resources/coverage/generator/model.modified.profile.c +++ b/tests/resources/coverage/generator/model.modified.profile.c @@ -405,7 +405,7 @@ void findRoot0(double voi, double *states, double *rates, double *variables) algebraic[1] = u[1]; } -void initialiseVariables(double *states, double *rates, double *constants, double *algebraic) +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic) { states[0] = 0.0; constants[0] = 1.0; diff --git a/tests/resources/coverage/generator/model.modified.profile.h b/tests/resources/coverage/generator/model.modified.profile.h index 482f4f6c31..99e4b49f12 100644 --- a/tests/resources/coverage/generator/model.modified.profile.h +++ b/tests/resources/coverage/generator/model.modified.profile.h @@ -31,7 +31,7 @@ double * createAlgebraicArray(); void deleteArray(double *array); -void initialiseVariables(double *states, double *rates, double *constants, double *algebraic); +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/coverage/generator/model.modified.profile.py b/tests/resources/coverage/generator/model.modified.profile.py index 5c5e36cbd6..eb7f0514f0 100644 --- a/tests/resources/coverage/generator/model.modified.profile.py +++ b/tests/resources/coverage/generator/model.modified.profile.py @@ -383,7 +383,7 @@ def find_root_0(voi, states, rates, variables): algebraic[1] = u[1] -def initialise_variables(states, rates, constants, algebraic): +def initialise_variables(voi, states, rates, constants, algebraic): states[0] = 0.0 constants[0] = 1.0 constants[1] = 2.0 diff --git a/tests/resources/coverage/generator/model.out b/tests/resources/coverage/generator/model.out index 63ed9abc24..d57486a8d2 100644 --- a/tests/resources/coverage/generator/model.out +++ b/tests/resources/coverage/generator/model.out @@ -116,7 +116,7 @@ void findRoot0(double voi, double *states, double *rates, double *variables) algebraic[1] = u[1]; } -void initialiseVariables(double *states, double *rates, double *constants, double *algebraic) +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic) { states[0] = 0.0; constants[0] = 1.0; diff --git a/tests/resources/coverage/generator/model.py b/tests/resources/coverage/generator/model.py index b36dad8dea..8f5da46a7f 100644 --- a/tests/resources/coverage/generator/model.py +++ b/tests/resources/coverage/generator/model.py @@ -383,7 +383,7 @@ def find_root_0(voi, states, rates, variables): algebraic[1] = u[1] -def initialise_variables(states, rates, constants, algebraic): +def initialise_variables(voi, states, rates, constants, algebraic): states[0] = 0.0 constants[0] = 1.0 constants[1] = 2.0 diff --git a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.c b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.c index 9dc5931425..cae10b971b 100644 --- a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.c +++ b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.c @@ -76,9 +76,8 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double *constants, double *algebraic, ExternalVariable externalVariable) +void initialiseVariables(double *constants, double *algebraic) { - external[1] = externalVariable(variables, 1); } void computeComputedConstants(double *constants, double *computedConstants) diff --git a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.h b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.h index 3aea6ecead..96a917b0ad 100644 --- a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.h +++ b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.h @@ -32,6 +32,6 @@ void deleteArray(double *array); typedef double (* ExternalVariable)(double *variables, size_t index); -void initialiseVariables(double *constants, double *algebraic, ExternalVariable externalVariable); +void initialiseVariables(double *constants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeVariables(double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); diff --git a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.py b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.py index 56bde48d88..293eda06d1 100644 --- a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.py +++ b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.py @@ -43,8 +43,8 @@ def create_externals_array(): return [nan]*EXTERNAL_COUNT -def initialise_variables(constants, algebraic, external_variable): - external[1] = external_variable(variables, 1) +def initialise_variables(constants, algebraic): + pass def compute_computed_constants(constants, computed_constants): diff --git a/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.c b/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.c index 8050184e0f..014cbdc35b 100644 --- a/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.c +++ b/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.c @@ -79,7 +79,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double *states, double *rates, double *constants, double *algebraic) +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic) { states[0] = 1.0; } diff --git a/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.h b/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.h index a78dbb906d..fe567bfd63 100644 --- a/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.h +++ b/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.h @@ -31,7 +31,7 @@ double * createAlgebraicArray(); void deleteArray(double *array); -void initialiseVariables(double *states, double *rates, double *constants, double *algebraic); +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.py b/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.py index 0da204aecf..c82c2e8618 100644 --- a/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.py +++ b/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.py @@ -46,7 +46,7 @@ def create_algebraic_array(): return [nan]*ALGEBRAIC_COUNT -def initialise_variables(states, rates, constants, algebraic): +def initialise_variables(voi, states, rates, constants, algebraic): states[0] = 1.0 diff --git a/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.c b/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.c index 37466c2814..c87a0e1ce4 100644 --- a/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.c +++ b/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.c @@ -79,7 +79,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double *states, double *rates, double *constants, double *algebraic) +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic) { states[0] = 1.0; } diff --git a/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.h b/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.h index e05d298461..d2fac6dd07 100644 --- a/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.h +++ b/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.h @@ -31,7 +31,7 @@ double * createAlgebraicArray(); void deleteArray(double *array); -void initialiseVariables(double *states, double *rates, double *constants, double *algebraic); +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.py b/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.py index ffb5d2a000..427ddf5b9d 100644 --- a/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.py +++ b/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.py @@ -46,7 +46,7 @@ def create_algebraic_array(): return [nan]*ALGEBRAIC_COUNT -def initialise_variables(states, rates, constants, algebraic): +def initialise_variables(voi, states, rates, constants, algebraic): states[0] = 1.0 diff --git a/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.c b/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.c index 9c9f2695d7..92edb52552 100644 --- a/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.c +++ b/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.c @@ -79,7 +79,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double *states, double *rates, double *constants, double *algebraic) +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic) { states[0] = 1.0; } diff --git a/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.h b/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.h index ba0e44b676..57b67a4db1 100644 --- a/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.h +++ b/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.h @@ -31,7 +31,7 @@ double * createAlgebraicArray(); void deleteArray(double *array); -void initialiseVariables(double *states, double *rates, double *constants, double *algebraic); +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.py b/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.py index 1c3a92bcd3..a2c96535a6 100644 --- a/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.py +++ b/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.py @@ -46,7 +46,7 @@ def create_algebraic_array(): return [nan]*ALGEBRAIC_COUNT -def initialise_variables(states, rates, constants, algebraic): +def initialise_variables(voi, states, rates, constants, algebraic): states[0] = 1.0 diff --git a/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.c b/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.c index f8e0f2101e..7e852f4e1d 100644 --- a/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.c +++ b/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.c @@ -79,7 +79,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double *states, double *rates, double *constants, double *algebraic) +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic) { states[0] = 1.0; } diff --git a/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.h b/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.h index a33a6c6009..2cb538a2f7 100644 --- a/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.h +++ b/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.h @@ -31,7 +31,7 @@ double * createAlgebraicArray(); void deleteArray(double *array); -void initialiseVariables(double *states, double *rates, double *constants, double *algebraic); +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.py b/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.py index e1d0ff1171..a16626a8f9 100644 --- a/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.py +++ b/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.py @@ -46,7 +46,7 @@ def create_algebraic_array(): return [nan]*ALGEBRAIC_COUNT -def initialise_variables(states, rates, constants, algebraic): +def initialise_variables(voi, states, rates, constants, algebraic): states[0] = 1.0 diff --git a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.c b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.c index fcf0650ffd..2d502bbe6e 100644 --- a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.c +++ b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.c @@ -78,9 +78,8 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double *constants, double *algebraic, ExternalVariable externalVariable) +void initialiseVariables(double *constants, double *algebraic) { - external[0] = externalVariable(variables, 0); } void computeComputedConstants(double *constants, double *computedConstants) diff --git a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.h b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.h index 3aea6ecead..96a917b0ad 100644 --- a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.h +++ b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.h @@ -32,6 +32,6 @@ void deleteArray(double *array); typedef double (* ExternalVariable)(double *variables, size_t index); -void initialiseVariables(double *constants, double *algebraic, ExternalVariable externalVariable); +void initialiseVariables(double *constants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeVariables(double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); diff --git a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.py b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.py index c55a3656bd..67217abb1b 100644 --- a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.py +++ b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.py @@ -45,8 +45,8 @@ def create_externals_array(): return [nan]*EXTERNAL_COUNT -def initialise_variables(constants, algebraic, external_variable): - external[0] = external_variable(variables, 0) +def initialise_variables(constants, algebraic): + pass def compute_computed_constants(constants, computed_constants): diff --git a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.c b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.c index 1a1de087c7..620fc55239 100644 --- a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.c +++ b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.c @@ -77,11 +77,8 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double *constants, double *algebraic, ExternalVariable externalVariable) +void initialiseVariables(double *constants, double *algebraic) { - external[0] = externalVariable(variables, 0); - external[1] = externalVariable(variables, 1); - external[2] = externalVariable(variables, 2); } void computeComputedConstants(double *constants, double *computedConstants) diff --git a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.h b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.h index ec5b81c772..63c13e639f 100644 --- a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.h +++ b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.h @@ -32,6 +32,6 @@ void deleteArray(double *array); typedef double (* ExternalVariable)(double *variables, size_t index); -void initialiseVariables(double *constants, double *algebraic, ExternalVariable externalVariable); +void initialiseVariables(double *constants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeVariables(double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); diff --git a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.py b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.py index f83da06d0a..1b2b68c5fa 100644 --- a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.py +++ b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.py @@ -44,10 +44,8 @@ def create_externals_array(): return [nan]*EXTERNAL_COUNT -def initialise_variables(constants, algebraic, external_variable): - external[0] = external_variable(variables, 0) - external[1] = external_variable(variables, 1) - external[2] = external_variable(variables, 2) +def initialise_variables(constants, algebraic): + pass def compute_computed_constants(constants, computed_constants): diff --git a/tests/resources/generator/cell_geometry_model/model.external.c b/tests/resources/generator/cell_geometry_model/model.external.c index 9443a62226..d20c187693 100644 --- a/tests/resources/generator/cell_geometry_model/model.external.c +++ b/tests/resources/generator/cell_geometry_model/model.external.c @@ -78,10 +78,8 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double *constants, double *algebraic, ExternalVariable externalVariable) +void initialiseVariables(double *constants, double *algebraic) { - external[1] = externalVariable(variables, 1); - external[2] = externalVariable(variables, 2); } void computeComputedConstants(double *constants, double *computedConstants) diff --git a/tests/resources/generator/cell_geometry_model/model.external.h b/tests/resources/generator/cell_geometry_model/model.external.h index c7ef02ef15..0fc34b1508 100644 --- a/tests/resources/generator/cell_geometry_model/model.external.h +++ b/tests/resources/generator/cell_geometry_model/model.external.h @@ -32,6 +32,6 @@ void deleteArray(double *array); typedef double (* ExternalVariable)(double *variables, size_t index); -void initialiseVariables(double *constants, double *algebraic, ExternalVariable externalVariable); +void initialiseVariables(double *constants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeVariables(double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); diff --git a/tests/resources/generator/cell_geometry_model/model.external.py b/tests/resources/generator/cell_geometry_model/model.external.py index 5549575c37..734dbc14ee 100644 --- a/tests/resources/generator/cell_geometry_model/model.external.py +++ b/tests/resources/generator/cell_geometry_model/model.external.py @@ -45,9 +45,8 @@ def create_externals_array(): return [nan]*EXTERNAL_COUNT -def initialise_variables(constants, algebraic, external_variable): - external[1] = external_variable(variables, 1) - external[2] = external_variable(variables, 2) +def initialise_variables(constants, algebraic): + pass def compute_computed_constants(constants, computed_constants): diff --git a/tests/resources/generator/cellml_mappings_and_encapsulations/model.c b/tests/resources/generator/cellml_mappings_and_encapsulations/model.c index 4e23c77de8..17813b55b5 100644 --- a/tests/resources/generator/cellml_mappings_and_encapsulations/model.c +++ b/tests/resources/generator/cellml_mappings_and_encapsulations/model.c @@ -80,7 +80,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double *states, double *rates, double *constants, double *algebraic) +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic) { states[0] = 1.0; states[1] = 0.0; diff --git a/tests/resources/generator/cellml_mappings_and_encapsulations/model.h b/tests/resources/generator/cellml_mappings_and_encapsulations/model.h index e55d0f0e3c..43685c5ba2 100644 --- a/tests/resources/generator/cellml_mappings_and_encapsulations/model.h +++ b/tests/resources/generator/cellml_mappings_and_encapsulations/model.h @@ -31,7 +31,7 @@ double * createAlgebraicArray(); void deleteArray(double *array); -void initialiseVariables(double *states, double *rates, double *constants, double *algebraic); +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/cellml_mappings_and_encapsulations/model.py b/tests/resources/generator/cellml_mappings_and_encapsulations/model.py index cc23dc6d18..75604f927f 100644 --- a/tests/resources/generator/cellml_mappings_and_encapsulations/model.py +++ b/tests/resources/generator/cellml_mappings_and_encapsulations/model.py @@ -47,7 +47,7 @@ def create_algebraic_array(): return [nan]*ALGEBRAIC_COUNT -def initialise_variables(states, rates, constants, algebraic): +def initialise_variables(voi, states, rates, constants, algebraic): states[0] = 1.0 states[1] = 0.0 diff --git a/tests/resources/generator/cellml_state_initialised_using_variable/model.c b/tests/resources/generator/cellml_state_initialised_using_variable/model.c index 311dad8ea8..a146b4d201 100644 --- a/tests/resources/generator/cellml_state_initialised_using_variable/model.c +++ b/tests/resources/generator/cellml_state_initialised_using_variable/model.c @@ -78,7 +78,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double *states, double *rates, double *constants, double *algebraic) +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic) { states[0] = constants[0]; constants[0] = 123.0; diff --git a/tests/resources/generator/cellml_state_initialised_using_variable/model.h b/tests/resources/generator/cellml_state_initialised_using_variable/model.h index c7fc1bb53b..ab266738e2 100644 --- a/tests/resources/generator/cellml_state_initialised_using_variable/model.h +++ b/tests/resources/generator/cellml_state_initialised_using_variable/model.h @@ -31,7 +31,7 @@ double * createAlgebraicArray(); void deleteArray(double *array); -void initialiseVariables(double *states, double *rates, double *constants, double *algebraic); +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/cellml_state_initialised_using_variable/model.py b/tests/resources/generator/cellml_state_initialised_using_variable/model.py index 7da7403e91..032002fb91 100644 --- a/tests/resources/generator/cellml_state_initialised_using_variable/model.py +++ b/tests/resources/generator/cellml_state_initialised_using_variable/model.py @@ -45,7 +45,7 @@ def create_algebraic_array(): return [nan]*ALGEBRAIC_COUNT -def initialise_variables(states, rates, constants, algebraic): +def initialise_variables(voi, states, rates, constants, algebraic): states[0] = constants[0] constants[0] = 123.0 diff --git a/tests/resources/generator/cellml_unit_scaling_rate/model.c b/tests/resources/generator/cellml_unit_scaling_rate/model.c index 053937550a..d714d284df 100644 --- a/tests/resources/generator/cellml_unit_scaling_rate/model.c +++ b/tests/resources/generator/cellml_unit_scaling_rate/model.c @@ -79,7 +79,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double *states, double *rates, double *constants, double *algebraic) +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic) { states[0] = 123.0; } diff --git a/tests/resources/generator/cellml_unit_scaling_rate/model.h b/tests/resources/generator/cellml_unit_scaling_rate/model.h index c7fc1bb53b..ab266738e2 100644 --- a/tests/resources/generator/cellml_unit_scaling_rate/model.h +++ b/tests/resources/generator/cellml_unit_scaling_rate/model.h @@ -31,7 +31,7 @@ double * createAlgebraicArray(); void deleteArray(double *array); -void initialiseVariables(double *states, double *rates, double *constants, double *algebraic); +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/cellml_unit_scaling_rate/model.py b/tests/resources/generator/cellml_unit_scaling_rate/model.py index 1e36dfbf75..8b002e8089 100644 --- a/tests/resources/generator/cellml_unit_scaling_rate/model.py +++ b/tests/resources/generator/cellml_unit_scaling_rate/model.py @@ -46,7 +46,7 @@ def create_algebraic_array(): return [nan]*ALGEBRAIC_COUNT -def initialise_variables(states, rates, constants, algebraic): +def initialise_variables(voi, states, rates, constants, algebraic): states[0] = 123.0 diff --git a/tests/resources/generator/cellml_unit_scaling_state/model.c b/tests/resources/generator/cellml_unit_scaling_state/model.c index 4ebce78ef1..b9aa6f1bc9 100644 --- a/tests/resources/generator/cellml_unit_scaling_state/model.c +++ b/tests/resources/generator/cellml_unit_scaling_state/model.c @@ -79,7 +79,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double *states, double *rates, double *constants, double *algebraic) +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic) { states[0] = 123.0; } diff --git a/tests/resources/generator/cellml_unit_scaling_state/model.h b/tests/resources/generator/cellml_unit_scaling_state/model.h index c7fc1bb53b..ab266738e2 100644 --- a/tests/resources/generator/cellml_unit_scaling_state/model.h +++ b/tests/resources/generator/cellml_unit_scaling_state/model.h @@ -31,7 +31,7 @@ double * createAlgebraicArray(); void deleteArray(double *array); -void initialiseVariables(double *states, double *rates, double *constants, double *algebraic); +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/cellml_unit_scaling_state/model.py b/tests/resources/generator/cellml_unit_scaling_state/model.py index b76901fc5b..a419ddf98f 100644 --- a/tests/resources/generator/cellml_unit_scaling_state/model.py +++ b/tests/resources/generator/cellml_unit_scaling_state/model.py @@ -46,7 +46,7 @@ def create_algebraic_array(): return [nan]*ALGEBRAIC_COUNT -def initialise_variables(states, rates, constants, algebraic): +def initialise_variables(voi, states, rates, constants, algebraic): states[0] = 123.0 diff --git a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.c b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.c index 4ae30b4c25..f98746f5c1 100644 --- a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.c +++ b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.c @@ -78,7 +78,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double *states, double *rates, double *constants, double *algebraic) +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic) { states[0] = 123.0; states[1] = 0.001*789.0; diff --git a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.h b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.h index dd0b1fd5cd..e56356d45a 100644 --- a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.h +++ b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.h @@ -31,7 +31,7 @@ double * createAlgebraicArray(); void deleteArray(double *array); -void initialiseVariables(double *states, double *rates, double *constants, double *algebraic); +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.py b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.py index 212fca2d8a..fd82e9c5fe 100644 --- a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.py +++ b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.py @@ -45,7 +45,7 @@ def create_algebraic_array(): return [nan]*ALGEBRAIC_COUNT -def initialise_variables(states, rates, constants, algebraic): +def initialise_variables(voi, states, rates, constants, algebraic): states[0] = 123.0 states[1] = 0.001*789.0 diff --git a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.c b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.c index d4036cd8fe..363343cd2b 100644 --- a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.c +++ b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.c @@ -80,7 +80,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double *states, double *rates, double *constants, double *algebraic) +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic) { states[0] = constants[0]; states[1] = 0.001*constants[1]; diff --git a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.h b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.h index 7267fab5d8..67cbb918d9 100644 --- a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.h +++ b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.h @@ -31,7 +31,7 @@ double * createAlgebraicArray(); void deleteArray(double *array); -void initialiseVariables(double *states, double *rates, double *constants, double *algebraic); +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.py b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.py index f60e5e970a..7e03b6de11 100644 --- a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.py +++ b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.py @@ -47,7 +47,7 @@ def create_algebraic_array(): return [nan]*ALGEBRAIC_COUNT -def initialise_variables(states, rates, constants, algebraic): +def initialise_variables(voi, states, rates, constants, algebraic): states[0] = constants[0] states[1] = 0.001*constants[1] constants[0] = 123.0 diff --git a/tests/resources/generator/cellml_unit_scaling_voi_direct/model.c b/tests/resources/generator/cellml_unit_scaling_voi_direct/model.c index 3f3b30f11b..d545a05574 100644 --- a/tests/resources/generator/cellml_unit_scaling_voi_direct/model.c +++ b/tests/resources/generator/cellml_unit_scaling_voi_direct/model.c @@ -78,7 +78,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double *states, double *rates, double *constants, double *algebraic) +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic) { states[0] = 3.0; states[1] = 5.0; diff --git a/tests/resources/generator/cellml_unit_scaling_voi_direct/model.h b/tests/resources/generator/cellml_unit_scaling_voi_direct/model.h index 351e9dc86f..e29840b4e5 100644 --- a/tests/resources/generator/cellml_unit_scaling_voi_direct/model.h +++ b/tests/resources/generator/cellml_unit_scaling_voi_direct/model.h @@ -31,7 +31,7 @@ double * createAlgebraicArray(); void deleteArray(double *array); -void initialiseVariables(double *states, double *rates, double *constants, double *algebraic); +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/cellml_unit_scaling_voi_direct/model.py b/tests/resources/generator/cellml_unit_scaling_voi_direct/model.py index bed26c2782..2d7f9ee98d 100644 --- a/tests/resources/generator/cellml_unit_scaling_voi_direct/model.py +++ b/tests/resources/generator/cellml_unit_scaling_voi_direct/model.py @@ -45,7 +45,7 @@ def create_algebraic_array(): return [nan]*ALGEBRAIC_COUNT -def initialise_variables(states, rates, constants, algebraic): +def initialise_variables(voi, states, rates, constants, algebraic): states[0] = 3.0 states[1] = 5.0 diff --git a/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.c b/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.c index cc52751060..1a7319f7dc 100644 --- a/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.c +++ b/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.c @@ -79,7 +79,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double *states, double *rates, double *constants, double *algebraic) +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic) { states[0] = 3.0; states[1] = 7.0; diff --git a/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.h b/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.h index 487f6a7483..c5193145bc 100644 --- a/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.h +++ b/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.h @@ -31,7 +31,7 @@ double * createAlgebraicArray(); void deleteArray(double *array); -void initialiseVariables(double *states, double *rates, double *constants, double *algebraic); +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.py b/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.py index 5d5db39450..9bc446530a 100644 --- a/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.py +++ b/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.py @@ -46,7 +46,7 @@ def create_algebraic_array(): return [nan]*ALGEBRAIC_COUNT -def initialise_variables(states, rates, constants, algebraic): +def initialise_variables(voi, states, rates, constants, algebraic): states[0] = 3.0 states[1] = 7.0 states[2] = 11.0 diff --git a/tests/resources/generator/dae_cellml_1_1_model/model.c b/tests/resources/generator/dae_cellml_1_1_model/model.c index d32cd7b90e..b4a2873d61 100644 --- a/tests/resources/generator/dae_cellml_1_1_model/model.c +++ b/tests/resources/generator/dae_cellml_1_1_model/model.c @@ -146,7 +146,7 @@ void findRoot1(double voi, double *states, double *rates, double *variables) algebraic[4] = u[0]; } -void initialiseVariables(double *states, double *rates, double *constants, double *algebraic) +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic) { states[0] = 1.0; states[1] = 0.0; diff --git a/tests/resources/generator/dae_cellml_1_1_model/model.h b/tests/resources/generator/dae_cellml_1_1_model/model.h index f4325a88b0..d677f483cd 100644 --- a/tests/resources/generator/dae_cellml_1_1_model/model.h +++ b/tests/resources/generator/dae_cellml_1_1_model/model.h @@ -31,7 +31,7 @@ double * createAlgebraicArray(); void deleteArray(double *array); -void initialiseVariables(double *states, double *rates, double *constants, double *algebraic); +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/dae_cellml_1_1_model/model.py b/tests/resources/generator/dae_cellml_1_1_model/model.py index a65bd29329..b5f846ce9b 100644 --- a/tests/resources/generator/dae_cellml_1_1_model/model.py +++ b/tests/resources/generator/dae_cellml_1_1_model/model.py @@ -100,7 +100,7 @@ def find_root_1(voi, states, rates, variables): algebraic[4] = u[0] -def initialise_variables(states, rates, constants, algebraic): +def initialise_variables(voi, states, rates, constants, algebraic): states[0] = 1.0 states[1] = 0.0 constants[0] = 1.0 diff --git a/tests/resources/generator/dependent_eqns/model.c b/tests/resources/generator/dependent_eqns/model.c index da657936cb..48ab41d0ca 100644 --- a/tests/resources/generator/dependent_eqns/model.c +++ b/tests/resources/generator/dependent_eqns/model.c @@ -79,7 +79,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double *states, double *rates, double *constants, double *algebraic) +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic) { states[0] = 0.0; } diff --git a/tests/resources/generator/dependent_eqns/model.h b/tests/resources/generator/dependent_eqns/model.h index 2a63e4ec51..428425c587 100644 --- a/tests/resources/generator/dependent_eqns/model.h +++ b/tests/resources/generator/dependent_eqns/model.h @@ -31,7 +31,7 @@ double * createAlgebraicArray(); void deleteArray(double *array); -void initialiseVariables(double *states, double *rates, double *constants, double *algebraic); +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/dependent_eqns/model.py b/tests/resources/generator/dependent_eqns/model.py index b415fdb96b..e808d821ce 100644 --- a/tests/resources/generator/dependent_eqns/model.py +++ b/tests/resources/generator/dependent_eqns/model.py @@ -46,7 +46,7 @@ def create_algebraic_array(): return [nan]*ALGEBRAIC_COUNT -def initialise_variables(states, rates, constants, algebraic): +def initialise_variables(voi, states, rates, constants, algebraic): states[0] = 0.0 diff --git a/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.c b/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.c index 20d93a9cc0..a8a5216a2e 100644 --- a/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.c +++ b/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.c @@ -326,7 +326,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double *states, double *rates, double *constants, double *algebraic) +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic) { states[0] = 6.226104e-5; states[1] = 5.0; diff --git a/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.h b/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.h index 91a04ff7d2..911283f315 100644 --- a/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.h +++ b/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.h @@ -31,7 +31,7 @@ double * createAlgebraicArray(); void deleteArray(double *array); -void initialiseVariables(double *states, double *rates, double *constants, double *algebraic); +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.py b/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.py index 379a01e73d..aa0f5640b4 100644 --- a/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.py +++ b/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.py @@ -313,7 +313,7 @@ def create_algebraic_array(): return [nan]*ALGEBRAIC_COUNT -def initialise_variables(states, rates, constants, algebraic): +def initialise_variables(voi, states, rates, constants, algebraic): states[0] = 6.226104e-5 states[1] = 5.0 states[2] = 0.409551 diff --git a/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.c b/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.c index 95cebcd3a3..359ef0869d 100644 --- a/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.c +++ b/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.c @@ -276,7 +276,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double *states, double *rates, double *constants, double *algebraic) +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic) { states[0] = -39.013558536; states[1] = 0.092361701692; diff --git a/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.h b/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.h index 96bd8c9d2e..817cb1544c 100644 --- a/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.h +++ b/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.h @@ -31,7 +31,7 @@ double * createAlgebraicArray(); void deleteArray(double *array); -void initialiseVariables(double *states, double *rates, double *constants, double *algebraic); +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.py b/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.py index 0b6a2012ad..1817e152e6 100644 --- a/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.py +++ b/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.py @@ -251,7 +251,7 @@ def create_algebraic_array(): return [nan]*ALGEBRAIC_COUNT -def initialise_variables(states, rates, constants, algebraic): +def initialise_variables(voi, states, rates, constants, algebraic): states[0] = -39.013558536 states[1] = 0.092361701692 states[2] = 0.015905380261 diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.c index e0dcf3cb10..d81cafe4e8 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.c @@ -113,7 +113,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic, ExternalVariable externalVariable) +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic) { states[0] = 0.0; states[1] = 0.6; @@ -124,7 +124,6 @@ void initialiseVariables(double voi, double *states, double *rates, double *cons constants[2] = 0.3; constants[3] = 120.0; constants[4] = 36.0; - external[0] = externalVariable(voi, states, rates, variables, 0); } void computeComputedConstants(double *constants, double *computedConstants) diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.h index 543f64ae8d..857b7d32fa 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.h +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.h @@ -36,7 +36,7 @@ void deleteArray(double *array); typedef double (* ExternalVariable)(double voi, double *states, double *rates, double *variables, size_t index); -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic, ExternalVariable externalVariable); +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.py index 264db7750e..ddf22acb14 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.py @@ -85,7 +85,7 @@ def create_externals_array(): return [nan]*EXTERNAL_COUNT -def initialise_variables(voi, states, rates, constants, algebraic, external_variable): +def initialise_variables(voi, states, rates, constants, algebraic): states[0] = 0.0 states[1] = 0.6 states[2] = 0.05 @@ -95,7 +95,6 @@ def initialise_variables(voi, states, rates, constants, algebraic, external_vari constants[2] = 0.3 constants[3] = 120.0 constants[4] = 36.0 - external[0] = external_variable(voi, states, rates, variables, 0) def compute_computed_constants(constants, computed_constants): diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.c index 055c697965..399b824ff9 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.c @@ -98,7 +98,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double *states, double *rates, double *constants, double *algebraic) +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic) { states[0] = 0.0; states[1] = 0.6; diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.c index f5534292ab..42fbe04210 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.c @@ -113,7 +113,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic, ExternalVariable externalVariable) +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic) { states[0] = 0.0; states[1] = 0.6; @@ -124,7 +124,6 @@ void initialiseVariables(double voi, double *states, double *rates, double *cons constants[2] = 0.3; constants[3] = 120.0; constants[4] = 36.0; - external[4] = externalVariable(voi, states, rates, variables, 4); } void computeComputedConstants(double *constants, double *computedConstants) diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.h index 543f64ae8d..857b7d32fa 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.h +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.h @@ -36,7 +36,7 @@ void deleteArray(double *array); typedef double (* ExternalVariable)(double voi, double *states, double *rates, double *variables, size_t index); -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic, ExternalVariable externalVariable); +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.py index 825c30cc95..ebabb1f34f 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.py @@ -85,7 +85,7 @@ def create_externals_array(): return [nan]*EXTERNAL_COUNT -def initialise_variables(voi, states, rates, constants, algebraic, external_variable): +def initialise_variables(voi, states, rates, constants, algebraic): states[0] = 0.0 states[1] = 0.6 states[2] = 0.05 @@ -95,7 +95,6 @@ def initialise_variables(voi, states, rates, constants, algebraic, external_vari constants[2] = 0.3 constants[3] = 120.0 constants[4] = 36.0 - external[4] = external_variable(voi, states, rates, variables, 4) def compute_computed_constants(constants, computed_constants): diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.c index 7d34125683..48d1499945 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.c @@ -113,7 +113,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic, ExternalVariable externalVariable) +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic) { states[0] = 0.0; states[1] = 0.6; @@ -123,7 +123,6 @@ void initialiseVariables(double voi, double *states, double *rates, double *cons constants[1] = 0.3; constants[2] = 120.0; constants[3] = 36.0; - external[4] = externalVariable(voi, states, rates, variables, 4); } void computeComputedConstants(double *constants, double *computedConstants) diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.h index 543f64ae8d..857b7d32fa 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.h +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.h @@ -36,7 +36,7 @@ void deleteArray(double *array); typedef double (* ExternalVariable)(double voi, double *states, double *rates, double *variables, size_t index); -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic, ExternalVariable externalVariable); +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.py index 32d9a44ba7..82efd710e2 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.py @@ -85,7 +85,7 @@ def create_externals_array(): return [nan]*EXTERNAL_COUNT -def initialise_variables(voi, states, rates, constants, algebraic, external_variable): +def initialise_variables(voi, states, rates, constants, algebraic): states[0] = 0.0 states[1] = 0.6 states[2] = 0.05 @@ -94,7 +94,6 @@ def initialise_variables(voi, states, rates, constants, algebraic, external_vari constants[1] = 0.3 constants[2] = 120.0 constants[3] = 36.0 - external[4] = external_variable(voi, states, rates, variables, 4) def compute_computed_constants(constants, computed_constants): diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.c index f929e387f7..25ffe82fe0 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.c @@ -516,7 +516,7 @@ void findRoot16(double voi, double *states, double *rates, double *variables) rates[3] = u[0]; } -void initialiseVariables(double *states, double *rates, double *constants, double *algebraic) +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic) { states[0] = 0.0; states[1] = 0.6; diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.h index 6dead540ca..07842acfdc 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.h +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.h @@ -31,7 +31,7 @@ double * createAlgebraicArray(); void deleteArray(double *array); -void initialiseVariables(double *states, double *rates, double *constants, double *algebraic); +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.py index 4dc6719376..6a67ef4213 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.py @@ -437,7 +437,7 @@ def find_root_16(voi, states, rates, variables): rates[3] = u[0] -def initialise_variables(states, rates, constants, algebraic): +def initialise_variables(voi, states, rates, constants, algebraic): states[0] = 0.0 states[1] = 0.6 states[2] = 0.05 diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.c index b91929dbd9..6631f821e2 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.c @@ -113,7 +113,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic, ExternalVariable externalVariable) +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic) { states[0] = 0.0; states[1] = 0.6; @@ -124,8 +124,6 @@ void initialiseVariables(double voi, double *states, double *rates, double *cons constants[2] = 0.3; constants[3] = 120.0; constants[4] = 36.0; - external[9] = externalVariable(voi, states, rates, variables, 9); - external[0] = externalVariable(voi, states, rates, variables, 0); } void computeComputedConstants(double *constants, double *computedConstants) diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.h index 543f64ae8d..857b7d32fa 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.h +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.h @@ -36,7 +36,7 @@ void deleteArray(double *array); typedef double (* ExternalVariable)(double voi, double *states, double *rates, double *variables, size_t index); -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic, ExternalVariable externalVariable); +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.py index 243b736f05..69623430c6 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.py @@ -85,7 +85,7 @@ def create_externals_array(): return [nan]*EXTERNAL_COUNT -def initialise_variables(voi, states, rates, constants, algebraic, external_variable): +def initialise_variables(voi, states, rates, constants, algebraic): states[0] = 0.0 states[1] = 0.6 states[2] = 0.05 @@ -95,8 +95,6 @@ def initialise_variables(voi, states, rates, constants, algebraic, external_vari constants[2] = 0.3 constants[3] = 120.0 constants[4] = 36.0 - external[9] = external_variable(voi, states, rates, variables, 9) - external[0] = external_variable(voi, states, rates, variables, 0) def compute_computed_constants(constants, computed_constants): diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.c index 35de38cb56..a51d461128 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.c @@ -113,7 +113,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic, ExternalVariable externalVariable) +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic) { states[0] = 0.0; states[1] = 0.6; @@ -123,8 +123,6 @@ void initialiseVariables(double voi, double *states, double *rates, double *cons constants[1] = 0.3; constants[2] = 120.0; constants[3] = 36.0; - external[11] = externalVariable(voi, states, rates, variables, 11); - external[4] = externalVariable(voi, states, rates, variables, 4); } void computeComputedConstants(double *constants, double *computedConstants) diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.h index 543f64ae8d..857b7d32fa 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.h +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.h @@ -36,7 +36,7 @@ void deleteArray(double *array); typedef double (* ExternalVariable)(double voi, double *states, double *rates, double *variables, size_t index); -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic, ExternalVariable externalVariable); +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.py index 0da4974b20..4dd723021b 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.py @@ -85,7 +85,7 @@ def create_externals_array(): return [nan]*EXTERNAL_COUNT -def initialise_variables(voi, states, rates, constants, algebraic, external_variable): +def initialise_variables(voi, states, rates, constants, algebraic): states[0] = 0.0 states[1] = 0.6 states[2] = 0.05 @@ -94,8 +94,6 @@ def initialise_variables(voi, states, rates, constants, algebraic, external_vari constants[1] = 0.3 constants[2] = 120.0 constants[3] = 36.0 - external[11] = external_variable(voi, states, rates, variables, 11) - external[4] = external_variable(voi, states, rates, variables, 4) def compute_computed_constants(constants, computed_constants): diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.c index cc74be6ce6..004ed3c370 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.c @@ -113,7 +113,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic, ExternalVariable externalVariable) +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic) { states[0] = 0.0; states[1] = 0.6; @@ -122,8 +122,6 @@ void initialiseVariables(double voi, double *states, double *rates, double *cons constants[0] = 0.0; constants[1] = 0.3; constants[2] = 36.0; - external[5] = externalVariable(voi, states, rates, variables, 5); - external[4] = externalVariable(voi, states, rates, variables, 4); } void computeComputedConstants(double *constants, double *computedConstants) diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.h index 543f64ae8d..857b7d32fa 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.h +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.h @@ -36,7 +36,7 @@ void deleteArray(double *array); typedef double (* ExternalVariable)(double voi, double *states, double *rates, double *variables, size_t index); -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic, ExternalVariable externalVariable); +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.py index 9ffe1b12aa..05478b9260 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.py @@ -85,7 +85,7 @@ def create_externals_array(): return [nan]*EXTERNAL_COUNT -def initialise_variables(voi, states, rates, constants, algebraic, external_variable): +def initialise_variables(voi, states, rates, constants, algebraic): states[0] = 0.0 states[1] = 0.6 states[2] = 0.05 @@ -93,8 +93,6 @@ def initialise_variables(voi, states, rates, constants, algebraic, external_vari constants[0] = 0.0 constants[1] = 0.3 constants[2] = 36.0 - external[5] = external_variable(voi, states, rates, variables, 5) - external[4] = external_variable(voi, states, rates, variables, 4) def compute_computed_constants(constants, computed_constants): diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.c index 3f7fde0861..c5a4fdcb36 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.c @@ -113,7 +113,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic, ExternalVariable externalVariable) +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic) { states[0] = 0.6; states[1] = 0.325; @@ -122,8 +122,6 @@ void initialiseVariables(double voi, double *states, double *rates, double *cons constants[2] = 0.3; constants[3] = 120.0; constants[4] = 36.0; - external[1] = externalVariable(voi, states, rates, variables, 1); - external[5] = externalVariable(voi, states, rates, variables, 5); } void computeComputedConstants(double *constants, double *computedConstants) diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.h index 543f64ae8d..857b7d32fa 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.h +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.h @@ -36,7 +36,7 @@ void deleteArray(double *array); typedef double (* ExternalVariable)(double voi, double *states, double *rates, double *variables, size_t index); -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic, ExternalVariable externalVariable); +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.py index a4fb36996a..f02d4bbc17 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.py @@ -85,7 +85,7 @@ def create_externals_array(): return [nan]*EXTERNAL_COUNT -def initialise_variables(voi, states, rates, constants, algebraic, external_variable): +def initialise_variables(voi, states, rates, constants, algebraic): states[0] = 0.6 states[1] = 0.325 constants[0] = 1.0 @@ -93,8 +93,6 @@ def initialise_variables(voi, states, rates, constants, algebraic, external_vari constants[2] = 0.3 constants[3] = 120.0 constants[4] = 36.0 - external[1] = external_variable(voi, states, rates, variables, 1) - external[5] = external_variable(voi, states, rates, variables, 5) def compute_computed_constants(constants, computed_constants): diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.c index c2572f6cf8..968d381c83 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.c @@ -113,7 +113,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic, ExternalVariable externalVariable) +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic) { states[0] = 0.6; states[1] = 0.05; @@ -123,9 +123,6 @@ void initialiseVariables(double voi, double *states, double *rates, double *cons constants[2] = 0.3; constants[3] = 120.0; constants[4] = 36.0; - external[1] = externalVariable(voi, states, rates, variables, 1); - external[9] = externalVariable(voi, states, rates, variables, 9); - external[4] = externalVariable(voi, states, rates, variables, 4); } void computeComputedConstants(double *constants, double *computedConstants) diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.h index 543f64ae8d..857b7d32fa 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.h +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.h @@ -36,7 +36,7 @@ void deleteArray(double *array); typedef double (* ExternalVariable)(double voi, double *states, double *rates, double *variables, size_t index); -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic, ExternalVariable externalVariable); +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.py index 5fefa1e030..d533782eac 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.py @@ -85,7 +85,7 @@ def create_externals_array(): return [nan]*EXTERNAL_COUNT -def initialise_variables(voi, states, rates, constants, algebraic, external_variable): +def initialise_variables(voi, states, rates, constants, algebraic): states[0] = 0.6 states[1] = 0.05 states[2] = 0.325 @@ -94,9 +94,6 @@ def initialise_variables(voi, states, rates, constants, algebraic, external_vari constants[2] = 0.3 constants[3] = 120.0 constants[4] = 36.0 - external[1] = external_variable(voi, states, rates, variables, 1) - external[9] = external_variable(voi, states, rates, variables, 9) - external[4] = external_variable(voi, states, rates, variables, 4) def compute_computed_constants(constants, computed_constants): diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.h index 6dead540ca..07842acfdc 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.h +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.h @@ -31,7 +31,7 @@ double * createAlgebraicArray(); void deleteArray(double *array); -void initialiseVariables(double *states, double *rates, double *constants, double *algebraic); +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.py index 7aaf3feb17..2a50b6d32c 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.py @@ -77,7 +77,7 @@ def create_algebraic_array(): return [nan]*ALGEBRAIC_COUNT -def initialise_variables(states, rates, constants, algebraic): +def initialise_variables(voi, states, rates, constants, algebraic): states[0] = 0.0 states[1] = 0.6 states[2] = 0.05 diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.c index f5d0d0929d..64e677b509 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.c @@ -113,7 +113,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic, ExternalVariable externalVariable) +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic) { states[0] = 0.0; states[1] = 0.6; @@ -123,7 +123,6 @@ void initialiseVariables(double voi, double *states, double *rates, double *cons constants[2] = 0.3; constants[3] = 120.0; constants[4] = 36.0; - external[4] = externalVariable(voi, states, rates, variables, 4); } void computeComputedConstants(double *constants, double *computedConstants) diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.h index 543f64ae8d..857b7d32fa 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.h +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.h @@ -36,7 +36,7 @@ void deleteArray(double *array); typedef double (* ExternalVariable)(double voi, double *states, double *rates, double *variables, size_t index); -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic, ExternalVariable externalVariable); +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.py index 27d1d496a2..bd4d565ed1 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.py @@ -85,7 +85,7 @@ def create_externals_array(): return [nan]*EXTERNAL_COUNT -def initialise_variables(voi, states, rates, constants, algebraic, external_variable): +def initialise_variables(voi, states, rates, constants, algebraic): states[0] = 0.0 states[1] = 0.6 states[2] = 0.325 @@ -94,7 +94,6 @@ def initialise_variables(voi, states, rates, constants, algebraic, external_vari constants[2] = 0.3 constants[3] = 120.0 constants[4] = 36.0 - external[4] = external_variable(voi, states, rates, variables, 4) def compute_computed_constants(constants, computed_constants): diff --git a/tests/resources/generator/noble_model_1962/model.c b/tests/resources/generator/noble_model_1962/model.c index 7b978a5a76..e827ed2393 100644 --- a/tests/resources/generator/noble_model_1962/model.c +++ b/tests/resources/generator/noble_model_1962/model.c @@ -97,7 +97,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double *states, double *rates, double *constants, double *algebraic) +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic) { states[0] = -87.0; states[1] = 0.01; diff --git a/tests/resources/generator/noble_model_1962/model.h b/tests/resources/generator/noble_model_1962/model.h index 3814979f5b..e3b78b41d5 100644 --- a/tests/resources/generator/noble_model_1962/model.h +++ b/tests/resources/generator/noble_model_1962/model.h @@ -31,7 +31,7 @@ double * createAlgebraicArray(); void deleteArray(double *array); -void initialiseVariables(double *states, double *rates, double *constants, double *algebraic); +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/noble_model_1962/model.py b/tests/resources/generator/noble_model_1962/model.py index 998e70942a..787e9a9736 100644 --- a/tests/resources/generator/noble_model_1962/model.py +++ b/tests/resources/generator/noble_model_1962/model.py @@ -64,7 +64,7 @@ def create_algebraic_array(): return [nan]*ALGEBRAIC_COUNT -def initialise_variables(states, rates, constants, algebraic): +def initialise_variables(voi, states, rates, constants, algebraic): states[0] = -87.0 states[1] = 0.01 states[2] = 0.8 diff --git a/tests/resources/generator/ode_computed_var_on_rhs/model.c b/tests/resources/generator/ode_computed_var_on_rhs/model.c index fb2e5ed243..e353013d0f 100644 --- a/tests/resources/generator/ode_computed_var_on_rhs/model.c +++ b/tests/resources/generator/ode_computed_var_on_rhs/model.c @@ -78,7 +78,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double *states, double *rates, double *constants, double *algebraic) +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic) { states[0] = 1.0; } diff --git a/tests/resources/generator/ode_computed_var_on_rhs/model.h b/tests/resources/generator/ode_computed_var_on_rhs/model.h index 351e9dc86f..e29840b4e5 100644 --- a/tests/resources/generator/ode_computed_var_on_rhs/model.h +++ b/tests/resources/generator/ode_computed_var_on_rhs/model.h @@ -31,7 +31,7 @@ double * createAlgebraicArray(); void deleteArray(double *array); -void initialiseVariables(double *states, double *rates, double *constants, double *algebraic); +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/ode_computed_var_on_rhs/model.py b/tests/resources/generator/ode_computed_var_on_rhs/model.py index 4d2a9c43ca..d5856eb249 100644 --- a/tests/resources/generator/ode_computed_var_on_rhs/model.py +++ b/tests/resources/generator/ode_computed_var_on_rhs/model.py @@ -45,7 +45,7 @@ def create_algebraic_array(): return [nan]*ALGEBRAIC_COUNT -def initialise_variables(states, rates, constants, algebraic): +def initialise_variables(voi, states, rates, constants, algebraic): states[0] = 1.0 diff --git a/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.c b/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.c index 8c03c4af6d..77dc8431b8 100644 --- a/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.c +++ b/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.c @@ -78,7 +78,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double *states, double *rates, double *constants, double *algebraic) +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic) { states[0] = 1.0; } diff --git a/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.h b/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.h index e05d298461..d2fac6dd07 100644 --- a/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.h +++ b/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.h @@ -31,7 +31,7 @@ double * createAlgebraicArray(); void deleteArray(double *array); -void initialiseVariables(double *states, double *rates, double *constants, double *algebraic); +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.py b/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.py index b475ed2af5..1de612165b 100644 --- a/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.py +++ b/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.py @@ -45,7 +45,7 @@ def create_algebraic_array(): return [nan]*ALGEBRAIC_COUNT -def initialise_variables(states, rates, constants, algebraic): +def initialise_variables(voi, states, rates, constants, algebraic): states[0] = 1.0 diff --git a/tests/resources/generator/ode_const_var_on_rhs/model.c b/tests/resources/generator/ode_const_var_on_rhs/model.c index f201c2cb4d..2a6e2a5f22 100644 --- a/tests/resources/generator/ode_const_var_on_rhs/model.c +++ b/tests/resources/generator/ode_const_var_on_rhs/model.c @@ -78,7 +78,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double *states, double *rates, double *constants, double *algebraic) +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic) { states[0] = 1.0; constants[0] = 1.0; diff --git a/tests/resources/generator/ode_const_var_on_rhs/model.h b/tests/resources/generator/ode_const_var_on_rhs/model.h index 351e9dc86f..e29840b4e5 100644 --- a/tests/resources/generator/ode_const_var_on_rhs/model.h +++ b/tests/resources/generator/ode_const_var_on_rhs/model.h @@ -31,7 +31,7 @@ double * createAlgebraicArray(); void deleteArray(double *array); -void initialiseVariables(double *states, double *rates, double *constants, double *algebraic); +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/ode_const_var_on_rhs/model.py b/tests/resources/generator/ode_const_var_on_rhs/model.py index 17b950ef3b..82e966ec62 100644 --- a/tests/resources/generator/ode_const_var_on_rhs/model.py +++ b/tests/resources/generator/ode_const_var_on_rhs/model.py @@ -45,7 +45,7 @@ def create_algebraic_array(): return [nan]*ALGEBRAIC_COUNT -def initialise_variables(states, rates, constants, algebraic): +def initialise_variables(voi, states, rates, constants, algebraic): states[0] = 1.0 constants[0] = 1.0 diff --git a/tests/resources/generator/ode_const_var_on_rhs_one_component/model.c b/tests/resources/generator/ode_const_var_on_rhs_one_component/model.c index 19f3ea08f0..72adfdb45a 100644 --- a/tests/resources/generator/ode_const_var_on_rhs_one_component/model.c +++ b/tests/resources/generator/ode_const_var_on_rhs_one_component/model.c @@ -78,7 +78,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double *states, double *rates, double *constants, double *algebraic) +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic) { states[0] = 1.0; constants[0] = 1.0; diff --git a/tests/resources/generator/ode_const_var_on_rhs_one_component/model.h b/tests/resources/generator/ode_const_var_on_rhs_one_component/model.h index e05d298461..d2fac6dd07 100644 --- a/tests/resources/generator/ode_const_var_on_rhs_one_component/model.h +++ b/tests/resources/generator/ode_const_var_on_rhs_one_component/model.h @@ -31,7 +31,7 @@ double * createAlgebraicArray(); void deleteArray(double *array); -void initialiseVariables(double *states, double *rates, double *constants, double *algebraic); +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/ode_const_var_on_rhs_one_component/model.py b/tests/resources/generator/ode_const_var_on_rhs_one_component/model.py index 4179fad784..b501785003 100644 --- a/tests/resources/generator/ode_const_var_on_rhs_one_component/model.py +++ b/tests/resources/generator/ode_const_var_on_rhs_one_component/model.py @@ -45,7 +45,7 @@ def create_algebraic_array(): return [nan]*ALGEBRAIC_COUNT -def initialise_variables(states, rates, constants, algebraic): +def initialise_variables(voi, states, rates, constants, algebraic): states[0] = 1.0 constants[0] = 1.0 diff --git a/tests/resources/generator/ode_constant_on_rhs/model.c b/tests/resources/generator/ode_constant_on_rhs/model.c index 1809eb460d..b16f444300 100644 --- a/tests/resources/generator/ode_constant_on_rhs/model.c +++ b/tests/resources/generator/ode_constant_on_rhs/model.c @@ -77,7 +77,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double *states, double *rates, double *constants, double *algebraic) +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic) { states[0] = 1.0; } diff --git a/tests/resources/generator/ode_constant_on_rhs/model.h b/tests/resources/generator/ode_constant_on_rhs/model.h index 351e9dc86f..e29840b4e5 100644 --- a/tests/resources/generator/ode_constant_on_rhs/model.h +++ b/tests/resources/generator/ode_constant_on_rhs/model.h @@ -31,7 +31,7 @@ double * createAlgebraicArray(); void deleteArray(double *array); -void initialiseVariables(double *states, double *rates, double *constants, double *algebraic); +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/ode_constant_on_rhs/model.py b/tests/resources/generator/ode_constant_on_rhs/model.py index f9e8d5488b..0341e10a40 100644 --- a/tests/resources/generator/ode_constant_on_rhs/model.py +++ b/tests/resources/generator/ode_constant_on_rhs/model.py @@ -44,7 +44,7 @@ def create_algebraic_array(): return [nan]*ALGEBRAIC_COUNT -def initialise_variables(states, rates, constants, algebraic): +def initialise_variables(voi, states, rates, constants, algebraic): states[0] = 1.0 diff --git a/tests/resources/generator/ode_constant_on_rhs_one_component/model.c b/tests/resources/generator/ode_constant_on_rhs_one_component/model.c index 900aefa1a5..2f0a222f88 100644 --- a/tests/resources/generator/ode_constant_on_rhs_one_component/model.c +++ b/tests/resources/generator/ode_constant_on_rhs_one_component/model.c @@ -77,7 +77,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double *states, double *rates, double *constants, double *algebraic) +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic) { states[0] = 1.0; } diff --git a/tests/resources/generator/ode_constant_on_rhs_one_component/model.h b/tests/resources/generator/ode_constant_on_rhs_one_component/model.h index e05d298461..d2fac6dd07 100644 --- a/tests/resources/generator/ode_constant_on_rhs_one_component/model.h +++ b/tests/resources/generator/ode_constant_on_rhs_one_component/model.h @@ -31,7 +31,7 @@ double * createAlgebraicArray(); void deleteArray(double *array); -void initialiseVariables(double *states, double *rates, double *constants, double *algebraic); +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/ode_constant_on_rhs_one_component/model.py b/tests/resources/generator/ode_constant_on_rhs_one_component/model.py index e32e47341e..0a7d4de47c 100644 --- a/tests/resources/generator/ode_constant_on_rhs_one_component/model.py +++ b/tests/resources/generator/ode_constant_on_rhs_one_component/model.py @@ -44,7 +44,7 @@ def create_algebraic_array(): return [nan]*ALGEBRAIC_COUNT -def initialise_variables(states, rates, constants, algebraic): +def initialise_variables(voi, states, rates, constants, algebraic): states[0] = 1.0 diff --git a/tests/resources/generator/ode_multiple_dependent_odes/model.c b/tests/resources/generator/ode_multiple_dependent_odes/model.c index 50b5e525bc..19903539fc 100644 --- a/tests/resources/generator/ode_multiple_dependent_odes/model.c +++ b/tests/resources/generator/ode_multiple_dependent_odes/model.c @@ -79,7 +79,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double *states, double *rates, double *constants, double *algebraic) +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic) { states[0] = -2.0; states[1] = 0.0; diff --git a/tests/resources/generator/ode_multiple_dependent_odes/model.h b/tests/resources/generator/ode_multiple_dependent_odes/model.h index c97d6682e3..723fd54030 100644 --- a/tests/resources/generator/ode_multiple_dependent_odes/model.h +++ b/tests/resources/generator/ode_multiple_dependent_odes/model.h @@ -31,7 +31,7 @@ double * createAlgebraicArray(); void deleteArray(double *array); -void initialiseVariables(double *states, double *rates, double *constants, double *algebraic); +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/ode_multiple_dependent_odes/model.py b/tests/resources/generator/ode_multiple_dependent_odes/model.py index cfe8f9dbb3..a25d71bd78 100644 --- a/tests/resources/generator/ode_multiple_dependent_odes/model.py +++ b/tests/resources/generator/ode_multiple_dependent_odes/model.py @@ -46,7 +46,7 @@ def create_algebraic_array(): return [nan]*ALGEBRAIC_COUNT -def initialise_variables(states, rates, constants, algebraic): +def initialise_variables(voi, states, rates, constants, algebraic): states[0] = -2.0 states[1] = 0.0 constants[0] = 1.0 diff --git a/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.c b/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.c index 69cb46ef08..ce65181001 100644 --- a/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.c +++ b/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.c @@ -79,7 +79,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double *states, double *rates, double *constants, double *algebraic) +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic) { states[0] = -2.0; states[1] = 0.0; diff --git a/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.h b/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.h index 04133c21ef..a929fb7cd9 100644 --- a/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.h +++ b/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.h @@ -31,7 +31,7 @@ double * createAlgebraicArray(); void deleteArray(double *array); -void initialiseVariables(double *states, double *rates, double *constants, double *algebraic); +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.py b/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.py index d6823483bb..c86ec1bb7e 100644 --- a/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.py +++ b/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.py @@ -46,7 +46,7 @@ def create_algebraic_array(): return [nan]*ALGEBRAIC_COUNT -def initialise_variables(states, rates, constants, algebraic): +def initialise_variables(voi, states, rates, constants, algebraic): states[0] = -2.0 states[1] = 0.0 constants[0] = 1.0 diff --git a/tests/resources/generator/ode_multiple_odes_with_same_name/model.c b/tests/resources/generator/ode_multiple_odes_with_same_name/model.c index 67a376b764..c1f03ce233 100644 --- a/tests/resources/generator/ode_multiple_odes_with_same_name/model.c +++ b/tests/resources/generator/ode_multiple_odes_with_same_name/model.c @@ -79,7 +79,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double *states, double *rates, double *constants, double *algebraic) +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic) { states[0] = 1.0; states[1] = 1.0; diff --git a/tests/resources/generator/ode_multiple_odes_with_same_name/model.h b/tests/resources/generator/ode_multiple_odes_with_same_name/model.h index 83e1465e4d..f62cb5d152 100644 --- a/tests/resources/generator/ode_multiple_odes_with_same_name/model.h +++ b/tests/resources/generator/ode_multiple_odes_with_same_name/model.h @@ -31,7 +31,7 @@ double * createAlgebraicArray(); void deleteArray(double *array); -void initialiseVariables(double *states, double *rates, double *constants, double *algebraic); +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/ode_multiple_odes_with_same_name/model.py b/tests/resources/generator/ode_multiple_odes_with_same_name/model.py index 3fc06a3ab8..8c25966175 100644 --- a/tests/resources/generator/ode_multiple_odes_with_same_name/model.py +++ b/tests/resources/generator/ode_multiple_odes_with_same_name/model.py @@ -46,7 +46,7 @@ def create_algebraic_array(): return [nan]*ALGEBRAIC_COUNT -def initialise_variables(states, rates, constants, algebraic): +def initialise_variables(voi, states, rates, constants, algebraic): states[0] = 1.0 states[1] = 1.0 constants[0] = 1.0 diff --git a/tests/resources/generator/ode_unknown_var_on_rhs/model.c b/tests/resources/generator/ode_unknown_var_on_rhs/model.c index 9885566370..3ff8890e6e 100644 --- a/tests/resources/generator/ode_unknown_var_on_rhs/model.c +++ b/tests/resources/generator/ode_unknown_var_on_rhs/model.c @@ -78,7 +78,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double *states, double *rates, double *constants, double *algebraic) +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic) { states[0] = 1.0; states[1] = 1.0; diff --git a/tests/resources/generator/ode_unknown_var_on_rhs/model.h b/tests/resources/generator/ode_unknown_var_on_rhs/model.h index 351e9dc86f..e29840b4e5 100644 --- a/tests/resources/generator/ode_unknown_var_on_rhs/model.h +++ b/tests/resources/generator/ode_unknown_var_on_rhs/model.h @@ -31,7 +31,7 @@ double * createAlgebraicArray(); void deleteArray(double *array); -void initialiseVariables(double *states, double *rates, double *constants, double *algebraic); +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/ode_unknown_var_on_rhs/model.py b/tests/resources/generator/ode_unknown_var_on_rhs/model.py index 825591ba22..2da518cac6 100644 --- a/tests/resources/generator/ode_unknown_var_on_rhs/model.py +++ b/tests/resources/generator/ode_unknown_var_on_rhs/model.py @@ -45,7 +45,7 @@ def create_algebraic_array(): return [nan]*ALGEBRAIC_COUNT -def initialise_variables(states, rates, constants, algebraic): +def initialise_variables(voi, states, rates, constants, algebraic): states[0] = 1.0 states[1] = 1.0 diff --git a/tests/resources/generator/robertson_model_1966/model.dae.c b/tests/resources/generator/robertson_model_1966/model.dae.c index 026a8322f9..4d5fa00dfd 100644 --- a/tests/resources/generator/robertson_model_1966/model.dae.c +++ b/tests/resources/generator/robertson_model_1966/model.dae.c @@ -117,7 +117,7 @@ void findRoot0(double voi, double *states, double *rates, double *variables) algebraic[0] = u[0]; } -void initialiseVariables(double *states, double *rates, double *constants, double *algebraic) +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic) { states[0] = 1.0; states[1] = 0.0; diff --git a/tests/resources/generator/robertson_model_1966/model.dae.h b/tests/resources/generator/robertson_model_1966/model.dae.h index c329027254..5d5754056a 100644 --- a/tests/resources/generator/robertson_model_1966/model.dae.h +++ b/tests/resources/generator/robertson_model_1966/model.dae.h @@ -31,7 +31,7 @@ double * createAlgebraicArray(); void deleteArray(double *array); -void initialiseVariables(double *states, double *rates, double *constants, double *algebraic); +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/robertson_model_1966/model.dae.py b/tests/resources/generator/robertson_model_1966/model.dae.py index ab43813892..1b8fd41272 100644 --- a/tests/resources/generator/robertson_model_1966/model.dae.py +++ b/tests/resources/generator/robertson_model_1966/model.dae.py @@ -74,7 +74,7 @@ def find_root_0(voi, states, rates, variables): algebraic[0] = u[0] -def initialise_variables(states, rates, constants, algebraic): +def initialise_variables(voi, states, rates, constants, algebraic): states[0] = 1.0 states[1] = 0.0 constants[0] = 0.04 diff --git a/tests/resources/generator/robertson_model_1966/model.ode.c b/tests/resources/generator/robertson_model_1966/model.ode.c index 6685a416ad..27ca2adc65 100644 --- a/tests/resources/generator/robertson_model_1966/model.ode.c +++ b/tests/resources/generator/robertson_model_1966/model.ode.c @@ -83,7 +83,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double *states, double *rates, double *constants, double *algebraic) +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic) { states[0] = 1.0; states[1] = 0.0; diff --git a/tests/resources/generator/robertson_model_1966/model.ode.h b/tests/resources/generator/robertson_model_1966/model.ode.h index c329027254..5d5754056a 100644 --- a/tests/resources/generator/robertson_model_1966/model.ode.h +++ b/tests/resources/generator/robertson_model_1966/model.ode.h @@ -31,7 +31,7 @@ double * createAlgebraicArray(); void deleteArray(double *array); -void initialiseVariables(double *states, double *rates, double *constants, double *algebraic); +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/robertson_model_1966/model.ode.py b/tests/resources/generator/robertson_model_1966/model.ode.py index d6da1199a5..ef074678fb 100644 --- a/tests/resources/generator/robertson_model_1966/model.ode.py +++ b/tests/resources/generator/robertson_model_1966/model.ode.py @@ -50,7 +50,7 @@ def create_algebraic_array(): return [nan]*ALGEBRAIC_COUNT -def initialise_variables(states, rates, constants, algebraic): +def initialise_variables(voi, states, rates, constants, algebraic): states[0] = 1.0 states[1] = 0.0 states[2] = 0.0 diff --git a/tests/resources/generator/sine_model_imports/model.c b/tests/resources/generator/sine_model_imports/model.c index b253483188..167815f03f 100644 --- a/tests/resources/generator/sine_model_imports/model.c +++ b/tests/resources/generator/sine_model_imports/model.c @@ -87,7 +87,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double *states, double *rates, double *constants, double *algebraic) +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic) { states[0] = constants[0]; constants[0] = 0.0; diff --git a/tests/resources/generator/sine_model_imports/model.h b/tests/resources/generator/sine_model_imports/model.h index b3f715a2b6..25b6b8b1e7 100644 --- a/tests/resources/generator/sine_model_imports/model.h +++ b/tests/resources/generator/sine_model_imports/model.h @@ -31,7 +31,7 @@ double * createAlgebraicArray(); void deleteArray(double *array); -void initialiseVariables(double *states, double *rates, double *constants, double *algebraic); +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/sine_model_imports/model.py b/tests/resources/generator/sine_model_imports/model.py index 35bb474abe..272f8268b1 100644 --- a/tests/resources/generator/sine_model_imports/model.py +++ b/tests/resources/generator/sine_model_imports/model.py @@ -58,7 +58,7 @@ def create_algebraic_array(): return [nan]*ALGEBRAIC_COUNT -def initialise_variables(states, rates, constants, algebraic): +def initialise_variables(voi, states, rates, constants, algebraic): states[0] = constants[0] constants[0] = 0.0 constants[1] = 0.75 diff --git a/tests/resources/generator/unknown_variable_as_external_variable/model.c b/tests/resources/generator/unknown_variable_as_external_variable/model.c index 1c1f84b89a..52086b8cf4 100644 --- a/tests/resources/generator/unknown_variable_as_external_variable/model.c +++ b/tests/resources/generator/unknown_variable_as_external_variable/model.c @@ -84,7 +84,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double *constants, double *algebraic, ExternalVariable externalVariable) +void initialiseVariables(double *constants, double *algebraic) { constants[0] = 1.1; constants[1] = 21262500.0; @@ -94,7 +94,6 @@ void initialiseVariables(double *constants, double *algebraic, ExternalVariable constants[5] = 2902500.0; constants[6] = 810000.0; constants[7] = 247140.0; - external[1] = externalVariable(variables, 1); } void computeComputedConstants(double *constants, double *computedConstants) diff --git a/tests/resources/generator/unknown_variable_as_external_variable/model.h b/tests/resources/generator/unknown_variable_as_external_variable/model.h index 2bb86e6fb2..3e97741459 100644 --- a/tests/resources/generator/unknown_variable_as_external_variable/model.h +++ b/tests/resources/generator/unknown_variable_as_external_variable/model.h @@ -32,6 +32,6 @@ void deleteArray(double *array); typedef double (* ExternalVariable)(double *variables, size_t index); -void initialiseVariables(double *constants, double *algebraic, ExternalVariable externalVariable); +void initialiseVariables(double *constants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeVariables(double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); diff --git a/tests/resources/generator/unknown_variable_as_external_variable/model.py b/tests/resources/generator/unknown_variable_as_external_variable/model.py index 74427a055c..f779ffb993 100644 --- a/tests/resources/generator/unknown_variable_as_external_variable/model.py +++ b/tests/resources/generator/unknown_variable_as_external_variable/model.py @@ -51,7 +51,7 @@ def create_externals_array(): return [nan]*EXTERNAL_COUNT -def initialise_variables(constants, algebraic, external_variable): +def initialise_variables(constants, algebraic): constants[0] = 1.1 constants[1] = 21262500.0 constants[2] = 150.0 @@ -60,7 +60,6 @@ def initialise_variables(constants, algebraic, external_variable): constants[5] = 2902500.0 constants[6] = 810000.0 constants[7] = 247140.0 - external[1] = external_variable(variables, 1) def compute_computed_constants(constants, computed_constants): diff --git a/tests/resources/generator/variable_initialised_using_a_constant/model.c b/tests/resources/generator/variable_initialised_using_a_constant/model.c index e230aecdb3..e4500b462b 100644 --- a/tests/resources/generator/variable_initialised_using_a_constant/model.c +++ b/tests/resources/generator/variable_initialised_using_a_constant/model.c @@ -78,7 +78,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double *states, double *rates, double *constants, double *algebraic) +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic) { states[0] = constants[0]; constants[0] = 7.0; diff --git a/tests/resources/generator/variable_initialised_using_a_constant/model.h b/tests/resources/generator/variable_initialised_using_a_constant/model.h index dac6bf5784..ea32185a4b 100644 --- a/tests/resources/generator/variable_initialised_using_a_constant/model.h +++ b/tests/resources/generator/variable_initialised_using_a_constant/model.h @@ -31,7 +31,7 @@ double * createAlgebraicArray(); void deleteArray(double *array); -void initialiseVariables(double *states, double *rates, double *constants, double *algebraic); +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/variable_initialised_using_a_constant/model.py b/tests/resources/generator/variable_initialised_using_a_constant/model.py index 814cd74a79..539c2776c4 100644 --- a/tests/resources/generator/variable_initialised_using_a_constant/model.py +++ b/tests/resources/generator/variable_initialised_using_a_constant/model.py @@ -45,7 +45,7 @@ def create_algebraic_array(): return [nan]*ALGEBRAIC_COUNT -def initialise_variables(states, rates, constants, algebraic): +def initialise_variables(voi, states, rates, constants, algebraic): states[0] = constants[0] constants[0] = 7.0 From b51474620873b171588f5c06437a0397f365c9ea Mon Sep 17 00:00:00 2001 From: Alan Garny Date: Fri, 16 Aug 2024 15:06:15 +0200 Subject: [PATCH 29/85] Analyser: a variable using an NLA should always be an algebraic variable. Even if the NLA equation only uses constant variables and constant values. --- src/analyser.cpp | 133 +++++++++++------- src/generator.cpp | 16 +-- .../model.dae.c | 100 ++++++------- .../model.dae.py | 100 ++++++------- 4 files changed, 189 insertions(+), 160 deletions(-) diff --git a/src/analyser.cpp b/src/analyser.cpp index 592ef57305..468fa16f8b 100644 --- a/src/analyser.cpp +++ b/src/analyser.cpp @@ -3062,6 +3062,66 @@ void Analyser::AnalyserImpl::analyseModel(const ModelPtr &model) v2aeMappings.emplace(internalEquation->mUnknownVariables.front()->mVariable, equation); } + // Start making our internal equations available through our API. + // Note: start because we need to determine the type of our equations before we can make our internal variables + // available through our API. + + std::map aie2aetMappings; + + for (const auto &internalEquation : mInternalEquations) { + // Determine whether the equation is an external one. + + auto externalEquation = true; + + for (const auto &unknownVariable : internalEquation->mUnknownVariables) { + if (!unknownVariable->mIsExternal) { + externalEquation = false; + + break; + } + } + + // Determine and keep track of the type of the equation. + + AnalyserEquation::Type type; + + if (externalEquation) { + type = AnalyserEquation::Type::EXTERNAL; + } else { + switch (internalEquation->mType) { + case AnalyserInternalEquation::Type::TRUE_CONSTANT: + type = AnalyserEquation::Type::TRUE_CONSTANT; + + break; + case AnalyserInternalEquation::Type::VARIABLE_BASED_CONSTANT: + type = AnalyserEquation::Type::VARIABLE_BASED_CONSTANT; + + break; + case AnalyserInternalEquation::Type::ODE: + type = AnalyserEquation::Type::ODE; + + break; + case AnalyserInternalEquation::Type::NLA: + type = AnalyserEquation::Type::NLA; + + break; + case AnalyserInternalEquation::Type::ALGEBRAIC: + type = AnalyserEquation::Type::ALGEBRAIC; + + break; + default: // AnalyserEquation::Type::UNKNOWN. + // The equation type is unknown, which means that it is a dummy + // equation for a true (i.e. non-computed) constant (so that it + // could have been marked as an external variable), so we skip + // it since the constant wasn't marked as an external variable. + + continue; + } + } + + aie2aetMappings.emplace(internalEquation, type); + } + // Make our internal variables available through our API. std::map aiv2avMappings; @@ -3106,17 +3166,32 @@ void Analyser::AnalyserImpl::analyseModel(const ModelPtr &model) } } - // Populate and keep track of the state/variable. + // Retrieve the equations used to compute the variable. - auto variable = AnalyserVariable::AnalyserVariableImpl::create(); AnalyserEquationPtrs equations; + auto nlaEquation = false; for (const auto &internalEquation : mInternalEquations) { if (std::find(internalEquation->mUnknownVariables.begin(), internalEquation->mUnknownVariables.end(), internalVariable) != internalEquation->mUnknownVariables.end()) { equations.push_back(aie2aeMappings[internalEquation]); + + if ((aie2aetMappings.find(internalEquation) != aie2aetMappings.end()) + && (aie2aetMappings[internalEquation] == AnalyserEquation::Type::NLA)) { + nlaEquation = true; + } } } + // Correct the type of the variable if it is a computed constant that is computed using an NLA equation. + + if ((type == AnalyserVariable::Type::COMPUTED_CONSTANT) && nlaEquation) { + type = AnalyserVariable::Type::ALGEBRAIC; + } + + // Populate and keep track of the state/variable. + + auto variable = AnalyserVariable::AnalyserVariableImpl::create(); + variable->mPimpl->populate(type, (type == AnalyserVariable::Type::STATE) ? ++stateIndex : @@ -3162,57 +3237,13 @@ void Analyser::AnalyserImpl::analyseModel(const ModelPtr &model) } } - // Make our internal equations available through our API. + // Finish making our internal equations available through our API. for (const auto &internalEquation : mInternalEquations) { - // Determine whether the equation is an external one. - - auto externalEquation = true; - - for (const auto &unknownVariable : internalEquation->mUnknownVariables) { - if (aiv2avMappings[unknownVariable]->type() != AnalyserVariable::Type::EXTERNAL) { - externalEquation = false; + // Make sure that the type of the equation is known. - break; - } - } - - // Determine the type of the equation. - - AnalyserEquation::Type type; - - if (externalEquation) { - type = AnalyserEquation::Type::EXTERNAL; - } else { - switch (internalEquation->mType) { - case AnalyserInternalEquation::Type::TRUE_CONSTANT: - type = AnalyserEquation::Type::TRUE_CONSTANT; - - break; - case AnalyserInternalEquation::Type::VARIABLE_BASED_CONSTANT: - type = AnalyserEquation::Type::VARIABLE_BASED_CONSTANT; - - break; - case AnalyserInternalEquation::Type::ODE: - type = AnalyserEquation::Type::ODE; - - break; - case AnalyserInternalEquation::Type::NLA: - type = AnalyserEquation::Type::NLA; - - break; - case AnalyserInternalEquation::Type::ALGEBRAIC: - type = AnalyserEquation::Type::ALGEBRAIC; - - break; - default: // AnalyserEquation::Type::UNKNOWN. - // The equation type is unknown, which means that it is a dummy - // equation for a true (i.e. non-computed) constant (so that it - // could have been marked as an external variable), so we skip - // it since the constant wasn't marked as an external variable. - - continue; - } + if (aie2aetMappings.find(internalEquation) == aie2aetMappings.end()) { + continue; } // Scale our internal equation's AST to take into account the fact that @@ -3223,6 +3254,8 @@ void Analyser::AnalyserImpl::analyseModel(const ModelPtr &model) // Manipulate the equation, if needed. + auto type = aie2aetMappings[internalEquation]; + switch (type) { case AnalyserEquation::Type::NLA: // The equation is currently of the form LHS = RHS, but we want it diff --git a/src/generator.cpp b/src/generator.cpp index 23a46e90d8..9f62dfb957 100644 --- a/src/generator.cpp +++ b/src/generator.cpp @@ -1830,15 +1830,12 @@ void Generator::GeneratorImpl::addImplementationInitialiseVariablesMethodCode(st } } - // Initialise our constants and our algebraic variables that have an - // initial value. Also use an initial guess of zero for computed - // constants and algebraic variables computed using an NLA system. - // Note: a variable which is the only unknown in an equation, but which - // is not on its own on either the LHS or RHS of that equation - // (e.g., x = y+z with x and y known and z unknown) is (currently) - // to be computed using an NLA system for which we need an initial - // guess. We use an initial guess of zero, which is fine since - // such an NLA system has only one solution. + // Initialise our constants and our algebraic variables that have an initial value. Also use an initial guess of + // zero for algebraic variables computed using an NLA system. + // Note: a variable which is the only unknown in an equation, but which is not on its own on either the LHS or + // RHS of that equation (e.g., x = y+z with x and y known and z unknown) is (currently) to be computed + // using an NLA system for which we need an initial guess. We use an initial guess of zero, which is fine + // since such an NLA system has only one solution. for (const auto &variable : variables(mModel)) { switch (variable->type()) { @@ -1846,7 +1843,6 @@ void Generator::GeneratorImpl::addImplementationInitialiseVariablesMethodCode(st methodBody += generateInitialisationCode(variable); break; - case AnalyserVariable::Type::COMPUTED_CONSTANT: case AnalyserVariable::Type::ALGEBRAIC: if (variable->initialisingVariable() != nullptr) { methodBody += generateInitialisationCode(variable); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.c index 25ffe82fe0..51e1dd0e23 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.c @@ -10,8 +10,8 @@ const char LIBCELLML_VERSION[] = "0.5.0"; const size_t STATE_COUNT = 4; const size_t CONSTANT_COUNT = 5; -const size_t COMPUTED_CONSTANT_COUNT = 3; -const size_t ALGEBRAIC_COUNT = 10; +const size_t COMPUTED_CONSTANT_COUNT = 0; +const size_t ALGEBRAIC_COUNT = 13; const VariableInfo VOI_INFO = {"time", "millisecond", "environment"}; @@ -31,9 +31,6 @@ const VariableInfo CONSTANT_INFO[] = { }; const VariableInfo COMPUTED_CONSTANT_INFO[] = { - {"E_L", "millivolt", "leakage_current"}, - {"E_Na", "millivolt", "sodium_channel"}, - {"E_K", "millivolt", "potassium_channel"} }; const VariableInfo ALGEBRAIC_INFO[] = { @@ -41,10 +38,13 @@ const VariableInfo ALGEBRAIC_INFO[] = { {"i_L", "microA_per_cm2", "leakage_current"}, {"i_K", "microA_per_cm2", "potassium_channel"}, {"i_Na", "microA_per_cm2", "sodium_channel"}, + {"E_L", "millivolt", "leakage_current"}, + {"E_Na", "millivolt", "sodium_channel"}, {"alpha_m", "per_millisecond", "sodium_channel_m_gate"}, {"beta_m", "per_millisecond", "sodium_channel_m_gate"}, {"alpha_h", "per_millisecond", "sodium_channel_h_gate"}, {"beta_h", "per_millisecond", "sodium_channel_h_gate"}, + {"E_K", "millivolt", "potassium_channel"}, {"alpha_n", "per_millisecond", "potassium_channel_n_gate"}, {"beta_n", "per_millisecond", "potassium_channel_n_gate"} }; @@ -163,9 +163,9 @@ void objectiveFunction2(double *u, double *f, void *data) double *rates = ((RootFindingInfo *) data)->rates; double *variables = ((RootFindingInfo *) data)->variables; - computedConstants[0] = u[0]; + algebraic[4] = u[0]; - f[0] = computedConstants[0]-(constants[1]-10.613)-0.0; + f[0] = algebraic[4]-(constants[1]-10.613)-0.0; } void findRoot2(double voi, double *states, double *rates, double *variables) @@ -173,11 +173,11 @@ void findRoot2(double voi, double *states, double *rates, double *variables) RootFindingInfo rfi = { voi, states, rates, variables }; double u[1]; - u[0] = external[0]; + u[0] = algebraic[4]; nlaSolve(objectiveFunction2, u, 1, &rfi); - external[0] = u[0]; + algebraic[4] = u[0]; } void objectiveFunction3(double *u, double *f, void *data) @@ -189,7 +189,7 @@ void objectiveFunction3(double *u, double *f, void *data) algebraic[1] = u[0]; - f[0] = algebraic[1]-constants[2]*(states[0]-computedConstants[0])-0.0; + f[0] = algebraic[1]-constants[2]*(states[0]-algebraic[4])-0.0; } void findRoot3(double voi, double *states, double *rates, double *variables) @@ -211,9 +211,9 @@ void objectiveFunction4(double *u, double *f, void *data) double *rates = ((RootFindingInfo *) data)->rates; double *variables = ((RootFindingInfo *) data)->variables; - computedConstants[1] = u[0]; + algebraic[5] = u[0]; - f[0] = computedConstants[1]-(constants[1]-115.0)-0.0; + f[0] = algebraic[5]-(constants[1]-115.0)-0.0; } void findRoot4(double voi, double *states, double *rates, double *variables) @@ -221,11 +221,11 @@ void findRoot4(double voi, double *states, double *rates, double *variables) RootFindingInfo rfi = { voi, states, rates, variables }; double u[1]; - u[0] = external[1]; + u[0] = algebraic[5]; nlaSolve(objectiveFunction4, u, 1, &rfi); - external[1] = u[0]; + algebraic[5] = u[0]; } void objectiveFunction5(double *u, double *f, void *data) @@ -237,7 +237,7 @@ void objectiveFunction5(double *u, double *f, void *data) algebraic[3] = u[0]; - f[0] = algebraic[3]-constants[3]*pow(states[2], 3.0)*states[1]*(states[0]-computedConstants[1])-0.0; + f[0] = algebraic[3]-constants[3]*pow(states[2], 3.0)*states[1]*(states[0]-algebraic[5])-0.0; } void findRoot5(double voi, double *states, double *rates, double *variables) @@ -259,9 +259,9 @@ void objectiveFunction6(double *u, double *f, void *data) double *rates = ((RootFindingInfo *) data)->rates; double *variables = ((RootFindingInfo *) data)->variables; - algebraic[4] = u[0]; + algebraic[6] = u[0]; - f[0] = algebraic[4]-0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0)-0.0; + f[0] = algebraic[6]-0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0)-0.0; } void findRoot6(double voi, double *states, double *rates, double *variables) @@ -269,11 +269,11 @@ void findRoot6(double voi, double *states, double *rates, double *variables) RootFindingInfo rfi = { voi, states, rates, variables }; double u[1]; - u[0] = algebraic[4]; + u[0] = algebraic[6]; nlaSolve(objectiveFunction6, u, 1, &rfi); - algebraic[4] = u[0]; + algebraic[6] = u[0]; } void objectiveFunction7(double *u, double *f, void *data) @@ -283,9 +283,9 @@ void objectiveFunction7(double *u, double *f, void *data) double *rates = ((RootFindingInfo *) data)->rates; double *variables = ((RootFindingInfo *) data)->variables; - algebraic[5] = u[0]; + algebraic[7] = u[0]; - f[0] = algebraic[5]-4.0*exp(states[0]/18.0)-0.0; + f[0] = algebraic[7]-4.0*exp(states[0]/18.0)-0.0; } void findRoot7(double voi, double *states, double *rates, double *variables) @@ -293,11 +293,11 @@ void findRoot7(double voi, double *states, double *rates, double *variables) RootFindingInfo rfi = { voi, states, rates, variables }; double u[1]; - u[0] = algebraic[5]; + u[0] = algebraic[7]; nlaSolve(objectiveFunction7, u, 1, &rfi); - algebraic[5] = u[0]; + algebraic[7] = u[0]; } void objectiveFunction8(double *u, double *f, void *data) @@ -309,7 +309,7 @@ void objectiveFunction8(double *u, double *f, void *data) rates[2] = u[0]; - f[0] = rates[2]-(algebraic[4]*(1.0-states[2])-algebraic[5]*states[2])-0.0; + f[0] = rates[2]-(algebraic[6]*(1.0-states[2])-algebraic[7]*states[2])-0.0; } void findRoot8(double voi, double *states, double *rates, double *variables) @@ -331,9 +331,9 @@ void objectiveFunction9(double *u, double *f, void *data) double *rates = ((RootFindingInfo *) data)->rates; double *variables = ((RootFindingInfo *) data)->variables; - algebraic[6] = u[0]; + algebraic[8] = u[0]; - f[0] = algebraic[6]-0.07*exp(states[0]/20.0)-0.0; + f[0] = algebraic[8]-0.07*exp(states[0]/20.0)-0.0; } void findRoot9(double voi, double *states, double *rates, double *variables) @@ -341,11 +341,11 @@ void findRoot9(double voi, double *states, double *rates, double *variables) RootFindingInfo rfi = { voi, states, rates, variables }; double u[1]; - u[0] = algebraic[6]; + u[0] = algebraic[8]; nlaSolve(objectiveFunction9, u, 1, &rfi); - algebraic[6] = u[0]; + algebraic[8] = u[0]; } void objectiveFunction10(double *u, double *f, void *data) @@ -355,9 +355,9 @@ void objectiveFunction10(double *u, double *f, void *data) double *rates = ((RootFindingInfo *) data)->rates; double *variables = ((RootFindingInfo *) data)->variables; - algebraic[7] = u[0]; + algebraic[9] = u[0]; - f[0] = algebraic[7]-1.0/(exp((states[0]+30.0)/10.0)+1.0)-0.0; + f[0] = algebraic[9]-1.0/(exp((states[0]+30.0)/10.0)+1.0)-0.0; } void findRoot10(double voi, double *states, double *rates, double *variables) @@ -365,11 +365,11 @@ void findRoot10(double voi, double *states, double *rates, double *variables) RootFindingInfo rfi = { voi, states, rates, variables }; double u[1]; - u[0] = algebraic[7]; + u[0] = algebraic[9]; nlaSolve(objectiveFunction10, u, 1, &rfi); - algebraic[7] = u[0]; + algebraic[9] = u[0]; } void objectiveFunction11(double *u, double *f, void *data) @@ -381,7 +381,7 @@ void objectiveFunction11(double *u, double *f, void *data) rates[1] = u[0]; - f[0] = rates[1]-(algebraic[6]*(1.0-states[1])-algebraic[7]*states[1])-0.0; + f[0] = rates[1]-(algebraic[8]*(1.0-states[1])-algebraic[9]*states[1])-0.0; } void findRoot11(double voi, double *states, double *rates, double *variables) @@ -403,9 +403,9 @@ void objectiveFunction12(double *u, double *f, void *data) double *rates = ((RootFindingInfo *) data)->rates; double *variables = ((RootFindingInfo *) data)->variables; - computedConstants[2] = u[0]; + algebraic[10] = u[0]; - f[0] = computedConstants[2]-(constants[1]+12.0)-0.0; + f[0] = algebraic[10]-(constants[1]+12.0)-0.0; } void findRoot12(double voi, double *states, double *rates, double *variables) @@ -413,11 +413,11 @@ void findRoot12(double voi, double *states, double *rates, double *variables) RootFindingInfo rfi = { voi, states, rates, variables }; double u[1]; - u[0] = external[2]; + u[0] = algebraic[10]; nlaSolve(objectiveFunction12, u, 1, &rfi); - external[2] = u[0]; + algebraic[10] = u[0]; } void objectiveFunction13(double *u, double *f, void *data) @@ -429,7 +429,7 @@ void objectiveFunction13(double *u, double *f, void *data) algebraic[2] = u[0]; - f[0] = algebraic[2]-constants[4]*pow(states[3], 4.0)*(states[0]-computedConstants[2])-0.0; + f[0] = algebraic[2]-constants[4]*pow(states[3], 4.0)*(states[0]-algebraic[10])-0.0; } void findRoot13(double voi, double *states, double *rates, double *variables) @@ -451,9 +451,9 @@ void objectiveFunction14(double *u, double *f, void *data) double *rates = ((RootFindingInfo *) data)->rates; double *variables = ((RootFindingInfo *) data)->variables; - algebraic[8] = u[0]; + algebraic[11] = u[0]; - f[0] = algebraic[8]-0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0)-0.0; + f[0] = algebraic[11]-0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0)-0.0; } void findRoot14(double voi, double *states, double *rates, double *variables) @@ -461,11 +461,11 @@ void findRoot14(double voi, double *states, double *rates, double *variables) RootFindingInfo rfi = { voi, states, rates, variables }; double u[1]; - u[0] = algebraic[8]; + u[0] = algebraic[11]; nlaSolve(objectiveFunction14, u, 1, &rfi); - algebraic[8] = u[0]; + algebraic[11] = u[0]; } void objectiveFunction15(double *u, double *f, void *data) @@ -475,9 +475,9 @@ void objectiveFunction15(double *u, double *f, void *data) double *rates = ((RootFindingInfo *) data)->rates; double *variables = ((RootFindingInfo *) data)->variables; - algebraic[9] = u[0]; + algebraic[12] = u[0]; - f[0] = algebraic[9]-0.125*exp(states[0]/80.0)-0.0; + f[0] = algebraic[12]-0.125*exp(states[0]/80.0)-0.0; } void findRoot15(double voi, double *states, double *rates, double *variables) @@ -485,11 +485,11 @@ void findRoot15(double voi, double *states, double *rates, double *variables) RootFindingInfo rfi = { voi, states, rates, variables }; double u[1]; - u[0] = algebraic[9]; + u[0] = algebraic[12]; nlaSolve(objectiveFunction15, u, 1, &rfi); - algebraic[9] = u[0]; + algebraic[12] = u[0]; } void objectiveFunction16(double *u, double *f, void *data) @@ -501,7 +501,7 @@ void objectiveFunction16(double *u, double *f, void *data) rates[3] = u[0]; - f[0] = rates[3]-(algebraic[8]*(1.0-states[3])-algebraic[9]*states[3])-0.0; + f[0] = rates[3]-(algebraic[11]*(1.0-states[3])-algebraic[12]*states[3])-0.0; } void findRoot16(double voi, double *states, double *rates, double *variables) @@ -531,9 +531,6 @@ void initialiseVariables(double voi, double *states, double *rates, double *cons constants[2] = 0.3; constants[3] = 120.0; constants[4] = 36.0; - computedConstants[0] = 0.0; - computedConstants[1] = 0.0; - computedConstants[2] = 0.0; algebraic[0] = 0.0; algebraic[1] = 0.0; algebraic[2] = 0.0; @@ -544,6 +541,9 @@ void initialiseVariables(double voi, double *states, double *rates, double *cons algebraic[7] = 0.0; algebraic[8] = 0.0; algebraic[9] = 0.0; + algebraic[10] = 0.0; + algebraic[11] = 0.0; + algebraic[12] = 0.0; } void computeComputedConstants(double *constants, double *computedConstants) diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.py index 6a67ef4213..a42be47a53 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.py @@ -9,8 +9,8 @@ STATE_COUNT = 4 CONSTANT_COUNT = 5 -COMPUTED_CONSTANT_COUNT = 3 -ALGEBRAIC_COUNT = 10 +COMPUTED_CONSTANT_COUNT = 0 +ALGEBRAIC_COUNT = 13 VOI_INFO = {"name": "time", "units": "millisecond", "component": "environment"} @@ -30,9 +30,6 @@ ] COMPUTED_CONSTANT_INFO = [ - {"name": "E_L", "units": "millivolt", "component": "leakage_current"}, - {"name": "E_Na", "units": "millivolt", "component": "sodium_channel"}, - {"name": "E_K", "units": "millivolt", "component": "potassium_channel"} ] ALGEBRAIC_INFO = [ @@ -40,10 +37,13 @@ {"name": "i_L", "units": "microA_per_cm2", "component": "leakage_current"}, {"name": "i_K", "units": "microA_per_cm2", "component": "potassium_channel"}, {"name": "i_Na", "units": "microA_per_cm2", "component": "sodium_channel"}, + {"name": "E_L", "units": "millivolt", "component": "leakage_current"}, + {"name": "E_Na", "units": "millivolt", "component": "sodium_channel"}, {"name": "alpha_m", "units": "per_millisecond", "component": "sodium_channel_m_gate"}, {"name": "beta_m", "units": "per_millisecond", "component": "sodium_channel_m_gate"}, {"name": "alpha_h", "units": "per_millisecond", "component": "sodium_channel_h_gate"}, {"name": "beta_h", "units": "per_millisecond", "component": "sodium_channel_h_gate"}, + {"name": "E_K", "units": "millivolt", "component": "potassium_channel"}, {"name": "alpha_n", "units": "per_millisecond", "component": "potassium_channel_n_gate"}, {"name": "beta_n", "units": "per_millisecond", "component": "potassium_channel_n_gate"} ] @@ -128,19 +128,19 @@ def objective_function_2(u, f, data): rates = data[2] variables = data[3] - computed_constants[0] = u[0] + algebraic[4] = u[0] - f[0] = computed_constants[0]-(constants[1]-10.613)-0.0 + f[0] = algebraic[4]-(constants[1]-10.613)-0.0 def find_root_2(voi, states, rates, variables): u = [nan]*1 - u[0] = external[0] + u[0] = algebraic[4] u = nla_solve(objective_function_2, u, 1, [voi, states, rates, variables]) - external[0] = u[0] + algebraic[4] = u[0] def objective_function_3(u, f, data): @@ -151,7 +151,7 @@ def objective_function_3(u, f, data): algebraic[1] = u[0] - f[0] = algebraic[1]-constants[2]*(states[0]-computed_constants[0])-0.0 + f[0] = algebraic[1]-constants[2]*(states[0]-algebraic[4])-0.0 def find_root_3(voi, states, rates, variables): @@ -170,19 +170,19 @@ def objective_function_4(u, f, data): rates = data[2] variables = data[3] - computed_constants[1] = u[0] + algebraic[5] = u[0] - f[0] = computed_constants[1]-(constants[1]-115.0)-0.0 + f[0] = algebraic[5]-(constants[1]-115.0)-0.0 def find_root_4(voi, states, rates, variables): u = [nan]*1 - u[0] = external[1] + u[0] = algebraic[5] u = nla_solve(objective_function_4, u, 1, [voi, states, rates, variables]) - external[1] = u[0] + algebraic[5] = u[0] def objective_function_5(u, f, data): @@ -193,7 +193,7 @@ def objective_function_5(u, f, data): algebraic[3] = u[0] - f[0] = algebraic[3]-constants[3]*pow(states[2], 3.0)*states[1]*(states[0]-computed_constants[1])-0.0 + f[0] = algebraic[3]-constants[3]*pow(states[2], 3.0)*states[1]*(states[0]-algebraic[5])-0.0 def find_root_5(voi, states, rates, variables): @@ -212,19 +212,19 @@ def objective_function_6(u, f, data): rates = data[2] variables = data[3] - algebraic[4] = u[0] + algebraic[6] = u[0] - f[0] = algebraic[4]-0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0)-0.0 + f[0] = algebraic[6]-0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0)-0.0 def find_root_6(voi, states, rates, variables): u = [nan]*1 - u[0] = algebraic[4] + u[0] = algebraic[6] u = nla_solve(objective_function_6, u, 1, [voi, states, rates, variables]) - algebraic[4] = u[0] + algebraic[6] = u[0] def objective_function_7(u, f, data): @@ -233,19 +233,19 @@ def objective_function_7(u, f, data): rates = data[2] variables = data[3] - algebraic[5] = u[0] + algebraic[7] = u[0] - f[0] = algebraic[5]-4.0*exp(states[0]/18.0)-0.0 + f[0] = algebraic[7]-4.0*exp(states[0]/18.0)-0.0 def find_root_7(voi, states, rates, variables): u = [nan]*1 - u[0] = algebraic[5] + u[0] = algebraic[7] u = nla_solve(objective_function_7, u, 1, [voi, states, rates, variables]) - algebraic[5] = u[0] + algebraic[7] = u[0] def objective_function_8(u, f, data): @@ -256,7 +256,7 @@ def objective_function_8(u, f, data): rates[2] = u[0] - f[0] = rates[2]-(algebraic[4]*(1.0-states[2])-algebraic[5]*states[2])-0.0 + f[0] = rates[2]-(algebraic[6]*(1.0-states[2])-algebraic[7]*states[2])-0.0 def find_root_8(voi, states, rates, variables): @@ -275,19 +275,19 @@ def objective_function_9(u, f, data): rates = data[2] variables = data[3] - algebraic[6] = u[0] + algebraic[8] = u[0] - f[0] = algebraic[6]-0.07*exp(states[0]/20.0)-0.0 + f[0] = algebraic[8]-0.07*exp(states[0]/20.0)-0.0 def find_root_9(voi, states, rates, variables): u = [nan]*1 - u[0] = algebraic[6] + u[0] = algebraic[8] u = nla_solve(objective_function_9, u, 1, [voi, states, rates, variables]) - algebraic[6] = u[0] + algebraic[8] = u[0] def objective_function_10(u, f, data): @@ -296,19 +296,19 @@ def objective_function_10(u, f, data): rates = data[2] variables = data[3] - algebraic[7] = u[0] + algebraic[9] = u[0] - f[0] = algebraic[7]-1.0/(exp((states[0]+30.0)/10.0)+1.0)-0.0 + f[0] = algebraic[9]-1.0/(exp((states[0]+30.0)/10.0)+1.0)-0.0 def find_root_10(voi, states, rates, variables): u = [nan]*1 - u[0] = algebraic[7] + u[0] = algebraic[9] u = nla_solve(objective_function_10, u, 1, [voi, states, rates, variables]) - algebraic[7] = u[0] + algebraic[9] = u[0] def objective_function_11(u, f, data): @@ -319,7 +319,7 @@ def objective_function_11(u, f, data): rates[1] = u[0] - f[0] = rates[1]-(algebraic[6]*(1.0-states[1])-algebraic[7]*states[1])-0.0 + f[0] = rates[1]-(algebraic[8]*(1.0-states[1])-algebraic[9]*states[1])-0.0 def find_root_11(voi, states, rates, variables): @@ -338,19 +338,19 @@ def objective_function_12(u, f, data): rates = data[2] variables = data[3] - computed_constants[2] = u[0] + algebraic[10] = u[0] - f[0] = computed_constants[2]-(constants[1]+12.0)-0.0 + f[0] = algebraic[10]-(constants[1]+12.0)-0.0 def find_root_12(voi, states, rates, variables): u = [nan]*1 - u[0] = external[2] + u[0] = algebraic[10] u = nla_solve(objective_function_12, u, 1, [voi, states, rates, variables]) - external[2] = u[0] + algebraic[10] = u[0] def objective_function_13(u, f, data): @@ -361,7 +361,7 @@ def objective_function_13(u, f, data): algebraic[2] = u[0] - f[0] = algebraic[2]-constants[4]*pow(states[3], 4.0)*(states[0]-computed_constants[2])-0.0 + f[0] = algebraic[2]-constants[4]*pow(states[3], 4.0)*(states[0]-algebraic[10])-0.0 def find_root_13(voi, states, rates, variables): @@ -380,19 +380,19 @@ def objective_function_14(u, f, data): rates = data[2] variables = data[3] - algebraic[8] = u[0] + algebraic[11] = u[0] - f[0] = algebraic[8]-0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0)-0.0 + f[0] = algebraic[11]-0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0)-0.0 def find_root_14(voi, states, rates, variables): u = [nan]*1 - u[0] = algebraic[8] + u[0] = algebraic[11] u = nla_solve(objective_function_14, u, 1, [voi, states, rates, variables]) - algebraic[8] = u[0] + algebraic[11] = u[0] def objective_function_15(u, f, data): @@ -401,19 +401,19 @@ def objective_function_15(u, f, data): rates = data[2] variables = data[3] - algebraic[9] = u[0] + algebraic[12] = u[0] - f[0] = algebraic[9]-0.125*exp(states[0]/80.0)-0.0 + f[0] = algebraic[12]-0.125*exp(states[0]/80.0)-0.0 def find_root_15(voi, states, rates, variables): u = [nan]*1 - u[0] = algebraic[9] + u[0] = algebraic[12] u = nla_solve(objective_function_15, u, 1, [voi, states, rates, variables]) - algebraic[9] = u[0] + algebraic[12] = u[0] def objective_function_16(u, f, data): @@ -424,7 +424,7 @@ def objective_function_16(u, f, data): rates[3] = u[0] - f[0] = rates[3]-(algebraic[8]*(1.0-states[3])-algebraic[9]*states[3])-0.0 + f[0] = rates[3]-(algebraic[11]*(1.0-states[3])-algebraic[12]*states[3])-0.0 def find_root_16(voi, states, rates, variables): @@ -451,9 +451,6 @@ def initialise_variables(voi, states, rates, constants, algebraic): constants[2] = 0.3 constants[3] = 120.0 constants[4] = 36.0 - computed_constants[0] = 0.0 - computed_constants[1] = 0.0 - computed_constants[2] = 0.0 algebraic[0] = 0.0 algebraic[1] = 0.0 algebraic[2] = 0.0 @@ -464,6 +461,9 @@ def initialise_variables(voi, states, rates, constants, algebraic): algebraic[7] = 0.0 algebraic[8] = 0.0 algebraic[9] = 0.0 + algebraic[10] = 0.0 + algebraic[11] = 0.0 + algebraic[12] = 0.0 def compute_computed_constants(constants, computed_constants): From 153b4b50d25b4159d310e45cfdb7a386078d1e6f Mon Sep 17 00:00:00 2001 From: Alan Garny Date: Fri, 16 Aug 2024 18:13:10 +0200 Subject: [PATCH 30/85] Analyser: some minor cleaning up. Constants are indexed using makeConstant(). --- src/analyser.cpp | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/analyser.cpp b/src/analyser.cpp index 468fa16f8b..d5758379d1 100644 --- a/src/analyser.cpp +++ b/src/analyser.cpp @@ -208,8 +208,7 @@ struct AnalyserInternalEquation bool variableOnRhs(const AnalyserInternalVariablePtr &variable); bool variableOnLhsOrRhs(const AnalyserInternalVariablePtr &variable); - bool check(const AnalyserModelPtr &model, size_t &stateIndex, size_t &constantIndex, - size_t &computedConstantIndex, size_t &algebraicIndex, bool checkNlaSystems); + bool check(const AnalyserModelPtr &model, size_t &stateIndex, size_t &computedConstantIndex, size_t &algebraicIndex, bool checkNlaSystems); }; AnalyserInternalEquationPtr AnalyserInternalEquation::create(const ComponentPtr &component) @@ -322,9 +321,7 @@ bool AnalyserInternalEquation::variableOnLhsOrRhs(const AnalyserInternalVariable } bool AnalyserInternalEquation::check(const AnalyserModelPtr &model, - size_t &stateIndex, size_t &constantIndex, - size_t &computedConstantIndex, size_t &algebraicIndex, - bool checkNlaSystems) + size_t &stateIndex, size_t &computedConstantIndex, size_t &algebraicIndex, bool checkNlaSystems) { // Nothing to check if the equation has a known type. @@ -439,8 +436,6 @@ bool AnalyserInternalEquation::check(const AnalyserModelPtr &model, case AnalyserInternalVariable::Type::ALGEBRAIC: variable->mIndex = (variable->mType == AnalyserInternalVariable::Type::STATE) ? ++stateIndex : - (variable->mType == AnalyserInternalVariable::Type::CONSTANT) ? - ++constantIndex : ((variable->mType == AnalyserInternalVariable::Type::COMPUTED_TRUE_CONSTANT) || (variable->mType == AnalyserInternalVariable::Type::COMPUTED_VARIABLE_BASED_CONSTANT)) ? ++computedConstantIndex : @@ -2766,8 +2761,7 @@ void Analyser::AnalyserImpl::analyseModel(const ModelPtr &model) relevantCheck = false; for (const auto &internalEquation : mInternalEquations) { - relevantCheck = internalEquation->check(mModel, stateIndex, constantIndex, computedConstantIndex, - algebraicIndex, checkNlaSystems) + relevantCheck = internalEquation->check(mModel, stateIndex, computedConstantIndex, algebraicIndex, checkNlaSystems) || relevantCheck; } From 19126a88da358d15cac81c0eb830de09db77d52a Mon Sep 17 00:00:00 2001 From: Alan Garny Date: Fri, 16 Aug 2024 18:29:05 +0200 Subject: [PATCH 31/85] Analyser: properly set the index of external variables. --- src/analyser.cpp | 5 +- .../model.external.c | 4 +- .../model.external.py | 4 +- .../cell_geometry_model/model.external.c | 6 +- .../cell_geometry_model/model.external.py | 6 +- .../model.algebraic.c | 44 +++++++------- .../model.algebraic.py | 44 +++++++------- .../model.computed.constant.c | 38 ++++++------ .../model.computed.constant.py | 38 ++++++------ .../model.constant.c | 36 ++++++------ .../model.constant.py | 36 ++++++------ .../model.dependent.algebraic.c | 44 +++++++------- .../model.dependent.algebraic.py | 44 +++++++------- .../model.dependent.computed.constant.c | 58 +++++++++---------- .../model.dependent.computed.constant.py | 58 +++++++++---------- .../model.dependent.constant.c | 44 +++++++------- .../model.dependent.constant.py | 44 +++++++------- .../model.dependent.state.c | 26 ++++----- .../model.dependent.state.py | 26 ++++----- .../model.external.c | 28 ++++----- .../model.external.py | 28 ++++----- .../model.state.c | 32 +++++----- .../model.state.py | 32 +++++----- .../model.c | 4 +- .../model.py | 4 +- 25 files changed, 368 insertions(+), 365 deletions(-) diff --git a/src/analyser.cpp b/src/analyser.cpp index d5758379d1..8670ec3928 100644 --- a/src/analyser.cpp +++ b/src/analyser.cpp @@ -3120,6 +3120,7 @@ void Analyser::AnalyserImpl::analyseModel(const ModelPtr &model) std::map aiv2avMappings; std::map v2avMappings; + auto externalIndex = MAX_SIZE_T; stateIndex = MAX_SIZE_T; constantIndex = MAX_SIZE_T; @@ -3193,7 +3194,9 @@ void Analyser::AnalyserImpl::analyseModel(const ModelPtr &model) ++constantIndex : (type == AnalyserVariable::Type::COMPUTED_CONSTANT) ? ++computedConstantIndex : - ++algebraicIndex, + (type == AnalyserVariable::Type::ALGEBRAIC) ? + ++algebraicIndex : + ++externalIndex, (type == AnalyserVariable::Type::EXTERNAL) ? nullptr : internalVariable->mInitialisingVariable, diff --git a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.c b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.c index cae10b971b..5cea89727f 100644 --- a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.c +++ b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.c @@ -86,6 +86,6 @@ void computeComputedConstants(double *constants, double *computedConstants) void computeVariables(double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) { - external[1] = externalVariable(variables, 1); - algebraic[0] = external[1]; + external[0] = externalVariable(variables, 0); + algebraic[0] = external[0]; } diff --git a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.py b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.py index 293eda06d1..8ce48759d5 100644 --- a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.py +++ b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.py @@ -52,5 +52,5 @@ def compute_computed_constants(constants, computed_constants): def compute_variables(constants, computed_constants, algebraic, external_variable): - external[1] = external_variable(variables, 1) - algebraic[0] = external[1] + external[0] = external_variable(variables, 0) + algebraic[0] = external[0] diff --git a/tests/resources/generator/cell_geometry_model/model.external.c b/tests/resources/generator/cell_geometry_model/model.external.c index d20c187693..c4c33c7c07 100644 --- a/tests/resources/generator/cell_geometry_model/model.external.c +++ b/tests/resources/generator/cell_geometry_model/model.external.c @@ -88,8 +88,8 @@ void computeComputedConstants(double *constants, double *computedConstants) void computeVariables(double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) { + external[0] = externalVariable(variables, 0); external[1] = externalVariable(variables, 1); - external[2] = externalVariable(variables, 2); - algebraic[0] = 1000.0*3.14*external[2]*external[2]*external[1]; - algebraic[3] = 0.02*algebraic[0]; + algebraic[0] = 1000.0*3.14*external[1]*external[1]*external[0]; + algebraic[1] = 0.02*algebraic[0]; } diff --git a/tests/resources/generator/cell_geometry_model/model.external.py b/tests/resources/generator/cell_geometry_model/model.external.py index 734dbc14ee..8f9555d5cb 100644 --- a/tests/resources/generator/cell_geometry_model/model.external.py +++ b/tests/resources/generator/cell_geometry_model/model.external.py @@ -54,7 +54,7 @@ def compute_computed_constants(constants, computed_constants): def compute_variables(constants, computed_constants, algebraic, external_variable): + external[0] = external_variable(variables, 0) external[1] = external_variable(variables, 1) - external[2] = external_variable(variables, 2) - algebraic[0] = 1000.0*3.14*external[2]*external[2]*external[1] - algebraic[3] = 0.02*algebraic[0] + algebraic[0] = 1000.0*3.14*external[1]*external[1]*external[0] + algebraic[1] = 0.02*algebraic[0] diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.c index d81cafe4e8..3ca0c5371b 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.c @@ -136,31 +136,31 @@ void computeComputedConstants(double *constants, double *computedConstants) void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) { external[0] = externalVariable(voi, states, rates, variables, 0); - algebraic[1] = constants[2]*(states[0]-computedConstants[0]); - algebraic[2] = constants[4]*pow(states[3], 4.0)*(states[0]-computedConstants[2]); - algebraic[3] = constants[3]*pow(states[2], 3.0)*states[1]*(states[0]-computedConstants[1]); - rates[0] = -(-external[0]+algebraic[3]+algebraic[2]+algebraic[1])/constants[0]; - algebraic[4] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0); - algebraic[5] = 4.0*exp(states[0]/18.0); - rates[2] = algebraic[4]*(1.0-states[2])-algebraic[5]*states[2]; - algebraic[6] = 0.07*exp(states[0]/20.0); - algebraic[7] = 1.0/(exp((states[0]+30.0)/10.0)+1.0); - rates[1] = algebraic[6]*(1.0-states[1])-algebraic[7]*states[1]; - algebraic[8] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0); - algebraic[9] = 0.125*exp(states[0]/80.0); - rates[3] = algebraic[8]*(1.0-states[3])-algebraic[9]*states[3]; + algebraic[0] = constants[2]*(states[0]-computedConstants[0]); + algebraic[1] = constants[4]*pow(states[3], 4.0)*(states[0]-computedConstants[2]); + algebraic[2] = constants[3]*pow(states[2], 3.0)*states[1]*(states[0]-computedConstants[1]); + rates[0] = -(-external[0]+algebraic[2]+algebraic[1]+algebraic[0])/constants[0]; + algebraic[3] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0); + algebraic[4] = 4.0*exp(states[0]/18.0); + rates[2] = algebraic[3]*(1.0-states[2])-algebraic[4]*states[2]; + algebraic[5] = 0.07*exp(states[0]/20.0); + algebraic[6] = 1.0/(exp((states[0]+30.0)/10.0)+1.0); + rates[1] = algebraic[5]*(1.0-states[1])-algebraic[6]*states[1]; + algebraic[7] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0); + algebraic[8] = 0.125*exp(states[0]/80.0); + rates[3] = algebraic[7]*(1.0-states[3])-algebraic[8]*states[3]; } void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) { external[0] = externalVariable(voi, states, rates, variables, 0); - algebraic[1] = constants[2]*(states[0]-computedConstants[0]); - algebraic[3] = constants[3]*pow(states[2], 3.0)*states[1]*(states[0]-computedConstants[1]); - algebraic[4] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0); - algebraic[5] = 4.0*exp(states[0]/18.0); - algebraic[6] = 0.07*exp(states[0]/20.0); - algebraic[7] = 1.0/(exp((states[0]+30.0)/10.0)+1.0); - algebraic[2] = constants[4]*pow(states[3], 4.0)*(states[0]-computedConstants[2]); - algebraic[8] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0); - algebraic[9] = 0.125*exp(states[0]/80.0); + algebraic[0] = constants[2]*(states[0]-computedConstants[0]); + algebraic[2] = constants[3]*pow(states[2], 3.0)*states[1]*(states[0]-computedConstants[1]); + algebraic[3] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0); + algebraic[4] = 4.0*exp(states[0]/18.0); + algebraic[5] = 0.07*exp(states[0]/20.0); + algebraic[6] = 1.0/(exp((states[0]+30.0)/10.0)+1.0); + algebraic[1] = constants[4]*pow(states[3], 4.0)*(states[0]-computedConstants[2]); + algebraic[7] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0); + algebraic[8] = 0.125*exp(states[0]/80.0); } diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.py index ddf22acb14..bbc403eae2 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.py @@ -105,29 +105,29 @@ def compute_computed_constants(constants, computed_constants): def compute_rates(voi, states, rates, constants, computed_constants, algebraic, external_variable): external[0] = external_variable(voi, states, rates, variables, 0) - algebraic[1] = constants[2]*(states[0]-computed_constants[0]) - algebraic[2] = constants[4]*pow(states[3], 4.0)*(states[0]-computed_constants[2]) - algebraic[3] = constants[3]*pow(states[2], 3.0)*states[1]*(states[0]-computed_constants[1]) - rates[0] = -(-external[0]+algebraic[3]+algebraic[2]+algebraic[1])/constants[0] - algebraic[4] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0) - algebraic[5] = 4.0*exp(states[0]/18.0) - rates[2] = algebraic[4]*(1.0-states[2])-algebraic[5]*states[2] - algebraic[6] = 0.07*exp(states[0]/20.0) - algebraic[7] = 1.0/(exp((states[0]+30.0)/10.0)+1.0) - rates[1] = algebraic[6]*(1.0-states[1])-algebraic[7]*states[1] - algebraic[8] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0) - algebraic[9] = 0.125*exp(states[0]/80.0) - rates[3] = algebraic[8]*(1.0-states[3])-algebraic[9]*states[3] + algebraic[0] = constants[2]*(states[0]-computed_constants[0]) + algebraic[1] = constants[4]*pow(states[3], 4.0)*(states[0]-computed_constants[2]) + algebraic[2] = constants[3]*pow(states[2], 3.0)*states[1]*(states[0]-computed_constants[1]) + rates[0] = -(-external[0]+algebraic[2]+algebraic[1]+algebraic[0])/constants[0] + algebraic[3] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0) + algebraic[4] = 4.0*exp(states[0]/18.0) + rates[2] = algebraic[3]*(1.0-states[2])-algebraic[4]*states[2] + algebraic[5] = 0.07*exp(states[0]/20.0) + algebraic[6] = 1.0/(exp((states[0]+30.0)/10.0)+1.0) + rates[1] = algebraic[5]*(1.0-states[1])-algebraic[6]*states[1] + algebraic[7] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0) + algebraic[8] = 0.125*exp(states[0]/80.0) + rates[3] = algebraic[7]*(1.0-states[3])-algebraic[8]*states[3] def compute_variables(voi, states, rates, constants, computed_constants, algebraic, external_variable): external[0] = external_variable(voi, states, rates, variables, 0) - algebraic[1] = constants[2]*(states[0]-computed_constants[0]) - algebraic[3] = constants[3]*pow(states[2], 3.0)*states[1]*(states[0]-computed_constants[1]) - algebraic[4] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0) - algebraic[5] = 4.0*exp(states[0]/18.0) - algebraic[6] = 0.07*exp(states[0]/20.0) - algebraic[7] = 1.0/(exp((states[0]+30.0)/10.0)+1.0) - algebraic[2] = constants[4]*pow(states[3], 4.0)*(states[0]-computed_constants[2]) - algebraic[8] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0) - algebraic[9] = 0.125*exp(states[0]/80.0) + algebraic[0] = constants[2]*(states[0]-computed_constants[0]) + algebraic[2] = constants[3]*pow(states[2], 3.0)*states[1]*(states[0]-computed_constants[1]) + algebraic[3] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0) + algebraic[4] = 4.0*exp(states[0]/18.0) + algebraic[5] = 0.07*exp(states[0]/20.0) + algebraic[6] = 1.0/(exp((states[0]+30.0)/10.0)+1.0) + algebraic[1] = constants[4]*pow(states[3], 4.0)*(states[0]-computed_constants[2]) + algebraic[7] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0) + algebraic[8] = 0.125*exp(states[0]/80.0) diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.c index 42fbe04210..9de4002c1f 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.c @@ -135,32 +135,32 @@ void computeComputedConstants(double *constants, double *computedConstants) void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) { algebraic[0] = ((voi >= 10.0) && (voi <= 10.5))?-20.0:0.0; - external[4] = externalVariable(voi, states, rates, variables, 4); - algebraic[1] = constants[2]*(states[0]-external[4]); + external[0] = externalVariable(voi, states, rates, variables, 0); + algebraic[1] = constants[2]*(states[0]-external[0]); algebraic[2] = constants[4]*pow(states[3], 4.0)*(states[0]-computedConstants[1]); algebraic[3] = constants[3]*pow(states[2], 3.0)*states[1]*(states[0]-computedConstants[0]); rates[0] = -(-algebraic[0]+algebraic[3]+algebraic[2]+algebraic[1])/constants[0]; - algebraic[5] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0); - algebraic[6] = 4.0*exp(states[0]/18.0); - rates[2] = algebraic[5]*(1.0-states[2])-algebraic[6]*states[2]; - algebraic[7] = 0.07*exp(states[0]/20.0); - algebraic[8] = 1.0/(exp((states[0]+30.0)/10.0)+1.0); - rates[1] = algebraic[7]*(1.0-states[1])-algebraic[8]*states[1]; - algebraic[9] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0); - algebraic[10] = 0.125*exp(states[0]/80.0); - rates[3] = algebraic[9]*(1.0-states[3])-algebraic[10]*states[3]; + algebraic[4] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0); + algebraic[5] = 4.0*exp(states[0]/18.0); + rates[2] = algebraic[4]*(1.0-states[2])-algebraic[5]*states[2]; + algebraic[6] = 0.07*exp(states[0]/20.0); + algebraic[7] = 1.0/(exp((states[0]+30.0)/10.0)+1.0); + rates[1] = algebraic[6]*(1.0-states[1])-algebraic[7]*states[1]; + algebraic[8] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0); + algebraic[9] = 0.125*exp(states[0]/80.0); + rates[3] = algebraic[8]*(1.0-states[3])-algebraic[9]*states[3]; } void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) { - external[4] = externalVariable(voi, states, rates, variables, 4); - algebraic[1] = constants[2]*(states[0]-external[4]); + external[0] = externalVariable(voi, states, rates, variables, 0); + algebraic[1] = constants[2]*(states[0]-external[0]); algebraic[3] = constants[3]*pow(states[2], 3.0)*states[1]*(states[0]-computedConstants[0]); - algebraic[5] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0); - algebraic[6] = 4.0*exp(states[0]/18.0); - algebraic[7] = 0.07*exp(states[0]/20.0); - algebraic[8] = 1.0/(exp((states[0]+30.0)/10.0)+1.0); + algebraic[4] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0); + algebraic[5] = 4.0*exp(states[0]/18.0); + algebraic[6] = 0.07*exp(states[0]/20.0); + algebraic[7] = 1.0/(exp((states[0]+30.0)/10.0)+1.0); algebraic[2] = constants[4]*pow(states[3], 4.0)*(states[0]-computedConstants[1]); - algebraic[9] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0); - algebraic[10] = 0.125*exp(states[0]/80.0); + algebraic[8] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0); + algebraic[9] = 0.125*exp(states[0]/80.0); } diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.py index ebabb1f34f..a9fd749a9f 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.py @@ -104,30 +104,30 @@ def compute_computed_constants(constants, computed_constants): def compute_rates(voi, states, rates, constants, computed_constants, algebraic, external_variable): algebraic[0] = -20.0 if and_func(geq_func(voi, 10.0), leq_func(voi, 10.5)) else 0.0 - external[4] = external_variable(voi, states, rates, variables, 4) - algebraic[1] = constants[2]*(states[0]-external[4]) + external[0] = external_variable(voi, states, rates, variables, 0) + algebraic[1] = constants[2]*(states[0]-external[0]) algebraic[2] = constants[4]*pow(states[3], 4.0)*(states[0]-computed_constants[1]) algebraic[3] = constants[3]*pow(states[2], 3.0)*states[1]*(states[0]-computed_constants[0]) rates[0] = -(-algebraic[0]+algebraic[3]+algebraic[2]+algebraic[1])/constants[0] - algebraic[5] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0) - algebraic[6] = 4.0*exp(states[0]/18.0) - rates[2] = algebraic[5]*(1.0-states[2])-algebraic[6]*states[2] - algebraic[7] = 0.07*exp(states[0]/20.0) - algebraic[8] = 1.0/(exp((states[0]+30.0)/10.0)+1.0) - rates[1] = algebraic[7]*(1.0-states[1])-algebraic[8]*states[1] - algebraic[9] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0) - algebraic[10] = 0.125*exp(states[0]/80.0) - rates[3] = algebraic[9]*(1.0-states[3])-algebraic[10]*states[3] + algebraic[4] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0) + algebraic[5] = 4.0*exp(states[0]/18.0) + rates[2] = algebraic[4]*(1.0-states[2])-algebraic[5]*states[2] + algebraic[6] = 0.07*exp(states[0]/20.0) + algebraic[7] = 1.0/(exp((states[0]+30.0)/10.0)+1.0) + rates[1] = algebraic[6]*(1.0-states[1])-algebraic[7]*states[1] + algebraic[8] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0) + algebraic[9] = 0.125*exp(states[0]/80.0) + rates[3] = algebraic[8]*(1.0-states[3])-algebraic[9]*states[3] def compute_variables(voi, states, rates, constants, computed_constants, algebraic, external_variable): - external[4] = external_variable(voi, states, rates, variables, 4) - algebraic[1] = constants[2]*(states[0]-external[4]) + external[0] = external_variable(voi, states, rates, variables, 0) + algebraic[1] = constants[2]*(states[0]-external[0]) algebraic[3] = constants[3]*pow(states[2], 3.0)*states[1]*(states[0]-computed_constants[0]) - algebraic[5] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0) - algebraic[6] = 4.0*exp(states[0]/18.0) - algebraic[7] = 0.07*exp(states[0]/20.0) - algebraic[8] = 1.0/(exp((states[0]+30.0)/10.0)+1.0) + algebraic[4] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0) + algebraic[5] = 4.0*exp(states[0]/18.0) + algebraic[6] = 0.07*exp(states[0]/20.0) + algebraic[7] = 1.0/(exp((states[0]+30.0)/10.0)+1.0) algebraic[2] = constants[4]*pow(states[3], 4.0)*(states[0]-computed_constants[1]) - algebraic[9] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0) - algebraic[10] = 0.125*exp(states[0]/80.0) + algebraic[8] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0) + algebraic[9] = 0.125*exp(states[0]/80.0) diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.c index 48d1499945..83398ea28e 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.c @@ -135,32 +135,32 @@ void computeComputedConstants(double *constants, double *computedConstants) void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) { algebraic[0] = ((voi >= 10.0) && (voi <= 10.5))?-20.0:0.0; - external[4] = externalVariable(voi, states, rates, variables, 4); + external[0] = externalVariable(voi, states, rates, variables, 0); algebraic[1] = constants[1]*(states[0]-computedConstants[0]); algebraic[2] = constants[3]*pow(states[3], 4.0)*(states[0]-computedConstants[2]); algebraic[3] = constants[2]*pow(states[2], 3.0)*states[1]*(states[0]-computedConstants[1]); - rates[0] = -(-algebraic[0]+algebraic[3]+algebraic[2]+algebraic[1])/external[4]; - algebraic[5] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0); - algebraic[6] = 4.0*exp(states[0]/18.0); - rates[2] = algebraic[5]*(1.0-states[2])-algebraic[6]*states[2]; - algebraic[7] = 0.07*exp(states[0]/20.0); - algebraic[8] = 1.0/(exp((states[0]+30.0)/10.0)+1.0); - rates[1] = algebraic[7]*(1.0-states[1])-algebraic[8]*states[1]; - algebraic[9] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0); - algebraic[10] = 0.125*exp(states[0]/80.0); - rates[3] = algebraic[9]*(1.0-states[3])-algebraic[10]*states[3]; + rates[0] = -(-algebraic[0]+algebraic[3]+algebraic[2]+algebraic[1])/external[0]; + algebraic[4] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0); + algebraic[5] = 4.0*exp(states[0]/18.0); + rates[2] = algebraic[4]*(1.0-states[2])-algebraic[5]*states[2]; + algebraic[6] = 0.07*exp(states[0]/20.0); + algebraic[7] = 1.0/(exp((states[0]+30.0)/10.0)+1.0); + rates[1] = algebraic[6]*(1.0-states[1])-algebraic[7]*states[1]; + algebraic[8] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0); + algebraic[9] = 0.125*exp(states[0]/80.0); + rates[3] = algebraic[8]*(1.0-states[3])-algebraic[9]*states[3]; } void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) { algebraic[1] = constants[1]*(states[0]-computedConstants[0]); algebraic[3] = constants[2]*pow(states[2], 3.0)*states[1]*(states[0]-computedConstants[1]); - algebraic[5] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0); - algebraic[6] = 4.0*exp(states[0]/18.0); - algebraic[7] = 0.07*exp(states[0]/20.0); - algebraic[8] = 1.0/(exp((states[0]+30.0)/10.0)+1.0); + algebraic[4] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0); + algebraic[5] = 4.0*exp(states[0]/18.0); + algebraic[6] = 0.07*exp(states[0]/20.0); + algebraic[7] = 1.0/(exp((states[0]+30.0)/10.0)+1.0); algebraic[2] = constants[3]*pow(states[3], 4.0)*(states[0]-computedConstants[2]); - algebraic[9] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0); - algebraic[10] = 0.125*exp(states[0]/80.0); - external[4] = externalVariable(voi, states, rates, variables, 4); + algebraic[8] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0); + algebraic[9] = 0.125*exp(states[0]/80.0); + external[0] = externalVariable(voi, states, rates, variables, 0); } diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.py index 82efd710e2..e5b7943357 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.py @@ -104,30 +104,30 @@ def compute_computed_constants(constants, computed_constants): def compute_rates(voi, states, rates, constants, computed_constants, algebraic, external_variable): algebraic[0] = -20.0 if and_func(geq_func(voi, 10.0), leq_func(voi, 10.5)) else 0.0 - external[4] = external_variable(voi, states, rates, variables, 4) + external[0] = external_variable(voi, states, rates, variables, 0) algebraic[1] = constants[1]*(states[0]-computed_constants[0]) algebraic[2] = constants[3]*pow(states[3], 4.0)*(states[0]-computed_constants[2]) algebraic[3] = constants[2]*pow(states[2], 3.0)*states[1]*(states[0]-computed_constants[1]) - rates[0] = -(-algebraic[0]+algebraic[3]+algebraic[2]+algebraic[1])/external[4] - algebraic[5] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0) - algebraic[6] = 4.0*exp(states[0]/18.0) - rates[2] = algebraic[5]*(1.0-states[2])-algebraic[6]*states[2] - algebraic[7] = 0.07*exp(states[0]/20.0) - algebraic[8] = 1.0/(exp((states[0]+30.0)/10.0)+1.0) - rates[1] = algebraic[7]*(1.0-states[1])-algebraic[8]*states[1] - algebraic[9] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0) - algebraic[10] = 0.125*exp(states[0]/80.0) - rates[3] = algebraic[9]*(1.0-states[3])-algebraic[10]*states[3] + rates[0] = -(-algebraic[0]+algebraic[3]+algebraic[2]+algebraic[1])/external[0] + algebraic[4] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0) + algebraic[5] = 4.0*exp(states[0]/18.0) + rates[2] = algebraic[4]*(1.0-states[2])-algebraic[5]*states[2] + algebraic[6] = 0.07*exp(states[0]/20.0) + algebraic[7] = 1.0/(exp((states[0]+30.0)/10.0)+1.0) + rates[1] = algebraic[6]*(1.0-states[1])-algebraic[7]*states[1] + algebraic[8] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0) + algebraic[9] = 0.125*exp(states[0]/80.0) + rates[3] = algebraic[8]*(1.0-states[3])-algebraic[9]*states[3] def compute_variables(voi, states, rates, constants, computed_constants, algebraic, external_variable): algebraic[1] = constants[1]*(states[0]-computed_constants[0]) algebraic[3] = constants[2]*pow(states[2], 3.0)*states[1]*(states[0]-computed_constants[1]) - algebraic[5] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0) - algebraic[6] = 4.0*exp(states[0]/18.0) - algebraic[7] = 0.07*exp(states[0]/20.0) - algebraic[8] = 1.0/(exp((states[0]+30.0)/10.0)+1.0) + algebraic[4] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0) + algebraic[5] = 4.0*exp(states[0]/18.0) + algebraic[6] = 0.07*exp(states[0]/20.0) + algebraic[7] = 1.0/(exp((states[0]+30.0)/10.0)+1.0) algebraic[2] = constants[3]*pow(states[3], 4.0)*(states[0]-computed_constants[2]) - algebraic[9] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0) - algebraic[10] = 0.125*exp(states[0]/80.0) - external[4] = external_variable(voi, states, rates, variables, 4) + algebraic[8] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0) + algebraic[9] = 0.125*exp(states[0]/80.0) + external[0] = external_variable(voi, states, rates, variables, 0) diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.c index 6631f821e2..63f4f05721 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.c @@ -135,32 +135,32 @@ void computeComputedConstants(double *constants, double *computedConstants) void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) { - external[9] = externalVariable(voi, states, rates, variables, 9); + external[1] = externalVariable(voi, states, rates, variables, 1); external[0] = externalVariable(voi, states, rates, variables, 0); - algebraic[1] = constants[2]*(states[0]-computedConstants[0]); - algebraic[2] = constants[4]*pow(states[3], 4.0)*(states[0]-computedConstants[2]); - algebraic[3] = constants[3]*pow(states[2], 3.0)*states[1]*(states[0]-computedConstants[1]); - rates[0] = -(-external[0]+algebraic[3]+algebraic[2]+algebraic[1])/constants[0]; - algebraic[4] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0); - algebraic[5] = 4.0*exp(states[0]/18.0); - rates[2] = algebraic[4]*(1.0-states[2])-algebraic[5]*states[2]; - algebraic[6] = 0.07*exp(states[0]/20.0); - algebraic[7] = 1.0/(exp((states[0]+30.0)/10.0)+1.0); - rates[1] = algebraic[6]*(1.0-states[1])-algebraic[7]*states[1]; - algebraic[8] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0); - rates[3] = algebraic[8]*(1.0-states[3])-external[9]*states[3]; + algebraic[0] = constants[2]*(states[0]-computedConstants[0]); + algebraic[1] = constants[4]*pow(states[3], 4.0)*(states[0]-computedConstants[2]); + algebraic[2] = constants[3]*pow(states[2], 3.0)*states[1]*(states[0]-computedConstants[1]); + rates[0] = -(-external[0]+algebraic[2]+algebraic[1]+algebraic[0])/constants[0]; + algebraic[3] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0); + algebraic[4] = 4.0*exp(states[0]/18.0); + rates[2] = algebraic[3]*(1.0-states[2])-algebraic[4]*states[2]; + algebraic[5] = 0.07*exp(states[0]/20.0); + algebraic[6] = 1.0/(exp((states[0]+30.0)/10.0)+1.0); + rates[1] = algebraic[5]*(1.0-states[1])-algebraic[6]*states[1]; + algebraic[7] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0); + rates[3] = algebraic[7]*(1.0-states[3])-external[1]*states[3]; } void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) { - external[9] = externalVariable(voi, states, rates, variables, 9); + external[1] = externalVariable(voi, states, rates, variables, 1); external[0] = externalVariable(voi, states, rates, variables, 0); - algebraic[1] = constants[2]*(states[0]-computedConstants[0]); - algebraic[3] = constants[3]*pow(states[2], 3.0)*states[1]*(states[0]-computedConstants[1]); - algebraic[4] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0); - algebraic[5] = 4.0*exp(states[0]/18.0); - algebraic[6] = 0.07*exp(states[0]/20.0); - algebraic[7] = 1.0/(exp((states[0]+30.0)/10.0)+1.0); - algebraic[2] = constants[4]*pow(states[3], 4.0)*(states[0]-computedConstants[2]); - algebraic[8] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0); + algebraic[0] = constants[2]*(states[0]-computedConstants[0]); + algebraic[2] = constants[3]*pow(states[2], 3.0)*states[1]*(states[0]-computedConstants[1]); + algebraic[3] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0); + algebraic[4] = 4.0*exp(states[0]/18.0); + algebraic[5] = 0.07*exp(states[0]/20.0); + algebraic[6] = 1.0/(exp((states[0]+30.0)/10.0)+1.0); + algebraic[1] = constants[4]*pow(states[3], 4.0)*(states[0]-computedConstants[2]); + algebraic[7] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0); } diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.py index 69623430c6..e78d84cca9 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.py @@ -104,30 +104,30 @@ def compute_computed_constants(constants, computed_constants): def compute_rates(voi, states, rates, constants, computed_constants, algebraic, external_variable): - external[9] = external_variable(voi, states, rates, variables, 9) + external[1] = external_variable(voi, states, rates, variables, 1) external[0] = external_variable(voi, states, rates, variables, 0) - algebraic[1] = constants[2]*(states[0]-computed_constants[0]) - algebraic[2] = constants[4]*pow(states[3], 4.0)*(states[0]-computed_constants[2]) - algebraic[3] = constants[3]*pow(states[2], 3.0)*states[1]*(states[0]-computed_constants[1]) - rates[0] = -(-external[0]+algebraic[3]+algebraic[2]+algebraic[1])/constants[0] - algebraic[4] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0) - algebraic[5] = 4.0*exp(states[0]/18.0) - rates[2] = algebraic[4]*(1.0-states[2])-algebraic[5]*states[2] - algebraic[6] = 0.07*exp(states[0]/20.0) - algebraic[7] = 1.0/(exp((states[0]+30.0)/10.0)+1.0) - rates[1] = algebraic[6]*(1.0-states[1])-algebraic[7]*states[1] - algebraic[8] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0) - rates[3] = algebraic[8]*(1.0-states[3])-external[9]*states[3] + algebraic[0] = constants[2]*(states[0]-computed_constants[0]) + algebraic[1] = constants[4]*pow(states[3], 4.0)*(states[0]-computed_constants[2]) + algebraic[2] = constants[3]*pow(states[2], 3.0)*states[1]*(states[0]-computed_constants[1]) + rates[0] = -(-external[0]+algebraic[2]+algebraic[1]+algebraic[0])/constants[0] + algebraic[3] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0) + algebraic[4] = 4.0*exp(states[0]/18.0) + rates[2] = algebraic[3]*(1.0-states[2])-algebraic[4]*states[2] + algebraic[5] = 0.07*exp(states[0]/20.0) + algebraic[6] = 1.0/(exp((states[0]+30.0)/10.0)+1.0) + rates[1] = algebraic[5]*(1.0-states[1])-algebraic[6]*states[1] + algebraic[7] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0) + rates[3] = algebraic[7]*(1.0-states[3])-external[1]*states[3] def compute_variables(voi, states, rates, constants, computed_constants, algebraic, external_variable): - external[9] = external_variable(voi, states, rates, variables, 9) + external[1] = external_variable(voi, states, rates, variables, 1) external[0] = external_variable(voi, states, rates, variables, 0) - algebraic[1] = constants[2]*(states[0]-computed_constants[0]) - algebraic[3] = constants[3]*pow(states[2], 3.0)*states[1]*(states[0]-computed_constants[1]) - algebraic[4] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0) - algebraic[5] = 4.0*exp(states[0]/18.0) - algebraic[6] = 0.07*exp(states[0]/20.0) - algebraic[7] = 1.0/(exp((states[0]+30.0)/10.0)+1.0) - algebraic[2] = constants[4]*pow(states[3], 4.0)*(states[0]-computed_constants[2]) - algebraic[8] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0) + algebraic[0] = constants[2]*(states[0]-computed_constants[0]) + algebraic[2] = constants[3]*pow(states[2], 3.0)*states[1]*(states[0]-computed_constants[1]) + algebraic[3] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0) + algebraic[4] = 4.0*exp(states[0]/18.0) + algebraic[5] = 0.07*exp(states[0]/20.0) + algebraic[6] = 1.0/(exp((states[0]+30.0)/10.0)+1.0) + algebraic[1] = constants[4]*pow(states[3], 4.0)*(states[0]-computed_constants[2]) + algebraic[7] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0) diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.c index a51d461128..1763e10c00 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.c @@ -132,38 +132,38 @@ void computeComputedConstants(double *constants, double *computedConstants) void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) { algebraic[0] = ((voi >= 10.0) && (voi <= 10.5))?-20.0:0.0; - external[11] = externalVariable(voi, states, rates, variables, 11); - external[4] = externalVariable(voi, states, rates, variables, 4); - algebraic[5] = external[4]-10.613; - algebraic[1] = constants[1]*(states[0]-algebraic[5]); - algebraic[2] = constants[3]*pow(states[3], 4.0)*(states[0]-external[11]); - algebraic[6] = external[4]-115.0; - algebraic[3] = constants[2]*pow(states[2], 3.0)*states[1]*(states[0]-algebraic[6]); + external[1] = externalVariable(voi, states, rates, variables, 1); + external[0] = externalVariable(voi, states, rates, variables, 0); + algebraic[4] = external[0]-10.613; + algebraic[1] = constants[1]*(states[0]-algebraic[4]); + algebraic[2] = constants[3]*pow(states[3], 4.0)*(states[0]-external[1]); + algebraic[5] = external[0]-115.0; + algebraic[3] = constants[2]*pow(states[2], 3.0)*states[1]*(states[0]-algebraic[5]); rates[0] = -(-algebraic[0]+algebraic[3]+algebraic[2]+algebraic[1])/constants[0]; - algebraic[7] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0); - algebraic[8] = 4.0*exp(states[0]/18.0); - rates[2] = algebraic[7]*(1.0-states[2])-algebraic[8]*states[2]; - algebraic[9] = 0.07*exp(states[0]/20.0); - algebraic[10] = 1.0/(exp((states[0]+30.0)/10.0)+1.0); - rates[1] = algebraic[9]*(1.0-states[1])-algebraic[10]*states[1]; - algebraic[12] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0); - algebraic[13] = 0.125*exp(states[0]/80.0); - rates[3] = algebraic[12]*(1.0-states[3])-algebraic[13]*states[3]; + algebraic[6] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0); + algebraic[7] = 4.0*exp(states[0]/18.0); + rates[2] = algebraic[6]*(1.0-states[2])-algebraic[7]*states[2]; + algebraic[8] = 0.07*exp(states[0]/20.0); + algebraic[9] = 1.0/(exp((states[0]+30.0)/10.0)+1.0); + rates[1] = algebraic[8]*(1.0-states[1])-algebraic[9]*states[1]; + algebraic[10] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0); + algebraic[11] = 0.125*exp(states[0]/80.0); + rates[3] = algebraic[10]*(1.0-states[3])-algebraic[11]*states[3]; } void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) { - external[11] = externalVariable(voi, states, rates, variables, 11); - external[4] = externalVariable(voi, states, rates, variables, 4); - algebraic[5] = external[4]-10.613; - algebraic[1] = constants[1]*(states[0]-algebraic[5]); - algebraic[6] = external[4]-115.0; - algebraic[3] = constants[2]*pow(states[2], 3.0)*states[1]*(states[0]-algebraic[6]); - algebraic[7] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0); - algebraic[8] = 4.0*exp(states[0]/18.0); - algebraic[9] = 0.07*exp(states[0]/20.0); - algebraic[10] = 1.0/(exp((states[0]+30.0)/10.0)+1.0); - algebraic[2] = constants[3]*pow(states[3], 4.0)*(states[0]-external[11]); - algebraic[12] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0); - algebraic[13] = 0.125*exp(states[0]/80.0); + external[1] = externalVariable(voi, states, rates, variables, 1); + external[0] = externalVariable(voi, states, rates, variables, 0); + algebraic[4] = external[0]-10.613; + algebraic[1] = constants[1]*(states[0]-algebraic[4]); + algebraic[5] = external[0]-115.0; + algebraic[3] = constants[2]*pow(states[2], 3.0)*states[1]*(states[0]-algebraic[5]); + algebraic[6] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0); + algebraic[7] = 4.0*exp(states[0]/18.0); + algebraic[8] = 0.07*exp(states[0]/20.0); + algebraic[9] = 1.0/(exp((states[0]+30.0)/10.0)+1.0); + algebraic[2] = constants[3]*pow(states[3], 4.0)*(states[0]-external[1]); + algebraic[10] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0); + algebraic[11] = 0.125*exp(states[0]/80.0); } diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.py index 4dd723021b..2ff358773d 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.py @@ -102,36 +102,36 @@ def compute_computed_constants(constants, computed_constants): def compute_rates(voi, states, rates, constants, computed_constants, algebraic, external_variable): algebraic[0] = -20.0 if and_func(geq_func(voi, 10.0), leq_func(voi, 10.5)) else 0.0 - external[11] = external_variable(voi, states, rates, variables, 11) - external[4] = external_variable(voi, states, rates, variables, 4) - algebraic[5] = external[4]-10.613 - algebraic[1] = constants[1]*(states[0]-algebraic[5]) - algebraic[2] = constants[3]*pow(states[3], 4.0)*(states[0]-external[11]) - algebraic[6] = external[4]-115.0 - algebraic[3] = constants[2]*pow(states[2], 3.0)*states[1]*(states[0]-algebraic[6]) + external[1] = external_variable(voi, states, rates, variables, 1) + external[0] = external_variable(voi, states, rates, variables, 0) + algebraic[4] = external[0]-10.613 + algebraic[1] = constants[1]*(states[0]-algebraic[4]) + algebraic[2] = constants[3]*pow(states[3], 4.0)*(states[0]-external[1]) + algebraic[5] = external[0]-115.0 + algebraic[3] = constants[2]*pow(states[2], 3.0)*states[1]*(states[0]-algebraic[5]) rates[0] = -(-algebraic[0]+algebraic[3]+algebraic[2]+algebraic[1])/constants[0] - algebraic[7] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0) - algebraic[8] = 4.0*exp(states[0]/18.0) - rates[2] = algebraic[7]*(1.0-states[2])-algebraic[8]*states[2] - algebraic[9] = 0.07*exp(states[0]/20.0) - algebraic[10] = 1.0/(exp((states[0]+30.0)/10.0)+1.0) - rates[1] = algebraic[9]*(1.0-states[1])-algebraic[10]*states[1] - algebraic[12] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0) - algebraic[13] = 0.125*exp(states[0]/80.0) - rates[3] = algebraic[12]*(1.0-states[3])-algebraic[13]*states[3] + algebraic[6] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0) + algebraic[7] = 4.0*exp(states[0]/18.0) + rates[2] = algebraic[6]*(1.0-states[2])-algebraic[7]*states[2] + algebraic[8] = 0.07*exp(states[0]/20.0) + algebraic[9] = 1.0/(exp((states[0]+30.0)/10.0)+1.0) + rates[1] = algebraic[8]*(1.0-states[1])-algebraic[9]*states[1] + algebraic[10] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0) + algebraic[11] = 0.125*exp(states[0]/80.0) + rates[3] = algebraic[10]*(1.0-states[3])-algebraic[11]*states[3] def compute_variables(voi, states, rates, constants, computed_constants, algebraic, external_variable): - external[11] = external_variable(voi, states, rates, variables, 11) - external[4] = external_variable(voi, states, rates, variables, 4) - algebraic[5] = external[4]-10.613 - algebraic[1] = constants[1]*(states[0]-algebraic[5]) - algebraic[6] = external[4]-115.0 - algebraic[3] = constants[2]*pow(states[2], 3.0)*states[1]*(states[0]-algebraic[6]) - algebraic[7] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0) - algebraic[8] = 4.0*exp(states[0]/18.0) - algebraic[9] = 0.07*exp(states[0]/20.0) - algebraic[10] = 1.0/(exp((states[0]+30.0)/10.0)+1.0) - algebraic[2] = constants[3]*pow(states[3], 4.0)*(states[0]-external[11]) - algebraic[12] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0) - algebraic[13] = 0.125*exp(states[0]/80.0) + external[1] = external_variable(voi, states, rates, variables, 1) + external[0] = external_variable(voi, states, rates, variables, 0) + algebraic[4] = external[0]-10.613 + algebraic[1] = constants[1]*(states[0]-algebraic[4]) + algebraic[5] = external[0]-115.0 + algebraic[3] = constants[2]*pow(states[2], 3.0)*states[1]*(states[0]-algebraic[5]) + algebraic[6] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0) + algebraic[7] = 4.0*exp(states[0]/18.0) + algebraic[8] = 0.07*exp(states[0]/20.0) + algebraic[9] = 1.0/(exp((states[0]+30.0)/10.0)+1.0) + algebraic[2] = constants[3]*pow(states[3], 4.0)*(states[0]-external[1]) + algebraic[10] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0) + algebraic[11] = 0.125*exp(states[0]/80.0) diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.c index 004ed3c370..bf11e3c35f 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.c @@ -134,34 +134,34 @@ void computeComputedConstants(double *constants, double *computedConstants) void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) { algebraic[0] = ((voi >= 10.0) && (voi <= 10.5))?-20.0:0.0; - external[5] = externalVariable(voi, states, rates, variables, 5); - external[4] = externalVariable(voi, states, rates, variables, 4); + external[1] = externalVariable(voi, states, rates, variables, 1); + external[0] = externalVariable(voi, states, rates, variables, 0); algebraic[1] = constants[1]*(states[0]-computedConstants[0]); algebraic[2] = constants[2]*pow(states[3], 4.0)*(states[0]-computedConstants[2]); - algebraic[3] = external[5]*pow(states[2], 3.0)*states[1]*(states[0]-computedConstants[1]); - rates[0] = -(-algebraic[0]+algebraic[3]+algebraic[2]+algebraic[1])/external[4]; - algebraic[6] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0); - algebraic[7] = 4.0*exp(states[0]/18.0); - rates[2] = algebraic[6]*(1.0-states[2])-algebraic[7]*states[2]; - algebraic[8] = 0.07*exp(states[0]/20.0); - algebraic[9] = 1.0/(exp((states[0]+30.0)/10.0)+1.0); - rates[1] = algebraic[8]*(1.0-states[1])-algebraic[9]*states[1]; - algebraic[10] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0); - algebraic[11] = 0.125*exp(states[0]/80.0); - rates[3] = algebraic[10]*(1.0-states[3])-algebraic[11]*states[3]; + algebraic[3] = external[1]*pow(states[2], 3.0)*states[1]*(states[0]-computedConstants[1]); + rates[0] = -(-algebraic[0]+algebraic[3]+algebraic[2]+algebraic[1])/external[0]; + algebraic[4] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0); + algebraic[5] = 4.0*exp(states[0]/18.0); + rates[2] = algebraic[4]*(1.0-states[2])-algebraic[5]*states[2]; + algebraic[6] = 0.07*exp(states[0]/20.0); + algebraic[7] = 1.0/(exp((states[0]+30.0)/10.0)+1.0); + rates[1] = algebraic[6]*(1.0-states[1])-algebraic[7]*states[1]; + algebraic[8] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0); + algebraic[9] = 0.125*exp(states[0]/80.0); + rates[3] = algebraic[8]*(1.0-states[3])-algebraic[9]*states[3]; } void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) { algebraic[1] = constants[1]*(states[0]-computedConstants[0]); - external[5] = externalVariable(voi, states, rates, variables, 5); - algebraic[3] = external[5]*pow(states[2], 3.0)*states[1]*(states[0]-computedConstants[1]); - algebraic[6] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0); - algebraic[7] = 4.0*exp(states[0]/18.0); - algebraic[8] = 0.07*exp(states[0]/20.0); - algebraic[9] = 1.0/(exp((states[0]+30.0)/10.0)+1.0); + external[1] = externalVariable(voi, states, rates, variables, 1); + algebraic[3] = external[1]*pow(states[2], 3.0)*states[1]*(states[0]-computedConstants[1]); + algebraic[4] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0); + algebraic[5] = 4.0*exp(states[0]/18.0); + algebraic[6] = 0.07*exp(states[0]/20.0); + algebraic[7] = 1.0/(exp((states[0]+30.0)/10.0)+1.0); algebraic[2] = constants[2]*pow(states[3], 4.0)*(states[0]-computedConstants[2]); - algebraic[10] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0); - algebraic[11] = 0.125*exp(states[0]/80.0); - external[4] = externalVariable(voi, states, rates, variables, 4); + algebraic[8] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0); + algebraic[9] = 0.125*exp(states[0]/80.0); + external[0] = externalVariable(voi, states, rates, variables, 0); } diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.py index 05478b9260..523a748540 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.py @@ -103,32 +103,32 @@ def compute_computed_constants(constants, computed_constants): def compute_rates(voi, states, rates, constants, computed_constants, algebraic, external_variable): algebraic[0] = -20.0 if and_func(geq_func(voi, 10.0), leq_func(voi, 10.5)) else 0.0 - external[5] = external_variable(voi, states, rates, variables, 5) - external[4] = external_variable(voi, states, rates, variables, 4) + external[1] = external_variable(voi, states, rates, variables, 1) + external[0] = external_variable(voi, states, rates, variables, 0) algebraic[1] = constants[1]*(states[0]-computed_constants[0]) algebraic[2] = constants[2]*pow(states[3], 4.0)*(states[0]-computed_constants[2]) - algebraic[3] = external[5]*pow(states[2], 3.0)*states[1]*(states[0]-computed_constants[1]) - rates[0] = -(-algebraic[0]+algebraic[3]+algebraic[2]+algebraic[1])/external[4] - algebraic[6] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0) - algebraic[7] = 4.0*exp(states[0]/18.0) - rates[2] = algebraic[6]*(1.0-states[2])-algebraic[7]*states[2] - algebraic[8] = 0.07*exp(states[0]/20.0) - algebraic[9] = 1.0/(exp((states[0]+30.0)/10.0)+1.0) - rates[1] = algebraic[8]*(1.0-states[1])-algebraic[9]*states[1] - algebraic[10] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0) - algebraic[11] = 0.125*exp(states[0]/80.0) - rates[3] = algebraic[10]*(1.0-states[3])-algebraic[11]*states[3] + algebraic[3] = external[1]*pow(states[2], 3.0)*states[1]*(states[0]-computed_constants[1]) + rates[0] = -(-algebraic[0]+algebraic[3]+algebraic[2]+algebraic[1])/external[0] + algebraic[4] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0) + algebraic[5] = 4.0*exp(states[0]/18.0) + rates[2] = algebraic[4]*(1.0-states[2])-algebraic[5]*states[2] + algebraic[6] = 0.07*exp(states[0]/20.0) + algebraic[7] = 1.0/(exp((states[0]+30.0)/10.0)+1.0) + rates[1] = algebraic[6]*(1.0-states[1])-algebraic[7]*states[1] + algebraic[8] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0) + algebraic[9] = 0.125*exp(states[0]/80.0) + rates[3] = algebraic[8]*(1.0-states[3])-algebraic[9]*states[3] def compute_variables(voi, states, rates, constants, computed_constants, algebraic, external_variable): algebraic[1] = constants[1]*(states[0]-computed_constants[0]) - external[5] = external_variable(voi, states, rates, variables, 5) - algebraic[3] = external[5]*pow(states[2], 3.0)*states[1]*(states[0]-computed_constants[1]) - algebraic[6] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0) - algebraic[7] = 4.0*exp(states[0]/18.0) - algebraic[8] = 0.07*exp(states[0]/20.0) - algebraic[9] = 1.0/(exp((states[0]+30.0)/10.0)+1.0) + external[1] = external_variable(voi, states, rates, variables, 1) + algebraic[3] = external[1]*pow(states[2], 3.0)*states[1]*(states[0]-computed_constants[1]) + algebraic[4] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0) + algebraic[5] = 4.0*exp(states[0]/18.0) + algebraic[6] = 0.07*exp(states[0]/20.0) + algebraic[7] = 1.0/(exp((states[0]+30.0)/10.0)+1.0) algebraic[2] = constants[2]*pow(states[3], 4.0)*(states[0]-computed_constants[2]) - algebraic[10] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0) - algebraic[11] = 0.125*exp(states[0]/80.0) - external[4] = external_variable(voi, states, rates, variables, 4) + algebraic[8] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0) + algebraic[9] = 0.125*exp(states[0]/80.0) + external[0] = external_variable(voi, states, rates, variables, 0) diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.c index c5a4fdcb36..e9bb071d97 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.c @@ -133,23 +133,23 @@ void computeComputedConstants(double *constants, double *computedConstants) void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) { - external[1] = externalVariable(voi, states, rates, variables, 1); - algebraic[8] = 0.07*exp(external[1]/20.0); - algebraic[9] = 1.0/(exp((external[1]+30.0)/10.0)+1.0); - rates[0] = algebraic[8]*(1.0-states[0])-algebraic[9]*states[0]; - algebraic[10] = 0.01*(external[1]+10.0)/(exp((external[1]+10.0)/10.0)-1.0); - algebraic[11] = 0.125*exp(external[1]/80.0); - rates[1] = algebraic[10]*(1.0-states[1])-algebraic[11]*states[1]; + external[0] = externalVariable(voi, states, rates, variables, 0); + algebraic[6] = 0.07*exp(external[0]/20.0); + algebraic[7] = 1.0/(exp((external[0]+30.0)/10.0)+1.0); + rates[0] = algebraic[6]*(1.0-states[0])-algebraic[7]*states[0]; + algebraic[8] = 0.01*(external[0]+10.0)/(exp((external[0]+10.0)/10.0)-1.0); + algebraic[9] = 0.125*exp(external[0]/80.0); + rates[1] = algebraic[8]*(1.0-states[1])-algebraic[9]*states[1]; } void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) { algebraic[0] = ((voi >= 10.0) && (voi <= 10.5))?-20.0:0.0; + external[0] = externalVariable(voi, states, rates, variables, 0); + algebraic[1] = constants[2]*(external[0]-computedConstants[0]); external[1] = externalVariable(voi, states, rates, variables, 1); - algebraic[2] = constants[2]*(external[1]-computedConstants[0]); - external[5] = externalVariable(voi, states, rates, variables, 5); - algebraic[4] = constants[3]*pow(external[5], 3.0)*states[0]*(external[1]-computedConstants[1]); - algebraic[6] = 0.1*(external[1]+25.0)/(exp((external[1]+25.0)/10.0)-1.0); - algebraic[7] = 4.0*exp(external[1]/18.0); - algebraic[3] = constants[4]*pow(states[1], 4.0)*(external[1]-computedConstants[2]); + algebraic[3] = constants[3]*pow(external[1], 3.0)*states[0]*(external[0]-computedConstants[1]); + algebraic[4] = 0.1*(external[0]+25.0)/(exp((external[0]+25.0)/10.0)-1.0); + algebraic[5] = 4.0*exp(external[0]/18.0); + algebraic[2] = constants[4]*pow(states[1], 4.0)*(external[0]-computedConstants[2]); } diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.py index f02d4bbc17..f4e175bb25 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.py @@ -102,21 +102,21 @@ def compute_computed_constants(constants, computed_constants): def compute_rates(voi, states, rates, constants, computed_constants, algebraic, external_variable): - external[1] = external_variable(voi, states, rates, variables, 1) - algebraic[8] = 0.07*exp(external[1]/20.0) - algebraic[9] = 1.0/(exp((external[1]+30.0)/10.0)+1.0) - rates[0] = algebraic[8]*(1.0-states[0])-algebraic[9]*states[0] - algebraic[10] = 0.01*(external[1]+10.0)/(exp((external[1]+10.0)/10.0)-1.0) - algebraic[11] = 0.125*exp(external[1]/80.0) - rates[1] = algebraic[10]*(1.0-states[1])-algebraic[11]*states[1] + external[0] = external_variable(voi, states, rates, variables, 0) + algebraic[6] = 0.07*exp(external[0]/20.0) + algebraic[7] = 1.0/(exp((external[0]+30.0)/10.0)+1.0) + rates[0] = algebraic[6]*(1.0-states[0])-algebraic[7]*states[0] + algebraic[8] = 0.01*(external[0]+10.0)/(exp((external[0]+10.0)/10.0)-1.0) + algebraic[9] = 0.125*exp(external[0]/80.0) + rates[1] = algebraic[8]*(1.0-states[1])-algebraic[9]*states[1] def compute_variables(voi, states, rates, constants, computed_constants, algebraic, external_variable): algebraic[0] = -20.0 if and_func(geq_func(voi, 10.0), leq_func(voi, 10.5)) else 0.0 + external[0] = external_variable(voi, states, rates, variables, 0) + algebraic[1] = constants[2]*(external[0]-computed_constants[0]) external[1] = external_variable(voi, states, rates, variables, 1) - algebraic[2] = constants[2]*(external[1]-computed_constants[0]) - external[5] = external_variable(voi, states, rates, variables, 5) - algebraic[4] = constants[3]*pow(external[5], 3.0)*states[0]*(external[1]-computed_constants[1]) - algebraic[6] = 0.1*(external[1]+25.0)/(exp((external[1]+25.0)/10.0)-1.0) - algebraic[7] = 4.0*exp(external[1]/18.0) - algebraic[3] = constants[4]*pow(states[1], 4.0)*(external[1]-computed_constants[2]) + algebraic[3] = constants[3]*pow(external[1], 3.0)*states[0]*(external[0]-computed_constants[1]) + algebraic[4] = 0.1*(external[0]+25.0)/(exp((external[0]+25.0)/10.0)-1.0) + algebraic[5] = 4.0*exp(external[0]/18.0) + algebraic[2] = constants[4]*pow(states[1], 4.0)*(external[0]-computed_constants[2]) diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.c index 968d381c83..d23067e7ba 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.c @@ -134,24 +134,24 @@ void computeComputedConstants(double *constants, double *computedConstants) void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) { - external[1] = externalVariable(voi, states, rates, variables, 1); - algebraic[5] = 0.1*(external[1]+25.0)/(exp((external[1]+25.0)/10.0)-1.0); - algebraic[6] = 4.0*exp(external[1]/18.0); - rates[1] = algebraic[5]*(1.0-states[1])-algebraic[6]*states[1]; - algebraic[7] = 0.07*exp(external[1]/20.0); - algebraic[8] = 1.0/(exp((external[1]+30.0)/10.0)+1.0); - rates[0] = algebraic[7]*(1.0-states[0])-algebraic[8]*states[0]; - external[9] = externalVariable(voi, states, rates, variables, 9); - algebraic[10] = 0.125*exp(external[1]/80.0); - rates[2] = external[9]*(1.0-states[2])-algebraic[10]*states[2]; + external[0] = externalVariable(voi, states, rates, variables, 0); + algebraic[3] = 0.1*(external[0]+25.0)/(exp((external[0]+25.0)/10.0)-1.0); + algebraic[4] = 4.0*exp(external[0]/18.0); + rates[1] = algebraic[3]*(1.0-states[1])-algebraic[4]*states[1]; + algebraic[5] = 0.07*exp(external[0]/20.0); + algebraic[6] = 1.0/(exp((external[0]+30.0)/10.0)+1.0); + rates[0] = algebraic[5]*(1.0-states[0])-algebraic[6]*states[0]; + external[2] = externalVariable(voi, states, rates, variables, 2); + algebraic[7] = 0.125*exp(external[0]/80.0); + rates[2] = external[2]*(1.0-states[2])-algebraic[7]*states[2]; } void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) { algebraic[0] = ((voi >= 10.0) && (voi <= 10.5))?-20.0:0.0; + external[0] = externalVariable(voi, states, rates, variables, 0); + algebraic[1] = constants[2]*(external[0]-computedConstants[0]); + external[2] = externalVariable(voi, states, rates, variables, 2); external[1] = externalVariable(voi, states, rates, variables, 1); - algebraic[2] = constants[2]*(external[1]-computedConstants[0]); - external[9] = externalVariable(voi, states, rates, variables, 9); - external[4] = externalVariable(voi, states, rates, variables, 4); - algebraic[3] = constants[4]*pow(states[2], 4.0)*(external[1]-computedConstants[2]); + algebraic[2] = constants[4]*pow(states[2], 4.0)*(external[0]-computedConstants[2]); } diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.py index d533782eac..7e7ce58041 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.py @@ -103,22 +103,22 @@ def compute_computed_constants(constants, computed_constants): def compute_rates(voi, states, rates, constants, computed_constants, algebraic, external_variable): - external[1] = external_variable(voi, states, rates, variables, 1) - algebraic[5] = 0.1*(external[1]+25.0)/(exp((external[1]+25.0)/10.0)-1.0) - algebraic[6] = 4.0*exp(external[1]/18.0) - rates[1] = algebraic[5]*(1.0-states[1])-algebraic[6]*states[1] - algebraic[7] = 0.07*exp(external[1]/20.0) - algebraic[8] = 1.0/(exp((external[1]+30.0)/10.0)+1.0) - rates[0] = algebraic[7]*(1.0-states[0])-algebraic[8]*states[0] - external[9] = external_variable(voi, states, rates, variables, 9) - algebraic[10] = 0.125*exp(external[1]/80.0) - rates[2] = external[9]*(1.0-states[2])-algebraic[10]*states[2] + external[0] = external_variable(voi, states, rates, variables, 0) + algebraic[3] = 0.1*(external[0]+25.0)/(exp((external[0]+25.0)/10.0)-1.0) + algebraic[4] = 4.0*exp(external[0]/18.0) + rates[1] = algebraic[3]*(1.0-states[1])-algebraic[4]*states[1] + algebraic[5] = 0.07*exp(external[0]/20.0) + algebraic[6] = 1.0/(exp((external[0]+30.0)/10.0)+1.0) + rates[0] = algebraic[5]*(1.0-states[0])-algebraic[6]*states[0] + external[2] = external_variable(voi, states, rates, variables, 2) + algebraic[7] = 0.125*exp(external[0]/80.0) + rates[2] = external[2]*(1.0-states[2])-algebraic[7]*states[2] def compute_variables(voi, states, rates, constants, computed_constants, algebraic, external_variable): algebraic[0] = -20.0 if and_func(geq_func(voi, 10.0), leq_func(voi, 10.5)) else 0.0 + external[0] = external_variable(voi, states, rates, variables, 0) + algebraic[1] = constants[2]*(external[0]-computed_constants[0]) + external[2] = external_variable(voi, states, rates, variables, 2) external[1] = external_variable(voi, states, rates, variables, 1) - algebraic[2] = constants[2]*(external[1]-computed_constants[0]) - external[9] = external_variable(voi, states, rates, variables, 9) - external[4] = external_variable(voi, states, rates, variables, 4) - algebraic[3] = constants[4]*pow(states[2], 4.0)*(external[1]-computed_constants[2]) + algebraic[2] = constants[4]*pow(states[2], 4.0)*(external[0]-computed_constants[2]) diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.c index 64e677b509..fb03fdd454 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.c @@ -137,27 +137,27 @@ void computeRates(double voi, double *states, double *rates, double *constants, algebraic[0] = ((voi >= 10.0) && (voi <= 10.5))?-20.0:0.0; algebraic[1] = constants[2]*(states[0]-computedConstants[0]); algebraic[2] = constants[4]*pow(states[2], 4.0)*(states[0]-computedConstants[2]); - external[4] = externalVariable(voi, states, rates, variables, 4); - algebraic[3] = constants[3]*pow(external[4], 3.0)*states[1]*(states[0]-computedConstants[1]); + external[0] = externalVariable(voi, states, rates, variables, 0); + algebraic[3] = constants[3]*pow(external[0], 3.0)*states[1]*(states[0]-computedConstants[1]); rates[0] = -(-algebraic[0]+algebraic[3]+algebraic[2]+algebraic[1])/constants[0]; - algebraic[7] = 0.07*exp(states[0]/20.0); - algebraic[8] = 1.0/(exp((states[0]+30.0)/10.0)+1.0); - rates[1] = algebraic[7]*(1.0-states[1])-algebraic[8]*states[1]; - algebraic[9] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0); - algebraic[10] = 0.125*exp(states[0]/80.0); - rates[2] = algebraic[9]*(1.0-states[2])-algebraic[10]*states[2]; + algebraic[6] = 0.07*exp(states[0]/20.0); + algebraic[7] = 1.0/(exp((states[0]+30.0)/10.0)+1.0); + rates[1] = algebraic[6]*(1.0-states[1])-algebraic[7]*states[1]; + algebraic[8] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0); + algebraic[9] = 0.125*exp(states[0]/80.0); + rates[2] = algebraic[8]*(1.0-states[2])-algebraic[9]*states[2]; } void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) { algebraic[1] = constants[2]*(states[0]-computedConstants[0]); - external[4] = externalVariable(voi, states, rates, variables, 4); - algebraic[3] = constants[3]*pow(external[4], 3.0)*states[1]*(states[0]-computedConstants[1]); - algebraic[5] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0); - algebraic[6] = 4.0*exp(states[0]/18.0); - algebraic[7] = 0.07*exp(states[0]/20.0); - algebraic[8] = 1.0/(exp((states[0]+30.0)/10.0)+1.0); + external[0] = externalVariable(voi, states, rates, variables, 0); + algebraic[3] = constants[3]*pow(external[0], 3.0)*states[1]*(states[0]-computedConstants[1]); + algebraic[4] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0); + algebraic[5] = 4.0*exp(states[0]/18.0); + algebraic[6] = 0.07*exp(states[0]/20.0); + algebraic[7] = 1.0/(exp((states[0]+30.0)/10.0)+1.0); algebraic[2] = constants[4]*pow(states[2], 4.0)*(states[0]-computedConstants[2]); - algebraic[9] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0); - algebraic[10] = 0.125*exp(states[0]/80.0); + algebraic[8] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0); + algebraic[9] = 0.125*exp(states[0]/80.0); } diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.py index bd4d565ed1..19e213325d 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.py @@ -106,25 +106,25 @@ def compute_rates(voi, states, rates, constants, computed_constants, algebraic, algebraic[0] = -20.0 if and_func(geq_func(voi, 10.0), leq_func(voi, 10.5)) else 0.0 algebraic[1] = constants[2]*(states[0]-computed_constants[0]) algebraic[2] = constants[4]*pow(states[2], 4.0)*(states[0]-computed_constants[2]) - external[4] = external_variable(voi, states, rates, variables, 4) - algebraic[3] = constants[3]*pow(external[4], 3.0)*states[1]*(states[0]-computed_constants[1]) + external[0] = external_variable(voi, states, rates, variables, 0) + algebraic[3] = constants[3]*pow(external[0], 3.0)*states[1]*(states[0]-computed_constants[1]) rates[0] = -(-algebraic[0]+algebraic[3]+algebraic[2]+algebraic[1])/constants[0] - algebraic[7] = 0.07*exp(states[0]/20.0) - algebraic[8] = 1.0/(exp((states[0]+30.0)/10.0)+1.0) - rates[1] = algebraic[7]*(1.0-states[1])-algebraic[8]*states[1] - algebraic[9] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0) - algebraic[10] = 0.125*exp(states[0]/80.0) - rates[2] = algebraic[9]*(1.0-states[2])-algebraic[10]*states[2] + algebraic[6] = 0.07*exp(states[0]/20.0) + algebraic[7] = 1.0/(exp((states[0]+30.0)/10.0)+1.0) + rates[1] = algebraic[6]*(1.0-states[1])-algebraic[7]*states[1] + algebraic[8] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0) + algebraic[9] = 0.125*exp(states[0]/80.0) + rates[2] = algebraic[8]*(1.0-states[2])-algebraic[9]*states[2] def compute_variables(voi, states, rates, constants, computed_constants, algebraic, external_variable): algebraic[1] = constants[2]*(states[0]-computed_constants[0]) - external[4] = external_variable(voi, states, rates, variables, 4) - algebraic[3] = constants[3]*pow(external[4], 3.0)*states[1]*(states[0]-computed_constants[1]) - algebraic[5] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0) - algebraic[6] = 4.0*exp(states[0]/18.0) - algebraic[7] = 0.07*exp(states[0]/20.0) - algebraic[8] = 1.0/(exp((states[0]+30.0)/10.0)+1.0) + external[0] = external_variable(voi, states, rates, variables, 0) + algebraic[3] = constants[3]*pow(external[0], 3.0)*states[1]*(states[0]-computed_constants[1]) + algebraic[4] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0) + algebraic[5] = 4.0*exp(states[0]/18.0) + algebraic[6] = 0.07*exp(states[0]/20.0) + algebraic[7] = 1.0/(exp((states[0]+30.0)/10.0)+1.0) algebraic[2] = constants[4]*pow(states[2], 4.0)*(states[0]-computed_constants[2]) - algebraic[9] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0) - algebraic[10] = 0.125*exp(states[0]/80.0) + algebraic[8] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0) + algebraic[9] = 0.125*exp(states[0]/80.0) diff --git a/tests/resources/generator/unknown_variable_as_external_variable/model.c b/tests/resources/generator/unknown_variable_as_external_variable/model.c index 52086b8cf4..2eecb84e54 100644 --- a/tests/resources/generator/unknown_variable_as_external_variable/model.c +++ b/tests/resources/generator/unknown_variable_as_external_variable/model.c @@ -102,6 +102,6 @@ void computeComputedConstants(double *constants, double *computedConstants) void computeVariables(double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) { - external[1] = externalVariable(variables, 1); - algebraic[0] = constants[0]*(constants[1]*constants[2]-constants[3]*constants[4])/(constants[5]*constants[4]+external[1]*constants[2]+constants[7]*constants[4]*constants[2]+constants[6]); + external[0] = externalVariable(variables, 0); + algebraic[0] = constants[0]*(constants[1]*constants[2]-constants[3]*constants[4])/(constants[5]*constants[4]+external[0]*constants[2]+constants[7]*constants[4]*constants[2]+constants[6]); } diff --git a/tests/resources/generator/unknown_variable_as_external_variable/model.py b/tests/resources/generator/unknown_variable_as_external_variable/model.py index f779ffb993..1d02c1f0b9 100644 --- a/tests/resources/generator/unknown_variable_as_external_variable/model.py +++ b/tests/resources/generator/unknown_variable_as_external_variable/model.py @@ -67,5 +67,5 @@ def compute_computed_constants(constants, computed_constants): def compute_variables(constants, computed_constants, algebraic, external_variable): - external[1] = external_variable(variables, 1) - algebraic[0] = constants[0]*(constants[1]*constants[2]-constants[3]*constants[4])/(constants[5]*constants[4]+external[1]*constants[2]+constants[7]*constants[4]*constants[2]+constants[6]) + external[0] = external_variable(variables, 0) + algebraic[0] = constants[0]*(constants[1]*constants[2]-constants[3]*constants[4])/(constants[5]*constants[4]+external[0]*constants[2]+constants[7]*constants[4]*constants[2]+constants[6]) From 841c6760775bb44a20aa52525b9564974841558b Mon Sep 17 00:00:00 2001 From: Alan Garny Date: Fri, 16 Aug 2024 19:04:43 +0200 Subject: [PATCH 32/85] Analyser: put some struct/class definitions in a corresponding private header. --- src/analyser.cpp | 256 +-------------------------------------------- src/analyser_p.h | 266 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 267 insertions(+), 255 deletions(-) create mode 100644 src/analyser_p.h diff --git a/src/analyser.cpp b/src/analyser.cpp index 8670ec3928..a3a345735b 100644 --- a/src/analyser.cpp +++ b/src/analyser.cpp @@ -24,85 +24,20 @@ limitations under the License. #include #include "libcellml/analyserequation.h" -#include "libcellml/analyserequationast.h" #include "libcellml/analyserexternalvariable.h" -#include "libcellml/analysermodel.h" -#include "libcellml/analyservariable.h" -#include "libcellml/component.h" -#include "libcellml/generator.h" #include "libcellml/generatorprofile.h" -#include "libcellml/model.h" -#include "libcellml/units.h" #include "libcellml/validator.h" -#include "libcellml/variable.h" +#include "analyser_p.h" #include "analyserequation_p.h" #include "analyserequationast_p.h" -#include "analysermodel_p.h" #include "analyservariable_p.h" -#include "anycellmlelement_p.h" #include "commonutils.h" #include "generator_p.h" -#include "issue_p.h" -#include "logger_p.h" -#include "utilities.h" -#include "xmldoc.h" #include "xmlutils.h" -#include "libcellml/undefines.h" - namespace libcellml { -struct AnalyserInternalEquation; -struct AnalyserInternalVariable; - -using AnalyserInternalEquationWeakPtr = std::weak_ptr; -using AnalyserInternalEquationPtr = std::shared_ptr; -using AnalyserInternalVariablePtr = std::shared_ptr; - -using AnalyserInternalEquationWeakPtrs = std::vector; -using AnalyserInternalEquationPtrs = std::vector; -using AnalyserInternalVariablePtrs = std::vector; - -using AnalyserEquationPtrs = std::vector; -using AnalyserVariablePtrs = std::vector; -using AnalyserExternalVariablePtrs = std::vector; - -struct AnalyserInternalVariable -{ - enum struct Type - { - UNKNOWN, - SHOULD_BE_STATE, - INITIALISED, - VARIABLE_OF_INTEGRATION, - STATE, - CONSTANT, - COMPUTED_TRUE_CONSTANT, - COMPUTED_VARIABLE_BASED_CONSTANT, - INITIALISED_ALGEBRAIC, - ALGEBRAIC, - OVERCONSTRAINED - }; - - size_t mIndex = MAX_SIZE_T; - Type mType = Type::UNKNOWN; - bool mIsExternal = false; - - VariablePtr mInitialisingVariable; - VariablePtr mVariable; - VariablePtrs mDependencies; - - static AnalyserInternalVariablePtr create(const VariablePtr &variable); - - void setVariable(const VariablePtr &variable, - bool checkInitialValue = true); - - void makeVoi(); - void makeState(); - void makeConstant(size_t &index); -}; - AnalyserInternalVariablePtr AnalyserInternalVariable::create(const VariablePtr &variable) { auto res = AnalyserInternalVariablePtr {new AnalyserInternalVariable {}}; @@ -155,62 +90,6 @@ void AnalyserInternalVariable::makeConstant(size_t &index) mType = Type::CONSTANT; } -struct AnalyserInternalEquation -{ - enum struct Type - { - UNKNOWN, - TRUE_CONSTANT, - VARIABLE_BASED_CONSTANT, - ODE, - NLA, - ALGEBRAIC - }; - - Type mType = Type::UNKNOWN; - - VariablePtrs mDependencies; - - AnalyserEquationAstPtr mAst; - - ComponentPtr mComponent; - - AnalyserInternalVariablePtrs mVariables; - AnalyserInternalVariablePtrs mOdeVariables; - AnalyserInternalVariablePtrs mAllVariables; - AnalyserInternalVariablePtrs mUnknownVariables; - - size_t mNlaSystemIndex = MAX_SIZE_T; - AnalyserInternalEquationWeakPtrs mNlaSiblings; - - bool mComputedTrueConstant = true; - bool mComputedVariableBasedConstant = true; - - static AnalyserInternalEquationPtr create(const ComponentPtr &component); - static AnalyserInternalEquationPtr create(const AnalyserInternalVariablePtr &variable); - - void addVariable(const AnalyserInternalVariablePtr &variable); - void addOdeVariable(const AnalyserInternalVariablePtr &odeVariable); - - static bool isKnownVariable(const AnalyserInternalVariablePtr &variable); - static bool isKnownOdeVariable(const AnalyserInternalVariablePtr &odeVariable); - - static bool hasKnownVariables(const AnalyserInternalVariablePtrs &variables); - bool hasKnownVariables(); - - static bool isNonConstantVariable(const AnalyserInternalVariablePtr &variable); - - static bool hasNonConstantVariables(const AnalyserInternalVariablePtrs &variables); - bool hasNonConstantVariables(); - - bool variableOnLhsRhs(const AnalyserInternalVariablePtr &variable, - const AnalyserEquationAstPtr &astChild); - bool variableOnRhs(const AnalyserInternalVariablePtr &variable); - bool variableOnLhsOrRhs(const AnalyserInternalVariablePtr &variable); - - bool check(const AnalyserModelPtr &model, size_t &stateIndex, size_t &computedConstantIndex, size_t &algebraicIndex, bool checkNlaSystems); -}; - AnalyserInternalEquationPtr AnalyserInternalEquation::create(const ComponentPtr &component) { auto res = AnalyserInternalEquationPtr {new AnalyserInternalEquation {}}; @@ -497,139 +376,6 @@ bool AnalyserInternalEquation::check(const AnalyserModelPtr &model, return false; } -/** - * @brief The Analyser::AnalyserImpl class. - * - * The private implementation for the Analyser class. - */ -using UnitsMap = std::map; -using UnitsMaps = std::vector; -using UnitsMultipliers = std::vector; - -class Analyser::AnalyserImpl: public Logger::LoggerImpl -{ -public: - class PowerData - { - public: - bool mDimensionlessBase; - bool mExponentValueAvailable = true; - bool mExponentValueChangeable = false; - double mExponentValue; - AnalyserEquationAstPtr mExponentAst; - }; - - Analyser *mAnalyser = nullptr; - - AnalyserModelPtr mModel = AnalyserModel::AnalyserModelImpl::create(); - - AnalyserExternalVariablePtrs mExternalVariables; - - AnalyserInternalVariablePtrs mInternalVariables; - AnalyserInternalEquationPtrs mInternalEquations; - - GeneratorProfilePtr mGeneratorProfile = libcellml::GeneratorProfile::create(); - - std::map mStandardUnits; - std::map mCiCnUnits; - - AnalyserImpl(); - - AnalyserInternalVariablePtr internalVariable(const VariablePtr &variable); - - VariablePtr voiFirstOccurrence(const VariablePtr &variable, - const ComponentPtr &component); - - void analyseNode(const XmlNodePtr &node, AnalyserEquationAstPtr &ast, - const AnalyserEquationAstPtr &astParent, - const ComponentPtr &component, - const AnalyserInternalEquationPtr &equation); - void analyseComponent(const ComponentPtr &component); - void analyseComponentVariables(const ComponentPtr &component); - - void doEquivalentVariables(const VariablePtr &variable, - VariablePtrs &equivalentVariables) const; - VariablePtrs equivalentVariables(const VariablePtr &variable) const; - - void analyseEquationAst(const AnalyserEquationAstPtr &ast); - - void updateUnitsMapWithStandardUnit(const std::string &unitsName, - UnitsMap &unitsMap, - double unitsExponent); - void updateUnitsMap(const ModelPtr &model, const std::string &unitsName, - UnitsMap &unitsMap, bool userUnitsMap = false, - double unitsExponent = 1.0, - double unitsMultiplier = 0.0); - UnitsMap multiplyDivideUnitsMaps(const UnitsMap &firstUnitsMap, - const UnitsMap &secondUnitsMap, - bool multiply); - UnitsMaps multiplyDivideUnitsMaps(const UnitsMaps &firstUnitsMaps, - const UnitsMaps &secondUnitsMaps, - bool multiply = true); - UnitsMaps multiplyDivideUnitsMaps(const UnitsMaps &unitsMaps, - double factor, bool multiply); - double multiplyDivideUnitsMultipliers(double firstUnitsMultiplier, - double secondUnitsMultiplier, - bool multiply); - UnitsMultipliers multiplyDivideUnitsMultipliers(const UnitsMultipliers &firstUnitsMultipliers, - const UnitsMultipliers &secondUnitsMultipliers, - bool multiply = true); - UnitsMultipliers multiplyDivideUnitsMultipliers(double firstUnitsMultiplier, - const UnitsMultipliers &secondUnitsMultipliers, - bool multiply); - UnitsMultipliers powerRootUnitsMultipliers(const UnitsMultipliers &unitsMultipliers, - double factor, bool power); - bool areSameUnitsMaps(const UnitsMaps &firstUnitsMaps, - const UnitsMaps &secondUnitsMaps); - bool isDimensionlessUnitsMaps(const UnitsMaps &unitsMaps); - bool areSameUnitsMultipliers(const UnitsMultipliers &firstUnitsMultipliers, - const UnitsMultipliers &secondUnitsMultipliers); - void updateUnitsMultiplier(const ModelPtr &model, - const std::string &unitsName, - double &newUnitsMultiplier, - double unitsExponent = 1.0, - double unitsMultiplier = 0.0); - std::string componentName(const AnalyserEquationAstPtr &ast); - double powerValue(const AnalyserEquationAstPtr &ast, PowerData &powerData); - std::string expression(const AnalyserEquationAstPtr &ast, - bool includeHierarchy = true); - std::string expressionUnits(const UnitsMaps &unitsMaps, - const UnitsMultipliers &unitsMultipliers = {}); - std::string expressionUnits(const AnalyserEquationAstPtr &ast, - const UnitsMaps &unitsMaps, - const UnitsMaps &userUnitsMaps, - const UnitsMultipliers &unitsMultipliers); - void defaultUnitsMapsAndMultipliers(UnitsMaps &unitsMaps, - UnitsMaps &userUnitsMaps, - UnitsMultipliers &unitsMultipliers); - void analyseEquationUnits(const AnalyserEquationAstPtr &ast, - UnitsMaps &unitsMaps, UnitsMaps &userUnitsMaps, - UnitsMultipliers &unitsMultipliers, - std::string &issueDescription, PowerData &powerData); - - double scalingFactor(const VariablePtr &variable); - - void scaleAst(const AnalyserEquationAstPtr &ast, - const AnalyserEquationAstPtr &astParent, - double scalingFactor); - void scaleEquationAst(const AnalyserEquationAstPtr &ast); - - static bool isExternalVariable(const AnalyserInternalVariablePtr &variable); - - bool isStateRateBased(const AnalyserEquationPtr &equation, - AnalyserEquationPtrs &checkedEquations); - - void addInvalidVariableIssue(const AnalyserInternalVariablePtr &variable, - Issue::ReferenceRule referenceRule); - - void analyseModel(const ModelPtr &model); - - AnalyserExternalVariablePtrs::const_iterator findExternalVariable(const ModelPtr &model, - const std::string &componentName, - const std::string &variableName) const; - AnalyserExternalVariablePtrs::const_iterator findExternalVariable(const AnalyserExternalVariablePtr &externalVariable) const; -}; - Analyser::AnalyserImpl::AnalyserImpl() { // Customise our generator's profile. diff --git a/src/analyser_p.h b/src/analyser_p.h new file mode 100644 index 0000000000..138021a954 --- /dev/null +++ b/src/analyser_p.h @@ -0,0 +1,266 @@ +/* +Copyright libCellML Contributors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// #include "libcellml/analyser.h" + +#include "analysermodel_p.h" +#include "internaltypes.h" +#include "issue_p.h" +#include "logger_p.h" +#include "utilities.h" + +namespace libcellml { + +struct AnalyserInternalEquation; +struct AnalyserInternalVariable; + +using AnalyserInternalEquationWeakPtr = std::weak_ptr; +using AnalyserInternalEquationPtr = std::shared_ptr; +using AnalyserInternalVariablePtr = std::shared_ptr; + +using AnalyserInternalEquationWeakPtrs = std::vector; +using AnalyserInternalEquationPtrs = std::vector; +using AnalyserInternalVariablePtrs = std::vector; + +using AnalyserEquationPtrs = std::vector; +using AnalyserVariablePtrs = std::vector; +using AnalyserExternalVariablePtrs = std::vector; + +struct AnalyserInternalVariable +{ + enum struct Type + { + UNKNOWN, + SHOULD_BE_STATE, + INITIALISED, + VARIABLE_OF_INTEGRATION, + STATE, + CONSTANT, + COMPUTED_TRUE_CONSTANT, + COMPUTED_VARIABLE_BASED_CONSTANT, + INITIALISED_ALGEBRAIC, + ALGEBRAIC, + OVERCONSTRAINED + }; + + size_t mIndex = MAX_SIZE_T; + Type mType = Type::UNKNOWN; + bool mIsExternal = false; + + VariablePtr mInitialisingVariable; + VariablePtr mVariable; + VariablePtrs mDependencies; + + static AnalyserInternalVariablePtr create(const VariablePtr &variable); + + void setVariable(const VariablePtr &variable, + bool checkInitialValue = true); + + void makeVoi(); + void makeState(); + void makeConstant(size_t &index); +}; + +struct AnalyserInternalEquation +{ + enum struct Type + { + UNKNOWN, + TRUE_CONSTANT, + VARIABLE_BASED_CONSTANT, + ODE, + NLA, + ALGEBRAIC + }; + + Type mType = Type::UNKNOWN; + + VariablePtrs mDependencies; + + AnalyserEquationAstPtr mAst; + + ComponentPtr mComponent; + + AnalyserInternalVariablePtrs mVariables; + AnalyserInternalVariablePtrs mOdeVariables; + AnalyserInternalVariablePtrs mAllVariables; + AnalyserInternalVariablePtrs mUnknownVariables; + + size_t mNlaSystemIndex = MAX_SIZE_T; + AnalyserInternalEquationWeakPtrs mNlaSiblings; + + bool mComputedTrueConstant = true; + bool mComputedVariableBasedConstant = true; + + static AnalyserInternalEquationPtr create(const ComponentPtr &component); + static AnalyserInternalEquationPtr create(const AnalyserInternalVariablePtr &variable); + + void addVariable(const AnalyserInternalVariablePtr &variable); + void addOdeVariable(const AnalyserInternalVariablePtr &odeVariable); + + static bool isKnownVariable(const AnalyserInternalVariablePtr &variable); + static bool isKnownOdeVariable(const AnalyserInternalVariablePtr &odeVariable); + + static bool hasKnownVariables(const AnalyserInternalVariablePtrs &variables); + bool hasKnownVariables(); + + static bool isNonConstantVariable(const AnalyserInternalVariablePtr &variable); + + static bool hasNonConstantVariables(const AnalyserInternalVariablePtrs &variables); + bool hasNonConstantVariables(); + + bool variableOnLhsRhs(const AnalyserInternalVariablePtr &variable, + const AnalyserEquationAstPtr &astChild); + bool variableOnRhs(const AnalyserInternalVariablePtr &variable); + bool variableOnLhsOrRhs(const AnalyserInternalVariablePtr &variable); + + bool check(const AnalyserModelPtr &model, size_t &stateIndex, size_t &computedConstantIndex, size_t &algebraicIndex, bool checkNlaSystems); +}; + +/** + * @brief The Analyser::AnalyserImpl class. + * + * The private implementation for the Analyser class. + */ +using UnitsMap = std::map; +using UnitsMaps = std::vector; +using UnitsMultipliers = std::vector; + +class Analyser::AnalyserImpl: public Logger::LoggerImpl +{ +public: + class PowerData + { + public: + bool mDimensionlessBase; + bool mExponentValueAvailable = true; + bool mExponentValueChangeable = false; + double mExponentValue; + AnalyserEquationAstPtr mExponentAst; + }; + + Analyser *mAnalyser = nullptr; + + AnalyserModelPtr mModel = AnalyserModel::AnalyserModelImpl::create(); + + AnalyserExternalVariablePtrs mExternalVariables; + + AnalyserInternalVariablePtrs mInternalVariables; + AnalyserInternalEquationPtrs mInternalEquations; + + GeneratorProfilePtr mGeneratorProfile = libcellml::GeneratorProfile::create(); + + std::map mStandardUnits; + std::map mCiCnUnits; + + AnalyserImpl(); + + AnalyserInternalVariablePtr internalVariable(const VariablePtr &variable); + + VariablePtr voiFirstOccurrence(const VariablePtr &variable, + const ComponentPtr &component); + + void analyseNode(const XmlNodePtr &node, AnalyserEquationAstPtr &ast, + const AnalyserEquationAstPtr &astParent, + const ComponentPtr &component, + const AnalyserInternalEquationPtr &equation); + void analyseComponent(const ComponentPtr &component); + void analyseComponentVariables(const ComponentPtr &component); + + void doEquivalentVariables(const VariablePtr &variable, + VariablePtrs &equivalentVariables) const; + VariablePtrs equivalentVariables(const VariablePtr &variable) const; + + void analyseEquationAst(const AnalyserEquationAstPtr &ast); + + void updateUnitsMapWithStandardUnit(const std::string &unitsName, + UnitsMap &unitsMap, + double unitsExponent); + void updateUnitsMap(const ModelPtr &model, const std::string &unitsName, + UnitsMap &unitsMap, bool userUnitsMap = false, + double unitsExponent = 1.0, + double unitsMultiplier = 0.0); + UnitsMap multiplyDivideUnitsMaps(const UnitsMap &firstUnitsMap, + const UnitsMap &secondUnitsMap, + bool multiply); + UnitsMaps multiplyDivideUnitsMaps(const UnitsMaps &firstUnitsMaps, + const UnitsMaps &secondUnitsMaps, + bool multiply = true); + UnitsMaps multiplyDivideUnitsMaps(const UnitsMaps &unitsMaps, + double factor, bool multiply); + double multiplyDivideUnitsMultipliers(double firstUnitsMultiplier, + double secondUnitsMultiplier, + bool multiply); + UnitsMultipliers multiplyDivideUnitsMultipliers(const UnitsMultipliers &firstUnitsMultipliers, + const UnitsMultipliers &secondUnitsMultipliers, + bool multiply = true); + UnitsMultipliers multiplyDivideUnitsMultipliers(double firstUnitsMultiplier, + const UnitsMultipliers &secondUnitsMultipliers, + bool multiply); + UnitsMultipliers powerRootUnitsMultipliers(const UnitsMultipliers &unitsMultipliers, + double factor, bool power); + bool areSameUnitsMaps(const UnitsMaps &firstUnitsMaps, + const UnitsMaps &secondUnitsMaps); + bool isDimensionlessUnitsMaps(const UnitsMaps &unitsMaps); + bool areSameUnitsMultipliers(const UnitsMultipliers &firstUnitsMultipliers, + const UnitsMultipliers &secondUnitsMultipliers); + void updateUnitsMultiplier(const ModelPtr &model, + const std::string &unitsName, + double &newUnitsMultiplier, + double unitsExponent = 1.0, + double unitsMultiplier = 0.0); + std::string componentName(const AnalyserEquationAstPtr &ast); + double powerValue(const AnalyserEquationAstPtr &ast, PowerData &powerData); + std::string expression(const AnalyserEquationAstPtr &ast, + bool includeHierarchy = true); + std::string expressionUnits(const UnitsMaps &unitsMaps, + const UnitsMultipliers &unitsMultipliers = {}); + std::string expressionUnits(const AnalyserEquationAstPtr &ast, + const UnitsMaps &unitsMaps, + const UnitsMaps &userUnitsMaps, + const UnitsMultipliers &unitsMultipliers); + void defaultUnitsMapsAndMultipliers(UnitsMaps &unitsMaps, + UnitsMaps &userUnitsMaps, + UnitsMultipliers &unitsMultipliers); + void analyseEquationUnits(const AnalyserEquationAstPtr &ast, + UnitsMaps &unitsMaps, UnitsMaps &userUnitsMaps, + UnitsMultipliers &unitsMultipliers, + std::string &issueDescription, PowerData &powerData); + + double scalingFactor(const VariablePtr &variable); + + void scaleAst(const AnalyserEquationAstPtr &ast, + const AnalyserEquationAstPtr &astParent, + double scalingFactor); + void scaleEquationAst(const AnalyserEquationAstPtr &ast); + + static bool isExternalVariable(const AnalyserInternalVariablePtr &variable); + + bool isStateRateBased(const AnalyserEquationPtr &equation, + AnalyserEquationPtrs &checkedEquations); + + void addInvalidVariableIssue(const AnalyserInternalVariablePtr &variable, + Issue::ReferenceRule referenceRule); + + void analyseModel(const ModelPtr &model); + + AnalyserExternalVariablePtrs::const_iterator findExternalVariable(const ModelPtr &model, + const std::string &componentName, + const std::string &variableName) const; + AnalyserExternalVariablePtrs::const_iterator findExternalVariable(const AnalyserExternalVariablePtr &externalVariable) const; +}; + +} // namespace libcellml From 8afeb5c99c9e690d8c0827de9d552a3e6a990c42 Mon Sep 17 00:00:00 2001 From: Alan Garny Date: Fri, 16 Aug 2024 22:50:34 +0200 Subject: [PATCH 33/85] Analyser: simplified things. --- src/analyser.cpp | 94 +++++++++++++++++++++--------------------------- src/analyser_p.h | 14 ++++---- 2 files changed, 48 insertions(+), 60 deletions(-) diff --git a/src/analyser.cpp b/src/analyser.cpp index a3a345735b..2f1359eeee 100644 --- a/src/analyser.cpp +++ b/src/analyser.cpp @@ -84,9 +84,8 @@ void AnalyserInternalVariable::makeState() } } -void AnalyserInternalVariable::makeConstant(size_t &index) +void AnalyserInternalVariable::makeConstant() { - mIndex = ++index; mType = Type::CONSTANT; } @@ -119,11 +118,11 @@ void AnalyserInternalEquation::addVariable(const AnalyserInternalVariablePtr &va } } -void AnalyserInternalEquation::addOdeVariable(const AnalyserInternalVariablePtr &odeVariable) +void AnalyserInternalEquation::addStateVariable(const AnalyserInternalVariablePtr &stateVariable) { - if (std::find(mOdeVariables.begin(), mOdeVariables.end(), odeVariable) == mOdeVariables.end()) { - mOdeVariables.push_back(odeVariable); - mAllVariables.push_back(odeVariable); + if (std::find(mStateVariables.begin(), mStateVariables.end(), stateVariable) == mStateVariables.end()) { + mStateVariables.push_back(stateVariable); + mAllVariables.push_back(stateVariable); } } @@ -132,9 +131,9 @@ bool AnalyserInternalEquation::isKnownVariable(const AnalyserInternalVariablePtr return variable->mType != AnalyserInternalVariable::Type::UNKNOWN; } -bool AnalyserInternalEquation::isKnownOdeVariable(const AnalyserInternalVariablePtr &odeVariable) +bool AnalyserInternalEquation::isKnownStateVariable(const AnalyserInternalVariablePtr &stateVariable) { - return odeVariable->mIndex != MAX_SIZE_T; + return stateVariable->mIsKnownStateVariable; } bool AnalyserInternalEquation::hasKnownVariables(const AnalyserInternalVariablePtrs &variables) @@ -146,7 +145,7 @@ bool AnalyserInternalEquation::hasKnownVariables(const AnalyserInternalVariableP bool AnalyserInternalEquation::hasKnownVariables() { - return hasKnownVariables(mVariables) || hasKnownVariables(mOdeVariables); + return hasKnownVariables(mVariables) || hasKnownVariables(mStateVariables); } bool AnalyserInternalEquation::isNonConstantVariable(const AnalyserInternalVariablePtr &variable) @@ -156,7 +155,7 @@ bool AnalyserInternalEquation::isNonConstantVariable(const AnalyserInternalVaria // know for sure that it's neither a state variable nor a variable // that is computed using an NLA system. - return variable->mIsExternal + return variable->mIsExternalVariable || ((variable->mType != AnalyserInternalVariable::Type::UNKNOWN) && (variable->mType != AnalyserInternalVariable::Type::INITIALISED) && (variable->mType != AnalyserInternalVariable::Type::COMPUTED_TRUE_CONSTANT) @@ -172,7 +171,7 @@ bool AnalyserInternalEquation::hasNonConstantVariables(const AnalyserInternalVar bool AnalyserInternalEquation::hasNonConstantVariables() { - return hasNonConstantVariables(mVariables) || hasNonConstantVariables(mOdeVariables); + return hasNonConstantVariables(mVariables) || hasNonConstantVariables(mStateVariables); } bool AnalyserInternalEquation::variableOnLhsRhs(const AnalyserInternalVariablePtr &variable, @@ -199,8 +198,7 @@ bool AnalyserInternalEquation::variableOnLhsOrRhs(const AnalyserInternalVariable || variableOnRhs(variable); } -bool AnalyserInternalEquation::check(const AnalyserModelPtr &model, - size_t &stateIndex, size_t &computedConstantIndex, size_t &algebraicIndex, bool checkNlaSystems) +bool AnalyserInternalEquation::check(const AnalyserModelPtr &model, bool checkNlaSystems) { // Nothing to check if the equation has a known type. @@ -208,13 +206,13 @@ bool AnalyserInternalEquation::check(const AnalyserModelPtr &model, return false; } - // Determine, from the (new) known (ODE) variables, whether the equation is + // Determine, from the (new) known (state) variables, whether the equation is // used to compute a true constant or a variable-based constant. mComputedTrueConstant = mComputedTrueConstant && !hasKnownVariables(); mComputedVariableBasedConstant = mComputedVariableBasedConstant && !hasNonConstantVariables(); - // Add, as a dependency, the variables used to compute the (new) known (ODE) + // Add, as a dependency, the variables used to compute the (new) known (state) // variables. for (const auto &variable : mVariables) { @@ -223,20 +221,20 @@ bool AnalyserInternalEquation::check(const AnalyserModelPtr &model, } } - // Stop tracking (new) known (ODE) variables. + // Stop tracking (new) known (state) variables. mVariables.erase(std::remove_if(mVariables.begin(), mVariables.end(), isKnownVariable), mVariables.end()); - mOdeVariables.erase(std::remove_if(mOdeVariables.begin(), mOdeVariables.end(), isKnownOdeVariable), mOdeVariables.end()); + mStateVariables.erase(std::remove_if(mStateVariables.begin(), mStateVariables.end(), isKnownStateVariable), mStateVariables.end()); - // If there is no (ODE) variable left then it means that the variables in + // If there is no (state) variable left then it means that the variables in // the equation are overconstrained unless one of them was initialised in // which case it will now be considered as an algebraic variable and this // equation as an NLA equation. - auto unknownVariablesOrOdeVariablesLeft = mVariables.size() + mOdeVariables.size(); + auto unknownVariablesOrStateVariablesLeft = mVariables.size() + mStateVariables.size(); AnalyserInternalVariablePtrs initialisedVariables; - if (checkNlaSystems && (unknownVariablesOrOdeVariablesLeft == 0)) { + if (checkNlaSystems && (unknownVariablesOrStateVariablesLeft == 0)) { for (const auto &variable : mAllVariables) { switch (variable->mType) { case AnalyserInternalVariable::Type::INITIALISED: @@ -266,7 +264,7 @@ bool AnalyserInternalEquation::check(const AnalyserModelPtr &model, } } - // If there is one (ODE) variable left (on its own on the LHS/RHS of the + // If there is one (state) variable left (on its own on the LHS/RHS of the // equation or in case we check for NLA systems) or some initialised // variables then update its variable (to be the corresponding one in the // component in which the equation is), as well as set its type (if it is @@ -274,9 +272,9 @@ bool AnalyserInternalEquation::check(const AnalyserModelPtr &model, // Finally, set the type and order of the equation, should everything have // gone as planned. - auto unknownVariableLeft = (unknownVariablesOrOdeVariablesLeft == 1) ? + auto unknownVariableLeft = (unknownVariablesOrStateVariablesLeft == 1) ? mVariables.empty() ? - mOdeVariables.front() : + mStateVariables.front() : mVariables.front() : nullptr; @@ -284,9 +282,9 @@ bool AnalyserInternalEquation::check(const AnalyserModelPtr &model, && (checkNlaSystems || variableOnLhsOrRhs(unknownVariableLeft))) || !initialisedVariables.empty()) { auto variables = mVariables.empty() ? - mOdeVariables.empty() ? + mStateVariables.empty() ? initialisedVariables : - mOdeVariables : + mStateVariables : mVariables; for (const auto &variable : variables) { @@ -313,12 +311,7 @@ bool AnalyserInternalEquation::check(const AnalyserModelPtr &model, case AnalyserInternalVariable::Type::COMPUTED_VARIABLE_BASED_CONSTANT: case AnalyserInternalVariable::Type::INITIALISED_ALGEBRAIC: case AnalyserInternalVariable::Type::ALGEBRAIC: - variable->mIndex = (variable->mType == AnalyserInternalVariable::Type::STATE) ? - ++stateIndex : - ((variable->mType == AnalyserInternalVariable::Type::COMPUTED_TRUE_CONSTANT) - || (variable->mType == AnalyserInternalVariable::Type::COMPUTED_VARIABLE_BASED_CONSTANT)) ? - ++computedConstantIndex : - ++algebraicIndex; + variable->mIsKnownStateVariable = variable->mType == AnalyserInternalVariable::Type::STATE; mUnknownVariables.push_back(variable); @@ -739,11 +732,11 @@ void Analyser::AnalyserImpl::analyseNode(const XmlNodePtr &node, // something that is not allowed in CellML and will therefore be // reported when we validate the model. - // Have our equation track the (ODE) variable (by ODE variable, we mean + // Have our equation track the (state) variable (by state variable, we mean // a variable that is used in a "diff" element). if (node->parent()->firstChild()->isMathmlElement("diff")) { - equation->addOdeVariable(internalVariable(variable)); + equation->addStateVariable(internalVariable(variable)); } else if (!node->parent()->isMathmlElement("bvar")) { equation->addVariable(internalVariable(variable)); } @@ -2231,7 +2224,7 @@ void Analyser::AnalyserImpl::scaleEquationAst(const AnalyserEquationAstPtr &ast) bool Analyser::AnalyserImpl::isExternalVariable(const AnalyserInternalVariablePtr &variable) { - return variable->mIsExternal; + return variable->mIsExternalVariable; } bool Analyser::AnalyserImpl::isStateRateBased(const AnalyserEquationPtr &equation, @@ -2352,8 +2345,8 @@ void Analyser::AnalyserImpl::analyseModel(const ModelPtr &model) primaryExternalVariables[internalVariable->mVariable].push_back(variable); - if (!internalVariable->mIsExternal) { - internalVariable->mIsExternal = true; + if (!internalVariable->mIsExternalVariable) { + internalVariable->mIsExternalVariable = true; for (const auto &dependency : externalVariable->dependencies()) { internalVariable->mDependencies.push_back(Analyser::AnalyserImpl::internalVariable(dependency)->mVariable); @@ -2480,7 +2473,7 @@ void Analyser::AnalyserImpl::analyseModel(const ModelPtr &model) // Detmerine whether some variables have been marked as external. auto hasExternalVariables = std::any_of(mInternalVariables.begin(), mInternalVariables.end(), [](const auto &iv) { - return iv->mIsExternal; + return iv->mIsExternalVariable; }); // Loop over our equations, checking which variables, if any, can be @@ -2495,10 +2488,6 @@ void Analyser::AnalyserImpl::analyseModel(const ModelPtr &model) // model invalid) that have been marked as external (rendering the // model valid). - auto stateIndex = MAX_SIZE_T; - auto constantIndex = MAX_SIZE_T; - auto computedConstantIndex = MAX_SIZE_T; - auto algebraicIndex = MAX_SIZE_T; auto loopNumber = 1; bool relevantCheck; auto checkNlaSystems = false; @@ -2507,7 +2496,7 @@ void Analyser::AnalyserImpl::analyseModel(const ModelPtr &model) relevantCheck = false; for (const auto &internalEquation : mInternalEquations) { - relevantCheck = internalEquation->check(mModel, stateIndex, computedConstantIndex, algebraicIndex, checkNlaSystems) + relevantCheck = internalEquation->check(mModel, checkNlaSystems) || relevantCheck; } @@ -2522,7 +2511,7 @@ void Analyser::AnalyserImpl::analyseModel(const ModelPtr &model) // marked as external and we go through the two loops one more time. for (const auto &internalVariable : mInternalVariables) { - if (internalVariable->mIsExternal + if (internalVariable->mIsExternalVariable && (internalVariable->mType == AnalyserInternalVariable::Type::UNKNOWN)) { internalVariable->mType = AnalyserInternalVariable::Type::INITIALISED; } @@ -2552,7 +2541,7 @@ void Analyser::AnalyserImpl::analyseModel(const ModelPtr &model) case AnalyserInternalVariable::Type::INITIALISED: // The variable is (still) initialised so it has to be a constant. - internalVariable->makeConstant(constantIndex); + internalVariable->makeConstant(); break; case AnalyserInternalVariable::Type::OVERCONSTRAINED: @@ -2606,7 +2595,7 @@ void Analyser::AnalyserImpl::analyseModel(const ModelPtr &model) if (internalEquation->mType == AnalyserInternalEquation::Type::NLA) { for (const auto &unknownVariable : internalEquation->mUnknownVariables) { - if (unknownVariable->mIsExternal + if (unknownVariable->mIsExternalVariable && (std::find(addedExternalVariables.begin(), addedExternalVariables.end(), unknownVariable) == addedExternalVariables.end())) { addedExternalVariables.push_back(unknownVariable); addedInternalEquations.push_back(AnalyserInternalEquation::create(unknownVariable)); @@ -2754,7 +2743,7 @@ void Analyser::AnalyserImpl::analyseModel(const ModelPtr &model) // have been marked as external return std::any_of(ie->mUnknownVariables.begin(), ie->mUnknownVariables.end(), [](const auto &uv) { - return !uv->mIsExternal; + return !uv->mIsExternalVariable; }); } @@ -2814,7 +2803,7 @@ void Analyser::AnalyserImpl::analyseModel(const ModelPtr &model) auto externalEquation = true; for (const auto &unknownVariable : internalEquation->mUnknownVariables) { - if (!unknownVariable->mIsExternal) { + if (!unknownVariable->mIsExternalVariable) { externalEquation = false; break; @@ -2866,19 +2855,18 @@ void Analyser::AnalyserImpl::analyseModel(const ModelPtr &model) std::map aiv2avMappings; std::map v2avMappings; + auto stateIndex = MAX_SIZE_T; + auto constantIndex = MAX_SIZE_T; + auto computedConstantIndex = MAX_SIZE_T; + auto algebraicIndex = MAX_SIZE_T; auto externalIndex = MAX_SIZE_T; - stateIndex = MAX_SIZE_T; - constantIndex = MAX_SIZE_T; - computedConstantIndex = MAX_SIZE_T; - algebraicIndex = MAX_SIZE_T; - for (const auto &internalVariable : mInternalVariables) { // Determine the type of the variable. AnalyserVariable::Type type; - if (internalVariable->mIsExternal) { + if (internalVariable->mIsExternalVariable) { type = AnalyserVariable::Type::EXTERNAL; } else { switch (internalVariable->mType) { diff --git a/src/analyser_p.h b/src/analyser_p.h index 138021a954..f79606e065 100644 --- a/src/analyser_p.h +++ b/src/analyser_p.h @@ -56,9 +56,9 @@ struct AnalyserInternalVariable OVERCONSTRAINED }; - size_t mIndex = MAX_SIZE_T; Type mType = Type::UNKNOWN; - bool mIsExternal = false; + bool mIsKnownStateVariable = false; + bool mIsExternalVariable = false; VariablePtr mInitialisingVariable; VariablePtr mVariable; @@ -71,7 +71,7 @@ struct AnalyserInternalVariable void makeVoi(); void makeState(); - void makeConstant(size_t &index); + void makeConstant(); }; struct AnalyserInternalEquation @@ -95,7 +95,7 @@ struct AnalyserInternalEquation ComponentPtr mComponent; AnalyserInternalVariablePtrs mVariables; - AnalyserInternalVariablePtrs mOdeVariables; + AnalyserInternalVariablePtrs mStateVariables; AnalyserInternalVariablePtrs mAllVariables; AnalyserInternalVariablePtrs mUnknownVariables; @@ -109,10 +109,10 @@ struct AnalyserInternalEquation static AnalyserInternalEquationPtr create(const AnalyserInternalVariablePtr &variable); void addVariable(const AnalyserInternalVariablePtr &variable); - void addOdeVariable(const AnalyserInternalVariablePtr &odeVariable); + void addStateVariable(const AnalyserInternalVariablePtr &stateVariable); static bool isKnownVariable(const AnalyserInternalVariablePtr &variable); - static bool isKnownOdeVariable(const AnalyserInternalVariablePtr &odeVariable); + static bool isKnownStateVariable(const AnalyserInternalVariablePtr &stateVariable); static bool hasKnownVariables(const AnalyserInternalVariablePtrs &variables); bool hasKnownVariables(); @@ -127,7 +127,7 @@ struct AnalyserInternalEquation bool variableOnRhs(const AnalyserInternalVariablePtr &variable); bool variableOnLhsOrRhs(const AnalyserInternalVariablePtr &variable); - bool check(const AnalyserModelPtr &model, size_t &stateIndex, size_t &computedConstantIndex, size_t &algebraicIndex, bool checkNlaSystems); + bool check(const AnalyserModelPtr &model, bool checkNlaSystems); }; /** From 40d3fb497c6543757fcbddaa0c0c6cb7203492a1 Mon Sep 17 00:00:00 2001 From: Alan Garny Date: Sat, 17 Aug 2024 11:14:53 +0200 Subject: [PATCH 34/85] Generator: make sure that constants are initialised when they are needed to initialise a state. --- src/generator.cpp | 48 +++++++++++-------- .../model.c | 2 +- .../model.py | 2 +- .../model.c | 4 +- .../model.py | 4 +- .../model.c | 2 +- .../model.py | 2 +- 7 files changed, 37 insertions(+), 27 deletions(-) diff --git a/src/generator.cpp b/src/generator.cpp index 9f62dfb957..b9551a2490 100644 --- a/src/generator.cpp +++ b/src/generator.cpp @@ -1813,11 +1813,26 @@ void Generator::GeneratorImpl::addImplementationInitialiseVariablesMethodCode(st auto implementationInitialiseVariablesMethodString = mProfile->implementationInitialiseVariablesMethodString(modelHasOdes()); if (!implementationInitialiseVariablesMethodString.empty()) { - // Initialise our states. + // Initialise our states (after, if needed, initialising the constant on which it depends). std::string methodBody; + auto constants = mModel->constants(); for (const auto &state : mModel->states()) { + auto initialisingVariable = state->initialisingVariable(); + auto initialValue = initialisingVariable->initialValue(); + + if (!isCellMLReal(initialValue)) { + auto constant = std::find_if(constants.begin(), constants.end(), + [=](const AnalyserVariablePtr &av) -> bool { return av->variable()->name() == initialValue; }); + + if (constant != constants.end()) { + methodBody += generateInitialisationCode(*constant); + + constants.erase(constant); + } + } + methodBody += generateInitialisationCode(state); } @@ -1830,29 +1845,24 @@ void Generator::GeneratorImpl::addImplementationInitialiseVariablesMethodCode(st } } - // Initialise our constants and our algebraic variables that have an initial value. Also use an initial guess of - // zero for algebraic variables computed using an NLA system. + // Initialise our constants. + + for (const auto &constant : constants) { + methodBody += generateInitialisationCode(constant); + } + + // Initialise our algebraic variables that have an initial value. Also use an initial guess of zero for + // algebraic variables computed using an NLA system. // Note: a variable which is the only unknown in an equation, but which is not on its own on either the LHS or // RHS of that equation (e.g., x = y+z with x and y known and z unknown) is (currently) to be computed // using an NLA system for which we need an initial guess. We use an initial guess of zero, which is fine // since such an NLA system has only one solution. - for (const auto &variable : variables(mModel)) { - switch (variable->type()) { - case AnalyserVariable::Type::CONSTANT: - methodBody += generateInitialisationCode(variable); - - break; - case AnalyserVariable::Type::ALGEBRAIC: - if (variable->initialisingVariable() != nullptr) { - methodBody += generateInitialisationCode(variable); - } else if (variable->equation(0)->type() == AnalyserEquation::Type::NLA) { - methodBody += generateZeroInitialisationCode(variable); - } - - break; - default: // Other types we don't care about. - break; + for (const auto &algebraic : mModel->algebraic()) { + if (algebraic->initialisingVariable() != nullptr) { + methodBody += generateInitialisationCode(algebraic); + } else if (algebraic->equation(0)->type() == AnalyserEquation::Type::NLA) { + methodBody += generateZeroInitialisationCode(algebraic); } } diff --git a/tests/resources/generator/cellml_state_initialised_using_variable/model.c b/tests/resources/generator/cellml_state_initialised_using_variable/model.c index a146b4d201..67ec8957ec 100644 --- a/tests/resources/generator/cellml_state_initialised_using_variable/model.c +++ b/tests/resources/generator/cellml_state_initialised_using_variable/model.c @@ -80,8 +80,8 @@ void deleteArray(double *array) void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic) { - states[0] = constants[0]; constants[0] = 123.0; + states[0] = constants[0]; } void computeComputedConstants(double *constants, double *computedConstants) diff --git a/tests/resources/generator/cellml_state_initialised_using_variable/model.py b/tests/resources/generator/cellml_state_initialised_using_variable/model.py index 032002fb91..8ce57554e5 100644 --- a/tests/resources/generator/cellml_state_initialised_using_variable/model.py +++ b/tests/resources/generator/cellml_state_initialised_using_variable/model.py @@ -46,8 +46,8 @@ def create_algebraic_array(): def initialise_variables(voi, states, rates, constants, algebraic): - states[0] = constants[0] constants[0] = 123.0 + states[0] = constants[0] def compute_computed_constants(constants, computed_constants): diff --git a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.c b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.c index 363343cd2b..e860b309e6 100644 --- a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.c +++ b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.c @@ -82,10 +82,10 @@ void deleteArray(double *array) void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic) { - states[0] = constants[0]; - states[1] = 0.001*constants[1]; constants[0] = 123.0; + states[0] = constants[0]; constants[1] = 789.0; + states[1] = 0.001*constants[1]; } void computeComputedConstants(double *constants, double *computedConstants) diff --git a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.py b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.py index 7e03b6de11..b58354e4ba 100644 --- a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.py +++ b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.py @@ -48,10 +48,10 @@ def create_algebraic_array(): def initialise_variables(voi, states, rates, constants, algebraic): - states[0] = constants[0] - states[1] = 0.001*constants[1] constants[0] = 123.0 + states[0] = constants[0] constants[1] = 789.0 + states[1] = 0.001*constants[1] def compute_computed_constants(constants, computed_constants): diff --git a/tests/resources/generator/variable_initialised_using_a_constant/model.c b/tests/resources/generator/variable_initialised_using_a_constant/model.c index e4500b462b..4539a6618b 100644 --- a/tests/resources/generator/variable_initialised_using_a_constant/model.c +++ b/tests/resources/generator/variable_initialised_using_a_constant/model.c @@ -80,8 +80,8 @@ void deleteArray(double *array) void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic) { - states[0] = constants[0]; constants[0] = 7.0; + states[0] = constants[0]; } void computeComputedConstants(double *constants, double *computedConstants) diff --git a/tests/resources/generator/variable_initialised_using_a_constant/model.py b/tests/resources/generator/variable_initialised_using_a_constant/model.py index 539c2776c4..092c15be25 100644 --- a/tests/resources/generator/variable_initialised_using_a_constant/model.py +++ b/tests/resources/generator/variable_initialised_using_a_constant/model.py @@ -46,8 +46,8 @@ def create_algebraic_array(): def initialise_variables(voi, states, rates, constants, algebraic): - states[0] = constants[0] constants[0] = 7.0 + states[0] = constants[0] def compute_computed_constants(constants, computed_constants): From b32d169a7d08b41959e00927e23c1a31f27ea1d0 Mon Sep 17 00:00:00 2001 From: Alan Garny Date: Mon, 19 Aug 2024 11:13:44 +0200 Subject: [PATCH 35/85] Generator: renamed the "external" array to "externals". Oversight on my part! --- src/generatorprofile.cpp | 4 +-- src/generatorprofilesha1values.h | 4 +-- .../bindings/python/test_generator_profile.py | 2 +- tests/generator/generatorprofile.cpp | 2 +- .../model.external.c | 4 +-- .../model.external.py | 4 +-- .../model.external.c | 2 +- .../model.external.py | 2 +- .../model.three.externals.c | 6 ++--- .../model.three.externals.py | 6 ++--- .../cell_geometry_model/model.external.c | 6 ++--- .../cell_geometry_model/model.external.py | 6 ++--- .../model.algebraic.c | 6 ++--- .../model.algebraic.py | 6 ++--- .../model.computed.constant.c | 8 +++--- .../model.computed.constant.py | 8 +++--- .../model.constant.c | 6 ++--- .../model.constant.py | 6 ++--- .../model.dependent.algebraic.c | 12 ++++----- .../model.dependent.algebraic.py | 12 ++++----- .../model.dependent.computed.constant.c | 20 +++++++------- .../model.dependent.computed.constant.py | 20 +++++++------- .../model.dependent.constant.c | 14 +++++----- .../model.dependent.constant.py | 14 +++++----- .../model.dependent.state.c | 24 ++++++++--------- .../model.dependent.state.py | 24 ++++++++--------- .../model.external.c | 26 +++++++++---------- .../model.external.py | 26 +++++++++---------- .../model.state.c | 8 +++--- .../model.state.py | 8 +++--- .../model.c | 4 +-- .../model.py | 4 +-- 32 files changed, 152 insertions(+), 152 deletions(-) diff --git a/src/generatorprofile.cpp b/src/generatorprofile.cpp index 8de812817c..08d9b9a825 100644 --- a/src/generatorprofile.cpp +++ b/src/generatorprofile.cpp @@ -288,7 +288,7 @@ void GeneratorProfile::GeneratorProfileImpl::loadProfile(GeneratorProfile::Profi mConstantsArrayString = "constants"; mComputedConstantsArrayString = "computedConstants"; mAlgebraicArrayString = "algebraic"; - mExternalArrayString = "external"; + mExternalArrayString = "externals"; mExternalVariableMethodTypeDefinitionFamString = "typedef double (* ExternalVariable)(double *variables, size_t index);\n"; mExternalVariableMethodTypeDefinitionFdmString = "typedef double (* ExternalVariable)(double voi, double *states, double *rates, double *variables, size_t index);\n"; @@ -729,7 +729,7 @@ void GeneratorProfile::GeneratorProfileImpl::loadProfile(GeneratorProfile::Profi mConstantsArrayString = "constants"; mComputedConstantsArrayString = "computed_constants"; mAlgebraicArrayString = "algebraic"; - mExternalArrayString = "external"; + mExternalArrayString = "externals"; mExternalVariableMethodTypeDefinitionFamString = ""; mExternalVariableMethodTypeDefinitionFdmString = ""; diff --git a/src/generatorprofilesha1values.h b/src/generatorprofilesha1values.h index dacc0b264f..6d03642adf 100644 --- a/src/generatorprofilesha1values.h +++ b/src/generatorprofilesha1values.h @@ -24,7 +24,7 @@ namespace libcellml { * The content of this file is generated, do not edit this file directly. * See docs/dev_utilities.rst for further information. */ -static const char C_GENERATOR_PROFILE_SHA1[] = "323f0e5824d5c794c28f34dda5e7410efc836e62"; -static const char PYTHON_GENERATOR_PROFILE_SHA1[] = "3f6672212636b5179b23b9664cead525f54f665f"; +static const char C_GENERATOR_PROFILE_SHA1[] = "ad23abd7fbd49d6b76113c14b0d2ec4c7df09d41"; +static const char PYTHON_GENERATOR_PROFILE_SHA1[] = "cced8fe15a79248bc3902c9f45637b053243fc98"; } // namespace libcellml diff --git a/tests/bindings/python/test_generator_profile.py b/tests/bindings/python/test_generator_profile.py index c030ba9c8b..d4d8703e51 100644 --- a/tests/bindings/python/test_generator_profile.py +++ b/tests/bindings/python/test_generator_profile.py @@ -1667,7 +1667,7 @@ def test_external_array_string(self): g = GeneratorProfile() - self.assertEqual('external', g.externalArrayString()) + self.assertEqual('externals', g.externalArrayString()) g.setExternalArrayString(GeneratorProfileTestCase.VALUE) self.assertEqual(GeneratorProfileTestCase.VALUE, g.externalArrayString()) diff --git a/tests/generator/generatorprofile.cpp b/tests/generator/generatorprofile.cpp index 155af5a07e..62bdb259fd 100644 --- a/tests/generator/generatorprofile.cpp +++ b/tests/generator/generatorprofile.cpp @@ -340,7 +340,7 @@ TEST(GeneratorProfile, defaultMiscellaneousValues) EXPECT_EQ("constants", generatorProfile->constantsArrayString()); EXPECT_EQ("computedConstants", generatorProfile->computedConstantsArrayString()); EXPECT_EQ("algebraic", generatorProfile->algebraicArrayString()); - EXPECT_EQ("external", generatorProfile->externalArrayString()); + EXPECT_EQ("externals", generatorProfile->externalArrayString()); EXPECT_EQ("typedef double (* ExternalVariable)(double *variables, size_t index);\n", generatorProfile->externalVariableMethodTypeDefinitionString(false)); EXPECT_EQ("typedef double (* ExternalVariable)(double voi, double *states, double *rates, double *variables, size_t index);\n", generatorProfile->externalVariableMethodTypeDefinitionString(true)); diff --git a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.c b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.c index 5cea89727f..670484b6a5 100644 --- a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.c +++ b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.c @@ -86,6 +86,6 @@ void computeComputedConstants(double *constants, double *computedConstants) void computeVariables(double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) { - external[0] = externalVariable(variables, 0); - algebraic[0] = external[0]; + externals[0] = externalVariable(variables, 0); + algebraic[0] = externals[0]; } diff --git a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.py b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.py index 8ce48759d5..08357f1eed 100644 --- a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.py +++ b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.py @@ -52,5 +52,5 @@ def compute_computed_constants(constants, computed_constants): def compute_variables(constants, computed_constants, algebraic, external_variable): - external[0] = external_variable(variables, 0) - algebraic[0] = external[0] + externals[0] = external_variable(variables, 0) + algebraic[0] = externals[0] diff --git a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.c b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.c index 2d502bbe6e..ba2a7e9056 100644 --- a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.c +++ b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.c @@ -91,5 +91,5 @@ void computeComputedConstants(double *constants, double *computedConstants) void computeVariables(double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) { - external[0] = externalVariable(variables, 0); + externals[0] = externalVariable(variables, 0); } diff --git a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.py b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.py index 67217abb1b..1253e4dad2 100644 --- a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.py +++ b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.py @@ -56,4 +56,4 @@ def compute_computed_constants(constants, computed_constants): def compute_variables(constants, computed_constants, algebraic, external_variable): - external[0] = external_variable(variables, 0) + externals[0] = external_variable(variables, 0) diff --git a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.c b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.c index 620fc55239..25af29adaa 100644 --- a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.c +++ b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.c @@ -87,7 +87,7 @@ void computeComputedConstants(double *constants, double *computedConstants) void computeVariables(double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) { - external[0] = externalVariable(variables, 0); - external[1] = externalVariable(variables, 1); - external[2] = externalVariable(variables, 2); + externals[0] = externalVariable(variables, 0); + externals[1] = externalVariable(variables, 1); + externals[2] = externalVariable(variables, 2); } diff --git a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.py b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.py index 1b2b68c5fa..fbc56b7156 100644 --- a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.py +++ b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.py @@ -53,6 +53,6 @@ def compute_computed_constants(constants, computed_constants): def compute_variables(constants, computed_constants, algebraic, external_variable): - external[0] = external_variable(variables, 0) - external[1] = external_variable(variables, 1) - external[2] = external_variable(variables, 2) + externals[0] = external_variable(variables, 0) + externals[1] = external_variable(variables, 1) + externals[2] = external_variable(variables, 2) diff --git a/tests/resources/generator/cell_geometry_model/model.external.c b/tests/resources/generator/cell_geometry_model/model.external.c index c4c33c7c07..a57c6692c0 100644 --- a/tests/resources/generator/cell_geometry_model/model.external.c +++ b/tests/resources/generator/cell_geometry_model/model.external.c @@ -88,8 +88,8 @@ void computeComputedConstants(double *constants, double *computedConstants) void computeVariables(double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) { - external[0] = externalVariable(variables, 0); - external[1] = externalVariable(variables, 1); - algebraic[0] = 1000.0*3.14*external[1]*external[1]*external[0]; + externals[0] = externalVariable(variables, 0); + externals[1] = externalVariable(variables, 1); + algebraic[0] = 1000.0*3.14*externals[1]*externals[1]*externals[0]; algebraic[1] = 0.02*algebraic[0]; } diff --git a/tests/resources/generator/cell_geometry_model/model.external.py b/tests/resources/generator/cell_geometry_model/model.external.py index 8f9555d5cb..e220d2e73d 100644 --- a/tests/resources/generator/cell_geometry_model/model.external.py +++ b/tests/resources/generator/cell_geometry_model/model.external.py @@ -54,7 +54,7 @@ def compute_computed_constants(constants, computed_constants): def compute_variables(constants, computed_constants, algebraic, external_variable): - external[0] = external_variable(variables, 0) - external[1] = external_variable(variables, 1) - algebraic[0] = 1000.0*3.14*external[1]*external[1]*external[0] + externals[0] = external_variable(variables, 0) + externals[1] = external_variable(variables, 1) + algebraic[0] = 1000.0*3.14*externals[1]*externals[1]*externals[0] algebraic[1] = 0.02*algebraic[0] diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.c index 3ca0c5371b..cdeae6291f 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.c @@ -135,11 +135,11 @@ void computeComputedConstants(double *constants, double *computedConstants) void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) { - external[0] = externalVariable(voi, states, rates, variables, 0); + externals[0] = externalVariable(voi, states, rates, variables, 0); algebraic[0] = constants[2]*(states[0]-computedConstants[0]); algebraic[1] = constants[4]*pow(states[3], 4.0)*(states[0]-computedConstants[2]); algebraic[2] = constants[3]*pow(states[2], 3.0)*states[1]*(states[0]-computedConstants[1]); - rates[0] = -(-external[0]+algebraic[2]+algebraic[1]+algebraic[0])/constants[0]; + rates[0] = -(-externals[0]+algebraic[2]+algebraic[1]+algebraic[0])/constants[0]; algebraic[3] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0); algebraic[4] = 4.0*exp(states[0]/18.0); rates[2] = algebraic[3]*(1.0-states[2])-algebraic[4]*states[2]; @@ -153,7 +153,7 @@ void computeRates(double voi, double *states, double *rates, double *constants, void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) { - external[0] = externalVariable(voi, states, rates, variables, 0); + externals[0] = externalVariable(voi, states, rates, variables, 0); algebraic[0] = constants[2]*(states[0]-computedConstants[0]); algebraic[2] = constants[3]*pow(states[2], 3.0)*states[1]*(states[0]-computedConstants[1]); algebraic[3] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.py index bbc403eae2..efe508ad16 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.py @@ -104,11 +104,11 @@ def compute_computed_constants(constants, computed_constants): def compute_rates(voi, states, rates, constants, computed_constants, algebraic, external_variable): - external[0] = external_variable(voi, states, rates, variables, 0) + externals[0] = external_variable(voi, states, rates, variables, 0) algebraic[0] = constants[2]*(states[0]-computed_constants[0]) algebraic[1] = constants[4]*pow(states[3], 4.0)*(states[0]-computed_constants[2]) algebraic[2] = constants[3]*pow(states[2], 3.0)*states[1]*(states[0]-computed_constants[1]) - rates[0] = -(-external[0]+algebraic[2]+algebraic[1]+algebraic[0])/constants[0] + rates[0] = -(-externals[0]+algebraic[2]+algebraic[1]+algebraic[0])/constants[0] algebraic[3] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0) algebraic[4] = 4.0*exp(states[0]/18.0) rates[2] = algebraic[3]*(1.0-states[2])-algebraic[4]*states[2] @@ -121,7 +121,7 @@ def compute_rates(voi, states, rates, constants, computed_constants, algebraic, def compute_variables(voi, states, rates, constants, computed_constants, algebraic, external_variable): - external[0] = external_variable(voi, states, rates, variables, 0) + externals[0] = external_variable(voi, states, rates, variables, 0) algebraic[0] = constants[2]*(states[0]-computed_constants[0]) algebraic[2] = constants[3]*pow(states[2], 3.0)*states[1]*(states[0]-computed_constants[1]) algebraic[3] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0) diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.c index 9de4002c1f..2e6435a24e 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.c @@ -135,8 +135,8 @@ void computeComputedConstants(double *constants, double *computedConstants) void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) { algebraic[0] = ((voi >= 10.0) && (voi <= 10.5))?-20.0:0.0; - external[0] = externalVariable(voi, states, rates, variables, 0); - algebraic[1] = constants[2]*(states[0]-external[0]); + externals[0] = externalVariable(voi, states, rates, variables, 0); + algebraic[1] = constants[2]*(states[0]-externals[0]); algebraic[2] = constants[4]*pow(states[3], 4.0)*(states[0]-computedConstants[1]); algebraic[3] = constants[3]*pow(states[2], 3.0)*states[1]*(states[0]-computedConstants[0]); rates[0] = -(-algebraic[0]+algebraic[3]+algebraic[2]+algebraic[1])/constants[0]; @@ -153,8 +153,8 @@ void computeRates(double voi, double *states, double *rates, double *constants, void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) { - external[0] = externalVariable(voi, states, rates, variables, 0); - algebraic[1] = constants[2]*(states[0]-external[0]); + externals[0] = externalVariable(voi, states, rates, variables, 0); + algebraic[1] = constants[2]*(states[0]-externals[0]); algebraic[3] = constants[3]*pow(states[2], 3.0)*states[1]*(states[0]-computedConstants[0]); algebraic[4] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0); algebraic[5] = 4.0*exp(states[0]/18.0); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.py index a9fd749a9f..a1324eb79a 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.py @@ -104,8 +104,8 @@ def compute_computed_constants(constants, computed_constants): def compute_rates(voi, states, rates, constants, computed_constants, algebraic, external_variable): algebraic[0] = -20.0 if and_func(geq_func(voi, 10.0), leq_func(voi, 10.5)) else 0.0 - external[0] = external_variable(voi, states, rates, variables, 0) - algebraic[1] = constants[2]*(states[0]-external[0]) + externals[0] = external_variable(voi, states, rates, variables, 0) + algebraic[1] = constants[2]*(states[0]-externals[0]) algebraic[2] = constants[4]*pow(states[3], 4.0)*(states[0]-computed_constants[1]) algebraic[3] = constants[3]*pow(states[2], 3.0)*states[1]*(states[0]-computed_constants[0]) rates[0] = -(-algebraic[0]+algebraic[3]+algebraic[2]+algebraic[1])/constants[0] @@ -121,8 +121,8 @@ def compute_rates(voi, states, rates, constants, computed_constants, algebraic, def compute_variables(voi, states, rates, constants, computed_constants, algebraic, external_variable): - external[0] = external_variable(voi, states, rates, variables, 0) - algebraic[1] = constants[2]*(states[0]-external[0]) + externals[0] = external_variable(voi, states, rates, variables, 0) + algebraic[1] = constants[2]*(states[0]-externals[0]) algebraic[3] = constants[3]*pow(states[2], 3.0)*states[1]*(states[0]-computed_constants[0]) algebraic[4] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0) algebraic[5] = 4.0*exp(states[0]/18.0) diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.c index 83398ea28e..6d271f592c 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.c @@ -135,11 +135,11 @@ void computeComputedConstants(double *constants, double *computedConstants) void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) { algebraic[0] = ((voi >= 10.0) && (voi <= 10.5))?-20.0:0.0; - external[0] = externalVariable(voi, states, rates, variables, 0); + externals[0] = externalVariable(voi, states, rates, variables, 0); algebraic[1] = constants[1]*(states[0]-computedConstants[0]); algebraic[2] = constants[3]*pow(states[3], 4.0)*(states[0]-computedConstants[2]); algebraic[3] = constants[2]*pow(states[2], 3.0)*states[1]*(states[0]-computedConstants[1]); - rates[0] = -(-algebraic[0]+algebraic[3]+algebraic[2]+algebraic[1])/external[0]; + rates[0] = -(-algebraic[0]+algebraic[3]+algebraic[2]+algebraic[1])/externals[0]; algebraic[4] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0); algebraic[5] = 4.0*exp(states[0]/18.0); rates[2] = algebraic[4]*(1.0-states[2])-algebraic[5]*states[2]; @@ -162,5 +162,5 @@ void computeVariables(double voi, double *states, double *rates, double *constan algebraic[2] = constants[3]*pow(states[3], 4.0)*(states[0]-computedConstants[2]); algebraic[8] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0); algebraic[9] = 0.125*exp(states[0]/80.0); - external[0] = externalVariable(voi, states, rates, variables, 0); + externals[0] = externalVariable(voi, states, rates, variables, 0); } diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.py index e5b7943357..b3951a5dd8 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.py @@ -104,11 +104,11 @@ def compute_computed_constants(constants, computed_constants): def compute_rates(voi, states, rates, constants, computed_constants, algebraic, external_variable): algebraic[0] = -20.0 if and_func(geq_func(voi, 10.0), leq_func(voi, 10.5)) else 0.0 - external[0] = external_variable(voi, states, rates, variables, 0) + externals[0] = external_variable(voi, states, rates, variables, 0) algebraic[1] = constants[1]*(states[0]-computed_constants[0]) algebraic[2] = constants[3]*pow(states[3], 4.0)*(states[0]-computed_constants[2]) algebraic[3] = constants[2]*pow(states[2], 3.0)*states[1]*(states[0]-computed_constants[1]) - rates[0] = -(-algebraic[0]+algebraic[3]+algebraic[2]+algebraic[1])/external[0] + rates[0] = -(-algebraic[0]+algebraic[3]+algebraic[2]+algebraic[1])/externals[0] algebraic[4] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0) algebraic[5] = 4.0*exp(states[0]/18.0) rates[2] = algebraic[4]*(1.0-states[2])-algebraic[5]*states[2] @@ -130,4 +130,4 @@ def compute_variables(voi, states, rates, constants, computed_constants, algebra algebraic[2] = constants[3]*pow(states[3], 4.0)*(states[0]-computed_constants[2]) algebraic[8] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0) algebraic[9] = 0.125*exp(states[0]/80.0) - external[0] = external_variable(voi, states, rates, variables, 0) + externals[0] = external_variable(voi, states, rates, variables, 0) diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.c index 63f4f05721..f10c3958b8 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.c @@ -135,12 +135,12 @@ void computeComputedConstants(double *constants, double *computedConstants) void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) { - external[1] = externalVariable(voi, states, rates, variables, 1); - external[0] = externalVariable(voi, states, rates, variables, 0); + externals[1] = externalVariable(voi, states, rates, variables, 1); + externals[0] = externalVariable(voi, states, rates, variables, 0); algebraic[0] = constants[2]*(states[0]-computedConstants[0]); algebraic[1] = constants[4]*pow(states[3], 4.0)*(states[0]-computedConstants[2]); algebraic[2] = constants[3]*pow(states[2], 3.0)*states[1]*(states[0]-computedConstants[1]); - rates[0] = -(-external[0]+algebraic[2]+algebraic[1]+algebraic[0])/constants[0]; + rates[0] = -(-externals[0]+algebraic[2]+algebraic[1]+algebraic[0])/constants[0]; algebraic[3] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0); algebraic[4] = 4.0*exp(states[0]/18.0); rates[2] = algebraic[3]*(1.0-states[2])-algebraic[4]*states[2]; @@ -148,13 +148,13 @@ void computeRates(double voi, double *states, double *rates, double *constants, algebraic[6] = 1.0/(exp((states[0]+30.0)/10.0)+1.0); rates[1] = algebraic[5]*(1.0-states[1])-algebraic[6]*states[1]; algebraic[7] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0); - rates[3] = algebraic[7]*(1.0-states[3])-external[1]*states[3]; + rates[3] = algebraic[7]*(1.0-states[3])-externals[1]*states[3]; } void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) { - external[1] = externalVariable(voi, states, rates, variables, 1); - external[0] = externalVariable(voi, states, rates, variables, 0); + externals[1] = externalVariable(voi, states, rates, variables, 1); + externals[0] = externalVariable(voi, states, rates, variables, 0); algebraic[0] = constants[2]*(states[0]-computedConstants[0]); algebraic[2] = constants[3]*pow(states[2], 3.0)*states[1]*(states[0]-computedConstants[1]); algebraic[3] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.py index e78d84cca9..716cafe93f 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.py @@ -104,12 +104,12 @@ def compute_computed_constants(constants, computed_constants): def compute_rates(voi, states, rates, constants, computed_constants, algebraic, external_variable): - external[1] = external_variable(voi, states, rates, variables, 1) - external[0] = external_variable(voi, states, rates, variables, 0) + externals[1] = external_variable(voi, states, rates, variables, 1) + externals[0] = external_variable(voi, states, rates, variables, 0) algebraic[0] = constants[2]*(states[0]-computed_constants[0]) algebraic[1] = constants[4]*pow(states[3], 4.0)*(states[0]-computed_constants[2]) algebraic[2] = constants[3]*pow(states[2], 3.0)*states[1]*(states[0]-computed_constants[1]) - rates[0] = -(-external[0]+algebraic[2]+algebraic[1]+algebraic[0])/constants[0] + rates[0] = -(-externals[0]+algebraic[2]+algebraic[1]+algebraic[0])/constants[0] algebraic[3] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0) algebraic[4] = 4.0*exp(states[0]/18.0) rates[2] = algebraic[3]*(1.0-states[2])-algebraic[4]*states[2] @@ -117,12 +117,12 @@ def compute_rates(voi, states, rates, constants, computed_constants, algebraic, algebraic[6] = 1.0/(exp((states[0]+30.0)/10.0)+1.0) rates[1] = algebraic[5]*(1.0-states[1])-algebraic[6]*states[1] algebraic[7] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0) - rates[3] = algebraic[7]*(1.0-states[3])-external[1]*states[3] + rates[3] = algebraic[7]*(1.0-states[3])-externals[1]*states[3] def compute_variables(voi, states, rates, constants, computed_constants, algebraic, external_variable): - external[1] = external_variable(voi, states, rates, variables, 1) - external[0] = external_variable(voi, states, rates, variables, 0) + externals[1] = external_variable(voi, states, rates, variables, 1) + externals[0] = external_variable(voi, states, rates, variables, 0) algebraic[0] = constants[2]*(states[0]-computed_constants[0]) algebraic[2] = constants[3]*pow(states[2], 3.0)*states[1]*(states[0]-computed_constants[1]) algebraic[3] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0) diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.c index 1763e10c00..08b086b89a 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.c @@ -132,12 +132,12 @@ void computeComputedConstants(double *constants, double *computedConstants) void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) { algebraic[0] = ((voi >= 10.0) && (voi <= 10.5))?-20.0:0.0; - external[1] = externalVariable(voi, states, rates, variables, 1); - external[0] = externalVariable(voi, states, rates, variables, 0); - algebraic[4] = external[0]-10.613; + externals[1] = externalVariable(voi, states, rates, variables, 1); + externals[0] = externalVariable(voi, states, rates, variables, 0); + algebraic[4] = externals[0]-10.613; algebraic[1] = constants[1]*(states[0]-algebraic[4]); - algebraic[2] = constants[3]*pow(states[3], 4.0)*(states[0]-external[1]); - algebraic[5] = external[0]-115.0; + algebraic[2] = constants[3]*pow(states[3], 4.0)*(states[0]-externals[1]); + algebraic[5] = externals[0]-115.0; algebraic[3] = constants[2]*pow(states[2], 3.0)*states[1]*(states[0]-algebraic[5]); rates[0] = -(-algebraic[0]+algebraic[3]+algebraic[2]+algebraic[1])/constants[0]; algebraic[6] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0); @@ -153,17 +153,17 @@ void computeRates(double voi, double *states, double *rates, double *constants, void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) { - external[1] = externalVariable(voi, states, rates, variables, 1); - external[0] = externalVariable(voi, states, rates, variables, 0); - algebraic[4] = external[0]-10.613; + externals[1] = externalVariable(voi, states, rates, variables, 1); + externals[0] = externalVariable(voi, states, rates, variables, 0); + algebraic[4] = externals[0]-10.613; algebraic[1] = constants[1]*(states[0]-algebraic[4]); - algebraic[5] = external[0]-115.0; + algebraic[5] = externals[0]-115.0; algebraic[3] = constants[2]*pow(states[2], 3.0)*states[1]*(states[0]-algebraic[5]); algebraic[6] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0); algebraic[7] = 4.0*exp(states[0]/18.0); algebraic[8] = 0.07*exp(states[0]/20.0); algebraic[9] = 1.0/(exp((states[0]+30.0)/10.0)+1.0); - algebraic[2] = constants[3]*pow(states[3], 4.0)*(states[0]-external[1]); + algebraic[2] = constants[3]*pow(states[3], 4.0)*(states[0]-externals[1]); algebraic[10] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0); algebraic[11] = 0.125*exp(states[0]/80.0); } diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.py index 2ff358773d..0a961a48b8 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.py @@ -102,12 +102,12 @@ def compute_computed_constants(constants, computed_constants): def compute_rates(voi, states, rates, constants, computed_constants, algebraic, external_variable): algebraic[0] = -20.0 if and_func(geq_func(voi, 10.0), leq_func(voi, 10.5)) else 0.0 - external[1] = external_variable(voi, states, rates, variables, 1) - external[0] = external_variable(voi, states, rates, variables, 0) - algebraic[4] = external[0]-10.613 + externals[1] = external_variable(voi, states, rates, variables, 1) + externals[0] = external_variable(voi, states, rates, variables, 0) + algebraic[4] = externals[0]-10.613 algebraic[1] = constants[1]*(states[0]-algebraic[4]) - algebraic[2] = constants[3]*pow(states[3], 4.0)*(states[0]-external[1]) - algebraic[5] = external[0]-115.0 + algebraic[2] = constants[3]*pow(states[3], 4.0)*(states[0]-externals[1]) + algebraic[5] = externals[0]-115.0 algebraic[3] = constants[2]*pow(states[2], 3.0)*states[1]*(states[0]-algebraic[5]) rates[0] = -(-algebraic[0]+algebraic[3]+algebraic[2]+algebraic[1])/constants[0] algebraic[6] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0) @@ -122,16 +122,16 @@ def compute_rates(voi, states, rates, constants, computed_constants, algebraic, def compute_variables(voi, states, rates, constants, computed_constants, algebraic, external_variable): - external[1] = external_variable(voi, states, rates, variables, 1) - external[0] = external_variable(voi, states, rates, variables, 0) - algebraic[4] = external[0]-10.613 + externals[1] = external_variable(voi, states, rates, variables, 1) + externals[0] = external_variable(voi, states, rates, variables, 0) + algebraic[4] = externals[0]-10.613 algebraic[1] = constants[1]*(states[0]-algebraic[4]) - algebraic[5] = external[0]-115.0 + algebraic[5] = externals[0]-115.0 algebraic[3] = constants[2]*pow(states[2], 3.0)*states[1]*(states[0]-algebraic[5]) algebraic[6] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0) algebraic[7] = 4.0*exp(states[0]/18.0) algebraic[8] = 0.07*exp(states[0]/20.0) algebraic[9] = 1.0/(exp((states[0]+30.0)/10.0)+1.0) - algebraic[2] = constants[3]*pow(states[3], 4.0)*(states[0]-external[1]) + algebraic[2] = constants[3]*pow(states[3], 4.0)*(states[0]-externals[1]) algebraic[10] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0) algebraic[11] = 0.125*exp(states[0]/80.0) diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.c index bf11e3c35f..45f29d072a 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.c @@ -134,12 +134,12 @@ void computeComputedConstants(double *constants, double *computedConstants) void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) { algebraic[0] = ((voi >= 10.0) && (voi <= 10.5))?-20.0:0.0; - external[1] = externalVariable(voi, states, rates, variables, 1); - external[0] = externalVariable(voi, states, rates, variables, 0); + externals[1] = externalVariable(voi, states, rates, variables, 1); + externals[0] = externalVariable(voi, states, rates, variables, 0); algebraic[1] = constants[1]*(states[0]-computedConstants[0]); algebraic[2] = constants[2]*pow(states[3], 4.0)*(states[0]-computedConstants[2]); - algebraic[3] = external[1]*pow(states[2], 3.0)*states[1]*(states[0]-computedConstants[1]); - rates[0] = -(-algebraic[0]+algebraic[3]+algebraic[2]+algebraic[1])/external[0]; + algebraic[3] = externals[1]*pow(states[2], 3.0)*states[1]*(states[0]-computedConstants[1]); + rates[0] = -(-algebraic[0]+algebraic[3]+algebraic[2]+algebraic[1])/externals[0]; algebraic[4] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0); algebraic[5] = 4.0*exp(states[0]/18.0); rates[2] = algebraic[4]*(1.0-states[2])-algebraic[5]*states[2]; @@ -154,8 +154,8 @@ void computeRates(double voi, double *states, double *rates, double *constants, void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) { algebraic[1] = constants[1]*(states[0]-computedConstants[0]); - external[1] = externalVariable(voi, states, rates, variables, 1); - algebraic[3] = external[1]*pow(states[2], 3.0)*states[1]*(states[0]-computedConstants[1]); + externals[1] = externalVariable(voi, states, rates, variables, 1); + algebraic[3] = externals[1]*pow(states[2], 3.0)*states[1]*(states[0]-computedConstants[1]); algebraic[4] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0); algebraic[5] = 4.0*exp(states[0]/18.0); algebraic[6] = 0.07*exp(states[0]/20.0); @@ -163,5 +163,5 @@ void computeVariables(double voi, double *states, double *rates, double *constan algebraic[2] = constants[2]*pow(states[3], 4.0)*(states[0]-computedConstants[2]); algebraic[8] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0); algebraic[9] = 0.125*exp(states[0]/80.0); - external[0] = externalVariable(voi, states, rates, variables, 0); + externals[0] = externalVariable(voi, states, rates, variables, 0); } diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.py index 523a748540..7fb9fbb6f7 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.py @@ -103,12 +103,12 @@ def compute_computed_constants(constants, computed_constants): def compute_rates(voi, states, rates, constants, computed_constants, algebraic, external_variable): algebraic[0] = -20.0 if and_func(geq_func(voi, 10.0), leq_func(voi, 10.5)) else 0.0 - external[1] = external_variable(voi, states, rates, variables, 1) - external[0] = external_variable(voi, states, rates, variables, 0) + externals[1] = external_variable(voi, states, rates, variables, 1) + externals[0] = external_variable(voi, states, rates, variables, 0) algebraic[1] = constants[1]*(states[0]-computed_constants[0]) algebraic[2] = constants[2]*pow(states[3], 4.0)*(states[0]-computed_constants[2]) - algebraic[3] = external[1]*pow(states[2], 3.0)*states[1]*(states[0]-computed_constants[1]) - rates[0] = -(-algebraic[0]+algebraic[3]+algebraic[2]+algebraic[1])/external[0] + algebraic[3] = externals[1]*pow(states[2], 3.0)*states[1]*(states[0]-computed_constants[1]) + rates[0] = -(-algebraic[0]+algebraic[3]+algebraic[2]+algebraic[1])/externals[0] algebraic[4] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0) algebraic[5] = 4.0*exp(states[0]/18.0) rates[2] = algebraic[4]*(1.0-states[2])-algebraic[5]*states[2] @@ -122,8 +122,8 @@ def compute_rates(voi, states, rates, constants, computed_constants, algebraic, def compute_variables(voi, states, rates, constants, computed_constants, algebraic, external_variable): algebraic[1] = constants[1]*(states[0]-computed_constants[0]) - external[1] = external_variable(voi, states, rates, variables, 1) - algebraic[3] = external[1]*pow(states[2], 3.0)*states[1]*(states[0]-computed_constants[1]) + externals[1] = external_variable(voi, states, rates, variables, 1) + algebraic[3] = externals[1]*pow(states[2], 3.0)*states[1]*(states[0]-computed_constants[1]) algebraic[4] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0) algebraic[5] = 4.0*exp(states[0]/18.0) algebraic[6] = 0.07*exp(states[0]/20.0) @@ -131,4 +131,4 @@ def compute_variables(voi, states, rates, constants, computed_constants, algebra algebraic[2] = constants[2]*pow(states[3], 4.0)*(states[0]-computed_constants[2]) algebraic[8] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0) algebraic[9] = 0.125*exp(states[0]/80.0) - external[0] = external_variable(voi, states, rates, variables, 0) + externals[0] = external_variable(voi, states, rates, variables, 0) diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.c index e9bb071d97..f5f5a253f7 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.c @@ -133,23 +133,23 @@ void computeComputedConstants(double *constants, double *computedConstants) void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) { - external[0] = externalVariable(voi, states, rates, variables, 0); - algebraic[6] = 0.07*exp(external[0]/20.0); - algebraic[7] = 1.0/(exp((external[0]+30.0)/10.0)+1.0); + externals[0] = externalVariable(voi, states, rates, variables, 0); + algebraic[6] = 0.07*exp(externals[0]/20.0); + algebraic[7] = 1.0/(exp((externals[0]+30.0)/10.0)+1.0); rates[0] = algebraic[6]*(1.0-states[0])-algebraic[7]*states[0]; - algebraic[8] = 0.01*(external[0]+10.0)/(exp((external[0]+10.0)/10.0)-1.0); - algebraic[9] = 0.125*exp(external[0]/80.0); + algebraic[8] = 0.01*(externals[0]+10.0)/(exp((externals[0]+10.0)/10.0)-1.0); + algebraic[9] = 0.125*exp(externals[0]/80.0); rates[1] = algebraic[8]*(1.0-states[1])-algebraic[9]*states[1]; } void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) { algebraic[0] = ((voi >= 10.0) && (voi <= 10.5))?-20.0:0.0; - external[0] = externalVariable(voi, states, rates, variables, 0); - algebraic[1] = constants[2]*(external[0]-computedConstants[0]); - external[1] = externalVariable(voi, states, rates, variables, 1); - algebraic[3] = constants[3]*pow(external[1], 3.0)*states[0]*(external[0]-computedConstants[1]); - algebraic[4] = 0.1*(external[0]+25.0)/(exp((external[0]+25.0)/10.0)-1.0); - algebraic[5] = 4.0*exp(external[0]/18.0); - algebraic[2] = constants[4]*pow(states[1], 4.0)*(external[0]-computedConstants[2]); + externals[0] = externalVariable(voi, states, rates, variables, 0); + algebraic[1] = constants[2]*(externals[0]-computedConstants[0]); + externals[1] = externalVariable(voi, states, rates, variables, 1); + algebraic[3] = constants[3]*pow(externals[1], 3.0)*states[0]*(externals[0]-computedConstants[1]); + algebraic[4] = 0.1*(externals[0]+25.0)/(exp((externals[0]+25.0)/10.0)-1.0); + algebraic[5] = 4.0*exp(externals[0]/18.0); + algebraic[2] = constants[4]*pow(states[1], 4.0)*(externals[0]-computedConstants[2]); } diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.py index f4e175bb25..cb704989d0 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.py @@ -102,21 +102,21 @@ def compute_computed_constants(constants, computed_constants): def compute_rates(voi, states, rates, constants, computed_constants, algebraic, external_variable): - external[0] = external_variable(voi, states, rates, variables, 0) - algebraic[6] = 0.07*exp(external[0]/20.0) - algebraic[7] = 1.0/(exp((external[0]+30.0)/10.0)+1.0) + externals[0] = external_variable(voi, states, rates, variables, 0) + algebraic[6] = 0.07*exp(externals[0]/20.0) + algebraic[7] = 1.0/(exp((externals[0]+30.0)/10.0)+1.0) rates[0] = algebraic[6]*(1.0-states[0])-algebraic[7]*states[0] - algebraic[8] = 0.01*(external[0]+10.0)/(exp((external[0]+10.0)/10.0)-1.0) - algebraic[9] = 0.125*exp(external[0]/80.0) + algebraic[8] = 0.01*(externals[0]+10.0)/(exp((externals[0]+10.0)/10.0)-1.0) + algebraic[9] = 0.125*exp(externals[0]/80.0) rates[1] = algebraic[8]*(1.0-states[1])-algebraic[9]*states[1] def compute_variables(voi, states, rates, constants, computed_constants, algebraic, external_variable): algebraic[0] = -20.0 if and_func(geq_func(voi, 10.0), leq_func(voi, 10.5)) else 0.0 - external[0] = external_variable(voi, states, rates, variables, 0) - algebraic[1] = constants[2]*(external[0]-computed_constants[0]) - external[1] = external_variable(voi, states, rates, variables, 1) - algebraic[3] = constants[3]*pow(external[1], 3.0)*states[0]*(external[0]-computed_constants[1]) - algebraic[4] = 0.1*(external[0]+25.0)/(exp((external[0]+25.0)/10.0)-1.0) - algebraic[5] = 4.0*exp(external[0]/18.0) - algebraic[2] = constants[4]*pow(states[1], 4.0)*(external[0]-computed_constants[2]) + externals[0] = external_variable(voi, states, rates, variables, 0) + algebraic[1] = constants[2]*(externals[0]-computed_constants[0]) + externals[1] = external_variable(voi, states, rates, variables, 1) + algebraic[3] = constants[3]*pow(externals[1], 3.0)*states[0]*(externals[0]-computed_constants[1]) + algebraic[4] = 0.1*(externals[0]+25.0)/(exp((externals[0]+25.0)/10.0)-1.0) + algebraic[5] = 4.0*exp(externals[0]/18.0) + algebraic[2] = constants[4]*pow(states[1], 4.0)*(externals[0]-computed_constants[2]) diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.c index d23067e7ba..4dd3845710 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.c @@ -134,24 +134,24 @@ void computeComputedConstants(double *constants, double *computedConstants) void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) { - external[0] = externalVariable(voi, states, rates, variables, 0); - algebraic[3] = 0.1*(external[0]+25.0)/(exp((external[0]+25.0)/10.0)-1.0); - algebraic[4] = 4.0*exp(external[0]/18.0); + externals[0] = externalVariable(voi, states, rates, variables, 0); + algebraic[3] = 0.1*(externals[0]+25.0)/(exp((externals[0]+25.0)/10.0)-1.0); + algebraic[4] = 4.0*exp(externals[0]/18.0); rates[1] = algebraic[3]*(1.0-states[1])-algebraic[4]*states[1]; - algebraic[5] = 0.07*exp(external[0]/20.0); - algebraic[6] = 1.0/(exp((external[0]+30.0)/10.0)+1.0); + algebraic[5] = 0.07*exp(externals[0]/20.0); + algebraic[6] = 1.0/(exp((externals[0]+30.0)/10.0)+1.0); rates[0] = algebraic[5]*(1.0-states[0])-algebraic[6]*states[0]; - external[2] = externalVariable(voi, states, rates, variables, 2); - algebraic[7] = 0.125*exp(external[0]/80.0); - rates[2] = external[2]*(1.0-states[2])-algebraic[7]*states[2]; + externals[2] = externalVariable(voi, states, rates, variables, 2); + algebraic[7] = 0.125*exp(externals[0]/80.0); + rates[2] = externals[2]*(1.0-states[2])-algebraic[7]*states[2]; } void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) { algebraic[0] = ((voi >= 10.0) && (voi <= 10.5))?-20.0:0.0; - external[0] = externalVariable(voi, states, rates, variables, 0); - algebraic[1] = constants[2]*(external[0]-computedConstants[0]); - external[2] = externalVariable(voi, states, rates, variables, 2); - external[1] = externalVariable(voi, states, rates, variables, 1); - algebraic[2] = constants[4]*pow(states[2], 4.0)*(external[0]-computedConstants[2]); + externals[0] = externalVariable(voi, states, rates, variables, 0); + algebraic[1] = constants[2]*(externals[0]-computedConstants[0]); + externals[2] = externalVariable(voi, states, rates, variables, 2); + externals[1] = externalVariable(voi, states, rates, variables, 1); + algebraic[2] = constants[4]*pow(states[2], 4.0)*(externals[0]-computedConstants[2]); } diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.py index 7e7ce58041..fd8453ffcf 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.py @@ -103,22 +103,22 @@ def compute_computed_constants(constants, computed_constants): def compute_rates(voi, states, rates, constants, computed_constants, algebraic, external_variable): - external[0] = external_variable(voi, states, rates, variables, 0) - algebraic[3] = 0.1*(external[0]+25.0)/(exp((external[0]+25.0)/10.0)-1.0) - algebraic[4] = 4.0*exp(external[0]/18.0) + externals[0] = external_variable(voi, states, rates, variables, 0) + algebraic[3] = 0.1*(externals[0]+25.0)/(exp((externals[0]+25.0)/10.0)-1.0) + algebraic[4] = 4.0*exp(externals[0]/18.0) rates[1] = algebraic[3]*(1.0-states[1])-algebraic[4]*states[1] - algebraic[5] = 0.07*exp(external[0]/20.0) - algebraic[6] = 1.0/(exp((external[0]+30.0)/10.0)+1.0) + algebraic[5] = 0.07*exp(externals[0]/20.0) + algebraic[6] = 1.0/(exp((externals[0]+30.0)/10.0)+1.0) rates[0] = algebraic[5]*(1.0-states[0])-algebraic[6]*states[0] - external[2] = external_variable(voi, states, rates, variables, 2) - algebraic[7] = 0.125*exp(external[0]/80.0) - rates[2] = external[2]*(1.0-states[2])-algebraic[7]*states[2] + externals[2] = external_variable(voi, states, rates, variables, 2) + algebraic[7] = 0.125*exp(externals[0]/80.0) + rates[2] = externals[2]*(1.0-states[2])-algebraic[7]*states[2] def compute_variables(voi, states, rates, constants, computed_constants, algebraic, external_variable): algebraic[0] = -20.0 if and_func(geq_func(voi, 10.0), leq_func(voi, 10.5)) else 0.0 - external[0] = external_variable(voi, states, rates, variables, 0) - algebraic[1] = constants[2]*(external[0]-computed_constants[0]) - external[2] = external_variable(voi, states, rates, variables, 2) - external[1] = external_variable(voi, states, rates, variables, 1) - algebraic[2] = constants[4]*pow(states[2], 4.0)*(external[0]-computed_constants[2]) + externals[0] = external_variable(voi, states, rates, variables, 0) + algebraic[1] = constants[2]*(externals[0]-computed_constants[0]) + externals[2] = external_variable(voi, states, rates, variables, 2) + externals[1] = external_variable(voi, states, rates, variables, 1) + algebraic[2] = constants[4]*pow(states[2], 4.0)*(externals[0]-computed_constants[2]) diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.c index fb03fdd454..205334d7b1 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.c @@ -137,8 +137,8 @@ void computeRates(double voi, double *states, double *rates, double *constants, algebraic[0] = ((voi >= 10.0) && (voi <= 10.5))?-20.0:0.0; algebraic[1] = constants[2]*(states[0]-computedConstants[0]); algebraic[2] = constants[4]*pow(states[2], 4.0)*(states[0]-computedConstants[2]); - external[0] = externalVariable(voi, states, rates, variables, 0); - algebraic[3] = constants[3]*pow(external[0], 3.0)*states[1]*(states[0]-computedConstants[1]); + externals[0] = externalVariable(voi, states, rates, variables, 0); + algebraic[3] = constants[3]*pow(externals[0], 3.0)*states[1]*(states[0]-computedConstants[1]); rates[0] = -(-algebraic[0]+algebraic[3]+algebraic[2]+algebraic[1])/constants[0]; algebraic[6] = 0.07*exp(states[0]/20.0); algebraic[7] = 1.0/(exp((states[0]+30.0)/10.0)+1.0); @@ -151,8 +151,8 @@ void computeRates(double voi, double *states, double *rates, double *constants, void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) { algebraic[1] = constants[2]*(states[0]-computedConstants[0]); - external[0] = externalVariable(voi, states, rates, variables, 0); - algebraic[3] = constants[3]*pow(external[0], 3.0)*states[1]*(states[0]-computedConstants[1]); + externals[0] = externalVariable(voi, states, rates, variables, 0); + algebraic[3] = constants[3]*pow(externals[0], 3.0)*states[1]*(states[0]-computedConstants[1]); algebraic[4] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0); algebraic[5] = 4.0*exp(states[0]/18.0); algebraic[6] = 0.07*exp(states[0]/20.0); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.py index 19e213325d..b97e824032 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.py @@ -106,8 +106,8 @@ def compute_rates(voi, states, rates, constants, computed_constants, algebraic, algebraic[0] = -20.0 if and_func(geq_func(voi, 10.0), leq_func(voi, 10.5)) else 0.0 algebraic[1] = constants[2]*(states[0]-computed_constants[0]) algebraic[2] = constants[4]*pow(states[2], 4.0)*(states[0]-computed_constants[2]) - external[0] = external_variable(voi, states, rates, variables, 0) - algebraic[3] = constants[3]*pow(external[0], 3.0)*states[1]*(states[0]-computed_constants[1]) + externals[0] = external_variable(voi, states, rates, variables, 0) + algebraic[3] = constants[3]*pow(externals[0], 3.0)*states[1]*(states[0]-computed_constants[1]) rates[0] = -(-algebraic[0]+algebraic[3]+algebraic[2]+algebraic[1])/constants[0] algebraic[6] = 0.07*exp(states[0]/20.0) algebraic[7] = 1.0/(exp((states[0]+30.0)/10.0)+1.0) @@ -119,8 +119,8 @@ def compute_rates(voi, states, rates, constants, computed_constants, algebraic, def compute_variables(voi, states, rates, constants, computed_constants, algebraic, external_variable): algebraic[1] = constants[2]*(states[0]-computed_constants[0]) - external[0] = external_variable(voi, states, rates, variables, 0) - algebraic[3] = constants[3]*pow(external[0], 3.0)*states[1]*(states[0]-computed_constants[1]) + externals[0] = external_variable(voi, states, rates, variables, 0) + algebraic[3] = constants[3]*pow(externals[0], 3.0)*states[1]*(states[0]-computed_constants[1]) algebraic[4] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0) algebraic[5] = 4.0*exp(states[0]/18.0) algebraic[6] = 0.07*exp(states[0]/20.0) diff --git a/tests/resources/generator/unknown_variable_as_external_variable/model.c b/tests/resources/generator/unknown_variable_as_external_variable/model.c index 2eecb84e54..8b023706c3 100644 --- a/tests/resources/generator/unknown_variable_as_external_variable/model.c +++ b/tests/resources/generator/unknown_variable_as_external_variable/model.c @@ -102,6 +102,6 @@ void computeComputedConstants(double *constants, double *computedConstants) void computeVariables(double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) { - external[0] = externalVariable(variables, 0); - algebraic[0] = constants[0]*(constants[1]*constants[2]-constants[3]*constants[4])/(constants[5]*constants[4]+external[0]*constants[2]+constants[7]*constants[4]*constants[2]+constants[6]); + externals[0] = externalVariable(variables, 0); + algebraic[0] = constants[0]*(constants[1]*constants[2]-constants[3]*constants[4])/(constants[5]*constants[4]+externals[0]*constants[2]+constants[7]*constants[4]*constants[2]+constants[6]); } diff --git a/tests/resources/generator/unknown_variable_as_external_variable/model.py b/tests/resources/generator/unknown_variable_as_external_variable/model.py index 1d02c1f0b9..4a8e5e1952 100644 --- a/tests/resources/generator/unknown_variable_as_external_variable/model.py +++ b/tests/resources/generator/unknown_variable_as_external_variable/model.py @@ -67,5 +67,5 @@ def compute_computed_constants(constants, computed_constants): def compute_variables(constants, computed_constants, algebraic, external_variable): - external[0] = external_variable(variables, 0) - algebraic[0] = constants[0]*(constants[1]*constants[2]-constants[3]*constants[4])/(constants[5]*constants[4]+external[0]*constants[2]+constants[7]*constants[4]*constants[2]+constants[6]) + externals[0] = external_variable(variables, 0) + algebraic[0] = constants[0]*(constants[1]*constants[2]-constants[3]*constants[4])/(constants[5]*constants[4]+externals[0]*constants[2]+constants[7]*constants[4]*constants[2]+constants[6]) From 8cba9cdf5c4fa56a861123ed35623b664433996d Mon Sep 17 00:00:00 2001 From: Alan Garny Date: Mon, 19 Aug 2024 11:45:04 +0200 Subject: [PATCH 36/85] Generator: "initialise" computed constants in initialiseVariables(). This effectively reverts commit b1b75362. Indeed, some computed constants are initialised using an equation (e.g., x = 3 rather than x with an initial value of 3). So, there is no need to compute those computed constants many times (using computeComputedConstants()). Instead, it's much better to compute them in initialiseVariables(). Not to mention that we might have "computedConstants[1] = 1.0;" and then "computedConstants[0] = computedConstants[1];" so if we were to compute both of them in computeComputedConstants(), we would need to compute "computedConstants[1] = 1.0;" before computing "computedConstants[0] = computedConstants[1];", which would make things slightly more complicated to generate. --- src/generator.cpp | 17 +++---------- tests/resources/coverage/generator/model.c | 24 +++++++++---------- .../generator/model.implementation.out | 24 +++++++++---------- .../generator/model.modified.profile.c | 24 +++++++++---------- .../generator/model.modified.profile.py | 24 +++++++++---------- tests/resources/coverage/generator/model.out | 24 +++++++++---------- tests/resources/coverage/generator/model.py | 24 +++++++++---------- .../algebraic_eqn_computed_var_on_rhs/model.c | 2 +- .../model.py | 3 +-- .../algebraic_eqn_constant_on_rhs/model.c | 2 +- .../algebraic_eqn_constant_on_rhs/model.py | 4 ++-- .../algebraic_eqn_derivative_on_rhs/model.c | 2 +- .../algebraic_eqn_derivative_on_rhs/model.py | 3 ++- .../model.c | 2 +- .../model.py | 3 ++- .../algebraic_eqn_state_var_on_rhs/model.c | 2 +- .../algebraic_eqn_state_var_on_rhs/model.py | 3 ++- .../model.c | 2 +- .../model.py | 3 ++- .../model.c | 6 ++--- .../model.external.c | 6 ++--- .../model.external.py | 8 +++---- .../model.py | 7 +++--- .../algebraic_unknown_var_on_rhs/model.c | 2 +- .../algebraic_unknown_var_on_rhs/model.py | 3 +-- .../generator/ode_computed_var_on_rhs/model.c | 2 +- .../ode_computed_var_on_rhs/model.py | 3 ++- .../model.c | 2 +- .../model.py | 3 ++- .../generator/sine_model_imports/model.c | 8 +++---- .../generator/sine_model_imports/model.py | 7 +++--- 31 files changed, 122 insertions(+), 127 deletions(-) diff --git a/src/generator.cpp b/src/generator.cpp index b9551a2490..dd26dbb1ae 100644 --- a/src/generator.cpp +++ b/src/generator.cpp @@ -1866,16 +1866,12 @@ void Generator::GeneratorImpl::addImplementationInitialiseVariablesMethodCode(st } } - // Initialise our (initialised) true constants. - // Note: this means that we don't initialise (computed) constants that are initialised using a true constant - // through an equation (e.g., x = 3 rather than x with an initial value of 3), hence we test the number - // of constants in the equation. + // Initialise our true constants. auto equations = mModel->equations(); for (const auto &equation : equations) { - if ((equation->constantCount() == 1) - && (equation->type() == AnalyserEquation::Type::TRUE_CONSTANT)) { + if (equation->type() == AnalyserEquation::Type::TRUE_CONSTANT) { methodBody += generateEquationCode(equation, remainingEquations); } } @@ -1889,17 +1885,10 @@ void Generator::GeneratorImpl::addImplementationInitialiseVariablesMethodCode(st void Generator::GeneratorImpl::addImplementationComputeComputedConstantsMethodCode(std::vector &remainingEquations) { if (!mProfile->implementationComputeComputedConstantsMethodString().empty()) { - // Initialise all our computed constants. - // Note: this means (computed) constants that are initialised using an equation that relies on constant - // variables (e.g., x = a + b, with a and b being constants), as well as (computed) constants that are - // initialised using a true constant through an equation (e.g., x = 3 rather than x with an initial value - // of 3). - std::string methodBody; for (const auto &equation : mModel->equations()) { - if ((equation->type() == AnalyserEquation::Type::TRUE_CONSTANT) - || (equation->type() == AnalyserEquation::Type::VARIABLE_BASED_CONSTANT)) { + if (equation->type() == AnalyserEquation::Type::VARIABLE_BASED_CONSTANT) { methodBody += generateEquationCode(equation, remainingEquations); } } diff --git a/tests/resources/coverage/generator/model.c b/tests/resources/coverage/generator/model.c index 72b66e639a..8b2dc77550 100644 --- a/tests/resources/coverage/generator/model.c +++ b/tests/resources/coverage/generator/model.c @@ -417,6 +417,18 @@ void initialiseVariables(double voi, double *states, double *rates, double *cons constants[6] = 7.0; algebraic[0] = 1.0; algebraic[1] = 2.0; + computedConstants[177] = 123.0; + computedConstants[178] = 123.456789; + computedConstants[179] = 123.0e99; + computedConstants[180] = 123.456789e99; + computedConstants[182] = 1.0; + computedConstants[183] = 0.0; + computedConstants[184] = 2.71828182845905; + computedConstants[185] = 3.14159265358979; + computedConstants[186] = INFINITY; + computedConstants[187] = NAN; + computedConstants[198] = 1.0; + computedConstants[199] = 3.0; } void computeComputedConstants(double *constants, double *computedConstants) @@ -598,17 +610,7 @@ void computeComputedConstants(double *constants, double *computedConstants) computedConstants[174] = (constants[0] > constants[1])?constants[0]:(constants[2] > constants[3])?constants[2]:(constants[4] > constants[5])?constants[4]:NAN; computedConstants[175] = (constants[0] > constants[1])?constants[0]:(constants[2] > constants[3])?constants[2]:(constants[4] > constants[5])?constants[4]:constants[6]; computedConstants[176] = 123.0+((constants[0] > constants[1])?constants[0]:NAN); - computedConstants[177] = 123.0; - computedConstants[178] = 123.456789; - computedConstants[179] = 123.0e99; - computedConstants[180] = 123.456789e99; computedConstants[181] = constants[0]; - computedConstants[182] = 1.0; - computedConstants[183] = 0.0; - computedConstants[184] = 2.71828182845905; - computedConstants[185] = 3.14159265358979; - computedConstants[186] = INFINITY; - computedConstants[187] = NAN; computedConstants[188] = (constants[0] && constants[1])+((constants[2] > constants[3])?constants[1]:NAN)+constants[4]+(constants[5] && constants[6]); computedConstants[189] = (constants[0] && constants[1])-(((constants[2] > constants[3])?constants[1]:NAN)-(constants[4]-((constants[2] > constants[3])?constants[1]:NAN)))-(constants[5] && constants[6]); computedConstants[190] = (constants[0] && constants[1])*((constants[2] > constants[3])?constants[1]:NAN)*constants[4]*((constants[2] > constants[3])?constants[1]:NAN)*(constants[5] && constants[6]); @@ -619,8 +621,6 @@ void computeComputedConstants(double *constants, double *computedConstants) computedConstants[195] = pow(constants[0] && constants[1], pow((constants[2] > constants[3])?constants[1]:NAN, pow(pow(constants[4], (constants[2] > constants[3])?constants[1]:NAN), constants[0] && constants[1]))); computedConstants[196] = pow(pow(pow(constants[0] && constants[1], 1.0/pow((constants[2] > constants[3])?constants[1]:NAN, 1.0/constants[4])), 1.0/((constants[2] > constants[3])?constants[1]:NAN)), 1.0/(constants[0] && constants[1])); computedConstants[197] = -(constants[0] && constants[1])+-((constants[2] > constants[3])?constants[1]:NAN); - computedConstants[198] = 1.0; - computedConstants[199] = 3.0; } void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) diff --git a/tests/resources/coverage/generator/model.implementation.out b/tests/resources/coverage/generator/model.implementation.out index 9879365ae9..2198bce7be 100644 --- a/tests/resources/coverage/generator/model.implementation.out +++ b/tests/resources/coverage/generator/model.implementation.out @@ -180,6 +180,18 @@ void initialiseVariables(double voi, double *states, double *rates, double *cons constants[6] = 7.0; algebraic[0] = 1.0; algebraic[1] = 2.0; + computedConstants[177] = 123.0; + computedConstants[178] = 123.456789; + computedConstants[179] = 123.0e99; + computedConstants[180] = 123.456789e99; + computedConstants[182] = 1.0; + computedConstants[183] = 0.0; + computedConstants[184] = 2.71828182845905; + computedConstants[185] = 3.14159265358979; + computedConstants[186] = INFINITY; + computedConstants[187] = NAN; + computedConstants[198] = 1.0; + computedConstants[199] = 3.0; } void computeComputedConstants(double *constants, double *computedConstants) @@ -361,17 +373,7 @@ void computeComputedConstants(double *constants, double *computedConstants) computedConstants[174] = (gt(constants[0], constants[1]))?constants[0]:(gt(constants[2], constants[3]))?constants[2]:(gt(constants[4], constants[5]))?constants[4]:NAN; computedConstants[175] = (gt(constants[0], constants[1]))?constants[0]:(gt(constants[2], constants[3]))?constants[2]:(gt(constants[4], constants[5]))?constants[4]:constants[6]; computedConstants[176] = 123.0+((gt(constants[0], constants[1]))?constants[0]:NAN); - computedConstants[177] = 123.0; - computedConstants[178] = 123.456789; - computedConstants[179] = 123.0e99; - computedConstants[180] = 123.456789e99; computedConstants[181] = constants[0]; - computedConstants[182] = 1.0; - computedConstants[183] = 0.0; - computedConstants[184] = 2.71828182845905; - computedConstants[185] = 3.14159265358979; - computedConstants[186] = INFINITY; - computedConstants[187] = NAN; computedConstants[188] = and(constants[0], constants[1])+((gt(constants[2], constants[3]))?constants[1]:NAN)+constants[4]+and(constants[5], constants[6]); computedConstants[189] = and(constants[0], constants[1])-(((gt(constants[2], constants[3]))?constants[1]:NAN)-(constants[4]-((gt(constants[2], constants[3]))?constants[1]:NAN)))-and(constants[5], constants[6]); computedConstants[190] = and(constants[0], constants[1])*((gt(constants[2], constants[3]))?constants[1]:NAN)*constants[4]*((gt(constants[2], constants[3]))?constants[1]:NAN)*and(constants[5], constants[6]); @@ -382,8 +384,6 @@ void computeComputedConstants(double *constants, double *computedConstants) computedConstants[195] = pow(and(constants[0], constants[1]), pow((gt(constants[2], constants[3]))?constants[1]:NAN, pow(pow(constants[4], (gt(constants[2], constants[3]))?constants[1]:NAN), and(constants[0], constants[1])))); computedConstants[196] = pow(pow(pow(and(constants[0], constants[1]), 1.0/pow((gt(constants[2], constants[3]))?constants[1]:NAN, 1.0/constants[4])), 1.0/((gt(constants[2], constants[3]))?constants[1]:NAN)), 1.0/and(constants[0], constants[1])); computedConstants[197] = -and(constants[0], constants[1])+-((gt(constants[2], constants[3]))?constants[1]:NAN); - computedConstants[198] = 1.0; - computedConstants[199] = 3.0; } void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) diff --git a/tests/resources/coverage/generator/model.modified.profile.c b/tests/resources/coverage/generator/model.modified.profile.c index 4d98fe81bd..710c1d8978 100644 --- a/tests/resources/coverage/generator/model.modified.profile.c +++ b/tests/resources/coverage/generator/model.modified.profile.c @@ -417,6 +417,18 @@ void initialiseVariables(double voi, double *states, double *rates, double *cons constants[6] = 7.0; algebraic[0] = 1.0; algebraic[1] = 2.0; + computedConstants[177] = 123.0; + computedConstants[178] = 123.456789; + computedConstants[179] = 123.0e99; + computedConstants[180] = 123.456789e99; + computedConstants[182] = 1.0; + computedConstants[183] = 0.0; + computedConstants[184] = 2.71828182845905; + computedConstants[185] = 3.14159265358979; + computedConstants[186] = INFINITY; + computedConstants[187] = NAN; + computedConstants[198] = 1.0; + computedConstants[199] = 3.0; } void computeComputedConstants(double *constants, double *computedConstants) @@ -598,17 +610,7 @@ void computeComputedConstants(double *constants, double *computedConstants) computedConstants[174] = (constants[0] > constants[1])?constants[0]:(constants[2] > constants[3])?constants[2]:(constants[4] > constants[5])?constants[4]:NAN; computedConstants[175] = (constants[0] > constants[1])?constants[0]:(constants[2] > constants[3])?constants[2]:(constants[4] > constants[5])?constants[4]:constants[6]; computedConstants[176] = 123.0+((constants[0] > constants[1])?constants[0]:NAN); - computedConstants[177] = 123.0; - computedConstants[178] = 123.456789; - computedConstants[179] = 123.0e99; - computedConstants[180] = 123.456789e99; computedConstants[181] = constants[0]; - computedConstants[182] = 1.0; - computedConstants[183] = 0.0; - computedConstants[184] = 2.71828182845905; - computedConstants[185] = 3.14159265358979; - computedConstants[186] = INFINITY; - computedConstants[187] = NAN; computedConstants[188] = (constants[0] && constants[1])+((constants[2] > constants[3])?constants[1]:NAN)+constants[4]+(constants[5] && constants[6]); computedConstants[189] = (constants[0] && constants[1])-(((constants[2] > constants[3])?constants[1]:NAN)-(constants[4]-((constants[2] > constants[3])?constants[1]:NAN)))-(constants[5] && constants[6]); computedConstants[190] = (constants[0] && constants[1])*((constants[2] > constants[3])?constants[1]:NAN)*constants[4]*((constants[2] > constants[3])?constants[1]:NAN)*(constants[5] && constants[6]); @@ -619,8 +621,6 @@ void computeComputedConstants(double *constants, double *computedConstants) computedConstants[195] = pow(constants[0] && constants[1], pow((constants[2] > constants[3])?constants[1]:NAN, pow(pow(constants[4], (constants[2] > constants[3])?constants[1]:NAN), constants[0] && constants[1]))); computedConstants[196] = pow(pow(pow(constants[0] && constants[1], 1.0/pow((constants[2] > constants[3])?constants[1]:NAN, 1.0/constants[4])), 1.0/((constants[2] > constants[3])?constants[1]:NAN)), 1.0/(constants[0] && constants[1])); computedConstants[197] = -(constants[0] && constants[1])+-((constants[2] > constants[3])?constants[1]:NAN); - computedConstants[198] = 1.0; - computedConstants[199] = 3.0; } void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) diff --git a/tests/resources/coverage/generator/model.modified.profile.py b/tests/resources/coverage/generator/model.modified.profile.py index eb7f0514f0..ba16c980ba 100644 --- a/tests/resources/coverage/generator/model.modified.profile.py +++ b/tests/resources/coverage/generator/model.modified.profile.py @@ -394,6 +394,18 @@ def initialise_variables(voi, states, rates, constants, algebraic): constants[6] = 7.0 algebraic[0] = 1.0 algebraic[1] = 2.0 + computed_constants[177] = 123.0 + computed_constants[178] = 123.456789 + computed_constants[179] = 123.0e99 + computed_constants[180] = 123.456789e99 + computed_constants[182] = 1.0 + computed_constants[183] = 0.0 + computed_constants[184] = 2.71828182845905 + computed_constants[185] = 3.14159265358979 + computed_constants[186] = inf + computed_constants[187] = nan + computed_constants[198] = 1.0 + computed_constants[199] = 3.0 def compute_computed_constants(constants, computed_constants): @@ -574,17 +586,7 @@ def compute_computed_constants(constants, computed_constants): computed_constants[174] = constants[0] if gt_func(constants[0], constants[1]) else constants[2] if gt_func(constants[2], constants[3]) else constants[4] if gt_func(constants[4], constants[5]) else nan computed_constants[175] = constants[0] if gt_func(constants[0], constants[1]) else constants[2] if gt_func(constants[2], constants[3]) else constants[4] if gt_func(constants[4], constants[5]) else constants[6] computed_constants[176] = 123.0+(constants[0] if gt_func(constants[0], constants[1]) else nan) - computed_constants[177] = 123.0 - computed_constants[178] = 123.456789 - computed_constants[179] = 123.0e99 - computed_constants[180] = 123.456789e99 computed_constants[181] = constants[0] - computed_constants[182] = 1.0 - computed_constants[183] = 0.0 - computed_constants[184] = 2.71828182845905 - computed_constants[185] = 3.14159265358979 - computed_constants[186] = inf - computed_constants[187] = nan computed_constants[188] = and_func(constants[0], constants[1])+(constants[1] if gt_func(constants[2], constants[3]) else nan)+constants[4]+and_func(constants[5], constants[6]) computed_constants[189] = and_func(constants[0], constants[1])-((constants[1] if gt_func(constants[2], constants[3]) else nan)-(constants[4]-(constants[1] if gt_func(constants[2], constants[3]) else nan)))-and_func(constants[5], constants[6]) computed_constants[190] = and_func(constants[0], constants[1])*(constants[1] if gt_func(constants[2], constants[3]) else nan)*constants[4]*(constants[1] if gt_func(constants[2], constants[3]) else nan)*and_func(constants[5], constants[6]) @@ -595,8 +597,6 @@ def compute_computed_constants(constants, computed_constants): computed_constants[195] = pow(and_func(constants[0], constants[1]), pow(constants[1] if gt_func(constants[2], constants[3]) else nan, pow(pow(constants[4], constants[1] if gt_func(constants[2], constants[3]) else nan), and_func(constants[0], constants[1])))) computed_constants[196] = pow(pow(pow(and_func(constants[0], constants[1]), 1.0/pow(constants[1] if gt_func(constants[2], constants[3]) else nan, 1.0/constants[4])), 1.0/(constants[1] if gt_func(constants[2], constants[3]) else nan)), 1.0/and_func(constants[0], constants[1])) computed_constants[197] = -and_func(constants[0], constants[1])+-(constants[1] if gt_func(constants[2], constants[3]) else nan) - computed_constants[198] = 1.0 - computed_constants[199] = 3.0 def compute_rates(voi, states, rates, constants, computed_constants, algebraic): diff --git a/tests/resources/coverage/generator/model.out b/tests/resources/coverage/generator/model.out index d57486a8d2..6ced968c7a 100644 --- a/tests/resources/coverage/generator/model.out +++ b/tests/resources/coverage/generator/model.out @@ -128,6 +128,18 @@ void initialiseVariables(double voi, double *states, double *rates, double *cons constants[6] = 7.0; algebraic[0] = 1.0; algebraic[1] = 2.0; + computedConstants[177] = 123.0; + computedConstants[178] = 123.456789; + computedConstants[179] = 123.0e99; + computedConstants[180] = 123.456789e99; + computedConstants[182] = 1.0; + computedConstants[183] = 0.0; + computedConstants[184] = 2.71828182845905; + computedConstants[185] = 3.14159265358979; + computedConstants[186] = INFINITY; + computedConstants[187] = NAN; + computedConstants[198] = 1.0; + computedConstants[199] = 3.0; } void computeComputedConstants(double *constants, double *computedConstants) @@ -309,17 +321,7 @@ void computeComputedConstants(double *constants, double *computedConstants) computedConstants[174] = piecewise(constants[0] > constants[1], constants[0], piecewise(constants[2] > constants[3], constants[2], piecewise(constants[4] > constants[5], constants[4], NAN))); computedConstants[175] = piecewise(constants[0] > constants[1], constants[0], piecewise(constants[2] > constants[3], constants[2], piecewise(constants[4] > constants[5], constants[4], constants[6]))); computedConstants[176] = 123.0+piecewise(constants[0] > constants[1], constants[0], NAN); - computedConstants[177] = 123.0; - computedConstants[178] = 123.456789; - computedConstants[179] = 123.0e99; - computedConstants[180] = 123.456789e99; computedConstants[181] = constants[0]; - computedConstants[182] = 1.0; - computedConstants[183] = 0.0; - computedConstants[184] = 2.71828182845905; - computedConstants[185] = 3.14159265358979; - computedConstants[186] = INFINITY; - computedConstants[187] = NAN; computedConstants[188] = (constants[0] && constants[1])+piecewise(constants[2] > constants[3], constants[1], NAN)+constants[4]+(constants[5] && constants[6]); computedConstants[189] = (constants[0] && constants[1])-(piecewise(constants[2] > constants[3], constants[1], NAN)-(constants[4]-piecewise(constants[2] > constants[3], constants[1], NAN)))-(constants[5] && constants[6]); computedConstants[190] = (constants[0] && constants[1])*piecewise(constants[2] > constants[3], constants[1], NAN)*constants[4]*piecewise(constants[2] > constants[3], constants[1], NAN)*(constants[5] && constants[6]); @@ -330,8 +332,6 @@ void computeComputedConstants(double *constants, double *computedConstants) computedConstants[195] = (constants[0] && constants[1])^^(piecewise(constants[2] > constants[3], constants[1], NAN)^^(constants[4]^^piecewise(constants[2] > constants[3], constants[1], NAN)^^(constants[0] && constants[1]))); computedConstants[196] = (constants[0] && constants[1])^^(1.0/(piecewise(constants[2] > constants[3], constants[1], NAN)^^(1.0/constants[4])))^^(1.0/piecewise(constants[2] > constants[3], constants[1], NAN))^^(1.0/(constants[0] && constants[1])); computedConstants[197] = -(constants[0] && constants[1])+-piecewise(constants[2] > constants[3], constants[1], NAN); - computedConstants[198] = 1.0; - computedConstants[199] = 3.0; } void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) diff --git a/tests/resources/coverage/generator/model.py b/tests/resources/coverage/generator/model.py index 8f5da46a7f..948be5f364 100644 --- a/tests/resources/coverage/generator/model.py +++ b/tests/resources/coverage/generator/model.py @@ -394,6 +394,18 @@ def initialise_variables(voi, states, rates, constants, algebraic): constants[6] = 7.0 algebraic[0] = 1.0 algebraic[1] = 2.0 + computed_constants[177] = 123.0 + computed_constants[178] = 123.456789 + computed_constants[179] = 123.0e99 + computed_constants[180] = 123.456789e99 + computed_constants[182] = 1.0 + computed_constants[183] = 0.0 + computed_constants[184] = 2.71828182845905 + computed_constants[185] = 3.14159265358979 + computed_constants[186] = inf + computed_constants[187] = nan + computed_constants[198] = 1.0 + computed_constants[199] = 3.0 def compute_computed_constants(constants, computed_constants): @@ -574,17 +586,7 @@ def compute_computed_constants(constants, computed_constants): computed_constants[174] = constants[0] if gt_func(constants[0], constants[1]) else constants[2] if gt_func(constants[2], constants[3]) else constants[4] if gt_func(constants[4], constants[5]) else nan computed_constants[175] = constants[0] if gt_func(constants[0], constants[1]) else constants[2] if gt_func(constants[2], constants[3]) else constants[4] if gt_func(constants[4], constants[5]) else constants[6] computed_constants[176] = 123.0+(constants[0] if gt_func(constants[0], constants[1]) else nan) - computed_constants[177] = 123.0 - computed_constants[178] = 123.456789 - computed_constants[179] = 123.0e99 - computed_constants[180] = 123.456789e99 computed_constants[181] = constants[0] - computed_constants[182] = 1.0 - computed_constants[183] = 0.0 - computed_constants[184] = 2.71828182845905 - computed_constants[185] = 3.14159265358979 - computed_constants[186] = inf - computed_constants[187] = nan computed_constants[188] = and_func(constants[0], constants[1])+(constants[1] if gt_func(constants[2], constants[3]) else nan)+constants[4]+and_func(constants[5], constants[6]) computed_constants[189] = and_func(constants[0], constants[1])-((constants[1] if gt_func(constants[2], constants[3]) else nan)-(constants[4]-(constants[1] if gt_func(constants[2], constants[3]) else nan)))-and_func(constants[5], constants[6]) computed_constants[190] = and_func(constants[0], constants[1])*(constants[1] if gt_func(constants[2], constants[3]) else nan)*constants[4]*(constants[1] if gt_func(constants[2], constants[3]) else nan)*and_func(constants[5], constants[6]) @@ -595,8 +597,6 @@ def compute_computed_constants(constants, computed_constants): computed_constants[195] = pow(and_func(constants[0], constants[1]), pow(constants[1] if gt_func(constants[2], constants[3]) else nan, pow(pow(constants[4], constants[1] if gt_func(constants[2], constants[3]) else nan), and_func(constants[0], constants[1])))) computed_constants[196] = pow(pow(pow(and_func(constants[0], constants[1]), 1.0/pow(constants[1] if gt_func(constants[2], constants[3]) else nan, 1.0/constants[4])), 1.0/(constants[1] if gt_func(constants[2], constants[3]) else nan)), 1.0/and_func(constants[0], constants[1])) computed_constants[197] = -and_func(constants[0], constants[1])+-(constants[1] if gt_func(constants[2], constants[3]) else nan) - computed_constants[198] = 1.0 - computed_constants[199] = 3.0 def compute_rates(voi, states, rates, constants, computed_constants, algebraic): diff --git a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.c b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.c index 77864fe754..a3c00b62dd 100644 --- a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.c +++ b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.c @@ -63,12 +63,12 @@ void deleteArray(double *array) void initialiseVariables(double *constants, double *algebraic) { + computedConstants[1] = 1.0; } void computeComputedConstants(double *constants, double *computedConstants) { computedConstants[0] = computedConstants[1]; - computedConstants[1] = 1.0; } void computeVariables(double *constants, double *computedConstants, double *algebraic) diff --git a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.py b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.py index 7478720bdc..e16ebcdbb6 100644 --- a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.py +++ b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.py @@ -36,12 +36,11 @@ def create_algebraic_array(): def initialise_variables(constants, algebraic): - pass + computed_constants[1] = 1.0 def compute_computed_constants(constants, computed_constants): computed_constants[0] = computed_constants[1] - computed_constants[1] = 1.0 def compute_variables(constants, computed_constants, algebraic): diff --git a/tests/resources/generator/algebraic_eqn_constant_on_rhs/model.c b/tests/resources/generator/algebraic_eqn_constant_on_rhs/model.c index 44c462e66e..f4791714af 100644 --- a/tests/resources/generator/algebraic_eqn_constant_on_rhs/model.c +++ b/tests/resources/generator/algebraic_eqn_constant_on_rhs/model.c @@ -62,11 +62,11 @@ void deleteArray(double *array) void initialiseVariables(double *constants, double *algebraic) { + computedConstants[0] = 1.0; } void computeComputedConstants(double *constants, double *computedConstants) { - computedConstants[0] = 1.0; } void computeVariables(double *constants, double *computedConstants, double *algebraic) diff --git a/tests/resources/generator/algebraic_eqn_constant_on_rhs/model.py b/tests/resources/generator/algebraic_eqn_constant_on_rhs/model.py index ec6d22f69c..af04c489bc 100644 --- a/tests/resources/generator/algebraic_eqn_constant_on_rhs/model.py +++ b/tests/resources/generator/algebraic_eqn_constant_on_rhs/model.py @@ -35,11 +35,11 @@ def create_algebraic_array(): def initialise_variables(constants, algebraic): - pass + computed_constants[0] = 1.0 def compute_computed_constants(constants, computed_constants): - computed_constants[0] = 1.0 + pass def compute_variables(constants, computed_constants, algebraic): diff --git a/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.c b/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.c index 014cbdc35b..d5fb727cde 100644 --- a/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.c +++ b/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.c @@ -82,11 +82,11 @@ void deleteArray(double *array) void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic) { states[0] = 1.0; + computedConstants[0] = 1.0; } void computeComputedConstants(double *constants, double *computedConstants) { - computedConstants[0] = 1.0; } void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) diff --git a/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.py b/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.py index c82c2e8618..32d4574de2 100644 --- a/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.py +++ b/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.py @@ -48,10 +48,11 @@ def create_algebraic_array(): def initialise_variables(voi, states, rates, constants, algebraic): states[0] = 1.0 + computed_constants[0] = 1.0 def compute_computed_constants(constants, computed_constants): - computed_constants[0] = 1.0 + pass def compute_rates(voi, states, rates, constants, computed_constants, algebraic): diff --git a/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.c b/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.c index c87a0e1ce4..c081714e40 100644 --- a/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.c +++ b/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.c @@ -82,11 +82,11 @@ void deleteArray(double *array) void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic) { states[0] = 1.0; + computedConstants[0] = 1.0; } void computeComputedConstants(double *constants, double *computedConstants) { - computedConstants[0] = 1.0; } void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) diff --git a/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.py b/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.py index 427ddf5b9d..a6c1827be4 100644 --- a/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.py +++ b/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.py @@ -48,10 +48,11 @@ def create_algebraic_array(): def initialise_variables(voi, states, rates, constants, algebraic): states[0] = 1.0 + computed_constants[0] = 1.0 def compute_computed_constants(constants, computed_constants): - computed_constants[0] = 1.0 + pass def compute_rates(voi, states, rates, constants, computed_constants, algebraic): diff --git a/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.c b/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.c index 92edb52552..ce09a99843 100644 --- a/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.c +++ b/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.c @@ -82,11 +82,11 @@ void deleteArray(double *array) void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic) { states[0] = 1.0; + computedConstants[0] = 1.0; } void computeComputedConstants(double *constants, double *computedConstants) { - computedConstants[0] = 1.0; } void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) diff --git a/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.py b/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.py index a2c96535a6..25d0f4e4dc 100644 --- a/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.py +++ b/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.py @@ -48,10 +48,11 @@ def create_algebraic_array(): def initialise_variables(voi, states, rates, constants, algebraic): states[0] = 1.0 + computed_constants[0] = 1.0 def compute_computed_constants(constants, computed_constants): - computed_constants[0] = 1.0 + pass def compute_rates(voi, states, rates, constants, computed_constants, algebraic): diff --git a/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.c b/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.c index 7e852f4e1d..fd550fc19b 100644 --- a/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.c +++ b/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.c @@ -82,11 +82,11 @@ void deleteArray(double *array) void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic) { states[0] = 1.0; + computedConstants[0] = 1.0; } void computeComputedConstants(double *constants, double *computedConstants) { - computedConstants[0] = 1.0; } void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) diff --git a/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.py b/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.py index a16626a8f9..62519628b3 100644 --- a/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.py +++ b/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.py @@ -48,10 +48,11 @@ def create_algebraic_array(): def initialise_variables(voi, states, rates, constants, algebraic): states[0] = 1.0 + computed_constants[0] = 1.0 def compute_computed_constants(constants, computed_constants): - computed_constants[0] = 1.0 + pass def compute_rates(voi, states, rates, constants, computed_constants, algebraic): diff --git a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.c b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.c index f197a0f5da..105a0833d9 100644 --- a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.c +++ b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.c @@ -94,13 +94,13 @@ void findRoot0(double *variables) void initialiseVariables(double *constants, double *algebraic) { algebraic[0] = 1.0; + computedConstants[0] = 3.0; + computedConstants[1] = 5.0; + computedConstants[2] = 7.0; } void computeComputedConstants(double *constants, double *computedConstants) { - computedConstants[0] = 3.0; - computedConstants[1] = 5.0; - computedConstants[2] = 7.0; } void computeVariables(double *constants, double *computedConstants, double *algebraic) diff --git a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.c b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.c index ba2a7e9056..41a543f1d2 100644 --- a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.c +++ b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.c @@ -80,13 +80,13 @@ void deleteArray(double *array) void initialiseVariables(double *constants, double *algebraic) { + computedConstants[0] = 3.0; + computedConstants[1] = 5.0; + computedConstants[2] = 7.0; } void computeComputedConstants(double *constants, double *computedConstants) { - computedConstants[0] = 3.0; - computedConstants[1] = 5.0; - computedConstants[2] = 7.0; } void computeVariables(double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) diff --git a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.py b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.py index 1253e4dad2..86cfcf3510 100644 --- a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.py +++ b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.py @@ -46,14 +46,14 @@ def create_externals_array(): def initialise_variables(constants, algebraic): - pass - - -def compute_computed_constants(constants, computed_constants): computed_constants[0] = 3.0 computed_constants[1] = 5.0 computed_constants[2] = 7.0 +def compute_computed_constants(constants, computed_constants): + pass + + def compute_variables(constants, computed_constants, algebraic, external_variable): externals[0] = external_variable(variables, 0) diff --git a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.py b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.py index d0b04d108b..df36f9d08e 100644 --- a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.py +++ b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.py @@ -60,13 +60,14 @@ def find_root_0(variables): def initialise_variables(constants, algebraic): algebraic[0] = 1.0 - - -def compute_computed_constants(constants, computed_constants): computed_constants[0] = 3.0 computed_constants[1] = 5.0 computed_constants[2] = 7.0 +def compute_computed_constants(constants, computed_constants): + pass + + def compute_variables(constants, computed_constants, algebraic): find_root_0(variables) diff --git a/tests/resources/generator/algebraic_unknown_var_on_rhs/model.c b/tests/resources/generator/algebraic_unknown_var_on_rhs/model.c index dc329bd29b..48c8e8533a 100644 --- a/tests/resources/generator/algebraic_unknown_var_on_rhs/model.c +++ b/tests/resources/generator/algebraic_unknown_var_on_rhs/model.c @@ -63,11 +63,11 @@ void deleteArray(double *array) void initialiseVariables(double *constants, double *algebraic) { + computedConstants[0] = 1.0; } void computeComputedConstants(double *constants, double *computedConstants) { - computedConstants[0] = 1.0; computedConstants[1] = computedConstants[0]; } diff --git a/tests/resources/generator/algebraic_unknown_var_on_rhs/model.py b/tests/resources/generator/algebraic_unknown_var_on_rhs/model.py index 56ec81b7ef..34185c7ef1 100644 --- a/tests/resources/generator/algebraic_unknown_var_on_rhs/model.py +++ b/tests/resources/generator/algebraic_unknown_var_on_rhs/model.py @@ -36,11 +36,10 @@ def create_algebraic_array(): def initialise_variables(constants, algebraic): - pass + computed_constants[0] = 1.0 def compute_computed_constants(constants, computed_constants): - computed_constants[0] = 1.0 computed_constants[1] = computed_constants[0] diff --git a/tests/resources/generator/ode_computed_var_on_rhs/model.c b/tests/resources/generator/ode_computed_var_on_rhs/model.c index e353013d0f..7e82c15320 100644 --- a/tests/resources/generator/ode_computed_var_on_rhs/model.c +++ b/tests/resources/generator/ode_computed_var_on_rhs/model.c @@ -81,11 +81,11 @@ void deleteArray(double *array) void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic) { states[0] = 1.0; + computedConstants[0] = 1.0; } void computeComputedConstants(double *constants, double *computedConstants) { - computedConstants[0] = 1.0; } void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) diff --git a/tests/resources/generator/ode_computed_var_on_rhs/model.py b/tests/resources/generator/ode_computed_var_on_rhs/model.py index d5856eb249..2ac23adae2 100644 --- a/tests/resources/generator/ode_computed_var_on_rhs/model.py +++ b/tests/resources/generator/ode_computed_var_on_rhs/model.py @@ -47,10 +47,11 @@ def create_algebraic_array(): def initialise_variables(voi, states, rates, constants, algebraic): states[0] = 1.0 + computed_constants[0] = 1.0 def compute_computed_constants(constants, computed_constants): - computed_constants[0] = 1.0 + pass def compute_rates(voi, states, rates, constants, computed_constants, algebraic): diff --git a/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.c b/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.c index 77dc8431b8..6c40a92a76 100644 --- a/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.c +++ b/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.c @@ -81,11 +81,11 @@ void deleteArray(double *array) void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic) { states[0] = 1.0; + computedConstants[0] = 1.0; } void computeComputedConstants(double *constants, double *computedConstants) { - computedConstants[0] = 1.0; } void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) diff --git a/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.py b/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.py index 1de612165b..6d8e7ec5d4 100644 --- a/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.py +++ b/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.py @@ -47,10 +47,11 @@ def create_algebraic_array(): def initialise_variables(voi, states, rates, constants, algebraic): states[0] = 1.0 + computed_constants[0] = 1.0 def compute_computed_constants(constants, computed_constants): - computed_constants[0] = 1.0 + pass def compute_rates(voi, states, rates, constants, computed_constants, algebraic): diff --git a/tests/resources/generator/sine_model_imports/model.c b/tests/resources/generator/sine_model_imports/model.c index 167815f03f..3d3b671d06 100644 --- a/tests/resources/generator/sine_model_imports/model.c +++ b/tests/resources/generator/sine_model_imports/model.c @@ -92,10 +92,6 @@ void initialiseVariables(double voi, double *states, double *rates, double *cons states[0] = constants[0]; constants[0] = 0.0; constants[1] = 0.75; -} - -void computeComputedConstants(double *constants, double *computedConstants) -{ computedConstants[0] = 2.0/3.14159265358979; computedConstants[1] = 2.0*3.14159265358979; computedConstants[2] = 3.14159265358979/2.0; @@ -103,6 +99,10 @@ void computeComputedConstants(double *constants, double *computedConstants) computedConstants[4] = 3.0*3.14159265358979/2.0; } +void computeComputedConstants(double *constants, double *computedConstants) +{ +} + void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { rates[0] = cos(voi); diff --git a/tests/resources/generator/sine_model_imports/model.py b/tests/resources/generator/sine_model_imports/model.py index 272f8268b1..0204c1bc94 100644 --- a/tests/resources/generator/sine_model_imports/model.py +++ b/tests/resources/generator/sine_model_imports/model.py @@ -62,9 +62,6 @@ def initialise_variables(voi, states, rates, constants, algebraic): states[0] = constants[0] constants[0] = 0.0 constants[1] = 0.75 - - -def compute_computed_constants(constants, computed_constants): computed_constants[0] = 2.0/3.14159265358979 computed_constants[1] = 2.0*3.14159265358979 computed_constants[2] = 3.14159265358979/2.0 @@ -72,6 +69,10 @@ def compute_computed_constants(constants, computed_constants): computed_constants[4] = 3.0*3.14159265358979/2.0 +def compute_computed_constants(constants, computed_constants): + pass + + def compute_rates(voi, states, rates, constants, computed_constants, algebraic): rates[0] = cos(voi) From 65e1d18c39ce0a7ebfa7e4648156644c0afa3515 Mon Sep 17 00:00:00 2001 From: Alan Garny Date: Mon, 19 Aug 2024 14:46:15 +0200 Subject: [PATCH 37/85] Generator: initialise things in initialiseVariables() in the order of its parameters. --- src/generator.cpp | 21 ++++++++++--------- tests/resources/coverage/generator/model.c | 4 ++-- .../generator/model.implementation.out | 4 ++-- .../generator/model.modified.profile.c | 4 ++-- .../generator/model.modified.profile.py | 4 ++-- tests/resources/coverage/generator/model.out | 4 ++-- tests/resources/coverage/generator/model.py | 4 ++-- .../model.c | 2 +- .../model.py | 2 +- 9 files changed, 25 insertions(+), 24 deletions(-) diff --git a/src/generator.cpp b/src/generator.cpp index dd26dbb1ae..f11c2e0000 100644 --- a/src/generator.cpp +++ b/src/generator.cpp @@ -1851,6 +1851,17 @@ void Generator::GeneratorImpl::addImplementationInitialiseVariablesMethodCode(st methodBody += generateInitialisationCode(constant); } + // Initialise our computed constants that are initialised using an equation (e.g., x = 3 rather than x with an + // initial value of 3). + + auto equations = mModel->equations(); + + for (const auto &equation : equations) { + if (equation->type() == AnalyserEquation::Type::TRUE_CONSTANT) { + methodBody += generateEquationCode(equation, remainingEquations); + } + } + // Initialise our algebraic variables that have an initial value. Also use an initial guess of zero for // algebraic variables computed using an NLA system. // Note: a variable which is the only unknown in an equation, but which is not on its own on either the LHS or @@ -1866,16 +1877,6 @@ void Generator::GeneratorImpl::addImplementationInitialiseVariablesMethodCode(st } } - // Initialise our true constants. - - auto equations = mModel->equations(); - - for (const auto &equation : equations) { - if (equation->type() == AnalyserEquation::Type::TRUE_CONSTANT) { - methodBody += generateEquationCode(equation, remainingEquations); - } - } - mCode += newLineIfNeeded() + replace(implementationInitialiseVariablesMethodString, "[CODE]", generateMethodBodyCode(methodBody)); diff --git a/tests/resources/coverage/generator/model.c b/tests/resources/coverage/generator/model.c index 8b2dc77550..897a705034 100644 --- a/tests/resources/coverage/generator/model.c +++ b/tests/resources/coverage/generator/model.c @@ -415,8 +415,6 @@ void initialiseVariables(double voi, double *states, double *rates, double *cons constants[4] = 5.0; constants[5] = 6.0; constants[6] = 7.0; - algebraic[0] = 1.0; - algebraic[1] = 2.0; computedConstants[177] = 123.0; computedConstants[178] = 123.456789; computedConstants[179] = 123.0e99; @@ -429,6 +427,8 @@ void initialiseVariables(double voi, double *states, double *rates, double *cons computedConstants[187] = NAN; computedConstants[198] = 1.0; computedConstants[199] = 3.0; + algebraic[0] = 1.0; + algebraic[1] = 2.0; } void computeComputedConstants(double *constants, double *computedConstants) diff --git a/tests/resources/coverage/generator/model.implementation.out b/tests/resources/coverage/generator/model.implementation.out index 2198bce7be..a224e4f34b 100644 --- a/tests/resources/coverage/generator/model.implementation.out +++ b/tests/resources/coverage/generator/model.implementation.out @@ -178,8 +178,6 @@ void initialiseVariables(double voi, double *states, double *rates, double *cons constants[4] = 5.0; constants[5] = 6.0; constants[6] = 7.0; - algebraic[0] = 1.0; - algebraic[1] = 2.0; computedConstants[177] = 123.0; computedConstants[178] = 123.456789; computedConstants[179] = 123.0e99; @@ -192,6 +190,8 @@ void initialiseVariables(double voi, double *states, double *rates, double *cons computedConstants[187] = NAN; computedConstants[198] = 1.0; computedConstants[199] = 3.0; + algebraic[0] = 1.0; + algebraic[1] = 2.0; } void computeComputedConstants(double *constants, double *computedConstants) diff --git a/tests/resources/coverage/generator/model.modified.profile.c b/tests/resources/coverage/generator/model.modified.profile.c index 710c1d8978..bc61303a20 100644 --- a/tests/resources/coverage/generator/model.modified.profile.c +++ b/tests/resources/coverage/generator/model.modified.profile.c @@ -415,8 +415,6 @@ void initialiseVariables(double voi, double *states, double *rates, double *cons constants[4] = 5.0; constants[5] = 6.0; constants[6] = 7.0; - algebraic[0] = 1.0; - algebraic[1] = 2.0; computedConstants[177] = 123.0; computedConstants[178] = 123.456789; computedConstants[179] = 123.0e99; @@ -429,6 +427,8 @@ void initialiseVariables(double voi, double *states, double *rates, double *cons computedConstants[187] = NAN; computedConstants[198] = 1.0; computedConstants[199] = 3.0; + algebraic[0] = 1.0; + algebraic[1] = 2.0; } void computeComputedConstants(double *constants, double *computedConstants) diff --git a/tests/resources/coverage/generator/model.modified.profile.py b/tests/resources/coverage/generator/model.modified.profile.py index ba16c980ba..ab520ec75e 100644 --- a/tests/resources/coverage/generator/model.modified.profile.py +++ b/tests/resources/coverage/generator/model.modified.profile.py @@ -392,8 +392,6 @@ def initialise_variables(voi, states, rates, constants, algebraic): constants[4] = 5.0 constants[5] = 6.0 constants[6] = 7.0 - algebraic[0] = 1.0 - algebraic[1] = 2.0 computed_constants[177] = 123.0 computed_constants[178] = 123.456789 computed_constants[179] = 123.0e99 @@ -406,6 +404,8 @@ def initialise_variables(voi, states, rates, constants, algebraic): computed_constants[187] = nan computed_constants[198] = 1.0 computed_constants[199] = 3.0 + algebraic[0] = 1.0 + algebraic[1] = 2.0 def compute_computed_constants(constants, computed_constants): diff --git a/tests/resources/coverage/generator/model.out b/tests/resources/coverage/generator/model.out index 6ced968c7a..b30c5e3a6b 100644 --- a/tests/resources/coverage/generator/model.out +++ b/tests/resources/coverage/generator/model.out @@ -126,8 +126,6 @@ void initialiseVariables(double voi, double *states, double *rates, double *cons constants[4] = 5.0; constants[5] = 6.0; constants[6] = 7.0; - algebraic[0] = 1.0; - algebraic[1] = 2.0; computedConstants[177] = 123.0; computedConstants[178] = 123.456789; computedConstants[179] = 123.0e99; @@ -140,6 +138,8 @@ void initialiseVariables(double voi, double *states, double *rates, double *cons computedConstants[187] = NAN; computedConstants[198] = 1.0; computedConstants[199] = 3.0; + algebraic[0] = 1.0; + algebraic[1] = 2.0; } void computeComputedConstants(double *constants, double *computedConstants) diff --git a/tests/resources/coverage/generator/model.py b/tests/resources/coverage/generator/model.py index 948be5f364..ed21a14b93 100644 --- a/tests/resources/coverage/generator/model.py +++ b/tests/resources/coverage/generator/model.py @@ -392,8 +392,6 @@ def initialise_variables(voi, states, rates, constants, algebraic): constants[4] = 5.0 constants[5] = 6.0 constants[6] = 7.0 - algebraic[0] = 1.0 - algebraic[1] = 2.0 computed_constants[177] = 123.0 computed_constants[178] = 123.456789 computed_constants[179] = 123.0e99 @@ -406,6 +404,8 @@ def initialise_variables(voi, states, rates, constants, algebraic): computed_constants[187] = nan computed_constants[198] = 1.0 computed_constants[199] = 3.0 + algebraic[0] = 1.0 + algebraic[1] = 2.0 def compute_computed_constants(constants, computed_constants): diff --git a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.c b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.c index 105a0833d9..fb406af3a4 100644 --- a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.c +++ b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.c @@ -93,10 +93,10 @@ void findRoot0(double *variables) void initialiseVariables(double *constants, double *algebraic) { - algebraic[0] = 1.0; computedConstants[0] = 3.0; computedConstants[1] = 5.0; computedConstants[2] = 7.0; + algebraic[0] = 1.0; } void computeComputedConstants(double *constants, double *computedConstants) diff --git a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.py b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.py index df36f9d08e..5022e2f824 100644 --- a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.py +++ b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.py @@ -59,10 +59,10 @@ def find_root_0(variables): def initialise_variables(constants, algebraic): - algebraic[0] = 1.0 computed_constants[0] = 3.0 computed_constants[1] = 5.0 computed_constants[2] = 7.0 + algebraic[0] = 1.0 def compute_computed_constants(constants, computed_constants): From 327225a9e1cf7668d929e2a5088a6578d2e41358 Mon Sep 17 00:00:00 2001 From: Alan Garny Date: Mon, 19 Aug 2024 14:59:26 +0200 Subject: [PATCH 38/85] GeneratorProfile: pass the computedConstants array to initialiseVariables(). --- src/generatorprofile.cpp | 12 ++++++------ src/generatorprofilesha1values.h | 4 ++-- tests/bindings/python/test_generator_profile.py | 8 ++++---- tests/generator/generatorprofile.cpp | 8 ++++---- tests/resources/coverage/generator/model.c | 2 +- tests/resources/coverage/generator/model.h | 2 +- .../coverage/generator/model.implementation.out | 2 +- .../resources/coverage/generator/model.interface.out | 2 +- .../coverage/generator/model.modified.profile.c | 2 +- .../coverage/generator/model.modified.profile.h | 2 +- .../coverage/generator/model.modified.profile.py | 2 +- tests/resources/coverage/generator/model.out | 2 +- tests/resources/coverage/generator/model.py | 2 +- .../algebraic_eqn_computed_var_on_rhs/model.c | 2 +- .../model.external.c | 2 +- .../model.external.h | 2 +- .../model.external.py | 2 +- .../algebraic_eqn_computed_var_on_rhs/model.h | 2 +- .../algebraic_eqn_computed_var_on_rhs/model.py | 2 +- .../generator/algebraic_eqn_const_var_on_rhs/model.c | 2 +- .../generator/algebraic_eqn_const_var_on_rhs/model.h | 2 +- .../algebraic_eqn_const_var_on_rhs/model.py | 2 +- .../generator/algebraic_eqn_constant_on_rhs/model.c | 2 +- .../generator/algebraic_eqn_constant_on_rhs/model.h | 2 +- .../generator/algebraic_eqn_constant_on_rhs/model.py | 2 +- .../algebraic_eqn_derivative_on_rhs/model.c | 2 +- .../algebraic_eqn_derivative_on_rhs/model.h | 2 +- .../algebraic_eqn_derivative_on_rhs/model.py | 2 +- .../model.c | 2 +- .../model.h | 2 +- .../model.py | 2 +- .../generator/algebraic_eqn_state_var_on_rhs/model.c | 2 +- .../generator/algebraic_eqn_state_var_on_rhs/model.h | 2 +- .../algebraic_eqn_state_var_on_rhs/model.py | 2 +- .../model.c | 2 +- .../model.h | 2 +- .../model.py | 2 +- .../model.c | 2 +- .../model.external.c | 2 +- .../model.external.h | 2 +- .../model.external.py | 2 +- .../model.h | 2 +- .../model.py | 2 +- .../model.c | 2 +- .../model.h | 2 +- .../model.py | 2 +- .../model.three.externals.c | 2 +- .../model.three.externals.h | 2 +- .../model.three.externals.py | 2 +- .../model.not.ordered.c | 2 +- .../model.not.ordered.h | 2 +- .../model.not.ordered.py | 2 +- .../model.ordered.c | 2 +- .../model.ordered.h | 2 +- .../model.ordered.py | 2 +- .../generator/algebraic_unknown_var_on_rhs/model.c | 2 +- .../generator/algebraic_unknown_var_on_rhs/model.h | 2 +- .../generator/algebraic_unknown_var_on_rhs/model.py | 2 +- .../resources/generator/cell_geometry_model/model.c | 2 +- .../generator/cell_geometry_model/model.external.c | 2 +- .../generator/cell_geometry_model/model.external.h | 2 +- .../generator/cell_geometry_model/model.external.py | 2 +- .../resources/generator/cell_geometry_model/model.h | 2 +- .../resources/generator/cell_geometry_model/model.py | 2 +- .../cellml_mappings_and_encapsulations/model.c | 2 +- .../cellml_mappings_and_encapsulations/model.h | 2 +- .../cellml_mappings_and_encapsulations/model.py | 2 +- .../resources/generator/cellml_slc_example/model.py | 2 +- .../cellml_state_initialised_using_variable/model.c | 2 +- .../cellml_state_initialised_using_variable/model.h | 2 +- .../cellml_state_initialised_using_variable/model.py | 2 +- .../generator/cellml_unit_scaling_constant/model.c | 2 +- .../generator/cellml_unit_scaling_constant/model.h | 2 +- .../generator/cellml_unit_scaling_constant/model.py | 2 +- .../generator/cellml_unit_scaling_rate/model.c | 2 +- .../generator/cellml_unit_scaling_rate/model.h | 2 +- .../generator/cellml_unit_scaling_rate/model.py | 2 +- .../generator/cellml_unit_scaling_state/model.c | 2 +- .../generator/cellml_unit_scaling_state/model.h | 2 +- .../generator/cellml_unit_scaling_state/model.py | 2 +- .../model.c | 2 +- .../model.h | 2 +- .../model.py | 2 +- .../model.c | 2 +- .../model.h | 2 +- .../model.py | 2 +- .../generator/cellml_unit_scaling_voi_direct/model.c | 2 +- .../generator/cellml_unit_scaling_voi_direct/model.h | 2 +- .../cellml_unit_scaling_voi_direct/model.py | 2 +- .../cellml_unit_scaling_voi_indirect/model.c | 2 +- .../cellml_unit_scaling_voi_indirect/model.h | 2 +- .../cellml_unit_scaling_voi_indirect/model.py | 2 +- .../resources/generator/dae_cellml_1_1_model/model.c | 2 +- .../resources/generator/dae_cellml_1_1_model/model.h | 2 +- .../generator/dae_cellml_1_1_model/model.py | 2 +- tests/resources/generator/dependent_eqns/model.c | 2 +- tests/resources/generator/dependent_eqns/model.h | 2 +- tests/resources/generator/dependent_eqns/model.py | 2 +- .../model.c | 2 +- .../model.h | 2 +- .../model.py | 2 +- .../model.c | 2 +- .../model.h | 2 +- .../model.py | 2 +- .../model.algebraic.c | 2 +- .../model.algebraic.h | 2 +- .../model.algebraic.py | 2 +- .../hodgkin_huxley_squid_axon_model_1952/model.c | 2 +- .../model.computed.constant.c | 2 +- .../model.computed.constant.h | 2 +- .../model.computed.constant.py | 2 +- .../model.constant.c | 2 +- .../model.constant.h | 2 +- .../model.constant.py | 2 +- .../hodgkin_huxley_squid_axon_model_1952/model.dae.c | 2 +- .../hodgkin_huxley_squid_axon_model_1952/model.dae.h | 2 +- .../model.dae.py | 2 +- .../model.dependent.algebraic.c | 2 +- .../model.dependent.algebraic.h | 2 +- .../model.dependent.algebraic.py | 2 +- .../model.dependent.computed.constant.c | 2 +- .../model.dependent.computed.constant.h | 2 +- .../model.dependent.computed.constant.py | 2 +- .../model.dependent.constant.c | 2 +- .../model.dependent.constant.h | 2 +- .../model.dependent.constant.py | 2 +- .../model.dependent.state.c | 2 +- .../model.dependent.state.h | 2 +- .../model.dependent.state.py | 2 +- .../model.external.c | 2 +- .../model.external.h | 2 +- .../model.external.py | 2 +- .../hodgkin_huxley_squid_axon_model_1952/model.h | 2 +- .../hodgkin_huxley_squid_axon_model_1952/model.py | 2 +- .../model.state.c | 2 +- .../model.state.h | 2 +- .../model.state.py | 2 +- tests/resources/generator/noble_model_1962/model.c | 2 +- tests/resources/generator/noble_model_1962/model.h | 2 +- tests/resources/generator/noble_model_1962/model.py | 2 +- .../generator/ode_computed_var_on_rhs/model.c | 2 +- .../generator/ode_computed_var_on_rhs/model.h | 2 +- .../generator/ode_computed_var_on_rhs/model.py | 2 +- .../ode_computed_var_on_rhs_one_component/model.c | 2 +- .../ode_computed_var_on_rhs_one_component/model.h | 2 +- .../ode_computed_var_on_rhs_one_component/model.py | 2 +- .../resources/generator/ode_const_var_on_rhs/model.c | 2 +- .../resources/generator/ode_const_var_on_rhs/model.h | 2 +- .../generator/ode_const_var_on_rhs/model.py | 2 +- .../ode_const_var_on_rhs_one_component/model.c | 2 +- .../ode_const_var_on_rhs_one_component/model.h | 2 +- .../ode_const_var_on_rhs_one_component/model.py | 2 +- .../resources/generator/ode_constant_on_rhs/model.c | 2 +- .../resources/generator/ode_constant_on_rhs/model.h | 2 +- .../resources/generator/ode_constant_on_rhs/model.py | 2 +- .../ode_constant_on_rhs_one_component/model.c | 2 +- .../ode_constant_on_rhs_one_component/model.h | 2 +- .../ode_constant_on_rhs_one_component/model.py | 2 +- .../generator/ode_multiple_dependent_odes/model.c | 2 +- .../generator/ode_multiple_dependent_odes/model.h | 2 +- .../generator/ode_multiple_dependent_odes/model.py | 2 +- .../model.c | 2 +- .../model.h | 2 +- .../model.py | 2 +- .../ode_multiple_odes_with_same_name/model.c | 2 +- .../ode_multiple_odes_with_same_name/model.h | 2 +- .../ode_multiple_odes_with_same_name/model.py | 2 +- .../generator/ode_unknown_var_on_rhs/model.c | 2 +- .../generator/ode_unknown_var_on_rhs/model.h | 2 +- .../generator/ode_unknown_var_on_rhs/model.py | 2 +- .../generator/robertson_model_1966/model.dae.c | 2 +- .../generator/robertson_model_1966/model.dae.h | 2 +- .../generator/robertson_model_1966/model.dae.py | 2 +- .../generator/robertson_model_1966/model.ode.c | 2 +- .../generator/robertson_model_1966/model.ode.h | 2 +- .../generator/robertson_model_1966/model.ode.py | 2 +- tests/resources/generator/sine_model_imports/model.c | 2 +- tests/resources/generator/sine_model_imports/model.h | 2 +- .../resources/generator/sine_model_imports/model.py | 2 +- .../unknown_variable_as_external_variable/model.c | 2 +- .../unknown_variable_as_external_variable/model.h | 2 +- .../unknown_variable_as_external_variable/model.py | 2 +- .../variable_initialised_using_a_constant/model.c | 2 +- .../variable_initialised_using_a_constant/model.h | 2 +- .../variable_initialised_using_a_constant/model.py | 2 +- 185 files changed, 197 insertions(+), 197 deletions(-) diff --git a/src/generatorprofile.cpp b/src/generatorprofile.cpp index 08d9b9a825..0179deb7f4 100644 --- a/src/generatorprofile.cpp +++ b/src/generatorprofile.cpp @@ -409,14 +409,14 @@ void GeneratorProfile::GeneratorProfileImpl::loadProfile(GeneratorProfile::Profi " free(array);\n" "}\n"; - mInterfaceInitialiseVariablesMethodFamString = "void initialiseVariables(double *constants, double *algebraic);\n"; - mImplementationInitialiseVariablesMethodFamString = "void initialiseVariables(double *constants, double *algebraic)\n" + mInterfaceInitialiseVariablesMethodFamString = "void initialiseVariables(double *constants, double *computedConstants, double *algebraic);\n"; + mImplementationInitialiseVariablesMethodFamString = "void initialiseVariables(double *constants, double *computedConstants, double *algebraic)\n" "{\n" "[CODE]" "}\n"; - mInterfaceInitialiseVariablesMethodFdmString = "void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic);\n"; - mImplementationInitialiseVariablesMethodFdmString = "void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic)\n" + mInterfaceInitialiseVariablesMethodFdmString = "void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic);\n"; + mImplementationInitialiseVariablesMethodFdmString = "void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic)\n" "{\n" "[CODE]" "}\n"; @@ -802,12 +802,12 @@ void GeneratorProfile::GeneratorProfileImpl::loadProfile(GeneratorProfile::Profi mInterfaceInitialiseVariablesMethodFamString = ""; mImplementationInitialiseVariablesMethodFamString = "\n" - "def initialise_variables(constants, algebraic):\n" + "def initialise_variables(constants, computed_constants, algebraic):\n" "[CODE]"; mInterfaceInitialiseVariablesMethodFdmString = ""; mImplementationInitialiseVariablesMethodFdmString = "\n" - "def initialise_variables(voi, states, rates, constants, algebraic):\n" + "def initialise_variables(voi, states, rates, constants, computed_constants, algebraic):\n" "[CODE]"; mInterfaceComputeComputedConstantsMethodString = ""; diff --git a/src/generatorprofilesha1values.h b/src/generatorprofilesha1values.h index 6d03642adf..a208a59869 100644 --- a/src/generatorprofilesha1values.h +++ b/src/generatorprofilesha1values.h @@ -24,7 +24,7 @@ namespace libcellml { * The content of this file is generated, do not edit this file directly. * See docs/dev_utilities.rst for further information. */ -static const char C_GENERATOR_PROFILE_SHA1[] = "ad23abd7fbd49d6b76113c14b0d2ec4c7df09d41"; -static const char PYTHON_GENERATOR_PROFILE_SHA1[] = "cced8fe15a79248bc3902c9f45637b053243fc98"; +static const char C_GENERATOR_PROFILE_SHA1[] = "22b2ada38f83adad3e70dd776ef9d72c7c1a966f"; +static const char PYTHON_GENERATOR_PROFILE_SHA1[] = "405499117ed4245fbee40c3d18303ee748e3a1a2"; } // namespace libcellml diff --git a/tests/bindings/python/test_generator_profile.py b/tests/bindings/python/test_generator_profile.py index d4d8703e51..fad40298bb 100644 --- a/tests/bindings/python/test_generator_profile.py +++ b/tests/bindings/python/test_generator_profile.py @@ -838,12 +838,12 @@ def test_implementation_initialise_constants_method_string(self): g = GeneratorProfile() - self.assertEqual('void initialiseVariables(double *constants, double *algebraic)\n{\n[CODE]}\n', + self.assertEqual('void initialiseVariables(double *constants, double *computedConstants, double *algebraic)\n{\n[CODE]}\n', g.implementationInitialiseVariablesMethodString(False)) g.setImplementationInitialiseVariablesMethodString(False, GeneratorProfileTestCase.VALUE) self.assertEqual(GeneratorProfileTestCase.VALUE, g.implementationInitialiseVariablesMethodString(False)) - self.assertEqual('void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic)\n{\n[CODE]}\n', + self.assertEqual('void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic)\n{\n[CODE]}\n', g.implementationInitialiseVariablesMethodString(True)) g.setImplementationInitialiseVariablesMethodString(True, GeneratorProfileTestCase.VALUE) self.assertEqual(GeneratorProfileTestCase.VALUE, g.implementationInitialiseVariablesMethodString(True)) @@ -1117,12 +1117,12 @@ def test_interface_initialise_constants_method_string(self): g = GeneratorProfile() - self.assertEqual('void initialiseVariables(double *constants, double *algebraic);\n', + self.assertEqual('void initialiseVariables(double *constants, double *computedConstants, double *algebraic);\n', g.interfaceInitialiseVariablesMethodString(False)) g.setInterfaceInitialiseVariablesMethodString(False, GeneratorProfileTestCase.VALUE) self.assertEqual(GeneratorProfileTestCase.VALUE, g.interfaceInitialiseVariablesMethodString(False)) - self.assertEqual('void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic);\n', + self.assertEqual('void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic);\n', g.interfaceInitialiseVariablesMethodString(True)) g.setInterfaceInitialiseVariablesMethodString(True, GeneratorProfileTestCase.VALUE) self.assertEqual(GeneratorProfileTestCase.VALUE, g.interfaceInitialiseVariablesMethodString(True)) diff --git a/tests/generator/generatorprofile.cpp b/tests/generator/generatorprofile.cpp index 62bdb259fd..ab038a2634 100644 --- a/tests/generator/generatorprofile.cpp +++ b/tests/generator/generatorprofile.cpp @@ -486,17 +486,17 @@ TEST(GeneratorProfile, defaultMiscellaneousValues) "}\n", generatorProfile->implementationDeleteArrayMethodString()); - EXPECT_EQ("void initialiseVariables(double *constants, double *algebraic);\n", + EXPECT_EQ("void initialiseVariables(double *constants, double *computedConstants, double *algebraic);\n", generatorProfile->interfaceInitialiseVariablesMethodString(false)); - EXPECT_EQ("void initialiseVariables(double *constants, double *algebraic)\n" + EXPECT_EQ("void initialiseVariables(double *constants, double *computedConstants, double *algebraic)\n" "{\n" "[CODE]" "}\n", generatorProfile->implementationInitialiseVariablesMethodString(false)); - EXPECT_EQ("void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic);\n", + EXPECT_EQ("void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic);\n", generatorProfile->interfaceInitialiseVariablesMethodString(true)); - EXPECT_EQ("void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic)\n" + EXPECT_EQ("void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic)\n" "{\n" "[CODE]" "}\n", diff --git a/tests/resources/coverage/generator/model.c b/tests/resources/coverage/generator/model.c index 897a705034..8b52167d66 100644 --- a/tests/resources/coverage/generator/model.c +++ b/tests/resources/coverage/generator/model.c @@ -405,7 +405,7 @@ void findRoot0(double voi, double *states, double *rates, double *variables) algebraic[1] = u[1]; } -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic) +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { states[0] = 0.0; constants[0] = 1.0; diff --git a/tests/resources/coverage/generator/model.h b/tests/resources/coverage/generator/model.h index 5d9a4cbdc0..c22174b701 100644 --- a/tests/resources/coverage/generator/model.h +++ b/tests/resources/coverage/generator/model.h @@ -31,7 +31,7 @@ double * createAlgebraicArray(); void deleteArray(double *array); -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic); +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/coverage/generator/model.implementation.out b/tests/resources/coverage/generator/model.implementation.out index a224e4f34b..6a38edeafd 100644 --- a/tests/resources/coverage/generator/model.implementation.out +++ b/tests/resources/coverage/generator/model.implementation.out @@ -168,7 +168,7 @@ void findRoot0(double voi, double *states, double *rates, double *variables) algebraic[1] = u[1]; } -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic) +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { states[0] = 0.0; constants[0] = 1.0; diff --git a/tests/resources/coverage/generator/model.interface.out b/tests/resources/coverage/generator/model.interface.out index 5fa121175b..a444951dc6 100644 --- a/tests/resources/coverage/generator/model.interface.out +++ b/tests/resources/coverage/generator/model.interface.out @@ -11,7 +11,7 @@ double * createAlgebraicArray(); void deleteArray(double *array); -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic); +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/coverage/generator/model.modified.profile.c b/tests/resources/coverage/generator/model.modified.profile.c index bc61303a20..5653c51ae6 100644 --- a/tests/resources/coverage/generator/model.modified.profile.c +++ b/tests/resources/coverage/generator/model.modified.profile.c @@ -405,7 +405,7 @@ void findRoot0(double voi, double *states, double *rates, double *variables) algebraic[1] = u[1]; } -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic) +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { states[0] = 0.0; constants[0] = 1.0; diff --git a/tests/resources/coverage/generator/model.modified.profile.h b/tests/resources/coverage/generator/model.modified.profile.h index 99e4b49f12..6cc99016d4 100644 --- a/tests/resources/coverage/generator/model.modified.profile.h +++ b/tests/resources/coverage/generator/model.modified.profile.h @@ -31,7 +31,7 @@ double * createAlgebraicArray(); void deleteArray(double *array); -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic); +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/coverage/generator/model.modified.profile.py b/tests/resources/coverage/generator/model.modified.profile.py index ab520ec75e..89ec8121c4 100644 --- a/tests/resources/coverage/generator/model.modified.profile.py +++ b/tests/resources/coverage/generator/model.modified.profile.py @@ -383,7 +383,7 @@ def find_root_0(voi, states, rates, variables): algebraic[1] = u[1] -def initialise_variables(voi, states, rates, constants, algebraic): +def initialise_variables(voi, states, rates, constants, computed_constants, algebraic): states[0] = 0.0 constants[0] = 1.0 constants[1] = 2.0 diff --git a/tests/resources/coverage/generator/model.out b/tests/resources/coverage/generator/model.out index b30c5e3a6b..514bac2e1c 100644 --- a/tests/resources/coverage/generator/model.out +++ b/tests/resources/coverage/generator/model.out @@ -116,7 +116,7 @@ void findRoot0(double voi, double *states, double *rates, double *variables) algebraic[1] = u[1]; } -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic) +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { states[0] = 0.0; constants[0] = 1.0; diff --git a/tests/resources/coverage/generator/model.py b/tests/resources/coverage/generator/model.py index ed21a14b93..a211b39e5f 100644 --- a/tests/resources/coverage/generator/model.py +++ b/tests/resources/coverage/generator/model.py @@ -383,7 +383,7 @@ def find_root_0(voi, states, rates, variables): algebraic[1] = u[1] -def initialise_variables(voi, states, rates, constants, algebraic): +def initialise_variables(voi, states, rates, constants, computed_constants, algebraic): states[0] = 0.0 constants[0] = 1.0 constants[1] = 2.0 diff --git a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.c b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.c index a3c00b62dd..e2e640d06e 100644 --- a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.c +++ b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.c @@ -61,7 +61,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double *constants, double *algebraic) +void initialiseVariables(double *constants, double *computedConstants, double *algebraic) { computedConstants[1] = 1.0; } diff --git a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.c b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.c index 670484b6a5..70e5a39b8a 100644 --- a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.c +++ b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.c @@ -76,7 +76,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double *constants, double *algebraic) +void initialiseVariables(double *constants, double *computedConstants, double *algebraic) { } diff --git a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.h b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.h index 96a917b0ad..9492088756 100644 --- a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.h +++ b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.h @@ -32,6 +32,6 @@ void deleteArray(double *array); typedef double (* ExternalVariable)(double *variables, size_t index); -void initialiseVariables(double *constants, double *algebraic); +void initialiseVariables(double *constants, double *computedConstants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeVariables(double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); diff --git a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.py b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.py index 08357f1eed..244859d72c 100644 --- a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.py +++ b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.py @@ -43,7 +43,7 @@ def create_externals_array(): return [nan]*EXTERNAL_COUNT -def initialise_variables(constants, algebraic): +def initialise_variables(constants, computed_constants, algebraic): pass diff --git a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.h b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.h index 1f34a6c517..c8faff2f68 100644 --- a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.h +++ b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.h @@ -27,6 +27,6 @@ double * createAlgebraicArray(); void deleteArray(double *array); -void initialiseVariables(double *constants, double *algebraic); +void initialiseVariables(double *constants, double *computedConstants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeVariables(double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.py b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.py index e16ebcdbb6..ecf5e3ada1 100644 --- a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.py +++ b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.py @@ -35,7 +35,7 @@ def create_algebraic_array(): return [nan]*ALGEBRAIC_COUNT -def initialise_variables(constants, algebraic): +def initialise_variables(constants, computed_constants, algebraic): computed_constants[1] = 1.0 diff --git a/tests/resources/generator/algebraic_eqn_const_var_on_rhs/model.c b/tests/resources/generator/algebraic_eqn_const_var_on_rhs/model.c index 844244bab2..9677a8153a 100644 --- a/tests/resources/generator/algebraic_eqn_const_var_on_rhs/model.c +++ b/tests/resources/generator/algebraic_eqn_const_var_on_rhs/model.c @@ -61,7 +61,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double *constants, double *algebraic) +void initialiseVariables(double *constants, double *computedConstants, double *algebraic) { constants[0] = 1.0; } diff --git a/tests/resources/generator/algebraic_eqn_const_var_on_rhs/model.h b/tests/resources/generator/algebraic_eqn_const_var_on_rhs/model.h index 1f34a6c517..c8faff2f68 100644 --- a/tests/resources/generator/algebraic_eqn_const_var_on_rhs/model.h +++ b/tests/resources/generator/algebraic_eqn_const_var_on_rhs/model.h @@ -27,6 +27,6 @@ double * createAlgebraicArray(); void deleteArray(double *array); -void initialiseVariables(double *constants, double *algebraic); +void initialiseVariables(double *constants, double *computedConstants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeVariables(double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/algebraic_eqn_const_var_on_rhs/model.py b/tests/resources/generator/algebraic_eqn_const_var_on_rhs/model.py index 1f58e7d6f4..16a15e2d4d 100644 --- a/tests/resources/generator/algebraic_eqn_const_var_on_rhs/model.py +++ b/tests/resources/generator/algebraic_eqn_const_var_on_rhs/model.py @@ -35,7 +35,7 @@ def create_algebraic_array(): return [nan]*ALGEBRAIC_COUNT -def initialise_variables(constants, algebraic): +def initialise_variables(constants, computed_constants, algebraic): constants[0] = 1.0 diff --git a/tests/resources/generator/algebraic_eqn_constant_on_rhs/model.c b/tests/resources/generator/algebraic_eqn_constant_on_rhs/model.c index f4791714af..38d6117d38 100644 --- a/tests/resources/generator/algebraic_eqn_constant_on_rhs/model.c +++ b/tests/resources/generator/algebraic_eqn_constant_on_rhs/model.c @@ -60,7 +60,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double *constants, double *algebraic) +void initialiseVariables(double *constants, double *computedConstants, double *algebraic) { computedConstants[0] = 1.0; } diff --git a/tests/resources/generator/algebraic_eqn_constant_on_rhs/model.h b/tests/resources/generator/algebraic_eqn_constant_on_rhs/model.h index 214a248c0b..c317e56937 100644 --- a/tests/resources/generator/algebraic_eqn_constant_on_rhs/model.h +++ b/tests/resources/generator/algebraic_eqn_constant_on_rhs/model.h @@ -27,6 +27,6 @@ double * createAlgebraicArray(); void deleteArray(double *array); -void initialiseVariables(double *constants, double *algebraic); +void initialiseVariables(double *constants, double *computedConstants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeVariables(double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/algebraic_eqn_constant_on_rhs/model.py b/tests/resources/generator/algebraic_eqn_constant_on_rhs/model.py index af04c489bc..93ffb01d85 100644 --- a/tests/resources/generator/algebraic_eqn_constant_on_rhs/model.py +++ b/tests/resources/generator/algebraic_eqn_constant_on_rhs/model.py @@ -34,7 +34,7 @@ def create_algebraic_array(): return [nan]*ALGEBRAIC_COUNT -def initialise_variables(constants, algebraic): +def initialise_variables(constants, computed_constants, algebraic): computed_constants[0] = 1.0 diff --git a/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.c b/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.c index d5fb727cde..9c2f823f6b 100644 --- a/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.c +++ b/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.c @@ -79,7 +79,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic) +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { states[0] = 1.0; computedConstants[0] = 1.0; diff --git a/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.h b/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.h index fe567bfd63..c50e027fca 100644 --- a/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.h +++ b/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.h @@ -31,7 +31,7 @@ double * createAlgebraicArray(); void deleteArray(double *array); -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic); +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.py b/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.py index 32d4574de2..3f7bc95174 100644 --- a/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.py +++ b/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.py @@ -46,7 +46,7 @@ def create_algebraic_array(): return [nan]*ALGEBRAIC_COUNT -def initialise_variables(voi, states, rates, constants, algebraic): +def initialise_variables(voi, states, rates, constants, computed_constants, algebraic): states[0] = 1.0 computed_constants[0] = 1.0 diff --git a/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.c b/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.c index c081714e40..8c72b66ab3 100644 --- a/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.c +++ b/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.c @@ -79,7 +79,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic) +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { states[0] = 1.0; computedConstants[0] = 1.0; diff --git a/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.h b/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.h index d2fac6dd07..7672524c38 100644 --- a/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.h +++ b/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.h @@ -31,7 +31,7 @@ double * createAlgebraicArray(); void deleteArray(double *array); -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic); +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.py b/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.py index a6c1827be4..598b58e854 100644 --- a/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.py +++ b/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.py @@ -46,7 +46,7 @@ def create_algebraic_array(): return [nan]*ALGEBRAIC_COUNT -def initialise_variables(voi, states, rates, constants, algebraic): +def initialise_variables(voi, states, rates, constants, computed_constants, algebraic): states[0] = 1.0 computed_constants[0] = 1.0 diff --git a/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.c b/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.c index ce09a99843..3131bc653b 100644 --- a/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.c +++ b/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.c @@ -79,7 +79,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic) +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { states[0] = 1.0; computedConstants[0] = 1.0; diff --git a/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.h b/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.h index 57b67a4db1..981651ccd1 100644 --- a/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.h +++ b/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.h @@ -31,7 +31,7 @@ double * createAlgebraicArray(); void deleteArray(double *array); -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic); +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.py b/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.py index 25d0f4e4dc..c655ba4613 100644 --- a/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.py +++ b/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.py @@ -46,7 +46,7 @@ def create_algebraic_array(): return [nan]*ALGEBRAIC_COUNT -def initialise_variables(voi, states, rates, constants, algebraic): +def initialise_variables(voi, states, rates, constants, computed_constants, algebraic): states[0] = 1.0 computed_constants[0] = 1.0 diff --git a/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.c b/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.c index fd550fc19b..02014ef239 100644 --- a/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.c +++ b/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.c @@ -79,7 +79,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic) +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { states[0] = 1.0; computedConstants[0] = 1.0; diff --git a/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.h b/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.h index 2cb538a2f7..46e07c2ddf 100644 --- a/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.h +++ b/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.h @@ -31,7 +31,7 @@ double * createAlgebraicArray(); void deleteArray(double *array); -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic); +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.py b/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.py index 62519628b3..013484ceec 100644 --- a/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.py +++ b/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.py @@ -46,7 +46,7 @@ def create_algebraic_array(): return [nan]*ALGEBRAIC_COUNT -def initialise_variables(voi, states, rates, constants, algebraic): +def initialise_variables(voi, states, rates, constants, computed_constants, algebraic): states[0] = 1.0 computed_constants[0] = 1.0 diff --git a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.c b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.c index fb406af3a4..bd2b6cf187 100644 --- a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.c +++ b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.c @@ -91,7 +91,7 @@ void findRoot0(double *variables) algebraic[0] = u[0]; } -void initialiseVariables(double *constants, double *algebraic) +void initialiseVariables(double *constants, double *computedConstants, double *algebraic) { computedConstants[0] = 3.0; computedConstants[1] = 5.0; diff --git a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.c b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.c index 41a543f1d2..43fe422a9f 100644 --- a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.c +++ b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.c @@ -78,7 +78,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double *constants, double *algebraic) +void initialiseVariables(double *constants, double *computedConstants, double *algebraic) { computedConstants[0] = 3.0; computedConstants[1] = 5.0; diff --git a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.h b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.h index 96a917b0ad..9492088756 100644 --- a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.h +++ b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.h @@ -32,6 +32,6 @@ void deleteArray(double *array); typedef double (* ExternalVariable)(double *variables, size_t index); -void initialiseVariables(double *constants, double *algebraic); +void initialiseVariables(double *constants, double *computedConstants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeVariables(double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); diff --git a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.py b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.py index 86cfcf3510..c5a93e2ac2 100644 --- a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.py +++ b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.py @@ -45,7 +45,7 @@ def create_externals_array(): return [nan]*EXTERNAL_COUNT -def initialise_variables(constants, algebraic): +def initialise_variables(constants, computed_constants, algebraic): computed_constants[0] = 3.0 computed_constants[1] = 5.0 computed_constants[2] = 7.0 diff --git a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.h b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.h index 1f34a6c517..c8faff2f68 100644 --- a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.h +++ b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.h @@ -27,6 +27,6 @@ double * createAlgebraicArray(); void deleteArray(double *array); -void initialiseVariables(double *constants, double *algebraic); +void initialiseVariables(double *constants, double *computedConstants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeVariables(double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.py b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.py index 5022e2f824..199da80a29 100644 --- a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.py +++ b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.py @@ -58,7 +58,7 @@ def find_root_0(variables): algebraic[0] = u[0] -def initialise_variables(constants, algebraic): +def initialise_variables(constants, computed_constants, algebraic): computed_constants[0] = 3.0 computed_constants[1] = 5.0 computed_constants[2] = 7.0 diff --git a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.c b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.c index 0dbe3d9a82..f2362c8361 100644 --- a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.c +++ b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.c @@ -98,7 +98,7 @@ void findRoot0(double *variables) algebraic[2] = u[2]; } -void initialiseVariables(double *constants, double *algebraic) +void initialiseVariables(double *constants, double *computedConstants, double *algebraic) { algebraic[0] = 1.0; algebraic[1] = 1.0; diff --git a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.h b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.h index 20d7d3dd9d..9fdff0e0c7 100644 --- a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.h +++ b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.h @@ -27,6 +27,6 @@ double * createAlgebraicArray(); void deleteArray(double *array); -void initialiseVariables(double *constants, double *algebraic); +void initialiseVariables(double *constants, double *computedConstants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeVariables(double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.py b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.py index 2e9fe582ce..08b001bda7 100644 --- a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.py +++ b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.py @@ -65,7 +65,7 @@ def find_root_0(variables): algebraic[2] = u[2] -def initialise_variables(constants, algebraic): +def initialise_variables(constants, computed_constants, algebraic): algebraic[0] = 1.0 algebraic[1] = 1.0 algebraic[2] = 1.0 diff --git a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.c b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.c index 25af29adaa..bc57800164 100644 --- a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.c +++ b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.c @@ -77,7 +77,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double *constants, double *algebraic) +void initialiseVariables(double *constants, double *computedConstants, double *algebraic) { } diff --git a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.h b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.h index 63c13e639f..33b7905754 100644 --- a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.h +++ b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.h @@ -32,6 +32,6 @@ void deleteArray(double *array); typedef double (* ExternalVariable)(double *variables, size_t index); -void initialiseVariables(double *constants, double *algebraic); +void initialiseVariables(double *constants, double *computedConstants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeVariables(double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); diff --git a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.py b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.py index fbc56b7156..7d519d04b3 100644 --- a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.py +++ b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.py @@ -44,7 +44,7 @@ def create_externals_array(): return [nan]*EXTERNAL_COUNT -def initialise_variables(constants, algebraic): +def initialise_variables(constants, computed_constants, algebraic): pass diff --git a/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.c b/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.c index dec7a49535..eb6901bc61 100644 --- a/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.c +++ b/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.c @@ -97,7 +97,7 @@ void findRoot0(double *variables) algebraic[1] = u[1]; } -void initialiseVariables(double *constants, double *algebraic) +void initialiseVariables(double *constants, double *computedConstants, double *algebraic) { constants[0] = 3.0; constants[1] = 5.0; diff --git a/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.h b/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.h index 20d7d3dd9d..9fdff0e0c7 100644 --- a/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.h +++ b/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.h @@ -27,6 +27,6 @@ double * createAlgebraicArray(); void deleteArray(double *array); -void initialiseVariables(double *constants, double *algebraic); +void initialiseVariables(double *constants, double *computedConstants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeVariables(double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.py b/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.py index a38ce9d1ec..31584bc6cc 100644 --- a/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.py +++ b/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.py @@ -64,7 +64,7 @@ def find_root_0(variables): algebraic[1] = u[1] -def initialise_variables(constants, algebraic): +def initialise_variables(constants, computed_constants, algebraic): constants[0] = 3.0 constants[1] = 5.0 algebraic[1] = 1.0 diff --git a/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.c b/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.c index 1cfcef8403..f446032296 100644 --- a/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.c +++ b/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.c @@ -97,7 +97,7 @@ void findRoot0(double *variables) algebraic[1] = u[1]; } -void initialiseVariables(double *constants, double *algebraic) +void initialiseVariables(double *constants, double *computedConstants, double *algebraic) { constants[0] = 3.0; constants[1] = 5.0; diff --git a/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.h b/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.h index 20d7d3dd9d..9fdff0e0c7 100644 --- a/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.h +++ b/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.h @@ -27,6 +27,6 @@ double * createAlgebraicArray(); void deleteArray(double *array); -void initialiseVariables(double *constants, double *algebraic); +void initialiseVariables(double *constants, double *computedConstants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeVariables(double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.py b/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.py index a7badc9535..7cc2478a0a 100644 --- a/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.py +++ b/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.py @@ -64,7 +64,7 @@ def find_root_0(variables): algebraic[1] = u[1] -def initialise_variables(constants, algebraic): +def initialise_variables(constants, computed_constants, algebraic): constants[0] = 3.0 constants[1] = 5.0 algebraic[0] = 1.0 diff --git a/tests/resources/generator/algebraic_unknown_var_on_rhs/model.c b/tests/resources/generator/algebraic_unknown_var_on_rhs/model.c index 48c8e8533a..75949bb58a 100644 --- a/tests/resources/generator/algebraic_unknown_var_on_rhs/model.c +++ b/tests/resources/generator/algebraic_unknown_var_on_rhs/model.c @@ -61,7 +61,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double *constants, double *algebraic) +void initialiseVariables(double *constants, double *computedConstants, double *algebraic) { computedConstants[0] = 1.0; } diff --git a/tests/resources/generator/algebraic_unknown_var_on_rhs/model.h b/tests/resources/generator/algebraic_unknown_var_on_rhs/model.h index 214a248c0b..c317e56937 100644 --- a/tests/resources/generator/algebraic_unknown_var_on_rhs/model.h +++ b/tests/resources/generator/algebraic_unknown_var_on_rhs/model.h @@ -27,6 +27,6 @@ double * createAlgebraicArray(); void deleteArray(double *array); -void initialiseVariables(double *constants, double *algebraic); +void initialiseVariables(double *constants, double *computedConstants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeVariables(double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/algebraic_unknown_var_on_rhs/model.py b/tests/resources/generator/algebraic_unknown_var_on_rhs/model.py index 34185c7ef1..a9b08bd062 100644 --- a/tests/resources/generator/algebraic_unknown_var_on_rhs/model.py +++ b/tests/resources/generator/algebraic_unknown_var_on_rhs/model.py @@ -35,7 +35,7 @@ def create_algebraic_array(): return [nan]*ALGEBRAIC_COUNT -def initialise_variables(constants, algebraic): +def initialise_variables(constants, computed_constants, algebraic): computed_constants[0] = 1.0 diff --git a/tests/resources/generator/cell_geometry_model/model.c b/tests/resources/generator/cell_geometry_model/model.c index 5e019e3e4e..9d3f104514 100644 --- a/tests/resources/generator/cell_geometry_model/model.c +++ b/tests/resources/generator/cell_geometry_model/model.c @@ -63,7 +63,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double *constants, double *algebraic) +void initialiseVariables(double *constants, double *computedConstants, double *algebraic) { constants[0] = 0.01; constants[1] = 0.0011; diff --git a/tests/resources/generator/cell_geometry_model/model.external.c b/tests/resources/generator/cell_geometry_model/model.external.c index a57c6692c0..1b946f417f 100644 --- a/tests/resources/generator/cell_geometry_model/model.external.c +++ b/tests/resources/generator/cell_geometry_model/model.external.c @@ -78,7 +78,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double *constants, double *algebraic) +void initialiseVariables(double *constants, double *computedConstants, double *algebraic) { } diff --git a/tests/resources/generator/cell_geometry_model/model.external.h b/tests/resources/generator/cell_geometry_model/model.external.h index 0fc34b1508..28c04e7141 100644 --- a/tests/resources/generator/cell_geometry_model/model.external.h +++ b/tests/resources/generator/cell_geometry_model/model.external.h @@ -32,6 +32,6 @@ void deleteArray(double *array); typedef double (* ExternalVariable)(double *variables, size_t index); -void initialiseVariables(double *constants, double *algebraic); +void initialiseVariables(double *constants, double *computedConstants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeVariables(double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); diff --git a/tests/resources/generator/cell_geometry_model/model.external.py b/tests/resources/generator/cell_geometry_model/model.external.py index e220d2e73d..463fb5960c 100644 --- a/tests/resources/generator/cell_geometry_model/model.external.py +++ b/tests/resources/generator/cell_geometry_model/model.external.py @@ -45,7 +45,7 @@ def create_externals_array(): return [nan]*EXTERNAL_COUNT -def initialise_variables(constants, algebraic): +def initialise_variables(constants, computed_constants, algebraic): pass diff --git a/tests/resources/generator/cell_geometry_model/model.h b/tests/resources/generator/cell_geometry_model/model.h index 01b945a3ae..bcf58d80ed 100644 --- a/tests/resources/generator/cell_geometry_model/model.h +++ b/tests/resources/generator/cell_geometry_model/model.h @@ -27,6 +27,6 @@ double * createAlgebraicArray(); void deleteArray(double *array); -void initialiseVariables(double *constants, double *algebraic); +void initialiseVariables(double *constants, double *computedConstants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeVariables(double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/cell_geometry_model/model.py b/tests/resources/generator/cell_geometry_model/model.py index a8a99bf87f..a427cc5ffd 100644 --- a/tests/resources/generator/cell_geometry_model/model.py +++ b/tests/resources/generator/cell_geometry_model/model.py @@ -37,7 +37,7 @@ def create_algebraic_array(): return [nan]*ALGEBRAIC_COUNT -def initialise_variables(constants, algebraic): +def initialise_variables(constants, computed_constants, algebraic): constants[0] = 0.01 constants[1] = 0.0011 diff --git a/tests/resources/generator/cellml_mappings_and_encapsulations/model.c b/tests/resources/generator/cellml_mappings_and_encapsulations/model.c index 17813b55b5..dfeedb00f4 100644 --- a/tests/resources/generator/cellml_mappings_and_encapsulations/model.c +++ b/tests/resources/generator/cellml_mappings_and_encapsulations/model.c @@ -80,7 +80,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic) +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { states[0] = 1.0; states[1] = 0.0; diff --git a/tests/resources/generator/cellml_mappings_and_encapsulations/model.h b/tests/resources/generator/cellml_mappings_and_encapsulations/model.h index 43685c5ba2..d668e10ba8 100644 --- a/tests/resources/generator/cellml_mappings_and_encapsulations/model.h +++ b/tests/resources/generator/cellml_mappings_and_encapsulations/model.h @@ -31,7 +31,7 @@ double * createAlgebraicArray(); void deleteArray(double *array); -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic); +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/cellml_mappings_and_encapsulations/model.py b/tests/resources/generator/cellml_mappings_and_encapsulations/model.py index 75604f927f..cde62f28c3 100644 --- a/tests/resources/generator/cellml_mappings_and_encapsulations/model.py +++ b/tests/resources/generator/cellml_mappings_and_encapsulations/model.py @@ -47,7 +47,7 @@ def create_algebraic_array(): return [nan]*ALGEBRAIC_COUNT -def initialise_variables(voi, states, rates, constants, algebraic): +def initialise_variables(voi, states, rates, constants, computed_constants, algebraic): states[0] = 1.0 states[1] = 0.0 diff --git a/tests/resources/generator/cellml_slc_example/model.py b/tests/resources/generator/cellml_slc_example/model.py index f7fd19efad..848d4a7222 100644 --- a/tests/resources/generator/cellml_slc_example/model.py +++ b/tests/resources/generator/cellml_slc_example/model.py @@ -43,7 +43,7 @@ def create_algebraic_array(): return [nan]*ALGEBRAIC_COUNT -def initialise_variables(constants, algebraic): +def initialise_variables(constants, computed_constants, algebraic): constants[0] = 1.1 constants[1] = 21262500.0 constants[2] = 150.0 diff --git a/tests/resources/generator/cellml_state_initialised_using_variable/model.c b/tests/resources/generator/cellml_state_initialised_using_variable/model.c index 67ec8957ec..ac395dd3bb 100644 --- a/tests/resources/generator/cellml_state_initialised_using_variable/model.c +++ b/tests/resources/generator/cellml_state_initialised_using_variable/model.c @@ -78,7 +78,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic) +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { constants[0] = 123.0; states[0] = constants[0]; diff --git a/tests/resources/generator/cellml_state_initialised_using_variable/model.h b/tests/resources/generator/cellml_state_initialised_using_variable/model.h index ab266738e2..125d289e64 100644 --- a/tests/resources/generator/cellml_state_initialised_using_variable/model.h +++ b/tests/resources/generator/cellml_state_initialised_using_variable/model.h @@ -31,7 +31,7 @@ double * createAlgebraicArray(); void deleteArray(double *array); -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic); +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/cellml_state_initialised_using_variable/model.py b/tests/resources/generator/cellml_state_initialised_using_variable/model.py index 8ce57554e5..f2e9eb5259 100644 --- a/tests/resources/generator/cellml_state_initialised_using_variable/model.py +++ b/tests/resources/generator/cellml_state_initialised_using_variable/model.py @@ -45,7 +45,7 @@ def create_algebraic_array(): return [nan]*ALGEBRAIC_COUNT -def initialise_variables(voi, states, rates, constants, algebraic): +def initialise_variables(voi, states, rates, constants, computed_constants, algebraic): constants[0] = 123.0 states[0] = constants[0] diff --git a/tests/resources/generator/cellml_unit_scaling_constant/model.c b/tests/resources/generator/cellml_unit_scaling_constant/model.c index 096f850647..3d259be889 100644 --- a/tests/resources/generator/cellml_unit_scaling_constant/model.c +++ b/tests/resources/generator/cellml_unit_scaling_constant/model.c @@ -62,7 +62,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double *constants, double *algebraic) +void initialiseVariables(double *constants, double *computedConstants, double *algebraic) { constants[0] = 123.0; } diff --git a/tests/resources/generator/cellml_unit_scaling_constant/model.h b/tests/resources/generator/cellml_unit_scaling_constant/model.h index d7919125ee..1e51b94dde 100644 --- a/tests/resources/generator/cellml_unit_scaling_constant/model.h +++ b/tests/resources/generator/cellml_unit_scaling_constant/model.h @@ -27,6 +27,6 @@ double * createAlgebraicArray(); void deleteArray(double *array); -void initialiseVariables(double *constants, double *algebraic); +void initialiseVariables(double *constants, double *computedConstants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeVariables(double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/cellml_unit_scaling_constant/model.py b/tests/resources/generator/cellml_unit_scaling_constant/model.py index b6ea3f00d7..16717c06e4 100644 --- a/tests/resources/generator/cellml_unit_scaling_constant/model.py +++ b/tests/resources/generator/cellml_unit_scaling_constant/model.py @@ -36,7 +36,7 @@ def create_algebraic_array(): return [nan]*ALGEBRAIC_COUNT -def initialise_variables(constants, algebraic): +def initialise_variables(constants, computed_constants, algebraic): constants[0] = 123.0 diff --git a/tests/resources/generator/cellml_unit_scaling_rate/model.c b/tests/resources/generator/cellml_unit_scaling_rate/model.c index d714d284df..604d08c5fd 100644 --- a/tests/resources/generator/cellml_unit_scaling_rate/model.c +++ b/tests/resources/generator/cellml_unit_scaling_rate/model.c @@ -79,7 +79,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic) +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { states[0] = 123.0; } diff --git a/tests/resources/generator/cellml_unit_scaling_rate/model.h b/tests/resources/generator/cellml_unit_scaling_rate/model.h index ab266738e2..125d289e64 100644 --- a/tests/resources/generator/cellml_unit_scaling_rate/model.h +++ b/tests/resources/generator/cellml_unit_scaling_rate/model.h @@ -31,7 +31,7 @@ double * createAlgebraicArray(); void deleteArray(double *array); -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic); +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/cellml_unit_scaling_rate/model.py b/tests/resources/generator/cellml_unit_scaling_rate/model.py index 8b002e8089..45678f11d5 100644 --- a/tests/resources/generator/cellml_unit_scaling_rate/model.py +++ b/tests/resources/generator/cellml_unit_scaling_rate/model.py @@ -46,7 +46,7 @@ def create_algebraic_array(): return [nan]*ALGEBRAIC_COUNT -def initialise_variables(voi, states, rates, constants, algebraic): +def initialise_variables(voi, states, rates, constants, computed_constants, algebraic): states[0] = 123.0 diff --git a/tests/resources/generator/cellml_unit_scaling_state/model.c b/tests/resources/generator/cellml_unit_scaling_state/model.c index b9aa6f1bc9..ac805fa9e2 100644 --- a/tests/resources/generator/cellml_unit_scaling_state/model.c +++ b/tests/resources/generator/cellml_unit_scaling_state/model.c @@ -79,7 +79,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic) +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { states[0] = 123.0; } diff --git a/tests/resources/generator/cellml_unit_scaling_state/model.h b/tests/resources/generator/cellml_unit_scaling_state/model.h index ab266738e2..125d289e64 100644 --- a/tests/resources/generator/cellml_unit_scaling_state/model.h +++ b/tests/resources/generator/cellml_unit_scaling_state/model.h @@ -31,7 +31,7 @@ double * createAlgebraicArray(); void deleteArray(double *array); -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic); +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/cellml_unit_scaling_state/model.py b/tests/resources/generator/cellml_unit_scaling_state/model.py index a419ddf98f..d88e7699c5 100644 --- a/tests/resources/generator/cellml_unit_scaling_state/model.py +++ b/tests/resources/generator/cellml_unit_scaling_state/model.py @@ -46,7 +46,7 @@ def create_algebraic_array(): return [nan]*ALGEBRAIC_COUNT -def initialise_variables(voi, states, rates, constants, algebraic): +def initialise_variables(voi, states, rates, constants, computed_constants, algebraic): states[0] = 123.0 diff --git a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.c b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.c index f98746f5c1..5e7d345e2d 100644 --- a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.c +++ b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.c @@ -78,7 +78,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic) +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { states[0] = 123.0; states[1] = 0.001*789.0; diff --git a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.h b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.h index e56356d45a..ca1a66c12b 100644 --- a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.h +++ b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.h @@ -31,7 +31,7 @@ double * createAlgebraicArray(); void deleteArray(double *array); -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic); +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.py b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.py index fd82e9c5fe..4bf6281a0a 100644 --- a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.py +++ b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.py @@ -45,7 +45,7 @@ def create_algebraic_array(): return [nan]*ALGEBRAIC_COUNT -def initialise_variables(voi, states, rates, constants, algebraic): +def initialise_variables(voi, states, rates, constants, computed_constants, algebraic): states[0] = 123.0 states[1] = 0.001*789.0 diff --git a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.c b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.c index e860b309e6..d7e12ef11e 100644 --- a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.c +++ b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.c @@ -80,7 +80,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic) +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { constants[0] = 123.0; states[0] = constants[0]; diff --git a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.h b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.h index 67cbb918d9..7f150918f4 100644 --- a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.h +++ b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.h @@ -31,7 +31,7 @@ double * createAlgebraicArray(); void deleteArray(double *array); -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic); +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.py b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.py index b58354e4ba..648e230131 100644 --- a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.py +++ b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.py @@ -47,7 +47,7 @@ def create_algebraic_array(): return [nan]*ALGEBRAIC_COUNT -def initialise_variables(voi, states, rates, constants, algebraic): +def initialise_variables(voi, states, rates, constants, computed_constants, algebraic): constants[0] = 123.0 states[0] = constants[0] constants[1] = 789.0 diff --git a/tests/resources/generator/cellml_unit_scaling_voi_direct/model.c b/tests/resources/generator/cellml_unit_scaling_voi_direct/model.c index d545a05574..630608791e 100644 --- a/tests/resources/generator/cellml_unit_scaling_voi_direct/model.c +++ b/tests/resources/generator/cellml_unit_scaling_voi_direct/model.c @@ -78,7 +78,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic) +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { states[0] = 3.0; states[1] = 5.0; diff --git a/tests/resources/generator/cellml_unit_scaling_voi_direct/model.h b/tests/resources/generator/cellml_unit_scaling_voi_direct/model.h index e29840b4e5..a415fa4aed 100644 --- a/tests/resources/generator/cellml_unit_scaling_voi_direct/model.h +++ b/tests/resources/generator/cellml_unit_scaling_voi_direct/model.h @@ -31,7 +31,7 @@ double * createAlgebraicArray(); void deleteArray(double *array); -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic); +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/cellml_unit_scaling_voi_direct/model.py b/tests/resources/generator/cellml_unit_scaling_voi_direct/model.py index 2d7f9ee98d..fa2831f8f8 100644 --- a/tests/resources/generator/cellml_unit_scaling_voi_direct/model.py +++ b/tests/resources/generator/cellml_unit_scaling_voi_direct/model.py @@ -45,7 +45,7 @@ def create_algebraic_array(): return [nan]*ALGEBRAIC_COUNT -def initialise_variables(voi, states, rates, constants, algebraic): +def initialise_variables(voi, states, rates, constants, computed_constants, algebraic): states[0] = 3.0 states[1] = 5.0 diff --git a/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.c b/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.c index 1a7319f7dc..4d5382792f 100644 --- a/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.c +++ b/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.c @@ -79,7 +79,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic) +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { states[0] = 3.0; states[1] = 7.0; diff --git a/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.h b/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.h index c5193145bc..68f3a5146d 100644 --- a/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.h +++ b/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.h @@ -31,7 +31,7 @@ double * createAlgebraicArray(); void deleteArray(double *array); -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic); +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.py b/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.py index 9bc446530a..824dc3e08c 100644 --- a/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.py +++ b/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.py @@ -46,7 +46,7 @@ def create_algebraic_array(): return [nan]*ALGEBRAIC_COUNT -def initialise_variables(voi, states, rates, constants, algebraic): +def initialise_variables(voi, states, rates, constants, computed_constants, algebraic): states[0] = 3.0 states[1] = 7.0 states[2] = 11.0 diff --git a/tests/resources/generator/dae_cellml_1_1_model/model.c b/tests/resources/generator/dae_cellml_1_1_model/model.c index b4a2873d61..fbf6e9c031 100644 --- a/tests/resources/generator/dae_cellml_1_1_model/model.c +++ b/tests/resources/generator/dae_cellml_1_1_model/model.c @@ -146,7 +146,7 @@ void findRoot1(double voi, double *states, double *rates, double *variables) algebraic[4] = u[0]; } -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic) +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { states[0] = 1.0; states[1] = 0.0; diff --git a/tests/resources/generator/dae_cellml_1_1_model/model.h b/tests/resources/generator/dae_cellml_1_1_model/model.h index d677f483cd..4aeac109db 100644 --- a/tests/resources/generator/dae_cellml_1_1_model/model.h +++ b/tests/resources/generator/dae_cellml_1_1_model/model.h @@ -31,7 +31,7 @@ double * createAlgebraicArray(); void deleteArray(double *array); -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic); +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/dae_cellml_1_1_model/model.py b/tests/resources/generator/dae_cellml_1_1_model/model.py index b5f846ce9b..55f5a61539 100644 --- a/tests/resources/generator/dae_cellml_1_1_model/model.py +++ b/tests/resources/generator/dae_cellml_1_1_model/model.py @@ -100,7 +100,7 @@ def find_root_1(voi, states, rates, variables): algebraic[4] = u[0] -def initialise_variables(voi, states, rates, constants, algebraic): +def initialise_variables(voi, states, rates, constants, computed_constants, algebraic): states[0] = 1.0 states[1] = 0.0 constants[0] = 1.0 diff --git a/tests/resources/generator/dependent_eqns/model.c b/tests/resources/generator/dependent_eqns/model.c index 48ab41d0ca..dfad97fc7a 100644 --- a/tests/resources/generator/dependent_eqns/model.c +++ b/tests/resources/generator/dependent_eqns/model.c @@ -79,7 +79,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic) +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { states[0] = 0.0; } diff --git a/tests/resources/generator/dependent_eqns/model.h b/tests/resources/generator/dependent_eqns/model.h index 428425c587..574fe07d5c 100644 --- a/tests/resources/generator/dependent_eqns/model.h +++ b/tests/resources/generator/dependent_eqns/model.h @@ -31,7 +31,7 @@ double * createAlgebraicArray(); void deleteArray(double *array); -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic); +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/dependent_eqns/model.py b/tests/resources/generator/dependent_eqns/model.py index e808d821ce..3d9a8c2026 100644 --- a/tests/resources/generator/dependent_eqns/model.py +++ b/tests/resources/generator/dependent_eqns/model.py @@ -46,7 +46,7 @@ def create_algebraic_array(): return [nan]*ALGEBRAIC_COUNT -def initialise_variables(voi, states, rates, constants, algebraic): +def initialise_variables(voi, states, rates, constants, computed_constants, algebraic): states[0] = 0.0 diff --git a/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.c b/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.c index a8a5216a2e..045b53af6a 100644 --- a/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.c +++ b/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.c @@ -326,7 +326,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic) +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { states[0] = 6.226104e-5; states[1] = 5.0; diff --git a/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.h b/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.h index 911283f315..3ff58c68f4 100644 --- a/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.h +++ b/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.h @@ -31,7 +31,7 @@ double * createAlgebraicArray(); void deleteArray(double *array); -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic); +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.py b/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.py index aa0f5640b4..cd7801ddc4 100644 --- a/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.py +++ b/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.py @@ -313,7 +313,7 @@ def create_algebraic_array(): return [nan]*ALGEBRAIC_COUNT -def initialise_variables(voi, states, rates, constants, algebraic): +def initialise_variables(voi, states, rates, constants, computed_constants, algebraic): states[0] = 6.226104e-5 states[1] = 5.0 states[2] = 0.409551 diff --git a/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.c b/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.c index 359ef0869d..ad882a9ebb 100644 --- a/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.c +++ b/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.c @@ -276,7 +276,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic) +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { states[0] = -39.013558536; states[1] = 0.092361701692; diff --git a/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.h b/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.h index 817cb1544c..7160a3fb12 100644 --- a/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.h +++ b/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.h @@ -31,7 +31,7 @@ double * createAlgebraicArray(); void deleteArray(double *array); -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic); +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.py b/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.py index 1817e152e6..9a0e9212ef 100644 --- a/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.py +++ b/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.py @@ -251,7 +251,7 @@ def create_algebraic_array(): return [nan]*ALGEBRAIC_COUNT -def initialise_variables(voi, states, rates, constants, algebraic): +def initialise_variables(voi, states, rates, constants, computed_constants, algebraic): states[0] = -39.013558536 states[1] = 0.092361701692 states[2] = 0.015905380261 diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.c index cdeae6291f..55490ad4c0 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.c @@ -113,7 +113,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic) +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { states[0] = 0.0; states[1] = 0.6; diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.h index 857b7d32fa..d86b4881ec 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.h +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.h @@ -36,7 +36,7 @@ void deleteArray(double *array); typedef double (* ExternalVariable)(double voi, double *states, double *rates, double *variables, size_t index); -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic); +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.py index efe508ad16..a444417b16 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.py @@ -85,7 +85,7 @@ def create_externals_array(): return [nan]*EXTERNAL_COUNT -def initialise_variables(voi, states, rates, constants, algebraic): +def initialise_variables(voi, states, rates, constants, computed_constants, algebraic): states[0] = 0.0 states[1] = 0.6 states[2] = 0.05 diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.c index 399b824ff9..9ea08e1592 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.c @@ -98,7 +98,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic) +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { states[0] = 0.0; states[1] = 0.6; diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.c index 2e6435a24e..8709c5445b 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.c @@ -113,7 +113,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic) +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { states[0] = 0.0; states[1] = 0.6; diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.h index 857b7d32fa..d86b4881ec 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.h +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.h @@ -36,7 +36,7 @@ void deleteArray(double *array); typedef double (* ExternalVariable)(double voi, double *states, double *rates, double *variables, size_t index); -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic); +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.py index a1324eb79a..02f9149f91 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.py @@ -85,7 +85,7 @@ def create_externals_array(): return [nan]*EXTERNAL_COUNT -def initialise_variables(voi, states, rates, constants, algebraic): +def initialise_variables(voi, states, rates, constants, computed_constants, algebraic): states[0] = 0.0 states[1] = 0.6 states[2] = 0.05 diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.c index 6d271f592c..a67ad82735 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.c @@ -113,7 +113,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic) +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { states[0] = 0.0; states[1] = 0.6; diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.h index 857b7d32fa..d86b4881ec 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.h +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.h @@ -36,7 +36,7 @@ void deleteArray(double *array); typedef double (* ExternalVariable)(double voi, double *states, double *rates, double *variables, size_t index); -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic); +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.py index b3951a5dd8..cd644acd07 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.py @@ -85,7 +85,7 @@ def create_externals_array(): return [nan]*EXTERNAL_COUNT -def initialise_variables(voi, states, rates, constants, algebraic): +def initialise_variables(voi, states, rates, constants, computed_constants, algebraic): states[0] = 0.0 states[1] = 0.6 states[2] = 0.05 diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.c index 51e1dd0e23..0b1b5ec76f 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.c @@ -516,7 +516,7 @@ void findRoot16(double voi, double *states, double *rates, double *variables) rates[3] = u[0]; } -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic) +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { states[0] = 0.0; states[1] = 0.6; diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.h index 07842acfdc..bb8c14e65a 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.h +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.h @@ -31,7 +31,7 @@ double * createAlgebraicArray(); void deleteArray(double *array); -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic); +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.py index a42be47a53..82e45add94 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.py @@ -437,7 +437,7 @@ def find_root_16(voi, states, rates, variables): rates[3] = u[0] -def initialise_variables(voi, states, rates, constants, algebraic): +def initialise_variables(voi, states, rates, constants, computed_constants, algebraic): states[0] = 0.0 states[1] = 0.6 states[2] = 0.05 diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.c index f10c3958b8..29251ba2f4 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.c @@ -113,7 +113,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic) +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { states[0] = 0.0; states[1] = 0.6; diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.h index 857b7d32fa..d86b4881ec 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.h +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.h @@ -36,7 +36,7 @@ void deleteArray(double *array); typedef double (* ExternalVariable)(double voi, double *states, double *rates, double *variables, size_t index); -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic); +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.py index 716cafe93f..5617153fe5 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.py @@ -85,7 +85,7 @@ def create_externals_array(): return [nan]*EXTERNAL_COUNT -def initialise_variables(voi, states, rates, constants, algebraic): +def initialise_variables(voi, states, rates, constants, computed_constants, algebraic): states[0] = 0.0 states[1] = 0.6 states[2] = 0.05 diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.c index 08b086b89a..3c67e6474b 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.c @@ -113,7 +113,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic) +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { states[0] = 0.0; states[1] = 0.6; diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.h index 857b7d32fa..d86b4881ec 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.h +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.h @@ -36,7 +36,7 @@ void deleteArray(double *array); typedef double (* ExternalVariable)(double voi, double *states, double *rates, double *variables, size_t index); -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic); +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.py index 0a961a48b8..03c5b15a3a 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.py @@ -85,7 +85,7 @@ def create_externals_array(): return [nan]*EXTERNAL_COUNT -def initialise_variables(voi, states, rates, constants, algebraic): +def initialise_variables(voi, states, rates, constants, computed_constants, algebraic): states[0] = 0.0 states[1] = 0.6 states[2] = 0.05 diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.c index 45f29d072a..e4646c0553 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.c @@ -113,7 +113,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic) +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { states[0] = 0.0; states[1] = 0.6; diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.h index 857b7d32fa..d86b4881ec 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.h +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.h @@ -36,7 +36,7 @@ void deleteArray(double *array); typedef double (* ExternalVariable)(double voi, double *states, double *rates, double *variables, size_t index); -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic); +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.py index 7fb9fbb6f7..522d0795db 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.py @@ -85,7 +85,7 @@ def create_externals_array(): return [nan]*EXTERNAL_COUNT -def initialise_variables(voi, states, rates, constants, algebraic): +def initialise_variables(voi, states, rates, constants, computed_constants, algebraic): states[0] = 0.0 states[1] = 0.6 states[2] = 0.05 diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.c index f5f5a253f7..bceb90099d 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.c @@ -113,7 +113,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic) +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { states[0] = 0.6; states[1] = 0.325; diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.h index 857b7d32fa..d86b4881ec 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.h +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.h @@ -36,7 +36,7 @@ void deleteArray(double *array); typedef double (* ExternalVariable)(double voi, double *states, double *rates, double *variables, size_t index); -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic); +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.py index cb704989d0..d6e3ae27c2 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.py @@ -85,7 +85,7 @@ def create_externals_array(): return [nan]*EXTERNAL_COUNT -def initialise_variables(voi, states, rates, constants, algebraic): +def initialise_variables(voi, states, rates, constants, computed_constants, algebraic): states[0] = 0.6 states[1] = 0.325 constants[0] = 1.0 diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.c index 4dd3845710..452d243d28 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.c @@ -113,7 +113,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic) +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { states[0] = 0.6; states[1] = 0.05; diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.h index 857b7d32fa..d86b4881ec 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.h +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.h @@ -36,7 +36,7 @@ void deleteArray(double *array); typedef double (* ExternalVariable)(double voi, double *states, double *rates, double *variables, size_t index); -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic); +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.py index fd8453ffcf..199dab37b0 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.py @@ -85,7 +85,7 @@ def create_externals_array(): return [nan]*EXTERNAL_COUNT -def initialise_variables(voi, states, rates, constants, algebraic): +def initialise_variables(voi, states, rates, constants, computed_constants, algebraic): states[0] = 0.6 states[1] = 0.05 states[2] = 0.325 diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.h index 07842acfdc..bb8c14e65a 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.h +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.h @@ -31,7 +31,7 @@ double * createAlgebraicArray(); void deleteArray(double *array); -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic); +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.py index 2a50b6d32c..5e4544aff4 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.py @@ -77,7 +77,7 @@ def create_algebraic_array(): return [nan]*ALGEBRAIC_COUNT -def initialise_variables(voi, states, rates, constants, algebraic): +def initialise_variables(voi, states, rates, constants, computed_constants, algebraic): states[0] = 0.0 states[1] = 0.6 states[2] = 0.05 diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.c index 205334d7b1..b9b6ea788c 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.c @@ -113,7 +113,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic) +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { states[0] = 0.0; states[1] = 0.6; diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.h index 857b7d32fa..d86b4881ec 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.h +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.h @@ -36,7 +36,7 @@ void deleteArray(double *array); typedef double (* ExternalVariable)(double voi, double *states, double *rates, double *variables, size_t index); -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic); +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.py index b97e824032..1e9f9cf9ca 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.py @@ -85,7 +85,7 @@ def create_externals_array(): return [nan]*EXTERNAL_COUNT -def initialise_variables(voi, states, rates, constants, algebraic): +def initialise_variables(voi, states, rates, constants, computed_constants, algebraic): states[0] = 0.0 states[1] = 0.6 states[2] = 0.325 diff --git a/tests/resources/generator/noble_model_1962/model.c b/tests/resources/generator/noble_model_1962/model.c index e827ed2393..01b5b73f84 100644 --- a/tests/resources/generator/noble_model_1962/model.c +++ b/tests/resources/generator/noble_model_1962/model.c @@ -97,7 +97,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic) +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { states[0] = -87.0; states[1] = 0.01; diff --git a/tests/resources/generator/noble_model_1962/model.h b/tests/resources/generator/noble_model_1962/model.h index e3b78b41d5..dd78b85735 100644 --- a/tests/resources/generator/noble_model_1962/model.h +++ b/tests/resources/generator/noble_model_1962/model.h @@ -31,7 +31,7 @@ double * createAlgebraicArray(); void deleteArray(double *array); -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic); +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/noble_model_1962/model.py b/tests/resources/generator/noble_model_1962/model.py index 787e9a9736..886e83180b 100644 --- a/tests/resources/generator/noble_model_1962/model.py +++ b/tests/resources/generator/noble_model_1962/model.py @@ -64,7 +64,7 @@ def create_algebraic_array(): return [nan]*ALGEBRAIC_COUNT -def initialise_variables(voi, states, rates, constants, algebraic): +def initialise_variables(voi, states, rates, constants, computed_constants, algebraic): states[0] = -87.0 states[1] = 0.01 states[2] = 0.8 diff --git a/tests/resources/generator/ode_computed_var_on_rhs/model.c b/tests/resources/generator/ode_computed_var_on_rhs/model.c index 7e82c15320..d414fe9c3f 100644 --- a/tests/resources/generator/ode_computed_var_on_rhs/model.c +++ b/tests/resources/generator/ode_computed_var_on_rhs/model.c @@ -78,7 +78,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic) +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { states[0] = 1.0; computedConstants[0] = 1.0; diff --git a/tests/resources/generator/ode_computed_var_on_rhs/model.h b/tests/resources/generator/ode_computed_var_on_rhs/model.h index e29840b4e5..a415fa4aed 100644 --- a/tests/resources/generator/ode_computed_var_on_rhs/model.h +++ b/tests/resources/generator/ode_computed_var_on_rhs/model.h @@ -31,7 +31,7 @@ double * createAlgebraicArray(); void deleteArray(double *array); -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic); +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/ode_computed_var_on_rhs/model.py b/tests/resources/generator/ode_computed_var_on_rhs/model.py index 2ac23adae2..8cc8419dc1 100644 --- a/tests/resources/generator/ode_computed_var_on_rhs/model.py +++ b/tests/resources/generator/ode_computed_var_on_rhs/model.py @@ -45,7 +45,7 @@ def create_algebraic_array(): return [nan]*ALGEBRAIC_COUNT -def initialise_variables(voi, states, rates, constants, algebraic): +def initialise_variables(voi, states, rates, constants, computed_constants, algebraic): states[0] = 1.0 computed_constants[0] = 1.0 diff --git a/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.c b/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.c index 6c40a92a76..ae4086a657 100644 --- a/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.c +++ b/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.c @@ -78,7 +78,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic) +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { states[0] = 1.0; computedConstants[0] = 1.0; diff --git a/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.h b/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.h index d2fac6dd07..7672524c38 100644 --- a/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.h +++ b/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.h @@ -31,7 +31,7 @@ double * createAlgebraicArray(); void deleteArray(double *array); -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic); +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.py b/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.py index 6d8e7ec5d4..200410168d 100644 --- a/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.py +++ b/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.py @@ -45,7 +45,7 @@ def create_algebraic_array(): return [nan]*ALGEBRAIC_COUNT -def initialise_variables(voi, states, rates, constants, algebraic): +def initialise_variables(voi, states, rates, constants, computed_constants, algebraic): states[0] = 1.0 computed_constants[0] = 1.0 diff --git a/tests/resources/generator/ode_const_var_on_rhs/model.c b/tests/resources/generator/ode_const_var_on_rhs/model.c index 2a6e2a5f22..c07a96c1da 100644 --- a/tests/resources/generator/ode_const_var_on_rhs/model.c +++ b/tests/resources/generator/ode_const_var_on_rhs/model.c @@ -78,7 +78,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic) +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { states[0] = 1.0; constants[0] = 1.0; diff --git a/tests/resources/generator/ode_const_var_on_rhs/model.h b/tests/resources/generator/ode_const_var_on_rhs/model.h index e29840b4e5..a415fa4aed 100644 --- a/tests/resources/generator/ode_const_var_on_rhs/model.h +++ b/tests/resources/generator/ode_const_var_on_rhs/model.h @@ -31,7 +31,7 @@ double * createAlgebraicArray(); void deleteArray(double *array); -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic); +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/ode_const_var_on_rhs/model.py b/tests/resources/generator/ode_const_var_on_rhs/model.py index 82e966ec62..30e37bfffd 100644 --- a/tests/resources/generator/ode_const_var_on_rhs/model.py +++ b/tests/resources/generator/ode_const_var_on_rhs/model.py @@ -45,7 +45,7 @@ def create_algebraic_array(): return [nan]*ALGEBRAIC_COUNT -def initialise_variables(voi, states, rates, constants, algebraic): +def initialise_variables(voi, states, rates, constants, computed_constants, algebraic): states[0] = 1.0 constants[0] = 1.0 diff --git a/tests/resources/generator/ode_const_var_on_rhs_one_component/model.c b/tests/resources/generator/ode_const_var_on_rhs_one_component/model.c index 72adfdb45a..535c9f2320 100644 --- a/tests/resources/generator/ode_const_var_on_rhs_one_component/model.c +++ b/tests/resources/generator/ode_const_var_on_rhs_one_component/model.c @@ -78,7 +78,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic) +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { states[0] = 1.0; constants[0] = 1.0; diff --git a/tests/resources/generator/ode_const_var_on_rhs_one_component/model.h b/tests/resources/generator/ode_const_var_on_rhs_one_component/model.h index d2fac6dd07..7672524c38 100644 --- a/tests/resources/generator/ode_const_var_on_rhs_one_component/model.h +++ b/tests/resources/generator/ode_const_var_on_rhs_one_component/model.h @@ -31,7 +31,7 @@ double * createAlgebraicArray(); void deleteArray(double *array); -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic); +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/ode_const_var_on_rhs_one_component/model.py b/tests/resources/generator/ode_const_var_on_rhs_one_component/model.py index b501785003..f9dd400b5f 100644 --- a/tests/resources/generator/ode_const_var_on_rhs_one_component/model.py +++ b/tests/resources/generator/ode_const_var_on_rhs_one_component/model.py @@ -45,7 +45,7 @@ def create_algebraic_array(): return [nan]*ALGEBRAIC_COUNT -def initialise_variables(voi, states, rates, constants, algebraic): +def initialise_variables(voi, states, rates, constants, computed_constants, algebraic): states[0] = 1.0 constants[0] = 1.0 diff --git a/tests/resources/generator/ode_constant_on_rhs/model.c b/tests/resources/generator/ode_constant_on_rhs/model.c index b16f444300..079b3e5ab6 100644 --- a/tests/resources/generator/ode_constant_on_rhs/model.c +++ b/tests/resources/generator/ode_constant_on_rhs/model.c @@ -77,7 +77,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic) +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { states[0] = 1.0; } diff --git a/tests/resources/generator/ode_constant_on_rhs/model.h b/tests/resources/generator/ode_constant_on_rhs/model.h index e29840b4e5..a415fa4aed 100644 --- a/tests/resources/generator/ode_constant_on_rhs/model.h +++ b/tests/resources/generator/ode_constant_on_rhs/model.h @@ -31,7 +31,7 @@ double * createAlgebraicArray(); void deleteArray(double *array); -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic); +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/ode_constant_on_rhs/model.py b/tests/resources/generator/ode_constant_on_rhs/model.py index 0341e10a40..f68edb5389 100644 --- a/tests/resources/generator/ode_constant_on_rhs/model.py +++ b/tests/resources/generator/ode_constant_on_rhs/model.py @@ -44,7 +44,7 @@ def create_algebraic_array(): return [nan]*ALGEBRAIC_COUNT -def initialise_variables(voi, states, rates, constants, algebraic): +def initialise_variables(voi, states, rates, constants, computed_constants, algebraic): states[0] = 1.0 diff --git a/tests/resources/generator/ode_constant_on_rhs_one_component/model.c b/tests/resources/generator/ode_constant_on_rhs_one_component/model.c index 2f0a222f88..ac1762023c 100644 --- a/tests/resources/generator/ode_constant_on_rhs_one_component/model.c +++ b/tests/resources/generator/ode_constant_on_rhs_one_component/model.c @@ -77,7 +77,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic) +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { states[0] = 1.0; } diff --git a/tests/resources/generator/ode_constant_on_rhs_one_component/model.h b/tests/resources/generator/ode_constant_on_rhs_one_component/model.h index d2fac6dd07..7672524c38 100644 --- a/tests/resources/generator/ode_constant_on_rhs_one_component/model.h +++ b/tests/resources/generator/ode_constant_on_rhs_one_component/model.h @@ -31,7 +31,7 @@ double * createAlgebraicArray(); void deleteArray(double *array); -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic); +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/ode_constant_on_rhs_one_component/model.py b/tests/resources/generator/ode_constant_on_rhs_one_component/model.py index 0a7d4de47c..d82951638b 100644 --- a/tests/resources/generator/ode_constant_on_rhs_one_component/model.py +++ b/tests/resources/generator/ode_constant_on_rhs_one_component/model.py @@ -44,7 +44,7 @@ def create_algebraic_array(): return [nan]*ALGEBRAIC_COUNT -def initialise_variables(voi, states, rates, constants, algebraic): +def initialise_variables(voi, states, rates, constants, computed_constants, algebraic): states[0] = 1.0 diff --git a/tests/resources/generator/ode_multiple_dependent_odes/model.c b/tests/resources/generator/ode_multiple_dependent_odes/model.c index 19903539fc..504fb338c0 100644 --- a/tests/resources/generator/ode_multiple_dependent_odes/model.c +++ b/tests/resources/generator/ode_multiple_dependent_odes/model.c @@ -79,7 +79,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic) +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { states[0] = -2.0; states[1] = 0.0; diff --git a/tests/resources/generator/ode_multiple_dependent_odes/model.h b/tests/resources/generator/ode_multiple_dependent_odes/model.h index 723fd54030..798bab570e 100644 --- a/tests/resources/generator/ode_multiple_dependent_odes/model.h +++ b/tests/resources/generator/ode_multiple_dependent_odes/model.h @@ -31,7 +31,7 @@ double * createAlgebraicArray(); void deleteArray(double *array); -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic); +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/ode_multiple_dependent_odes/model.py b/tests/resources/generator/ode_multiple_dependent_odes/model.py index a25d71bd78..aa411806cc 100644 --- a/tests/resources/generator/ode_multiple_dependent_odes/model.py +++ b/tests/resources/generator/ode_multiple_dependent_odes/model.py @@ -46,7 +46,7 @@ def create_algebraic_array(): return [nan]*ALGEBRAIC_COUNT -def initialise_variables(voi, states, rates, constants, algebraic): +def initialise_variables(voi, states, rates, constants, computed_constants, algebraic): states[0] = -2.0 states[1] = 0.0 constants[0] = 1.0 diff --git a/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.c b/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.c index ce65181001..7ce4852626 100644 --- a/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.c +++ b/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.c @@ -79,7 +79,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic) +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { states[0] = -2.0; states[1] = 0.0; diff --git a/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.h b/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.h index a929fb7cd9..bec3e3490f 100644 --- a/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.h +++ b/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.h @@ -31,7 +31,7 @@ double * createAlgebraicArray(); void deleteArray(double *array); -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic); +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.py b/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.py index c86ec1bb7e..0b45d416cb 100644 --- a/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.py +++ b/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.py @@ -46,7 +46,7 @@ def create_algebraic_array(): return [nan]*ALGEBRAIC_COUNT -def initialise_variables(voi, states, rates, constants, algebraic): +def initialise_variables(voi, states, rates, constants, computed_constants, algebraic): states[0] = -2.0 states[1] = 0.0 constants[0] = 1.0 diff --git a/tests/resources/generator/ode_multiple_odes_with_same_name/model.c b/tests/resources/generator/ode_multiple_odes_with_same_name/model.c index c1f03ce233..d176162d68 100644 --- a/tests/resources/generator/ode_multiple_odes_with_same_name/model.c +++ b/tests/resources/generator/ode_multiple_odes_with_same_name/model.c @@ -79,7 +79,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic) +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { states[0] = 1.0; states[1] = 1.0; diff --git a/tests/resources/generator/ode_multiple_odes_with_same_name/model.h b/tests/resources/generator/ode_multiple_odes_with_same_name/model.h index f62cb5d152..ffe8d72ae2 100644 --- a/tests/resources/generator/ode_multiple_odes_with_same_name/model.h +++ b/tests/resources/generator/ode_multiple_odes_with_same_name/model.h @@ -31,7 +31,7 @@ double * createAlgebraicArray(); void deleteArray(double *array); -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic); +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/ode_multiple_odes_with_same_name/model.py b/tests/resources/generator/ode_multiple_odes_with_same_name/model.py index 8c25966175..9b961ab387 100644 --- a/tests/resources/generator/ode_multiple_odes_with_same_name/model.py +++ b/tests/resources/generator/ode_multiple_odes_with_same_name/model.py @@ -46,7 +46,7 @@ def create_algebraic_array(): return [nan]*ALGEBRAIC_COUNT -def initialise_variables(voi, states, rates, constants, algebraic): +def initialise_variables(voi, states, rates, constants, computed_constants, algebraic): states[0] = 1.0 states[1] = 1.0 constants[0] = 1.0 diff --git a/tests/resources/generator/ode_unknown_var_on_rhs/model.c b/tests/resources/generator/ode_unknown_var_on_rhs/model.c index 3ff8890e6e..ea28a9b45e 100644 --- a/tests/resources/generator/ode_unknown_var_on_rhs/model.c +++ b/tests/resources/generator/ode_unknown_var_on_rhs/model.c @@ -78,7 +78,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic) +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { states[0] = 1.0; states[1] = 1.0; diff --git a/tests/resources/generator/ode_unknown_var_on_rhs/model.h b/tests/resources/generator/ode_unknown_var_on_rhs/model.h index e29840b4e5..a415fa4aed 100644 --- a/tests/resources/generator/ode_unknown_var_on_rhs/model.h +++ b/tests/resources/generator/ode_unknown_var_on_rhs/model.h @@ -31,7 +31,7 @@ double * createAlgebraicArray(); void deleteArray(double *array); -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic); +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/ode_unknown_var_on_rhs/model.py b/tests/resources/generator/ode_unknown_var_on_rhs/model.py index 2da518cac6..4a6a2dcf2f 100644 --- a/tests/resources/generator/ode_unknown_var_on_rhs/model.py +++ b/tests/resources/generator/ode_unknown_var_on_rhs/model.py @@ -45,7 +45,7 @@ def create_algebraic_array(): return [nan]*ALGEBRAIC_COUNT -def initialise_variables(voi, states, rates, constants, algebraic): +def initialise_variables(voi, states, rates, constants, computed_constants, algebraic): states[0] = 1.0 states[1] = 1.0 diff --git a/tests/resources/generator/robertson_model_1966/model.dae.c b/tests/resources/generator/robertson_model_1966/model.dae.c index 4d5fa00dfd..0a9d6e3d0f 100644 --- a/tests/resources/generator/robertson_model_1966/model.dae.c +++ b/tests/resources/generator/robertson_model_1966/model.dae.c @@ -117,7 +117,7 @@ void findRoot0(double voi, double *states, double *rates, double *variables) algebraic[0] = u[0]; } -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic) +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { states[0] = 1.0; states[1] = 0.0; diff --git a/tests/resources/generator/robertson_model_1966/model.dae.h b/tests/resources/generator/robertson_model_1966/model.dae.h index 5d5754056a..85620bec4c 100644 --- a/tests/resources/generator/robertson_model_1966/model.dae.h +++ b/tests/resources/generator/robertson_model_1966/model.dae.h @@ -31,7 +31,7 @@ double * createAlgebraicArray(); void deleteArray(double *array); -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic); +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/robertson_model_1966/model.dae.py b/tests/resources/generator/robertson_model_1966/model.dae.py index 1b8fd41272..e018d745aa 100644 --- a/tests/resources/generator/robertson_model_1966/model.dae.py +++ b/tests/resources/generator/robertson_model_1966/model.dae.py @@ -74,7 +74,7 @@ def find_root_0(voi, states, rates, variables): algebraic[0] = u[0] -def initialise_variables(voi, states, rates, constants, algebraic): +def initialise_variables(voi, states, rates, constants, computed_constants, algebraic): states[0] = 1.0 states[1] = 0.0 constants[0] = 0.04 diff --git a/tests/resources/generator/robertson_model_1966/model.ode.c b/tests/resources/generator/robertson_model_1966/model.ode.c index 27ca2adc65..c64c8f3d07 100644 --- a/tests/resources/generator/robertson_model_1966/model.ode.c +++ b/tests/resources/generator/robertson_model_1966/model.ode.c @@ -83,7 +83,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic) +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { states[0] = 1.0; states[1] = 0.0; diff --git a/tests/resources/generator/robertson_model_1966/model.ode.h b/tests/resources/generator/robertson_model_1966/model.ode.h index 5d5754056a..85620bec4c 100644 --- a/tests/resources/generator/robertson_model_1966/model.ode.h +++ b/tests/resources/generator/robertson_model_1966/model.ode.h @@ -31,7 +31,7 @@ double * createAlgebraicArray(); void deleteArray(double *array); -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic); +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/robertson_model_1966/model.ode.py b/tests/resources/generator/robertson_model_1966/model.ode.py index ef074678fb..06e02a7840 100644 --- a/tests/resources/generator/robertson_model_1966/model.ode.py +++ b/tests/resources/generator/robertson_model_1966/model.ode.py @@ -50,7 +50,7 @@ def create_algebraic_array(): return [nan]*ALGEBRAIC_COUNT -def initialise_variables(voi, states, rates, constants, algebraic): +def initialise_variables(voi, states, rates, constants, computed_constants, algebraic): states[0] = 1.0 states[1] = 0.0 states[2] = 0.0 diff --git a/tests/resources/generator/sine_model_imports/model.c b/tests/resources/generator/sine_model_imports/model.c index 3d3b671d06..35e0bd5e9d 100644 --- a/tests/resources/generator/sine_model_imports/model.c +++ b/tests/resources/generator/sine_model_imports/model.c @@ -87,7 +87,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic) +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { states[0] = constants[0]; constants[0] = 0.0; diff --git a/tests/resources/generator/sine_model_imports/model.h b/tests/resources/generator/sine_model_imports/model.h index 25b6b8b1e7..e823a94004 100644 --- a/tests/resources/generator/sine_model_imports/model.h +++ b/tests/resources/generator/sine_model_imports/model.h @@ -31,7 +31,7 @@ double * createAlgebraicArray(); void deleteArray(double *array); -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic); +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/sine_model_imports/model.py b/tests/resources/generator/sine_model_imports/model.py index 0204c1bc94..fe54908e70 100644 --- a/tests/resources/generator/sine_model_imports/model.py +++ b/tests/resources/generator/sine_model_imports/model.py @@ -58,7 +58,7 @@ def create_algebraic_array(): return [nan]*ALGEBRAIC_COUNT -def initialise_variables(voi, states, rates, constants, algebraic): +def initialise_variables(voi, states, rates, constants, computed_constants, algebraic): states[0] = constants[0] constants[0] = 0.0 constants[1] = 0.75 diff --git a/tests/resources/generator/unknown_variable_as_external_variable/model.c b/tests/resources/generator/unknown_variable_as_external_variable/model.c index 8b023706c3..4ba572946e 100644 --- a/tests/resources/generator/unknown_variable_as_external_variable/model.c +++ b/tests/resources/generator/unknown_variable_as_external_variable/model.c @@ -84,7 +84,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double *constants, double *algebraic) +void initialiseVariables(double *constants, double *computedConstants, double *algebraic) { constants[0] = 1.1; constants[1] = 21262500.0; diff --git a/tests/resources/generator/unknown_variable_as_external_variable/model.h b/tests/resources/generator/unknown_variable_as_external_variable/model.h index 3e97741459..c4d3c40201 100644 --- a/tests/resources/generator/unknown_variable_as_external_variable/model.h +++ b/tests/resources/generator/unknown_variable_as_external_variable/model.h @@ -32,6 +32,6 @@ void deleteArray(double *array); typedef double (* ExternalVariable)(double *variables, size_t index); -void initialiseVariables(double *constants, double *algebraic); +void initialiseVariables(double *constants, double *computedConstants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeVariables(double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); diff --git a/tests/resources/generator/unknown_variable_as_external_variable/model.py b/tests/resources/generator/unknown_variable_as_external_variable/model.py index 4a8e5e1952..bdd145f68d 100644 --- a/tests/resources/generator/unknown_variable_as_external_variable/model.py +++ b/tests/resources/generator/unknown_variable_as_external_variable/model.py @@ -51,7 +51,7 @@ def create_externals_array(): return [nan]*EXTERNAL_COUNT -def initialise_variables(constants, algebraic): +def initialise_variables(constants, computed_constants, algebraic): constants[0] = 1.1 constants[1] = 21262500.0 constants[2] = 150.0 diff --git a/tests/resources/generator/variable_initialised_using_a_constant/model.c b/tests/resources/generator/variable_initialised_using_a_constant/model.c index 4539a6618b..689d802b56 100644 --- a/tests/resources/generator/variable_initialised_using_a_constant/model.c +++ b/tests/resources/generator/variable_initialised_using_a_constant/model.c @@ -78,7 +78,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic) +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { constants[0] = 7.0; states[0] = constants[0]; diff --git a/tests/resources/generator/variable_initialised_using_a_constant/model.h b/tests/resources/generator/variable_initialised_using_a_constant/model.h index ea32185a4b..ce68264b34 100644 --- a/tests/resources/generator/variable_initialised_using_a_constant/model.h +++ b/tests/resources/generator/variable_initialised_using_a_constant/model.h @@ -31,7 +31,7 @@ double * createAlgebraicArray(); void deleteArray(double *array); -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *algebraic); +void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/variable_initialised_using_a_constant/model.py b/tests/resources/generator/variable_initialised_using_a_constant/model.py index 092c15be25..688fa53037 100644 --- a/tests/resources/generator/variable_initialised_using_a_constant/model.py +++ b/tests/resources/generator/variable_initialised_using_a_constant/model.py @@ -45,7 +45,7 @@ def create_algebraic_array(): return [nan]*ALGEBRAIC_COUNT -def initialise_variables(voi, states, rates, constants, algebraic): +def initialise_variables(voi, states, rates, constants, computed_constants, algebraic): constants[0] = 7.0 states[0] = constants[0] From d1020eb2edb524de086591cb4b5846fcf1dda2fa Mon Sep 17 00:00:00 2001 From: Alan Garny Date: Mon, 19 Aug 2024 15:12:46 +0200 Subject: [PATCH 39/85] GeneratorProfile: don't need to pass the VOI to initialiseVariables(). --- src/generatorprofile.cpp | 6 +++--- src/generatorprofilesha1values.h | 4 ++-- tests/bindings/python/test_generator_profile.py | 4 ++-- tests/generator/generatorprofile.cpp | 4 ++-- tests/resources/coverage/generator/model.c | 2 +- tests/resources/coverage/generator/model.h | 2 +- tests/resources/coverage/generator/model.implementation.out | 2 +- tests/resources/coverage/generator/model.interface.out | 2 +- tests/resources/coverage/generator/model.modified.profile.c | 2 +- tests/resources/coverage/generator/model.modified.profile.h | 2 +- .../resources/coverage/generator/model.modified.profile.py | 2 +- tests/resources/coverage/generator/model.out | 2 +- tests/resources/coverage/generator/model.py | 2 +- .../generator/algebraic_eqn_derivative_on_rhs/model.c | 2 +- .../generator/algebraic_eqn_derivative_on_rhs/model.h | 2 +- .../generator/algebraic_eqn_derivative_on_rhs/model.py | 2 +- .../algebraic_eqn_derivative_on_rhs_one_component/model.c | 2 +- .../algebraic_eqn_derivative_on_rhs_one_component/model.h | 2 +- .../algebraic_eqn_derivative_on_rhs_one_component/model.py | 2 +- .../generator/algebraic_eqn_state_var_on_rhs/model.c | 2 +- .../generator/algebraic_eqn_state_var_on_rhs/model.h | 2 +- .../generator/algebraic_eqn_state_var_on_rhs/model.py | 2 +- .../algebraic_eqn_state_var_on_rhs_one_component/model.c | 2 +- .../algebraic_eqn_state_var_on_rhs_one_component/model.h | 2 +- .../algebraic_eqn_state_var_on_rhs_one_component/model.py | 2 +- .../generator/cellml_mappings_and_encapsulations/model.c | 2 +- .../generator/cellml_mappings_and_encapsulations/model.h | 2 +- .../generator/cellml_mappings_and_encapsulations/model.py | 2 +- .../cellml_state_initialised_using_variable/model.c | 2 +- .../cellml_state_initialised_using_variable/model.h | 2 +- .../cellml_state_initialised_using_variable/model.py | 2 +- tests/resources/generator/cellml_unit_scaling_rate/model.c | 2 +- tests/resources/generator/cellml_unit_scaling_rate/model.h | 2 +- tests/resources/generator/cellml_unit_scaling_rate/model.py | 2 +- tests/resources/generator/cellml_unit_scaling_state/model.c | 2 +- tests/resources/generator/cellml_unit_scaling_state/model.h | 2 +- .../resources/generator/cellml_unit_scaling_state/model.py | 2 +- .../model.c | 2 +- .../model.h | 2 +- .../model.py | 2 +- .../model.c | 2 +- .../model.h | 2 +- .../model.py | 2 +- .../generator/cellml_unit_scaling_voi_direct/model.c | 2 +- .../generator/cellml_unit_scaling_voi_direct/model.h | 2 +- .../generator/cellml_unit_scaling_voi_direct/model.py | 2 +- .../generator/cellml_unit_scaling_voi_indirect/model.c | 2 +- .../generator/cellml_unit_scaling_voi_indirect/model.h | 2 +- .../generator/cellml_unit_scaling_voi_indirect/model.py | 2 +- tests/resources/generator/dae_cellml_1_1_model/model.c | 2 +- tests/resources/generator/dae_cellml_1_1_model/model.h | 2 +- tests/resources/generator/dae_cellml_1_1_model/model.py | 2 +- tests/resources/generator/dependent_eqns/model.c | 2 +- tests/resources/generator/dependent_eqns/model.h | 2 +- tests/resources/generator/dependent_eqns/model.py | 2 +- .../model.c | 2 +- .../model.h | 2 +- .../model.py | 2 +- .../model.c | 2 +- .../model.h | 2 +- .../model.py | 2 +- .../hodgkin_huxley_squid_axon_model_1952/model.algebraic.c | 2 +- .../hodgkin_huxley_squid_axon_model_1952/model.algebraic.h | 2 +- .../hodgkin_huxley_squid_axon_model_1952/model.algebraic.py | 2 +- .../generator/hodgkin_huxley_squid_axon_model_1952/model.c | 2 +- .../model.computed.constant.c | 2 +- .../model.computed.constant.h | 2 +- .../model.computed.constant.py | 2 +- .../hodgkin_huxley_squid_axon_model_1952/model.constant.c | 2 +- .../hodgkin_huxley_squid_axon_model_1952/model.constant.h | 2 +- .../hodgkin_huxley_squid_axon_model_1952/model.constant.py | 2 +- .../hodgkin_huxley_squid_axon_model_1952/model.dae.c | 2 +- .../hodgkin_huxley_squid_axon_model_1952/model.dae.h | 2 +- .../hodgkin_huxley_squid_axon_model_1952/model.dae.py | 2 +- .../model.dependent.algebraic.c | 2 +- .../model.dependent.algebraic.h | 2 +- .../model.dependent.algebraic.py | 2 +- .../model.dependent.computed.constant.c | 2 +- .../model.dependent.computed.constant.h | 2 +- .../model.dependent.computed.constant.py | 2 +- .../model.dependent.constant.c | 2 +- .../model.dependent.constant.h | 2 +- .../model.dependent.constant.py | 2 +- .../model.dependent.state.c | 2 +- .../model.dependent.state.h | 2 +- .../model.dependent.state.py | 2 +- .../hodgkin_huxley_squid_axon_model_1952/model.external.c | 2 +- .../hodgkin_huxley_squid_axon_model_1952/model.external.h | 2 +- .../hodgkin_huxley_squid_axon_model_1952/model.external.py | 2 +- .../generator/hodgkin_huxley_squid_axon_model_1952/model.h | 2 +- .../generator/hodgkin_huxley_squid_axon_model_1952/model.py | 2 +- .../hodgkin_huxley_squid_axon_model_1952/model.state.c | 2 +- .../hodgkin_huxley_squid_axon_model_1952/model.state.h | 2 +- .../hodgkin_huxley_squid_axon_model_1952/model.state.py | 2 +- tests/resources/generator/noble_model_1962/model.c | 2 +- tests/resources/generator/noble_model_1962/model.h | 2 +- tests/resources/generator/noble_model_1962/model.py | 2 +- tests/resources/generator/ode_computed_var_on_rhs/model.c | 2 +- tests/resources/generator/ode_computed_var_on_rhs/model.h | 2 +- tests/resources/generator/ode_computed_var_on_rhs/model.py | 2 +- .../generator/ode_computed_var_on_rhs_one_component/model.c | 2 +- .../generator/ode_computed_var_on_rhs_one_component/model.h | 2 +- .../ode_computed_var_on_rhs_one_component/model.py | 2 +- tests/resources/generator/ode_const_var_on_rhs/model.c | 2 +- tests/resources/generator/ode_const_var_on_rhs/model.h | 2 +- tests/resources/generator/ode_const_var_on_rhs/model.py | 2 +- .../generator/ode_const_var_on_rhs_one_component/model.c | 2 +- .../generator/ode_const_var_on_rhs_one_component/model.h | 2 +- .../generator/ode_const_var_on_rhs_one_component/model.py | 2 +- tests/resources/generator/ode_constant_on_rhs/model.c | 2 +- tests/resources/generator/ode_constant_on_rhs/model.h | 2 +- tests/resources/generator/ode_constant_on_rhs/model.py | 2 +- .../generator/ode_constant_on_rhs_one_component/model.c | 2 +- .../generator/ode_constant_on_rhs_one_component/model.h | 2 +- .../generator/ode_constant_on_rhs_one_component/model.py | 2 +- .../resources/generator/ode_multiple_dependent_odes/model.c | 2 +- .../resources/generator/ode_multiple_dependent_odes/model.h | 2 +- .../generator/ode_multiple_dependent_odes/model.py | 2 +- .../ode_multiple_dependent_odes_one_component/model.c | 2 +- .../ode_multiple_dependent_odes_one_component/model.h | 2 +- .../ode_multiple_dependent_odes_one_component/model.py | 2 +- .../generator/ode_multiple_odes_with_same_name/model.c | 2 +- .../generator/ode_multiple_odes_with_same_name/model.h | 2 +- .../generator/ode_multiple_odes_with_same_name/model.py | 2 +- tests/resources/generator/ode_unknown_var_on_rhs/model.c | 2 +- tests/resources/generator/ode_unknown_var_on_rhs/model.h | 2 +- tests/resources/generator/ode_unknown_var_on_rhs/model.py | 2 +- tests/resources/generator/robertson_model_1966/model.dae.c | 2 +- tests/resources/generator/robertson_model_1966/model.dae.h | 2 +- tests/resources/generator/robertson_model_1966/model.dae.py | 2 +- tests/resources/generator/robertson_model_1966/model.ode.c | 2 +- tests/resources/generator/robertson_model_1966/model.ode.h | 2 +- tests/resources/generator/robertson_model_1966/model.ode.py | 2 +- tests/resources/generator/sine_model_imports/model.c | 2 +- tests/resources/generator/sine_model_imports/model.h | 2 +- tests/resources/generator/sine_model_imports/model.py | 2 +- .../generator/variable_initialised_using_a_constant/model.c | 2 +- .../generator/variable_initialised_using_a_constant/model.h | 2 +- .../variable_initialised_using_a_constant/model.py | 2 +- 139 files changed, 144 insertions(+), 144 deletions(-) diff --git a/src/generatorprofile.cpp b/src/generatorprofile.cpp index 0179deb7f4..c45912ed4a 100644 --- a/src/generatorprofile.cpp +++ b/src/generatorprofile.cpp @@ -415,8 +415,8 @@ void GeneratorProfile::GeneratorProfileImpl::loadProfile(GeneratorProfile::Profi "[CODE]" "}\n"; - mInterfaceInitialiseVariablesMethodFdmString = "void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic);\n"; - mImplementationInitialiseVariablesMethodFdmString = "void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic)\n" + mInterfaceInitialiseVariablesMethodFdmString = "void initialiseVariables(double *states, double *rates, double *constants, double *computedConstants, double *algebraic);\n"; + mImplementationInitialiseVariablesMethodFdmString = "void initialiseVariables(double *states, double *rates, double *constants, double *computedConstants, double *algebraic)\n" "{\n" "[CODE]" "}\n"; @@ -807,7 +807,7 @@ void GeneratorProfile::GeneratorProfileImpl::loadProfile(GeneratorProfile::Profi mInterfaceInitialiseVariablesMethodFdmString = ""; mImplementationInitialiseVariablesMethodFdmString = "\n" - "def initialise_variables(voi, states, rates, constants, computed_constants, algebraic):\n" + "def initialise_variables(states, rates, constants, computed_constants, algebraic):\n" "[CODE]"; mInterfaceComputeComputedConstantsMethodString = ""; diff --git a/src/generatorprofilesha1values.h b/src/generatorprofilesha1values.h index a208a59869..c7400228e8 100644 --- a/src/generatorprofilesha1values.h +++ b/src/generatorprofilesha1values.h @@ -24,7 +24,7 @@ namespace libcellml { * The content of this file is generated, do not edit this file directly. * See docs/dev_utilities.rst for further information. */ -static const char C_GENERATOR_PROFILE_SHA1[] = "22b2ada38f83adad3e70dd776ef9d72c7c1a966f"; -static const char PYTHON_GENERATOR_PROFILE_SHA1[] = "405499117ed4245fbee40c3d18303ee748e3a1a2"; +static const char C_GENERATOR_PROFILE_SHA1[] = "e5477b943b378914f730fdbf8c415e662d8950e2"; +static const char PYTHON_GENERATOR_PROFILE_SHA1[] = "f0acab1cd54d81a14aaee315aeb7dd69ac4c7ffb"; } // namespace libcellml diff --git a/tests/bindings/python/test_generator_profile.py b/tests/bindings/python/test_generator_profile.py index fad40298bb..22f653cbbc 100644 --- a/tests/bindings/python/test_generator_profile.py +++ b/tests/bindings/python/test_generator_profile.py @@ -843,7 +843,7 @@ def test_implementation_initialise_constants_method_string(self): g.setImplementationInitialiseVariablesMethodString(False, GeneratorProfileTestCase.VALUE) self.assertEqual(GeneratorProfileTestCase.VALUE, g.implementationInitialiseVariablesMethodString(False)) - self.assertEqual('void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic)\n{\n[CODE]}\n', + self.assertEqual('void initialiseVariables(double *states, double *rates, double *constants, double *computedConstants, double *algebraic)\n{\n[CODE]}\n', g.implementationInitialiseVariablesMethodString(True)) g.setImplementationInitialiseVariablesMethodString(True, GeneratorProfileTestCase.VALUE) self.assertEqual(GeneratorProfileTestCase.VALUE, g.implementationInitialiseVariablesMethodString(True)) @@ -1122,7 +1122,7 @@ def test_interface_initialise_constants_method_string(self): g.setInterfaceInitialiseVariablesMethodString(False, GeneratorProfileTestCase.VALUE) self.assertEqual(GeneratorProfileTestCase.VALUE, g.interfaceInitialiseVariablesMethodString(False)) - self.assertEqual('void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic);\n', + self.assertEqual('void initialiseVariables(double *states, double *rates, double *constants, double *computedConstants, double *algebraic);\n', g.interfaceInitialiseVariablesMethodString(True)) g.setInterfaceInitialiseVariablesMethodString(True, GeneratorProfileTestCase.VALUE) self.assertEqual(GeneratorProfileTestCase.VALUE, g.interfaceInitialiseVariablesMethodString(True)) diff --git a/tests/generator/generatorprofile.cpp b/tests/generator/generatorprofile.cpp index ab038a2634..50e26d775f 100644 --- a/tests/generator/generatorprofile.cpp +++ b/tests/generator/generatorprofile.cpp @@ -494,9 +494,9 @@ TEST(GeneratorProfile, defaultMiscellaneousValues) "}\n", generatorProfile->implementationInitialiseVariablesMethodString(false)); - EXPECT_EQ("void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic);\n", + EXPECT_EQ("void initialiseVariables(double *states, double *rates, double *constants, double *computedConstants, double *algebraic);\n", generatorProfile->interfaceInitialiseVariablesMethodString(true)); - EXPECT_EQ("void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic)\n" + EXPECT_EQ("void initialiseVariables(double *states, double *rates, double *constants, double *computedConstants, double *algebraic)\n" "{\n" "[CODE]" "}\n", diff --git a/tests/resources/coverage/generator/model.c b/tests/resources/coverage/generator/model.c index 8b52167d66..0b2f0b53f8 100644 --- a/tests/resources/coverage/generator/model.c +++ b/tests/resources/coverage/generator/model.c @@ -405,7 +405,7 @@ void findRoot0(double voi, double *states, double *rates, double *variables) algebraic[1] = u[1]; } -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) +void initialiseVariables(double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { states[0] = 0.0; constants[0] = 1.0; diff --git a/tests/resources/coverage/generator/model.h b/tests/resources/coverage/generator/model.h index c22174b701..8f8822482d 100644 --- a/tests/resources/coverage/generator/model.h +++ b/tests/resources/coverage/generator/model.h @@ -31,7 +31,7 @@ double * createAlgebraicArray(); void deleteArray(double *array); -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); +void initialiseVariables(double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/coverage/generator/model.implementation.out b/tests/resources/coverage/generator/model.implementation.out index 6a38edeafd..441505f7cd 100644 --- a/tests/resources/coverage/generator/model.implementation.out +++ b/tests/resources/coverage/generator/model.implementation.out @@ -168,7 +168,7 @@ void findRoot0(double voi, double *states, double *rates, double *variables) algebraic[1] = u[1]; } -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) +void initialiseVariables(double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { states[0] = 0.0; constants[0] = 1.0; diff --git a/tests/resources/coverage/generator/model.interface.out b/tests/resources/coverage/generator/model.interface.out index a444951dc6..a5fb080356 100644 --- a/tests/resources/coverage/generator/model.interface.out +++ b/tests/resources/coverage/generator/model.interface.out @@ -11,7 +11,7 @@ double * createAlgebraicArray(); void deleteArray(double *array); -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); +void initialiseVariables(double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/coverage/generator/model.modified.profile.c b/tests/resources/coverage/generator/model.modified.profile.c index 5653c51ae6..07afcc6afc 100644 --- a/tests/resources/coverage/generator/model.modified.profile.c +++ b/tests/resources/coverage/generator/model.modified.profile.c @@ -405,7 +405,7 @@ void findRoot0(double voi, double *states, double *rates, double *variables) algebraic[1] = u[1]; } -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) +void initialiseVariables(double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { states[0] = 0.0; constants[0] = 1.0; diff --git a/tests/resources/coverage/generator/model.modified.profile.h b/tests/resources/coverage/generator/model.modified.profile.h index 6cc99016d4..df9429751a 100644 --- a/tests/resources/coverage/generator/model.modified.profile.h +++ b/tests/resources/coverage/generator/model.modified.profile.h @@ -31,7 +31,7 @@ double * createAlgebraicArray(); void deleteArray(double *array); -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); +void initialiseVariables(double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/coverage/generator/model.modified.profile.py b/tests/resources/coverage/generator/model.modified.profile.py index 89ec8121c4..886bbb8b7e 100644 --- a/tests/resources/coverage/generator/model.modified.profile.py +++ b/tests/resources/coverage/generator/model.modified.profile.py @@ -383,7 +383,7 @@ def find_root_0(voi, states, rates, variables): algebraic[1] = u[1] -def initialise_variables(voi, states, rates, constants, computed_constants, algebraic): +def initialise_variables(states, rates, constants, computed_constants, algebraic): states[0] = 0.0 constants[0] = 1.0 constants[1] = 2.0 diff --git a/tests/resources/coverage/generator/model.out b/tests/resources/coverage/generator/model.out index 514bac2e1c..3a2b4ea517 100644 --- a/tests/resources/coverage/generator/model.out +++ b/tests/resources/coverage/generator/model.out @@ -116,7 +116,7 @@ void findRoot0(double voi, double *states, double *rates, double *variables) algebraic[1] = u[1]; } -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) +void initialiseVariables(double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { states[0] = 0.0; constants[0] = 1.0; diff --git a/tests/resources/coverage/generator/model.py b/tests/resources/coverage/generator/model.py index a211b39e5f..113504cbe3 100644 --- a/tests/resources/coverage/generator/model.py +++ b/tests/resources/coverage/generator/model.py @@ -383,7 +383,7 @@ def find_root_0(voi, states, rates, variables): algebraic[1] = u[1] -def initialise_variables(voi, states, rates, constants, computed_constants, algebraic): +def initialise_variables(states, rates, constants, computed_constants, algebraic): states[0] = 0.0 constants[0] = 1.0 constants[1] = 2.0 diff --git a/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.c b/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.c index 9c2f823f6b..cd2b071d02 100644 --- a/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.c +++ b/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.c @@ -79,7 +79,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) +void initialiseVariables(double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { states[0] = 1.0; computedConstants[0] = 1.0; diff --git a/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.h b/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.h index c50e027fca..f343bb87e3 100644 --- a/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.h +++ b/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.h @@ -31,7 +31,7 @@ double * createAlgebraicArray(); void deleteArray(double *array); -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); +void initialiseVariables(double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.py b/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.py index 3f7bc95174..362c69198a 100644 --- a/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.py +++ b/tests/resources/generator/algebraic_eqn_derivative_on_rhs/model.py @@ -46,7 +46,7 @@ def create_algebraic_array(): return [nan]*ALGEBRAIC_COUNT -def initialise_variables(voi, states, rates, constants, computed_constants, algebraic): +def initialise_variables(states, rates, constants, computed_constants, algebraic): states[0] = 1.0 computed_constants[0] = 1.0 diff --git a/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.c b/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.c index 8c72b66ab3..7f718e1cb9 100644 --- a/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.c +++ b/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.c @@ -79,7 +79,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) +void initialiseVariables(double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { states[0] = 1.0; computedConstants[0] = 1.0; diff --git a/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.h b/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.h index 7672524c38..3f2f4d80ff 100644 --- a/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.h +++ b/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.h @@ -31,7 +31,7 @@ double * createAlgebraicArray(); void deleteArray(double *array); -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); +void initialiseVariables(double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.py b/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.py index 598b58e854..f777d6ad3a 100644 --- a/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.py +++ b/tests/resources/generator/algebraic_eqn_derivative_on_rhs_one_component/model.py @@ -46,7 +46,7 @@ def create_algebraic_array(): return [nan]*ALGEBRAIC_COUNT -def initialise_variables(voi, states, rates, constants, computed_constants, algebraic): +def initialise_variables(states, rates, constants, computed_constants, algebraic): states[0] = 1.0 computed_constants[0] = 1.0 diff --git a/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.c b/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.c index 3131bc653b..d532f16d2e 100644 --- a/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.c +++ b/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.c @@ -79,7 +79,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) +void initialiseVariables(double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { states[0] = 1.0; computedConstants[0] = 1.0; diff --git a/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.h b/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.h index 981651ccd1..7ac3ea8123 100644 --- a/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.h +++ b/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.h @@ -31,7 +31,7 @@ double * createAlgebraicArray(); void deleteArray(double *array); -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); +void initialiseVariables(double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.py b/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.py index c655ba4613..324e320b2c 100644 --- a/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.py +++ b/tests/resources/generator/algebraic_eqn_state_var_on_rhs/model.py @@ -46,7 +46,7 @@ def create_algebraic_array(): return [nan]*ALGEBRAIC_COUNT -def initialise_variables(voi, states, rates, constants, computed_constants, algebraic): +def initialise_variables(states, rates, constants, computed_constants, algebraic): states[0] = 1.0 computed_constants[0] = 1.0 diff --git a/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.c b/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.c index 02014ef239..6c2e35bcbb 100644 --- a/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.c +++ b/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.c @@ -79,7 +79,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) +void initialiseVariables(double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { states[0] = 1.0; computedConstants[0] = 1.0; diff --git a/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.h b/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.h index 46e07c2ddf..774c116634 100644 --- a/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.h +++ b/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.h @@ -31,7 +31,7 @@ double * createAlgebraicArray(); void deleteArray(double *array); -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); +void initialiseVariables(double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.py b/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.py index 013484ceec..b787f96f7c 100644 --- a/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.py +++ b/tests/resources/generator/algebraic_eqn_state_var_on_rhs_one_component/model.py @@ -46,7 +46,7 @@ def create_algebraic_array(): return [nan]*ALGEBRAIC_COUNT -def initialise_variables(voi, states, rates, constants, computed_constants, algebraic): +def initialise_variables(states, rates, constants, computed_constants, algebraic): states[0] = 1.0 computed_constants[0] = 1.0 diff --git a/tests/resources/generator/cellml_mappings_and_encapsulations/model.c b/tests/resources/generator/cellml_mappings_and_encapsulations/model.c index dfeedb00f4..cc55be1bfe 100644 --- a/tests/resources/generator/cellml_mappings_and_encapsulations/model.c +++ b/tests/resources/generator/cellml_mappings_and_encapsulations/model.c @@ -80,7 +80,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) +void initialiseVariables(double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { states[0] = 1.0; states[1] = 0.0; diff --git a/tests/resources/generator/cellml_mappings_and_encapsulations/model.h b/tests/resources/generator/cellml_mappings_and_encapsulations/model.h index d668e10ba8..6841a14e85 100644 --- a/tests/resources/generator/cellml_mappings_and_encapsulations/model.h +++ b/tests/resources/generator/cellml_mappings_and_encapsulations/model.h @@ -31,7 +31,7 @@ double * createAlgebraicArray(); void deleteArray(double *array); -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); +void initialiseVariables(double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/cellml_mappings_and_encapsulations/model.py b/tests/resources/generator/cellml_mappings_and_encapsulations/model.py index cde62f28c3..525f3fbaf9 100644 --- a/tests/resources/generator/cellml_mappings_and_encapsulations/model.py +++ b/tests/resources/generator/cellml_mappings_and_encapsulations/model.py @@ -47,7 +47,7 @@ def create_algebraic_array(): return [nan]*ALGEBRAIC_COUNT -def initialise_variables(voi, states, rates, constants, computed_constants, algebraic): +def initialise_variables(states, rates, constants, computed_constants, algebraic): states[0] = 1.0 states[1] = 0.0 diff --git a/tests/resources/generator/cellml_state_initialised_using_variable/model.c b/tests/resources/generator/cellml_state_initialised_using_variable/model.c index ac395dd3bb..843885850a 100644 --- a/tests/resources/generator/cellml_state_initialised_using_variable/model.c +++ b/tests/resources/generator/cellml_state_initialised_using_variable/model.c @@ -78,7 +78,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) +void initialiseVariables(double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { constants[0] = 123.0; states[0] = constants[0]; diff --git a/tests/resources/generator/cellml_state_initialised_using_variable/model.h b/tests/resources/generator/cellml_state_initialised_using_variable/model.h index 125d289e64..226dd4b8f1 100644 --- a/tests/resources/generator/cellml_state_initialised_using_variable/model.h +++ b/tests/resources/generator/cellml_state_initialised_using_variable/model.h @@ -31,7 +31,7 @@ double * createAlgebraicArray(); void deleteArray(double *array); -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); +void initialiseVariables(double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/cellml_state_initialised_using_variable/model.py b/tests/resources/generator/cellml_state_initialised_using_variable/model.py index f2e9eb5259..7250839ba3 100644 --- a/tests/resources/generator/cellml_state_initialised_using_variable/model.py +++ b/tests/resources/generator/cellml_state_initialised_using_variable/model.py @@ -45,7 +45,7 @@ def create_algebraic_array(): return [nan]*ALGEBRAIC_COUNT -def initialise_variables(voi, states, rates, constants, computed_constants, algebraic): +def initialise_variables(states, rates, constants, computed_constants, algebraic): constants[0] = 123.0 states[0] = constants[0] diff --git a/tests/resources/generator/cellml_unit_scaling_rate/model.c b/tests/resources/generator/cellml_unit_scaling_rate/model.c index 604d08c5fd..015e96a455 100644 --- a/tests/resources/generator/cellml_unit_scaling_rate/model.c +++ b/tests/resources/generator/cellml_unit_scaling_rate/model.c @@ -79,7 +79,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) +void initialiseVariables(double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { states[0] = 123.0; } diff --git a/tests/resources/generator/cellml_unit_scaling_rate/model.h b/tests/resources/generator/cellml_unit_scaling_rate/model.h index 125d289e64..226dd4b8f1 100644 --- a/tests/resources/generator/cellml_unit_scaling_rate/model.h +++ b/tests/resources/generator/cellml_unit_scaling_rate/model.h @@ -31,7 +31,7 @@ double * createAlgebraicArray(); void deleteArray(double *array); -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); +void initialiseVariables(double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/cellml_unit_scaling_rate/model.py b/tests/resources/generator/cellml_unit_scaling_rate/model.py index 45678f11d5..7f580b8b9e 100644 --- a/tests/resources/generator/cellml_unit_scaling_rate/model.py +++ b/tests/resources/generator/cellml_unit_scaling_rate/model.py @@ -46,7 +46,7 @@ def create_algebraic_array(): return [nan]*ALGEBRAIC_COUNT -def initialise_variables(voi, states, rates, constants, computed_constants, algebraic): +def initialise_variables(states, rates, constants, computed_constants, algebraic): states[0] = 123.0 diff --git a/tests/resources/generator/cellml_unit_scaling_state/model.c b/tests/resources/generator/cellml_unit_scaling_state/model.c index ac805fa9e2..e124b3ff5c 100644 --- a/tests/resources/generator/cellml_unit_scaling_state/model.c +++ b/tests/resources/generator/cellml_unit_scaling_state/model.c @@ -79,7 +79,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) +void initialiseVariables(double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { states[0] = 123.0; } diff --git a/tests/resources/generator/cellml_unit_scaling_state/model.h b/tests/resources/generator/cellml_unit_scaling_state/model.h index 125d289e64..226dd4b8f1 100644 --- a/tests/resources/generator/cellml_unit_scaling_state/model.h +++ b/tests/resources/generator/cellml_unit_scaling_state/model.h @@ -31,7 +31,7 @@ double * createAlgebraicArray(); void deleteArray(double *array); -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); +void initialiseVariables(double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/cellml_unit_scaling_state/model.py b/tests/resources/generator/cellml_unit_scaling_state/model.py index d88e7699c5..00e8898178 100644 --- a/tests/resources/generator/cellml_unit_scaling_state/model.py +++ b/tests/resources/generator/cellml_unit_scaling_state/model.py @@ -46,7 +46,7 @@ def create_algebraic_array(): return [nan]*ALGEBRAIC_COUNT -def initialise_variables(voi, states, rates, constants, computed_constants, algebraic): +def initialise_variables(states, rates, constants, computed_constants, algebraic): states[0] = 123.0 diff --git a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.c b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.c index 5e7d345e2d..3fe07aefc9 100644 --- a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.c +++ b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.c @@ -78,7 +78,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) +void initialiseVariables(double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { states[0] = 123.0; states[1] = 0.001*789.0; diff --git a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.h b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.h index ca1a66c12b..9b6ba7ee8c 100644 --- a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.h +++ b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.h @@ -31,7 +31,7 @@ double * createAlgebraicArray(); void deleteArray(double *array); -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); +void initialiseVariables(double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.py b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.py index 4bf6281a0a..748208e285 100644 --- a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.py +++ b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_constant/model.py @@ -45,7 +45,7 @@ def create_algebraic_array(): return [nan]*ALGEBRAIC_COUNT -def initialise_variables(voi, states, rates, constants, computed_constants, algebraic): +def initialise_variables(states, rates, constants, computed_constants, algebraic): states[0] = 123.0 states[1] = 0.001*789.0 diff --git a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.c b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.c index d7e12ef11e..90ad419ec5 100644 --- a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.c +++ b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.c @@ -80,7 +80,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) +void initialiseVariables(double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { constants[0] = 123.0; states[0] = constants[0]; diff --git a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.h b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.h index 7f150918f4..ec39035304 100644 --- a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.h +++ b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.h @@ -31,7 +31,7 @@ double * createAlgebraicArray(); void deleteArray(double *array); -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); +void initialiseVariables(double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.py b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.py index 648e230131..22c48a1c4d 100644 --- a/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.py +++ b/tests/resources/generator/cellml_unit_scaling_state_initialised_using_variable/model.py @@ -47,7 +47,7 @@ def create_algebraic_array(): return [nan]*ALGEBRAIC_COUNT -def initialise_variables(voi, states, rates, constants, computed_constants, algebraic): +def initialise_variables(states, rates, constants, computed_constants, algebraic): constants[0] = 123.0 states[0] = constants[0] constants[1] = 789.0 diff --git a/tests/resources/generator/cellml_unit_scaling_voi_direct/model.c b/tests/resources/generator/cellml_unit_scaling_voi_direct/model.c index 630608791e..ef1f82a587 100644 --- a/tests/resources/generator/cellml_unit_scaling_voi_direct/model.c +++ b/tests/resources/generator/cellml_unit_scaling_voi_direct/model.c @@ -78,7 +78,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) +void initialiseVariables(double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { states[0] = 3.0; states[1] = 5.0; diff --git a/tests/resources/generator/cellml_unit_scaling_voi_direct/model.h b/tests/resources/generator/cellml_unit_scaling_voi_direct/model.h index a415fa4aed..c269dcfadf 100644 --- a/tests/resources/generator/cellml_unit_scaling_voi_direct/model.h +++ b/tests/resources/generator/cellml_unit_scaling_voi_direct/model.h @@ -31,7 +31,7 @@ double * createAlgebraicArray(); void deleteArray(double *array); -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); +void initialiseVariables(double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/cellml_unit_scaling_voi_direct/model.py b/tests/resources/generator/cellml_unit_scaling_voi_direct/model.py index fa2831f8f8..84696dfa18 100644 --- a/tests/resources/generator/cellml_unit_scaling_voi_direct/model.py +++ b/tests/resources/generator/cellml_unit_scaling_voi_direct/model.py @@ -45,7 +45,7 @@ def create_algebraic_array(): return [nan]*ALGEBRAIC_COUNT -def initialise_variables(voi, states, rates, constants, computed_constants, algebraic): +def initialise_variables(states, rates, constants, computed_constants, algebraic): states[0] = 3.0 states[1] = 5.0 diff --git a/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.c b/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.c index 4d5382792f..944482def1 100644 --- a/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.c +++ b/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.c @@ -79,7 +79,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) +void initialiseVariables(double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { states[0] = 3.0; states[1] = 7.0; diff --git a/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.h b/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.h index 68f3a5146d..30f79b5a29 100644 --- a/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.h +++ b/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.h @@ -31,7 +31,7 @@ double * createAlgebraicArray(); void deleteArray(double *array); -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); +void initialiseVariables(double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.py b/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.py index 824dc3e08c..0fb6f11aba 100644 --- a/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.py +++ b/tests/resources/generator/cellml_unit_scaling_voi_indirect/model.py @@ -46,7 +46,7 @@ def create_algebraic_array(): return [nan]*ALGEBRAIC_COUNT -def initialise_variables(voi, states, rates, constants, computed_constants, algebraic): +def initialise_variables(states, rates, constants, computed_constants, algebraic): states[0] = 3.0 states[1] = 7.0 states[2] = 11.0 diff --git a/tests/resources/generator/dae_cellml_1_1_model/model.c b/tests/resources/generator/dae_cellml_1_1_model/model.c index fbf6e9c031..6b0819a99f 100644 --- a/tests/resources/generator/dae_cellml_1_1_model/model.c +++ b/tests/resources/generator/dae_cellml_1_1_model/model.c @@ -146,7 +146,7 @@ void findRoot1(double voi, double *states, double *rates, double *variables) algebraic[4] = u[0]; } -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) +void initialiseVariables(double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { states[0] = 1.0; states[1] = 0.0; diff --git a/tests/resources/generator/dae_cellml_1_1_model/model.h b/tests/resources/generator/dae_cellml_1_1_model/model.h index 4aeac109db..ad06e8560d 100644 --- a/tests/resources/generator/dae_cellml_1_1_model/model.h +++ b/tests/resources/generator/dae_cellml_1_1_model/model.h @@ -31,7 +31,7 @@ double * createAlgebraicArray(); void deleteArray(double *array); -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); +void initialiseVariables(double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/dae_cellml_1_1_model/model.py b/tests/resources/generator/dae_cellml_1_1_model/model.py index 55f5a61539..ef14cb9e3d 100644 --- a/tests/resources/generator/dae_cellml_1_1_model/model.py +++ b/tests/resources/generator/dae_cellml_1_1_model/model.py @@ -100,7 +100,7 @@ def find_root_1(voi, states, rates, variables): algebraic[4] = u[0] -def initialise_variables(voi, states, rates, constants, computed_constants, algebraic): +def initialise_variables(states, rates, constants, computed_constants, algebraic): states[0] = 1.0 states[1] = 0.0 constants[0] = 1.0 diff --git a/tests/resources/generator/dependent_eqns/model.c b/tests/resources/generator/dependent_eqns/model.c index dfad97fc7a..e646340a22 100644 --- a/tests/resources/generator/dependent_eqns/model.c +++ b/tests/resources/generator/dependent_eqns/model.c @@ -79,7 +79,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) +void initialiseVariables(double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { states[0] = 0.0; } diff --git a/tests/resources/generator/dependent_eqns/model.h b/tests/resources/generator/dependent_eqns/model.h index 574fe07d5c..ab8b197239 100644 --- a/tests/resources/generator/dependent_eqns/model.h +++ b/tests/resources/generator/dependent_eqns/model.h @@ -31,7 +31,7 @@ double * createAlgebraicArray(); void deleteArray(double *array); -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); +void initialiseVariables(double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/dependent_eqns/model.py b/tests/resources/generator/dependent_eqns/model.py index 3d9a8c2026..13aa1f7852 100644 --- a/tests/resources/generator/dependent_eqns/model.py +++ b/tests/resources/generator/dependent_eqns/model.py @@ -46,7 +46,7 @@ def create_algebraic_array(): return [nan]*ALGEBRAIC_COUNT -def initialise_variables(voi, states, rates, constants, computed_constants, algebraic): +def initialise_variables(states, rates, constants, computed_constants, algebraic): states[0] = 0.0 diff --git a/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.c b/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.c index 045b53af6a..1a000b924b 100644 --- a/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.c +++ b/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.c @@ -326,7 +326,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) +void initialiseVariables(double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { states[0] = 6.226104e-5; states[1] = 5.0; diff --git a/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.h b/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.h index 3ff58c68f4..7f6f6b5424 100644 --- a/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.h +++ b/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.h @@ -31,7 +31,7 @@ double * createAlgebraicArray(); void deleteArray(double *array); -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); +void initialiseVariables(double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.py b/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.py index cd7801ddc4..eab12072bb 100644 --- a/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.py +++ b/tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.py @@ -313,7 +313,7 @@ def create_algebraic_array(): return [nan]*ALGEBRAIC_COUNT -def initialise_variables(voi, states, rates, constants, computed_constants, algebraic): +def initialise_variables(states, rates, constants, computed_constants, algebraic): states[0] = 6.226104e-5 states[1] = 5.0 states[2] = 0.409551 diff --git a/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.c b/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.c index ad882a9ebb..1251fc5113 100644 --- a/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.c +++ b/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.c @@ -276,7 +276,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) +void initialiseVariables(double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { states[0] = -39.013558536; states[1] = 0.092361701692; diff --git a/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.h b/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.h index 7160a3fb12..eed1a4a76e 100644 --- a/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.h +++ b/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.h @@ -31,7 +31,7 @@ double * createAlgebraicArray(); void deleteArray(double *array); -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); +void initialiseVariables(double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.py b/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.py index 9a0e9212ef..15377776c3 100644 --- a/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.py +++ b/tests/resources/generator/garny_kohl_hunter_boyett_noble_rabbit_san_model_2003/model.py @@ -251,7 +251,7 @@ def create_algebraic_array(): return [nan]*ALGEBRAIC_COUNT -def initialise_variables(voi, states, rates, constants, computed_constants, algebraic): +def initialise_variables(states, rates, constants, computed_constants, algebraic): states[0] = -39.013558536 states[1] = 0.092361701692 states[2] = 0.015905380261 diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.c index 55490ad4c0..3a449edd19 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.c @@ -113,7 +113,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) +void initialiseVariables(double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { states[0] = 0.0; states[1] = 0.6; diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.h index d86b4881ec..1ba9603ccd 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.h +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.h @@ -36,7 +36,7 @@ void deleteArray(double *array); typedef double (* ExternalVariable)(double voi, double *states, double *rates, double *variables, size_t index); -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); +void initialiseVariables(double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.py index a444417b16..7e9218d84a 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.py @@ -85,7 +85,7 @@ def create_externals_array(): return [nan]*EXTERNAL_COUNT -def initialise_variables(voi, states, rates, constants, computed_constants, algebraic): +def initialise_variables(states, rates, constants, computed_constants, algebraic): states[0] = 0.0 states[1] = 0.6 states[2] = 0.05 diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.c index 9ea08e1592..40a4e34310 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.c @@ -98,7 +98,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) +void initialiseVariables(double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { states[0] = 0.0; states[1] = 0.6; diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.c index 8709c5445b..abf11523e1 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.c @@ -113,7 +113,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) +void initialiseVariables(double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { states[0] = 0.0; states[1] = 0.6; diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.h index d86b4881ec..1ba9603ccd 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.h +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.h @@ -36,7 +36,7 @@ void deleteArray(double *array); typedef double (* ExternalVariable)(double voi, double *states, double *rates, double *variables, size_t index); -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); +void initialiseVariables(double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.py index 02f9149f91..66a555dfb8 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.py @@ -85,7 +85,7 @@ def create_externals_array(): return [nan]*EXTERNAL_COUNT -def initialise_variables(voi, states, rates, constants, computed_constants, algebraic): +def initialise_variables(states, rates, constants, computed_constants, algebraic): states[0] = 0.0 states[1] = 0.6 states[2] = 0.05 diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.c index a67ad82735..0b61cfd4b4 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.c @@ -113,7 +113,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) +void initialiseVariables(double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { states[0] = 0.0; states[1] = 0.6; diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.h index d86b4881ec..1ba9603ccd 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.h +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.h @@ -36,7 +36,7 @@ void deleteArray(double *array); typedef double (* ExternalVariable)(double voi, double *states, double *rates, double *variables, size_t index); -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); +void initialiseVariables(double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.py index cd644acd07..30ac1e4787 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.py @@ -85,7 +85,7 @@ def create_externals_array(): return [nan]*EXTERNAL_COUNT -def initialise_variables(voi, states, rates, constants, computed_constants, algebraic): +def initialise_variables(states, rates, constants, computed_constants, algebraic): states[0] = 0.0 states[1] = 0.6 states[2] = 0.05 diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.c index 0b1b5ec76f..a940fe5cf3 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.c @@ -516,7 +516,7 @@ void findRoot16(double voi, double *states, double *rates, double *variables) rates[3] = u[0]; } -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) +void initialiseVariables(double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { states[0] = 0.0; states[1] = 0.6; diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.h index bb8c14e65a..1edf0a208b 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.h +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.h @@ -31,7 +31,7 @@ double * createAlgebraicArray(); void deleteArray(double *array); -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); +void initialiseVariables(double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.py index 82e45add94..9d57d7855a 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.py @@ -437,7 +437,7 @@ def find_root_16(voi, states, rates, variables): rates[3] = u[0] -def initialise_variables(voi, states, rates, constants, computed_constants, algebraic): +def initialise_variables(states, rates, constants, computed_constants, algebraic): states[0] = 0.0 states[1] = 0.6 states[2] = 0.05 diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.c index 29251ba2f4..174c5d1c5b 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.c @@ -113,7 +113,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) +void initialiseVariables(double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { states[0] = 0.0; states[1] = 0.6; diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.h index d86b4881ec..1ba9603ccd 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.h +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.h @@ -36,7 +36,7 @@ void deleteArray(double *array); typedef double (* ExternalVariable)(double voi, double *states, double *rates, double *variables, size_t index); -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); +void initialiseVariables(double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.py index 5617153fe5..db89293eb9 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.py @@ -85,7 +85,7 @@ def create_externals_array(): return [nan]*EXTERNAL_COUNT -def initialise_variables(voi, states, rates, constants, computed_constants, algebraic): +def initialise_variables(states, rates, constants, computed_constants, algebraic): states[0] = 0.0 states[1] = 0.6 states[2] = 0.05 diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.c index 3c67e6474b..9e73eb2cb9 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.c @@ -113,7 +113,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) +void initialiseVariables(double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { states[0] = 0.0; states[1] = 0.6; diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.h index d86b4881ec..1ba9603ccd 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.h +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.h @@ -36,7 +36,7 @@ void deleteArray(double *array); typedef double (* ExternalVariable)(double voi, double *states, double *rates, double *variables, size_t index); -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); +void initialiseVariables(double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.py index 03c5b15a3a..42ab91f87a 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.py @@ -85,7 +85,7 @@ def create_externals_array(): return [nan]*EXTERNAL_COUNT -def initialise_variables(voi, states, rates, constants, computed_constants, algebraic): +def initialise_variables(states, rates, constants, computed_constants, algebraic): states[0] = 0.0 states[1] = 0.6 states[2] = 0.05 diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.c index e4646c0553..8c7192206a 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.c @@ -113,7 +113,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) +void initialiseVariables(double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { states[0] = 0.0; states[1] = 0.6; diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.h index d86b4881ec..1ba9603ccd 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.h +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.h @@ -36,7 +36,7 @@ void deleteArray(double *array); typedef double (* ExternalVariable)(double voi, double *states, double *rates, double *variables, size_t index); -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); +void initialiseVariables(double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.py index 522d0795db..88ab261a36 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.py @@ -85,7 +85,7 @@ def create_externals_array(): return [nan]*EXTERNAL_COUNT -def initialise_variables(voi, states, rates, constants, computed_constants, algebraic): +def initialise_variables(states, rates, constants, computed_constants, algebraic): states[0] = 0.0 states[1] = 0.6 states[2] = 0.05 diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.c index bceb90099d..b41fa29b6b 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.c @@ -113,7 +113,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) +void initialiseVariables(double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { states[0] = 0.6; states[1] = 0.325; diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.h index d86b4881ec..1ba9603ccd 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.h +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.h @@ -36,7 +36,7 @@ void deleteArray(double *array); typedef double (* ExternalVariable)(double voi, double *states, double *rates, double *variables, size_t index); -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); +void initialiseVariables(double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.py index d6e3ae27c2..47adbb19b5 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.py @@ -85,7 +85,7 @@ def create_externals_array(): return [nan]*EXTERNAL_COUNT -def initialise_variables(voi, states, rates, constants, computed_constants, algebraic): +def initialise_variables(states, rates, constants, computed_constants, algebraic): states[0] = 0.6 states[1] = 0.325 constants[0] = 1.0 diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.c index 452d243d28..a57d9f0404 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.c @@ -113,7 +113,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) +void initialiseVariables(double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { states[0] = 0.6; states[1] = 0.05; diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.h index d86b4881ec..1ba9603ccd 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.h +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.h @@ -36,7 +36,7 @@ void deleteArray(double *array); typedef double (* ExternalVariable)(double voi, double *states, double *rates, double *variables, size_t index); -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); +void initialiseVariables(double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.py index 199dab37b0..2f58c315a4 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.py @@ -85,7 +85,7 @@ def create_externals_array(): return [nan]*EXTERNAL_COUNT -def initialise_variables(voi, states, rates, constants, computed_constants, algebraic): +def initialise_variables(states, rates, constants, computed_constants, algebraic): states[0] = 0.6 states[1] = 0.05 states[2] = 0.325 diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.h index bb8c14e65a..1edf0a208b 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.h +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.h @@ -31,7 +31,7 @@ double * createAlgebraicArray(); void deleteArray(double *array); -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); +void initialiseVariables(double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.py index 5e4544aff4..c32bbcaf52 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.py @@ -77,7 +77,7 @@ def create_algebraic_array(): return [nan]*ALGEBRAIC_COUNT -def initialise_variables(voi, states, rates, constants, computed_constants, algebraic): +def initialise_variables(states, rates, constants, computed_constants, algebraic): states[0] = 0.0 states[1] = 0.6 states[2] = 0.05 diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.c index b9b6ea788c..7ea8984c31 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.c @@ -113,7 +113,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) +void initialiseVariables(double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { states[0] = 0.0; states[1] = 0.6; diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.h index d86b4881ec..1ba9603ccd 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.h +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.h @@ -36,7 +36,7 @@ void deleteArray(double *array); typedef double (* ExternalVariable)(double voi, double *states, double *rates, double *variables, size_t index); -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); +void initialiseVariables(double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.py index 1e9f9cf9ca..5963bee10b 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.py @@ -85,7 +85,7 @@ def create_externals_array(): return [nan]*EXTERNAL_COUNT -def initialise_variables(voi, states, rates, constants, computed_constants, algebraic): +def initialise_variables(states, rates, constants, computed_constants, algebraic): states[0] = 0.0 states[1] = 0.6 states[2] = 0.325 diff --git a/tests/resources/generator/noble_model_1962/model.c b/tests/resources/generator/noble_model_1962/model.c index 01b5b73f84..5ff0e01c5b 100644 --- a/tests/resources/generator/noble_model_1962/model.c +++ b/tests/resources/generator/noble_model_1962/model.c @@ -97,7 +97,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) +void initialiseVariables(double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { states[0] = -87.0; states[1] = 0.01; diff --git a/tests/resources/generator/noble_model_1962/model.h b/tests/resources/generator/noble_model_1962/model.h index dd78b85735..34f47c14f3 100644 --- a/tests/resources/generator/noble_model_1962/model.h +++ b/tests/resources/generator/noble_model_1962/model.h @@ -31,7 +31,7 @@ double * createAlgebraicArray(); void deleteArray(double *array); -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); +void initialiseVariables(double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/noble_model_1962/model.py b/tests/resources/generator/noble_model_1962/model.py index 886e83180b..9929159d4e 100644 --- a/tests/resources/generator/noble_model_1962/model.py +++ b/tests/resources/generator/noble_model_1962/model.py @@ -64,7 +64,7 @@ def create_algebraic_array(): return [nan]*ALGEBRAIC_COUNT -def initialise_variables(voi, states, rates, constants, computed_constants, algebraic): +def initialise_variables(states, rates, constants, computed_constants, algebraic): states[0] = -87.0 states[1] = 0.01 states[2] = 0.8 diff --git a/tests/resources/generator/ode_computed_var_on_rhs/model.c b/tests/resources/generator/ode_computed_var_on_rhs/model.c index d414fe9c3f..74675869d7 100644 --- a/tests/resources/generator/ode_computed_var_on_rhs/model.c +++ b/tests/resources/generator/ode_computed_var_on_rhs/model.c @@ -78,7 +78,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) +void initialiseVariables(double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { states[0] = 1.0; computedConstants[0] = 1.0; diff --git a/tests/resources/generator/ode_computed_var_on_rhs/model.h b/tests/resources/generator/ode_computed_var_on_rhs/model.h index a415fa4aed..c269dcfadf 100644 --- a/tests/resources/generator/ode_computed_var_on_rhs/model.h +++ b/tests/resources/generator/ode_computed_var_on_rhs/model.h @@ -31,7 +31,7 @@ double * createAlgebraicArray(); void deleteArray(double *array); -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); +void initialiseVariables(double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/ode_computed_var_on_rhs/model.py b/tests/resources/generator/ode_computed_var_on_rhs/model.py index 8cc8419dc1..f01c8fa218 100644 --- a/tests/resources/generator/ode_computed_var_on_rhs/model.py +++ b/tests/resources/generator/ode_computed_var_on_rhs/model.py @@ -45,7 +45,7 @@ def create_algebraic_array(): return [nan]*ALGEBRAIC_COUNT -def initialise_variables(voi, states, rates, constants, computed_constants, algebraic): +def initialise_variables(states, rates, constants, computed_constants, algebraic): states[0] = 1.0 computed_constants[0] = 1.0 diff --git a/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.c b/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.c index ae4086a657..2c0aae0bba 100644 --- a/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.c +++ b/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.c @@ -78,7 +78,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) +void initialiseVariables(double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { states[0] = 1.0; computedConstants[0] = 1.0; diff --git a/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.h b/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.h index 7672524c38..3f2f4d80ff 100644 --- a/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.h +++ b/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.h @@ -31,7 +31,7 @@ double * createAlgebraicArray(); void deleteArray(double *array); -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); +void initialiseVariables(double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.py b/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.py index 200410168d..e18daee17e 100644 --- a/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.py +++ b/tests/resources/generator/ode_computed_var_on_rhs_one_component/model.py @@ -45,7 +45,7 @@ def create_algebraic_array(): return [nan]*ALGEBRAIC_COUNT -def initialise_variables(voi, states, rates, constants, computed_constants, algebraic): +def initialise_variables(states, rates, constants, computed_constants, algebraic): states[0] = 1.0 computed_constants[0] = 1.0 diff --git a/tests/resources/generator/ode_const_var_on_rhs/model.c b/tests/resources/generator/ode_const_var_on_rhs/model.c index c07a96c1da..c44536b884 100644 --- a/tests/resources/generator/ode_const_var_on_rhs/model.c +++ b/tests/resources/generator/ode_const_var_on_rhs/model.c @@ -78,7 +78,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) +void initialiseVariables(double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { states[0] = 1.0; constants[0] = 1.0; diff --git a/tests/resources/generator/ode_const_var_on_rhs/model.h b/tests/resources/generator/ode_const_var_on_rhs/model.h index a415fa4aed..c269dcfadf 100644 --- a/tests/resources/generator/ode_const_var_on_rhs/model.h +++ b/tests/resources/generator/ode_const_var_on_rhs/model.h @@ -31,7 +31,7 @@ double * createAlgebraicArray(); void deleteArray(double *array); -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); +void initialiseVariables(double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/ode_const_var_on_rhs/model.py b/tests/resources/generator/ode_const_var_on_rhs/model.py index 30e37bfffd..81636d01bf 100644 --- a/tests/resources/generator/ode_const_var_on_rhs/model.py +++ b/tests/resources/generator/ode_const_var_on_rhs/model.py @@ -45,7 +45,7 @@ def create_algebraic_array(): return [nan]*ALGEBRAIC_COUNT -def initialise_variables(voi, states, rates, constants, computed_constants, algebraic): +def initialise_variables(states, rates, constants, computed_constants, algebraic): states[0] = 1.0 constants[0] = 1.0 diff --git a/tests/resources/generator/ode_const_var_on_rhs_one_component/model.c b/tests/resources/generator/ode_const_var_on_rhs_one_component/model.c index 535c9f2320..0aa1714bf4 100644 --- a/tests/resources/generator/ode_const_var_on_rhs_one_component/model.c +++ b/tests/resources/generator/ode_const_var_on_rhs_one_component/model.c @@ -78,7 +78,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) +void initialiseVariables(double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { states[0] = 1.0; constants[0] = 1.0; diff --git a/tests/resources/generator/ode_const_var_on_rhs_one_component/model.h b/tests/resources/generator/ode_const_var_on_rhs_one_component/model.h index 7672524c38..3f2f4d80ff 100644 --- a/tests/resources/generator/ode_const_var_on_rhs_one_component/model.h +++ b/tests/resources/generator/ode_const_var_on_rhs_one_component/model.h @@ -31,7 +31,7 @@ double * createAlgebraicArray(); void deleteArray(double *array); -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); +void initialiseVariables(double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/ode_const_var_on_rhs_one_component/model.py b/tests/resources/generator/ode_const_var_on_rhs_one_component/model.py index f9dd400b5f..33824ba523 100644 --- a/tests/resources/generator/ode_const_var_on_rhs_one_component/model.py +++ b/tests/resources/generator/ode_const_var_on_rhs_one_component/model.py @@ -45,7 +45,7 @@ def create_algebraic_array(): return [nan]*ALGEBRAIC_COUNT -def initialise_variables(voi, states, rates, constants, computed_constants, algebraic): +def initialise_variables(states, rates, constants, computed_constants, algebraic): states[0] = 1.0 constants[0] = 1.0 diff --git a/tests/resources/generator/ode_constant_on_rhs/model.c b/tests/resources/generator/ode_constant_on_rhs/model.c index 079b3e5ab6..c930a7deba 100644 --- a/tests/resources/generator/ode_constant_on_rhs/model.c +++ b/tests/resources/generator/ode_constant_on_rhs/model.c @@ -77,7 +77,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) +void initialiseVariables(double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { states[0] = 1.0; } diff --git a/tests/resources/generator/ode_constant_on_rhs/model.h b/tests/resources/generator/ode_constant_on_rhs/model.h index a415fa4aed..c269dcfadf 100644 --- a/tests/resources/generator/ode_constant_on_rhs/model.h +++ b/tests/resources/generator/ode_constant_on_rhs/model.h @@ -31,7 +31,7 @@ double * createAlgebraicArray(); void deleteArray(double *array); -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); +void initialiseVariables(double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/ode_constant_on_rhs/model.py b/tests/resources/generator/ode_constant_on_rhs/model.py index f68edb5389..40fc73eac5 100644 --- a/tests/resources/generator/ode_constant_on_rhs/model.py +++ b/tests/resources/generator/ode_constant_on_rhs/model.py @@ -44,7 +44,7 @@ def create_algebraic_array(): return [nan]*ALGEBRAIC_COUNT -def initialise_variables(voi, states, rates, constants, computed_constants, algebraic): +def initialise_variables(states, rates, constants, computed_constants, algebraic): states[0] = 1.0 diff --git a/tests/resources/generator/ode_constant_on_rhs_one_component/model.c b/tests/resources/generator/ode_constant_on_rhs_one_component/model.c index ac1762023c..e706b63f78 100644 --- a/tests/resources/generator/ode_constant_on_rhs_one_component/model.c +++ b/tests/resources/generator/ode_constant_on_rhs_one_component/model.c @@ -77,7 +77,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) +void initialiseVariables(double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { states[0] = 1.0; } diff --git a/tests/resources/generator/ode_constant_on_rhs_one_component/model.h b/tests/resources/generator/ode_constant_on_rhs_one_component/model.h index 7672524c38..3f2f4d80ff 100644 --- a/tests/resources/generator/ode_constant_on_rhs_one_component/model.h +++ b/tests/resources/generator/ode_constant_on_rhs_one_component/model.h @@ -31,7 +31,7 @@ double * createAlgebraicArray(); void deleteArray(double *array); -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); +void initialiseVariables(double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/ode_constant_on_rhs_one_component/model.py b/tests/resources/generator/ode_constant_on_rhs_one_component/model.py index d82951638b..f346db704f 100644 --- a/tests/resources/generator/ode_constant_on_rhs_one_component/model.py +++ b/tests/resources/generator/ode_constant_on_rhs_one_component/model.py @@ -44,7 +44,7 @@ def create_algebraic_array(): return [nan]*ALGEBRAIC_COUNT -def initialise_variables(voi, states, rates, constants, computed_constants, algebraic): +def initialise_variables(states, rates, constants, computed_constants, algebraic): states[0] = 1.0 diff --git a/tests/resources/generator/ode_multiple_dependent_odes/model.c b/tests/resources/generator/ode_multiple_dependent_odes/model.c index 504fb338c0..9664d71a3c 100644 --- a/tests/resources/generator/ode_multiple_dependent_odes/model.c +++ b/tests/resources/generator/ode_multiple_dependent_odes/model.c @@ -79,7 +79,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) +void initialiseVariables(double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { states[0] = -2.0; states[1] = 0.0; diff --git a/tests/resources/generator/ode_multiple_dependent_odes/model.h b/tests/resources/generator/ode_multiple_dependent_odes/model.h index 798bab570e..941110a716 100644 --- a/tests/resources/generator/ode_multiple_dependent_odes/model.h +++ b/tests/resources/generator/ode_multiple_dependent_odes/model.h @@ -31,7 +31,7 @@ double * createAlgebraicArray(); void deleteArray(double *array); -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); +void initialiseVariables(double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/ode_multiple_dependent_odes/model.py b/tests/resources/generator/ode_multiple_dependent_odes/model.py index aa411806cc..e349f1ef59 100644 --- a/tests/resources/generator/ode_multiple_dependent_odes/model.py +++ b/tests/resources/generator/ode_multiple_dependent_odes/model.py @@ -46,7 +46,7 @@ def create_algebraic_array(): return [nan]*ALGEBRAIC_COUNT -def initialise_variables(voi, states, rates, constants, computed_constants, algebraic): +def initialise_variables(states, rates, constants, computed_constants, algebraic): states[0] = -2.0 states[1] = 0.0 constants[0] = 1.0 diff --git a/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.c b/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.c index 7ce4852626..a466e72187 100644 --- a/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.c +++ b/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.c @@ -79,7 +79,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) +void initialiseVariables(double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { states[0] = -2.0; states[1] = 0.0; diff --git a/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.h b/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.h index bec3e3490f..6bf82d1490 100644 --- a/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.h +++ b/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.h @@ -31,7 +31,7 @@ double * createAlgebraicArray(); void deleteArray(double *array); -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); +void initialiseVariables(double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.py b/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.py index 0b45d416cb..b56414b1b2 100644 --- a/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.py +++ b/tests/resources/generator/ode_multiple_dependent_odes_one_component/model.py @@ -46,7 +46,7 @@ def create_algebraic_array(): return [nan]*ALGEBRAIC_COUNT -def initialise_variables(voi, states, rates, constants, computed_constants, algebraic): +def initialise_variables(states, rates, constants, computed_constants, algebraic): states[0] = -2.0 states[1] = 0.0 constants[0] = 1.0 diff --git a/tests/resources/generator/ode_multiple_odes_with_same_name/model.c b/tests/resources/generator/ode_multiple_odes_with_same_name/model.c index d176162d68..bdb58093ce 100644 --- a/tests/resources/generator/ode_multiple_odes_with_same_name/model.c +++ b/tests/resources/generator/ode_multiple_odes_with_same_name/model.c @@ -79,7 +79,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) +void initialiseVariables(double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { states[0] = 1.0; states[1] = 1.0; diff --git a/tests/resources/generator/ode_multiple_odes_with_same_name/model.h b/tests/resources/generator/ode_multiple_odes_with_same_name/model.h index ffe8d72ae2..a8f42ef1b7 100644 --- a/tests/resources/generator/ode_multiple_odes_with_same_name/model.h +++ b/tests/resources/generator/ode_multiple_odes_with_same_name/model.h @@ -31,7 +31,7 @@ double * createAlgebraicArray(); void deleteArray(double *array); -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); +void initialiseVariables(double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/ode_multiple_odes_with_same_name/model.py b/tests/resources/generator/ode_multiple_odes_with_same_name/model.py index 9b961ab387..e08f2c0f8b 100644 --- a/tests/resources/generator/ode_multiple_odes_with_same_name/model.py +++ b/tests/resources/generator/ode_multiple_odes_with_same_name/model.py @@ -46,7 +46,7 @@ def create_algebraic_array(): return [nan]*ALGEBRAIC_COUNT -def initialise_variables(voi, states, rates, constants, computed_constants, algebraic): +def initialise_variables(states, rates, constants, computed_constants, algebraic): states[0] = 1.0 states[1] = 1.0 constants[0] = 1.0 diff --git a/tests/resources/generator/ode_unknown_var_on_rhs/model.c b/tests/resources/generator/ode_unknown_var_on_rhs/model.c index ea28a9b45e..9a10f6f5c2 100644 --- a/tests/resources/generator/ode_unknown_var_on_rhs/model.c +++ b/tests/resources/generator/ode_unknown_var_on_rhs/model.c @@ -78,7 +78,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) +void initialiseVariables(double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { states[0] = 1.0; states[1] = 1.0; diff --git a/tests/resources/generator/ode_unknown_var_on_rhs/model.h b/tests/resources/generator/ode_unknown_var_on_rhs/model.h index a415fa4aed..c269dcfadf 100644 --- a/tests/resources/generator/ode_unknown_var_on_rhs/model.h +++ b/tests/resources/generator/ode_unknown_var_on_rhs/model.h @@ -31,7 +31,7 @@ double * createAlgebraicArray(); void deleteArray(double *array); -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); +void initialiseVariables(double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/ode_unknown_var_on_rhs/model.py b/tests/resources/generator/ode_unknown_var_on_rhs/model.py index 4a6a2dcf2f..65e64eb3c2 100644 --- a/tests/resources/generator/ode_unknown_var_on_rhs/model.py +++ b/tests/resources/generator/ode_unknown_var_on_rhs/model.py @@ -45,7 +45,7 @@ def create_algebraic_array(): return [nan]*ALGEBRAIC_COUNT -def initialise_variables(voi, states, rates, constants, computed_constants, algebraic): +def initialise_variables(states, rates, constants, computed_constants, algebraic): states[0] = 1.0 states[1] = 1.0 diff --git a/tests/resources/generator/robertson_model_1966/model.dae.c b/tests/resources/generator/robertson_model_1966/model.dae.c index 0a9d6e3d0f..9f90b3f9c9 100644 --- a/tests/resources/generator/robertson_model_1966/model.dae.c +++ b/tests/resources/generator/robertson_model_1966/model.dae.c @@ -117,7 +117,7 @@ void findRoot0(double voi, double *states, double *rates, double *variables) algebraic[0] = u[0]; } -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) +void initialiseVariables(double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { states[0] = 1.0; states[1] = 0.0; diff --git a/tests/resources/generator/robertson_model_1966/model.dae.h b/tests/resources/generator/robertson_model_1966/model.dae.h index 85620bec4c..3eb2e01f1f 100644 --- a/tests/resources/generator/robertson_model_1966/model.dae.h +++ b/tests/resources/generator/robertson_model_1966/model.dae.h @@ -31,7 +31,7 @@ double * createAlgebraicArray(); void deleteArray(double *array); -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); +void initialiseVariables(double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/robertson_model_1966/model.dae.py b/tests/resources/generator/robertson_model_1966/model.dae.py index e018d745aa..512fd8d9fc 100644 --- a/tests/resources/generator/robertson_model_1966/model.dae.py +++ b/tests/resources/generator/robertson_model_1966/model.dae.py @@ -74,7 +74,7 @@ def find_root_0(voi, states, rates, variables): algebraic[0] = u[0] -def initialise_variables(voi, states, rates, constants, computed_constants, algebraic): +def initialise_variables(states, rates, constants, computed_constants, algebraic): states[0] = 1.0 states[1] = 0.0 constants[0] = 0.04 diff --git a/tests/resources/generator/robertson_model_1966/model.ode.c b/tests/resources/generator/robertson_model_1966/model.ode.c index c64c8f3d07..dc3ae18924 100644 --- a/tests/resources/generator/robertson_model_1966/model.ode.c +++ b/tests/resources/generator/robertson_model_1966/model.ode.c @@ -83,7 +83,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) +void initialiseVariables(double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { states[0] = 1.0; states[1] = 0.0; diff --git a/tests/resources/generator/robertson_model_1966/model.ode.h b/tests/resources/generator/robertson_model_1966/model.ode.h index 85620bec4c..3eb2e01f1f 100644 --- a/tests/resources/generator/robertson_model_1966/model.ode.h +++ b/tests/resources/generator/robertson_model_1966/model.ode.h @@ -31,7 +31,7 @@ double * createAlgebraicArray(); void deleteArray(double *array); -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); +void initialiseVariables(double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/robertson_model_1966/model.ode.py b/tests/resources/generator/robertson_model_1966/model.ode.py index 06e02a7840..b3811cff75 100644 --- a/tests/resources/generator/robertson_model_1966/model.ode.py +++ b/tests/resources/generator/robertson_model_1966/model.ode.py @@ -50,7 +50,7 @@ def create_algebraic_array(): return [nan]*ALGEBRAIC_COUNT -def initialise_variables(voi, states, rates, constants, computed_constants, algebraic): +def initialise_variables(states, rates, constants, computed_constants, algebraic): states[0] = 1.0 states[1] = 0.0 states[2] = 0.0 diff --git a/tests/resources/generator/sine_model_imports/model.c b/tests/resources/generator/sine_model_imports/model.c index 35e0bd5e9d..d1f9227a32 100644 --- a/tests/resources/generator/sine_model_imports/model.c +++ b/tests/resources/generator/sine_model_imports/model.c @@ -87,7 +87,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) +void initialiseVariables(double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { states[0] = constants[0]; constants[0] = 0.0; diff --git a/tests/resources/generator/sine_model_imports/model.h b/tests/resources/generator/sine_model_imports/model.h index e823a94004..f54dd00c05 100644 --- a/tests/resources/generator/sine_model_imports/model.h +++ b/tests/resources/generator/sine_model_imports/model.h @@ -31,7 +31,7 @@ double * createAlgebraicArray(); void deleteArray(double *array); -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); +void initialiseVariables(double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/sine_model_imports/model.py b/tests/resources/generator/sine_model_imports/model.py index fe54908e70..e1b66e7dbf 100644 --- a/tests/resources/generator/sine_model_imports/model.py +++ b/tests/resources/generator/sine_model_imports/model.py @@ -58,7 +58,7 @@ def create_algebraic_array(): return [nan]*ALGEBRAIC_COUNT -def initialise_variables(voi, states, rates, constants, computed_constants, algebraic): +def initialise_variables(states, rates, constants, computed_constants, algebraic): states[0] = constants[0] constants[0] = 0.0 constants[1] = 0.75 diff --git a/tests/resources/generator/variable_initialised_using_a_constant/model.c b/tests/resources/generator/variable_initialised_using_a_constant/model.c index 689d802b56..dfa7477122 100644 --- a/tests/resources/generator/variable_initialised_using_a_constant/model.c +++ b/tests/resources/generator/variable_initialised_using_a_constant/model.c @@ -78,7 +78,7 @@ void deleteArray(double *array) free(array); } -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) +void initialiseVariables(double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { constants[0] = 7.0; states[0] = constants[0]; diff --git a/tests/resources/generator/variable_initialised_using_a_constant/model.h b/tests/resources/generator/variable_initialised_using_a_constant/model.h index ce68264b34..932dd3aa63 100644 --- a/tests/resources/generator/variable_initialised_using_a_constant/model.h +++ b/tests/resources/generator/variable_initialised_using_a_constant/model.h @@ -31,7 +31,7 @@ double * createAlgebraicArray(); void deleteArray(double *array); -void initialiseVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); +void initialiseVariables(double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/variable_initialised_using_a_constant/model.py b/tests/resources/generator/variable_initialised_using_a_constant/model.py index 688fa53037..a0ea05ad7c 100644 --- a/tests/resources/generator/variable_initialised_using_a_constant/model.py +++ b/tests/resources/generator/variable_initialised_using_a_constant/model.py @@ -45,7 +45,7 @@ def create_algebraic_array(): return [nan]*ALGEBRAIC_COUNT -def initialise_variables(voi, states, rates, constants, computed_constants, algebraic): +def initialise_variables(states, rates, constants, computed_constants, algebraic): constants[0] = 7.0 states[0] = constants[0] From f3bbce337d51c0ad10639dd1864ea7aa95c7d756 Mon Sep 17 00:00:00 2001 From: Alan Garny Date: Mon, 19 Aug 2024 16:01:23 +0200 Subject: [PATCH 40/85] Tests: removed unneeded generated C/Python files. --- tests/generator/generator.cpp | 8 +- ...del.three.externals.c => model.external.c} | 2 +- ...del.three.externals.h => model.external.h} | 0 ...l.three.externals.py => model.external.py} | 0 .../model.one.external.c | 85 ------------ .../model.one.external.h | 37 ------ .../model.one.external.py | 71 ---------- .../model.two.externals.c | 125 ------------------ .../model.two.externals.h | 37 ------ .../model.two.externals.py | 105 --------------- 10 files changed, 5 insertions(+), 465 deletions(-) rename tests/resources/generator/algebraic_system_with_three_linked_unknowns/{model.three.externals.c => model.external.c} (98%) rename tests/resources/generator/algebraic_system_with_three_linked_unknowns/{model.three.externals.h => model.external.h} (100%) rename tests/resources/generator/algebraic_system_with_three_linked_unknowns/{model.three.externals.py => model.external.py} (100%) delete mode 100644 tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.one.external.c delete mode 100644 tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.one.external.h delete mode 100644 tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.one.external.py delete mode 100644 tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.two.externals.c delete mode 100644 tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.two.externals.h delete mode 100644 tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.two.externals.py diff --git a/tests/generator/generator.cpp b/tests/generator/generator.cpp index 9bfab3e607..52ccea486f 100644 --- a/tests/generator/generator.cpp +++ b/tests/generator/generator.cpp @@ -412,16 +412,16 @@ TEST(Generator, algebraicSystemWithThreeLinkedUnknownsWithThreeExternalVariables auto profile = generator->profile(); - profile->setInterfaceFileNameString("model.three.externals.h"); + profile->setInterfaceFileNameString("model.external.h"); - EXPECT_EQ_FILE_CONTENTS("generator/algebraic_system_with_three_linked_unknowns/model.three.externals.h", generator->interfaceCode()); - EXPECT_EQ_FILE_CONTENTS("generator/algebraic_system_with_three_linked_unknowns/model.three.externals.c", generator->implementationCode()); + EXPECT_EQ_FILE_CONTENTS("generator/algebraic_system_with_three_linked_unknowns/model.external.h", generator->interfaceCode()); + EXPECT_EQ_FILE_CONTENTS("generator/algebraic_system_with_three_linked_unknowns/model.external.c", generator->implementationCode()); profile = libcellml::GeneratorProfile::create(libcellml::GeneratorProfile::Profile::PYTHON); generator->setProfile(profile); - EXPECT_EQ_FILE_CONTENTS("generator/algebraic_system_with_three_linked_unknowns/model.three.externals.py", generator->implementationCode()); + EXPECT_EQ_FILE_CONTENTS("generator/algebraic_system_with_three_linked_unknowns/model.external.py", generator->implementationCode()); } TEST(Generator, algebraicSystemWithVariousDependenciesOrdered) diff --git a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.c b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.external.c similarity index 98% rename from tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.c rename to tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.external.c index bc57800164..38c67fb560 100644 --- a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.c +++ b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.external.c @@ -1,6 +1,6 @@ /* The content of this file was generated using the C profile of libCellML 0.5.0. */ -#include "model.three.externals.h" +#include "model.external.h" #include #include diff --git a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.h b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.external.h similarity index 100% rename from tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.h rename to tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.external.h diff --git a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.py b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.external.py similarity index 100% rename from tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.three.externals.py rename to tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.external.py diff --git a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.one.external.c b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.one.external.c deleted file mode 100644 index 46aff4ae67..0000000000 --- a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.one.external.c +++ /dev/null @@ -1,85 +0,0 @@ -/* The content of this file was generated using the C profile of libCellML 0.5.0. */ - -#include "model.one.external.h" - -#include -#include - -const char VERSION[] = "0.6.0"; -const char LIBCELLML_VERSION[] = "0.5.0"; - -const size_t CONSTANT_COUNT = 0; -const size_t COMPUTED_CONSTANT_COUNT = 0; -const size_t ALGEBRAIC_COUNT = 3; - -const VariableInfo VARIABLE_INFO[] = { - {"x", "dimensionless", "my_algebraic_system", EXTERNAL}, - {"y", "dimensionless", "my_algebraic_system", ALGEBRAIC}, - {"z", "dimensionless", "my_algebraic_system", ALGEBRAIC} -}; - -double * createVariablesArray() -{ - double *res = (double *) malloc(VARIABLE_COUNT*sizeof(double)); - - for (size_t i = 0; i < VARIABLE_COUNT; ++i) { - res[i] = NAN; - } - - return res; -} - -void deleteArray(double *array) -{ - free(array); -} - -typedef struct { - double *variables; -} RootFindingInfo; - -extern void nlaSolve(void (*objectiveFunction)(double *, double *, void *), - double *u, size_t n, void *data); - -void objectiveFunction0(double *u, double *f, void *data) -{ - double *variables = ((RootFindingInfo *) data)->variables; - - variables[1] = u[0]; - variables[2] = u[1]; - - f[0] = 2.0*variables[0]+variables[1]-2.0*variables[2]-(-1.0); - f[1] = 3.0*variables[0]-3.0*variables[1]-variables[2]-5.0; - f[2] = variables[0]-2.0*variables[1]+3.0*variables[2]-6.0; -} - -void findRoot0(double *variables) -{ - RootFindingInfo rfi = { variables }; - double u[2]; - - u[0] = variables[1]; - u[1] = variables[2]; - - nlaSolve(objectiveFunction0, u, 2, &rfi); - - variables[1] = u[0]; - variables[2] = u[1]; -} - -void initialiseVariables(double *constants, ExternalVariable externalVariable) -{ - variables[1] = 1.0; - variables[2] = 1.0; - variables[0] = externalVariable(variables, 0); -} - -void computeComputedConstants(double *constants, double *computedConstants) -{ -} - -void computeVariables(double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) -{ - variables[0] = externalVariable(variables, 0); - findRoot0(variables); -} diff --git a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.one.external.h b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.one.external.h deleted file mode 100644 index f8cc4af0bb..0000000000 --- a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.one.external.h +++ /dev/null @@ -1,37 +0,0 @@ -/* The content of this file was generated using the C profile of libCellML 0.5.0. */ - -#pragma once - -#include - -extern const char VERSION[]; -extern const char LIBCELLML_VERSION[]; - -extern const size_t CONSTANT_COUNT; -extern const size_t COMPUTED_CONSTANT_COUNT; -extern const size_t ALGEBRAIC_COUNT; - -typedef enum { - CONSTANT, - COMPUTED_CONSTANT, - ALGEBRAIC, - EXTERNAL -} VariableType; - -typedef struct { - char name[2]; - char units[14]; - char component[20]; - VariableType type; -} VariableInfo; - -extern const VariableInfo VARIABLE_INFO[]; - -double * createVariablesArray(); -void deleteArray(double *array); - -typedef double (* ExternalVariable)(double *variables, size_t index); - -void initialiseVariables(double *constants, ExternalVariable externalVariable); -void computeComputedConstants(double *constants, double *computedConstants); -void computeVariables(double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); diff --git a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.one.external.py b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.one.external.py deleted file mode 100644 index bd566aa08d..0000000000 --- a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.one.external.py +++ /dev/null @@ -1,71 +0,0 @@ -# The content of this file was generated using the Python profile of libCellML 0.5.0. - -from enum import Enum -from math import * - - -__version__ = "0.5.0" -LIBCELLML_VERSION = "0.5.0" - -CONSTANT_COUNT = 0 -COMPUTED_CONSTANT_COUNT = 0 -ALGEBRAIC_COUNT = 3 - - -class VariableType(Enum): - CONSTANT = 0 - COMPUTED_CONSTANT = 1 - ALGEBRAIC = 2 - EXTERNAL = 3 - - -VARIABLE_INFO = [ - {"name": "x", "units": "dimensionless", "component": "my_algebraic_system", "type": VariableType.EXTERNAL}, - {"name": "y", "units": "dimensionless", "component": "my_algebraic_system", "type": VariableType.ALGEBRAIC}, - {"name": "z", "units": "dimensionless", "component": "my_algebraic_system", "type": VariableType.ALGEBRAIC} -] - - -def create_variables_array(): - return [nan]*VARIABLE_COUNT - - -from nlasolver import nla_solve - - -def objective_function_0(u, f, data): - variables = data[0] - - variables[1] = u[0] - variables[2] = u[1] - - f[0] = 2.0*variables[0]+variables[1]-2.0*variables[2]-(-1.0) - f[1] = 3.0*variables[0]-3.0*variables[1]-variables[2]-5.0 - f[2] = variables[0]-2.0*variables[1]+3.0*variables[2]-6.0 - - -def find_root_0(variables): - u = [nan]*2 - - u[0] = variables[1] - u[1] = variables[2] - - u = nla_solve(objective_function_0, u, 2, [variables]) - - variables[1] = u[0] - variables[2] = u[1] - - -def initialise_variables(constants, external_variable): - variables[1] = 1.0 - variables[2] = 1.0 - variables[0] = external_variable(variables, 0) - - -def compute_computed_constants(constants, computed_constants): - pass - - -def compute_variables(constants, computed_constants, algebraic, external_variable): - variables[0] = external_variable(variables, 0) - find_root_0(variables) diff --git a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.two.externals.c b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.two.externals.c deleted file mode 100644 index 797c82c58b..0000000000 --- a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.two.externals.c +++ /dev/null @@ -1,125 +0,0 @@ -/* The content of this file was generated using the C profile of libCellML 0.5.0. */ - -#include "model.two.externals.h" - -#include -#include - -const char VERSION[] = "0.6.0"; -const char LIBCELLML_VERSION[] = "0.5.0"; - -const size_t CONSTANT_COUNT = 0; -const size_t COMPUTED_CONSTANT_COUNT = 0; -const size_t ALGEBRAIC_COUNT = 3; - -const VariableInfo VARIABLE_INFO[] = { - {"x", "dimensionless", "my_algebraic_system", EXTERNAL}, - {"y", "dimensionless", "my_algebraic_system", ALGEBRAIC}, - {"z", "dimensionless", "my_algebraic_system", EXTERNAL} -}; - -double * createVariablesArray() -{ - double *res = (double *) malloc(VARIABLE_COUNT*sizeof(double)); - - for (size_t i = 0; i < VARIABLE_COUNT; ++i) { - res[i] = NAN; - } - - return res; -} - -void deleteArray(double *array) -{ - free(array); -} - -typedef struct { - double *variables; -} RootFindingInfo; - -extern void nlaSolve(void (*objectiveFunction)(double *, double *, void *), - double *u, size_t n, void *data); - -void objectiveFunction0(double *u, double *f, void *data) -{ - double *variables = ((RootFindingInfo *) data)->variables; - - variables[1] = u[0]; - - f[0] = 2.0*variables[0]+variables[1]-2.0*variables[2]-(-1.0); -} - -void findRoot0(double *variables) -{ - RootFindingInfo rfi = { variables }; - double u[1]; - - u[0] = variables[1]; - - nlaSolve(objectiveFunction0, u, 1, &rfi); - - variables[1] = u[0]; -} - -void objectiveFunction1(double *u, double *f, void *data) -{ - double *variables = ((RootFindingInfo *) data)->variables; - - variables[1] = u[0]; - - f[0] = 3.0*variables[0]-3.0*variables[1]-variables[2]-5.0; -} - -void findRoot1(double *variables) -{ - RootFindingInfo rfi = { variables }; - double u[1]; - - u[0] = variables[1]; - - nlaSolve(objectiveFunction1, u, 1, &rfi); - - variables[1] = u[0]; -} - -void objectiveFunction2(double *u, double *f, void *data) -{ - double *variables = ((RootFindingInfo *) data)->variables; - - variables[1] = u[0]; - - f[0] = variables[0]-2.0*variables[1]+3.0*variables[2]-6.0; -} - -void findRoot2(double *variables) -{ - RootFindingInfo rfi = { variables }; - double u[1]; - - u[0] = variables[1]; - - nlaSolve(objectiveFunction2, u, 1, &rfi); - - variables[1] = u[0]; -} - -void initialiseVariables(double *constants, ExternalVariable externalVariable) -{ - variables[1] = 1.0; - variables[0] = externalVariable(variables, 0); - variables[2] = externalVariable(variables, 2); -} - -void computeComputedConstants(double *constants, double *computedConstants) -{ -} - -void computeVariables(double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) -{ - variables[0] = externalVariable(variables, 0); - variables[2] = externalVariable(variables, 2); - findRoot0(variables); - findRoot1(variables); - findRoot2(variables); -} diff --git a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.two.externals.h b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.two.externals.h deleted file mode 100644 index f8cc4af0bb..0000000000 --- a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.two.externals.h +++ /dev/null @@ -1,37 +0,0 @@ -/* The content of this file was generated using the C profile of libCellML 0.5.0. */ - -#pragma once - -#include - -extern const char VERSION[]; -extern const char LIBCELLML_VERSION[]; - -extern const size_t CONSTANT_COUNT; -extern const size_t COMPUTED_CONSTANT_COUNT; -extern const size_t ALGEBRAIC_COUNT; - -typedef enum { - CONSTANT, - COMPUTED_CONSTANT, - ALGEBRAIC, - EXTERNAL -} VariableType; - -typedef struct { - char name[2]; - char units[14]; - char component[20]; - VariableType type; -} VariableInfo; - -extern const VariableInfo VARIABLE_INFO[]; - -double * createVariablesArray(); -void deleteArray(double *array); - -typedef double (* ExternalVariable)(double *variables, size_t index); - -void initialiseVariables(double *constants, ExternalVariable externalVariable); -void computeComputedConstants(double *constants, double *computedConstants); -void computeVariables(double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); diff --git a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.two.externals.py b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.two.externals.py deleted file mode 100644 index 3ce4e8ff07..0000000000 --- a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.two.externals.py +++ /dev/null @@ -1,105 +0,0 @@ -# The content of this file was generated using the Python profile of libCellML 0.5.0. - -from enum import Enum -from math import * - - -__version__ = "0.5.0" -LIBCELLML_VERSION = "0.5.0" - -CONSTANT_COUNT = 0 -COMPUTED_CONSTANT_COUNT = 0 -ALGEBRAIC_COUNT = 3 - - -class VariableType(Enum): - CONSTANT = 0 - COMPUTED_CONSTANT = 1 - ALGEBRAIC = 2 - EXTERNAL = 3 - - -VARIABLE_INFO = [ - {"name": "x", "units": "dimensionless", "component": "my_algebraic_system", "type": VariableType.EXTERNAL}, - {"name": "y", "units": "dimensionless", "component": "my_algebraic_system", "type": VariableType.ALGEBRAIC}, - {"name": "z", "units": "dimensionless", "component": "my_algebraic_system", "type": VariableType.EXTERNAL} -] - - -def create_variables_array(): - return [nan]*VARIABLE_COUNT - - -from nlasolver import nla_solve - - -def objective_function_0(u, f, data): - variables = data[0] - - variables[1] = u[0] - - f[0] = 2.0*variables[0]+variables[1]-2.0*variables[2]-(-1.0) - - -def find_root_0(variables): - u = [nan]*1 - - u[0] = variables[1] - - u = nla_solve(objective_function_0, u, 1, [variables]) - - variables[1] = u[0] - - -def objective_function_1(u, f, data): - variables = data[0] - - variables[1] = u[0] - - f[0] = 3.0*variables[0]-3.0*variables[1]-variables[2]-5.0 - - -def find_root_1(variables): - u = [nan]*1 - - u[0] = variables[1] - - u = nla_solve(objective_function_1, u, 1, [variables]) - - variables[1] = u[0] - - -def objective_function_2(u, f, data): - variables = data[0] - - variables[1] = u[0] - - f[0] = variables[0]-2.0*variables[1]+3.0*variables[2]-6.0 - - -def find_root_2(variables): - u = [nan]*1 - - u[0] = variables[1] - - u = nla_solve(objective_function_2, u, 1, [variables]) - - variables[1] = u[0] - - -def initialise_variables(constants, external_variable): - variables[1] = 1.0 - variables[0] = external_variable(variables, 0) - variables[2] = external_variable(variables, 2) - - -def compute_computed_constants(constants, computed_constants): - pass - - -def compute_variables(constants, computed_constants, algebraic, external_variable): - variables[0] = external_variable(variables, 0) - variables[2] = external_variable(variables, 2) - find_root_0(variables) - find_root_1(variables) - find_root_2(variables) From 1f0963079497f768749ecbcfc72a83872a4a5ce4 Mon Sep 17 00:00:00 2001 From: Alan Garny Date: Mon, 19 Aug 2024 18:39:41 +0200 Subject: [PATCH 41/85] Generator: make sure that constants are initialised when they are needed to initialise a state. --- src/generator.cpp | 25 ++++++++++++++----- .../generator/sine_model_imports/model.c | 2 +- .../generator/sine_model_imports/model.py | 2 +- 3 files changed, 21 insertions(+), 8 deletions(-) diff --git a/src/generator.cpp b/src/generator.cpp index f11c2e0000..9def5a35f7 100644 --- a/src/generator.cpp +++ b/src/generator.cpp @@ -1821,16 +1821,29 @@ void Generator::GeneratorImpl::addImplementationInitialiseVariablesMethodCode(st for (const auto &state : mModel->states()) { auto initialisingVariable = state->initialisingVariable(); auto initialValue = initialisingVariable->initialValue(); + auto constant = constants.end(); - if (!isCellMLReal(initialValue)) { - auto constant = std::find_if(constants.begin(), constants.end(), - [=](const AnalyserVariablePtr &av) -> bool { return av->variable()->name() == initialValue; }); + while (!isCellMLReal(initialValue)) { + // The initial value references another variable, so look for it keeping in mind that its initial value may + // reference another variable, and so on. - if (constant != constants.end()) { - methodBody += generateInitialisationCode(*constant); + auto initialisingComponent = owningComponent(initialisingVariable); + auto crtConstant = std::find_if(constants.begin(), constants.end(), + [=](const AnalyserVariablePtr &av) -> bool { return initialisingComponent->variable(initialValue)->hasEquivalentVariable(av->variable()); }); - constants.erase(constant); + if (crtConstant == constants.end()) { + break; } + + constant = crtConstant; + initialisingVariable = (*constant)->variable(); + initialValue = initialisingVariable->initialValue(); + } + + if (constant != constants.end()) { + methodBody += generateInitialisationCode(*constant); + + constants.erase(constant); } methodBody += generateInitialisationCode(state); diff --git a/tests/resources/generator/sine_model_imports/model.c b/tests/resources/generator/sine_model_imports/model.c index d1f9227a32..990a16ce24 100644 --- a/tests/resources/generator/sine_model_imports/model.c +++ b/tests/resources/generator/sine_model_imports/model.c @@ -89,8 +89,8 @@ void deleteArray(double *array) void initialiseVariables(double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { - states[0] = constants[0]; constants[0] = 0.0; + states[0] = constants[0]; constants[1] = 0.75; computedConstants[0] = 2.0/3.14159265358979; computedConstants[1] = 2.0*3.14159265358979; diff --git a/tests/resources/generator/sine_model_imports/model.py b/tests/resources/generator/sine_model_imports/model.py index e1b66e7dbf..4bbacc4779 100644 --- a/tests/resources/generator/sine_model_imports/model.py +++ b/tests/resources/generator/sine_model_imports/model.py @@ -59,8 +59,8 @@ def create_algebraic_array(): def initialise_variables(states, rates, constants, computed_constants, algebraic): - states[0] = constants[0] constants[0] = 0.0 + states[0] = constants[0] constants[1] = 0.75 computed_constants[0] = 2.0/3.14159265358979 computed_constants[1] = 2.0*3.14159265358979 From b54f6889d5b0c57402160779683640722526d9ad Mon Sep 17 00:00:00 2001 From: Alan Garny Date: Mon, 19 Aug 2024 22:30:29 +0200 Subject: [PATCH 42/85] GeneratorProfile: use the constants, computed constants, and algebraic arrays rather than the variables array with findRoot() & Co. --- src/generatorprofile.cpp | 48 ++-- src/generatorprofilesha1values.h | 4 +- .../bindings/python/test_generator_profile.py | 16 +- tests/generator/generatorprofile.cpp | 28 ++- tests/resources/coverage/generator/model.c | 14 +- .../generator/model.implementation.out | 14 +- .../generator/model.modified.profile.c | 14 +- .../generator/model.modified.profile.py | 10 +- tests/resources/coverage/generator/model.out | 12 +- tests/resources/coverage/generator/model.py | 10 +- .../model.c | 14 +- .../model.py | 10 +- .../model.c | 14 +- .../model.py | 10 +- .../model.not.ordered.c | 14 +- .../model.not.ordered.py | 10 +- .../model.ordered.c | 14 +- .../model.ordered.py | 10 +- .../generator/dae_cellml_1_1_model/model.c | 28 ++- .../generator/dae_cellml_1_1_model/model.py | 24 +- .../model.dae.c | 208 ++++++++++-------- .../model.dae.py | 204 ++++++++++------- .../robertson_model_1966/model.dae.c | 16 +- .../robertson_model_1966/model.dae.py | 12 +- 24 files changed, 454 insertions(+), 304 deletions(-) diff --git a/src/generatorprofile.cpp b/src/generatorprofile.cpp index c45912ed4a..db36f888c6 100644 --- a/src/generatorprofile.cpp +++ b/src/generatorprofile.cpp @@ -297,28 +297,32 @@ void GeneratorProfile::GeneratorProfileImpl::loadProfile(GeneratorProfile::Profi mExternalVariableMethodCallFdmString = "externalVariable(voi, states, rates, variables, [INDEX])"; mRootFindingInfoObjectFamString = "typedef struct {\n" - " double *variables;\n" + " double *constants;\n" + " double *computedConstants;\n" + " double *algebraic;\n" "} RootFindingInfo;\n"; mRootFindingInfoObjectFdmString = "typedef struct {\n" " double voi;\n" " double *states;\n" " double *rates;\n" - " double *variables;\n" + " double *constants;\n" + " double *computedConstants;\n" + " double *algebraic;\n" "} RootFindingInfo;\n"; mExternNlaSolveMethodString = "extern void nlaSolve(void (*objectiveFunction)(double *, double *, void *),\n" " double *u, size_t n, void *data);\n"; - mFindRootCallFamString = "findRoot[INDEX](variables);\n"; - mFindRootCallFdmString = "findRoot[INDEX](voi, states, rates, variables);\n"; - mFindRootMethodFamString = "void findRoot[INDEX](double *variables)\n" + mFindRootCallFamString = "findRoot[INDEX](constants, computedConstants, algebraic);\n"; + mFindRootCallFdmString = "findRoot[INDEX](voi, states, rates, constants, computedConstants, algebraic);\n"; + mFindRootMethodFamString = "void findRoot[INDEX](double *constants, double *computedConstants, double *algebraic)\n" "{\n" - " RootFindingInfo rfi = { variables };\n" + " RootFindingInfo rfi = { constants, computedConstants, algebraic };\n" " double u[[SIZE]];\n" "\n" "[CODE]" "}\n"; - mFindRootMethodFdmString = "void findRoot[INDEX](double voi, double *states, double *rates, double *variables)\n" + mFindRootMethodFdmString = "void findRoot[INDEX](double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic)\n" "{\n" - " RootFindingInfo rfi = { voi, states, rates, variables };\n" + " RootFindingInfo rfi = { voi, states, rates, constants, computedConstants, algebraic };\n" " double u[[SIZE]];\n" "\n" "[CODE]" @@ -327,7 +331,9 @@ void GeneratorProfile::GeneratorProfileImpl::loadProfile(GeneratorProfile::Profi mNlaSolveCallFdmString = "nlaSolve(objectiveFunction[INDEX], u, [SIZE], &rfi);\n"; mObjectiveFunctionMethodFamString = "void objectiveFunction[INDEX](double *u, double *f, void *data)\n" "{\n" - " double *variables = ((RootFindingInfo *) data)->variables;\n" + " double *constants = ((RootFindingInfo *) data)->constants;\n" + " double *computedConstants = ((RootFindingInfo *) data)->computedConstants;\n" + " double *algebraic = ((RootFindingInfo *) data)->algebraic;\n" "\n" "[CODE]" "}\n"; @@ -336,7 +342,9 @@ void GeneratorProfile::GeneratorProfileImpl::loadProfile(GeneratorProfile::Profi " double voi = ((RootFindingInfo *) data)->voi;\n" " double *states = ((RootFindingInfo *) data)->states;\n" " double *rates = ((RootFindingInfo *) data)->rates;\n" - " double *variables = ((RootFindingInfo *) data)->variables;\n" + " double *constants = ((RootFindingInfo *) data)->constants;\n" + " double *computedConstants = ((RootFindingInfo *) data)->computedConstants;\n" + " double *algebraic = ((RootFindingInfo *) data)->algebraic;\n" "\n" "[CODE]" "}\n"; @@ -742,23 +750,25 @@ void GeneratorProfile::GeneratorProfileImpl::loadProfile(GeneratorProfile::Profi mExternNlaSolveMethodString = "\n" "from nlasolver import nla_solve" "\n"; - mFindRootCallFamString = "find_root_[INDEX](variables)\n"; - mFindRootCallFdmString = "find_root_[INDEX](voi, states, rates, variables)\n"; + mFindRootCallFamString = "find_root_[INDEX](constants, computed_constants, algebraic)\n"; + mFindRootCallFdmString = "find_root_[INDEX](voi, states, rates, constants, computed_constants, algebraic)\n"; mFindRootMethodFamString = "\n" - "def find_root_[INDEX](variables):\n" + "def find_root_[INDEX](constants, computed_constants, algebraic):\n" " u = [nan]*[SIZE]\n" "\n" "[CODE]"; mFindRootMethodFdmString = "\n" - "def find_root_[INDEX](voi, states, rates, variables):\n" + "def find_root_[INDEX](voi, states, rates, constants, computed_constants, algebraic):\n" " u = [nan]*[SIZE]\n" "\n" "[CODE]"; - mNlaSolveCallFamString = "u = nla_solve(objective_function_[INDEX], u, [SIZE], [variables])\n"; - mNlaSolveCallFdmString = "u = nla_solve(objective_function_[INDEX], u, [SIZE], [voi, states, rates, variables])\n"; + mNlaSolveCallFamString = "u = nla_solve(objective_function_[INDEX], u, [SIZE], [constants, computed_constants, algebraic])\n"; + mNlaSolveCallFdmString = "u = nla_solve(objective_function_[INDEX], u, [SIZE], [voi, states, rates, constants, computed_constants, algebraic])\n"; mObjectiveFunctionMethodFamString = "\n" "def objective_function_[INDEX](u, f, data):\n" - " variables = data[0]\n" + " constants = data[0]\n" + " computed_constants = data[1]\n" + " algebraic = data[2]\n" "\n" "[CODE]"; mObjectiveFunctionMethodFdmString = "\n" @@ -766,7 +776,9 @@ void GeneratorProfile::GeneratorProfileImpl::loadProfile(GeneratorProfile::Profi " voi = data[0]\n" " states = data[1]\n" " rates = data[2]\n" - " variables = data[3]\n" + " constants = data[3]\n" + " computed_constants = data[4]\n" + " algebraic = data[5]\n" "\n" "[CODE]"; mUArrayString = "u"; diff --git a/src/generatorprofilesha1values.h b/src/generatorprofilesha1values.h index c7400228e8..fb447d9032 100644 --- a/src/generatorprofilesha1values.h +++ b/src/generatorprofilesha1values.h @@ -24,7 +24,7 @@ namespace libcellml { * The content of this file is generated, do not edit this file directly. * See docs/dev_utilities.rst for further information. */ -static const char C_GENERATOR_PROFILE_SHA1[] = "e5477b943b378914f730fdbf8c415e662d8950e2"; -static const char PYTHON_GENERATOR_PROFILE_SHA1[] = "f0acab1cd54d81a14aaee315aeb7dd69ac4c7ffb"; +static const char C_GENERATOR_PROFILE_SHA1[] = "d89b171278ed3bf717a6127eeb6ac6a7a90d0157"; +static const char PYTHON_GENERATOR_PROFILE_SHA1[] = "b5d9c5ac70bf89bf6396b8928885781b96e458ba"; } // namespace libcellml diff --git a/tests/bindings/python/test_generator_profile.py b/tests/bindings/python/test_generator_profile.py index 22f653cbbc..32b35283a0 100644 --- a/tests/bindings/python/test_generator_profile.py +++ b/tests/bindings/python/test_generator_profile.py @@ -1708,11 +1708,11 @@ def test_root_finding_info_object_string(self): g = GeneratorProfile() - self.assertEqual('typedef struct {\n double *variables;\n} RootFindingInfo;\n', g.rootFindingInfoObjectString(False)) + self.assertEqual('typedef struct {\n double *constants;\n double *computedConstants;\n double *algebraic;\n} RootFindingInfo;\n', g.rootFindingInfoObjectString(False)) g.setRootFindingInfoObjectString(False, GeneratorProfileTestCase.VALUE) self.assertEqual(GeneratorProfileTestCase.VALUE, g.rootFindingInfoObjectString(False)) - self.assertEqual('typedef struct {\n double voi;\n double *states;\n double *rates;\n double *variables;\n} RootFindingInfo;\n', g.rootFindingInfoObjectString(True)) + self.assertEqual('typedef struct {\n double voi;\n double *states;\n double *rates;\n double *constants;\n double *computedConstants;\n double *algebraic;\n} RootFindingInfo;\n', g.rootFindingInfoObjectString(True)) g.setRootFindingInfoObjectString(True, GeneratorProfileTestCase.VALUE) self.assertEqual(GeneratorProfileTestCase.VALUE, g.rootFindingInfoObjectString(True)) @@ -1730,11 +1730,11 @@ def test_find_root_call_string(self): g = GeneratorProfile() - self.assertEqual('findRoot[INDEX](variables);\n', g.findRootCallString(False)) + self.assertEqual('findRoot[INDEX](constants, computedConstants, algebraic);\n', g.findRootCallString(False)) g.setFindRootCallString(False, GeneratorProfileTestCase.VALUE) self.assertEqual(GeneratorProfileTestCase.VALUE, g.findRootCallString(False)) - self.assertEqual('findRoot[INDEX](voi, states, rates, variables);\n', g.findRootCallString(True)) + self.assertEqual('findRoot[INDEX](voi, states, rates, constants, computedConstants, algebraic);\n', g.findRootCallString(True)) g.setFindRootCallString(True, GeneratorProfileTestCase.VALUE) self.assertEqual(GeneratorProfileTestCase.VALUE, g.findRootCallString(True)) @@ -1743,11 +1743,11 @@ def test_find_root_method_string(self): g = GeneratorProfile() - self.assertEqual('void findRoot[INDEX](double *variables)\n{\n RootFindingInfo rfi = { variables };\n double u[[SIZE]];\n\n[CODE]}\n', g.findRootMethodString(False)) + self.assertEqual('void findRoot[INDEX](double *constants, double *computedConstants, double *algebraic)\n{\n RootFindingInfo rfi = { constants, computedConstants, algebraic };\n double u[[SIZE]];\n\n[CODE]}\n', g.findRootMethodString(False)) g.setFindRootMethodString(False, GeneratorProfileTestCase.VALUE) self.assertEqual(GeneratorProfileTestCase.VALUE, g.findRootMethodString(False)) - self.assertEqual('void findRoot[INDEX](double voi, double *states, double *rates, double *variables)\n{\n RootFindingInfo rfi = { voi, states, rates, variables };\n double u[[SIZE]];\n\n[CODE]}\n', g.findRootMethodString(True)) + self.assertEqual('void findRoot[INDEX](double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic)\n{\n RootFindingInfo rfi = { voi, states, rates, constants, computedConstants, algebraic };\n double u[[SIZE]];\n\n[CODE]}\n', g.findRootMethodString(True)) g.setFindRootMethodString(True, GeneratorProfileTestCase.VALUE) self.assertEqual(GeneratorProfileTestCase.VALUE, g.findRootMethodString(True)) @@ -1769,11 +1769,11 @@ def test_objective_function_method_string(self): g = GeneratorProfile() - self.assertEqual('void objectiveFunction[INDEX](double *u, double *f, void *data)\n{\n double *variables = ((RootFindingInfo *) data)->variables;\n\n[CODE]}\n', g.objectiveFunctionMethodString(False)) + self.assertEqual('void objectiveFunction[INDEX](double *u, double *f, void *data)\n{\n double *constants = ((RootFindingInfo *) data)->constants;\n double *computedConstants = ((RootFindingInfo *) data)->computedConstants;\n double *algebraic = ((RootFindingInfo *) data)->algebraic;\n\n[CODE]}\n', g.objectiveFunctionMethodString(False)) g.setObjectiveFunctionMethodString(False, GeneratorProfileTestCase.VALUE) self.assertEqual(GeneratorProfileTestCase.VALUE, g.objectiveFunctionMethodString(False)) - self.assertEqual('void objectiveFunction[INDEX](double *u, double *f, void *data)\n{\n double voi = ((RootFindingInfo *) data)->voi;\n double *states = ((RootFindingInfo *) data)->states;\n double *rates = ((RootFindingInfo *) data)->rates;\n double *variables = ((RootFindingInfo *) data)->variables;\n\n[CODE]}\n', g.objectiveFunctionMethodString(True)) + self.assertEqual('void objectiveFunction[INDEX](double *u, double *f, void *data)\n{\n double voi = ((RootFindingInfo *) data)->voi;\n double *states = ((RootFindingInfo *) data)->states;\n double *rates = ((RootFindingInfo *) data)->rates;\n double *constants = ((RootFindingInfo *) data)->constants;\n double *computedConstants = ((RootFindingInfo *) data)->computedConstants;\n double *algebraic = ((RootFindingInfo *) data)->algebraic;\n\n[CODE]}\n', g.objectiveFunctionMethodString(True)) g.setObjectiveFunctionMethodString(True, GeneratorProfileTestCase.VALUE) self.assertEqual(GeneratorProfileTestCase.VALUE, g.objectiveFunctionMethodString(True)) diff --git a/tests/generator/generatorprofile.cpp b/tests/generator/generatorprofile.cpp index 50e26d775f..4cc9c64120 100644 --- a/tests/generator/generatorprofile.cpp +++ b/tests/generator/generatorprofile.cpp @@ -349,34 +349,38 @@ TEST(GeneratorProfile, defaultMiscellaneousValues) EXPECT_EQ("externalVariable(voi, states, rates, variables, [INDEX])", generatorProfile->externalVariableMethodCallString(true)); EXPECT_EQ("typedef struct {\n" - " double *variables;\n" + " double *constants;\n" + " double *computedConstants;\n" + " double *algebraic;\n" "} RootFindingInfo;\n", generatorProfile->rootFindingInfoObjectString(false)); EXPECT_EQ("typedef struct {\n" " double voi;\n" " double *states;\n" " double *rates;\n" - " double *variables;\n" + " double *constants;\n" + " double *computedConstants;\n" + " double *algebraic;\n" "} RootFindingInfo;\n", generatorProfile->rootFindingInfoObjectString(true)); EXPECT_EQ("extern void nlaSolve(void (*objectiveFunction)(double *, double *, void *),\n" " double *u, size_t n, void *data);\n", generatorProfile->externNlaSolveMethodString()); - EXPECT_EQ("findRoot[INDEX](variables);\n", + EXPECT_EQ("findRoot[INDEX](constants, computedConstants, algebraic);\n", generatorProfile->findRootCallString(false)); - EXPECT_EQ("findRoot[INDEX](voi, states, rates, variables);\n", + EXPECT_EQ("findRoot[INDEX](voi, states, rates, constants, computedConstants, algebraic);\n", generatorProfile->findRootCallString(true)); - EXPECT_EQ("void findRoot[INDEX](double *variables)\n" + EXPECT_EQ("void findRoot[INDEX](double *constants, double *computedConstants, double *algebraic)\n" "{\n" - " RootFindingInfo rfi = { variables };\n" + " RootFindingInfo rfi = { constants, computedConstants, algebraic };\n" " double u[[SIZE]];\n" "\n" "[CODE]" "}\n", generatorProfile->findRootMethodString(false)); - EXPECT_EQ("void findRoot[INDEX](double voi, double *states, double *rates, double *variables)\n" + EXPECT_EQ("void findRoot[INDEX](double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic)\n" "{\n" - " RootFindingInfo rfi = { voi, states, rates, variables };\n" + " RootFindingInfo rfi = { voi, states, rates, constants, computedConstants, algebraic };\n" " double u[[SIZE]];\n" "\n" "[CODE]" @@ -388,7 +392,9 @@ TEST(GeneratorProfile, defaultMiscellaneousValues) generatorProfile->nlaSolveCallString(true)); EXPECT_EQ("void objectiveFunction[INDEX](double *u, double *f, void *data)\n" "{\n" - " double *variables = ((RootFindingInfo *) data)->variables;\n" + " double *constants = ((RootFindingInfo *) data)->constants;\n" + " double *computedConstants = ((RootFindingInfo *) data)->computedConstants;\n" + " double *algebraic = ((RootFindingInfo *) data)->algebraic;\n" "\n" "[CODE]" "}\n", @@ -398,7 +404,9 @@ TEST(GeneratorProfile, defaultMiscellaneousValues) " double voi = ((RootFindingInfo *) data)->voi;\n" " double *states = ((RootFindingInfo *) data)->states;\n" " double *rates = ((RootFindingInfo *) data)->rates;\n" - " double *variables = ((RootFindingInfo *) data)->variables;\n" + " double *constants = ((RootFindingInfo *) data)->constants;\n" + " double *computedConstants = ((RootFindingInfo *) data)->computedConstants;\n" + " double *algebraic = ((RootFindingInfo *) data)->algebraic;\n" "\n" "[CODE]" "}\n", diff --git a/tests/resources/coverage/generator/model.c b/tests/resources/coverage/generator/model.c index 0b2f0b53f8..cdfe71e116 100644 --- a/tests/resources/coverage/generator/model.c +++ b/tests/resources/coverage/generator/model.c @@ -371,7 +371,9 @@ typedef struct { double voi; double *states; double *rates; - double *variables; + double *constants; + double *computedConstants; + double *algebraic; } RootFindingInfo; extern void nlaSolve(void (*objectiveFunction)(double *, double *, void *), @@ -382,7 +384,9 @@ void objectiveFunction0(double *u, double *f, void *data) double voi = ((RootFindingInfo *) data)->voi; double *states = ((RootFindingInfo *) data)->states; double *rates = ((RootFindingInfo *) data)->rates; - double *variables = ((RootFindingInfo *) data)->variables; + double *constants = ((RootFindingInfo *) data)->constants; + double *computedConstants = ((RootFindingInfo *) data)->computedConstants; + double *algebraic = ((RootFindingInfo *) data)->algebraic; algebraic[0] = u[0]; algebraic[1] = u[1]; @@ -391,9 +395,9 @@ void objectiveFunction0(double *u, double *f, void *data) f[1] = algebraic[0]-algebraic[1]-(computedConstants[198]+computedConstants[199]); } -void findRoot0(double voi, double *states, double *rates, double *variables) +void findRoot0(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { - RootFindingInfo rfi = { voi, states, rates, variables }; + RootFindingInfo rfi = { voi, states, rates, constants, computedConstants, algebraic }; double u[2]; u[0] = algebraic[0]; @@ -630,5 +634,5 @@ void computeRates(double voi, double *states, double *rates, double *constants, void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { - findRoot0(voi, states, rates, variables); + findRoot0(voi, states, rates, constants, computedConstants, algebraic); } diff --git a/tests/resources/coverage/generator/model.implementation.out b/tests/resources/coverage/generator/model.implementation.out index 441505f7cd..c969013df1 100644 --- a/tests/resources/coverage/generator/model.implementation.out +++ b/tests/resources/coverage/generator/model.implementation.out @@ -134,7 +134,9 @@ typedef struct { double voi; double *states; double *rates; - double *variables; + double *constants; + double *computedConstants; + double *algebraic; } RootFindingInfo; extern void nlaSolve(void (*objectiveFunction)(double *, double *, void *), @@ -145,7 +147,9 @@ void objectiveFunction0(double *u, double *f, void *data) double voi = ((RootFindingInfo *) data)->voi; double *states = ((RootFindingInfo *) data)->states; double *rates = ((RootFindingInfo *) data)->rates; - double *variables = ((RootFindingInfo *) data)->variables; + double *constants = ((RootFindingInfo *) data)->constants; + double *computedConstants = ((RootFindingInfo *) data)->computedConstants; + double *algebraic = ((RootFindingInfo *) data)->algebraic; algebraic[0] = u[0]; algebraic[1] = u[1]; @@ -154,9 +158,9 @@ void objectiveFunction0(double *u, double *f, void *data) f[1] = algebraic[0]-algebraic[1]-(computedConstants[198]+computedConstants[199]); } -void findRoot0(double voi, double *states, double *rates, double *variables) +void findRoot0(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { - RootFindingInfo rfi = { voi, states, rates, variables }; + RootFindingInfo rfi = { voi, states, rates, constants, computedConstants, algebraic }; double u[2]; u[0] = algebraic[0]; @@ -393,5 +397,5 @@ void computeRates(double voi, double *states, double *rates, double *constants, void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { - findRoot0(voi, states, rates, variables); + findRoot0(voi, states, rates, constants, computedConstants, algebraic); } diff --git a/tests/resources/coverage/generator/model.modified.profile.c b/tests/resources/coverage/generator/model.modified.profile.c index 07afcc6afc..5c6e1d9fd6 100644 --- a/tests/resources/coverage/generator/model.modified.profile.c +++ b/tests/resources/coverage/generator/model.modified.profile.c @@ -371,7 +371,9 @@ typedef struct { double voi; double *states; double *rates; - double *variables; + double *constants; + double *computedConstants; + double *algebraic; } RootFindingInfo; extern void nlaSolve(void (*objectiveFunction)(double *, double *, void *), @@ -382,7 +384,9 @@ void objectiveFunction0(double *u, double *f, void *data) double voi = ((RootFindingInfo *) data)->voi; double *states = ((RootFindingInfo *) data)->states; double *rates = ((RootFindingInfo *) data)->rates; - double *variables = ((RootFindingInfo *) data)->variables; + double *constants = ((RootFindingInfo *) data)->constants; + double *computedConstants = ((RootFindingInfo *) data)->computedConstants; + double *algebraic = ((RootFindingInfo *) data)->algebraic; algebraic[0] = u[0]; algebraic[1] = u[1]; @@ -391,9 +395,9 @@ void objectiveFunction0(double *u, double *f, void *data) f[1] = algebraic[0]-algebraic[1]-(computedConstants[198]+computedConstants[199]); } -void findRoot0(double voi, double *states, double *rates, double *variables) +void findRoot0(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { - RootFindingInfo rfi = { voi, states, rates, variables }; + RootFindingInfo rfi = { voi, states, rates, constants, computedConstants, algebraic }; double u[2]; u[0] = algebraic[0]; @@ -630,5 +634,5 @@ void computeRates(double voi, double *states, double *rates, double *constants, void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { - findRoot0(voi, states, rates, variables); + findRoot0(voi, states, rates, constants, computedConstants, algebraic); } diff --git a/tests/resources/coverage/generator/model.modified.profile.py b/tests/resources/coverage/generator/model.modified.profile.py index 886bbb8b7e..4c224613dc 100644 --- a/tests/resources/coverage/generator/model.modified.profile.py +++ b/tests/resources/coverage/generator/model.modified.profile.py @@ -362,7 +362,9 @@ def objective_function_0(u, f, data): voi = data[0] states = data[1] rates = data[2] - variables = data[3] + constants = data[3] + computed_constants = data[4] + algebraic = data[5] algebraic[0] = u[0] algebraic[1] = u[1] @@ -371,13 +373,13 @@ def objective_function_0(u, f, data): f[1] = algebraic[0]-algebraic[1]-(computed_constants[198]+computed_constants[199]) -def find_root_0(voi, states, rates, variables): +def find_root_0(voi, states, rates, constants, computed_constants, algebraic): u = [nan]*2 u[0] = algebraic[0] u[1] = algebraic[1] - u = nla_solve(objective_function_0, u, 2, [voi, states, rates, variables]) + u = nla_solve(objective_function_0, u, 2, [voi, states, rates, constants, computed_constants, algebraic]) algebraic[0] = u[0] algebraic[1] = u[1] @@ -604,4 +606,4 @@ def compute_rates(voi, states, rates, constants, computed_constants, algebraic): def compute_variables(voi, states, rates, constants, computed_constants, algebraic): - find_root_0(voi, states, rates, variables) + find_root_0(voi, states, rates, constants, computed_constants, algebraic) diff --git a/tests/resources/coverage/generator/model.out b/tests/resources/coverage/generator/model.out index 3a2b4ea517..acd776c9fa 100644 --- a/tests/resources/coverage/generator/model.out +++ b/tests/resources/coverage/generator/model.out @@ -82,7 +82,9 @@ typedef struct { double voi; double *states; double *rates; - double *variables; + double *constants; + double *computedConstants; + double *algebraic; } RootFindingInfo; extern void nlaSolve(void (*objectiveFunction)(double *, double *, void *), @@ -93,7 +95,9 @@ void objectiveFunction0(double *u, double *f, void *data) double voi = ((RootFindingInfo *) data)->voi; double *states = ((RootFindingInfo *) data)->states; double *rates = ((RootFindingInfo *) data)->rates; - double *variables = ((RootFindingInfo *) data)->variables; + double *constants = ((RootFindingInfo *) data)->constants; + double *computedConstants = ((RootFindingInfo *) data)->computedConstants; + double *algebraic = ((RootFindingInfo *) data)->algebraic; algebraic[0] = u[0]; algebraic[1] = u[1]; @@ -102,9 +106,9 @@ void objectiveFunction0(double *u, double *f, void *data) f[1] = algebraic[0]-algebraic[1]-(computedConstants[198]+computedConstants[199]); } -void findRoot0(double voi, double *states, double *rates, double *variables) +void findRoot0(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { - RootFindingInfo rfi = { voi, states, rates, variables }; + RootFindingInfo rfi = { voi, states, rates, constants, computedConstants, algebraic }; double u[2]; u[0] = algebraic[0]; diff --git a/tests/resources/coverage/generator/model.py b/tests/resources/coverage/generator/model.py index 113504cbe3..779814e801 100644 --- a/tests/resources/coverage/generator/model.py +++ b/tests/resources/coverage/generator/model.py @@ -362,7 +362,9 @@ def objective_function_0(u, f, data): voi = data[0] states = data[1] rates = data[2] - variables = data[3] + constants = data[3] + computed_constants = data[4] + algebraic = data[5] algebraic[0] = u[0] algebraic[1] = u[1] @@ -371,13 +373,13 @@ def objective_function_0(u, f, data): f[1] = algebraic[0]-algebraic[1]-(computed_constants[198]+computed_constants[199]) -def find_root_0(voi, states, rates, variables): +def find_root_0(voi, states, rates, constants, computed_constants, algebraic): u = [nan]*2 u[0] = algebraic[0] u[1] = algebraic[1] - u = nla_solve(objective_function_0, u, 2, [voi, states, rates, variables]) + u = nla_solve(objective_function_0, u, 2, [voi, states, rates, constants, computed_constants, algebraic]) algebraic[0] = u[0] algebraic[1] = u[1] @@ -604,4 +606,4 @@ def compute_rates(voi, states, rates, constants, computed_constants, algebraic): def compute_variables(voi, states, rates, constants, computed_constants, algebraic): - find_root_0(voi, states, rates, variables) + find_root_0(voi, states, rates, constants, computed_constants, algebraic) diff --git a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.c b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.c index bd2b6cf187..1841f66b05 100644 --- a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.c +++ b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.c @@ -64,7 +64,9 @@ void deleteArray(double *array) } typedef struct { - double *variables; + double *constants; + double *computedConstants; + double *algebraic; } RootFindingInfo; extern void nlaSolve(void (*objectiveFunction)(double *, double *, void *), @@ -72,16 +74,18 @@ extern void nlaSolve(void (*objectiveFunction)(double *, double *, void *), void objectiveFunction0(double *u, double *f, void *data) { - double *variables = ((RootFindingInfo *) data)->variables; + double *constants = ((RootFindingInfo *) data)->constants; + double *computedConstants = ((RootFindingInfo *) data)->computedConstants; + double *algebraic = ((RootFindingInfo *) data)->algebraic; algebraic[0] = u[0]; f[0] = algebraic[0]+computedConstants[0]-(computedConstants[1]+computedConstants[2]); } -void findRoot0(double *variables) +void findRoot0(double *constants, double *computedConstants, double *algebraic) { - RootFindingInfo rfi = { variables }; + RootFindingInfo rfi = { constants, computedConstants, algebraic }; double u[1]; u[0] = algebraic[0]; @@ -105,5 +109,5 @@ void computeComputedConstants(double *constants, double *computedConstants) void computeVariables(double *constants, double *computedConstants, double *algebraic) { - findRoot0(variables); + findRoot0(constants, computedConstants, algebraic); } diff --git a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.py b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.py index 199da80a29..0e3d3346d9 100644 --- a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.py +++ b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.py @@ -41,19 +41,21 @@ def create_algebraic_array(): def objective_function_0(u, f, data): - variables = data[0] + constants = data[0] + computed_constants = data[1] + algebraic = data[2] algebraic[0] = u[0] f[0] = algebraic[0]+computed_constants[0]-(computed_constants[1]+computed_constants[2]) -def find_root_0(variables): +def find_root_0(constants, computed_constants, algebraic): u = [nan]*1 u[0] = algebraic[0] - u = nla_solve(objective_function_0, u, 1, [variables]) + u = nla_solve(objective_function_0, u, 1, [constants, computed_constants, algebraic]) algebraic[0] = u[0] @@ -70,4 +72,4 @@ def compute_computed_constants(constants, computed_constants): def compute_variables(constants, computed_constants, algebraic): - find_root_0(variables) + find_root_0(constants, computed_constants, algebraic) diff --git a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.c b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.c index f2362c8361..6d4d78db8c 100644 --- a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.c +++ b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.c @@ -63,7 +63,9 @@ void deleteArray(double *array) } typedef struct { - double *variables; + double *constants; + double *computedConstants; + double *algebraic; } RootFindingInfo; extern void nlaSolve(void (*objectiveFunction)(double *, double *, void *), @@ -71,7 +73,9 @@ extern void nlaSolve(void (*objectiveFunction)(double *, double *, void *), void objectiveFunction0(double *u, double *f, void *data) { - double *variables = ((RootFindingInfo *) data)->variables; + double *constants = ((RootFindingInfo *) data)->constants; + double *computedConstants = ((RootFindingInfo *) data)->computedConstants; + double *algebraic = ((RootFindingInfo *) data)->algebraic; algebraic[0] = u[0]; algebraic[1] = u[1]; @@ -82,9 +86,9 @@ void objectiveFunction0(double *u, double *f, void *data) f[2] = algebraic[0]-2.0*algebraic[1]+3.0*algebraic[2]-6.0; } -void findRoot0(double *variables) +void findRoot0(double *constants, double *computedConstants, double *algebraic) { - RootFindingInfo rfi = { variables }; + RootFindingInfo rfi = { constants, computedConstants, algebraic }; double u[3]; u[0] = algebraic[0]; @@ -111,5 +115,5 @@ void computeComputedConstants(double *constants, double *computedConstants) void computeVariables(double *constants, double *computedConstants, double *algebraic) { - findRoot0(variables); + findRoot0(constants, computedConstants, algebraic); } diff --git a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.py b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.py index 08b001bda7..64d9589228 100644 --- a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.py +++ b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.py @@ -40,7 +40,9 @@ def create_algebraic_array(): def objective_function_0(u, f, data): - variables = data[0] + constants = data[0] + computed_constants = data[1] + algebraic = data[2] algebraic[0] = u[0] algebraic[1] = u[1] @@ -51,14 +53,14 @@ def objective_function_0(u, f, data): f[2] = algebraic[0]-2.0*algebraic[1]+3.0*algebraic[2]-6.0 -def find_root_0(variables): +def find_root_0(constants, computed_constants, algebraic): u = [nan]*3 u[0] = algebraic[0] u[1] = algebraic[1] u[2] = algebraic[2] - u = nla_solve(objective_function_0, u, 3, [variables]) + u = nla_solve(objective_function_0, u, 3, [constants, computed_constants, algebraic]) algebraic[0] = u[0] algebraic[1] = u[1] @@ -76,4 +78,4 @@ def compute_computed_constants(constants, computed_constants): def compute_variables(constants, computed_constants, algebraic): - find_root_0(variables) + find_root_0(constants, computed_constants, algebraic) diff --git a/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.c b/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.c index eb6901bc61..c05b191458 100644 --- a/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.c +++ b/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.c @@ -66,7 +66,9 @@ void deleteArray(double *array) } typedef struct { - double *variables; + double *constants; + double *computedConstants; + double *algebraic; } RootFindingInfo; extern void nlaSolve(void (*objectiveFunction)(double *, double *, void *), @@ -74,7 +76,9 @@ extern void nlaSolve(void (*objectiveFunction)(double *, double *, void *), void objectiveFunction0(double *u, double *f, void *data) { - double *variables = ((RootFindingInfo *) data)->variables; + double *constants = ((RootFindingInfo *) data)->constants; + double *computedConstants = ((RootFindingInfo *) data)->computedConstants; + double *algebraic = ((RootFindingInfo *) data)->algebraic; algebraic[2] = u[0]; algebraic[1] = u[1]; @@ -83,9 +87,9 @@ void objectiveFunction0(double *u, double *f, void *data) f[1] = computedConstants[0]+3.0*algebraic[1]-algebraic[2]-19.0; } -void findRoot0(double *variables) +void findRoot0(double *constants, double *computedConstants, double *algebraic) { - RootFindingInfo rfi = { variables }; + RootFindingInfo rfi = { constants, computedConstants, algebraic }; double u[2]; u[0] = algebraic[2]; @@ -112,6 +116,6 @@ void computeComputedConstants(double *constants, double *computedConstants) void computeVariables(double *constants, double *computedConstants, double *algebraic) { - findRoot0(variables); + findRoot0(constants, computedConstants, algebraic); algebraic[0] = algebraic[1]+algebraic[2]; } diff --git a/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.py b/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.py index 31584bc6cc..9398a2d159 100644 --- a/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.py +++ b/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.py @@ -43,7 +43,9 @@ def create_algebraic_array(): def objective_function_0(u, f, data): - variables = data[0] + constants = data[0] + computed_constants = data[1] + algebraic = data[2] algebraic[2] = u[0] algebraic[1] = u[1] @@ -52,13 +54,13 @@ def objective_function_0(u, f, data): f[1] = computed_constants[0]+3.0*algebraic[1]-algebraic[2]-19.0 -def find_root_0(variables): +def find_root_0(constants, computed_constants, algebraic): u = [nan]*2 u[0] = algebraic[2] u[1] = algebraic[1] - u = nla_solve(objective_function_0, u, 2, [variables]) + u = nla_solve(objective_function_0, u, 2, [constants, computed_constants, algebraic]) algebraic[2] = u[0] algebraic[1] = u[1] @@ -76,5 +78,5 @@ def compute_computed_constants(constants, computed_constants): def compute_variables(constants, computed_constants, algebraic): - find_root_0(variables) + find_root_0(constants, computed_constants, algebraic) algebraic[0] = algebraic[1]+algebraic[2] diff --git a/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.c b/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.c index f446032296..81bb633963 100644 --- a/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.c +++ b/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.c @@ -66,7 +66,9 @@ void deleteArray(double *array) } typedef struct { - double *variables; + double *constants; + double *computedConstants; + double *algebraic; } RootFindingInfo; extern void nlaSolve(void (*objectiveFunction)(double *, double *, void *), @@ -74,7 +76,9 @@ extern void nlaSolve(void (*objectiveFunction)(double *, double *, void *), void objectiveFunction0(double *u, double *f, void *data) { - double *variables = ((RootFindingInfo *) data)->variables; + double *constants = ((RootFindingInfo *) data)->constants; + double *computedConstants = ((RootFindingInfo *) data)->computedConstants; + double *algebraic = ((RootFindingInfo *) data)->algebraic; algebraic[0] = u[0]; algebraic[1] = u[1]; @@ -83,9 +87,9 @@ void objectiveFunction0(double *u, double *f, void *data) f[1] = computedConstants[0]+3.0*algebraic[1]-algebraic[0]-19.0; } -void findRoot0(double *variables) +void findRoot0(double *constants, double *computedConstants, double *algebraic) { - RootFindingInfo rfi = { variables }; + RootFindingInfo rfi = { constants, computedConstants, algebraic }; double u[2]; u[0] = algebraic[0]; @@ -112,6 +116,6 @@ void computeComputedConstants(double *constants, double *computedConstants) void computeVariables(double *constants, double *computedConstants, double *algebraic) { - findRoot0(variables); + findRoot0(constants, computedConstants, algebraic); algebraic[2] = algebraic[1]+algebraic[0]; } diff --git a/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.py b/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.py index 7cc2478a0a..780f9aac86 100644 --- a/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.py +++ b/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.py @@ -43,7 +43,9 @@ def create_algebraic_array(): def objective_function_0(u, f, data): - variables = data[0] + constants = data[0] + computed_constants = data[1] + algebraic = data[2] algebraic[0] = u[0] algebraic[1] = u[1] @@ -52,13 +54,13 @@ def objective_function_0(u, f, data): f[1] = computed_constants[0]+3.0*algebraic[1]-algebraic[0]-19.0 -def find_root_0(variables): +def find_root_0(constants, computed_constants, algebraic): u = [nan]*2 u[0] = algebraic[0] u[1] = algebraic[1] - u = nla_solve(objective_function_0, u, 2, [variables]) + u = nla_solve(objective_function_0, u, 2, [constants, computed_constants, algebraic]) algebraic[0] = u[0] algebraic[1] = u[1] @@ -76,5 +78,5 @@ def compute_computed_constants(constants, computed_constants): def compute_variables(constants, computed_constants, algebraic): - find_root_0(variables) + find_root_0(constants, computed_constants, algebraic) algebraic[2] = algebraic[1]+algebraic[0] diff --git a/tests/resources/generator/dae_cellml_1_1_model/model.c b/tests/resources/generator/dae_cellml_1_1_model/model.c index 6b0819a99f..95913f3226 100644 --- a/tests/resources/generator/dae_cellml_1_1_model/model.c +++ b/tests/resources/generator/dae_cellml_1_1_model/model.c @@ -92,7 +92,9 @@ typedef struct { double voi; double *states; double *rates; - double *variables; + double *constants; + double *computedConstants; + double *algebraic; } RootFindingInfo; extern void nlaSolve(void (*objectiveFunction)(double *, double *, void *), @@ -103,16 +105,18 @@ void objectiveFunction0(double *u, double *f, void *data) double voi = ((RootFindingInfo *) data)->voi; double *states = ((RootFindingInfo *) data)->states; double *rates = ((RootFindingInfo *) data)->rates; - double *variables = ((RootFindingInfo *) data)->variables; + double *constants = ((RootFindingInfo *) data)->constants; + double *computedConstants = ((RootFindingInfo *) data)->computedConstants; + double *algebraic = ((RootFindingInfo *) data)->algebraic; algebraic[0] = u[0]; f[0] = constants[0]-(algebraic[0]+algebraic[1]); } -void findRoot0(double voi, double *states, double *rates, double *variables) +void findRoot0(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { - RootFindingInfo rfi = { voi, states, rates, variables }; + RootFindingInfo rfi = { voi, states, rates, constants, computedConstants, algebraic }; double u[1]; u[0] = algebraic[0]; @@ -127,16 +131,18 @@ void objectiveFunction1(double *u, double *f, void *data) double voi = ((RootFindingInfo *) data)->voi; double *states = ((RootFindingInfo *) data)->states; double *rates = ((RootFindingInfo *) data)->rates; - double *variables = ((RootFindingInfo *) data)->variables; + double *constants = ((RootFindingInfo *) data)->constants; + double *computedConstants = ((RootFindingInfo *) data)->computedConstants; + double *algebraic = ((RootFindingInfo *) data)->algebraic; algebraic[4] = u[0]; f[0] = algebraic[2]-(algebraic[3]+algebraic[4]); } -void findRoot1(double voi, double *states, double *rates, double *variables) +void findRoot1(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { - RootFindingInfo rfi = { voi, states, rates, variables }; + RootFindingInfo rfi = { voi, states, rates, constants, computedConstants, algebraic }; double u[1]; u[0] = algebraic[4]; @@ -166,19 +172,19 @@ void computeComputedConstants(double *constants, double *computedConstants) void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { algebraic[1] = states[1]+constants[1]; - findRoot0(voi, states, rates, variables); + findRoot0(voi, states, rates, constants, computedConstants, algebraic); rates[0] = algebraic[0]; algebraic[2] = states[0]/constants[2]; algebraic[3] = constants[3]*algebraic[1]; - findRoot1(voi, states, rates, variables); + findRoot1(voi, states, rates, constants, computedConstants, algebraic); rates[1] = algebraic[4]/constants[4]; } void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { algebraic[1] = states[1]+constants[1]; - findRoot0(voi, states, rates, variables); + findRoot0(voi, states, rates, constants, computedConstants, algebraic); algebraic[2] = states[0]/constants[2]; algebraic[3] = constants[3]*algebraic[1]; - findRoot1(voi, states, rates, variables); + findRoot1(voi, states, rates, constants, computedConstants, algebraic); } diff --git a/tests/resources/generator/dae_cellml_1_1_model/model.py b/tests/resources/generator/dae_cellml_1_1_model/model.py index ef14cb9e3d..f53382f0fd 100644 --- a/tests/resources/generator/dae_cellml_1_1_model/model.py +++ b/tests/resources/generator/dae_cellml_1_1_model/model.py @@ -62,19 +62,21 @@ def objective_function_0(u, f, data): voi = data[0] states = data[1] rates = data[2] - variables = data[3] + constants = data[3] + computed_constants = data[4] + algebraic = data[5] algebraic[0] = u[0] f[0] = constants[0]-(algebraic[0]+algebraic[1]) -def find_root_0(voi, states, rates, variables): +def find_root_0(voi, states, rates, constants, computed_constants, algebraic): u = [nan]*1 u[0] = algebraic[0] - u = nla_solve(objective_function_0, u, 1, [voi, states, rates, variables]) + u = nla_solve(objective_function_0, u, 1, [voi, states, rates, constants, computed_constants, algebraic]) algebraic[0] = u[0] @@ -83,19 +85,21 @@ def objective_function_1(u, f, data): voi = data[0] states = data[1] rates = data[2] - variables = data[3] + constants = data[3] + computed_constants = data[4] + algebraic = data[5] algebraic[4] = u[0] f[0] = algebraic[2]-(algebraic[3]+algebraic[4]) -def find_root_1(voi, states, rates, variables): +def find_root_1(voi, states, rates, constants, computed_constants, algebraic): u = [nan]*1 u[0] = algebraic[4] - u = nla_solve(objective_function_1, u, 1, [voi, states, rates, variables]) + u = nla_solve(objective_function_1, u, 1, [voi, states, rates, constants, computed_constants, algebraic]) algebraic[4] = u[0] @@ -118,17 +122,17 @@ def compute_computed_constants(constants, computed_constants): def compute_rates(voi, states, rates, constants, computed_constants, algebraic): algebraic[1] = states[1]+constants[1] - find_root_0(voi, states, rates, variables) + find_root_0(voi, states, rates, constants, computed_constants, algebraic) rates[0] = algebraic[0] algebraic[2] = states[0]/constants[2] algebraic[3] = constants[3]*algebraic[1] - find_root_1(voi, states, rates, variables) + find_root_1(voi, states, rates, constants, computed_constants, algebraic) rates[1] = algebraic[4]/constants[4] def compute_variables(voi, states, rates, constants, computed_constants, algebraic): algebraic[1] = states[1]+constants[1] - find_root_0(voi, states, rates, variables) + find_root_0(voi, states, rates, constants, computed_constants, algebraic) algebraic[2] = states[0]/constants[2] algebraic[3] = constants[3]*algebraic[1] - find_root_1(voi, states, rates, variables) + find_root_1(voi, states, rates, constants, computed_constants, algebraic) diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.c index a940fe5cf3..256bce34c1 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.c @@ -102,7 +102,9 @@ typedef struct { double voi; double *states; double *rates; - double *variables; + double *constants; + double *computedConstants; + double *algebraic; } RootFindingInfo; extern void nlaSolve(void (*objectiveFunction)(double *, double *, void *), @@ -113,16 +115,18 @@ void objectiveFunction0(double *u, double *f, void *data) double voi = ((RootFindingInfo *) data)->voi; double *states = ((RootFindingInfo *) data)->states; double *rates = ((RootFindingInfo *) data)->rates; - double *variables = ((RootFindingInfo *) data)->variables; + double *constants = ((RootFindingInfo *) data)->constants; + double *computedConstants = ((RootFindingInfo *) data)->computedConstants; + double *algebraic = ((RootFindingInfo *) data)->algebraic; algebraic[0] = u[0]; f[0] = algebraic[0]-(((voi >= 10.0) && (voi <= 10.5))?-20.0:0.0)-0.0; } -void findRoot0(double voi, double *states, double *rates, double *variables) +void findRoot0(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { - RootFindingInfo rfi = { voi, states, rates, variables }; + RootFindingInfo rfi = { voi, states, rates, constants, computedConstants, algebraic }; double u[1]; u[0] = algebraic[0]; @@ -137,16 +141,18 @@ void objectiveFunction1(double *u, double *f, void *data) double voi = ((RootFindingInfo *) data)->voi; double *states = ((RootFindingInfo *) data)->states; double *rates = ((RootFindingInfo *) data)->rates; - double *variables = ((RootFindingInfo *) data)->variables; + double *constants = ((RootFindingInfo *) data)->constants; + double *computedConstants = ((RootFindingInfo *) data)->computedConstants; + double *algebraic = ((RootFindingInfo *) data)->algebraic; rates[0] = u[0]; f[0] = rates[0]-(-(-algebraic[0]+algebraic[3]+algebraic[2]+algebraic[1])/constants[0])-0.0; } -void findRoot1(double voi, double *states, double *rates, double *variables) +void findRoot1(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { - RootFindingInfo rfi = { voi, states, rates, variables }; + RootFindingInfo rfi = { voi, states, rates, constants, computedConstants, algebraic }; double u[1]; u[0] = rates[0]; @@ -161,16 +167,18 @@ void objectiveFunction2(double *u, double *f, void *data) double voi = ((RootFindingInfo *) data)->voi; double *states = ((RootFindingInfo *) data)->states; double *rates = ((RootFindingInfo *) data)->rates; - double *variables = ((RootFindingInfo *) data)->variables; + double *constants = ((RootFindingInfo *) data)->constants; + double *computedConstants = ((RootFindingInfo *) data)->computedConstants; + double *algebraic = ((RootFindingInfo *) data)->algebraic; algebraic[4] = u[0]; f[0] = algebraic[4]-(constants[1]-10.613)-0.0; } -void findRoot2(double voi, double *states, double *rates, double *variables) +void findRoot2(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { - RootFindingInfo rfi = { voi, states, rates, variables }; + RootFindingInfo rfi = { voi, states, rates, constants, computedConstants, algebraic }; double u[1]; u[0] = algebraic[4]; @@ -185,16 +193,18 @@ void objectiveFunction3(double *u, double *f, void *data) double voi = ((RootFindingInfo *) data)->voi; double *states = ((RootFindingInfo *) data)->states; double *rates = ((RootFindingInfo *) data)->rates; - double *variables = ((RootFindingInfo *) data)->variables; + double *constants = ((RootFindingInfo *) data)->constants; + double *computedConstants = ((RootFindingInfo *) data)->computedConstants; + double *algebraic = ((RootFindingInfo *) data)->algebraic; algebraic[1] = u[0]; f[0] = algebraic[1]-constants[2]*(states[0]-algebraic[4])-0.0; } -void findRoot3(double voi, double *states, double *rates, double *variables) +void findRoot3(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { - RootFindingInfo rfi = { voi, states, rates, variables }; + RootFindingInfo rfi = { voi, states, rates, constants, computedConstants, algebraic }; double u[1]; u[0] = algebraic[1]; @@ -209,16 +219,18 @@ void objectiveFunction4(double *u, double *f, void *data) double voi = ((RootFindingInfo *) data)->voi; double *states = ((RootFindingInfo *) data)->states; double *rates = ((RootFindingInfo *) data)->rates; - double *variables = ((RootFindingInfo *) data)->variables; + double *constants = ((RootFindingInfo *) data)->constants; + double *computedConstants = ((RootFindingInfo *) data)->computedConstants; + double *algebraic = ((RootFindingInfo *) data)->algebraic; algebraic[5] = u[0]; f[0] = algebraic[5]-(constants[1]-115.0)-0.0; } -void findRoot4(double voi, double *states, double *rates, double *variables) +void findRoot4(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { - RootFindingInfo rfi = { voi, states, rates, variables }; + RootFindingInfo rfi = { voi, states, rates, constants, computedConstants, algebraic }; double u[1]; u[0] = algebraic[5]; @@ -233,16 +245,18 @@ void objectiveFunction5(double *u, double *f, void *data) double voi = ((RootFindingInfo *) data)->voi; double *states = ((RootFindingInfo *) data)->states; double *rates = ((RootFindingInfo *) data)->rates; - double *variables = ((RootFindingInfo *) data)->variables; + double *constants = ((RootFindingInfo *) data)->constants; + double *computedConstants = ((RootFindingInfo *) data)->computedConstants; + double *algebraic = ((RootFindingInfo *) data)->algebraic; algebraic[3] = u[0]; f[0] = algebraic[3]-constants[3]*pow(states[2], 3.0)*states[1]*(states[0]-algebraic[5])-0.0; } -void findRoot5(double voi, double *states, double *rates, double *variables) +void findRoot5(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { - RootFindingInfo rfi = { voi, states, rates, variables }; + RootFindingInfo rfi = { voi, states, rates, constants, computedConstants, algebraic }; double u[1]; u[0] = algebraic[3]; @@ -257,16 +271,18 @@ void objectiveFunction6(double *u, double *f, void *data) double voi = ((RootFindingInfo *) data)->voi; double *states = ((RootFindingInfo *) data)->states; double *rates = ((RootFindingInfo *) data)->rates; - double *variables = ((RootFindingInfo *) data)->variables; + double *constants = ((RootFindingInfo *) data)->constants; + double *computedConstants = ((RootFindingInfo *) data)->computedConstants; + double *algebraic = ((RootFindingInfo *) data)->algebraic; algebraic[6] = u[0]; f[0] = algebraic[6]-0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0)-0.0; } -void findRoot6(double voi, double *states, double *rates, double *variables) +void findRoot6(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { - RootFindingInfo rfi = { voi, states, rates, variables }; + RootFindingInfo rfi = { voi, states, rates, constants, computedConstants, algebraic }; double u[1]; u[0] = algebraic[6]; @@ -281,16 +297,18 @@ void objectiveFunction7(double *u, double *f, void *data) double voi = ((RootFindingInfo *) data)->voi; double *states = ((RootFindingInfo *) data)->states; double *rates = ((RootFindingInfo *) data)->rates; - double *variables = ((RootFindingInfo *) data)->variables; + double *constants = ((RootFindingInfo *) data)->constants; + double *computedConstants = ((RootFindingInfo *) data)->computedConstants; + double *algebraic = ((RootFindingInfo *) data)->algebraic; algebraic[7] = u[0]; f[0] = algebraic[7]-4.0*exp(states[0]/18.0)-0.0; } -void findRoot7(double voi, double *states, double *rates, double *variables) +void findRoot7(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { - RootFindingInfo rfi = { voi, states, rates, variables }; + RootFindingInfo rfi = { voi, states, rates, constants, computedConstants, algebraic }; double u[1]; u[0] = algebraic[7]; @@ -305,16 +323,18 @@ void objectiveFunction8(double *u, double *f, void *data) double voi = ((RootFindingInfo *) data)->voi; double *states = ((RootFindingInfo *) data)->states; double *rates = ((RootFindingInfo *) data)->rates; - double *variables = ((RootFindingInfo *) data)->variables; + double *constants = ((RootFindingInfo *) data)->constants; + double *computedConstants = ((RootFindingInfo *) data)->computedConstants; + double *algebraic = ((RootFindingInfo *) data)->algebraic; rates[2] = u[0]; f[0] = rates[2]-(algebraic[6]*(1.0-states[2])-algebraic[7]*states[2])-0.0; } -void findRoot8(double voi, double *states, double *rates, double *variables) +void findRoot8(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { - RootFindingInfo rfi = { voi, states, rates, variables }; + RootFindingInfo rfi = { voi, states, rates, constants, computedConstants, algebraic }; double u[1]; u[0] = rates[2]; @@ -329,16 +349,18 @@ void objectiveFunction9(double *u, double *f, void *data) double voi = ((RootFindingInfo *) data)->voi; double *states = ((RootFindingInfo *) data)->states; double *rates = ((RootFindingInfo *) data)->rates; - double *variables = ((RootFindingInfo *) data)->variables; + double *constants = ((RootFindingInfo *) data)->constants; + double *computedConstants = ((RootFindingInfo *) data)->computedConstants; + double *algebraic = ((RootFindingInfo *) data)->algebraic; algebraic[8] = u[0]; f[0] = algebraic[8]-0.07*exp(states[0]/20.0)-0.0; } -void findRoot9(double voi, double *states, double *rates, double *variables) +void findRoot9(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { - RootFindingInfo rfi = { voi, states, rates, variables }; + RootFindingInfo rfi = { voi, states, rates, constants, computedConstants, algebraic }; double u[1]; u[0] = algebraic[8]; @@ -353,16 +375,18 @@ void objectiveFunction10(double *u, double *f, void *data) double voi = ((RootFindingInfo *) data)->voi; double *states = ((RootFindingInfo *) data)->states; double *rates = ((RootFindingInfo *) data)->rates; - double *variables = ((RootFindingInfo *) data)->variables; + double *constants = ((RootFindingInfo *) data)->constants; + double *computedConstants = ((RootFindingInfo *) data)->computedConstants; + double *algebraic = ((RootFindingInfo *) data)->algebraic; algebraic[9] = u[0]; f[0] = algebraic[9]-1.0/(exp((states[0]+30.0)/10.0)+1.0)-0.0; } -void findRoot10(double voi, double *states, double *rates, double *variables) +void findRoot10(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { - RootFindingInfo rfi = { voi, states, rates, variables }; + RootFindingInfo rfi = { voi, states, rates, constants, computedConstants, algebraic }; double u[1]; u[0] = algebraic[9]; @@ -377,16 +401,18 @@ void objectiveFunction11(double *u, double *f, void *data) double voi = ((RootFindingInfo *) data)->voi; double *states = ((RootFindingInfo *) data)->states; double *rates = ((RootFindingInfo *) data)->rates; - double *variables = ((RootFindingInfo *) data)->variables; + double *constants = ((RootFindingInfo *) data)->constants; + double *computedConstants = ((RootFindingInfo *) data)->computedConstants; + double *algebraic = ((RootFindingInfo *) data)->algebraic; rates[1] = u[0]; f[0] = rates[1]-(algebraic[8]*(1.0-states[1])-algebraic[9]*states[1])-0.0; } -void findRoot11(double voi, double *states, double *rates, double *variables) +void findRoot11(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { - RootFindingInfo rfi = { voi, states, rates, variables }; + RootFindingInfo rfi = { voi, states, rates, constants, computedConstants, algebraic }; double u[1]; u[0] = rates[1]; @@ -401,16 +427,18 @@ void objectiveFunction12(double *u, double *f, void *data) double voi = ((RootFindingInfo *) data)->voi; double *states = ((RootFindingInfo *) data)->states; double *rates = ((RootFindingInfo *) data)->rates; - double *variables = ((RootFindingInfo *) data)->variables; + double *constants = ((RootFindingInfo *) data)->constants; + double *computedConstants = ((RootFindingInfo *) data)->computedConstants; + double *algebraic = ((RootFindingInfo *) data)->algebraic; algebraic[10] = u[0]; f[0] = algebraic[10]-(constants[1]+12.0)-0.0; } -void findRoot12(double voi, double *states, double *rates, double *variables) +void findRoot12(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { - RootFindingInfo rfi = { voi, states, rates, variables }; + RootFindingInfo rfi = { voi, states, rates, constants, computedConstants, algebraic }; double u[1]; u[0] = algebraic[10]; @@ -425,16 +453,18 @@ void objectiveFunction13(double *u, double *f, void *data) double voi = ((RootFindingInfo *) data)->voi; double *states = ((RootFindingInfo *) data)->states; double *rates = ((RootFindingInfo *) data)->rates; - double *variables = ((RootFindingInfo *) data)->variables; + double *constants = ((RootFindingInfo *) data)->constants; + double *computedConstants = ((RootFindingInfo *) data)->computedConstants; + double *algebraic = ((RootFindingInfo *) data)->algebraic; algebraic[2] = u[0]; f[0] = algebraic[2]-constants[4]*pow(states[3], 4.0)*(states[0]-algebraic[10])-0.0; } -void findRoot13(double voi, double *states, double *rates, double *variables) +void findRoot13(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { - RootFindingInfo rfi = { voi, states, rates, variables }; + RootFindingInfo rfi = { voi, states, rates, constants, computedConstants, algebraic }; double u[1]; u[0] = algebraic[2]; @@ -449,16 +479,18 @@ void objectiveFunction14(double *u, double *f, void *data) double voi = ((RootFindingInfo *) data)->voi; double *states = ((RootFindingInfo *) data)->states; double *rates = ((RootFindingInfo *) data)->rates; - double *variables = ((RootFindingInfo *) data)->variables; + double *constants = ((RootFindingInfo *) data)->constants; + double *computedConstants = ((RootFindingInfo *) data)->computedConstants; + double *algebraic = ((RootFindingInfo *) data)->algebraic; algebraic[11] = u[0]; f[0] = algebraic[11]-0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0)-0.0; } -void findRoot14(double voi, double *states, double *rates, double *variables) +void findRoot14(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { - RootFindingInfo rfi = { voi, states, rates, variables }; + RootFindingInfo rfi = { voi, states, rates, constants, computedConstants, algebraic }; double u[1]; u[0] = algebraic[11]; @@ -473,16 +505,18 @@ void objectiveFunction15(double *u, double *f, void *data) double voi = ((RootFindingInfo *) data)->voi; double *states = ((RootFindingInfo *) data)->states; double *rates = ((RootFindingInfo *) data)->rates; - double *variables = ((RootFindingInfo *) data)->variables; + double *constants = ((RootFindingInfo *) data)->constants; + double *computedConstants = ((RootFindingInfo *) data)->computedConstants; + double *algebraic = ((RootFindingInfo *) data)->algebraic; algebraic[12] = u[0]; f[0] = algebraic[12]-0.125*exp(states[0]/80.0)-0.0; } -void findRoot15(double voi, double *states, double *rates, double *variables) +void findRoot15(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { - RootFindingInfo rfi = { voi, states, rates, variables }; + RootFindingInfo rfi = { voi, states, rates, constants, computedConstants, algebraic }; double u[1]; u[0] = algebraic[12]; @@ -497,16 +531,18 @@ void objectiveFunction16(double *u, double *f, void *data) double voi = ((RootFindingInfo *) data)->voi; double *states = ((RootFindingInfo *) data)->states; double *rates = ((RootFindingInfo *) data)->rates; - double *variables = ((RootFindingInfo *) data)->variables; + double *constants = ((RootFindingInfo *) data)->constants; + double *computedConstants = ((RootFindingInfo *) data)->computedConstants; + double *algebraic = ((RootFindingInfo *) data)->algebraic; rates[3] = u[0]; f[0] = rates[3]-(algebraic[11]*(1.0-states[3])-algebraic[12]*states[3])-0.0; } -void findRoot16(double voi, double *states, double *rates, double *variables) +void findRoot16(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { - RootFindingInfo rfi = { voi, states, rates, variables }; + RootFindingInfo rfi = { voi, states, rates, constants, computedConstants, algebraic }; double u[1]; u[0] = rates[3]; @@ -552,42 +588,42 @@ void computeComputedConstants(double *constants, double *computedConstants) void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { - findRoot0(voi, states, rates, variables); - findRoot2(voi, states, rates, variables); - findRoot3(voi, states, rates, variables); - findRoot14(voi, states, rates, variables); - findRoot15(voi, states, rates, variables); - findRoot16(voi, states, rates, variables); - findRoot12(voi, states, rates, variables); - findRoot13(voi, states, rates, variables); - findRoot9(voi, states, rates, variables); - findRoot10(voi, states, rates, variables); - findRoot11(voi, states, rates, variables); - findRoot6(voi, states, rates, variables); - findRoot7(voi, states, rates, variables); - findRoot8(voi, states, rates, variables); - findRoot4(voi, states, rates, variables); - findRoot5(voi, states, rates, variables); - findRoot1(voi, states, rates, variables); + findRoot0(voi, states, rates, constants, computedConstants, algebraic); + findRoot2(voi, states, rates, constants, computedConstants, algebraic); + findRoot3(voi, states, rates, constants, computedConstants, algebraic); + findRoot14(voi, states, rates, constants, computedConstants, algebraic); + findRoot15(voi, states, rates, constants, computedConstants, algebraic); + findRoot16(voi, states, rates, constants, computedConstants, algebraic); + findRoot12(voi, states, rates, constants, computedConstants, algebraic); + findRoot13(voi, states, rates, constants, computedConstants, algebraic); + findRoot9(voi, states, rates, constants, computedConstants, algebraic); + findRoot10(voi, states, rates, constants, computedConstants, algebraic); + findRoot11(voi, states, rates, constants, computedConstants, algebraic); + findRoot6(voi, states, rates, constants, computedConstants, algebraic); + findRoot7(voi, states, rates, constants, computedConstants, algebraic); + findRoot8(voi, states, rates, constants, computedConstants, algebraic); + findRoot4(voi, states, rates, constants, computedConstants, algebraic); + findRoot5(voi, states, rates, constants, computedConstants, algebraic); + findRoot1(voi, states, rates, constants, computedConstants, algebraic); } void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { - findRoot0(voi, states, rates, variables); - findRoot2(voi, states, rates, variables); - findRoot3(voi, states, rates, variables); - findRoot14(voi, states, rates, variables); - findRoot15(voi, states, rates, variables); - findRoot16(voi, states, rates, variables); - findRoot12(voi, states, rates, variables); - findRoot13(voi, states, rates, variables); - findRoot9(voi, states, rates, variables); - findRoot10(voi, states, rates, variables); - findRoot11(voi, states, rates, variables); - findRoot6(voi, states, rates, variables); - findRoot7(voi, states, rates, variables); - findRoot8(voi, states, rates, variables); - findRoot4(voi, states, rates, variables); - findRoot5(voi, states, rates, variables); - findRoot1(voi, states, rates, variables); + findRoot0(voi, states, rates, constants, computedConstants, algebraic); + findRoot2(voi, states, rates, constants, computedConstants, algebraic); + findRoot3(voi, states, rates, constants, computedConstants, algebraic); + findRoot14(voi, states, rates, constants, computedConstants, algebraic); + findRoot15(voi, states, rates, constants, computedConstants, algebraic); + findRoot16(voi, states, rates, constants, computedConstants, algebraic); + findRoot12(voi, states, rates, constants, computedConstants, algebraic); + findRoot13(voi, states, rates, constants, computedConstants, algebraic); + findRoot9(voi, states, rates, constants, computedConstants, algebraic); + findRoot10(voi, states, rates, constants, computedConstants, algebraic); + findRoot11(voi, states, rates, constants, computedConstants, algebraic); + findRoot6(voi, states, rates, constants, computedConstants, algebraic); + findRoot7(voi, states, rates, constants, computedConstants, algebraic); + findRoot8(voi, states, rates, constants, computedConstants, algebraic); + findRoot4(voi, states, rates, constants, computedConstants, algebraic); + findRoot5(voi, states, rates, constants, computedConstants, algebraic); + findRoot1(voi, states, rates, constants, computedConstants, algebraic); } diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.py index 9d57d7855a..90843ccc6a 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.py @@ -84,19 +84,21 @@ def objective_function_0(u, f, data): voi = data[0] states = data[1] rates = data[2] - variables = data[3] + constants = data[3] + computed_constants = data[4] + algebraic = data[5] algebraic[0] = u[0] f[0] = algebraic[0]-(-20.0 if and_func(geq_func(voi, 10.0), leq_func(voi, 10.5)) else 0.0)-0.0 -def find_root_0(voi, states, rates, variables): +def find_root_0(voi, states, rates, constants, computed_constants, algebraic): u = [nan]*1 u[0] = algebraic[0] - u = nla_solve(objective_function_0, u, 1, [voi, states, rates, variables]) + u = nla_solve(objective_function_0, u, 1, [voi, states, rates, constants, computed_constants, algebraic]) algebraic[0] = u[0] @@ -105,19 +107,21 @@ def objective_function_1(u, f, data): voi = data[0] states = data[1] rates = data[2] - variables = data[3] + constants = data[3] + computed_constants = data[4] + algebraic = data[5] rates[0] = u[0] f[0] = rates[0]-(-(-algebraic[0]+algebraic[3]+algebraic[2]+algebraic[1])/constants[0])-0.0 -def find_root_1(voi, states, rates, variables): +def find_root_1(voi, states, rates, constants, computed_constants, algebraic): u = [nan]*1 u[0] = rates[0] - u = nla_solve(objective_function_1, u, 1, [voi, states, rates, variables]) + u = nla_solve(objective_function_1, u, 1, [voi, states, rates, constants, computed_constants, algebraic]) rates[0] = u[0] @@ -126,19 +130,21 @@ def objective_function_2(u, f, data): voi = data[0] states = data[1] rates = data[2] - variables = data[3] + constants = data[3] + computed_constants = data[4] + algebraic = data[5] algebraic[4] = u[0] f[0] = algebraic[4]-(constants[1]-10.613)-0.0 -def find_root_2(voi, states, rates, variables): +def find_root_2(voi, states, rates, constants, computed_constants, algebraic): u = [nan]*1 u[0] = algebraic[4] - u = nla_solve(objective_function_2, u, 1, [voi, states, rates, variables]) + u = nla_solve(objective_function_2, u, 1, [voi, states, rates, constants, computed_constants, algebraic]) algebraic[4] = u[0] @@ -147,19 +153,21 @@ def objective_function_3(u, f, data): voi = data[0] states = data[1] rates = data[2] - variables = data[3] + constants = data[3] + computed_constants = data[4] + algebraic = data[5] algebraic[1] = u[0] f[0] = algebraic[1]-constants[2]*(states[0]-algebraic[4])-0.0 -def find_root_3(voi, states, rates, variables): +def find_root_3(voi, states, rates, constants, computed_constants, algebraic): u = [nan]*1 u[0] = algebraic[1] - u = nla_solve(objective_function_3, u, 1, [voi, states, rates, variables]) + u = nla_solve(objective_function_3, u, 1, [voi, states, rates, constants, computed_constants, algebraic]) algebraic[1] = u[0] @@ -168,19 +176,21 @@ def objective_function_4(u, f, data): voi = data[0] states = data[1] rates = data[2] - variables = data[3] + constants = data[3] + computed_constants = data[4] + algebraic = data[5] algebraic[5] = u[0] f[0] = algebraic[5]-(constants[1]-115.0)-0.0 -def find_root_4(voi, states, rates, variables): +def find_root_4(voi, states, rates, constants, computed_constants, algebraic): u = [nan]*1 u[0] = algebraic[5] - u = nla_solve(objective_function_4, u, 1, [voi, states, rates, variables]) + u = nla_solve(objective_function_4, u, 1, [voi, states, rates, constants, computed_constants, algebraic]) algebraic[5] = u[0] @@ -189,19 +199,21 @@ def objective_function_5(u, f, data): voi = data[0] states = data[1] rates = data[2] - variables = data[3] + constants = data[3] + computed_constants = data[4] + algebraic = data[5] algebraic[3] = u[0] f[0] = algebraic[3]-constants[3]*pow(states[2], 3.0)*states[1]*(states[0]-algebraic[5])-0.0 -def find_root_5(voi, states, rates, variables): +def find_root_5(voi, states, rates, constants, computed_constants, algebraic): u = [nan]*1 u[0] = algebraic[3] - u = nla_solve(objective_function_5, u, 1, [voi, states, rates, variables]) + u = nla_solve(objective_function_5, u, 1, [voi, states, rates, constants, computed_constants, algebraic]) algebraic[3] = u[0] @@ -210,19 +222,21 @@ def objective_function_6(u, f, data): voi = data[0] states = data[1] rates = data[2] - variables = data[3] + constants = data[3] + computed_constants = data[4] + algebraic = data[5] algebraic[6] = u[0] f[0] = algebraic[6]-0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0)-0.0 -def find_root_6(voi, states, rates, variables): +def find_root_6(voi, states, rates, constants, computed_constants, algebraic): u = [nan]*1 u[0] = algebraic[6] - u = nla_solve(objective_function_6, u, 1, [voi, states, rates, variables]) + u = nla_solve(objective_function_6, u, 1, [voi, states, rates, constants, computed_constants, algebraic]) algebraic[6] = u[0] @@ -231,19 +245,21 @@ def objective_function_7(u, f, data): voi = data[0] states = data[1] rates = data[2] - variables = data[3] + constants = data[3] + computed_constants = data[4] + algebraic = data[5] algebraic[7] = u[0] f[0] = algebraic[7]-4.0*exp(states[0]/18.0)-0.0 -def find_root_7(voi, states, rates, variables): +def find_root_7(voi, states, rates, constants, computed_constants, algebraic): u = [nan]*1 u[0] = algebraic[7] - u = nla_solve(objective_function_7, u, 1, [voi, states, rates, variables]) + u = nla_solve(objective_function_7, u, 1, [voi, states, rates, constants, computed_constants, algebraic]) algebraic[7] = u[0] @@ -252,19 +268,21 @@ def objective_function_8(u, f, data): voi = data[0] states = data[1] rates = data[2] - variables = data[3] + constants = data[3] + computed_constants = data[4] + algebraic = data[5] rates[2] = u[0] f[0] = rates[2]-(algebraic[6]*(1.0-states[2])-algebraic[7]*states[2])-0.0 -def find_root_8(voi, states, rates, variables): +def find_root_8(voi, states, rates, constants, computed_constants, algebraic): u = [nan]*1 u[0] = rates[2] - u = nla_solve(objective_function_8, u, 1, [voi, states, rates, variables]) + u = nla_solve(objective_function_8, u, 1, [voi, states, rates, constants, computed_constants, algebraic]) rates[2] = u[0] @@ -273,19 +291,21 @@ def objective_function_9(u, f, data): voi = data[0] states = data[1] rates = data[2] - variables = data[3] + constants = data[3] + computed_constants = data[4] + algebraic = data[5] algebraic[8] = u[0] f[0] = algebraic[8]-0.07*exp(states[0]/20.0)-0.0 -def find_root_9(voi, states, rates, variables): +def find_root_9(voi, states, rates, constants, computed_constants, algebraic): u = [nan]*1 u[0] = algebraic[8] - u = nla_solve(objective_function_9, u, 1, [voi, states, rates, variables]) + u = nla_solve(objective_function_9, u, 1, [voi, states, rates, constants, computed_constants, algebraic]) algebraic[8] = u[0] @@ -294,19 +314,21 @@ def objective_function_10(u, f, data): voi = data[0] states = data[1] rates = data[2] - variables = data[3] + constants = data[3] + computed_constants = data[4] + algebraic = data[5] algebraic[9] = u[0] f[0] = algebraic[9]-1.0/(exp((states[0]+30.0)/10.0)+1.0)-0.0 -def find_root_10(voi, states, rates, variables): +def find_root_10(voi, states, rates, constants, computed_constants, algebraic): u = [nan]*1 u[0] = algebraic[9] - u = nla_solve(objective_function_10, u, 1, [voi, states, rates, variables]) + u = nla_solve(objective_function_10, u, 1, [voi, states, rates, constants, computed_constants, algebraic]) algebraic[9] = u[0] @@ -315,19 +337,21 @@ def objective_function_11(u, f, data): voi = data[0] states = data[1] rates = data[2] - variables = data[3] + constants = data[3] + computed_constants = data[4] + algebraic = data[5] rates[1] = u[0] f[0] = rates[1]-(algebraic[8]*(1.0-states[1])-algebraic[9]*states[1])-0.0 -def find_root_11(voi, states, rates, variables): +def find_root_11(voi, states, rates, constants, computed_constants, algebraic): u = [nan]*1 u[0] = rates[1] - u = nla_solve(objective_function_11, u, 1, [voi, states, rates, variables]) + u = nla_solve(objective_function_11, u, 1, [voi, states, rates, constants, computed_constants, algebraic]) rates[1] = u[0] @@ -336,19 +360,21 @@ def objective_function_12(u, f, data): voi = data[0] states = data[1] rates = data[2] - variables = data[3] + constants = data[3] + computed_constants = data[4] + algebraic = data[5] algebraic[10] = u[0] f[0] = algebraic[10]-(constants[1]+12.0)-0.0 -def find_root_12(voi, states, rates, variables): +def find_root_12(voi, states, rates, constants, computed_constants, algebraic): u = [nan]*1 u[0] = algebraic[10] - u = nla_solve(objective_function_12, u, 1, [voi, states, rates, variables]) + u = nla_solve(objective_function_12, u, 1, [voi, states, rates, constants, computed_constants, algebraic]) algebraic[10] = u[0] @@ -357,19 +383,21 @@ def objective_function_13(u, f, data): voi = data[0] states = data[1] rates = data[2] - variables = data[3] + constants = data[3] + computed_constants = data[4] + algebraic = data[5] algebraic[2] = u[0] f[0] = algebraic[2]-constants[4]*pow(states[3], 4.0)*(states[0]-algebraic[10])-0.0 -def find_root_13(voi, states, rates, variables): +def find_root_13(voi, states, rates, constants, computed_constants, algebraic): u = [nan]*1 u[0] = algebraic[2] - u = nla_solve(objective_function_13, u, 1, [voi, states, rates, variables]) + u = nla_solve(objective_function_13, u, 1, [voi, states, rates, constants, computed_constants, algebraic]) algebraic[2] = u[0] @@ -378,19 +406,21 @@ def objective_function_14(u, f, data): voi = data[0] states = data[1] rates = data[2] - variables = data[3] + constants = data[3] + computed_constants = data[4] + algebraic = data[5] algebraic[11] = u[0] f[0] = algebraic[11]-0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0)-0.0 -def find_root_14(voi, states, rates, variables): +def find_root_14(voi, states, rates, constants, computed_constants, algebraic): u = [nan]*1 u[0] = algebraic[11] - u = nla_solve(objective_function_14, u, 1, [voi, states, rates, variables]) + u = nla_solve(objective_function_14, u, 1, [voi, states, rates, constants, computed_constants, algebraic]) algebraic[11] = u[0] @@ -399,19 +429,21 @@ def objective_function_15(u, f, data): voi = data[0] states = data[1] rates = data[2] - variables = data[3] + constants = data[3] + computed_constants = data[4] + algebraic = data[5] algebraic[12] = u[0] f[0] = algebraic[12]-0.125*exp(states[0]/80.0)-0.0 -def find_root_15(voi, states, rates, variables): +def find_root_15(voi, states, rates, constants, computed_constants, algebraic): u = [nan]*1 u[0] = algebraic[12] - u = nla_solve(objective_function_15, u, 1, [voi, states, rates, variables]) + u = nla_solve(objective_function_15, u, 1, [voi, states, rates, constants, computed_constants, algebraic]) algebraic[12] = u[0] @@ -420,19 +452,21 @@ def objective_function_16(u, f, data): voi = data[0] states = data[1] rates = data[2] - variables = data[3] + constants = data[3] + computed_constants = data[4] + algebraic = data[5] rates[3] = u[0] f[0] = rates[3]-(algebraic[11]*(1.0-states[3])-algebraic[12]*states[3])-0.0 -def find_root_16(voi, states, rates, variables): +def find_root_16(voi, states, rates, constants, computed_constants, algebraic): u = [nan]*1 u[0] = rates[3] - u = nla_solve(objective_function_16, u, 1, [voi, states, rates, variables]) + u = nla_solve(objective_function_16, u, 1, [voi, states, rates, constants, computed_constants, algebraic]) rates[3] = u[0] @@ -471,40 +505,40 @@ def compute_computed_constants(constants, computed_constants): def compute_rates(voi, states, rates, constants, computed_constants, algebraic): - find_root_0(voi, states, rates, variables) - find_root_2(voi, states, rates, variables) - find_root_3(voi, states, rates, variables) - find_root_14(voi, states, rates, variables) - find_root_15(voi, states, rates, variables) - find_root_16(voi, states, rates, variables) - find_root_12(voi, states, rates, variables) - find_root_13(voi, states, rates, variables) - find_root_9(voi, states, rates, variables) - find_root_10(voi, states, rates, variables) - find_root_11(voi, states, rates, variables) - find_root_6(voi, states, rates, variables) - find_root_7(voi, states, rates, variables) - find_root_8(voi, states, rates, variables) - find_root_4(voi, states, rates, variables) - find_root_5(voi, states, rates, variables) - find_root_1(voi, states, rates, variables) + find_root_0(voi, states, rates, constants, computed_constants, algebraic) + find_root_2(voi, states, rates, constants, computed_constants, algebraic) + find_root_3(voi, states, rates, constants, computed_constants, algebraic) + find_root_14(voi, states, rates, constants, computed_constants, algebraic) + find_root_15(voi, states, rates, constants, computed_constants, algebraic) + find_root_16(voi, states, rates, constants, computed_constants, algebraic) + find_root_12(voi, states, rates, constants, computed_constants, algebraic) + find_root_13(voi, states, rates, constants, computed_constants, algebraic) + find_root_9(voi, states, rates, constants, computed_constants, algebraic) + find_root_10(voi, states, rates, constants, computed_constants, algebraic) + find_root_11(voi, states, rates, constants, computed_constants, algebraic) + find_root_6(voi, states, rates, constants, computed_constants, algebraic) + find_root_7(voi, states, rates, constants, computed_constants, algebraic) + find_root_8(voi, states, rates, constants, computed_constants, algebraic) + find_root_4(voi, states, rates, constants, computed_constants, algebraic) + find_root_5(voi, states, rates, constants, computed_constants, algebraic) + find_root_1(voi, states, rates, constants, computed_constants, algebraic) def compute_variables(voi, states, rates, constants, computed_constants, algebraic): - find_root_0(voi, states, rates, variables) - find_root_2(voi, states, rates, variables) - find_root_3(voi, states, rates, variables) - find_root_14(voi, states, rates, variables) - find_root_15(voi, states, rates, variables) - find_root_16(voi, states, rates, variables) - find_root_12(voi, states, rates, variables) - find_root_13(voi, states, rates, variables) - find_root_9(voi, states, rates, variables) - find_root_10(voi, states, rates, variables) - find_root_11(voi, states, rates, variables) - find_root_6(voi, states, rates, variables) - find_root_7(voi, states, rates, variables) - find_root_8(voi, states, rates, variables) - find_root_4(voi, states, rates, variables) - find_root_5(voi, states, rates, variables) - find_root_1(voi, states, rates, variables) + find_root_0(voi, states, rates, constants, computed_constants, algebraic) + find_root_2(voi, states, rates, constants, computed_constants, algebraic) + find_root_3(voi, states, rates, constants, computed_constants, algebraic) + find_root_14(voi, states, rates, constants, computed_constants, algebraic) + find_root_15(voi, states, rates, constants, computed_constants, algebraic) + find_root_16(voi, states, rates, constants, computed_constants, algebraic) + find_root_12(voi, states, rates, constants, computed_constants, algebraic) + find_root_13(voi, states, rates, constants, computed_constants, algebraic) + find_root_9(voi, states, rates, constants, computed_constants, algebraic) + find_root_10(voi, states, rates, constants, computed_constants, algebraic) + find_root_11(voi, states, rates, constants, computed_constants, algebraic) + find_root_6(voi, states, rates, constants, computed_constants, algebraic) + find_root_7(voi, states, rates, constants, computed_constants, algebraic) + find_root_8(voi, states, rates, constants, computed_constants, algebraic) + find_root_4(voi, states, rates, constants, computed_constants, algebraic) + find_root_5(voi, states, rates, constants, computed_constants, algebraic) + find_root_1(voi, states, rates, constants, computed_constants, algebraic) diff --git a/tests/resources/generator/robertson_model_1966/model.dae.c b/tests/resources/generator/robertson_model_1966/model.dae.c index 9f90b3f9c9..0983133e14 100644 --- a/tests/resources/generator/robertson_model_1966/model.dae.c +++ b/tests/resources/generator/robertson_model_1966/model.dae.c @@ -87,7 +87,9 @@ typedef struct { double voi; double *states; double *rates; - double *variables; + double *constants; + double *computedConstants; + double *algebraic; } RootFindingInfo; extern void nlaSolve(void (*objectiveFunction)(double *, double *, void *), @@ -98,16 +100,18 @@ void objectiveFunction0(double *u, double *f, void *data) double voi = ((RootFindingInfo *) data)->voi; double *states = ((RootFindingInfo *) data)->states; double *rates = ((RootFindingInfo *) data)->rates; - double *variables = ((RootFindingInfo *) data)->variables; + double *constants = ((RootFindingInfo *) data)->constants; + double *computedConstants = ((RootFindingInfo *) data)->computedConstants; + double *algebraic = ((RootFindingInfo *) data)->algebraic; algebraic[0] = u[0]; f[0] = 1.0-(states[0]+states[1]+algebraic[0]); } -void findRoot0(double voi, double *states, double *rates, double *variables) +void findRoot0(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { - RootFindingInfo rfi = { voi, states, rates, variables }; + RootFindingInfo rfi = { voi, states, rates, constants, computedConstants, algebraic }; double u[1]; u[0] = algebraic[0]; @@ -133,13 +137,13 @@ void computeComputedConstants(double *constants, double *computedConstants) void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { - findRoot0(voi, states, rates, variables); + findRoot0(voi, states, rates, constants, computedConstants, algebraic); rates[0] = -constants[0]*states[0]+constants[1]*states[1]*algebraic[0]; rates[1] = constants[0]*states[0]-constants[2]*pow(states[1], 2.0)-constants[1]*states[1]*algebraic[0]; } void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) { - findRoot0(voi, states, rates, variables); + findRoot0(voi, states, rates, constants, computedConstants, algebraic); algebraic[1] = 10000.0*states[1]; } diff --git a/tests/resources/generator/robertson_model_1966/model.dae.py b/tests/resources/generator/robertson_model_1966/model.dae.py index 512fd8d9fc..1bb4bf2b0b 100644 --- a/tests/resources/generator/robertson_model_1966/model.dae.py +++ b/tests/resources/generator/robertson_model_1966/model.dae.py @@ -57,19 +57,21 @@ def objective_function_0(u, f, data): voi = data[0] states = data[1] rates = data[2] - variables = data[3] + constants = data[3] + computed_constants = data[4] + algebraic = data[5] algebraic[0] = u[0] f[0] = 1.0-(states[0]+states[1]+algebraic[0]) -def find_root_0(voi, states, rates, variables): +def find_root_0(voi, states, rates, constants, computed_constants, algebraic): u = [nan]*1 u[0] = algebraic[0] - u = nla_solve(objective_function_0, u, 1, [voi, states, rates, variables]) + u = nla_solve(objective_function_0, u, 1, [voi, states, rates, constants, computed_constants, algebraic]) algebraic[0] = u[0] @@ -88,11 +90,11 @@ def compute_computed_constants(constants, computed_constants): def compute_rates(voi, states, rates, constants, computed_constants, algebraic): - find_root_0(voi, states, rates, variables) + find_root_0(voi, states, rates, constants, computed_constants, algebraic) rates[0] = -constants[0]*states[0]+constants[1]*states[1]*algebraic[0] rates[1] = constants[0]*states[0]-constants[2]*pow(states[1], 2.0)-constants[1]*states[1]*algebraic[0] def compute_variables(voi, states, rates, constants, computed_constants, algebraic): - find_root_0(voi, states, rates, variables) + find_root_0(voi, states, rates, constants, computed_constants, algebraic) algebraic[1] = 10000.0*states[1] From d16520832d4ae50ec6e27bb5b80bc5032044025a Mon Sep 17 00:00:00 2001 From: Alan Garny Date: Mon, 19 Aug 2024 22:53:28 +0200 Subject: [PATCH 43/85] GeneratorProfile: use the constants, computed constants, and algebraic arrays rather than the variables array to compute external variables. --- src/generatorprofile.cpp | 12 ++++++------ src/generatorprofilesha1values.h | 4 ++-- tests/bindings/python/test_generator_profile.py | 8 ++++---- tests/generator/generatorprofile.cpp | 8 ++++---- .../model.external.c | 2 +- .../model.external.h | 2 +- .../model.external.py | 2 +- .../model.external.c | 2 +- .../model.external.h | 2 +- .../model.external.py | 2 +- .../model.external.c | 6 +++--- .../model.external.h | 2 +- .../model.external.py | 6 +++--- .../generator/cell_geometry_model/model.external.c | 4 ++-- .../generator/cell_geometry_model/model.external.h | 2 +- .../generator/cell_geometry_model/model.external.py | 4 ++-- .../model.algebraic.c | 4 ++-- .../model.algebraic.h | 2 +- .../model.algebraic.py | 4 ++-- .../model.computed.constant.c | 4 ++-- .../model.computed.constant.h | 2 +- .../model.computed.constant.py | 4 ++-- .../model.constant.c | 4 ++-- .../model.constant.h | 2 +- .../model.constant.py | 4 ++-- .../model.dependent.algebraic.c | 8 ++++---- .../model.dependent.algebraic.h | 2 +- .../model.dependent.algebraic.py | 8 ++++---- .../model.dependent.computed.constant.c | 8 ++++---- .../model.dependent.computed.constant.h | 2 +- .../model.dependent.computed.constant.py | 8 ++++---- .../model.dependent.constant.c | 8 ++++---- .../model.dependent.constant.h | 2 +- .../model.dependent.constant.py | 8 ++++---- .../model.dependent.state.c | 6 +++--- .../model.dependent.state.h | 2 +- .../model.dependent.state.py | 6 +++--- .../model.external.c | 10 +++++----- .../model.external.h | 2 +- .../model.external.py | 10 +++++----- .../model.state.c | 4 ++-- .../model.state.h | 2 +- .../model.state.py | 4 ++-- .../unknown_variable_as_external_variable/model.c | 2 +- .../unknown_variable_as_external_variable/model.h | 2 +- .../unknown_variable_as_external_variable/model.py | 2 +- 46 files changed, 102 insertions(+), 102 deletions(-) diff --git a/src/generatorprofile.cpp b/src/generatorprofile.cpp index db36f888c6..6c51b0242d 100644 --- a/src/generatorprofile.cpp +++ b/src/generatorprofile.cpp @@ -290,11 +290,11 @@ void GeneratorProfile::GeneratorProfileImpl::loadProfile(GeneratorProfile::Profi mAlgebraicArrayString = "algebraic"; mExternalArrayString = "externals"; - mExternalVariableMethodTypeDefinitionFamString = "typedef double (* ExternalVariable)(double *variables, size_t index);\n"; - mExternalVariableMethodTypeDefinitionFdmString = "typedef double (* ExternalVariable)(double voi, double *states, double *rates, double *variables, size_t index);\n"; + mExternalVariableMethodTypeDefinitionFamString = "typedef double (* ExternalVariable)(double *constants, double *computedConstants, double *algebraic, size_t index);\n"; + mExternalVariableMethodTypeDefinitionFdmString = "typedef double (* ExternalVariable)(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, size_t index);\n"; - mExternalVariableMethodCallFamString = "externalVariable(variables, [INDEX])"; - mExternalVariableMethodCallFdmString = "externalVariable(voi, states, rates, variables, [INDEX])"; + mExternalVariableMethodCallFamString = "externalVariable(constants, computedConstants, algebraic, [INDEX])"; + mExternalVariableMethodCallFdmString = "externalVariable(voi, states, rates, constants, computedConstants, algebraic, [INDEX])"; mRootFindingInfoObjectFamString = "typedef struct {\n" " double *constants;\n" @@ -742,8 +742,8 @@ void GeneratorProfile::GeneratorProfileImpl::loadProfile(GeneratorProfile::Profi mExternalVariableMethodTypeDefinitionFamString = ""; mExternalVariableMethodTypeDefinitionFdmString = ""; - mExternalVariableMethodCallFamString = "external_variable(variables, [INDEX])"; - mExternalVariableMethodCallFdmString = "external_variable(voi, states, rates, variables, [INDEX])"; + mExternalVariableMethodCallFamString = "external_variable(constants, computed_constants, algebraic, [INDEX])"; + mExternalVariableMethodCallFdmString = "external_variable(voi, states, rates, constants, computed_constants, algebraic, [INDEX])"; mRootFindingInfoObjectFamString = ""; mRootFindingInfoObjectFdmString = ""; diff --git a/src/generatorprofilesha1values.h b/src/generatorprofilesha1values.h index fb447d9032..e4bf327ed5 100644 --- a/src/generatorprofilesha1values.h +++ b/src/generatorprofilesha1values.h @@ -24,7 +24,7 @@ namespace libcellml { * The content of this file is generated, do not edit this file directly. * See docs/dev_utilities.rst for further information. */ -static const char C_GENERATOR_PROFILE_SHA1[] = "d89b171278ed3bf717a6127eeb6ac6a7a90d0157"; -static const char PYTHON_GENERATOR_PROFILE_SHA1[] = "b5d9c5ac70bf89bf6396b8928885781b96e458ba"; +static const char C_GENERATOR_PROFILE_SHA1[] = "1e07f5b270d8f8fe62cffa8bcd81bf04804aa9e5"; +static const char PYTHON_GENERATOR_PROFILE_SHA1[] = "3c4d4503bca8066e85c60491ac85a960ec8144bf"; } // namespace libcellml diff --git a/tests/bindings/python/test_generator_profile.py b/tests/bindings/python/test_generator_profile.py index 32b35283a0..5ec63521cd 100644 --- a/tests/bindings/python/test_generator_profile.py +++ b/tests/bindings/python/test_generator_profile.py @@ -1677,13 +1677,13 @@ def test_external_variable_method_type_definition_string(self): g = GeneratorProfile() self.assertEqual( - 'typedef double (* ExternalVariable)(double *variables, size_t index);\n', + 'typedef double (* ExternalVariable)(double *constants, double *computedConstants, double *algebraic, size_t index);\n', g.externalVariableMethodTypeDefinitionString(False)) g.setExternalVariableMethodTypeDefinitionString(False, GeneratorProfileTestCase.VALUE) self.assertEqual(GeneratorProfileTestCase.VALUE, g.externalVariableMethodTypeDefinitionString(False)) self.assertEqual( - 'typedef double (* ExternalVariable)(double voi, double *states, double *rates, double *variables, size_t index);\n', + 'typedef double (* ExternalVariable)(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, size_t index);\n', g.externalVariableMethodTypeDefinitionString(True)) g.setExternalVariableMethodTypeDefinitionString(True, GeneratorProfileTestCase.VALUE) self.assertEqual(GeneratorProfileTestCase.VALUE, g.externalVariableMethodTypeDefinitionString(True)) @@ -1693,12 +1693,12 @@ def test_external_variable_method_call_string(self): g = GeneratorProfile() - self.assertEqual('externalVariable(variables, [INDEX])', + self.assertEqual('externalVariable(constants, computedConstants, algebraic, [INDEX])', g.externalVariableMethodCallString(False)) g.setExternalVariableMethodCallString(False, GeneratorProfileTestCase.VALUE) self.assertEqual(GeneratorProfileTestCase.VALUE, g.externalVariableMethodCallString(False)) - self.assertEqual('externalVariable(voi, states, rates, variables, [INDEX])', + self.assertEqual('externalVariable(voi, states, rates, constants, computedConstants, algebraic, [INDEX])', g.externalVariableMethodCallString(True)) g.setExternalVariableMethodCallString(True, GeneratorProfileTestCase.VALUE) self.assertEqual(GeneratorProfileTestCase.VALUE, g.externalVariableMethodCallString(True)) diff --git a/tests/generator/generatorprofile.cpp b/tests/generator/generatorprofile.cpp index 4cc9c64120..c95a5112af 100644 --- a/tests/generator/generatorprofile.cpp +++ b/tests/generator/generatorprofile.cpp @@ -342,11 +342,11 @@ TEST(GeneratorProfile, defaultMiscellaneousValues) EXPECT_EQ("algebraic", generatorProfile->algebraicArrayString()); EXPECT_EQ("externals", generatorProfile->externalArrayString()); - EXPECT_EQ("typedef double (* ExternalVariable)(double *variables, size_t index);\n", generatorProfile->externalVariableMethodTypeDefinitionString(false)); - EXPECT_EQ("typedef double (* ExternalVariable)(double voi, double *states, double *rates, double *variables, size_t index);\n", generatorProfile->externalVariableMethodTypeDefinitionString(true)); + EXPECT_EQ("typedef double (* ExternalVariable)(double *constants, double *computedConstants, double *algebraic, size_t index);\n", generatorProfile->externalVariableMethodTypeDefinitionString(false)); + EXPECT_EQ("typedef double (* ExternalVariable)(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, size_t index);\n", generatorProfile->externalVariableMethodTypeDefinitionString(true)); - EXPECT_EQ("externalVariable(variables, [INDEX])", generatorProfile->externalVariableMethodCallString(false)); - EXPECT_EQ("externalVariable(voi, states, rates, variables, [INDEX])", generatorProfile->externalVariableMethodCallString(true)); + EXPECT_EQ("externalVariable(constants, computedConstants, algebraic, [INDEX])", generatorProfile->externalVariableMethodCallString(false)); + EXPECT_EQ("externalVariable(voi, states, rates, constants, computedConstants, algebraic, [INDEX])", generatorProfile->externalVariableMethodCallString(true)); EXPECT_EQ("typedef struct {\n" " double *constants;\n" diff --git a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.c b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.c index 70e5a39b8a..6e39ffddf4 100644 --- a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.c +++ b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.c @@ -86,6 +86,6 @@ void computeComputedConstants(double *constants, double *computedConstants) void computeVariables(double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) { - externals[0] = externalVariable(variables, 0); + externals[0] = externalVariable(constants, computedConstants, algebraic, 0); algebraic[0] = externals[0]; } diff --git a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.h b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.h index 9492088756..c68c54a282 100644 --- a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.h +++ b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.h @@ -30,7 +30,7 @@ double * createExternalsArray(); void deleteArray(double *array); -typedef double (* ExternalVariable)(double *variables, size_t index); +typedef double (* ExternalVariable)(double *constants, double *computedConstants, double *algebraic, size_t index); void initialiseVariables(double *constants, double *computedConstants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); diff --git a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.py b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.py index 244859d72c..953b054c86 100644 --- a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.py +++ b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.py @@ -52,5 +52,5 @@ def compute_computed_constants(constants, computed_constants): def compute_variables(constants, computed_constants, algebraic, external_variable): - externals[0] = external_variable(variables, 0) + externals[0] = external_variable(constants, computed_constants, algebraic, 0) algebraic[0] = externals[0] diff --git a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.c b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.c index 43fe422a9f..dd58522e6b 100644 --- a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.c +++ b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.c @@ -91,5 +91,5 @@ void computeComputedConstants(double *constants, double *computedConstants) void computeVariables(double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) { - externals[0] = externalVariable(variables, 0); + externals[0] = externalVariable(constants, computedConstants, algebraic, 0); } diff --git a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.h b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.h index 9492088756..c68c54a282 100644 --- a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.h +++ b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.h @@ -30,7 +30,7 @@ double * createExternalsArray(); void deleteArray(double *array); -typedef double (* ExternalVariable)(double *variables, size_t index); +typedef double (* ExternalVariable)(double *constants, double *computedConstants, double *algebraic, size_t index); void initialiseVariables(double *constants, double *computedConstants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); diff --git a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.py b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.py index c5a93e2ac2..8be4ddcd18 100644 --- a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.py +++ b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.py @@ -56,4 +56,4 @@ def compute_computed_constants(constants, computed_constants): def compute_variables(constants, computed_constants, algebraic, external_variable): - externals[0] = external_variable(variables, 0) + externals[0] = external_variable(constants, computed_constants, algebraic, 0) diff --git a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.external.c b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.external.c index 38c67fb560..ee21f220e2 100644 --- a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.external.c +++ b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.external.c @@ -87,7 +87,7 @@ void computeComputedConstants(double *constants, double *computedConstants) void computeVariables(double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) { - externals[0] = externalVariable(variables, 0); - externals[1] = externalVariable(variables, 1); - externals[2] = externalVariable(variables, 2); + externals[0] = externalVariable(constants, computedConstants, algebraic, 0); + externals[1] = externalVariable(constants, computedConstants, algebraic, 1); + externals[2] = externalVariable(constants, computedConstants, algebraic, 2); } diff --git a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.external.h b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.external.h index 33b7905754..8ea01811f8 100644 --- a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.external.h +++ b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.external.h @@ -30,7 +30,7 @@ double * createExternalsArray(); void deleteArray(double *array); -typedef double (* ExternalVariable)(double *variables, size_t index); +typedef double (* ExternalVariable)(double *constants, double *computedConstants, double *algebraic, size_t index); void initialiseVariables(double *constants, double *computedConstants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); diff --git a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.external.py b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.external.py index 7d519d04b3..65c6876d4f 100644 --- a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.external.py +++ b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.external.py @@ -53,6 +53,6 @@ def compute_computed_constants(constants, computed_constants): def compute_variables(constants, computed_constants, algebraic, external_variable): - externals[0] = external_variable(variables, 0) - externals[1] = external_variable(variables, 1) - externals[2] = external_variable(variables, 2) + externals[0] = external_variable(constants, computed_constants, algebraic, 0) + externals[1] = external_variable(constants, computed_constants, algebraic, 1) + externals[2] = external_variable(constants, computed_constants, algebraic, 2) diff --git a/tests/resources/generator/cell_geometry_model/model.external.c b/tests/resources/generator/cell_geometry_model/model.external.c index 1b946f417f..de3a3ab802 100644 --- a/tests/resources/generator/cell_geometry_model/model.external.c +++ b/tests/resources/generator/cell_geometry_model/model.external.c @@ -88,8 +88,8 @@ void computeComputedConstants(double *constants, double *computedConstants) void computeVariables(double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) { - externals[0] = externalVariable(variables, 0); - externals[1] = externalVariable(variables, 1); + externals[0] = externalVariable(constants, computedConstants, algebraic, 0); + externals[1] = externalVariable(constants, computedConstants, algebraic, 1); algebraic[0] = 1000.0*3.14*externals[1]*externals[1]*externals[0]; algebraic[1] = 0.02*algebraic[0]; } diff --git a/tests/resources/generator/cell_geometry_model/model.external.h b/tests/resources/generator/cell_geometry_model/model.external.h index 28c04e7141..c312a35c7f 100644 --- a/tests/resources/generator/cell_geometry_model/model.external.h +++ b/tests/resources/generator/cell_geometry_model/model.external.h @@ -30,7 +30,7 @@ double * createExternalsArray(); void deleteArray(double *array); -typedef double (* ExternalVariable)(double *variables, size_t index); +typedef double (* ExternalVariable)(double *constants, double *computedConstants, double *algebraic, size_t index); void initialiseVariables(double *constants, double *computedConstants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); diff --git a/tests/resources/generator/cell_geometry_model/model.external.py b/tests/resources/generator/cell_geometry_model/model.external.py index 463fb5960c..c45a649c6e 100644 --- a/tests/resources/generator/cell_geometry_model/model.external.py +++ b/tests/resources/generator/cell_geometry_model/model.external.py @@ -54,7 +54,7 @@ def compute_computed_constants(constants, computed_constants): def compute_variables(constants, computed_constants, algebraic, external_variable): - externals[0] = external_variable(variables, 0) - externals[1] = external_variable(variables, 1) + externals[0] = external_variable(constants, computed_constants, algebraic, 0) + externals[1] = external_variable(constants, computed_constants, algebraic, 1) algebraic[0] = 1000.0*3.14*externals[1]*externals[1]*externals[0] algebraic[1] = 0.02*algebraic[0] diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.c index 3a449edd19..20a0c70eab 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.c @@ -135,7 +135,7 @@ void computeComputedConstants(double *constants, double *computedConstants) void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) { - externals[0] = externalVariable(voi, states, rates, variables, 0); + externals[0] = externalVariable(voi, states, rates, constants, computedConstants, algebraic, 0); algebraic[0] = constants[2]*(states[0]-computedConstants[0]); algebraic[1] = constants[4]*pow(states[3], 4.0)*(states[0]-computedConstants[2]); algebraic[2] = constants[3]*pow(states[2], 3.0)*states[1]*(states[0]-computedConstants[1]); @@ -153,7 +153,7 @@ void computeRates(double voi, double *states, double *rates, double *constants, void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) { - externals[0] = externalVariable(voi, states, rates, variables, 0); + externals[0] = externalVariable(voi, states, rates, constants, computedConstants, algebraic, 0); algebraic[0] = constants[2]*(states[0]-computedConstants[0]); algebraic[2] = constants[3]*pow(states[2], 3.0)*states[1]*(states[0]-computedConstants[1]); algebraic[3] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.h index 1ba9603ccd..35a6bd9c3d 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.h +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.h @@ -34,7 +34,7 @@ double * createExternalsArray(); void deleteArray(double *array); -typedef double (* ExternalVariable)(double voi, double *states, double *rates, double *variables, size_t index); +typedef double (* ExternalVariable)(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, size_t index); void initialiseVariables(double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.py index 7e9218d84a..35757ff10f 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.py @@ -104,7 +104,7 @@ def compute_computed_constants(constants, computed_constants): def compute_rates(voi, states, rates, constants, computed_constants, algebraic, external_variable): - externals[0] = external_variable(voi, states, rates, variables, 0) + externals[0] = external_variable(voi, states, rates, constants, computed_constants, algebraic, 0) algebraic[0] = constants[2]*(states[0]-computed_constants[0]) algebraic[1] = constants[4]*pow(states[3], 4.0)*(states[0]-computed_constants[2]) algebraic[2] = constants[3]*pow(states[2], 3.0)*states[1]*(states[0]-computed_constants[1]) @@ -121,7 +121,7 @@ def compute_rates(voi, states, rates, constants, computed_constants, algebraic, def compute_variables(voi, states, rates, constants, computed_constants, algebraic, external_variable): - externals[0] = external_variable(voi, states, rates, variables, 0) + externals[0] = external_variable(voi, states, rates, constants, computed_constants, algebraic, 0) algebraic[0] = constants[2]*(states[0]-computed_constants[0]) algebraic[2] = constants[3]*pow(states[2], 3.0)*states[1]*(states[0]-computed_constants[1]) algebraic[3] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0) diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.c index abf11523e1..223249ed92 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.c @@ -135,7 +135,7 @@ void computeComputedConstants(double *constants, double *computedConstants) void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) { algebraic[0] = ((voi >= 10.0) && (voi <= 10.5))?-20.0:0.0; - externals[0] = externalVariable(voi, states, rates, variables, 0); + externals[0] = externalVariable(voi, states, rates, constants, computedConstants, algebraic, 0); algebraic[1] = constants[2]*(states[0]-externals[0]); algebraic[2] = constants[4]*pow(states[3], 4.0)*(states[0]-computedConstants[1]); algebraic[3] = constants[3]*pow(states[2], 3.0)*states[1]*(states[0]-computedConstants[0]); @@ -153,7 +153,7 @@ void computeRates(double voi, double *states, double *rates, double *constants, void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) { - externals[0] = externalVariable(voi, states, rates, variables, 0); + externals[0] = externalVariable(voi, states, rates, constants, computedConstants, algebraic, 0); algebraic[1] = constants[2]*(states[0]-externals[0]); algebraic[3] = constants[3]*pow(states[2], 3.0)*states[1]*(states[0]-computedConstants[0]); algebraic[4] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.h index 1ba9603ccd..35a6bd9c3d 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.h +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.h @@ -34,7 +34,7 @@ double * createExternalsArray(); void deleteArray(double *array); -typedef double (* ExternalVariable)(double voi, double *states, double *rates, double *variables, size_t index); +typedef double (* ExternalVariable)(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, size_t index); void initialiseVariables(double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.py index 66a555dfb8..c00871301f 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.py @@ -104,7 +104,7 @@ def compute_computed_constants(constants, computed_constants): def compute_rates(voi, states, rates, constants, computed_constants, algebraic, external_variable): algebraic[0] = -20.0 if and_func(geq_func(voi, 10.0), leq_func(voi, 10.5)) else 0.0 - externals[0] = external_variable(voi, states, rates, variables, 0) + externals[0] = external_variable(voi, states, rates, constants, computed_constants, algebraic, 0) algebraic[1] = constants[2]*(states[0]-externals[0]) algebraic[2] = constants[4]*pow(states[3], 4.0)*(states[0]-computed_constants[1]) algebraic[3] = constants[3]*pow(states[2], 3.0)*states[1]*(states[0]-computed_constants[0]) @@ -121,7 +121,7 @@ def compute_rates(voi, states, rates, constants, computed_constants, algebraic, def compute_variables(voi, states, rates, constants, computed_constants, algebraic, external_variable): - externals[0] = external_variable(voi, states, rates, variables, 0) + externals[0] = external_variable(voi, states, rates, constants, computed_constants, algebraic, 0) algebraic[1] = constants[2]*(states[0]-externals[0]) algebraic[3] = constants[3]*pow(states[2], 3.0)*states[1]*(states[0]-computed_constants[0]) algebraic[4] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0) diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.c index 0b61cfd4b4..708762d5a7 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.c @@ -135,7 +135,7 @@ void computeComputedConstants(double *constants, double *computedConstants) void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) { algebraic[0] = ((voi >= 10.0) && (voi <= 10.5))?-20.0:0.0; - externals[0] = externalVariable(voi, states, rates, variables, 0); + externals[0] = externalVariable(voi, states, rates, constants, computedConstants, algebraic, 0); algebraic[1] = constants[1]*(states[0]-computedConstants[0]); algebraic[2] = constants[3]*pow(states[3], 4.0)*(states[0]-computedConstants[2]); algebraic[3] = constants[2]*pow(states[2], 3.0)*states[1]*(states[0]-computedConstants[1]); @@ -162,5 +162,5 @@ void computeVariables(double voi, double *states, double *rates, double *constan algebraic[2] = constants[3]*pow(states[3], 4.0)*(states[0]-computedConstants[2]); algebraic[8] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0); algebraic[9] = 0.125*exp(states[0]/80.0); - externals[0] = externalVariable(voi, states, rates, variables, 0); + externals[0] = externalVariable(voi, states, rates, constants, computedConstants, algebraic, 0); } diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.h index 1ba9603ccd..35a6bd9c3d 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.h +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.h @@ -34,7 +34,7 @@ double * createExternalsArray(); void deleteArray(double *array); -typedef double (* ExternalVariable)(double voi, double *states, double *rates, double *variables, size_t index); +typedef double (* ExternalVariable)(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, size_t index); void initialiseVariables(double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.py index 30ac1e4787..47529b9f1a 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.py @@ -104,7 +104,7 @@ def compute_computed_constants(constants, computed_constants): def compute_rates(voi, states, rates, constants, computed_constants, algebraic, external_variable): algebraic[0] = -20.0 if and_func(geq_func(voi, 10.0), leq_func(voi, 10.5)) else 0.0 - externals[0] = external_variable(voi, states, rates, variables, 0) + externals[0] = external_variable(voi, states, rates, constants, computed_constants, algebraic, 0) algebraic[1] = constants[1]*(states[0]-computed_constants[0]) algebraic[2] = constants[3]*pow(states[3], 4.0)*(states[0]-computed_constants[2]) algebraic[3] = constants[2]*pow(states[2], 3.0)*states[1]*(states[0]-computed_constants[1]) @@ -130,4 +130,4 @@ def compute_variables(voi, states, rates, constants, computed_constants, algebra algebraic[2] = constants[3]*pow(states[3], 4.0)*(states[0]-computed_constants[2]) algebraic[8] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0) algebraic[9] = 0.125*exp(states[0]/80.0) - externals[0] = external_variable(voi, states, rates, variables, 0) + externals[0] = external_variable(voi, states, rates, constants, computed_constants, algebraic, 0) diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.c index 174c5d1c5b..37c38f09aa 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.c @@ -135,8 +135,8 @@ void computeComputedConstants(double *constants, double *computedConstants) void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) { - externals[1] = externalVariable(voi, states, rates, variables, 1); - externals[0] = externalVariable(voi, states, rates, variables, 0); + externals[1] = externalVariable(voi, states, rates, constants, computedConstants, algebraic, 1); + externals[0] = externalVariable(voi, states, rates, constants, computedConstants, algebraic, 0); algebraic[0] = constants[2]*(states[0]-computedConstants[0]); algebraic[1] = constants[4]*pow(states[3], 4.0)*(states[0]-computedConstants[2]); algebraic[2] = constants[3]*pow(states[2], 3.0)*states[1]*(states[0]-computedConstants[1]); @@ -153,8 +153,8 @@ void computeRates(double voi, double *states, double *rates, double *constants, void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) { - externals[1] = externalVariable(voi, states, rates, variables, 1); - externals[0] = externalVariable(voi, states, rates, variables, 0); + externals[1] = externalVariable(voi, states, rates, constants, computedConstants, algebraic, 1); + externals[0] = externalVariable(voi, states, rates, constants, computedConstants, algebraic, 0); algebraic[0] = constants[2]*(states[0]-computedConstants[0]); algebraic[2] = constants[3]*pow(states[2], 3.0)*states[1]*(states[0]-computedConstants[1]); algebraic[3] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.h index 1ba9603ccd..35a6bd9c3d 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.h +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.h @@ -34,7 +34,7 @@ double * createExternalsArray(); void deleteArray(double *array); -typedef double (* ExternalVariable)(double voi, double *states, double *rates, double *variables, size_t index); +typedef double (* ExternalVariable)(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, size_t index); void initialiseVariables(double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.py index db89293eb9..dcce03903e 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.py @@ -104,8 +104,8 @@ def compute_computed_constants(constants, computed_constants): def compute_rates(voi, states, rates, constants, computed_constants, algebraic, external_variable): - externals[1] = external_variable(voi, states, rates, variables, 1) - externals[0] = external_variable(voi, states, rates, variables, 0) + externals[1] = external_variable(voi, states, rates, constants, computed_constants, algebraic, 1) + externals[0] = external_variable(voi, states, rates, constants, computed_constants, algebraic, 0) algebraic[0] = constants[2]*(states[0]-computed_constants[0]) algebraic[1] = constants[4]*pow(states[3], 4.0)*(states[0]-computed_constants[2]) algebraic[2] = constants[3]*pow(states[2], 3.0)*states[1]*(states[0]-computed_constants[1]) @@ -121,8 +121,8 @@ def compute_rates(voi, states, rates, constants, computed_constants, algebraic, def compute_variables(voi, states, rates, constants, computed_constants, algebraic, external_variable): - externals[1] = external_variable(voi, states, rates, variables, 1) - externals[0] = external_variable(voi, states, rates, variables, 0) + externals[1] = external_variable(voi, states, rates, constants, computed_constants, algebraic, 1) + externals[0] = external_variable(voi, states, rates, constants, computed_constants, algebraic, 0) algebraic[0] = constants[2]*(states[0]-computed_constants[0]) algebraic[2] = constants[3]*pow(states[2], 3.0)*states[1]*(states[0]-computed_constants[1]) algebraic[3] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0) diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.c index 9e73eb2cb9..b52e837c23 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.c @@ -132,8 +132,8 @@ void computeComputedConstants(double *constants, double *computedConstants) void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) { algebraic[0] = ((voi >= 10.0) && (voi <= 10.5))?-20.0:0.0; - externals[1] = externalVariable(voi, states, rates, variables, 1); - externals[0] = externalVariable(voi, states, rates, variables, 0); + externals[1] = externalVariable(voi, states, rates, constants, computedConstants, algebraic, 1); + externals[0] = externalVariable(voi, states, rates, constants, computedConstants, algebraic, 0); algebraic[4] = externals[0]-10.613; algebraic[1] = constants[1]*(states[0]-algebraic[4]); algebraic[2] = constants[3]*pow(states[3], 4.0)*(states[0]-externals[1]); @@ -153,8 +153,8 @@ void computeRates(double voi, double *states, double *rates, double *constants, void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) { - externals[1] = externalVariable(voi, states, rates, variables, 1); - externals[0] = externalVariable(voi, states, rates, variables, 0); + externals[1] = externalVariable(voi, states, rates, constants, computedConstants, algebraic, 1); + externals[0] = externalVariable(voi, states, rates, constants, computedConstants, algebraic, 0); algebraic[4] = externals[0]-10.613; algebraic[1] = constants[1]*(states[0]-algebraic[4]); algebraic[5] = externals[0]-115.0; diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.h index 1ba9603ccd..35a6bd9c3d 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.h +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.h @@ -34,7 +34,7 @@ double * createExternalsArray(); void deleteArray(double *array); -typedef double (* ExternalVariable)(double voi, double *states, double *rates, double *variables, size_t index); +typedef double (* ExternalVariable)(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, size_t index); void initialiseVariables(double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.py index 42ab91f87a..87f39ea1b8 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.py @@ -102,8 +102,8 @@ def compute_computed_constants(constants, computed_constants): def compute_rates(voi, states, rates, constants, computed_constants, algebraic, external_variable): algebraic[0] = -20.0 if and_func(geq_func(voi, 10.0), leq_func(voi, 10.5)) else 0.0 - externals[1] = external_variable(voi, states, rates, variables, 1) - externals[0] = external_variable(voi, states, rates, variables, 0) + externals[1] = external_variable(voi, states, rates, constants, computed_constants, algebraic, 1) + externals[0] = external_variable(voi, states, rates, constants, computed_constants, algebraic, 0) algebraic[4] = externals[0]-10.613 algebraic[1] = constants[1]*(states[0]-algebraic[4]) algebraic[2] = constants[3]*pow(states[3], 4.0)*(states[0]-externals[1]) @@ -122,8 +122,8 @@ def compute_rates(voi, states, rates, constants, computed_constants, algebraic, def compute_variables(voi, states, rates, constants, computed_constants, algebraic, external_variable): - externals[1] = external_variable(voi, states, rates, variables, 1) - externals[0] = external_variable(voi, states, rates, variables, 0) + externals[1] = external_variable(voi, states, rates, constants, computed_constants, algebraic, 1) + externals[0] = external_variable(voi, states, rates, constants, computed_constants, algebraic, 0) algebraic[4] = externals[0]-10.613 algebraic[1] = constants[1]*(states[0]-algebraic[4]) algebraic[5] = externals[0]-115.0 diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.c index 8c7192206a..a1c9778c88 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.c @@ -134,8 +134,8 @@ void computeComputedConstants(double *constants, double *computedConstants) void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) { algebraic[0] = ((voi >= 10.0) && (voi <= 10.5))?-20.0:0.0; - externals[1] = externalVariable(voi, states, rates, variables, 1); - externals[0] = externalVariable(voi, states, rates, variables, 0); + externals[1] = externalVariable(voi, states, rates, constants, computedConstants, algebraic, 1); + externals[0] = externalVariable(voi, states, rates, constants, computedConstants, algebraic, 0); algebraic[1] = constants[1]*(states[0]-computedConstants[0]); algebraic[2] = constants[2]*pow(states[3], 4.0)*(states[0]-computedConstants[2]); algebraic[3] = externals[1]*pow(states[2], 3.0)*states[1]*(states[0]-computedConstants[1]); @@ -154,7 +154,7 @@ void computeRates(double voi, double *states, double *rates, double *constants, void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) { algebraic[1] = constants[1]*(states[0]-computedConstants[0]); - externals[1] = externalVariable(voi, states, rates, variables, 1); + externals[1] = externalVariable(voi, states, rates, constants, computedConstants, algebraic, 1); algebraic[3] = externals[1]*pow(states[2], 3.0)*states[1]*(states[0]-computedConstants[1]); algebraic[4] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0); algebraic[5] = 4.0*exp(states[0]/18.0); @@ -163,5 +163,5 @@ void computeVariables(double voi, double *states, double *rates, double *constan algebraic[2] = constants[2]*pow(states[3], 4.0)*(states[0]-computedConstants[2]); algebraic[8] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0); algebraic[9] = 0.125*exp(states[0]/80.0); - externals[0] = externalVariable(voi, states, rates, variables, 0); + externals[0] = externalVariable(voi, states, rates, constants, computedConstants, algebraic, 0); } diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.h index 1ba9603ccd..35a6bd9c3d 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.h +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.h @@ -34,7 +34,7 @@ double * createExternalsArray(); void deleteArray(double *array); -typedef double (* ExternalVariable)(double voi, double *states, double *rates, double *variables, size_t index); +typedef double (* ExternalVariable)(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, size_t index); void initialiseVariables(double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.py index 88ab261a36..e72a244f02 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.py @@ -103,8 +103,8 @@ def compute_computed_constants(constants, computed_constants): def compute_rates(voi, states, rates, constants, computed_constants, algebraic, external_variable): algebraic[0] = -20.0 if and_func(geq_func(voi, 10.0), leq_func(voi, 10.5)) else 0.0 - externals[1] = external_variable(voi, states, rates, variables, 1) - externals[0] = external_variable(voi, states, rates, variables, 0) + externals[1] = external_variable(voi, states, rates, constants, computed_constants, algebraic, 1) + externals[0] = external_variable(voi, states, rates, constants, computed_constants, algebraic, 0) algebraic[1] = constants[1]*(states[0]-computed_constants[0]) algebraic[2] = constants[2]*pow(states[3], 4.0)*(states[0]-computed_constants[2]) algebraic[3] = externals[1]*pow(states[2], 3.0)*states[1]*(states[0]-computed_constants[1]) @@ -122,7 +122,7 @@ def compute_rates(voi, states, rates, constants, computed_constants, algebraic, def compute_variables(voi, states, rates, constants, computed_constants, algebraic, external_variable): algebraic[1] = constants[1]*(states[0]-computed_constants[0]) - externals[1] = external_variable(voi, states, rates, variables, 1) + externals[1] = external_variable(voi, states, rates, constants, computed_constants, algebraic, 1) algebraic[3] = externals[1]*pow(states[2], 3.0)*states[1]*(states[0]-computed_constants[1]) algebraic[4] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0) algebraic[5] = 4.0*exp(states[0]/18.0) @@ -131,4 +131,4 @@ def compute_variables(voi, states, rates, constants, computed_constants, algebra algebraic[2] = constants[2]*pow(states[3], 4.0)*(states[0]-computed_constants[2]) algebraic[8] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0) algebraic[9] = 0.125*exp(states[0]/80.0) - externals[0] = external_variable(voi, states, rates, variables, 0) + externals[0] = external_variable(voi, states, rates, constants, computed_constants, algebraic, 0) diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.c index b41fa29b6b..7c679fed8e 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.c @@ -133,7 +133,7 @@ void computeComputedConstants(double *constants, double *computedConstants) void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) { - externals[0] = externalVariable(voi, states, rates, variables, 0); + externals[0] = externalVariable(voi, states, rates, constants, computedConstants, algebraic, 0); algebraic[6] = 0.07*exp(externals[0]/20.0); algebraic[7] = 1.0/(exp((externals[0]+30.0)/10.0)+1.0); rates[0] = algebraic[6]*(1.0-states[0])-algebraic[7]*states[0]; @@ -145,9 +145,9 @@ void computeRates(double voi, double *states, double *rates, double *constants, void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) { algebraic[0] = ((voi >= 10.0) && (voi <= 10.5))?-20.0:0.0; - externals[0] = externalVariable(voi, states, rates, variables, 0); + externals[0] = externalVariable(voi, states, rates, constants, computedConstants, algebraic, 0); algebraic[1] = constants[2]*(externals[0]-computedConstants[0]); - externals[1] = externalVariable(voi, states, rates, variables, 1); + externals[1] = externalVariable(voi, states, rates, constants, computedConstants, algebraic, 1); algebraic[3] = constants[3]*pow(externals[1], 3.0)*states[0]*(externals[0]-computedConstants[1]); algebraic[4] = 0.1*(externals[0]+25.0)/(exp((externals[0]+25.0)/10.0)-1.0); algebraic[5] = 4.0*exp(externals[0]/18.0); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.h index 1ba9603ccd..35a6bd9c3d 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.h +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.h @@ -34,7 +34,7 @@ double * createExternalsArray(); void deleteArray(double *array); -typedef double (* ExternalVariable)(double voi, double *states, double *rates, double *variables, size_t index); +typedef double (* ExternalVariable)(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, size_t index); void initialiseVariables(double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.py index 47adbb19b5..d1dcd1929e 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.py @@ -102,7 +102,7 @@ def compute_computed_constants(constants, computed_constants): def compute_rates(voi, states, rates, constants, computed_constants, algebraic, external_variable): - externals[0] = external_variable(voi, states, rates, variables, 0) + externals[0] = external_variable(voi, states, rates, constants, computed_constants, algebraic, 0) algebraic[6] = 0.07*exp(externals[0]/20.0) algebraic[7] = 1.0/(exp((externals[0]+30.0)/10.0)+1.0) rates[0] = algebraic[6]*(1.0-states[0])-algebraic[7]*states[0] @@ -113,9 +113,9 @@ def compute_rates(voi, states, rates, constants, computed_constants, algebraic, def compute_variables(voi, states, rates, constants, computed_constants, algebraic, external_variable): algebraic[0] = -20.0 if and_func(geq_func(voi, 10.0), leq_func(voi, 10.5)) else 0.0 - externals[0] = external_variable(voi, states, rates, variables, 0) + externals[0] = external_variable(voi, states, rates, constants, computed_constants, algebraic, 0) algebraic[1] = constants[2]*(externals[0]-computed_constants[0]) - externals[1] = external_variable(voi, states, rates, variables, 1) + externals[1] = external_variable(voi, states, rates, constants, computed_constants, algebraic, 1) algebraic[3] = constants[3]*pow(externals[1], 3.0)*states[0]*(externals[0]-computed_constants[1]) algebraic[4] = 0.1*(externals[0]+25.0)/(exp((externals[0]+25.0)/10.0)-1.0) algebraic[5] = 4.0*exp(externals[0]/18.0) diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.c index a57d9f0404..f1285c30d3 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.c @@ -134,14 +134,14 @@ void computeComputedConstants(double *constants, double *computedConstants) void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) { - externals[0] = externalVariable(voi, states, rates, variables, 0); + externals[0] = externalVariable(voi, states, rates, constants, computedConstants, algebraic, 0); algebraic[3] = 0.1*(externals[0]+25.0)/(exp((externals[0]+25.0)/10.0)-1.0); algebraic[4] = 4.0*exp(externals[0]/18.0); rates[1] = algebraic[3]*(1.0-states[1])-algebraic[4]*states[1]; algebraic[5] = 0.07*exp(externals[0]/20.0); algebraic[6] = 1.0/(exp((externals[0]+30.0)/10.0)+1.0); rates[0] = algebraic[5]*(1.0-states[0])-algebraic[6]*states[0]; - externals[2] = externalVariable(voi, states, rates, variables, 2); + externals[2] = externalVariable(voi, states, rates, constants, computedConstants, algebraic, 2); algebraic[7] = 0.125*exp(externals[0]/80.0); rates[2] = externals[2]*(1.0-states[2])-algebraic[7]*states[2]; } @@ -149,9 +149,9 @@ void computeRates(double voi, double *states, double *rates, double *constants, void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) { algebraic[0] = ((voi >= 10.0) && (voi <= 10.5))?-20.0:0.0; - externals[0] = externalVariable(voi, states, rates, variables, 0); + externals[0] = externalVariable(voi, states, rates, constants, computedConstants, algebraic, 0); algebraic[1] = constants[2]*(externals[0]-computedConstants[0]); - externals[2] = externalVariable(voi, states, rates, variables, 2); - externals[1] = externalVariable(voi, states, rates, variables, 1); + externals[2] = externalVariable(voi, states, rates, constants, computedConstants, algebraic, 2); + externals[1] = externalVariable(voi, states, rates, constants, computedConstants, algebraic, 1); algebraic[2] = constants[4]*pow(states[2], 4.0)*(externals[0]-computedConstants[2]); } diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.h index 1ba9603ccd..35a6bd9c3d 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.h +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.h @@ -34,7 +34,7 @@ double * createExternalsArray(); void deleteArray(double *array); -typedef double (* ExternalVariable)(double voi, double *states, double *rates, double *variables, size_t index); +typedef double (* ExternalVariable)(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, size_t index); void initialiseVariables(double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.py index 2f58c315a4..b726fdfa06 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.py @@ -103,22 +103,22 @@ def compute_computed_constants(constants, computed_constants): def compute_rates(voi, states, rates, constants, computed_constants, algebraic, external_variable): - externals[0] = external_variable(voi, states, rates, variables, 0) + externals[0] = external_variable(voi, states, rates, constants, computed_constants, algebraic, 0) algebraic[3] = 0.1*(externals[0]+25.0)/(exp((externals[0]+25.0)/10.0)-1.0) algebraic[4] = 4.0*exp(externals[0]/18.0) rates[1] = algebraic[3]*(1.0-states[1])-algebraic[4]*states[1] algebraic[5] = 0.07*exp(externals[0]/20.0) algebraic[6] = 1.0/(exp((externals[0]+30.0)/10.0)+1.0) rates[0] = algebraic[5]*(1.0-states[0])-algebraic[6]*states[0] - externals[2] = external_variable(voi, states, rates, variables, 2) + externals[2] = external_variable(voi, states, rates, constants, computed_constants, algebraic, 2) algebraic[7] = 0.125*exp(externals[0]/80.0) rates[2] = externals[2]*(1.0-states[2])-algebraic[7]*states[2] def compute_variables(voi, states, rates, constants, computed_constants, algebraic, external_variable): algebraic[0] = -20.0 if and_func(geq_func(voi, 10.0), leq_func(voi, 10.5)) else 0.0 - externals[0] = external_variable(voi, states, rates, variables, 0) + externals[0] = external_variable(voi, states, rates, constants, computed_constants, algebraic, 0) algebraic[1] = constants[2]*(externals[0]-computed_constants[0]) - externals[2] = external_variable(voi, states, rates, variables, 2) - externals[1] = external_variable(voi, states, rates, variables, 1) + externals[2] = external_variable(voi, states, rates, constants, computed_constants, algebraic, 2) + externals[1] = external_variable(voi, states, rates, constants, computed_constants, algebraic, 1) algebraic[2] = constants[4]*pow(states[2], 4.0)*(externals[0]-computed_constants[2]) diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.c index 7ea8984c31..d6aed64a5e 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.c @@ -137,7 +137,7 @@ void computeRates(double voi, double *states, double *rates, double *constants, algebraic[0] = ((voi >= 10.0) && (voi <= 10.5))?-20.0:0.0; algebraic[1] = constants[2]*(states[0]-computedConstants[0]); algebraic[2] = constants[4]*pow(states[2], 4.0)*(states[0]-computedConstants[2]); - externals[0] = externalVariable(voi, states, rates, variables, 0); + externals[0] = externalVariable(voi, states, rates, constants, computedConstants, algebraic, 0); algebraic[3] = constants[3]*pow(externals[0], 3.0)*states[1]*(states[0]-computedConstants[1]); rates[0] = -(-algebraic[0]+algebraic[3]+algebraic[2]+algebraic[1])/constants[0]; algebraic[6] = 0.07*exp(states[0]/20.0); @@ -151,7 +151,7 @@ void computeRates(double voi, double *states, double *rates, double *constants, void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) { algebraic[1] = constants[2]*(states[0]-computedConstants[0]); - externals[0] = externalVariable(voi, states, rates, variables, 0); + externals[0] = externalVariable(voi, states, rates, constants, computedConstants, algebraic, 0); algebraic[3] = constants[3]*pow(externals[0], 3.0)*states[1]*(states[0]-computedConstants[1]); algebraic[4] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0); algebraic[5] = 4.0*exp(states[0]/18.0); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.h index 1ba9603ccd..35a6bd9c3d 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.h +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.h @@ -34,7 +34,7 @@ double * createExternalsArray(); void deleteArray(double *array); -typedef double (* ExternalVariable)(double voi, double *states, double *rates, double *variables, size_t index); +typedef double (* ExternalVariable)(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, size_t index); void initialiseVariables(double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.py index 5963bee10b..5ce36e54a9 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.py @@ -106,7 +106,7 @@ def compute_rates(voi, states, rates, constants, computed_constants, algebraic, algebraic[0] = -20.0 if and_func(geq_func(voi, 10.0), leq_func(voi, 10.5)) else 0.0 algebraic[1] = constants[2]*(states[0]-computed_constants[0]) algebraic[2] = constants[4]*pow(states[2], 4.0)*(states[0]-computed_constants[2]) - externals[0] = external_variable(voi, states, rates, variables, 0) + externals[0] = external_variable(voi, states, rates, constants, computed_constants, algebraic, 0) algebraic[3] = constants[3]*pow(externals[0], 3.0)*states[1]*(states[0]-computed_constants[1]) rates[0] = -(-algebraic[0]+algebraic[3]+algebraic[2]+algebraic[1])/constants[0] algebraic[6] = 0.07*exp(states[0]/20.0) @@ -119,7 +119,7 @@ def compute_rates(voi, states, rates, constants, computed_constants, algebraic, def compute_variables(voi, states, rates, constants, computed_constants, algebraic, external_variable): algebraic[1] = constants[2]*(states[0]-computed_constants[0]) - externals[0] = external_variable(voi, states, rates, variables, 0) + externals[0] = external_variable(voi, states, rates, constants, computed_constants, algebraic, 0) algebraic[3] = constants[3]*pow(externals[0], 3.0)*states[1]*(states[0]-computed_constants[1]) algebraic[4] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0) algebraic[5] = 4.0*exp(states[0]/18.0) diff --git a/tests/resources/generator/unknown_variable_as_external_variable/model.c b/tests/resources/generator/unknown_variable_as_external_variable/model.c index 4ba572946e..439e1bb420 100644 --- a/tests/resources/generator/unknown_variable_as_external_variable/model.c +++ b/tests/resources/generator/unknown_variable_as_external_variable/model.c @@ -102,6 +102,6 @@ void computeComputedConstants(double *constants, double *computedConstants) void computeVariables(double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) { - externals[0] = externalVariable(variables, 0); + externals[0] = externalVariable(constants, computedConstants, algebraic, 0); algebraic[0] = constants[0]*(constants[1]*constants[2]-constants[3]*constants[4])/(constants[5]*constants[4]+externals[0]*constants[2]+constants[7]*constants[4]*constants[2]+constants[6]); } diff --git a/tests/resources/generator/unknown_variable_as_external_variable/model.h b/tests/resources/generator/unknown_variable_as_external_variable/model.h index c4d3c40201..49b5d66b7b 100644 --- a/tests/resources/generator/unknown_variable_as_external_variable/model.h +++ b/tests/resources/generator/unknown_variable_as_external_variable/model.h @@ -30,7 +30,7 @@ double * createExternalsArray(); void deleteArray(double *array); -typedef double (* ExternalVariable)(double *variables, size_t index); +typedef double (* ExternalVariable)(double *constants, double *computedConstants, double *algebraic, size_t index); void initialiseVariables(double *constants, double *computedConstants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); diff --git a/tests/resources/generator/unknown_variable_as_external_variable/model.py b/tests/resources/generator/unknown_variable_as_external_variable/model.py index bdd145f68d..399e6d5bb3 100644 --- a/tests/resources/generator/unknown_variable_as_external_variable/model.py +++ b/tests/resources/generator/unknown_variable_as_external_variable/model.py @@ -67,5 +67,5 @@ def compute_computed_constants(constants, computed_constants): def compute_variables(constants, computed_constants, algebraic, external_variable): - externals[0] = external_variable(variables, 0) + externals[0] = external_variable(constants, computed_constants, algebraic, 0) algebraic[0] = constants[0]*(constants[1]*constants[2]-constants[3]*constants[4])/(constants[5]*constants[4]+externals[0]*constants[2]+constants[7]*constants[4]*constants[2]+constants[6]) From 183d531e76c88fc69450dc540712891d53ce5791 Mon Sep 17 00:00:00 2001 From: Alan Garny Date: Tue, 20 Aug 2024 10:09:44 +0200 Subject: [PATCH 44/85] Tests: some minor cleaning up. --- tests/generator/generator.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/generator/generator.cpp b/tests/generator/generator.cpp index 52ccea486f..1808a8d52c 100644 --- a/tests/generator/generator.cpp +++ b/tests/generator/generator.cpp @@ -1514,12 +1514,12 @@ TEST(Generator, hodgkinHuxleySquidAxonModel1952WithAlgebraicVariablesAsExternalV auto analyser = libcellml::Analyser::create(); auto potassium_channel_n_gate_beta_n = model->component("potassium_channel_n_gate")->variable("beta_n"); - auto membrane_i_Stime = libcellml::AnalyserExternalVariable::create(model->component("membrane")->variable("i_Stim")); + auto membrane_i_Stim = libcellml::AnalyserExternalVariable::create(model->component("membrane")->variable("i_Stim")); - membrane_i_Stime->addDependency(potassium_channel_n_gate_beta_n); + membrane_i_Stim->addDependency(potassium_channel_n_gate_beta_n); analyser->addExternalVariable(libcellml::AnalyserExternalVariable::create(potassium_channel_n_gate_beta_n)); - analyser->addExternalVariable(membrane_i_Stime); + analyser->addExternalVariable(membrane_i_Stim); analyser->analyseModel(model); From 54e667365d4e663ec3466f62bcb3a1f3549c4da8 Mon Sep 17 00:00:00 2001 From: Alan Garny Date: Wed, 21 Aug 2024 21:30:03 +0200 Subject: [PATCH 45/85] Some minor cleaning up. --- src/analyser.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/analyser.cpp b/src/analyser.cpp index 2f1359eeee..519f9c9dfc 100644 --- a/src/analyser.cpp +++ b/src/analyser.cpp @@ -2782,13 +2782,11 @@ void Analyser::AnalyserImpl::analyseModel(const ModelPtr &model) // in the API. std::map aie2aeMappings; - std::map v2aeMappings; for (const auto &internalEquation : mInternalEquations) { auto equation = AnalyserEquation::AnalyserEquationImpl::create(); aie2aeMappings.emplace(internalEquation, equation); - v2aeMappings.emplace(internalEquation->mUnknownVariables.front()->mVariable, equation); } // Start making our internal equations available through our API. From 62dc092a4d9f653a60a2093117dbc6449c19c4b1 Mon Sep 17 00:00:00 2001 From: Alan Garny Date: Tue, 20 Aug 2024 09:01:48 +0200 Subject: [PATCH 46/85] GeneratorProfile: use the externals array to retrieve the value of external variables. --- src/api/libcellml/generatorprofile.h | 8 +- src/generator.cpp | 4 +- src/generatorprofile.cpp | 113 ++++++++++++------ src/generatorprofile_p.h | 8 +- src/generatorprofilesha1values.h | 4 +- src/generatorprofiletools.cpp | 6 +- .../javascript/generatorprofile.test.js | 14 ++- .../bindings/python/test_generator_profile.py | 40 ++++--- tests/generator/generatorprofile.cpp | 53 +++++--- .../model.external.c | 4 +- .../model.external.h | 4 +- .../model.external.py | 4 +- .../model.external.c | 4 +- .../model.external.h | 4 +- .../model.external.py | 4 +- .../model.external.c | 8 +- .../model.external.h | 4 +- .../model.external.py | 8 +- .../cell_geometry_model/model.external.c | 6 +- .../cell_geometry_model/model.external.h | 4 +- .../cell_geometry_model/model.external.py | 6 +- .../model.algebraic.c | 8 +- .../model.algebraic.h | 6 +- .../model.algebraic.py | 8 +- .../model.computed.constant.c | 8 +- .../model.computed.constant.h | 6 +- .../model.computed.constant.py | 8 +- .../model.constant.c | 8 +- .../model.constant.h | 6 +- .../model.constant.py | 8 +- .../model.dependent.algebraic.c | 12 +- .../model.dependent.algebraic.h | 6 +- .../model.dependent.algebraic.py | 12 +- .../model.dependent.computed.constant.c | 12 +- .../model.dependent.computed.constant.h | 6 +- .../model.dependent.computed.constant.py | 12 +- .../model.dependent.constant.c | 12 +- .../model.dependent.constant.h | 6 +- .../model.dependent.constant.py | 12 +- .../model.dependent.state.c | 10 +- .../model.dependent.state.h | 6 +- .../model.dependent.state.py | 10 +- .../model.external.c | 14 +-- .../model.external.h | 6 +- .../model.external.py | 14 +-- .../model.state.c | 8 +- .../model.state.h | 6 +- .../model.state.py | 8 +- .../model.c | 4 +- .../model.h | 4 +- .../model.py | 4 +- 51 files changed, 323 insertions(+), 237 deletions(-) diff --git a/src/api/libcellml/generatorprofile.h b/src/api/libcellml/generatorprofile.h index 33b889c117..12e14cc260 100644 --- a/src/api/libcellml/generatorprofile.h +++ b/src/api/libcellml/generatorprofile.h @@ -3212,11 +3212,14 @@ class LIBCELLML_EXPORT GeneratorProfile * @param forDifferentialModel Whether the call to the root finding * information object is for a differential model, as opposed to an * algebraic model. + * @param withExternalVariables Whether the call to the root finding + * information object is for a model with external variables. * * @return The @c std::string for the data structure for the root finding * information object. */ - std::string rootFindingInfoObjectString(bool forDifferentialModel) const; + std::string rootFindingInfoObjectString(bool forDifferentialModel, + bool withExternalVariables) const; /** * @brief Set the @c std::string for the data structure for the root finding @@ -3228,10 +3231,13 @@ class LIBCELLML_EXPORT GeneratorProfile * @param forDifferentialModel Whether the call to the root finding * information object is for a differential model, as opposed to an * algebraic model. + * @param withExternalVariables Whether the call to the root finding + * information object is for a model with external variables. * @param rootFindingInfoObjectString The @c std::string to use for the data * structure for the root finding information object. */ void setRootFindingInfoObjectString(bool forDifferentialModel, + bool withExternalVariables, const std::string &rootFindingInfoObjectString); /** diff --git a/src/generator.cpp b/src/generator.cpp index 9def5a35f7..7f5a6261d8 100644 --- a/src/generator.cpp +++ b/src/generator.cpp @@ -727,9 +727,9 @@ void Generator::GeneratorImpl::addExternalVariableMethodTypeDefinitionCode() void Generator::GeneratorImpl::addRootFindingInfoObjectCode() { if (modelHasNlas() - && !mProfile->rootFindingInfoObjectString(modelHasOdes()).empty()) { + && !mProfile->rootFindingInfoObjectString(modelHasOdes(), mModel->hasExternalVariables()).empty()) { mCode += newLineIfNeeded() - + mProfile->rootFindingInfoObjectString(modelHasOdes()); + + mProfile->rootFindingInfoObjectString(modelHasOdes(), mModel->hasExternalVariables()); } } diff --git a/src/generatorprofile.cpp b/src/generatorprofile.cpp index 6c51b0242d..b388edeebd 100644 --- a/src/generatorprofile.cpp +++ b/src/generatorprofile.cpp @@ -290,25 +290,42 @@ void GeneratorProfile::GeneratorProfileImpl::loadProfile(GeneratorProfile::Profi mAlgebraicArrayString = "algebraic"; mExternalArrayString = "externals"; - mExternalVariableMethodTypeDefinitionFamString = "typedef double (* ExternalVariable)(double *constants, double *computedConstants, double *algebraic, size_t index);\n"; - mExternalVariableMethodTypeDefinitionFdmString = "typedef double (* ExternalVariable)(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, size_t index);\n"; - - mExternalVariableMethodCallFamString = "externalVariable(constants, computedConstants, algebraic, [INDEX])"; - mExternalVariableMethodCallFdmString = "externalVariable(voi, states, rates, constants, computedConstants, algebraic, [INDEX])"; - - mRootFindingInfoObjectFamString = "typedef struct {\n" - " double *constants;\n" - " double *computedConstants;\n" - " double *algebraic;\n" - "} RootFindingInfo;\n"; - mRootFindingInfoObjectFdmString = "typedef struct {\n" - " double voi;\n" - " double *states;\n" - " double *rates;\n" - " double *constants;\n" - " double *computedConstants;\n" - " double *algebraic;\n" - "} RootFindingInfo;\n"; + mExternalVariableMethodTypeDefinitionFamString = "typedef double (* ExternalVariable)(double *constants, double *computedConstants, double *algebraic, double *externals, size_t index);\n"; + mExternalVariableMethodTypeDefinitionFdmString = "typedef double (* ExternalVariable)(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, double *externals, size_t index);\n"; + + mExternalVariableMethodCallFamString = "externalVariable(constants, computedConstants, algebraic, externals, [INDEX])"; + mExternalVariableMethodCallFdmString = "externalVariable(voi, states, rates, constants, computedConstants, algebraic, externals, [INDEX])"; + + mRootFindingInfoObjectFamWoevString = "typedef struct {\n" + " double *constants;\n" + " double *computedConstants;\n" + " double *algebraic;\n" + "} RootFindingInfo;\n"; + mRootFindingInfoObjectFamWevString = "typedef struct {\n" + " double *constants;\n" + " double *computedConstants;\n" + " double *algebraic;\n" + " double *externals;\n" + "} RootFindingInfo;\n"; + + mRootFindingInfoObjectFdmWoevString = "typedef struct {\n" + " double voi;\n" + " double *states;\n" + " double *rates;\n" + " double *constants;\n" + " double *computedConstants;\n" + " double *algebraic;\n" + "} RootFindingInfo;\n"; + mRootFindingInfoObjectFdmWevString = "typedef struct {\n" + " double voi;\n" + " double *states;\n" + " double *rates;\n" + " double *constants;\n" + " double *computedConstants;\n" + " double *algebraic;\n" + " double *externals;\n" + "} RootFindingInfo;\n"; + mExternNlaSolveMethodString = "extern void nlaSolve(void (*objectiveFunction)(double *, double *, void *),\n" " double *u, size_t n, void *data);\n"; mFindRootCallFamString = "findRoot[INDEX](constants, computedConstants, algebraic);\n"; @@ -440,8 +457,8 @@ void GeneratorProfile::GeneratorProfileImpl::loadProfile(GeneratorProfile::Profi "[CODE]" "}\n"; - mInterfaceComputeRatesMethodWevString = "void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable);\n"; - mImplementationComputeRatesMethodWevString = "void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable)\n{\n" + mInterfaceComputeRatesMethodWevString = "void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, double *externals, ExternalVariable externalVariable);\n"; + mImplementationComputeRatesMethodWevString = "void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, double *externals, ExternalVariable externalVariable)\n{\n" "[CODE]" "}\n"; @@ -451,8 +468,8 @@ void GeneratorProfile::GeneratorProfileImpl::loadProfile(GeneratorProfile::Profi "[CODE]" "}\n"; - mInterfaceComputeVariablesMethodFamWevString = "void computeVariables(double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable);\n"; - mImplementationComputeVariablesMethodFamWevString = "void computeVariables(double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable)\n" + mInterfaceComputeVariablesMethodFamWevString = "void computeVariables(double *constants, double *computedConstants, double *algebraic, double *externals, ExternalVariable externalVariable);\n"; + mImplementationComputeVariablesMethodFamWevString = "void computeVariables(double *constants, double *computedConstants, double *algebraic, double *externals, ExternalVariable externalVariable)\n" "{\n" "[CODE]" "}\n"; @@ -463,8 +480,8 @@ void GeneratorProfile::GeneratorProfileImpl::loadProfile(GeneratorProfile::Profi "[CODE]" "}\n"; - mInterfaceComputeVariablesMethodFdmWevString = "void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable);\n"; - mImplementationComputeVariablesMethodFdmWevString = "void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable)\n" + mInterfaceComputeVariablesMethodFdmWevString = "void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, double *externals, ExternalVariable externalVariable);\n"; + mImplementationComputeVariablesMethodFdmWevString = "void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, double *externals, ExternalVariable externalVariable)\n" "{\n" "[CODE]" "}\n"; @@ -742,11 +759,15 @@ void GeneratorProfile::GeneratorProfileImpl::loadProfile(GeneratorProfile::Profi mExternalVariableMethodTypeDefinitionFamString = ""; mExternalVariableMethodTypeDefinitionFdmString = ""; - mExternalVariableMethodCallFamString = "external_variable(constants, computed_constants, algebraic, [INDEX])"; - mExternalVariableMethodCallFdmString = "external_variable(voi, states, rates, constants, computed_constants, algebraic, [INDEX])"; + mExternalVariableMethodCallFamString = "external_variable(constants, computed_constants, algebraic, externals, [INDEX])"; + mExternalVariableMethodCallFdmString = "external_variable(voi, states, rates, constants, computed_constants, algebraic, externals, [INDEX])"; + + mRootFindingInfoObjectFamWoevString = ""; + mRootFindingInfoObjectFamWevString = ""; + + mRootFindingInfoObjectFdmWoevString = ""; + mRootFindingInfoObjectFdmWevString = ""; - mRootFindingInfoObjectFamString = ""; - mRootFindingInfoObjectFdmString = ""; mExternNlaSolveMethodString = "\n" "from nlasolver import nla_solve" "\n"; @@ -834,7 +855,7 @@ void GeneratorProfile::GeneratorProfileImpl::loadProfile(GeneratorProfile::Profi mInterfaceComputeRatesMethodWevString = ""; mImplementationComputeRatesMethodWevString = "\n" - "def compute_rates(voi, states, rates, constants, computed_constants, algebraic, external_variable):\n" + "def compute_rates(voi, states, rates, constants, computed_constants, algebraic, externals, external_variable):\n" "[CODE]"; mInterfaceComputeVariablesMethodFamWoevString = ""; @@ -844,7 +865,7 @@ void GeneratorProfile::GeneratorProfileImpl::loadProfile(GeneratorProfile::Profi mInterfaceComputeVariablesMethodFamWevString = ""; mImplementationComputeVariablesMethodFamWevString = "\n" - "def compute_variables(constants, computed_constants, algebraic, external_variable):\n" + "def compute_variables(constants, computed_constants, algebraic, externals, external_variable):\n" "[CODE]"; mInterfaceComputeVariablesMethodFdmWoevString = ""; @@ -854,7 +875,7 @@ void GeneratorProfile::GeneratorProfileImpl::loadProfile(GeneratorProfile::Profi mInterfaceComputeVariablesMethodFdmWevString = ""; mImplementationComputeVariablesMethodFdmWevString = "\n" - "def compute_variables(voi, states, rates, constants, computed_constants, algebraic, external_variable):\n" + "def compute_variables(voi, states, rates, constants, computed_constants, algebraic, externals, external_variable):\n" "[CODE]"; mEmptyMethodString = "pass\n"; @@ -2328,22 +2349,40 @@ void GeneratorProfile::setExternalVariableMethodCallString(bool forDifferentialM } } -std::string GeneratorProfile::rootFindingInfoObjectString(bool forDifferentialModel) const +std::string GeneratorProfile::rootFindingInfoObjectString(bool forDifferentialModel, + bool withExternalVariables) const { if (forDifferentialModel) { - return mPimpl->mRootFindingInfoObjectFdmString; + if (withExternalVariables) { + return mPimpl->mRootFindingInfoObjectFdmWevString; + } + + return mPimpl->mRootFindingInfoObjectFdmWoevString; } - return mPimpl->mRootFindingInfoObjectFamString; + if (withExternalVariables) { + return mPimpl->mRootFindingInfoObjectFamWevString; + } + + return mPimpl->mRootFindingInfoObjectFamWoevString; } void GeneratorProfile::setRootFindingInfoObjectString(bool forDifferentialModel, + bool withExternalVariables, const std::string &rootFindingInfoObjectString) { if (forDifferentialModel) { - mPimpl->mRootFindingInfoObjectFdmString = rootFindingInfoObjectString; + if (withExternalVariables) { + mPimpl->mRootFindingInfoObjectFdmWevString = rootFindingInfoObjectString; + } else { + mPimpl->mRootFindingInfoObjectFdmWoevString = rootFindingInfoObjectString; + } } else { - mPimpl->mRootFindingInfoObjectFamString = rootFindingInfoObjectString; + if (withExternalVariables) { + mPimpl->mRootFindingInfoObjectFamWevString = rootFindingInfoObjectString; + } else { + mPimpl->mRootFindingInfoObjectFamWoevString = rootFindingInfoObjectString; + } } } diff --git a/src/generatorprofile_p.h b/src/generatorprofile_p.h index 5ab7bb5a7b..fda7cf543d 100644 --- a/src/generatorprofile_p.h +++ b/src/generatorprofile_p.h @@ -225,8 +225,12 @@ struct GeneratorProfile::GeneratorProfileImpl std::string mExternalVariableMethodCallFamString; std::string mExternalVariableMethodCallFdmString; - std::string mRootFindingInfoObjectFamString; - std::string mRootFindingInfoObjectFdmString; + std::string mRootFindingInfoObjectFamWoevString; + std::string mRootFindingInfoObjectFamWevString; + + std::string mRootFindingInfoObjectFdmWoevString; + std::string mRootFindingInfoObjectFdmWevString; + std::string mExternNlaSolveMethodString; std::string mFindRootCallFamString; std::string mFindRootCallFdmString; diff --git a/src/generatorprofilesha1values.h b/src/generatorprofilesha1values.h index e4bf327ed5..1c6ba04d83 100644 --- a/src/generatorprofilesha1values.h +++ b/src/generatorprofilesha1values.h @@ -24,7 +24,7 @@ namespace libcellml { * The content of this file is generated, do not edit this file directly. * See docs/dev_utilities.rst for further information. */ -static const char C_GENERATOR_PROFILE_SHA1[] = "1e07f5b270d8f8fe62cffa8bcd81bf04804aa9e5"; -static const char PYTHON_GENERATOR_PROFILE_SHA1[] = "3c4d4503bca8066e85c60491ac85a960ec8144bf"; +static const char C_GENERATOR_PROFILE_SHA1[] = "d3c84f25e69c62eaf1a154bf75d4394185cf7e23"; +static const char PYTHON_GENERATOR_PROFILE_SHA1[] = "06014d14cb0b183d9ba4952c56eb36388da5de28"; } // namespace libcellml diff --git a/src/generatorprofiletools.cpp b/src/generatorprofiletools.cpp index d68bb59bc5..c85fe94110 100644 --- a/src/generatorprofiletools.cpp +++ b/src/generatorprofiletools.cpp @@ -491,8 +491,10 @@ std::string generatorProfileAsString(const GeneratorProfilePtr &generatorProfile profileContents += generatorProfile->externalVariableMethodCallString(false) + generatorProfile->externalVariableMethodCallString(true); - profileContents += generatorProfile->rootFindingInfoObjectString(false) - + generatorProfile->rootFindingInfoObjectString(true) + profileContents += generatorProfile->rootFindingInfoObjectString(false, false) + + generatorProfile->rootFindingInfoObjectString(false, true) + + generatorProfile->rootFindingInfoObjectString(true, false) + + generatorProfile->rootFindingInfoObjectString(true, true) + generatorProfile->externNlaSolveMethodString() + generatorProfile->findRootCallString(false) + generatorProfile->findRootCallString(true) diff --git a/tests/bindings/javascript/generatorprofile.test.js b/tests/bindings/javascript/generatorprofile.test.js index 7d1a1cc841..1b728eec35 100644 --- a/tests/bindings/javascript/generatorprofile.test.js +++ b/tests/bindings/javascript/generatorprofile.test.js @@ -819,11 +819,17 @@ describe("GeneratorProfile tests", () => { test("Checking GeneratorProfile.rootFindingInfoObjectString.", () => { const x = new libcellml.GeneratorProfile(libcellml.GeneratorProfile.Profile.C) - x.setRootFindingInfoObjectString(false, "something") - expect(x.rootFindingInfoObjectString(false)).toBe("something") + x.setRootFindingInfoObjectString(false, false, "something") + expect(x.rootFindingInfoObjectString(false, false)).toBe("something") - x.setRootFindingInfoObjectString(true, "something") - expect(x.rootFindingInfoObjectString(true)).toBe("something") + x.setRootFindingInfoObjectString(false, true, "something") + expect(x.rootFindingInfoObjectString(false, true)).toBe("something") + + x.setRootFindingInfoObjectString(true, false, "something") + expect(x.rootFindingInfoObjectString(true, false)).toBe("something") + + x.setRootFindingInfoObjectString(true, true, "something") + expect(x.rootFindingInfoObjectString(true, true)).toBe("something") }); test("Checking GeneratorProfile.externNlaSolveMethodString.", () => { const x = new libcellml.GeneratorProfile(libcellml.GeneratorProfile.Profile.C) diff --git a/tests/bindings/python/test_generator_profile.py b/tests/bindings/python/test_generator_profile.py index 5ec63521cd..b3bb6ad3ae 100644 --- a/tests/bindings/python/test_generator_profile.py +++ b/tests/bindings/python/test_generator_profile.py @@ -724,7 +724,7 @@ def test_implementation_compute_rates_method_string(self): self.assertEqual(GeneratorProfileTestCase.VALUE, g.implementationComputeRatesMethodString(False)) self.assertEqual( - 'void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable)\n{\n[CODE]}\n', + 'void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, double *externals, ExternalVariable externalVariable)\n{\n[CODE]}\n', g.implementationComputeRatesMethodString(True)) g.setImplementationComputeRatesMethodString(True, GeneratorProfileTestCase.VALUE) self.assertEqual(GeneratorProfileTestCase.VALUE, g.implementationComputeRatesMethodString(True)) @@ -741,7 +741,7 @@ def test_implementation_compute_variables_method_string(self): self.assertEqual(GeneratorProfileTestCase.VALUE, g.implementationComputeVariablesMethodString(False, False)) self.assertEqual( - 'void computeVariables(double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable)\n{\n[CODE]}\n', + 'void computeVariables(double *constants, double *computedConstants, double *algebraic, double *externals, ExternalVariable externalVariable)\n{\n[CODE]}\n', g.implementationComputeVariablesMethodString(False, True)) g.setImplementationComputeVariablesMethodString(False, True, GeneratorProfileTestCase.VALUE) self.assertEqual(GeneratorProfileTestCase.VALUE, g.implementationComputeVariablesMethodString(False, True)) @@ -753,7 +753,7 @@ def test_implementation_compute_variables_method_string(self): self.assertEqual(GeneratorProfileTestCase.VALUE, g.implementationComputeVariablesMethodString(True, False)) self.assertEqual( - 'void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable)\n{\n[CODE]}\n', + 'void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, double *externals, ExternalVariable externalVariable)\n{\n[CODE]}\n', g.implementationComputeVariablesMethodString(True, True)) g.setImplementationComputeVariablesMethodString(True, True, GeneratorProfileTestCase.VALUE) self.assertEqual(GeneratorProfileTestCase.VALUE, g.implementationComputeVariablesMethodString(True, True)) @@ -1006,7 +1006,7 @@ def test_interface_compute_rates_method_string(self): self.assertEqual(GeneratorProfileTestCase.VALUE, g.interfaceComputeRatesMethodString(False)) self.assertEqual( - 'void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable);\n', + 'void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, double *externals, ExternalVariable externalVariable);\n', g.interfaceComputeRatesMethodString(True)) g.setInterfaceComputeRatesMethodString(True, GeneratorProfileTestCase.VALUE) self.assertEqual(GeneratorProfileTestCase.VALUE, g.interfaceComputeRatesMethodString(True)) @@ -1023,7 +1023,7 @@ def test_interface_compute_variables_method_string(self): self.assertEqual(GeneratorProfileTestCase.VALUE, g.interfaceComputeVariablesMethodString(False, False)) self.assertEqual( - 'void computeVariables(double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable);\n', + 'void computeVariables(double *constants, double *computedConstants, double *algebraic, double *externals, ExternalVariable externalVariable);\n', g.interfaceComputeVariablesMethodString(False, True)) g.setInterfaceComputeVariablesMethodString(False, True, GeneratorProfileTestCase.VALUE) self.assertEqual(GeneratorProfileTestCase.VALUE, g.interfaceComputeVariablesMethodString(False, True)) @@ -1035,7 +1035,7 @@ def test_interface_compute_variables_method_string(self): self.assertEqual(GeneratorProfileTestCase.VALUE, g.interfaceComputeVariablesMethodString(True, False)) self.assertEqual( - 'void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable);\n', + 'void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, double *externals, ExternalVariable externalVariable);\n', g.interfaceComputeVariablesMethodString(True, True)) g.setInterfaceComputeVariablesMethodString(True, True, GeneratorProfileTestCase.VALUE) self.assertEqual(GeneratorProfileTestCase.VALUE, g.interfaceComputeVariablesMethodString(True, True)) @@ -1677,13 +1677,13 @@ def test_external_variable_method_type_definition_string(self): g = GeneratorProfile() self.assertEqual( - 'typedef double (* ExternalVariable)(double *constants, double *computedConstants, double *algebraic, size_t index);\n', + 'typedef double (* ExternalVariable)(double *constants, double *computedConstants, double *algebraic, double *externals, size_t index);\n', g.externalVariableMethodTypeDefinitionString(False)) g.setExternalVariableMethodTypeDefinitionString(False, GeneratorProfileTestCase.VALUE) self.assertEqual(GeneratorProfileTestCase.VALUE, g.externalVariableMethodTypeDefinitionString(False)) self.assertEqual( - 'typedef double (* ExternalVariable)(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, size_t index);\n', + 'typedef double (* ExternalVariable)(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, double *externals, size_t index);\n', g.externalVariableMethodTypeDefinitionString(True)) g.setExternalVariableMethodTypeDefinitionString(True, GeneratorProfileTestCase.VALUE) self.assertEqual(GeneratorProfileTestCase.VALUE, g.externalVariableMethodTypeDefinitionString(True)) @@ -1693,12 +1693,12 @@ def test_external_variable_method_call_string(self): g = GeneratorProfile() - self.assertEqual('externalVariable(constants, computedConstants, algebraic, [INDEX])', + self.assertEqual('externalVariable(constants, computedConstants, algebraic, externals, [INDEX])', g.externalVariableMethodCallString(False)) g.setExternalVariableMethodCallString(False, GeneratorProfileTestCase.VALUE) self.assertEqual(GeneratorProfileTestCase.VALUE, g.externalVariableMethodCallString(False)) - self.assertEqual('externalVariable(voi, states, rates, constants, computedConstants, algebraic, [INDEX])', + self.assertEqual('externalVariable(voi, states, rates, constants, computedConstants, algebraic, externals, [INDEX])', g.externalVariableMethodCallString(True)) g.setExternalVariableMethodCallString(True, GeneratorProfileTestCase.VALUE) self.assertEqual(GeneratorProfileTestCase.VALUE, g.externalVariableMethodCallString(True)) @@ -1708,13 +1708,21 @@ def test_root_finding_info_object_string(self): g = GeneratorProfile() - self.assertEqual('typedef struct {\n double *constants;\n double *computedConstants;\n double *algebraic;\n} RootFindingInfo;\n', g.rootFindingInfoObjectString(False)) - g.setRootFindingInfoObjectString(False, GeneratorProfileTestCase.VALUE) - self.assertEqual(GeneratorProfileTestCase.VALUE, g.rootFindingInfoObjectString(False)) + self.assertEqual('typedef struct {\n double *constants;\n double *computedConstants;\n double *algebraic;\n} RootFindingInfo;\n', g.rootFindingInfoObjectString(False, False)) + g.setRootFindingInfoObjectString(False, False, GeneratorProfileTestCase.VALUE) + self.assertEqual(GeneratorProfileTestCase.VALUE, g.rootFindingInfoObjectString(False, False)) - self.assertEqual('typedef struct {\n double voi;\n double *states;\n double *rates;\n double *constants;\n double *computedConstants;\n double *algebraic;\n} RootFindingInfo;\n', g.rootFindingInfoObjectString(True)) - g.setRootFindingInfoObjectString(True, GeneratorProfileTestCase.VALUE) - self.assertEqual(GeneratorProfileTestCase.VALUE, g.rootFindingInfoObjectString(True)) + self.assertEqual('typedef struct {\n double *constants;\n double *computedConstants;\n double *algebraic;\n double *externals;\n} RootFindingInfo;\n', g.rootFindingInfoObjectString(False, True)) + g.setRootFindingInfoObjectString(False, True, GeneratorProfileTestCase.VALUE) + self.assertEqual(GeneratorProfileTestCase.VALUE, g.rootFindingInfoObjectString(False, True)) + + self.assertEqual('typedef struct {\n double voi;\n double *states;\n double *rates;\n double *constants;\n double *computedConstants;\n double *algebraic;\n} RootFindingInfo;\n', g.rootFindingInfoObjectString(True, False)) + g.setRootFindingInfoObjectString(True, False, GeneratorProfileTestCase.VALUE) + self.assertEqual(GeneratorProfileTestCase.VALUE, g.rootFindingInfoObjectString(True, False)) + + self.assertEqual('typedef struct {\n double voi;\n double *states;\n double *rates;\n double *constants;\n double *computedConstants;\n double *algebraic;\n double *externals;\n} RootFindingInfo;\n', g.rootFindingInfoObjectString(True, True)) + g.setRootFindingInfoObjectString(True, True, GeneratorProfileTestCase.VALUE) + self.assertEqual(GeneratorProfileTestCase.VALUE, g.rootFindingInfoObjectString(True, True)) def test_extern_nla_solve_method_string(self): from libcellml import GeneratorProfile diff --git a/tests/generator/generatorprofile.cpp b/tests/generator/generatorprofile.cpp index c95a5112af..c61172e51d 100644 --- a/tests/generator/generatorprofile.cpp +++ b/tests/generator/generatorprofile.cpp @@ -342,18 +342,34 @@ TEST(GeneratorProfile, defaultMiscellaneousValues) EXPECT_EQ("algebraic", generatorProfile->algebraicArrayString()); EXPECT_EQ("externals", generatorProfile->externalArrayString()); - EXPECT_EQ("typedef double (* ExternalVariable)(double *constants, double *computedConstants, double *algebraic, size_t index);\n", generatorProfile->externalVariableMethodTypeDefinitionString(false)); - EXPECT_EQ("typedef double (* ExternalVariable)(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, size_t index);\n", generatorProfile->externalVariableMethodTypeDefinitionString(true)); + EXPECT_EQ("typedef double (* ExternalVariable)(double *constants, double *computedConstants, double *algebraic, double *externals, size_t index);\n", generatorProfile->externalVariableMethodTypeDefinitionString(false)); + EXPECT_EQ("typedef double (* ExternalVariable)(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, double *externals, size_t index);\n", generatorProfile->externalVariableMethodTypeDefinitionString(true)); - EXPECT_EQ("externalVariable(constants, computedConstants, algebraic, [INDEX])", generatorProfile->externalVariableMethodCallString(false)); - EXPECT_EQ("externalVariable(voi, states, rates, constants, computedConstants, algebraic, [INDEX])", generatorProfile->externalVariableMethodCallString(true)); + EXPECT_EQ("externalVariable(constants, computedConstants, algebraic, externals, [INDEX])", generatorProfile->externalVariableMethodCallString(false)); + EXPECT_EQ("externalVariable(voi, states, rates, constants, computedConstants, algebraic, externals, [INDEX])", generatorProfile->externalVariableMethodCallString(true)); EXPECT_EQ("typedef struct {\n" " double *constants;\n" " double *computedConstants;\n" " double *algebraic;\n" "} RootFindingInfo;\n", - generatorProfile->rootFindingInfoObjectString(false)); + generatorProfile->rootFindingInfoObjectString(false, false)); + EXPECT_EQ("typedef struct {\n" + " double *constants;\n" + " double *computedConstants;\n" + " double *algebraic;\n" + " double *externals;\n" + "} RootFindingInfo;\n", + generatorProfile->rootFindingInfoObjectString(false, true)); + EXPECT_EQ("typedef struct {\n" + " double voi;\n" + " double *states;\n" + " double *rates;\n" + " double *constants;\n" + " double *computedConstants;\n" + " double *algebraic;\n" + "} RootFindingInfo;\n", + generatorProfile->rootFindingInfoObjectString(true, false)); EXPECT_EQ("typedef struct {\n" " double voi;\n" " double *states;\n" @@ -361,8 +377,9 @@ TEST(GeneratorProfile, defaultMiscellaneousValues) " double *constants;\n" " double *computedConstants;\n" " double *algebraic;\n" + " double *externals;\n" "} RootFindingInfo;\n", - generatorProfile->rootFindingInfoObjectString(true)); + generatorProfile->rootFindingInfoObjectString(true, true)); EXPECT_EQ("extern void nlaSolve(void (*objectiveFunction)(double *, double *, void *),\n" " double *u, size_t n, void *data);\n", generatorProfile->externNlaSolveMethodString()); @@ -526,9 +543,9 @@ TEST(GeneratorProfile, defaultMiscellaneousValues) "}\n", generatorProfile->implementationComputeRatesMethodString(false)); - EXPECT_EQ("void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable);\n", + EXPECT_EQ("void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, double *externals, ExternalVariable externalVariable);\n", generatorProfile->interfaceComputeRatesMethodString(true)); - EXPECT_EQ("void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable)\n" + EXPECT_EQ("void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, double *externals, ExternalVariable externalVariable)\n" "{\n" "[CODE]" "}\n", @@ -542,9 +559,9 @@ TEST(GeneratorProfile, defaultMiscellaneousValues) "}\n", generatorProfile->implementationComputeVariablesMethodString(false, false)); - EXPECT_EQ("void computeVariables(double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable);\n", + EXPECT_EQ("void computeVariables(double *constants, double *computedConstants, double *algebraic, double *externals, ExternalVariable externalVariable);\n", generatorProfile->interfaceComputeVariablesMethodString(false, true)); - EXPECT_EQ("void computeVariables(double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable)\n" + EXPECT_EQ("void computeVariables(double *constants, double *computedConstants, double *algebraic, double *externals, ExternalVariable externalVariable)\n" "{\n" "[CODE]" "}\n", @@ -558,9 +575,9 @@ TEST(GeneratorProfile, defaultMiscellaneousValues) "}\n", generatorProfile->implementationComputeVariablesMethodString(true, false)); - EXPECT_EQ("void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable);\n", + EXPECT_EQ("void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, double *externals, ExternalVariable externalVariable);\n", generatorProfile->interfaceComputeVariablesMethodString(true, true)); - EXPECT_EQ("void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable)\n" + EXPECT_EQ("void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, double *externals, ExternalVariable externalVariable)\n" "{\n" "[CODE]" "}\n", @@ -939,8 +956,10 @@ TEST(GeneratorProfile, miscellaneous) generatorProfile->setExternalVariableMethodCallString(false, value); generatorProfile->setExternalVariableMethodCallString(true, value); - generatorProfile->setRootFindingInfoObjectString(false, value); - generatorProfile->setRootFindingInfoObjectString(true, value); + generatorProfile->setRootFindingInfoObjectString(false, false, value); + generatorProfile->setRootFindingInfoObjectString(false, true, value); + generatorProfile->setRootFindingInfoObjectString(true, false, value); + generatorProfile->setRootFindingInfoObjectString(true, true, value); generatorProfile->setExternNlaSolveMethodString(value); generatorProfile->setFindRootCallString(false, value); generatorProfile->setFindRootCallString(true, value); @@ -1080,8 +1099,10 @@ TEST(GeneratorProfile, miscellaneous) EXPECT_EQ(value, generatorProfile->externalVariableMethodCallString(false)); EXPECT_EQ(value, generatorProfile->externalVariableMethodCallString(true)); - EXPECT_EQ(value, generatorProfile->rootFindingInfoObjectString(false)); - EXPECT_EQ(value, generatorProfile->rootFindingInfoObjectString(true)); + EXPECT_EQ(value, generatorProfile->rootFindingInfoObjectString(false, false)); + EXPECT_EQ(value, generatorProfile->rootFindingInfoObjectString(false, true)); + EXPECT_EQ(value, generatorProfile->rootFindingInfoObjectString(true, false)); + EXPECT_EQ(value, generatorProfile->rootFindingInfoObjectString(true, true)); EXPECT_EQ(value, generatorProfile->externNlaSolveMethodString()); EXPECT_EQ(value, generatorProfile->findRootCallString(false)); EXPECT_EQ(value, generatorProfile->findRootCallString(true)); diff --git a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.c b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.c index 6e39ffddf4..97aab6bf2e 100644 --- a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.c +++ b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.c @@ -84,8 +84,8 @@ void computeComputedConstants(double *constants, double *computedConstants) { } -void computeVariables(double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) +void computeVariables(double *constants, double *computedConstants, double *algebraic, double *externals, ExternalVariable externalVariable) { - externals[0] = externalVariable(constants, computedConstants, algebraic, 0); + externals[0] = externalVariable(constants, computedConstants, algebraic, externals, 0); algebraic[0] = externals[0]; } diff --git a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.h b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.h index c68c54a282..2d7a134527 100644 --- a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.h +++ b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.h @@ -30,8 +30,8 @@ double * createExternalsArray(); void deleteArray(double *array); -typedef double (* ExternalVariable)(double *constants, double *computedConstants, double *algebraic, size_t index); +typedef double (* ExternalVariable)(double *constants, double *computedConstants, double *algebraic, double *externals, size_t index); void initialiseVariables(double *constants, double *computedConstants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); -void computeVariables(double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); +void computeVariables(double *constants, double *computedConstants, double *algebraic, double *externals, ExternalVariable externalVariable); diff --git a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.py b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.py index 953b054c86..0e366b97be 100644 --- a/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.py +++ b/tests/resources/generator/algebraic_eqn_computed_var_on_rhs/model.external.py @@ -51,6 +51,6 @@ def compute_computed_constants(constants, computed_constants): pass -def compute_variables(constants, computed_constants, algebraic, external_variable): - externals[0] = external_variable(constants, computed_constants, algebraic, 0) +def compute_variables(constants, computed_constants, algebraic, externals, external_variable): + externals[0] = external_variable(constants, computed_constants, algebraic, externals, 0) algebraic[0] = externals[0] diff --git a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.c b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.c index dd58522e6b..a1a60e49f2 100644 --- a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.c +++ b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.c @@ -89,7 +89,7 @@ void computeComputedConstants(double *constants, double *computedConstants) { } -void computeVariables(double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) +void computeVariables(double *constants, double *computedConstants, double *algebraic, double *externals, ExternalVariable externalVariable) { - externals[0] = externalVariable(constants, computedConstants, algebraic, 0); + externals[0] = externalVariable(constants, computedConstants, algebraic, externals, 0); } diff --git a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.h b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.h index c68c54a282..2d7a134527 100644 --- a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.h +++ b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.h @@ -30,8 +30,8 @@ double * createExternalsArray(); void deleteArray(double *array); -typedef double (* ExternalVariable)(double *constants, double *computedConstants, double *algebraic, size_t index); +typedef double (* ExternalVariable)(double *constants, double *computedConstants, double *algebraic, double *externals, size_t index); void initialiseVariables(double *constants, double *computedConstants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); -void computeVariables(double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); +void computeVariables(double *constants, double *computedConstants, double *algebraic, double *externals, ExternalVariable externalVariable); diff --git a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.py b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.py index 8be4ddcd18..927ddba3f2 100644 --- a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.py +++ b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.py @@ -55,5 +55,5 @@ def compute_computed_constants(constants, computed_constants): pass -def compute_variables(constants, computed_constants, algebraic, external_variable): - externals[0] = external_variable(constants, computed_constants, algebraic, 0) +def compute_variables(constants, computed_constants, algebraic, externals, external_variable): + externals[0] = external_variable(constants, computed_constants, algebraic, externals, 0) diff --git a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.external.c b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.external.c index ee21f220e2..d58310558e 100644 --- a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.external.c +++ b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.external.c @@ -85,9 +85,9 @@ void computeComputedConstants(double *constants, double *computedConstants) { } -void computeVariables(double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) +void computeVariables(double *constants, double *computedConstants, double *algebraic, double *externals, ExternalVariable externalVariable) { - externals[0] = externalVariable(constants, computedConstants, algebraic, 0); - externals[1] = externalVariable(constants, computedConstants, algebraic, 1); - externals[2] = externalVariable(constants, computedConstants, algebraic, 2); + externals[0] = externalVariable(constants, computedConstants, algebraic, externals, 0); + externals[1] = externalVariable(constants, computedConstants, algebraic, externals, 1); + externals[2] = externalVariable(constants, computedConstants, algebraic, externals, 2); } diff --git a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.external.h b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.external.h index 8ea01811f8..eb786b5874 100644 --- a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.external.h +++ b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.external.h @@ -30,8 +30,8 @@ double * createExternalsArray(); void deleteArray(double *array); -typedef double (* ExternalVariable)(double *constants, double *computedConstants, double *algebraic, size_t index); +typedef double (* ExternalVariable)(double *constants, double *computedConstants, double *algebraic, double *externals, size_t index); void initialiseVariables(double *constants, double *computedConstants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); -void computeVariables(double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); +void computeVariables(double *constants, double *computedConstants, double *algebraic, double *externals, ExternalVariable externalVariable); diff --git a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.external.py b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.external.py index 65c6876d4f..e72866bd38 100644 --- a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.external.py +++ b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.external.py @@ -52,7 +52,7 @@ def compute_computed_constants(constants, computed_constants): pass -def compute_variables(constants, computed_constants, algebraic, external_variable): - externals[0] = external_variable(constants, computed_constants, algebraic, 0) - externals[1] = external_variable(constants, computed_constants, algebraic, 1) - externals[2] = external_variable(constants, computed_constants, algebraic, 2) +def compute_variables(constants, computed_constants, algebraic, externals, external_variable): + externals[0] = external_variable(constants, computed_constants, algebraic, externals, 0) + externals[1] = external_variable(constants, computed_constants, algebraic, externals, 1) + externals[2] = external_variable(constants, computed_constants, algebraic, externals, 2) diff --git a/tests/resources/generator/cell_geometry_model/model.external.c b/tests/resources/generator/cell_geometry_model/model.external.c index de3a3ab802..e474107742 100644 --- a/tests/resources/generator/cell_geometry_model/model.external.c +++ b/tests/resources/generator/cell_geometry_model/model.external.c @@ -86,10 +86,10 @@ void computeComputedConstants(double *constants, double *computedConstants) { } -void computeVariables(double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) +void computeVariables(double *constants, double *computedConstants, double *algebraic, double *externals, ExternalVariable externalVariable) { - externals[0] = externalVariable(constants, computedConstants, algebraic, 0); - externals[1] = externalVariable(constants, computedConstants, algebraic, 1); + externals[0] = externalVariable(constants, computedConstants, algebraic, externals, 0); + externals[1] = externalVariable(constants, computedConstants, algebraic, externals, 1); algebraic[0] = 1000.0*3.14*externals[1]*externals[1]*externals[0]; algebraic[1] = 0.02*algebraic[0]; } diff --git a/tests/resources/generator/cell_geometry_model/model.external.h b/tests/resources/generator/cell_geometry_model/model.external.h index c312a35c7f..824fecf42b 100644 --- a/tests/resources/generator/cell_geometry_model/model.external.h +++ b/tests/resources/generator/cell_geometry_model/model.external.h @@ -30,8 +30,8 @@ double * createExternalsArray(); void deleteArray(double *array); -typedef double (* ExternalVariable)(double *constants, double *computedConstants, double *algebraic, size_t index); +typedef double (* ExternalVariable)(double *constants, double *computedConstants, double *algebraic, double *externals, size_t index); void initialiseVariables(double *constants, double *computedConstants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); -void computeVariables(double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); +void computeVariables(double *constants, double *computedConstants, double *algebraic, double *externals, ExternalVariable externalVariable); diff --git a/tests/resources/generator/cell_geometry_model/model.external.py b/tests/resources/generator/cell_geometry_model/model.external.py index c45a649c6e..88706ddad0 100644 --- a/tests/resources/generator/cell_geometry_model/model.external.py +++ b/tests/resources/generator/cell_geometry_model/model.external.py @@ -53,8 +53,8 @@ def compute_computed_constants(constants, computed_constants): pass -def compute_variables(constants, computed_constants, algebraic, external_variable): - externals[0] = external_variable(constants, computed_constants, algebraic, 0) - externals[1] = external_variable(constants, computed_constants, algebraic, 1) +def compute_variables(constants, computed_constants, algebraic, externals, external_variable): + externals[0] = external_variable(constants, computed_constants, algebraic, externals, 0) + externals[1] = external_variable(constants, computed_constants, algebraic, externals, 1) algebraic[0] = 1000.0*3.14*externals[1]*externals[1]*externals[0] algebraic[1] = 0.02*algebraic[0] diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.c index 20a0c70eab..5d1bf7544d 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.c @@ -133,9 +133,9 @@ void computeComputedConstants(double *constants, double *computedConstants) computedConstants[2] = constants[1]+12.0; } -void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) +void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, double *externals, ExternalVariable externalVariable) { - externals[0] = externalVariable(voi, states, rates, constants, computedConstants, algebraic, 0); + externals[0] = externalVariable(voi, states, rates, constants, computedConstants, algebraic, externals, 0); algebraic[0] = constants[2]*(states[0]-computedConstants[0]); algebraic[1] = constants[4]*pow(states[3], 4.0)*(states[0]-computedConstants[2]); algebraic[2] = constants[3]*pow(states[2], 3.0)*states[1]*(states[0]-computedConstants[1]); @@ -151,9 +151,9 @@ void computeRates(double voi, double *states, double *rates, double *constants, rates[3] = algebraic[7]*(1.0-states[3])-algebraic[8]*states[3]; } -void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) +void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, double *externals, ExternalVariable externalVariable) { - externals[0] = externalVariable(voi, states, rates, constants, computedConstants, algebraic, 0); + externals[0] = externalVariable(voi, states, rates, constants, computedConstants, algebraic, externals, 0); algebraic[0] = constants[2]*(states[0]-computedConstants[0]); algebraic[2] = constants[3]*pow(states[2], 3.0)*states[1]*(states[0]-computedConstants[1]); algebraic[3] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.h index 35a6bd9c3d..f07a94f94f 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.h +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.h @@ -34,9 +34,9 @@ double * createExternalsArray(); void deleteArray(double *array); -typedef double (* ExternalVariable)(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, size_t index); +typedef double (* ExternalVariable)(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, double *externals, size_t index); void initialiseVariables(double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); -void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); -void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); +void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, double *externals, ExternalVariable externalVariable); +void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, double *externals, ExternalVariable externalVariable); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.py index 35757ff10f..18b9522bc6 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.py @@ -103,8 +103,8 @@ def compute_computed_constants(constants, computed_constants): computed_constants[2] = constants[1]+12.0 -def compute_rates(voi, states, rates, constants, computed_constants, algebraic, external_variable): - externals[0] = external_variable(voi, states, rates, constants, computed_constants, algebraic, 0) +def compute_rates(voi, states, rates, constants, computed_constants, algebraic, externals, external_variable): + externals[0] = external_variable(voi, states, rates, constants, computed_constants, algebraic, externals, 0) algebraic[0] = constants[2]*(states[0]-computed_constants[0]) algebraic[1] = constants[4]*pow(states[3], 4.0)*(states[0]-computed_constants[2]) algebraic[2] = constants[3]*pow(states[2], 3.0)*states[1]*(states[0]-computed_constants[1]) @@ -120,8 +120,8 @@ def compute_rates(voi, states, rates, constants, computed_constants, algebraic, rates[3] = algebraic[7]*(1.0-states[3])-algebraic[8]*states[3] -def compute_variables(voi, states, rates, constants, computed_constants, algebraic, external_variable): - externals[0] = external_variable(voi, states, rates, constants, computed_constants, algebraic, 0) +def compute_variables(voi, states, rates, constants, computed_constants, algebraic, externals, external_variable): + externals[0] = external_variable(voi, states, rates, constants, computed_constants, algebraic, externals, 0) algebraic[0] = constants[2]*(states[0]-computed_constants[0]) algebraic[2] = constants[3]*pow(states[2], 3.0)*states[1]*(states[0]-computed_constants[1]) algebraic[3] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0) diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.c index 223249ed92..521c1b0c72 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.c @@ -132,10 +132,10 @@ void computeComputedConstants(double *constants, double *computedConstants) computedConstants[1] = constants[1]+12.0; } -void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) +void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, double *externals, ExternalVariable externalVariable) { algebraic[0] = ((voi >= 10.0) && (voi <= 10.5))?-20.0:0.0; - externals[0] = externalVariable(voi, states, rates, constants, computedConstants, algebraic, 0); + externals[0] = externalVariable(voi, states, rates, constants, computedConstants, algebraic, externals, 0); algebraic[1] = constants[2]*(states[0]-externals[0]); algebraic[2] = constants[4]*pow(states[3], 4.0)*(states[0]-computedConstants[1]); algebraic[3] = constants[3]*pow(states[2], 3.0)*states[1]*(states[0]-computedConstants[0]); @@ -151,9 +151,9 @@ void computeRates(double voi, double *states, double *rates, double *constants, rates[3] = algebraic[8]*(1.0-states[3])-algebraic[9]*states[3]; } -void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) +void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, double *externals, ExternalVariable externalVariable) { - externals[0] = externalVariable(voi, states, rates, constants, computedConstants, algebraic, 0); + externals[0] = externalVariable(voi, states, rates, constants, computedConstants, algebraic, externals, 0); algebraic[1] = constants[2]*(states[0]-externals[0]); algebraic[3] = constants[3]*pow(states[2], 3.0)*states[1]*(states[0]-computedConstants[0]); algebraic[4] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.h index 35a6bd9c3d..f07a94f94f 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.h +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.h @@ -34,9 +34,9 @@ double * createExternalsArray(); void deleteArray(double *array); -typedef double (* ExternalVariable)(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, size_t index); +typedef double (* ExternalVariable)(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, double *externals, size_t index); void initialiseVariables(double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); -void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); -void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); +void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, double *externals, ExternalVariable externalVariable); +void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, double *externals, ExternalVariable externalVariable); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.py index c00871301f..ca7257bd13 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.py @@ -102,9 +102,9 @@ def compute_computed_constants(constants, computed_constants): computed_constants[1] = constants[1]+12.0 -def compute_rates(voi, states, rates, constants, computed_constants, algebraic, external_variable): +def compute_rates(voi, states, rates, constants, computed_constants, algebraic, externals, external_variable): algebraic[0] = -20.0 if and_func(geq_func(voi, 10.0), leq_func(voi, 10.5)) else 0.0 - externals[0] = external_variable(voi, states, rates, constants, computed_constants, algebraic, 0) + externals[0] = external_variable(voi, states, rates, constants, computed_constants, algebraic, externals, 0) algebraic[1] = constants[2]*(states[0]-externals[0]) algebraic[2] = constants[4]*pow(states[3], 4.0)*(states[0]-computed_constants[1]) algebraic[3] = constants[3]*pow(states[2], 3.0)*states[1]*(states[0]-computed_constants[0]) @@ -120,8 +120,8 @@ def compute_rates(voi, states, rates, constants, computed_constants, algebraic, rates[3] = algebraic[8]*(1.0-states[3])-algebraic[9]*states[3] -def compute_variables(voi, states, rates, constants, computed_constants, algebraic, external_variable): - externals[0] = external_variable(voi, states, rates, constants, computed_constants, algebraic, 0) +def compute_variables(voi, states, rates, constants, computed_constants, algebraic, externals, external_variable): + externals[0] = external_variable(voi, states, rates, constants, computed_constants, algebraic, externals, 0) algebraic[1] = constants[2]*(states[0]-externals[0]) algebraic[3] = constants[3]*pow(states[2], 3.0)*states[1]*(states[0]-computed_constants[0]) algebraic[4] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0) diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.c index 708762d5a7..1e96249277 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.c @@ -132,10 +132,10 @@ void computeComputedConstants(double *constants, double *computedConstants) computedConstants[2] = constants[0]+12.0; } -void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) +void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, double *externals, ExternalVariable externalVariable) { algebraic[0] = ((voi >= 10.0) && (voi <= 10.5))?-20.0:0.0; - externals[0] = externalVariable(voi, states, rates, constants, computedConstants, algebraic, 0); + externals[0] = externalVariable(voi, states, rates, constants, computedConstants, algebraic, externals, 0); algebraic[1] = constants[1]*(states[0]-computedConstants[0]); algebraic[2] = constants[3]*pow(states[3], 4.0)*(states[0]-computedConstants[2]); algebraic[3] = constants[2]*pow(states[2], 3.0)*states[1]*(states[0]-computedConstants[1]); @@ -151,7 +151,7 @@ void computeRates(double voi, double *states, double *rates, double *constants, rates[3] = algebraic[8]*(1.0-states[3])-algebraic[9]*states[3]; } -void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) +void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, double *externals, ExternalVariable externalVariable) { algebraic[1] = constants[1]*(states[0]-computedConstants[0]); algebraic[3] = constants[2]*pow(states[2], 3.0)*states[1]*(states[0]-computedConstants[1]); @@ -162,5 +162,5 @@ void computeVariables(double voi, double *states, double *rates, double *constan algebraic[2] = constants[3]*pow(states[3], 4.0)*(states[0]-computedConstants[2]); algebraic[8] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0); algebraic[9] = 0.125*exp(states[0]/80.0); - externals[0] = externalVariable(voi, states, rates, constants, computedConstants, algebraic, 0); + externals[0] = externalVariable(voi, states, rates, constants, computedConstants, algebraic, externals, 0); } diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.h index 35a6bd9c3d..f07a94f94f 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.h +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.h @@ -34,9 +34,9 @@ double * createExternalsArray(); void deleteArray(double *array); -typedef double (* ExternalVariable)(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, size_t index); +typedef double (* ExternalVariable)(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, double *externals, size_t index); void initialiseVariables(double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); -void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); -void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); +void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, double *externals, ExternalVariable externalVariable); +void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, double *externals, ExternalVariable externalVariable); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.py index 47529b9f1a..7d66e0529d 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.py @@ -102,9 +102,9 @@ def compute_computed_constants(constants, computed_constants): computed_constants[2] = constants[0]+12.0 -def compute_rates(voi, states, rates, constants, computed_constants, algebraic, external_variable): +def compute_rates(voi, states, rates, constants, computed_constants, algebraic, externals, external_variable): algebraic[0] = -20.0 if and_func(geq_func(voi, 10.0), leq_func(voi, 10.5)) else 0.0 - externals[0] = external_variable(voi, states, rates, constants, computed_constants, algebraic, 0) + externals[0] = external_variable(voi, states, rates, constants, computed_constants, algebraic, externals, 0) algebraic[1] = constants[1]*(states[0]-computed_constants[0]) algebraic[2] = constants[3]*pow(states[3], 4.0)*(states[0]-computed_constants[2]) algebraic[3] = constants[2]*pow(states[2], 3.0)*states[1]*(states[0]-computed_constants[1]) @@ -120,7 +120,7 @@ def compute_rates(voi, states, rates, constants, computed_constants, algebraic, rates[3] = algebraic[8]*(1.0-states[3])-algebraic[9]*states[3] -def compute_variables(voi, states, rates, constants, computed_constants, algebraic, external_variable): +def compute_variables(voi, states, rates, constants, computed_constants, algebraic, externals, external_variable): algebraic[1] = constants[1]*(states[0]-computed_constants[0]) algebraic[3] = constants[2]*pow(states[2], 3.0)*states[1]*(states[0]-computed_constants[1]) algebraic[4] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0) @@ -130,4 +130,4 @@ def compute_variables(voi, states, rates, constants, computed_constants, algebra algebraic[2] = constants[3]*pow(states[3], 4.0)*(states[0]-computed_constants[2]) algebraic[8] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0) algebraic[9] = 0.125*exp(states[0]/80.0) - externals[0] = external_variable(voi, states, rates, constants, computed_constants, algebraic, 0) + externals[0] = external_variable(voi, states, rates, constants, computed_constants, algebraic, externals, 0) diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.c index 37c38f09aa..7b681079c5 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.c @@ -133,10 +133,10 @@ void computeComputedConstants(double *constants, double *computedConstants) computedConstants[2] = constants[1]+12.0; } -void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) +void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, double *externals, ExternalVariable externalVariable) { - externals[1] = externalVariable(voi, states, rates, constants, computedConstants, algebraic, 1); - externals[0] = externalVariable(voi, states, rates, constants, computedConstants, algebraic, 0); + externals[1] = externalVariable(voi, states, rates, constants, computedConstants, algebraic, externals, 1); + externals[0] = externalVariable(voi, states, rates, constants, computedConstants, algebraic, externals, 0); algebraic[0] = constants[2]*(states[0]-computedConstants[0]); algebraic[1] = constants[4]*pow(states[3], 4.0)*(states[0]-computedConstants[2]); algebraic[2] = constants[3]*pow(states[2], 3.0)*states[1]*(states[0]-computedConstants[1]); @@ -151,10 +151,10 @@ void computeRates(double voi, double *states, double *rates, double *constants, rates[3] = algebraic[7]*(1.0-states[3])-externals[1]*states[3]; } -void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) +void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, double *externals, ExternalVariable externalVariable) { - externals[1] = externalVariable(voi, states, rates, constants, computedConstants, algebraic, 1); - externals[0] = externalVariable(voi, states, rates, constants, computedConstants, algebraic, 0); + externals[1] = externalVariable(voi, states, rates, constants, computedConstants, algebraic, externals, 1); + externals[0] = externalVariable(voi, states, rates, constants, computedConstants, algebraic, externals, 0); algebraic[0] = constants[2]*(states[0]-computedConstants[0]); algebraic[2] = constants[3]*pow(states[2], 3.0)*states[1]*(states[0]-computedConstants[1]); algebraic[3] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.h index 35a6bd9c3d..f07a94f94f 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.h +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.h @@ -34,9 +34,9 @@ double * createExternalsArray(); void deleteArray(double *array); -typedef double (* ExternalVariable)(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, size_t index); +typedef double (* ExternalVariable)(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, double *externals, size_t index); void initialiseVariables(double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); -void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); -void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); +void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, double *externals, ExternalVariable externalVariable); +void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, double *externals, ExternalVariable externalVariable); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.py index dcce03903e..76a6c723f5 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.py @@ -103,9 +103,9 @@ def compute_computed_constants(constants, computed_constants): computed_constants[2] = constants[1]+12.0 -def compute_rates(voi, states, rates, constants, computed_constants, algebraic, external_variable): - externals[1] = external_variable(voi, states, rates, constants, computed_constants, algebraic, 1) - externals[0] = external_variable(voi, states, rates, constants, computed_constants, algebraic, 0) +def compute_rates(voi, states, rates, constants, computed_constants, algebraic, externals, external_variable): + externals[1] = external_variable(voi, states, rates, constants, computed_constants, algebraic, externals, 1) + externals[0] = external_variable(voi, states, rates, constants, computed_constants, algebraic, externals, 0) algebraic[0] = constants[2]*(states[0]-computed_constants[0]) algebraic[1] = constants[4]*pow(states[3], 4.0)*(states[0]-computed_constants[2]) algebraic[2] = constants[3]*pow(states[2], 3.0)*states[1]*(states[0]-computed_constants[1]) @@ -120,9 +120,9 @@ def compute_rates(voi, states, rates, constants, computed_constants, algebraic, rates[3] = algebraic[7]*(1.0-states[3])-externals[1]*states[3] -def compute_variables(voi, states, rates, constants, computed_constants, algebraic, external_variable): - externals[1] = external_variable(voi, states, rates, constants, computed_constants, algebraic, 1) - externals[0] = external_variable(voi, states, rates, constants, computed_constants, algebraic, 0) +def compute_variables(voi, states, rates, constants, computed_constants, algebraic, externals, external_variable): + externals[1] = external_variable(voi, states, rates, constants, computed_constants, algebraic, externals, 1) + externals[0] = external_variable(voi, states, rates, constants, computed_constants, algebraic, externals, 0) algebraic[0] = constants[2]*(states[0]-computed_constants[0]) algebraic[2] = constants[3]*pow(states[2], 3.0)*states[1]*(states[0]-computed_constants[1]) algebraic[3] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0) diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.c index b52e837c23..4ae8c6f8cf 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.c @@ -129,11 +129,11 @@ void computeComputedConstants(double *constants, double *computedConstants) { } -void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) +void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, double *externals, ExternalVariable externalVariable) { algebraic[0] = ((voi >= 10.0) && (voi <= 10.5))?-20.0:0.0; - externals[1] = externalVariable(voi, states, rates, constants, computedConstants, algebraic, 1); - externals[0] = externalVariable(voi, states, rates, constants, computedConstants, algebraic, 0); + externals[1] = externalVariable(voi, states, rates, constants, computedConstants, algebraic, externals, 1); + externals[0] = externalVariable(voi, states, rates, constants, computedConstants, algebraic, externals, 0); algebraic[4] = externals[0]-10.613; algebraic[1] = constants[1]*(states[0]-algebraic[4]); algebraic[2] = constants[3]*pow(states[3], 4.0)*(states[0]-externals[1]); @@ -151,10 +151,10 @@ void computeRates(double voi, double *states, double *rates, double *constants, rates[3] = algebraic[10]*(1.0-states[3])-algebraic[11]*states[3]; } -void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) +void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, double *externals, ExternalVariable externalVariable) { - externals[1] = externalVariable(voi, states, rates, constants, computedConstants, algebraic, 1); - externals[0] = externalVariable(voi, states, rates, constants, computedConstants, algebraic, 0); + externals[1] = externalVariable(voi, states, rates, constants, computedConstants, algebraic, externals, 1); + externals[0] = externalVariable(voi, states, rates, constants, computedConstants, algebraic, externals, 0); algebraic[4] = externals[0]-10.613; algebraic[1] = constants[1]*(states[0]-algebraic[4]); algebraic[5] = externals[0]-115.0; diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.h index 35a6bd9c3d..f07a94f94f 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.h +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.h @@ -34,9 +34,9 @@ double * createExternalsArray(); void deleteArray(double *array); -typedef double (* ExternalVariable)(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, size_t index); +typedef double (* ExternalVariable)(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, double *externals, size_t index); void initialiseVariables(double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); -void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); -void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); +void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, double *externals, ExternalVariable externalVariable); +void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, double *externals, ExternalVariable externalVariable); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.py index 87f39ea1b8..6d69149ce3 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.py @@ -100,10 +100,10 @@ def compute_computed_constants(constants, computed_constants): pass -def compute_rates(voi, states, rates, constants, computed_constants, algebraic, external_variable): +def compute_rates(voi, states, rates, constants, computed_constants, algebraic, externals, external_variable): algebraic[0] = -20.0 if and_func(geq_func(voi, 10.0), leq_func(voi, 10.5)) else 0.0 - externals[1] = external_variable(voi, states, rates, constants, computed_constants, algebraic, 1) - externals[0] = external_variable(voi, states, rates, constants, computed_constants, algebraic, 0) + externals[1] = external_variable(voi, states, rates, constants, computed_constants, algebraic, externals, 1) + externals[0] = external_variable(voi, states, rates, constants, computed_constants, algebraic, externals, 0) algebraic[4] = externals[0]-10.613 algebraic[1] = constants[1]*(states[0]-algebraic[4]) algebraic[2] = constants[3]*pow(states[3], 4.0)*(states[0]-externals[1]) @@ -121,9 +121,9 @@ def compute_rates(voi, states, rates, constants, computed_constants, algebraic, rates[3] = algebraic[10]*(1.0-states[3])-algebraic[11]*states[3] -def compute_variables(voi, states, rates, constants, computed_constants, algebraic, external_variable): - externals[1] = external_variable(voi, states, rates, constants, computed_constants, algebraic, 1) - externals[0] = external_variable(voi, states, rates, constants, computed_constants, algebraic, 0) +def compute_variables(voi, states, rates, constants, computed_constants, algebraic, externals, external_variable): + externals[1] = external_variable(voi, states, rates, constants, computed_constants, algebraic, externals, 1) + externals[0] = external_variable(voi, states, rates, constants, computed_constants, algebraic, externals, 0) algebraic[4] = externals[0]-10.613 algebraic[1] = constants[1]*(states[0]-algebraic[4]) algebraic[5] = externals[0]-115.0 diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.c index a1c9778c88..479c2a1cb9 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.c @@ -131,11 +131,11 @@ void computeComputedConstants(double *constants, double *computedConstants) computedConstants[2] = constants[0]+12.0; } -void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) +void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, double *externals, ExternalVariable externalVariable) { algebraic[0] = ((voi >= 10.0) && (voi <= 10.5))?-20.0:0.0; - externals[1] = externalVariable(voi, states, rates, constants, computedConstants, algebraic, 1); - externals[0] = externalVariable(voi, states, rates, constants, computedConstants, algebraic, 0); + externals[1] = externalVariable(voi, states, rates, constants, computedConstants, algebraic, externals, 1); + externals[0] = externalVariable(voi, states, rates, constants, computedConstants, algebraic, externals, 0); algebraic[1] = constants[1]*(states[0]-computedConstants[0]); algebraic[2] = constants[2]*pow(states[3], 4.0)*(states[0]-computedConstants[2]); algebraic[3] = externals[1]*pow(states[2], 3.0)*states[1]*(states[0]-computedConstants[1]); @@ -151,10 +151,10 @@ void computeRates(double voi, double *states, double *rates, double *constants, rates[3] = algebraic[8]*(1.0-states[3])-algebraic[9]*states[3]; } -void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) +void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, double *externals, ExternalVariable externalVariable) { algebraic[1] = constants[1]*(states[0]-computedConstants[0]); - externals[1] = externalVariable(voi, states, rates, constants, computedConstants, algebraic, 1); + externals[1] = externalVariable(voi, states, rates, constants, computedConstants, algebraic, externals, 1); algebraic[3] = externals[1]*pow(states[2], 3.0)*states[1]*(states[0]-computedConstants[1]); algebraic[4] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0); algebraic[5] = 4.0*exp(states[0]/18.0); @@ -163,5 +163,5 @@ void computeVariables(double voi, double *states, double *rates, double *constan algebraic[2] = constants[2]*pow(states[3], 4.0)*(states[0]-computedConstants[2]); algebraic[8] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0); algebraic[9] = 0.125*exp(states[0]/80.0); - externals[0] = externalVariable(voi, states, rates, constants, computedConstants, algebraic, 0); + externals[0] = externalVariable(voi, states, rates, constants, computedConstants, algebraic, externals, 0); } diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.h index 35a6bd9c3d..f07a94f94f 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.h +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.h @@ -34,9 +34,9 @@ double * createExternalsArray(); void deleteArray(double *array); -typedef double (* ExternalVariable)(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, size_t index); +typedef double (* ExternalVariable)(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, double *externals, size_t index); void initialiseVariables(double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); -void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); -void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); +void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, double *externals, ExternalVariable externalVariable); +void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, double *externals, ExternalVariable externalVariable); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.py index e72a244f02..8e4407c2f7 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.py @@ -101,10 +101,10 @@ def compute_computed_constants(constants, computed_constants): computed_constants[2] = constants[0]+12.0 -def compute_rates(voi, states, rates, constants, computed_constants, algebraic, external_variable): +def compute_rates(voi, states, rates, constants, computed_constants, algebraic, externals, external_variable): algebraic[0] = -20.0 if and_func(geq_func(voi, 10.0), leq_func(voi, 10.5)) else 0.0 - externals[1] = external_variable(voi, states, rates, constants, computed_constants, algebraic, 1) - externals[0] = external_variable(voi, states, rates, constants, computed_constants, algebraic, 0) + externals[1] = external_variable(voi, states, rates, constants, computed_constants, algebraic, externals, 1) + externals[0] = external_variable(voi, states, rates, constants, computed_constants, algebraic, externals, 0) algebraic[1] = constants[1]*(states[0]-computed_constants[0]) algebraic[2] = constants[2]*pow(states[3], 4.0)*(states[0]-computed_constants[2]) algebraic[3] = externals[1]*pow(states[2], 3.0)*states[1]*(states[0]-computed_constants[1]) @@ -120,9 +120,9 @@ def compute_rates(voi, states, rates, constants, computed_constants, algebraic, rates[3] = algebraic[8]*(1.0-states[3])-algebraic[9]*states[3] -def compute_variables(voi, states, rates, constants, computed_constants, algebraic, external_variable): +def compute_variables(voi, states, rates, constants, computed_constants, algebraic, externals, external_variable): algebraic[1] = constants[1]*(states[0]-computed_constants[0]) - externals[1] = external_variable(voi, states, rates, constants, computed_constants, algebraic, 1) + externals[1] = external_variable(voi, states, rates, constants, computed_constants, algebraic, externals, 1) algebraic[3] = externals[1]*pow(states[2], 3.0)*states[1]*(states[0]-computed_constants[1]) algebraic[4] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0) algebraic[5] = 4.0*exp(states[0]/18.0) @@ -131,4 +131,4 @@ def compute_variables(voi, states, rates, constants, computed_constants, algebra algebraic[2] = constants[2]*pow(states[3], 4.0)*(states[0]-computed_constants[2]) algebraic[8] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0) algebraic[9] = 0.125*exp(states[0]/80.0) - externals[0] = external_variable(voi, states, rates, constants, computed_constants, algebraic, 0) + externals[0] = external_variable(voi, states, rates, constants, computed_constants, algebraic, externals, 0) diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.c index 7c679fed8e..10e2b10fdc 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.c @@ -131,9 +131,9 @@ void computeComputedConstants(double *constants, double *computedConstants) computedConstants[2] = constants[1]+12.0; } -void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) +void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, double *externals, ExternalVariable externalVariable) { - externals[0] = externalVariable(voi, states, rates, constants, computedConstants, algebraic, 0); + externals[0] = externalVariable(voi, states, rates, constants, computedConstants, algebraic, externals, 0); algebraic[6] = 0.07*exp(externals[0]/20.0); algebraic[7] = 1.0/(exp((externals[0]+30.0)/10.0)+1.0); rates[0] = algebraic[6]*(1.0-states[0])-algebraic[7]*states[0]; @@ -142,12 +142,12 @@ void computeRates(double voi, double *states, double *rates, double *constants, rates[1] = algebraic[8]*(1.0-states[1])-algebraic[9]*states[1]; } -void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) +void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, double *externals, ExternalVariable externalVariable) { algebraic[0] = ((voi >= 10.0) && (voi <= 10.5))?-20.0:0.0; - externals[0] = externalVariable(voi, states, rates, constants, computedConstants, algebraic, 0); + externals[0] = externalVariable(voi, states, rates, constants, computedConstants, algebraic, externals, 0); algebraic[1] = constants[2]*(externals[0]-computedConstants[0]); - externals[1] = externalVariable(voi, states, rates, constants, computedConstants, algebraic, 1); + externals[1] = externalVariable(voi, states, rates, constants, computedConstants, algebraic, externals, 1); algebraic[3] = constants[3]*pow(externals[1], 3.0)*states[0]*(externals[0]-computedConstants[1]); algebraic[4] = 0.1*(externals[0]+25.0)/(exp((externals[0]+25.0)/10.0)-1.0); algebraic[5] = 4.0*exp(externals[0]/18.0); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.h index 35a6bd9c3d..f07a94f94f 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.h +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.h @@ -34,9 +34,9 @@ double * createExternalsArray(); void deleteArray(double *array); -typedef double (* ExternalVariable)(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, size_t index); +typedef double (* ExternalVariable)(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, double *externals, size_t index); void initialiseVariables(double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); -void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); -void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); +void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, double *externals, ExternalVariable externalVariable); +void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, double *externals, ExternalVariable externalVariable); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.py index d1dcd1929e..7a00357ca4 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.py @@ -101,8 +101,8 @@ def compute_computed_constants(constants, computed_constants): computed_constants[2] = constants[1]+12.0 -def compute_rates(voi, states, rates, constants, computed_constants, algebraic, external_variable): - externals[0] = external_variable(voi, states, rates, constants, computed_constants, algebraic, 0) +def compute_rates(voi, states, rates, constants, computed_constants, algebraic, externals, external_variable): + externals[0] = external_variable(voi, states, rates, constants, computed_constants, algebraic, externals, 0) algebraic[6] = 0.07*exp(externals[0]/20.0) algebraic[7] = 1.0/(exp((externals[0]+30.0)/10.0)+1.0) rates[0] = algebraic[6]*(1.0-states[0])-algebraic[7]*states[0] @@ -111,11 +111,11 @@ def compute_rates(voi, states, rates, constants, computed_constants, algebraic, rates[1] = algebraic[8]*(1.0-states[1])-algebraic[9]*states[1] -def compute_variables(voi, states, rates, constants, computed_constants, algebraic, external_variable): +def compute_variables(voi, states, rates, constants, computed_constants, algebraic, externals, external_variable): algebraic[0] = -20.0 if and_func(geq_func(voi, 10.0), leq_func(voi, 10.5)) else 0.0 - externals[0] = external_variable(voi, states, rates, constants, computed_constants, algebraic, 0) + externals[0] = external_variable(voi, states, rates, constants, computed_constants, algebraic, externals, 0) algebraic[1] = constants[2]*(externals[0]-computed_constants[0]) - externals[1] = external_variable(voi, states, rates, constants, computed_constants, algebraic, 1) + externals[1] = external_variable(voi, states, rates, constants, computed_constants, algebraic, externals, 1) algebraic[3] = constants[3]*pow(externals[1], 3.0)*states[0]*(externals[0]-computed_constants[1]) algebraic[4] = 0.1*(externals[0]+25.0)/(exp((externals[0]+25.0)/10.0)-1.0) algebraic[5] = 4.0*exp(externals[0]/18.0) diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.c index f1285c30d3..64b8a5ae69 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.c @@ -132,26 +132,26 @@ void computeComputedConstants(double *constants, double *computedConstants) computedConstants[2] = constants[1]+12.0; } -void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) +void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, double *externals, ExternalVariable externalVariable) { - externals[0] = externalVariable(voi, states, rates, constants, computedConstants, algebraic, 0); + externals[0] = externalVariable(voi, states, rates, constants, computedConstants, algebraic, externals, 0); algebraic[3] = 0.1*(externals[0]+25.0)/(exp((externals[0]+25.0)/10.0)-1.0); algebraic[4] = 4.0*exp(externals[0]/18.0); rates[1] = algebraic[3]*(1.0-states[1])-algebraic[4]*states[1]; algebraic[5] = 0.07*exp(externals[0]/20.0); algebraic[6] = 1.0/(exp((externals[0]+30.0)/10.0)+1.0); rates[0] = algebraic[5]*(1.0-states[0])-algebraic[6]*states[0]; - externals[2] = externalVariable(voi, states, rates, constants, computedConstants, algebraic, 2); + externals[2] = externalVariable(voi, states, rates, constants, computedConstants, algebraic, externals, 2); algebraic[7] = 0.125*exp(externals[0]/80.0); rates[2] = externals[2]*(1.0-states[2])-algebraic[7]*states[2]; } -void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) +void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, double *externals, ExternalVariable externalVariable) { algebraic[0] = ((voi >= 10.0) && (voi <= 10.5))?-20.0:0.0; - externals[0] = externalVariable(voi, states, rates, constants, computedConstants, algebraic, 0); + externals[0] = externalVariable(voi, states, rates, constants, computedConstants, algebraic, externals, 0); algebraic[1] = constants[2]*(externals[0]-computedConstants[0]); - externals[2] = externalVariable(voi, states, rates, constants, computedConstants, algebraic, 2); - externals[1] = externalVariable(voi, states, rates, constants, computedConstants, algebraic, 1); + externals[2] = externalVariable(voi, states, rates, constants, computedConstants, algebraic, externals, 2); + externals[1] = externalVariable(voi, states, rates, constants, computedConstants, algebraic, externals, 1); algebraic[2] = constants[4]*pow(states[2], 4.0)*(externals[0]-computedConstants[2]); } diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.h index 35a6bd9c3d..f07a94f94f 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.h +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.h @@ -34,9 +34,9 @@ double * createExternalsArray(); void deleteArray(double *array); -typedef double (* ExternalVariable)(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, size_t index); +typedef double (* ExternalVariable)(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, double *externals, size_t index); void initialiseVariables(double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); -void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); -void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); +void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, double *externals, ExternalVariable externalVariable); +void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, double *externals, ExternalVariable externalVariable); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.py index b726fdfa06..f86b3fb631 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.external.py @@ -102,23 +102,23 @@ def compute_computed_constants(constants, computed_constants): computed_constants[2] = constants[1]+12.0 -def compute_rates(voi, states, rates, constants, computed_constants, algebraic, external_variable): - externals[0] = external_variable(voi, states, rates, constants, computed_constants, algebraic, 0) +def compute_rates(voi, states, rates, constants, computed_constants, algebraic, externals, external_variable): + externals[0] = external_variable(voi, states, rates, constants, computed_constants, algebraic, externals, 0) algebraic[3] = 0.1*(externals[0]+25.0)/(exp((externals[0]+25.0)/10.0)-1.0) algebraic[4] = 4.0*exp(externals[0]/18.0) rates[1] = algebraic[3]*(1.0-states[1])-algebraic[4]*states[1] algebraic[5] = 0.07*exp(externals[0]/20.0) algebraic[6] = 1.0/(exp((externals[0]+30.0)/10.0)+1.0) rates[0] = algebraic[5]*(1.0-states[0])-algebraic[6]*states[0] - externals[2] = external_variable(voi, states, rates, constants, computed_constants, algebraic, 2) + externals[2] = external_variable(voi, states, rates, constants, computed_constants, algebraic, externals, 2) algebraic[7] = 0.125*exp(externals[0]/80.0) rates[2] = externals[2]*(1.0-states[2])-algebraic[7]*states[2] -def compute_variables(voi, states, rates, constants, computed_constants, algebraic, external_variable): +def compute_variables(voi, states, rates, constants, computed_constants, algebraic, externals, external_variable): algebraic[0] = -20.0 if and_func(geq_func(voi, 10.0), leq_func(voi, 10.5)) else 0.0 - externals[0] = external_variable(voi, states, rates, constants, computed_constants, algebraic, 0) + externals[0] = external_variable(voi, states, rates, constants, computed_constants, algebraic, externals, 0) algebraic[1] = constants[2]*(externals[0]-computed_constants[0]) - externals[2] = external_variable(voi, states, rates, constants, computed_constants, algebraic, 2) - externals[1] = external_variable(voi, states, rates, constants, computed_constants, algebraic, 1) + externals[2] = external_variable(voi, states, rates, constants, computed_constants, algebraic, externals, 2) + externals[1] = external_variable(voi, states, rates, constants, computed_constants, algebraic, externals, 1) algebraic[2] = constants[4]*pow(states[2], 4.0)*(externals[0]-computed_constants[2]) diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.c index d6aed64a5e..ba5aba2240 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.c @@ -132,12 +132,12 @@ void computeComputedConstants(double *constants, double *computedConstants) computedConstants[2] = constants[1]+12.0; } -void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) +void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, double *externals, ExternalVariable externalVariable) { algebraic[0] = ((voi >= 10.0) && (voi <= 10.5))?-20.0:0.0; algebraic[1] = constants[2]*(states[0]-computedConstants[0]); algebraic[2] = constants[4]*pow(states[2], 4.0)*(states[0]-computedConstants[2]); - externals[0] = externalVariable(voi, states, rates, constants, computedConstants, algebraic, 0); + externals[0] = externalVariable(voi, states, rates, constants, computedConstants, algebraic, externals, 0); algebraic[3] = constants[3]*pow(externals[0], 3.0)*states[1]*(states[0]-computedConstants[1]); rates[0] = -(-algebraic[0]+algebraic[3]+algebraic[2]+algebraic[1])/constants[0]; algebraic[6] = 0.07*exp(states[0]/20.0); @@ -148,10 +148,10 @@ void computeRates(double voi, double *states, double *rates, double *constants, rates[2] = algebraic[8]*(1.0-states[2])-algebraic[9]*states[2]; } -void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) +void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, double *externals, ExternalVariable externalVariable) { algebraic[1] = constants[2]*(states[0]-computedConstants[0]); - externals[0] = externalVariable(voi, states, rates, constants, computedConstants, algebraic, 0); + externals[0] = externalVariable(voi, states, rates, constants, computedConstants, algebraic, externals, 0); algebraic[3] = constants[3]*pow(externals[0], 3.0)*states[1]*(states[0]-computedConstants[1]); algebraic[4] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0); algebraic[5] = 4.0*exp(states[0]/18.0); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.h index 35a6bd9c3d..f07a94f94f 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.h +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.h @@ -34,9 +34,9 @@ double * createExternalsArray(); void deleteArray(double *array); -typedef double (* ExternalVariable)(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, size_t index); +typedef double (* ExternalVariable)(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, double *externals, size_t index); void initialiseVariables(double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); -void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); -void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); +void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, double *externals, ExternalVariable externalVariable); +void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, double *externals, ExternalVariable externalVariable); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.py index 5ce36e54a9..4373274a12 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.py @@ -102,11 +102,11 @@ def compute_computed_constants(constants, computed_constants): computed_constants[2] = constants[1]+12.0 -def compute_rates(voi, states, rates, constants, computed_constants, algebraic, external_variable): +def compute_rates(voi, states, rates, constants, computed_constants, algebraic, externals, external_variable): algebraic[0] = -20.0 if and_func(geq_func(voi, 10.0), leq_func(voi, 10.5)) else 0.0 algebraic[1] = constants[2]*(states[0]-computed_constants[0]) algebraic[2] = constants[4]*pow(states[2], 4.0)*(states[0]-computed_constants[2]) - externals[0] = external_variable(voi, states, rates, constants, computed_constants, algebraic, 0) + externals[0] = external_variable(voi, states, rates, constants, computed_constants, algebraic, externals, 0) algebraic[3] = constants[3]*pow(externals[0], 3.0)*states[1]*(states[0]-computed_constants[1]) rates[0] = -(-algebraic[0]+algebraic[3]+algebraic[2]+algebraic[1])/constants[0] algebraic[6] = 0.07*exp(states[0]/20.0) @@ -117,9 +117,9 @@ def compute_rates(voi, states, rates, constants, computed_constants, algebraic, rates[2] = algebraic[8]*(1.0-states[2])-algebraic[9]*states[2] -def compute_variables(voi, states, rates, constants, computed_constants, algebraic, external_variable): +def compute_variables(voi, states, rates, constants, computed_constants, algebraic, externals, external_variable): algebraic[1] = constants[2]*(states[0]-computed_constants[0]) - externals[0] = external_variable(voi, states, rates, constants, computed_constants, algebraic, 0) + externals[0] = external_variable(voi, states, rates, constants, computed_constants, algebraic, externals, 0) algebraic[3] = constants[3]*pow(externals[0], 3.0)*states[1]*(states[0]-computed_constants[1]) algebraic[4] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0) algebraic[5] = 4.0*exp(states[0]/18.0) diff --git a/tests/resources/generator/unknown_variable_as_external_variable/model.c b/tests/resources/generator/unknown_variable_as_external_variable/model.c index 439e1bb420..7e303a6551 100644 --- a/tests/resources/generator/unknown_variable_as_external_variable/model.c +++ b/tests/resources/generator/unknown_variable_as_external_variable/model.c @@ -100,8 +100,8 @@ void computeComputedConstants(double *constants, double *computedConstants) { } -void computeVariables(double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable) +void computeVariables(double *constants, double *computedConstants, double *algebraic, double *externals, ExternalVariable externalVariable) { - externals[0] = externalVariable(constants, computedConstants, algebraic, 0); + externals[0] = externalVariable(constants, computedConstants, algebraic, externals, 0); algebraic[0] = constants[0]*(constants[1]*constants[2]-constants[3]*constants[4])/(constants[5]*constants[4]+externals[0]*constants[2]+constants[7]*constants[4]*constants[2]+constants[6]); } diff --git a/tests/resources/generator/unknown_variable_as_external_variable/model.h b/tests/resources/generator/unknown_variable_as_external_variable/model.h index 49b5d66b7b..055ffae832 100644 --- a/tests/resources/generator/unknown_variable_as_external_variable/model.h +++ b/tests/resources/generator/unknown_variable_as_external_variable/model.h @@ -30,8 +30,8 @@ double * createExternalsArray(); void deleteArray(double *array); -typedef double (* ExternalVariable)(double *constants, double *computedConstants, double *algebraic, size_t index); +typedef double (* ExternalVariable)(double *constants, double *computedConstants, double *algebraic, double *externals, size_t index); void initialiseVariables(double *constants, double *computedConstants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); -void computeVariables(double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable); +void computeVariables(double *constants, double *computedConstants, double *algebraic, double *externals, ExternalVariable externalVariable); diff --git a/tests/resources/generator/unknown_variable_as_external_variable/model.py b/tests/resources/generator/unknown_variable_as_external_variable/model.py index 399e6d5bb3..67e7d24696 100644 --- a/tests/resources/generator/unknown_variable_as_external_variable/model.py +++ b/tests/resources/generator/unknown_variable_as_external_variable/model.py @@ -66,6 +66,6 @@ def compute_computed_constants(constants, computed_constants): pass -def compute_variables(constants, computed_constants, algebraic, external_variable): - externals[0] = external_variable(constants, computed_constants, algebraic, 0) +def compute_variables(constants, computed_constants, algebraic, externals, external_variable): + externals[0] = external_variable(constants, computed_constants, algebraic, externals, 0) algebraic[0] = constants[0]*(constants[1]*constants[2]-constants[3]*constants[4])/(constants[5]*constants[4]+externals[0]*constants[2]+constants[7]*constants[4]*constants[2]+constants[6]) From 4bf1afc386a797e9b96db5ab9919c5b5ff66beea Mon Sep 17 00:00:00 2001 From: Alan Garny Date: Tue, 20 Aug 2024 16:32:17 +0200 Subject: [PATCH 47/85] Addressed various coverage issues as a result of our work on issue #1247. --- src/analyser.cpp | 102 +++--- src/analyserequation.cpp | 19 -- src/analyserequation_p.h | 1 - src/api/libcellml/analyserequation.h | 29 -- src/bindings/interface/analyserequation.i | 9 - src/bindings/javascript/analyserequation.cpp | 3 - src/debug.cpp | 10 - src/generator.cpp | 95 +++--- src/generator_p.h | 2 - src/utilities.cpp | 50 +-- tests/coverage/coverage.cpp | 18 +- tests/resources/coverage/generator/model.c | 302 +++++++++--------- tests/resources/coverage/generator/model.h | 9 +- .../generator/model.implementation.out | 294 +++++++++-------- .../coverage/generator/model.interface.out | 7 +- .../generator/model.modified.profile.c | 302 +++++++++--------- .../generator/model.modified.profile.h | 9 +- .../generator/model.modified.profile.py | 298 ++++++++--------- tests/resources/coverage/generator/model.out | 282 ++++++++-------- tests/resources/coverage/generator/model.py | 298 ++++++++--------- 20 files changed, 1028 insertions(+), 1111 deletions(-) diff --git a/src/analyser.cpp b/src/analyser.cpp index 519f9c9dfc..e1a3ca780f 100644 --- a/src/analyser.cpp +++ b/src/analyser.cpp @@ -2243,8 +2243,7 @@ bool Analyser::AnalyserImpl::isStateRateBased(const AnalyserEquationPtr &equatio if ((dependency->type() == AnalyserEquation::Type::ODE) || ((dependency->type() == AnalyserEquation::Type::NLA) - && (dependency->stateCount() == 1) - && (dependency->state(0)->type() == AnalyserVariable::Type::STATE)) + && (dependency->stateCount() == 1)) || isStateRateBased(dependency, checkedEquations)) { return true; } @@ -2862,31 +2861,31 @@ void Analyser::AnalyserImpl::analyseModel(const ModelPtr &model) for (const auto &internalVariable : mInternalVariables) { // Determine the type of the variable. - AnalyserVariable::Type type; + AnalyserVariable::Type variableType; if (internalVariable->mIsExternalVariable) { - type = AnalyserVariable::Type::EXTERNAL; + variableType = AnalyserVariable::Type::EXTERNAL; } else { switch (internalVariable->mType) { case AnalyserInternalVariable::Type::STATE: - type = AnalyserVariable::Type::STATE; + variableType = AnalyserVariable::Type::STATE; break; case AnalyserInternalVariable::Type::CONSTANT: - type = AnalyserVariable::Type::CONSTANT; + variableType = AnalyserVariable::Type::CONSTANT; break; case AnalyserInternalVariable::Type::COMPUTED_TRUE_CONSTANT: case AnalyserInternalVariable::Type::COMPUTED_VARIABLE_BASED_CONSTANT: - type = AnalyserVariable::Type::COMPUTED_CONSTANT; + variableType = AnalyserVariable::Type::COMPUTED_CONSTANT; break; case AnalyserInternalVariable::Type::ALGEBRAIC: case AnalyserInternalVariable::Type::INITIALISED_ALGEBRAIC: - type = AnalyserVariable::Type::ALGEBRAIC; + variableType = AnalyserVariable::Type::ALGEBRAIC; break; - default: // AnalyserVariable::Type::VARIABLE_OF_INTEGRATION. + default: // AnalyserInternalVariable::Type::VARIABLE_OF_INTEGRATION. // This is the variable of integration, so skip it. continue; @@ -2896,7 +2895,7 @@ void Analyser::AnalyserImpl::analyseModel(const ModelPtr &model) // Retrieve the equations used to compute the variable. AnalyserEquationPtrs equations; - auto nlaEquation = false; + auto isNlaEquation = false; for (const auto &internalEquation : mInternalEquations) { if (std::find(internalEquation->mUnknownVariables.begin(), internalEquation->mUnknownVariables.end(), internalVariable) != internalEquation->mUnknownVariables.end()) { @@ -2904,32 +2903,32 @@ void Analyser::AnalyserImpl::analyseModel(const ModelPtr &model) if ((aie2aetMappings.find(internalEquation) != aie2aetMappings.end()) && (aie2aetMappings[internalEquation] == AnalyserEquation::Type::NLA)) { - nlaEquation = true; + isNlaEquation = true; } } } // Correct the type of the variable if it is a computed constant that is computed using an NLA equation. - if ((type == AnalyserVariable::Type::COMPUTED_CONSTANT) && nlaEquation) { - type = AnalyserVariable::Type::ALGEBRAIC; + if ((variableType == AnalyserVariable::Type::COMPUTED_CONSTANT) && isNlaEquation) { + variableType = AnalyserVariable::Type::ALGEBRAIC; } // Populate and keep track of the state/variable. auto variable = AnalyserVariable::AnalyserVariableImpl::create(); - variable->mPimpl->populate(type, - (type == AnalyserVariable::Type::STATE) ? + variable->mPimpl->populate(variableType, + (variableType == AnalyserVariable::Type::STATE) ? ++stateIndex : - (type == AnalyserVariable::Type::CONSTANT) ? + (variableType == AnalyserVariable::Type::CONSTANT) ? ++constantIndex : - (type == AnalyserVariable::Type::COMPUTED_CONSTANT) ? + (variableType == AnalyserVariable::Type::COMPUTED_CONSTANT) ? ++computedConstantIndex : - (type == AnalyserVariable::Type::ALGEBRAIC) ? + (variableType == AnalyserVariable::Type::ALGEBRAIC) ? ++algebraicIndex : ++externalIndex, - (type == AnalyserVariable::Type::EXTERNAL) ? + (variableType == AnalyserVariable::Type::EXTERNAL) ? nullptr : internalVariable->mInitialisingVariable, internalVariable->mVariable, @@ -2938,31 +2937,16 @@ void Analyser::AnalyserImpl::analyseModel(const ModelPtr &model) aiv2avMappings.emplace(internalVariable, variable); v2avMappings.emplace(internalVariable->mVariable, variable); - switch (type) { - case AnalyserVariable::Type::STATE: + if (variableType == AnalyserVariable::Type::STATE) { mModel->mPimpl->mStates.push_back(variable); - - break; - case AnalyserVariable::Type::CONSTANT: + } else if (variableType == AnalyserVariable::Type::CONSTANT) { mModel->mPimpl->mConstants.push_back(variable); - - break; - case AnalyserVariable::Type::COMPUTED_CONSTANT: + } else if (variableType == AnalyserVariable::Type::COMPUTED_CONSTANT) { mModel->mPimpl->mComputedConstants.push_back(variable); - - break; - case AnalyserVariable::Type::ALGEBRAIC: + } else if (variableType == AnalyserVariable::Type::ALGEBRAIC) { mModel->mPimpl->mAlgebraic.push_back(variable); - - break; - case AnalyserVariable::Type::EXTERNAL: + } else { // AnalyserVariable::Type::EXTERNAL. mModel->mPimpl->mExternals.push_back(variable); - - break; - default: // AnalyserVariable::Type::VARIABLE_OF_INTEGRATION. - // This is the variable of integration, so skip it. - - break; } } @@ -2983,9 +2967,9 @@ void Analyser::AnalyserImpl::analyseModel(const ModelPtr &model) // Manipulate the equation, if needed. - auto type = aie2aetMappings[internalEquation]; + auto equationType = aie2aetMappings[internalEquation]; - switch (type) { + switch (equationType) { case AnalyserEquation::Type::NLA: // The equation is currently of the form LHS = RHS, but we want it // in the form LHS-RHS, so replace the equality element with a minus @@ -3014,7 +2998,7 @@ void Analyser::AnalyserImpl::analyseModel(const ModelPtr &model) VariablePtrs variableDependencies; - if (type == AnalyserEquation::Type::EXTERNAL) { + if (equationType == AnalyserEquation::Type::EXTERNAL) { for (const auto &unknownVariable : internalEquation->mUnknownVariables) { for (const auto &dependency : unknownVariable->mDependencies) { variableDependencies.push_back(dependency); @@ -3052,40 +3036,28 @@ void Analyser::AnalyserImpl::analyseModel(const ModelPtr &model) auto equation = aie2aeMappings[internalEquation]; - equation->mPimpl->mType = type; - equation->mPimpl->mAst = (type == AnalyserEquation::Type::EXTERNAL) ? + equation->mPimpl->mType = equationType; + equation->mPimpl->mAst = (equationType == AnalyserEquation::Type::EXTERNAL) ? nullptr : internalEquation->mAst; equation->mPimpl->mNlaSystemIndex = internalEquation->mNlaSystemIndex; for (const auto &unknownVariable : internalEquation->mUnknownVariables) { + // Keep track of the variable that the equation computes. + // Note: an unknown variable cannot be the variable of integration (since it cannot be computed) or a + // constant (snce it is not computed but set), so no need to check for those. + auto variable = aiv2avMappings[unknownVariable]; + auto variableType = variable->type(); - switch (variable->type()) { - case AnalyserVariable::Type::STATE: + if (variableType == AnalyserVariable::Type::STATE) { equation->mPimpl->mStates.push_back(variable); - - break; - case AnalyserVariable::Type::CONSTANT: - equation->mPimpl->mConstants.push_back(variable); - - break; - case AnalyserVariable::Type::COMPUTED_CONSTANT: + } else if (variableType == AnalyserVariable::Type::COMPUTED_CONSTANT) { equation->mPimpl->mComputedConstants.push_back(variable); - - break; - case AnalyserVariable::Type::ALGEBRAIC: + } else if (variableType == AnalyserVariable::Type::ALGEBRAIC) { equation->mPimpl->mAlgebraic.push_back(variable); - - break; - case AnalyserVariable::Type::EXTERNAL: + } else { // AnalyserVariable::Type::EXTERNAL. equation->mPimpl->mExternals.push_back(variable); - - break; - default: // AnalyserVariable::Type::VARIABLE_OF_INTEGRATION. - // This is the variable of integration, which cannot be computed. - - break; } } diff --git a/src/analyserequation.cpp b/src/analyserequation.cpp index d5d13f9f31..c559bfe64d 100644 --- a/src/analyserequation.cpp +++ b/src/analyserequation.cpp @@ -157,25 +157,6 @@ AnalyserVariablePtr AnalyserEquation::state(size_t index) const return mPimpl->mStates[index]; } -size_t AnalyserEquation::constantCount() const -{ - return mPimpl->mConstants.size(); -} - -std::vector AnalyserEquation::constants() const -{ - return mPimpl->mConstants; -} - -AnalyserVariablePtr AnalyserEquation::constant(size_t index) const -{ - if (index >= mPimpl->mConstants.size()) { - return {}; - } - - return mPimpl->mConstants[index]; -} - size_t AnalyserEquation::computedConstantCount() const { return mPimpl->mComputedConstants.size(); diff --git a/src/analyserequation_p.h b/src/analyserequation_p.h index d0a167f4af..a75f6faff8 100644 --- a/src/analyserequation_p.h +++ b/src/analyserequation_p.h @@ -35,7 +35,6 @@ struct AnalyserEquation::AnalyserEquationImpl bool mIsStateRateBased = false; std::vector mStates; - std::vector mConstants; std::vector mComputedConstants; std::vector mAlgebraic; std::vector mExternals; diff --git a/src/api/libcellml/analyserequation.h b/src/api/libcellml/analyserequation.h index 9c83fa402a..2e5f601b14 100644 --- a/src/api/libcellml/analyserequation.h +++ b/src/api/libcellml/analyserequation.h @@ -194,35 +194,6 @@ class LIBCELLML_EXPORT AnalyserEquation */ AnalyserVariablePtr state(size_t index) const; - /** - * @brief Get the number of constant computed by this @ref AnalyserEquation. - * - * Return the number of constants computed by this @ref AnalyserEquation. - * - * @return The number of constants. - */ - size_t constantCount() const; - - /** - * @brief Get the constants computed by this @ref AnalyserEquation. - * - * Return the constants computed by this @ref AnalyserEquation. - * - * @return The constants as a @c std::vector. - */ - std::vector constants() const; - - /** - * @brief Get the constant, at @p index, computed by this @ref AnalyserEquation. - * - * Return the constant, at @p index, computed by this @ref AnalyserEquation. - * - * @param index The index of the constant to return. - * - * @return The constant, at @p index, on success, @c nullptr on failure. - */ - AnalyserVariablePtr constant(size_t index) const; - /** * @brief Get the number of computed constants computed by this @ref AnalyserEquation. * diff --git a/src/bindings/interface/analyserequation.i b/src/bindings/interface/analyserequation.i index 3e7f3345be..e75f49f9a4 100644 --- a/src/bindings/interface/analyserequation.i +++ b/src/bindings/interface/analyserequation.i @@ -52,15 +52,6 @@ %feature("docstring") libcellml::AnalyserEquation::state "Returns the state, at the given index, computed by this :class:`AnalyserEquation` object."; -%feature("docstring") libcellml::AnalyserEquation::constantCount -"Returns the number of constants computed by this :class:`AnalyserEquation` object."; - -%feature("docstring") libcellml::AnalyserEquation::constants -"Returns the constants computed by this :class:`AnalyserEquation` object."; - -%feature("docstring") libcellml::AnalyserEquation::constant -"Returns the constant, at the given index, computed by this :class:`AnalyserEquation` object."; - %feature("docstring") libcellml::AnalyserEquation::computedConstantCount "Returns the number of computed constants computed by this :class:`AnalyserEquation` object."; diff --git a/src/bindings/javascript/analyserequation.cpp b/src/bindings/javascript/analyserequation.cpp index ed04c4c13c..5f428b0405 100644 --- a/src/bindings/javascript/analyserequation.cpp +++ b/src/bindings/javascript/analyserequation.cpp @@ -48,9 +48,6 @@ EMSCRIPTEN_BINDINGS(libcellml_analyserequation) .function("stateCount", &libcellml::AnalyserEquation::stateCount) .function("states", select_overload() const>(&libcellml::AnalyserEquation::states)) .function("state", select_overload(&libcellml::AnalyserEquation::state)) - .function("constantCount", &libcellml::AnalyserEquation::constantCount) - .function("constants", select_overload() const>(&libcellml::AnalyserEquation::constants)) - .function("constant", select_overload(&libcellml::AnalyserEquation::constant)) .function("computedConstantCount", &libcellml::AnalyserEquation::computedConstantCount) .function("computedConstants", &libcellml::AnalyserEquation::computedConstants) .function("computedConstant", &libcellml::AnalyserEquation::computedConstant) diff --git a/src/debug.cpp b/src/debug.cpp index a1a92ac882..f16c754561 100644 --- a/src/debug.cpp +++ b/src/debug.cpp @@ -96,16 +96,6 @@ void printAnalyserModelEquations(const AnalyserModelPtr &model) Debug() << "\nNo states"; } - if (eqn->constantCount() != 0) { - Debug() << "\nConstants:"; - - for (const auto &var : eqn->constants()) { - Debug() << " - " << var->variable()->name(); - } - } else { - Debug() << "\nNo constants"; - } - if (eqn->computedConstantCount() != 0) { Debug() << "\nComputed constants:"; diff --git a/src/generator.cpp b/src/generator.cpp index 7f5a6261d8..ac689f9058 100644 --- a/src/generator.cpp +++ b/src/generator.cpp @@ -64,22 +64,6 @@ bool Generator::GeneratorImpl::modelHasNlas() const } } -AnalyserVariablePtr Generator::GeneratorImpl::doAnalyserVariable(const VariablePtr &variable, - const std::vector &variables) const -{ - AnalyserVariablePtr res; - - for (const auto &var : variables) { - if (mModel->areEquivalentVariables(variable, var->variable())) { - res = var; - - break; - } - } - - return res; -} - AnalyserVariablePtr Generator::GeneratorImpl::analyserVariable(const VariablePtr &variable) const { // Find and return the analyser variable associated with the given variable. @@ -92,7 +76,29 @@ AnalyserVariablePtr Generator::GeneratorImpl::analyserVariable(const VariablePtr && mModel->areEquivalentVariables(variable, modelVoiVariable)) { res = modelVoi; } else { - res = doAnalyserVariable(variable, variables(mModel)); + // Normally, we would have something like: + // + // for (const auto &modelVariable : variables(mModel)) { + // if (mModel->areEquivalentVariables(variable, modelVariable->variable())) { + // res = modelVariable; + // + // break; + // } + // } + // + // but we always have variables, so llvm-cov will complain that the false branch of our for loop is never + // reached. The below code is a bit more verbose but at least it makes llvm-cov happy. + + auto modelVariables = variables(mModel); + auto modelVariable = modelVariables.begin(); + + do { + if (mModel->areEquivalentVariables(variable, (*modelVariable)->variable())) { + res = *modelVariable; + } else { + ++modelVariable; + } + } while (res == nullptr); } return res; @@ -246,8 +252,9 @@ void Generator::GeneratorImpl::addOriginCommentCode() "Python"; profileInformation += " profile of"; - mCode += replace(mProfile->commentString(), - "[CODE]", replace(replace(mProfile->originCommentString(), "[PROFILE_INFORMATION]", profileInformation), "[LIBCELLML_VERSION]", versionString())); + mCode += newLineIfNeeded() + + replace(mProfile->commentString(), + "[CODE]", replace(replace(mProfile->originCommentString(), "[PROFILE_INFORMATION]", profileInformation), "[LIBCELLML_VERSION]", versionString())); } } @@ -302,10 +309,9 @@ void Generator::GeneratorImpl::addVersionAndLibcellmlVersionCode(bool interface) } if (!code.empty()) { - mCode += "\n"; + mCode += newLineIfNeeded() + + code; } - - mCode += code; } void Generator::GeneratorImpl::addStateAndVariableCountCode(bool interface) @@ -355,10 +361,9 @@ void Generator::GeneratorImpl::addStateAndVariableCountCode(bool interface) } if (!code.empty()) { - mCode += "\n"; + mCode += newLineIfNeeded() + + code; } - - mCode += code; } std::string Generator::GeneratorImpl::generateVariableInfoObjectCode(const std::string &objectString) const @@ -427,10 +432,9 @@ void Generator::GeneratorImpl::addInterfaceVariableInfoCode() } if (!code.empty()) { - mCode += "\n"; + mCode += newLineIfNeeded() + + code; } - - mCode += code; } void Generator::GeneratorImpl::doAddImplementationVariableInfoCode(const std::string &variableInfoString, @@ -671,10 +675,9 @@ void Generator::GeneratorImpl::addInterfaceCreateDeleteArrayMethodsCode() } if (!code.empty()) { - mCode += "\n"; + mCode += newLineIfNeeded() + + code; } - - mCode += code; } void Generator::GeneratorImpl::addImplementationCreateDeleteArrayMethodsCode() @@ -718,7 +721,7 @@ void Generator::GeneratorImpl::addExternalVariableMethodTypeDefinitionCode() auto externalVariableMethodTypeDefinitionString = mProfile->externalVariableMethodTypeDefinitionString(modelHasOdes()); if (!externalVariableMethodTypeDefinitionString.empty()) { - mCode += "\n" + mCode += newLineIfNeeded() + externalVariableMethodTypeDefinitionString; } } @@ -748,6 +751,9 @@ void Generator::GeneratorImpl::addNlaSystemsCode() && !mProfile->objectiveFunctionMethodString(modelHasOdes()).empty() && !mProfile->findRootMethodString(modelHasOdes()).empty() && !mProfile->nlaSolveCallString(modelHasOdes()).empty()) { + // Note: only states and algebraic variables can be computed through an NLA system. Constants, computed + // constants, and external variables cannot, by definition, be computed through an NLA system. + std::vector handledNlaEquations; for (const auto &equation : mModel->equations()) { @@ -760,13 +766,7 @@ void Generator::GeneratorImpl::addNlaSystemsCode() for (const auto &variable : variables) { auto arrayString = (variable->type() == AnalyserVariable::Type::STATE) ? mProfile->ratesArrayString() : - (variable->type() == AnalyserVariable::Type::CONSTANT) ? - mProfile->constantsArrayString() : - (variable->type() == AnalyserVariable::Type::COMPUTED_CONSTANT) ? - mProfile->computedConstantsArrayString() : - (variable->type() == AnalyserVariable::Type::ALGEBRAIC) ? - mProfile->algebraicArrayString() : - mProfile->externalArrayString(); + mProfile->algebraicArrayString(); methodBody += mProfile->indentString() + arrayString + mProfile->openArrayString() + convertToString(variable->index()) + mProfile->closeArrayString() @@ -809,9 +809,7 @@ void Generator::GeneratorImpl::addNlaSystemsCode() for (const auto &variable : variables) { auto arrayString = (variable->type() == AnalyserVariable::Type::STATE) ? mProfile->ratesArrayString() : - (variable->type() == AnalyserVariable::Type::ALGEBRAIC) ? - mProfile->algebraicArrayString() : - mProfile->externalArrayString(); + mProfile->algebraicArrayString(); methodBody += mProfile->indentString() + mProfile->uArrayString() + mProfile->openArrayString() + convertToString(++i) + mProfile->closeArrayString() @@ -835,9 +833,7 @@ void Generator::GeneratorImpl::addNlaSystemsCode() for (const auto &variable : variables) { auto arrayString = (variable->type() == AnalyserVariable::Type::STATE) ? mProfile->ratesArrayString() : - (variable->type() == AnalyserVariable::Type::ALGEBRAIC) ? - mProfile->algebraicArrayString() : - mProfile->externalArrayString(); + mProfile->algebraicArrayString(); methodBody += mProfile->indentString() + arrayString + mProfile->openArrayString() + convertToString(variable->index()) + mProfile->closeArrayString() @@ -1802,10 +1798,9 @@ void Generator::GeneratorImpl::addInterfaceComputeModelMethodsCode() } if (!code.empty()) { - mCode += "\n"; + mCode += newLineIfNeeded() + + code; } - - mCode += code; } void Generator::GeneratorImpl::addImplementationInitialiseVariablesMethodCode(std::vector &remainingEquations) @@ -1831,10 +1826,6 @@ void Generator::GeneratorImpl::addImplementationInitialiseVariablesMethodCode(st auto crtConstant = std::find_if(constants.begin(), constants.end(), [=](const AnalyserVariablePtr &av) -> bool { return initialisingComponent->variable(initialValue)->hasEquivalentVariable(av->variable()); }); - if (crtConstant == constants.end()) { - break; - } - constant = crtConstant; initialisingVariable = (*constant)->variable(); initialValue = initialisingVariable->initialValue(); diff --git a/src/generator_p.h b/src/generator_p.h index 05c3298a65..8e4308c9cc 100644 --- a/src/generator_p.h +++ b/src/generator_p.h @@ -44,8 +44,6 @@ struct Generator::GeneratorImpl bool modelHasOdes() const; bool modelHasNlas() const; - AnalyserVariablePtr doAnalyserVariable(const VariablePtr &variable, - const std::vector &variables) const; AnalyserVariablePtr analyserVariable(const VariablePtr &variable) const; double scalingFactor(const VariablePtr &variable) const; diff --git a/src/utilities.cpp b/src/utilities.cpp index 73473b6739..996fc653f3 100644 --- a/src/utilities.cpp +++ b/src/utilities.cpp @@ -1326,34 +1326,16 @@ std::vector variables(const AnalyserModelPtr &model) } auto states = model->states(); - - if (!states.empty()) { - res.insert(res.end(), states.begin(), states.end()); - } - auto constants = model->constants(); - - if (!constants.empty()) { - res.insert(res.end(), constants.begin(), constants.end()); - } - auto computedConstants = model->computedConstants(); - - if (!computedConstants.empty()) { - res.insert(res.end(), computedConstants.begin(), computedConstants.end()); - } - auto algebraic = model->algebraic(); - - if (!algebraic.empty()) { - res.insert(res.end(), algebraic.begin(), algebraic.end()); - } - auto externals = model->externals(); - if (!externals.empty()) { - res.insert(res.end(), externals.begin(), externals.end()); - } + res.insert(res.end(), states.begin(), states.end()); + res.insert(res.end(), constants.begin(), constants.end()); + res.insert(res.end(), computedConstants.begin(), computedConstants.end()); + res.insert(res.end(), algebraic.begin(), algebraic.end()); + res.insert(res.end(), externals.begin(), externals.end()); return res; } @@ -1361,29 +1343,13 @@ std::vector variables(const AnalyserModelPtr &model) std::vector variables(const AnalyserEquationPtr &equation) { auto res = equation->states(); - auto constants = equation->constants(); - - if (!constants.empty()) { - res.insert(res.end(), constants.begin(), constants.end()); - } - auto computedConstants = equation->computedConstants(); - - if (!computedConstants.empty()) { - res.insert(res.end(), computedConstants.begin(), computedConstants.end()); - } - auto algebraic = equation->algebraic(); - - if (!algebraic.empty()) { - res.insert(res.end(), algebraic.begin(), algebraic.end()); - } - auto externals = equation->externals(); - if (!externals.empty()) { - res.insert(res.end(), externals.begin(), externals.end()); - } + res.insert(res.end(), computedConstants.begin(), computedConstants.end()); + res.insert(res.end(), algebraic.begin(), algebraic.end()); + res.insert(res.end(), externals.begin(), externals.end()); return res; } diff --git a/tests/coverage/coverage.cpp b/tests/coverage/coverage.cpp index cd9654184a..c0ff65534d 100644 --- a/tests/coverage/coverage.cpp +++ b/tests/coverage/coverage.cpp @@ -584,6 +584,8 @@ TEST(Coverage, generator) auto analyser = libcellml::Analyser::create(); + analyser->addExternalVariable(libcellml::AnalyserExternalVariable::create(model->component("my_component")->variable("eqnPlus"))); + analyser->analyseModel(model); EXPECT_EQ(size_t(0), analyser->errorCount()); @@ -595,8 +597,9 @@ TEST(Coverage, generator) EXPECT_EQ(size_t(1), analyserModel->stateCount()); EXPECT_EQ(size_t(7), analyserModel->constantCount()); - EXPECT_EQ(size_t(200), analyserModel->computedConstantCount()); + EXPECT_EQ(size_t(199), analyserModel->computedConstantCount()); EXPECT_EQ(size_t(2), analyserModel->algebraicCount()); + EXPECT_EQ(size_t(1), analyserModel->externalCount()); EXPECT_EQ(size_t(203), analyserModel->equationCount()); EXPECT_NE(nullptr, analyserModel->voi()); @@ -607,15 +610,23 @@ TEST(Coverage, generator) EXPECT_NE(size_t(0), analyserModel->state(0)->equationCount()); EXPECT_NE(size_t(0), analyserModel->state(0)->equations().size()); EXPECT_NE(nullptr, analyserModel->state(0)->equation(0)); + EXPECT_NE(nullptr, analyserModel->state(0)->equation(0)->state(0)); EXPECT_EQ(nullptr, analyserModel->state(analyserModel->stateCount())); EXPECT_NE(nullptr, analyserModel->constant(0)); EXPECT_EQ(nullptr, analyserModel->constant(analyserModel->constantCount())); EXPECT_NE(nullptr, analyserModel->computedConstant(0)); + EXPECT_NE(nullptr, analyserModel->computedConstant(0)->equation(0)->computedConstant(0)); EXPECT_EQ(nullptr, analyserModel->computedConstant(analyserModel->computedConstantCount())); EXPECT_NE(nullptr, analyserModel->algebraic(0)); + EXPECT_NE(nullptr, analyserModel->algebraic(0)->equation(0)->algebraic(0)); EXPECT_EQ(nullptr, analyserModel->algebraic(analyserModel->algebraicCount())); - EXPECT_EQ(nullptr, analyserModel->external(0)); + EXPECT_NE(nullptr, analyserModel->external(0)); + EXPECT_NE(nullptr, analyserModel->external(0)->equation(0)->external(0)); EXPECT_EQ(nullptr, analyserModel->external(analyserModel->algebraicCount())); + EXPECT_EQ(size_t(1), analyserModel->equation(0)->stateCount()); + EXPECT_EQ(size_t(1), analyserModel->equation(0)->states().size()); + EXPECT_NE(nullptr, analyserModel->equation(0)->state(0)); + EXPECT_EQ(nullptr, analyserModel->equation(0)->state(analyserModel->equation(0)->stateCount())); EXPECT_NE(nullptr, analyserModel->equation(199)); EXPECT_NE(size_t(0), analyserModel->equation(199)->dependencyCount()); EXPECT_NE(size_t(0), analyserModel->equation(199)->dependencies().size()); @@ -746,6 +757,9 @@ TEST(Coverage, generator) profile->setImplementationDeleteArrayMethodString(""); + profile->setImplementationInitialiseVariablesMethodString(false, ""); + profile->setImplementationInitialiseVariablesMethodString(true, ""); + profile->setImplementationComputeVariablesMethodString(false, false, ""); profile->setImplementationComputeVariablesMethodString(false, true, ""); profile->setImplementationComputeVariablesMethodString(true, false, ""); diff --git a/tests/resources/coverage/generator/model.c b/tests/resources/coverage/generator/model.c index cdfe71e116..7560c12833 100644 --- a/tests/resources/coverage/generator/model.c +++ b/tests/resources/coverage/generator/model.c @@ -10,8 +10,9 @@ const char LIBCELLML_VERSION[] = "0.5.0"; const size_t STATE_COUNT = 1; const size_t CONSTANT_COUNT = 7; -const size_t COMPUTED_CONSTANT_COUNT = 200; +const size_t COMPUTED_CONSTANT_COUNT = 199; const size_t ALGEBRAIC_COUNT = 2; +const size_t EXTERNAL_COUNT = 1; const VariableInfo VOI_INFO = {"t", "second", "my_component"}; @@ -91,7 +92,6 @@ const VariableInfo COMPUTED_CONSTANT_INFO[] = { {"eqnXorParenthesesRightRoot", "dimensionless", "my_component"}, {"eqnXorCoverageParentheses", "dimensionless", "my_component"}, {"eqnNot", "dimensionless", "my_component"}, - {"eqnPlus", "dimensionless", "my_component"}, {"eqnPlusMultiple", "dimensionless", "my_component"}, {"eqnPlusParentheses", "dimensionless", "my_component"}, {"eqnPlusUnary", "dimensionless", "my_component"}, @@ -237,6 +237,10 @@ const VariableInfo ALGEBRAIC_INFO[] = { {"eqnNlaVariable2", "dimensionless", "my_component"} }; +const VariableInfo EXTERNAL_INFO[] = { + {"eqnPlus", "dimensionless", "my_component"} +}; + double xor(double x, double y) { return (x != 0.0) ^ (y != 0.0); @@ -362,6 +366,17 @@ double * createAlgebraicArray() return res; } +double * createExternalsArray() +{ + double *res = (double *) malloc(EXTERNAL_COUNT*sizeof(double)); + + for (size_t i = 0; i < EXTERNAL_COUNT; ++i) { + res[i] = NAN; + } + + return res; +} + void deleteArray(double *array) { free(array); @@ -374,6 +389,7 @@ typedef struct { double *constants; double *computedConstants; double *algebraic; + double *externals; } RootFindingInfo; extern void nlaSolve(void (*objectiveFunction)(double *, double *, void *), @@ -392,7 +408,7 @@ void objectiveFunction0(double *u, double *f, void *data) algebraic[1] = u[1]; f[0] = algebraic[0]+algebraic[1]+states[0]-0.0; - f[1] = algebraic[0]-algebraic[1]-(computedConstants[198]+computedConstants[199]); + f[1] = algebraic[0]-algebraic[1]-(computedConstants[197]+computedConstants[198]); } void findRoot0(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) @@ -419,18 +435,18 @@ void initialiseVariables(double *states, double *rates, double *constants, doubl constants[4] = 5.0; constants[5] = 6.0; constants[6] = 7.0; - computedConstants[177] = 123.0; - computedConstants[178] = 123.456789; - computedConstants[179] = 123.0e99; - computedConstants[180] = 123.456789e99; - computedConstants[182] = 1.0; - computedConstants[183] = 0.0; - computedConstants[184] = 2.71828182845905; - computedConstants[185] = 3.14159265358979; - computedConstants[186] = INFINITY; - computedConstants[187] = NAN; - computedConstants[198] = 1.0; - computedConstants[199] = 3.0; + computedConstants[176] = 123.0; + computedConstants[177] = 123.456789; + computedConstants[178] = 123.0e99; + computedConstants[179] = 123.456789e99; + computedConstants[181] = 1.0; + computedConstants[182] = 0.0; + computedConstants[183] = 2.71828182845905; + computedConstants[184] = 3.14159265358979; + computedConstants[185] = INFINITY; + computedConstants[186] = NAN; + computedConstants[197] = 1.0; + computedConstants[198] = 3.0; algebraic[0] = 1.0; algebraic[1] = 2.0; } @@ -498,141 +514,141 @@ void computeComputedConstants(double *constants, double *computedConstants) computedConstants[58] = xor(constants[0] < constants[1], pow(constants[2], 1.0/constants[3])); computedConstants[59] = constants[0]/xor(constants[1], constants[2]); computedConstants[60] = !constants[0]; - computedConstants[61] = constants[0]+constants[1]; - computedConstants[62] = constants[0]+constants[1]+constants[2]; - computedConstants[63] = (constants[0] < constants[1])+(constants[2] > constants[3]); - computedConstants[64] = constants[0]; - computedConstants[65] = constants[0]-constants[1]; - computedConstants[66] = (constants[0] < constants[1])-(constants[2] > constants[3]); - computedConstants[67] = (constants[0] < constants[1])-(constants[2]+constants[3]); - computedConstants[68] = (constants[0] < constants[1])-constants[2]; - computedConstants[69] = constants[0]-(-constants[1]); - computedConstants[70] = constants[0]-(-constants[1]*constants[2]); - computedConstants[71] = -constants[0]; - computedConstants[72] = -(constants[0] < constants[1]); - computedConstants[73] = constants[0]*constants[1]; - computedConstants[74] = constants[0]*constants[1]*constants[2]; - computedConstants[75] = (constants[0] < constants[1])*(constants[2] > constants[3]); - computedConstants[76] = (constants[0]+constants[1])*(constants[2] > constants[3]); - computedConstants[77] = constants[0]*(constants[1] > constants[2]); - computedConstants[78] = (constants[0]-constants[1])*(constants[2] > constants[3]); - computedConstants[79] = -constants[0]*(constants[1] > constants[2]); - computedConstants[80] = (constants[0] < constants[1])*(constants[2]+constants[3]); - computedConstants[81] = (constants[0] < constants[1])*constants[2]; - computedConstants[82] = (constants[0] < constants[1])*(constants[2]-constants[3]); - computedConstants[83] = (constants[0] < constants[1])*-constants[2]; - computedConstants[84] = constants[0]/constants[1]; - computedConstants[85] = (constants[0] < constants[1])/(constants[3] > constants[2]); - computedConstants[86] = (constants[0]+constants[1])/(constants[3] > constants[2]); - computedConstants[87] = constants[0]/(constants[2] > constants[1]); - computedConstants[88] = (constants[0]-constants[1])/(constants[3] > constants[2]); - computedConstants[89] = -constants[0]/(constants[2] > constants[1]); - computedConstants[90] = (constants[0] < constants[1])/(constants[2]+constants[3]); - computedConstants[91] = (constants[0] < constants[1])/constants[2]; - computedConstants[92] = (constants[0] < constants[1])/(constants[2]-constants[3]); - computedConstants[93] = (constants[0] < constants[1])/-constants[2]; - computedConstants[94] = (constants[0] < constants[1])/(constants[2]*constants[3]); - computedConstants[95] = (constants[0] < constants[1])/(constants[2]/constants[3]); - computedConstants[96] = sqrt(constants[0]); - computedConstants[97] = pow(constants[0], 2.0); - computedConstants[98] = pow(constants[0], 3.0); - computedConstants[99] = pow(constants[0], constants[1]); - computedConstants[100] = pow(constants[0] <= constants[1], constants[2] >= constants[3]); - computedConstants[101] = pow(constants[0]+constants[1], constants[2] >= constants[3]); - computedConstants[102] = pow(constants[0], constants[1] >= constants[2]); - computedConstants[103] = pow(constants[0]-constants[1], constants[2] >= constants[3]); - computedConstants[104] = pow(-constants[0], constants[1] >= constants[2]); - computedConstants[105] = pow(constants[0]*constants[1], constants[2] >= constants[3]); - computedConstants[106] = pow(constants[0]/constants[1], constants[2] >= constants[3]); - computedConstants[107] = pow(constants[0] <= constants[1], constants[2]+constants[3]); - computedConstants[108] = pow(constants[0] <= constants[1], constants[2]); - computedConstants[109] = pow(constants[0] <= constants[1], constants[2]-constants[3]); - computedConstants[110] = pow(constants[0] <= constants[1], -constants[2]); - computedConstants[111] = pow(constants[0] <= constants[1], constants[2]*constants[3]); - computedConstants[112] = pow(constants[0] <= constants[1], constants[2]/constants[3]); - computedConstants[113] = pow(constants[0] <= constants[1], pow(constants[2], constants[3])); - computedConstants[114] = pow(constants[0] <= constants[1], pow(constants[2], 1.0/constants[3])); + computedConstants[61] = constants[0]+constants[1]+constants[2]; + computedConstants[62] = (constants[0] < constants[1])+(constants[2] > constants[3]); + computedConstants[63] = constants[0]; + computedConstants[64] = constants[0]-constants[1]; + computedConstants[65] = (constants[0] < constants[1])-(constants[2] > constants[3]); + computedConstants[66] = (constants[0] < constants[1])-(constants[2]+constants[3]); + computedConstants[67] = (constants[0] < constants[1])-constants[2]; + computedConstants[68] = constants[0]-(-constants[1]); + computedConstants[69] = constants[0]-(-constants[1]*constants[2]); + computedConstants[70] = -constants[0]; + computedConstants[71] = -(constants[0] < constants[1]); + computedConstants[72] = constants[0]*constants[1]; + computedConstants[73] = constants[0]*constants[1]*constants[2]; + computedConstants[74] = (constants[0] < constants[1])*(constants[2] > constants[3]); + computedConstants[75] = (constants[0]+constants[1])*(constants[2] > constants[3]); + computedConstants[76] = constants[0]*(constants[1] > constants[2]); + computedConstants[77] = (constants[0]-constants[1])*(constants[2] > constants[3]); + computedConstants[78] = -constants[0]*(constants[1] > constants[2]); + computedConstants[79] = (constants[0] < constants[1])*(constants[2]+constants[3]); + computedConstants[80] = (constants[0] < constants[1])*constants[2]; + computedConstants[81] = (constants[0] < constants[1])*(constants[2]-constants[3]); + computedConstants[82] = (constants[0] < constants[1])*-constants[2]; + computedConstants[83] = constants[0]/constants[1]; + computedConstants[84] = (constants[0] < constants[1])/(constants[3] > constants[2]); + computedConstants[85] = (constants[0]+constants[1])/(constants[3] > constants[2]); + computedConstants[86] = constants[0]/(constants[2] > constants[1]); + computedConstants[87] = (constants[0]-constants[1])/(constants[3] > constants[2]); + computedConstants[88] = -constants[0]/(constants[2] > constants[1]); + computedConstants[89] = (constants[0] < constants[1])/(constants[2]+constants[3]); + computedConstants[90] = (constants[0] < constants[1])/constants[2]; + computedConstants[91] = (constants[0] < constants[1])/(constants[2]-constants[3]); + computedConstants[92] = (constants[0] < constants[1])/-constants[2]; + computedConstants[93] = (constants[0] < constants[1])/(constants[2]*constants[3]); + computedConstants[94] = (constants[0] < constants[1])/(constants[2]/constants[3]); + computedConstants[95] = sqrt(constants[0]); + computedConstants[96] = pow(constants[0], 2.0); + computedConstants[97] = pow(constants[0], 3.0); + computedConstants[98] = pow(constants[0], constants[1]); + computedConstants[99] = pow(constants[0] <= constants[1], constants[2] >= constants[3]); + computedConstants[100] = pow(constants[0]+constants[1], constants[2] >= constants[3]); + computedConstants[101] = pow(constants[0], constants[1] >= constants[2]); + computedConstants[102] = pow(constants[0]-constants[1], constants[2] >= constants[3]); + computedConstants[103] = pow(-constants[0], constants[1] >= constants[2]); + computedConstants[104] = pow(constants[0]*constants[1], constants[2] >= constants[3]); + computedConstants[105] = pow(constants[0]/constants[1], constants[2] >= constants[3]); + computedConstants[106] = pow(constants[0] <= constants[1], constants[2]+constants[3]); + computedConstants[107] = pow(constants[0] <= constants[1], constants[2]); + computedConstants[108] = pow(constants[0] <= constants[1], constants[2]-constants[3]); + computedConstants[109] = pow(constants[0] <= constants[1], -constants[2]); + computedConstants[110] = pow(constants[0] <= constants[1], constants[2]*constants[3]); + computedConstants[111] = pow(constants[0] <= constants[1], constants[2]/constants[3]); + computedConstants[112] = pow(constants[0] <= constants[1], pow(constants[2], constants[3])); + computedConstants[113] = pow(constants[0] <= constants[1], pow(constants[2], 1.0/constants[3])); + computedConstants[114] = sqrt(constants[0]); computedConstants[115] = sqrt(constants[0]); - computedConstants[116] = sqrt(constants[0]); - computedConstants[117] = pow(constants[0], 1.0/3.0); - computedConstants[118] = pow(constants[0], 1.0/constants[1]); - computedConstants[119] = pow(constants[0] < constants[1], 1.0/(constants[3] > constants[2])); - computedConstants[120] = pow(constants[0]+constants[1], 1.0/(constants[3] > constants[2])); - computedConstants[121] = pow(constants[0], 1.0/(constants[2] > constants[1])); - computedConstants[122] = pow(constants[0]-constants[1], 1.0/(constants[3] > constants[2])); - computedConstants[123] = pow(-constants[0], 1.0/(constants[2] > constants[1])); - computedConstants[124] = pow(constants[0]*constants[1], 1.0/(constants[3] > constants[2])); - computedConstants[125] = pow(constants[0]/constants[1], 1.0/(constants[3] > constants[2])); - computedConstants[126] = pow(constants[0] < constants[1], 1.0/(constants[2]+constants[3])); - computedConstants[127] = pow(constants[0] < constants[1], 1.0/constants[2]); - computedConstants[128] = pow(constants[0] < constants[1], 1.0/(constants[2]-constants[3])); - computedConstants[129] = pow(constants[0] < constants[1], 1.0/-constants[2]); - computedConstants[130] = pow(constants[0] < constants[1], 1.0/(constants[2]*constants[3])); - computedConstants[131] = pow(constants[0] < constants[1], 1.0/(constants[2]/constants[3])); - computedConstants[132] = pow(constants[0] < constants[1], 1.0/pow(constants[2], constants[3])); - computedConstants[133] = pow(constants[0] < constants[1], 1.0/pow(constants[2], 1.0/constants[3])); - computedConstants[134] = fabs(constants[0]); - computedConstants[135] = exp(constants[0]); - computedConstants[136] = log(constants[0]); - computedConstants[137] = log10(constants[0]); - computedConstants[138] = log(constants[0])/log(2.0); - computedConstants[139] = log10(constants[0]); - computedConstants[140] = log(constants[0])/log(constants[1]); - computedConstants[141] = ceil(constants[0]); - computedConstants[142] = floor(constants[0]); - computedConstants[143] = min(constants[0], constants[1]); - computedConstants[144] = min(constants[0], min(constants[1], constants[2])); - computedConstants[145] = max(constants[0], constants[1]); - computedConstants[146] = max(constants[0], max(constants[1], constants[2])); - computedConstants[147] = fmod(constants[0], constants[1]); - computedConstants[148] = sin(constants[0]); - computedConstants[149] = cos(constants[0]); - computedConstants[150] = tan(constants[0]); - computedConstants[151] = sec(constants[0]); - computedConstants[152] = csc(constants[0]); - computedConstants[153] = cot(constants[0]); - computedConstants[154] = sinh(constants[0]); - computedConstants[155] = cosh(constants[0]); - computedConstants[156] = tanh(constants[0]); - computedConstants[157] = sech(constants[0]); - computedConstants[158] = csch(constants[0]); - computedConstants[159] = coth(constants[0]); - computedConstants[160] = asin(constants[0]); - computedConstants[161] = acos(constants[0]); - computedConstants[162] = atan(constants[0]); - computedConstants[163] = asec(constants[0]); - computedConstants[164] = acsc(constants[0]); - computedConstants[165] = acot(constants[0]); - computedConstants[166] = asinh(constants[0]); - computedConstants[167] = acosh(constants[0]); - computedConstants[168] = atanh(constants[0]/2.0); - computedConstants[169] = asech(constants[0]); - computedConstants[170] = acsch(constants[0]); - computedConstants[171] = acoth(2.0*constants[0]); - computedConstants[172] = (constants[0] > constants[1])?constants[0]:NAN; - computedConstants[173] = (constants[0] > constants[1])?constants[0]:constants[2]; - computedConstants[174] = (constants[0] > constants[1])?constants[0]:(constants[2] > constants[3])?constants[2]:(constants[4] > constants[5])?constants[4]:NAN; - computedConstants[175] = (constants[0] > constants[1])?constants[0]:(constants[2] > constants[3])?constants[2]:(constants[4] > constants[5])?constants[4]:constants[6]; - computedConstants[176] = 123.0+((constants[0] > constants[1])?constants[0]:NAN); - computedConstants[181] = constants[0]; - computedConstants[188] = (constants[0] && constants[1])+((constants[2] > constants[3])?constants[1]:NAN)+constants[4]+(constants[5] && constants[6]); - computedConstants[189] = (constants[0] && constants[1])-(((constants[2] > constants[3])?constants[1]:NAN)-(constants[4]-((constants[2] > constants[3])?constants[1]:NAN)))-(constants[5] && constants[6]); - computedConstants[190] = (constants[0] && constants[1])*((constants[2] > constants[3])?constants[1]:NAN)*constants[4]*((constants[2] > constants[3])?constants[1]:NAN)*(constants[5] && constants[6]); - computedConstants[191] = (constants[0] && constants[1])/(((constants[2] > constants[3])?constants[1]:NAN)/(constants[4]/((constants[2] > constants[3])?constants[1]:NAN))); - computedConstants[192] = (constants[0] || constants[1]) && xor(constants[0], constants[1]) && ((constants[2] > constants[3])?constants[1]:NAN) && constants[4] && ((constants[2] > constants[3])?constants[1]:NAN) && xor(constants[0], constants[1]) && (constants[0] || constants[1]); - computedConstants[193] = (constants[0] && constants[1]) || xor(constants[0], constants[1]) || ((constants[2] > constants[3])?constants[1]:NAN) || constants[4] || ((constants[2] > constants[3])?constants[1]:NAN) || xor(constants[0], constants[1]) || (constants[0] && constants[1]); - computedConstants[194] = xor(constants[0] && constants[1], xor(constants[0] || constants[1], xor((constants[2] > constants[3])?constants[1]:NAN, xor(xor(xor(constants[4], (constants[2] > constants[3])?constants[1]:NAN), constants[0] || constants[1]), constants[0] && constants[1])))); - computedConstants[195] = pow(constants[0] && constants[1], pow((constants[2] > constants[3])?constants[1]:NAN, pow(pow(constants[4], (constants[2] > constants[3])?constants[1]:NAN), constants[0] && constants[1]))); - computedConstants[196] = pow(pow(pow(constants[0] && constants[1], 1.0/pow((constants[2] > constants[3])?constants[1]:NAN, 1.0/constants[4])), 1.0/((constants[2] > constants[3])?constants[1]:NAN)), 1.0/(constants[0] && constants[1])); - computedConstants[197] = -(constants[0] && constants[1])+-((constants[2] > constants[3])?constants[1]:NAN); + computedConstants[116] = pow(constants[0], 1.0/3.0); + computedConstants[117] = pow(constants[0], 1.0/constants[1]); + computedConstants[118] = pow(constants[0] < constants[1], 1.0/(constants[3] > constants[2])); + computedConstants[119] = pow(constants[0]+constants[1], 1.0/(constants[3] > constants[2])); + computedConstants[120] = pow(constants[0], 1.0/(constants[2] > constants[1])); + computedConstants[121] = pow(constants[0]-constants[1], 1.0/(constants[3] > constants[2])); + computedConstants[122] = pow(-constants[0], 1.0/(constants[2] > constants[1])); + computedConstants[123] = pow(constants[0]*constants[1], 1.0/(constants[3] > constants[2])); + computedConstants[124] = pow(constants[0]/constants[1], 1.0/(constants[3] > constants[2])); + computedConstants[125] = pow(constants[0] < constants[1], 1.0/(constants[2]+constants[3])); + computedConstants[126] = pow(constants[0] < constants[1], 1.0/constants[2]); + computedConstants[127] = pow(constants[0] < constants[1], 1.0/(constants[2]-constants[3])); + computedConstants[128] = pow(constants[0] < constants[1], 1.0/-constants[2]); + computedConstants[129] = pow(constants[0] < constants[1], 1.0/(constants[2]*constants[3])); + computedConstants[130] = pow(constants[0] < constants[1], 1.0/(constants[2]/constants[3])); + computedConstants[131] = pow(constants[0] < constants[1], 1.0/pow(constants[2], constants[3])); + computedConstants[132] = pow(constants[0] < constants[1], 1.0/pow(constants[2], 1.0/constants[3])); + computedConstants[133] = fabs(constants[0]); + computedConstants[134] = exp(constants[0]); + computedConstants[135] = log(constants[0]); + computedConstants[136] = log10(constants[0]); + computedConstants[137] = log(constants[0])/log(2.0); + computedConstants[138] = log10(constants[0]); + computedConstants[139] = log(constants[0])/log(constants[1]); + computedConstants[140] = ceil(constants[0]); + computedConstants[141] = floor(constants[0]); + computedConstants[142] = min(constants[0], constants[1]); + computedConstants[143] = min(constants[0], min(constants[1], constants[2])); + computedConstants[144] = max(constants[0], constants[1]); + computedConstants[145] = max(constants[0], max(constants[1], constants[2])); + computedConstants[146] = fmod(constants[0], constants[1]); + computedConstants[147] = sin(constants[0]); + computedConstants[148] = cos(constants[0]); + computedConstants[149] = tan(constants[0]); + computedConstants[150] = sec(constants[0]); + computedConstants[151] = csc(constants[0]); + computedConstants[152] = cot(constants[0]); + computedConstants[153] = sinh(constants[0]); + computedConstants[154] = cosh(constants[0]); + computedConstants[155] = tanh(constants[0]); + computedConstants[156] = sech(constants[0]); + computedConstants[157] = csch(constants[0]); + computedConstants[158] = coth(constants[0]); + computedConstants[159] = asin(constants[0]); + computedConstants[160] = acos(constants[0]); + computedConstants[161] = atan(constants[0]); + computedConstants[162] = asec(constants[0]); + computedConstants[163] = acsc(constants[0]); + computedConstants[164] = acot(constants[0]); + computedConstants[165] = asinh(constants[0]); + computedConstants[166] = acosh(constants[0]); + computedConstants[167] = atanh(constants[0]/2.0); + computedConstants[168] = asech(constants[0]); + computedConstants[169] = acsch(constants[0]); + computedConstants[170] = acoth(2.0*constants[0]); + computedConstants[171] = (constants[0] > constants[1])?constants[0]:NAN; + computedConstants[172] = (constants[0] > constants[1])?constants[0]:constants[2]; + computedConstants[173] = (constants[0] > constants[1])?constants[0]:(constants[2] > constants[3])?constants[2]:(constants[4] > constants[5])?constants[4]:NAN; + computedConstants[174] = (constants[0] > constants[1])?constants[0]:(constants[2] > constants[3])?constants[2]:(constants[4] > constants[5])?constants[4]:constants[6]; + computedConstants[175] = 123.0+((constants[0] > constants[1])?constants[0]:NAN); + computedConstants[180] = constants[0]; + computedConstants[187] = (constants[0] && constants[1])+((constants[2] > constants[3])?constants[1]:NAN)+constants[4]+(constants[5] && constants[6]); + computedConstants[188] = (constants[0] && constants[1])-(((constants[2] > constants[3])?constants[1]:NAN)-(constants[4]-((constants[2] > constants[3])?constants[1]:NAN)))-(constants[5] && constants[6]); + computedConstants[189] = (constants[0] && constants[1])*((constants[2] > constants[3])?constants[1]:NAN)*constants[4]*((constants[2] > constants[3])?constants[1]:NAN)*(constants[5] && constants[6]); + computedConstants[190] = (constants[0] && constants[1])/(((constants[2] > constants[3])?constants[1]:NAN)/(constants[4]/((constants[2] > constants[3])?constants[1]:NAN))); + computedConstants[191] = (constants[0] || constants[1]) && xor(constants[0], constants[1]) && ((constants[2] > constants[3])?constants[1]:NAN) && constants[4] && ((constants[2] > constants[3])?constants[1]:NAN) && xor(constants[0], constants[1]) && (constants[0] || constants[1]); + computedConstants[192] = (constants[0] && constants[1]) || xor(constants[0], constants[1]) || ((constants[2] > constants[3])?constants[1]:NAN) || constants[4] || ((constants[2] > constants[3])?constants[1]:NAN) || xor(constants[0], constants[1]) || (constants[0] && constants[1]); + computedConstants[193] = xor(constants[0] && constants[1], xor(constants[0] || constants[1], xor((constants[2] > constants[3])?constants[1]:NAN, xor(xor(xor(constants[4], (constants[2] > constants[3])?constants[1]:NAN), constants[0] || constants[1]), constants[0] && constants[1])))); + computedConstants[194] = pow(constants[0] && constants[1], pow((constants[2] > constants[3])?constants[1]:NAN, pow(pow(constants[4], (constants[2] > constants[3])?constants[1]:NAN), constants[0] && constants[1]))); + computedConstants[195] = pow(pow(pow(constants[0] && constants[1], 1.0/pow((constants[2] > constants[3])?constants[1]:NAN, 1.0/constants[4])), 1.0/((constants[2] > constants[3])?constants[1]:NAN)), 1.0/(constants[0] && constants[1])); + computedConstants[196] = -(constants[0] && constants[1])+-((constants[2] > constants[3])?constants[1]:NAN); } -void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) +void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, double *externals, ExternalVariable externalVariable) { rates[0] = 1.0; } -void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) +void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, double *externals, ExternalVariable externalVariable) { + externals[0] = externalVariable(voi, states, rates, constants, computedConstants, algebraic, externals, 0); findRoot0(voi, states, rates, constants, computedConstants, algebraic); } diff --git a/tests/resources/coverage/generator/model.h b/tests/resources/coverage/generator/model.h index 8f8822482d..e54a32cfa7 100644 --- a/tests/resources/coverage/generator/model.h +++ b/tests/resources/coverage/generator/model.h @@ -11,6 +11,7 @@ extern const size_t STATE_COUNT; extern const size_t CONSTANT_COUNT; extern const size_t COMPUTED_CONSTANT_COUNT; extern const size_t ALGEBRAIC_COUNT; +extern const size_t EXTERNAL_COUNT; typedef struct { char name[38]; @@ -23,15 +24,19 @@ extern const VariableInfo STATE_INFO[]; extern const VariableInfo CONSTANT_INFO[]; extern const VariableInfo COMPUTED_CONSTANT_INFO[]; extern const VariableInfo ALGEBRAIC_INFO[]; +extern const VariableInfo EXTERNAL_INFO[]; double * createStatesArray(); double * createConstantsArray(); double * createComputedConstantsArray(); double * createAlgebraicArray(); +double * createExternalsArray(); void deleteArray(double *array); +typedef double (* ExternalVariable)(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, double *externals, size_t index); + void initialiseVariables(double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); -void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); -void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); +void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, double *externals, ExternalVariable externalVariable); +void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, double *externals, ExternalVariable externalVariable); diff --git a/tests/resources/coverage/generator/model.implementation.out b/tests/resources/coverage/generator/model.implementation.out index c969013df1..3f78260f61 100644 --- a/tests/resources/coverage/generator/model.implementation.out +++ b/tests/resources/coverage/generator/model.implementation.out @@ -125,6 +125,17 @@ double * createAlgebraicArray() return res; } +double * createExternalsArray() +{ + double *res = (double *) malloc(EXTERNAL_COUNT*sizeof(double)); + + for (size_t i = 0; i < EXTERNAL_COUNT; ++i) { + res[i] = NAN; + } + + return res; +} + void deleteArray(double *array) { free(array); @@ -137,6 +148,7 @@ typedef struct { double *constants; double *computedConstants; double *algebraic; + double *externals; } RootFindingInfo; extern void nlaSolve(void (*objectiveFunction)(double *, double *, void *), @@ -155,7 +167,7 @@ void objectiveFunction0(double *u, double *f, void *data) algebraic[1] = u[1]; f[0] = algebraic[0]+algebraic[1]+states[0]-0.0; - f[1] = algebraic[0]-algebraic[1]-(computedConstants[198]+computedConstants[199]); + f[1] = algebraic[0]-algebraic[1]-(computedConstants[197]+computedConstants[198]); } void findRoot0(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) @@ -182,18 +194,18 @@ void initialiseVariables(double *states, double *rates, double *constants, doubl constants[4] = 5.0; constants[5] = 6.0; constants[6] = 7.0; - computedConstants[177] = 123.0; - computedConstants[178] = 123.456789; - computedConstants[179] = 123.0e99; - computedConstants[180] = 123.456789e99; - computedConstants[182] = 1.0; - computedConstants[183] = 0.0; - computedConstants[184] = 2.71828182845905; - computedConstants[185] = 3.14159265358979; - computedConstants[186] = INFINITY; - computedConstants[187] = NAN; - computedConstants[198] = 1.0; - computedConstants[199] = 3.0; + computedConstants[176] = 123.0; + computedConstants[177] = 123.456789; + computedConstants[178] = 123.0e99; + computedConstants[179] = 123.456789e99; + computedConstants[181] = 1.0; + computedConstants[182] = 0.0; + computedConstants[183] = 2.71828182845905; + computedConstants[184] = 3.14159265358979; + computedConstants[185] = INFINITY; + computedConstants[186] = NAN; + computedConstants[197] = 1.0; + computedConstants[198] = 3.0; algebraic[0] = 1.0; algebraic[1] = 2.0; } @@ -261,141 +273,141 @@ void computeComputedConstants(double *constants, double *computedConstants) computedConstants[58] = xor(lt(constants[0], constants[1]), pow(constants[2], 1.0/constants[3])); computedConstants[59] = constants[0]/xor(constants[1], constants[2]); computedConstants[60] = not(constants[0]); - computedConstants[61] = constants[0]+constants[1]; - computedConstants[62] = constants[0]+constants[1]+constants[2]; - computedConstants[63] = lt(constants[0], constants[1])+gt(constants[2], constants[3]); - computedConstants[64] = constants[0]; - computedConstants[65] = constants[0]-constants[1]; - computedConstants[66] = lt(constants[0], constants[1])-gt(constants[2], constants[3]); - computedConstants[67] = lt(constants[0], constants[1])-(constants[2]+constants[3]); - computedConstants[68] = lt(constants[0], constants[1])-constants[2]; - computedConstants[69] = constants[0]-(-constants[1]); - computedConstants[70] = constants[0]-(-constants[1]*constants[2]); - computedConstants[71] = -constants[0]; - computedConstants[72] = -lt(constants[0], constants[1]); - computedConstants[73] = constants[0]*constants[1]; - computedConstants[74] = constants[0]*constants[1]*constants[2]; - computedConstants[75] = lt(constants[0], constants[1])*gt(constants[2], constants[3]); - computedConstants[76] = (constants[0]+constants[1])*gt(constants[2], constants[3]); - computedConstants[77] = constants[0]*gt(constants[1], constants[2]); - computedConstants[78] = (constants[0]-constants[1])*gt(constants[2], constants[3]); - computedConstants[79] = -constants[0]*gt(constants[1], constants[2]); - computedConstants[80] = lt(constants[0], constants[1])*(constants[2]+constants[3]); - computedConstants[81] = lt(constants[0], constants[1])*constants[2]; - computedConstants[82] = lt(constants[0], constants[1])*(constants[2]-constants[3]); - computedConstants[83] = lt(constants[0], constants[1])*-constants[2]; - computedConstants[84] = constants[0]/constants[1]; - computedConstants[85] = lt(constants[0], constants[1])/gt(constants[3], constants[2]); - computedConstants[86] = (constants[0]+constants[1])/gt(constants[3], constants[2]); - computedConstants[87] = constants[0]/gt(constants[2], constants[1]); - computedConstants[88] = (constants[0]-constants[1])/gt(constants[3], constants[2]); - computedConstants[89] = -constants[0]/gt(constants[2], constants[1]); - computedConstants[90] = lt(constants[0], constants[1])/(constants[2]+constants[3]); - computedConstants[91] = lt(constants[0], constants[1])/constants[2]; - computedConstants[92] = lt(constants[0], constants[1])/(constants[2]-constants[3]); - computedConstants[93] = lt(constants[0], constants[1])/-constants[2]; - computedConstants[94] = lt(constants[0], constants[1])/(constants[2]*constants[3]); - computedConstants[95] = lt(constants[0], constants[1])/(constants[2]/constants[3]); - computedConstants[96] = sqrt(constants[0]); - computedConstants[97] = pow(constants[0], 2.0); - computedConstants[98] = pow(constants[0], 3.0); - computedConstants[99] = pow(constants[0], constants[1]); - computedConstants[100] = pow(leq(constants[0], constants[1]), geq(constants[2], constants[3])); - computedConstants[101] = pow(constants[0]+constants[1], geq(constants[2], constants[3])); - computedConstants[102] = pow(constants[0], geq(constants[1], constants[2])); - computedConstants[103] = pow(constants[0]-constants[1], geq(constants[2], constants[3])); - computedConstants[104] = pow(-constants[0], geq(constants[1], constants[2])); - computedConstants[105] = pow(constants[0]*constants[1], geq(constants[2], constants[3])); - computedConstants[106] = pow(constants[0]/constants[1], geq(constants[2], constants[3])); - computedConstants[107] = pow(leq(constants[0], constants[1]), constants[2]+constants[3]); - computedConstants[108] = pow(leq(constants[0], constants[1]), constants[2]); - computedConstants[109] = pow(leq(constants[0], constants[1]), constants[2]-constants[3]); - computedConstants[110] = pow(leq(constants[0], constants[1]), -constants[2]); - computedConstants[111] = pow(leq(constants[0], constants[1]), constants[2]*constants[3]); - computedConstants[112] = pow(leq(constants[0], constants[1]), constants[2]/constants[3]); - computedConstants[113] = pow(leq(constants[0], constants[1]), pow(constants[2], constants[3])); - computedConstants[114] = pow(leq(constants[0], constants[1]), pow(constants[2], 1.0/constants[3])); + computedConstants[61] = constants[0]+constants[1]+constants[2]; + computedConstants[62] = lt(constants[0], constants[1])+gt(constants[2], constants[3]); + computedConstants[63] = constants[0]; + computedConstants[64] = constants[0]-constants[1]; + computedConstants[65] = lt(constants[0], constants[1])-gt(constants[2], constants[3]); + computedConstants[66] = lt(constants[0], constants[1])-(constants[2]+constants[3]); + computedConstants[67] = lt(constants[0], constants[1])-constants[2]; + computedConstants[68] = constants[0]-(-constants[1]); + computedConstants[69] = constants[0]-(-constants[1]*constants[2]); + computedConstants[70] = -constants[0]; + computedConstants[71] = -lt(constants[0], constants[1]); + computedConstants[72] = constants[0]*constants[1]; + computedConstants[73] = constants[0]*constants[1]*constants[2]; + computedConstants[74] = lt(constants[0], constants[1])*gt(constants[2], constants[3]); + computedConstants[75] = (constants[0]+constants[1])*gt(constants[2], constants[3]); + computedConstants[76] = constants[0]*gt(constants[1], constants[2]); + computedConstants[77] = (constants[0]-constants[1])*gt(constants[2], constants[3]); + computedConstants[78] = -constants[0]*gt(constants[1], constants[2]); + computedConstants[79] = lt(constants[0], constants[1])*(constants[2]+constants[3]); + computedConstants[80] = lt(constants[0], constants[1])*constants[2]; + computedConstants[81] = lt(constants[0], constants[1])*(constants[2]-constants[3]); + computedConstants[82] = lt(constants[0], constants[1])*-constants[2]; + computedConstants[83] = constants[0]/constants[1]; + computedConstants[84] = lt(constants[0], constants[1])/gt(constants[3], constants[2]); + computedConstants[85] = (constants[0]+constants[1])/gt(constants[3], constants[2]); + computedConstants[86] = constants[0]/gt(constants[2], constants[1]); + computedConstants[87] = (constants[0]-constants[1])/gt(constants[3], constants[2]); + computedConstants[88] = -constants[0]/gt(constants[2], constants[1]); + computedConstants[89] = lt(constants[0], constants[1])/(constants[2]+constants[3]); + computedConstants[90] = lt(constants[0], constants[1])/constants[2]; + computedConstants[91] = lt(constants[0], constants[1])/(constants[2]-constants[3]); + computedConstants[92] = lt(constants[0], constants[1])/-constants[2]; + computedConstants[93] = lt(constants[0], constants[1])/(constants[2]*constants[3]); + computedConstants[94] = lt(constants[0], constants[1])/(constants[2]/constants[3]); + computedConstants[95] = sqrt(constants[0]); + computedConstants[96] = pow(constants[0], 2.0); + computedConstants[97] = pow(constants[0], 3.0); + computedConstants[98] = pow(constants[0], constants[1]); + computedConstants[99] = pow(leq(constants[0], constants[1]), geq(constants[2], constants[3])); + computedConstants[100] = pow(constants[0]+constants[1], geq(constants[2], constants[3])); + computedConstants[101] = pow(constants[0], geq(constants[1], constants[2])); + computedConstants[102] = pow(constants[0]-constants[1], geq(constants[2], constants[3])); + computedConstants[103] = pow(-constants[0], geq(constants[1], constants[2])); + computedConstants[104] = pow(constants[0]*constants[1], geq(constants[2], constants[3])); + computedConstants[105] = pow(constants[0]/constants[1], geq(constants[2], constants[3])); + computedConstants[106] = pow(leq(constants[0], constants[1]), constants[2]+constants[3]); + computedConstants[107] = pow(leq(constants[0], constants[1]), constants[2]); + computedConstants[108] = pow(leq(constants[0], constants[1]), constants[2]-constants[3]); + computedConstants[109] = pow(leq(constants[0], constants[1]), -constants[2]); + computedConstants[110] = pow(leq(constants[0], constants[1]), constants[2]*constants[3]); + computedConstants[111] = pow(leq(constants[0], constants[1]), constants[2]/constants[3]); + computedConstants[112] = pow(leq(constants[0], constants[1]), pow(constants[2], constants[3])); + computedConstants[113] = pow(leq(constants[0], constants[1]), pow(constants[2], 1.0/constants[3])); + computedConstants[114] = sqrt(constants[0]); computedConstants[115] = sqrt(constants[0]); - computedConstants[116] = sqrt(constants[0]); - computedConstants[117] = pow(constants[0], 1.0/3.0); - computedConstants[118] = pow(constants[0], 1.0/constants[1]); - computedConstants[119] = pow(lt(constants[0], constants[1]), 1.0/gt(constants[3], constants[2])); - computedConstants[120] = pow(constants[0]+constants[1], 1.0/gt(constants[3], constants[2])); - computedConstants[121] = pow(constants[0], 1.0/gt(constants[2], constants[1])); - computedConstants[122] = pow(constants[0]-constants[1], 1.0/gt(constants[3], constants[2])); - computedConstants[123] = pow(-constants[0], 1.0/gt(constants[2], constants[1])); - computedConstants[124] = pow(constants[0]*constants[1], 1.0/gt(constants[3], constants[2])); - computedConstants[125] = pow(constants[0]/constants[1], 1.0/gt(constants[3], constants[2])); - computedConstants[126] = pow(lt(constants[0], constants[1]), 1.0/(constants[2]+constants[3])); - computedConstants[127] = pow(lt(constants[0], constants[1]), 1.0/constants[2]); - computedConstants[128] = pow(lt(constants[0], constants[1]), 1.0/(constants[2]-constants[3])); - computedConstants[129] = pow(lt(constants[0], constants[1]), 1.0/-constants[2]); - computedConstants[130] = pow(lt(constants[0], constants[1]), 1.0/(constants[2]*constants[3])); - computedConstants[131] = pow(lt(constants[0], constants[1]), 1.0/(constants[2]/constants[3])); - computedConstants[132] = pow(lt(constants[0], constants[1]), 1.0/pow(constants[2], constants[3])); - computedConstants[133] = pow(lt(constants[0], constants[1]), 1.0/pow(constants[2], 1.0/constants[3])); - computedConstants[134] = fabs(constants[0]); - computedConstants[135] = exp(constants[0]); - computedConstants[136] = log(constants[0]); - computedConstants[137] = log10(constants[0]); - computedConstants[138] = log(constants[0])/log(2.0); - computedConstants[139] = log10(constants[0]); - computedConstants[140] = log(constants[0])/log(constants[1]); - computedConstants[141] = ceil(constants[0]); - computedConstants[142] = floor(constants[0]); - computedConstants[143] = min(constants[0], constants[1]); - computedConstants[144] = min(constants[0], min(constants[1], constants[2])); - computedConstants[145] = max(constants[0], constants[1]); - computedConstants[146] = max(constants[0], max(constants[1], constants[2])); - computedConstants[147] = fmod(constants[0], constants[1]); - computedConstants[148] = sin(constants[0]); - computedConstants[149] = cos(constants[0]); - computedConstants[150] = tan(constants[0]); - computedConstants[151] = sec(constants[0]); - computedConstants[152] = csc(constants[0]); - computedConstants[153] = cot(constants[0]); - computedConstants[154] = sinh(constants[0]); - computedConstants[155] = cosh(constants[0]); - computedConstants[156] = tanh(constants[0]); - computedConstants[157] = sech(constants[0]); - computedConstants[158] = csch(constants[0]); - computedConstants[159] = coth(constants[0]); - computedConstants[160] = asin(constants[0]); - computedConstants[161] = acos(constants[0]); - computedConstants[162] = atan(constants[0]); - computedConstants[163] = asec(constants[0]); - computedConstants[164] = acsc(constants[0]); - computedConstants[165] = acot(constants[0]); - computedConstants[166] = asinh(constants[0]); - computedConstants[167] = acosh(constants[0]); - computedConstants[168] = atanh(constants[0]/2.0); - computedConstants[169] = asech(constants[0]); - computedConstants[170] = acsch(constants[0]); - computedConstants[171] = acoth(2.0*constants[0]); - computedConstants[172] = (gt(constants[0], constants[1]))?constants[0]:NAN; - computedConstants[173] = (gt(constants[0], constants[1]))?constants[0]:constants[2]; - computedConstants[174] = (gt(constants[0], constants[1]))?constants[0]:(gt(constants[2], constants[3]))?constants[2]:(gt(constants[4], constants[5]))?constants[4]:NAN; - computedConstants[175] = (gt(constants[0], constants[1]))?constants[0]:(gt(constants[2], constants[3]))?constants[2]:(gt(constants[4], constants[5]))?constants[4]:constants[6]; - computedConstants[176] = 123.0+((gt(constants[0], constants[1]))?constants[0]:NAN); - computedConstants[181] = constants[0]; - computedConstants[188] = and(constants[0], constants[1])+((gt(constants[2], constants[3]))?constants[1]:NAN)+constants[4]+and(constants[5], constants[6]); - computedConstants[189] = and(constants[0], constants[1])-(((gt(constants[2], constants[3]))?constants[1]:NAN)-(constants[4]-((gt(constants[2], constants[3]))?constants[1]:NAN)))-and(constants[5], constants[6]); - computedConstants[190] = and(constants[0], constants[1])*((gt(constants[2], constants[3]))?constants[1]:NAN)*constants[4]*((gt(constants[2], constants[3]))?constants[1]:NAN)*and(constants[5], constants[6]); - computedConstants[191] = and(constants[0], constants[1])/(((gt(constants[2], constants[3]))?constants[1]:NAN)/(constants[4]/((gt(constants[2], constants[3]))?constants[1]:NAN))); - computedConstants[192] = and(or(constants[0], constants[1]), and(xor(constants[0], constants[1]), and((gt(constants[2], constants[3]))?constants[1]:NAN, and(and(and(constants[4], (gt(constants[2], constants[3]))?constants[1]:NAN), xor(constants[0], constants[1])), or(constants[0], constants[1]))))); - computedConstants[193] = or(and(constants[0], constants[1]), or(xor(constants[0], constants[1]), or((gt(constants[2], constants[3]))?constants[1]:NAN, or(or(or(constants[4], (gt(constants[2], constants[3]))?constants[1]:NAN), xor(constants[0], constants[1])), and(constants[0], constants[1]))))); - computedConstants[194] = xor(and(constants[0], constants[1]), xor(or(constants[0], constants[1]), xor((gt(constants[2], constants[3]))?constants[1]:NAN, xor(xor(xor(constants[4], (gt(constants[2], constants[3]))?constants[1]:NAN), or(constants[0], constants[1])), and(constants[0], constants[1]))))); - computedConstants[195] = pow(and(constants[0], constants[1]), pow((gt(constants[2], constants[3]))?constants[1]:NAN, pow(pow(constants[4], (gt(constants[2], constants[3]))?constants[1]:NAN), and(constants[0], constants[1])))); - computedConstants[196] = pow(pow(pow(and(constants[0], constants[1]), 1.0/pow((gt(constants[2], constants[3]))?constants[1]:NAN, 1.0/constants[4])), 1.0/((gt(constants[2], constants[3]))?constants[1]:NAN)), 1.0/and(constants[0], constants[1])); - computedConstants[197] = -and(constants[0], constants[1])+-((gt(constants[2], constants[3]))?constants[1]:NAN); + computedConstants[116] = pow(constants[0], 1.0/3.0); + computedConstants[117] = pow(constants[0], 1.0/constants[1]); + computedConstants[118] = pow(lt(constants[0], constants[1]), 1.0/gt(constants[3], constants[2])); + computedConstants[119] = pow(constants[0]+constants[1], 1.0/gt(constants[3], constants[2])); + computedConstants[120] = pow(constants[0], 1.0/gt(constants[2], constants[1])); + computedConstants[121] = pow(constants[0]-constants[1], 1.0/gt(constants[3], constants[2])); + computedConstants[122] = pow(-constants[0], 1.0/gt(constants[2], constants[1])); + computedConstants[123] = pow(constants[0]*constants[1], 1.0/gt(constants[3], constants[2])); + computedConstants[124] = pow(constants[0]/constants[1], 1.0/gt(constants[3], constants[2])); + computedConstants[125] = pow(lt(constants[0], constants[1]), 1.0/(constants[2]+constants[3])); + computedConstants[126] = pow(lt(constants[0], constants[1]), 1.0/constants[2]); + computedConstants[127] = pow(lt(constants[0], constants[1]), 1.0/(constants[2]-constants[3])); + computedConstants[128] = pow(lt(constants[0], constants[1]), 1.0/-constants[2]); + computedConstants[129] = pow(lt(constants[0], constants[1]), 1.0/(constants[2]*constants[3])); + computedConstants[130] = pow(lt(constants[0], constants[1]), 1.0/(constants[2]/constants[3])); + computedConstants[131] = pow(lt(constants[0], constants[1]), 1.0/pow(constants[2], constants[3])); + computedConstants[132] = pow(lt(constants[0], constants[1]), 1.0/pow(constants[2], 1.0/constants[3])); + computedConstants[133] = fabs(constants[0]); + computedConstants[134] = exp(constants[0]); + computedConstants[135] = log(constants[0]); + computedConstants[136] = log10(constants[0]); + computedConstants[137] = log(constants[0])/log(2.0); + computedConstants[138] = log10(constants[0]); + computedConstants[139] = log(constants[0])/log(constants[1]); + computedConstants[140] = ceil(constants[0]); + computedConstants[141] = floor(constants[0]); + computedConstants[142] = min(constants[0], constants[1]); + computedConstants[143] = min(constants[0], min(constants[1], constants[2])); + computedConstants[144] = max(constants[0], constants[1]); + computedConstants[145] = max(constants[0], max(constants[1], constants[2])); + computedConstants[146] = fmod(constants[0], constants[1]); + computedConstants[147] = sin(constants[0]); + computedConstants[148] = cos(constants[0]); + computedConstants[149] = tan(constants[0]); + computedConstants[150] = sec(constants[0]); + computedConstants[151] = csc(constants[0]); + computedConstants[152] = cot(constants[0]); + computedConstants[153] = sinh(constants[0]); + computedConstants[154] = cosh(constants[0]); + computedConstants[155] = tanh(constants[0]); + computedConstants[156] = sech(constants[0]); + computedConstants[157] = csch(constants[0]); + computedConstants[158] = coth(constants[0]); + computedConstants[159] = asin(constants[0]); + computedConstants[160] = acos(constants[0]); + computedConstants[161] = atan(constants[0]); + computedConstants[162] = asec(constants[0]); + computedConstants[163] = acsc(constants[0]); + computedConstants[164] = acot(constants[0]); + computedConstants[165] = asinh(constants[0]); + computedConstants[166] = acosh(constants[0]); + computedConstants[167] = atanh(constants[0]/2.0); + computedConstants[168] = asech(constants[0]); + computedConstants[169] = acsch(constants[0]); + computedConstants[170] = acoth(2.0*constants[0]); + computedConstants[171] = (gt(constants[0], constants[1]))?constants[0]:NAN; + computedConstants[172] = (gt(constants[0], constants[1]))?constants[0]:constants[2]; + computedConstants[173] = (gt(constants[0], constants[1]))?constants[0]:(gt(constants[2], constants[3]))?constants[2]:(gt(constants[4], constants[5]))?constants[4]:NAN; + computedConstants[174] = (gt(constants[0], constants[1]))?constants[0]:(gt(constants[2], constants[3]))?constants[2]:(gt(constants[4], constants[5]))?constants[4]:constants[6]; + computedConstants[175] = 123.0+((gt(constants[0], constants[1]))?constants[0]:NAN); + computedConstants[180] = constants[0]; + computedConstants[187] = and(constants[0], constants[1])+((gt(constants[2], constants[3]))?constants[1]:NAN)+constants[4]+and(constants[5], constants[6]); + computedConstants[188] = and(constants[0], constants[1])-(((gt(constants[2], constants[3]))?constants[1]:NAN)-(constants[4]-((gt(constants[2], constants[3]))?constants[1]:NAN)))-and(constants[5], constants[6]); + computedConstants[189] = and(constants[0], constants[1])*((gt(constants[2], constants[3]))?constants[1]:NAN)*constants[4]*((gt(constants[2], constants[3]))?constants[1]:NAN)*and(constants[5], constants[6]); + computedConstants[190] = and(constants[0], constants[1])/(((gt(constants[2], constants[3]))?constants[1]:NAN)/(constants[4]/((gt(constants[2], constants[3]))?constants[1]:NAN))); + computedConstants[191] = and(or(constants[0], constants[1]), and(xor(constants[0], constants[1]), and((gt(constants[2], constants[3]))?constants[1]:NAN, and(and(and(constants[4], (gt(constants[2], constants[3]))?constants[1]:NAN), xor(constants[0], constants[1])), or(constants[0], constants[1]))))); + computedConstants[192] = or(and(constants[0], constants[1]), or(xor(constants[0], constants[1]), or((gt(constants[2], constants[3]))?constants[1]:NAN, or(or(or(constants[4], (gt(constants[2], constants[3]))?constants[1]:NAN), xor(constants[0], constants[1])), and(constants[0], constants[1]))))); + computedConstants[193] = xor(and(constants[0], constants[1]), xor(or(constants[0], constants[1]), xor((gt(constants[2], constants[3]))?constants[1]:NAN, xor(xor(xor(constants[4], (gt(constants[2], constants[3]))?constants[1]:NAN), or(constants[0], constants[1])), and(constants[0], constants[1]))))); + computedConstants[194] = pow(and(constants[0], constants[1]), pow((gt(constants[2], constants[3]))?constants[1]:NAN, pow(pow(constants[4], (gt(constants[2], constants[3]))?constants[1]:NAN), and(constants[0], constants[1])))); + computedConstants[195] = pow(pow(pow(and(constants[0], constants[1]), 1.0/pow((gt(constants[2], constants[3]))?constants[1]:NAN, 1.0/constants[4])), 1.0/((gt(constants[2], constants[3]))?constants[1]:NAN)), 1.0/and(constants[0], constants[1])); + computedConstants[196] = -and(constants[0], constants[1])+-((gt(constants[2], constants[3]))?constants[1]:NAN); } -void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) +void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, double *externals, ExternalVariable externalVariable) { rates[0] = 1.0; } -void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) +void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, double *externals, ExternalVariable externalVariable) { + externals[0] = externalVariable(voi, states, rates, constants, computedConstants, algebraic, externals, 0); findRoot0(voi, states, rates, constants, computedConstants, algebraic); } diff --git a/tests/resources/coverage/generator/model.interface.out b/tests/resources/coverage/generator/model.interface.out index a5fb080356..db42dd2a75 100644 --- a/tests/resources/coverage/generator/model.interface.out +++ b/tests/resources/coverage/generator/model.interface.out @@ -8,10 +8,13 @@ double * createStatesArray(); double * createConstantsArray(); double * createComputedConstantsArray(); double * createAlgebraicArray(); +double * createExternalsArray(); void deleteArray(double *array); +typedef double (* ExternalVariable)(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, double *externals, size_t index); + void initialiseVariables(double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); -void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); -void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); +void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, double *externals, ExternalVariable externalVariable); +void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, double *externals, ExternalVariable externalVariable); diff --git a/tests/resources/coverage/generator/model.modified.profile.c b/tests/resources/coverage/generator/model.modified.profile.c index 5c6e1d9fd6..a539d57047 100644 --- a/tests/resources/coverage/generator/model.modified.profile.c +++ b/tests/resources/coverage/generator/model.modified.profile.c @@ -10,8 +10,9 @@ const char LIBCELLML_VERSION[] = "0.5.0"; const size_t STATE_COUNT = 1; const size_t CONSTANT_COUNT = 7; -const size_t COMPUTED_CONSTANT_COUNT = 200; +const size_t COMPUTED_CONSTANT_COUNT = 199; const size_t ALGEBRAIC_COUNT = 2; +const size_t EXTERNAL_COUNT = 1; const VariableInfo VOI_INFO = {"t", "second", "my_component"}; @@ -91,7 +92,6 @@ const VariableInfo COMPUTED_CONSTANT_INFO[] = { {"eqnXorParenthesesRightRoot", "dimensionless", "my_component"}, {"eqnXorCoverageParentheses", "dimensionless", "my_component"}, {"eqnNot", "dimensionless", "my_component"}, - {"eqnPlus", "dimensionless", "my_component"}, {"eqnPlusMultiple", "dimensionless", "my_component"}, {"eqnPlusParentheses", "dimensionless", "my_component"}, {"eqnPlusUnary", "dimensionless", "my_component"}, @@ -237,6 +237,10 @@ const VariableInfo ALGEBRAIC_INFO[] = { {"eqnNlaVariable2", "dimensionless", "my_component"} }; +const VariableInfo EXTERNAL_INFO[] = { + {"eqnPlus", "dimensionless", "my_component"} +}; + double xor(double x, double y) { return (x != 0.0) ^ (y != 0.0); @@ -362,6 +366,17 @@ double * createAlgebraicArray() return res; } +double * createExternalsArray() +{ + double *res = (double *) malloc(EXTERNAL_COUNT*sizeof(double)); + + for (size_t i = 0; i < EXTERNAL_COUNT; ++i) { + res[i] = NAN; + } + + return res; +} + void deleteArray(double *array) { free(array); @@ -374,6 +389,7 @@ typedef struct { double *constants; double *computedConstants; double *algebraic; + double *externals; } RootFindingInfo; extern void nlaSolve(void (*objectiveFunction)(double *, double *, void *), @@ -392,7 +408,7 @@ void objectiveFunction0(double *u, double *f, void *data) algebraic[1] = u[1]; f[0] = algebraic[0]+algebraic[1]+states[0]-0.0; - f[1] = algebraic[0]-algebraic[1]-(computedConstants[198]+computedConstants[199]); + f[1] = algebraic[0]-algebraic[1]-(computedConstants[197]+computedConstants[198]); } void findRoot0(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) @@ -419,18 +435,18 @@ void initialiseVariables(double *states, double *rates, double *constants, doubl constants[4] = 5.0; constants[5] = 6.0; constants[6] = 7.0; - computedConstants[177] = 123.0; - computedConstants[178] = 123.456789; - computedConstants[179] = 123.0e99; - computedConstants[180] = 123.456789e99; - computedConstants[182] = 1.0; - computedConstants[183] = 0.0; - computedConstants[184] = 2.71828182845905; - computedConstants[185] = 3.14159265358979; - computedConstants[186] = INFINITY; - computedConstants[187] = NAN; - computedConstants[198] = 1.0; - computedConstants[199] = 3.0; + computedConstants[176] = 123.0; + computedConstants[177] = 123.456789; + computedConstants[178] = 123.0e99; + computedConstants[179] = 123.456789e99; + computedConstants[181] = 1.0; + computedConstants[182] = 0.0; + computedConstants[183] = 2.71828182845905; + computedConstants[184] = 3.14159265358979; + computedConstants[185] = INFINITY; + computedConstants[186] = NAN; + computedConstants[197] = 1.0; + computedConstants[198] = 3.0; algebraic[0] = 1.0; algebraic[1] = 2.0; } @@ -498,141 +514,141 @@ void computeComputedConstants(double *constants, double *computedConstants) computedConstants[58] = xor(constants[0] < constants[1], pow(constants[2], 1.0/constants[3])); computedConstants[59] = constants[0]/xor(constants[1], constants[2]); computedConstants[60] = !constants[0]; - computedConstants[61] = constants[0]+constants[1]; - computedConstants[62] = constants[0]+constants[1]+constants[2]; - computedConstants[63] = (constants[0] < constants[1])+(constants[2] > constants[3]); - computedConstants[64] = constants[0]; - computedConstants[65] = constants[0]-constants[1]; - computedConstants[66] = (constants[0] < constants[1])-(constants[2] > constants[3]); - computedConstants[67] = (constants[0] < constants[1])-(constants[2]+constants[3]); - computedConstants[68] = (constants[0] < constants[1])-constants[2]; - computedConstants[69] = constants[0]-(-constants[1]); - computedConstants[70] = constants[0]-(-constants[1]*constants[2]); - computedConstants[71] = -constants[0]; - computedConstants[72] = -(constants[0] < constants[1]); - computedConstants[73] = constants[0]*constants[1]; - computedConstants[74] = constants[0]*constants[1]*constants[2]; - computedConstants[75] = (constants[0] < constants[1])*(constants[2] > constants[3]); - computedConstants[76] = (constants[0]+constants[1])*(constants[2] > constants[3]); - computedConstants[77] = constants[0]*(constants[1] > constants[2]); - computedConstants[78] = (constants[0]-constants[1])*(constants[2] > constants[3]); - computedConstants[79] = -constants[0]*(constants[1] > constants[2]); - computedConstants[80] = (constants[0] < constants[1])*(constants[2]+constants[3]); - computedConstants[81] = (constants[0] < constants[1])*constants[2]; - computedConstants[82] = (constants[0] < constants[1])*(constants[2]-constants[3]); - computedConstants[83] = (constants[0] < constants[1])*-constants[2]; - computedConstants[84] = constants[0]/constants[1]; - computedConstants[85] = (constants[0] < constants[1])/(constants[3] > constants[2]); - computedConstants[86] = (constants[0]+constants[1])/(constants[3] > constants[2]); - computedConstants[87] = constants[0]/(constants[2] > constants[1]); - computedConstants[88] = (constants[0]-constants[1])/(constants[3] > constants[2]); - computedConstants[89] = -constants[0]/(constants[2] > constants[1]); - computedConstants[90] = (constants[0] < constants[1])/(constants[2]+constants[3]); - computedConstants[91] = (constants[0] < constants[1])/constants[2]; - computedConstants[92] = (constants[0] < constants[1])/(constants[2]-constants[3]); - computedConstants[93] = (constants[0] < constants[1])/-constants[2]; - computedConstants[94] = (constants[0] < constants[1])/(constants[2]*constants[3]); - computedConstants[95] = (constants[0] < constants[1])/(constants[2]/constants[3]); - computedConstants[96] = sqrt(constants[0]); - computedConstants[97] = pow(constants[0], 2.0); - computedConstants[98] = pow(constants[0], 3.0); - computedConstants[99] = pow(constants[0], constants[1]); - computedConstants[100] = pow(constants[0] <= constants[1], constants[2] >= constants[3]); - computedConstants[101] = pow(constants[0]+constants[1], constants[2] >= constants[3]); - computedConstants[102] = pow(constants[0], constants[1] >= constants[2]); - computedConstants[103] = pow(constants[0]-constants[1], constants[2] >= constants[3]); - computedConstants[104] = pow(-constants[0], constants[1] >= constants[2]); - computedConstants[105] = pow(constants[0]*constants[1], constants[2] >= constants[3]); - computedConstants[106] = pow(constants[0]/constants[1], constants[2] >= constants[3]); - computedConstants[107] = pow(constants[0] <= constants[1], constants[2]+constants[3]); - computedConstants[108] = pow(constants[0] <= constants[1], constants[2]); - computedConstants[109] = pow(constants[0] <= constants[1], constants[2]-constants[3]); - computedConstants[110] = pow(constants[0] <= constants[1], -constants[2]); - computedConstants[111] = pow(constants[0] <= constants[1], constants[2]*constants[3]); - computedConstants[112] = pow(constants[0] <= constants[1], constants[2]/constants[3]); - computedConstants[113] = pow(constants[0] <= constants[1], pow(constants[2], constants[3])); - computedConstants[114] = pow(constants[0] <= constants[1], pow(constants[2], 1.0/constants[3])); + computedConstants[61] = constants[0]+constants[1]+constants[2]; + computedConstants[62] = (constants[0] < constants[1])+(constants[2] > constants[3]); + computedConstants[63] = constants[0]; + computedConstants[64] = constants[0]-constants[1]; + computedConstants[65] = (constants[0] < constants[1])-(constants[2] > constants[3]); + computedConstants[66] = (constants[0] < constants[1])-(constants[2]+constants[3]); + computedConstants[67] = (constants[0] < constants[1])-constants[2]; + computedConstants[68] = constants[0]-(-constants[1]); + computedConstants[69] = constants[0]-(-constants[1]*constants[2]); + computedConstants[70] = -constants[0]; + computedConstants[71] = -(constants[0] < constants[1]); + computedConstants[72] = constants[0]*constants[1]; + computedConstants[73] = constants[0]*constants[1]*constants[2]; + computedConstants[74] = (constants[0] < constants[1])*(constants[2] > constants[3]); + computedConstants[75] = (constants[0]+constants[1])*(constants[2] > constants[3]); + computedConstants[76] = constants[0]*(constants[1] > constants[2]); + computedConstants[77] = (constants[0]-constants[1])*(constants[2] > constants[3]); + computedConstants[78] = -constants[0]*(constants[1] > constants[2]); + computedConstants[79] = (constants[0] < constants[1])*(constants[2]+constants[3]); + computedConstants[80] = (constants[0] < constants[1])*constants[2]; + computedConstants[81] = (constants[0] < constants[1])*(constants[2]-constants[3]); + computedConstants[82] = (constants[0] < constants[1])*-constants[2]; + computedConstants[83] = constants[0]/constants[1]; + computedConstants[84] = (constants[0] < constants[1])/(constants[3] > constants[2]); + computedConstants[85] = (constants[0]+constants[1])/(constants[3] > constants[2]); + computedConstants[86] = constants[0]/(constants[2] > constants[1]); + computedConstants[87] = (constants[0]-constants[1])/(constants[3] > constants[2]); + computedConstants[88] = -constants[0]/(constants[2] > constants[1]); + computedConstants[89] = (constants[0] < constants[1])/(constants[2]+constants[3]); + computedConstants[90] = (constants[0] < constants[1])/constants[2]; + computedConstants[91] = (constants[0] < constants[1])/(constants[2]-constants[3]); + computedConstants[92] = (constants[0] < constants[1])/-constants[2]; + computedConstants[93] = (constants[0] < constants[1])/(constants[2]*constants[3]); + computedConstants[94] = (constants[0] < constants[1])/(constants[2]/constants[3]); + computedConstants[95] = sqrt(constants[0]); + computedConstants[96] = pow(constants[0], 2.0); + computedConstants[97] = pow(constants[0], 3.0); + computedConstants[98] = pow(constants[0], constants[1]); + computedConstants[99] = pow(constants[0] <= constants[1], constants[2] >= constants[3]); + computedConstants[100] = pow(constants[0]+constants[1], constants[2] >= constants[3]); + computedConstants[101] = pow(constants[0], constants[1] >= constants[2]); + computedConstants[102] = pow(constants[0]-constants[1], constants[2] >= constants[3]); + computedConstants[103] = pow(-constants[0], constants[1] >= constants[2]); + computedConstants[104] = pow(constants[0]*constants[1], constants[2] >= constants[3]); + computedConstants[105] = pow(constants[0]/constants[1], constants[2] >= constants[3]); + computedConstants[106] = pow(constants[0] <= constants[1], constants[2]+constants[3]); + computedConstants[107] = pow(constants[0] <= constants[1], constants[2]); + computedConstants[108] = pow(constants[0] <= constants[1], constants[2]-constants[3]); + computedConstants[109] = pow(constants[0] <= constants[1], -constants[2]); + computedConstants[110] = pow(constants[0] <= constants[1], constants[2]*constants[3]); + computedConstants[111] = pow(constants[0] <= constants[1], constants[2]/constants[3]); + computedConstants[112] = pow(constants[0] <= constants[1], pow(constants[2], constants[3])); + computedConstants[113] = pow(constants[0] <= constants[1], pow(constants[2], 1.0/constants[3])); + computedConstants[114] = sqrt(constants[0]); computedConstants[115] = sqrt(constants[0]); - computedConstants[116] = sqrt(constants[0]); - computedConstants[117] = pow(constants[0], 1.0/3.0); - computedConstants[118] = pow(constants[0], 1.0/constants[1]); - computedConstants[119] = pow(constants[0] < constants[1], 1.0/(constants[3] > constants[2])); - computedConstants[120] = pow(constants[0]+constants[1], 1.0/(constants[3] > constants[2])); - computedConstants[121] = pow(constants[0], 1.0/(constants[2] > constants[1])); - computedConstants[122] = pow(constants[0]-constants[1], 1.0/(constants[3] > constants[2])); - computedConstants[123] = pow(-constants[0], 1.0/(constants[2] > constants[1])); - computedConstants[124] = pow(constants[0]*constants[1], 1.0/(constants[3] > constants[2])); - computedConstants[125] = pow(constants[0]/constants[1], 1.0/(constants[3] > constants[2])); - computedConstants[126] = pow(constants[0] < constants[1], 1.0/(constants[2]+constants[3])); - computedConstants[127] = pow(constants[0] < constants[1], 1.0/constants[2]); - computedConstants[128] = pow(constants[0] < constants[1], 1.0/(constants[2]-constants[3])); - computedConstants[129] = pow(constants[0] < constants[1], 1.0/-constants[2]); - computedConstants[130] = pow(constants[0] < constants[1], 1.0/(constants[2]*constants[3])); - computedConstants[131] = pow(constants[0] < constants[1], 1.0/(constants[2]/constants[3])); - computedConstants[132] = pow(constants[0] < constants[1], 1.0/pow(constants[2], constants[3])); - computedConstants[133] = pow(constants[0] < constants[1], 1.0/pow(constants[2], 1.0/constants[3])); - computedConstants[134] = fabs(constants[0]); - computedConstants[135] = exp(constants[0]); - computedConstants[136] = log(constants[0]); - computedConstants[137] = log10(constants[0]); - computedConstants[138] = log(constants[0])/log(2.0); - computedConstants[139] = log10(constants[0]); - computedConstants[140] = log(constants[0])/log(constants[1]); - computedConstants[141] = ceil(constants[0]); - computedConstants[142] = floor(constants[0]); - computedConstants[143] = min(constants[0], constants[1]); - computedConstants[144] = min(constants[0], min(constants[1], constants[2])); - computedConstants[145] = max(constants[0], constants[1]); - computedConstants[146] = max(constants[0], max(constants[1], constants[2])); - computedConstants[147] = fmod(constants[0], constants[1]); - computedConstants[148] = sin(constants[0]); - computedConstants[149] = cos(constants[0]); - computedConstants[150] = tan(constants[0]); - computedConstants[151] = sec(constants[0]); - computedConstants[152] = csc(constants[0]); - computedConstants[153] = cot(constants[0]); - computedConstants[154] = sinh(constants[0]); - computedConstants[155] = cosh(constants[0]); - computedConstants[156] = tanh(constants[0]); - computedConstants[157] = sech(constants[0]); - computedConstants[158] = csch(constants[0]); - computedConstants[159] = coth(constants[0]); - computedConstants[160] = asin(constants[0]); - computedConstants[161] = acos(constants[0]); - computedConstants[162] = atan(constants[0]); - computedConstants[163] = asec(constants[0]); - computedConstants[164] = acsc(constants[0]); - computedConstants[165] = acot(constants[0]); - computedConstants[166] = asinh(constants[0]); - computedConstants[167] = acosh(constants[0]); - computedConstants[168] = atanh(constants[0]/2.0); - computedConstants[169] = asech(constants[0]); - computedConstants[170] = acsch(constants[0]); - computedConstants[171] = acoth(2.0*constants[0]); - computedConstants[172] = (constants[0] > constants[1])?constants[0]:NAN; - computedConstants[173] = (constants[0] > constants[1])?constants[0]:constants[2]; - computedConstants[174] = (constants[0] > constants[1])?constants[0]:(constants[2] > constants[3])?constants[2]:(constants[4] > constants[5])?constants[4]:NAN; - computedConstants[175] = (constants[0] > constants[1])?constants[0]:(constants[2] > constants[3])?constants[2]:(constants[4] > constants[5])?constants[4]:constants[6]; - computedConstants[176] = 123.0+((constants[0] > constants[1])?constants[0]:NAN); - computedConstants[181] = constants[0]; - computedConstants[188] = (constants[0] && constants[1])+((constants[2] > constants[3])?constants[1]:NAN)+constants[4]+(constants[5] && constants[6]); - computedConstants[189] = (constants[0] && constants[1])-(((constants[2] > constants[3])?constants[1]:NAN)-(constants[4]-((constants[2] > constants[3])?constants[1]:NAN)))-(constants[5] && constants[6]); - computedConstants[190] = (constants[0] && constants[1])*((constants[2] > constants[3])?constants[1]:NAN)*constants[4]*((constants[2] > constants[3])?constants[1]:NAN)*(constants[5] && constants[6]); - computedConstants[191] = (constants[0] && constants[1])/(((constants[2] > constants[3])?constants[1]:NAN)/(constants[4]/((constants[2] > constants[3])?constants[1]:NAN))); - computedConstants[192] = (constants[0] || constants[1]) && xor(constants[0], constants[1]) && ((constants[2] > constants[3])?constants[1]:NAN) && constants[4] && ((constants[2] > constants[3])?constants[1]:NAN) && xor(constants[0], constants[1]) && (constants[0] || constants[1]); - computedConstants[193] = (constants[0] && constants[1]) || xor(constants[0], constants[1]) || ((constants[2] > constants[3])?constants[1]:NAN) || constants[4] || ((constants[2] > constants[3])?constants[1]:NAN) || xor(constants[0], constants[1]) || (constants[0] && constants[1]); - computedConstants[194] = xor(constants[0] && constants[1], xor(constants[0] || constants[1], xor((constants[2] > constants[3])?constants[1]:NAN, xor(xor(xor(constants[4], (constants[2] > constants[3])?constants[1]:NAN), constants[0] || constants[1]), constants[0] && constants[1])))); - computedConstants[195] = pow(constants[0] && constants[1], pow((constants[2] > constants[3])?constants[1]:NAN, pow(pow(constants[4], (constants[2] > constants[3])?constants[1]:NAN), constants[0] && constants[1]))); - computedConstants[196] = pow(pow(pow(constants[0] && constants[1], 1.0/pow((constants[2] > constants[3])?constants[1]:NAN, 1.0/constants[4])), 1.0/((constants[2] > constants[3])?constants[1]:NAN)), 1.0/(constants[0] && constants[1])); - computedConstants[197] = -(constants[0] && constants[1])+-((constants[2] > constants[3])?constants[1]:NAN); + computedConstants[116] = pow(constants[0], 1.0/3.0); + computedConstants[117] = pow(constants[0], 1.0/constants[1]); + computedConstants[118] = pow(constants[0] < constants[1], 1.0/(constants[3] > constants[2])); + computedConstants[119] = pow(constants[0]+constants[1], 1.0/(constants[3] > constants[2])); + computedConstants[120] = pow(constants[0], 1.0/(constants[2] > constants[1])); + computedConstants[121] = pow(constants[0]-constants[1], 1.0/(constants[3] > constants[2])); + computedConstants[122] = pow(-constants[0], 1.0/(constants[2] > constants[1])); + computedConstants[123] = pow(constants[0]*constants[1], 1.0/(constants[3] > constants[2])); + computedConstants[124] = pow(constants[0]/constants[1], 1.0/(constants[3] > constants[2])); + computedConstants[125] = pow(constants[0] < constants[1], 1.0/(constants[2]+constants[3])); + computedConstants[126] = pow(constants[0] < constants[1], 1.0/constants[2]); + computedConstants[127] = pow(constants[0] < constants[1], 1.0/(constants[2]-constants[3])); + computedConstants[128] = pow(constants[0] < constants[1], 1.0/-constants[2]); + computedConstants[129] = pow(constants[0] < constants[1], 1.0/(constants[2]*constants[3])); + computedConstants[130] = pow(constants[0] < constants[1], 1.0/(constants[2]/constants[3])); + computedConstants[131] = pow(constants[0] < constants[1], 1.0/pow(constants[2], constants[3])); + computedConstants[132] = pow(constants[0] < constants[1], 1.0/pow(constants[2], 1.0/constants[3])); + computedConstants[133] = fabs(constants[0]); + computedConstants[134] = exp(constants[0]); + computedConstants[135] = log(constants[0]); + computedConstants[136] = log10(constants[0]); + computedConstants[137] = log(constants[0])/log(2.0); + computedConstants[138] = log10(constants[0]); + computedConstants[139] = log(constants[0])/log(constants[1]); + computedConstants[140] = ceil(constants[0]); + computedConstants[141] = floor(constants[0]); + computedConstants[142] = min(constants[0], constants[1]); + computedConstants[143] = min(constants[0], min(constants[1], constants[2])); + computedConstants[144] = max(constants[0], constants[1]); + computedConstants[145] = max(constants[0], max(constants[1], constants[2])); + computedConstants[146] = fmod(constants[0], constants[1]); + computedConstants[147] = sin(constants[0]); + computedConstants[148] = cos(constants[0]); + computedConstants[149] = tan(constants[0]); + computedConstants[150] = sec(constants[0]); + computedConstants[151] = csc(constants[0]); + computedConstants[152] = cot(constants[0]); + computedConstants[153] = sinh(constants[0]); + computedConstants[154] = cosh(constants[0]); + computedConstants[155] = tanh(constants[0]); + computedConstants[156] = sech(constants[0]); + computedConstants[157] = csch(constants[0]); + computedConstants[158] = coth(constants[0]); + computedConstants[159] = asin(constants[0]); + computedConstants[160] = acos(constants[0]); + computedConstants[161] = atan(constants[0]); + computedConstants[162] = asec(constants[0]); + computedConstants[163] = acsc(constants[0]); + computedConstants[164] = acot(constants[0]); + computedConstants[165] = asinh(constants[0]); + computedConstants[166] = acosh(constants[0]); + computedConstants[167] = atanh(constants[0]/2.0); + computedConstants[168] = asech(constants[0]); + computedConstants[169] = acsch(constants[0]); + computedConstants[170] = acoth(2.0*constants[0]); + computedConstants[171] = (constants[0] > constants[1])?constants[0]:NAN; + computedConstants[172] = (constants[0] > constants[1])?constants[0]:constants[2]; + computedConstants[173] = (constants[0] > constants[1])?constants[0]:(constants[2] > constants[3])?constants[2]:(constants[4] > constants[5])?constants[4]:NAN; + computedConstants[174] = (constants[0] > constants[1])?constants[0]:(constants[2] > constants[3])?constants[2]:(constants[4] > constants[5])?constants[4]:constants[6]; + computedConstants[175] = 123.0+((constants[0] > constants[1])?constants[0]:NAN); + computedConstants[180] = constants[0]; + computedConstants[187] = (constants[0] && constants[1])+((constants[2] > constants[3])?constants[1]:NAN)+constants[4]+(constants[5] && constants[6]); + computedConstants[188] = (constants[0] && constants[1])-(((constants[2] > constants[3])?constants[1]:NAN)-(constants[4]-((constants[2] > constants[3])?constants[1]:NAN)))-(constants[5] && constants[6]); + computedConstants[189] = (constants[0] && constants[1])*((constants[2] > constants[3])?constants[1]:NAN)*constants[4]*((constants[2] > constants[3])?constants[1]:NAN)*(constants[5] && constants[6]); + computedConstants[190] = (constants[0] && constants[1])/(((constants[2] > constants[3])?constants[1]:NAN)/(constants[4]/((constants[2] > constants[3])?constants[1]:NAN))); + computedConstants[191] = (constants[0] || constants[1]) && xor(constants[0], constants[1]) && ((constants[2] > constants[3])?constants[1]:NAN) && constants[4] && ((constants[2] > constants[3])?constants[1]:NAN) && xor(constants[0], constants[1]) && (constants[0] || constants[1]); + computedConstants[192] = (constants[0] && constants[1]) || xor(constants[0], constants[1]) || ((constants[2] > constants[3])?constants[1]:NAN) || constants[4] || ((constants[2] > constants[3])?constants[1]:NAN) || xor(constants[0], constants[1]) || (constants[0] && constants[1]); + computedConstants[193] = xor(constants[0] && constants[1], xor(constants[0] || constants[1], xor((constants[2] > constants[3])?constants[1]:NAN, xor(xor(xor(constants[4], (constants[2] > constants[3])?constants[1]:NAN), constants[0] || constants[1]), constants[0] && constants[1])))); + computedConstants[194] = pow(constants[0] && constants[1], pow((constants[2] > constants[3])?constants[1]:NAN, pow(pow(constants[4], (constants[2] > constants[3])?constants[1]:NAN), constants[0] && constants[1]))); + computedConstants[195] = pow(pow(pow(constants[0] && constants[1], 1.0/pow((constants[2] > constants[3])?constants[1]:NAN, 1.0/constants[4])), 1.0/((constants[2] > constants[3])?constants[1]:NAN)), 1.0/(constants[0] && constants[1])); + computedConstants[196] = -(constants[0] && constants[1])+-((constants[2] > constants[3])?constants[1]:NAN); } -void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) +void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, double *externals, ExternalVariable externalVariable) { rates[0] = 1.0; } -void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) +void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, double *externals, ExternalVariable externalVariable) { + externals[0] = externalVariable(voi, states, rates, constants, computedConstants, algebraic, externals, 0); findRoot0(voi, states, rates, constants, computedConstants, algebraic); } diff --git a/tests/resources/coverage/generator/model.modified.profile.h b/tests/resources/coverage/generator/model.modified.profile.h index df9429751a..1f4d048d6d 100644 --- a/tests/resources/coverage/generator/model.modified.profile.h +++ b/tests/resources/coverage/generator/model.modified.profile.h @@ -11,6 +11,7 @@ extern const size_t STATE_COUNT; extern const size_t CONSTANT_COUNT; extern const size_t COMPUTED_CONSTANT_COUNT; extern const size_t ALGEBRAIC_COUNT; +extern const size_t EXTERNAL_COUNT; typedef struct { char name[38]; @@ -23,15 +24,19 @@ extern const VariableInfo STATE_INFO[]; extern const VariableInfo CONSTANT_INFO[]; extern const VariableInfo COMPUTED_CONSTANT_INFO[]; extern const VariableInfo ALGEBRAIC_INFO[]; +extern const VariableInfo EXTERNAL_INFO[]; double * createStatesVector(); double * createConstantsArray(); double * createComputedConstantsArray(); double * createAlgebraicArray(); +double * createExternalsArray(); void deleteArray(double *array); +typedef double (* ExternalVariable)(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, double *externals, size_t index); + void initialiseVariables(double *states, double *rates, double *constants, double *computedConstants, double *algebraic); void computeComputedConstants(double *constants, double *computedConstants); -void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); -void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic); +void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, double *externals, ExternalVariable externalVariable); +void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, double *externals, ExternalVariable externalVariable); diff --git a/tests/resources/coverage/generator/model.modified.profile.py b/tests/resources/coverage/generator/model.modified.profile.py index 4c224613dc..a953afffa8 100644 --- a/tests/resources/coverage/generator/model.modified.profile.py +++ b/tests/resources/coverage/generator/model.modified.profile.py @@ -9,8 +9,9 @@ STATE_COUNT = 1 CONSTANT_COUNT = 7 -COMPUTED_CONSTANT_COUNT = 200 +COMPUTED_CONSTANT_COUNT = 199 ALGEBRAIC_COUNT = 2 +EXTERNAL_COUNT = 1 VOI_INFO = {"name": "t", "units": "second", "component": "my_component"} @@ -90,7 +91,6 @@ {"name": "eqnXorParenthesesRightRoot", "units": "dimensionless", "component": "my_component"}, {"name": "eqnXorCoverageParentheses", "units": "dimensionless", "component": "my_component"}, {"name": "eqnNot", "units": "dimensionless", "component": "my_component"}, - {"name": "eqnPlus", "units": "dimensionless", "component": "my_component"}, {"name": "eqnPlusMultiple", "units": "dimensionless", "component": "my_component"}, {"name": "eqnPlusParentheses", "units": "dimensionless", "component": "my_component"}, {"name": "eqnPlusUnary", "units": "dimensionless", "component": "my_component"}, @@ -236,6 +236,10 @@ {"name": "eqnNlaVariable2", "units": "dimensionless", "component": "my_component"} ] +EXTERNAL_INFO = [ + {"name": "eqnPlus", "units": "dimensionless", "component": "my_component"} +] + def eq_func(x, y): return 1.0 if x == y else 0.0 @@ -355,6 +359,10 @@ def create_algebraic_array(): return [nan]*ALGEBRAIC_COUNT +def create_externals_array(): + return [nan]*EXTERNAL_COUNT + + from nlasolver import nla_solve @@ -370,7 +378,7 @@ def objective_function_0(u, f, data): algebraic[1] = u[1] f[0] = algebraic[0]+algebraic[1]+states[0]-0.0 - f[1] = algebraic[0]-algebraic[1]-(computed_constants[198]+computed_constants[199]) + f[1] = algebraic[0]-algebraic[1]-(computed_constants[197]+computed_constants[198]) def find_root_0(voi, states, rates, constants, computed_constants, algebraic): @@ -394,18 +402,18 @@ def initialise_variables(states, rates, constants, computed_constants, algebraic constants[4] = 5.0 constants[5] = 6.0 constants[6] = 7.0 - computed_constants[177] = 123.0 - computed_constants[178] = 123.456789 - computed_constants[179] = 123.0e99 - computed_constants[180] = 123.456789e99 - computed_constants[182] = 1.0 - computed_constants[183] = 0.0 - computed_constants[184] = 2.71828182845905 - computed_constants[185] = 3.14159265358979 - computed_constants[186] = inf - computed_constants[187] = nan - computed_constants[198] = 1.0 - computed_constants[199] = 3.0 + computed_constants[176] = 123.0 + computed_constants[177] = 123.456789 + computed_constants[178] = 123.0e99 + computed_constants[179] = 123.456789e99 + computed_constants[181] = 1.0 + computed_constants[182] = 0.0 + computed_constants[183] = 2.71828182845905 + computed_constants[184] = 3.14159265358979 + computed_constants[185] = inf + computed_constants[186] = nan + computed_constants[197] = 1.0 + computed_constants[198] = 3.0 algebraic[0] = 1.0 algebraic[1] = 2.0 @@ -472,138 +480,138 @@ def compute_computed_constants(constants, computed_constants): computed_constants[58] = xor_func(lt_func(constants[0], constants[1]), pow(constants[2], 1.0/constants[3])) computed_constants[59] = constants[0]/xor_func(constants[1], constants[2]) computed_constants[60] = not_func(constants[0]) - computed_constants[61] = constants[0]+constants[1] - computed_constants[62] = constants[0]+constants[1]+constants[2] - computed_constants[63] = lt_func(constants[0], constants[1])+gt_func(constants[2], constants[3]) - computed_constants[64] = constants[0] - computed_constants[65] = constants[0]-constants[1] - computed_constants[66] = lt_func(constants[0], constants[1])-gt_func(constants[2], constants[3]) - computed_constants[67] = lt_func(constants[0], constants[1])-(constants[2]+constants[3]) - computed_constants[68] = lt_func(constants[0], constants[1])-constants[2] - computed_constants[69] = constants[0]-(-constants[1]) - computed_constants[70] = constants[0]-(-constants[1]*constants[2]) - computed_constants[71] = -constants[0] - computed_constants[72] = -lt_func(constants[0], constants[1]) - computed_constants[73] = constants[0]*constants[1] - computed_constants[74] = constants[0]*constants[1]*constants[2] - computed_constants[75] = lt_func(constants[0], constants[1])*gt_func(constants[2], constants[3]) - computed_constants[76] = (constants[0]+constants[1])*gt_func(constants[2], constants[3]) - computed_constants[77] = constants[0]*gt_func(constants[1], constants[2]) - computed_constants[78] = (constants[0]-constants[1])*gt_func(constants[2], constants[3]) - computed_constants[79] = -constants[0]*gt_func(constants[1], constants[2]) - computed_constants[80] = lt_func(constants[0], constants[1])*(constants[2]+constants[3]) - computed_constants[81] = lt_func(constants[0], constants[1])*constants[2] - computed_constants[82] = lt_func(constants[0], constants[1])*(constants[2]-constants[3]) - computed_constants[83] = lt_func(constants[0], constants[1])*-constants[2] - computed_constants[84] = constants[0]/constants[1] - computed_constants[85] = lt_func(constants[0], constants[1])/gt_func(constants[3], constants[2]) - computed_constants[86] = (constants[0]+constants[1])/gt_func(constants[3], constants[2]) - computed_constants[87] = constants[0]/gt_func(constants[2], constants[1]) - computed_constants[88] = (constants[0]-constants[1])/gt_func(constants[3], constants[2]) - computed_constants[89] = -constants[0]/gt_func(constants[2], constants[1]) - computed_constants[90] = lt_func(constants[0], constants[1])/(constants[2]+constants[3]) - computed_constants[91] = lt_func(constants[0], constants[1])/constants[2] - computed_constants[92] = lt_func(constants[0], constants[1])/(constants[2]-constants[3]) - computed_constants[93] = lt_func(constants[0], constants[1])/-constants[2] - computed_constants[94] = lt_func(constants[0], constants[1])/(constants[2]*constants[3]) - computed_constants[95] = lt_func(constants[0], constants[1])/(constants[2]/constants[3]) - computed_constants[96] = sqrt(constants[0]) - computed_constants[97] = pow(constants[0], 2.0) - computed_constants[98] = pow(constants[0], 3.0) - computed_constants[99] = pow(constants[0], constants[1]) - computed_constants[100] = pow(leq_func(constants[0], constants[1]), geq_func(constants[2], constants[3])) - computed_constants[101] = pow(constants[0]+constants[1], geq_func(constants[2], constants[3])) - computed_constants[102] = pow(constants[0], geq_func(constants[1], constants[2])) - computed_constants[103] = pow(constants[0]-constants[1], geq_func(constants[2], constants[3])) - computed_constants[104] = pow(-constants[0], geq_func(constants[1], constants[2])) - computed_constants[105] = pow(constants[0]*constants[1], geq_func(constants[2], constants[3])) - computed_constants[106] = pow(constants[0]/constants[1], geq_func(constants[2], constants[3])) - computed_constants[107] = pow(leq_func(constants[0], constants[1]), constants[2]+constants[3]) - computed_constants[108] = pow(leq_func(constants[0], constants[1]), constants[2]) - computed_constants[109] = pow(leq_func(constants[0], constants[1]), constants[2]-constants[3]) - computed_constants[110] = pow(leq_func(constants[0], constants[1]), -constants[2]) - computed_constants[111] = pow(leq_func(constants[0], constants[1]), constants[2]*constants[3]) - computed_constants[112] = pow(leq_func(constants[0], constants[1]), constants[2]/constants[3]) - computed_constants[113] = pow(leq_func(constants[0], constants[1]), pow(constants[2], constants[3])) - computed_constants[114] = pow(leq_func(constants[0], constants[1]), pow(constants[2], 1.0/constants[3])) + computed_constants[61] = constants[0]+constants[1]+constants[2] + computed_constants[62] = lt_func(constants[0], constants[1])+gt_func(constants[2], constants[3]) + computed_constants[63] = constants[0] + computed_constants[64] = constants[0]-constants[1] + computed_constants[65] = lt_func(constants[0], constants[1])-gt_func(constants[2], constants[3]) + computed_constants[66] = lt_func(constants[0], constants[1])-(constants[2]+constants[3]) + computed_constants[67] = lt_func(constants[0], constants[1])-constants[2] + computed_constants[68] = constants[0]-(-constants[1]) + computed_constants[69] = constants[0]-(-constants[1]*constants[2]) + computed_constants[70] = -constants[0] + computed_constants[71] = -lt_func(constants[0], constants[1]) + computed_constants[72] = constants[0]*constants[1] + computed_constants[73] = constants[0]*constants[1]*constants[2] + computed_constants[74] = lt_func(constants[0], constants[1])*gt_func(constants[2], constants[3]) + computed_constants[75] = (constants[0]+constants[1])*gt_func(constants[2], constants[3]) + computed_constants[76] = constants[0]*gt_func(constants[1], constants[2]) + computed_constants[77] = (constants[0]-constants[1])*gt_func(constants[2], constants[3]) + computed_constants[78] = -constants[0]*gt_func(constants[1], constants[2]) + computed_constants[79] = lt_func(constants[0], constants[1])*(constants[2]+constants[3]) + computed_constants[80] = lt_func(constants[0], constants[1])*constants[2] + computed_constants[81] = lt_func(constants[0], constants[1])*(constants[2]-constants[3]) + computed_constants[82] = lt_func(constants[0], constants[1])*-constants[2] + computed_constants[83] = constants[0]/constants[1] + computed_constants[84] = lt_func(constants[0], constants[1])/gt_func(constants[3], constants[2]) + computed_constants[85] = (constants[0]+constants[1])/gt_func(constants[3], constants[2]) + computed_constants[86] = constants[0]/gt_func(constants[2], constants[1]) + computed_constants[87] = (constants[0]-constants[1])/gt_func(constants[3], constants[2]) + computed_constants[88] = -constants[0]/gt_func(constants[2], constants[1]) + computed_constants[89] = lt_func(constants[0], constants[1])/(constants[2]+constants[3]) + computed_constants[90] = lt_func(constants[0], constants[1])/constants[2] + computed_constants[91] = lt_func(constants[0], constants[1])/(constants[2]-constants[3]) + computed_constants[92] = lt_func(constants[0], constants[1])/-constants[2] + computed_constants[93] = lt_func(constants[0], constants[1])/(constants[2]*constants[3]) + computed_constants[94] = lt_func(constants[0], constants[1])/(constants[2]/constants[3]) + computed_constants[95] = sqrt(constants[0]) + computed_constants[96] = pow(constants[0], 2.0) + computed_constants[97] = pow(constants[0], 3.0) + computed_constants[98] = pow(constants[0], constants[1]) + computed_constants[99] = pow(leq_func(constants[0], constants[1]), geq_func(constants[2], constants[3])) + computed_constants[100] = pow(constants[0]+constants[1], geq_func(constants[2], constants[3])) + computed_constants[101] = pow(constants[0], geq_func(constants[1], constants[2])) + computed_constants[102] = pow(constants[0]-constants[1], geq_func(constants[2], constants[3])) + computed_constants[103] = pow(-constants[0], geq_func(constants[1], constants[2])) + computed_constants[104] = pow(constants[0]*constants[1], geq_func(constants[2], constants[3])) + computed_constants[105] = pow(constants[0]/constants[1], geq_func(constants[2], constants[3])) + computed_constants[106] = pow(leq_func(constants[0], constants[1]), constants[2]+constants[3]) + computed_constants[107] = pow(leq_func(constants[0], constants[1]), constants[2]) + computed_constants[108] = pow(leq_func(constants[0], constants[1]), constants[2]-constants[3]) + computed_constants[109] = pow(leq_func(constants[0], constants[1]), -constants[2]) + computed_constants[110] = pow(leq_func(constants[0], constants[1]), constants[2]*constants[3]) + computed_constants[111] = pow(leq_func(constants[0], constants[1]), constants[2]/constants[3]) + computed_constants[112] = pow(leq_func(constants[0], constants[1]), pow(constants[2], constants[3])) + computed_constants[113] = pow(leq_func(constants[0], constants[1]), pow(constants[2], 1.0/constants[3])) + computed_constants[114] = sqrt(constants[0]) computed_constants[115] = sqrt(constants[0]) - computed_constants[116] = sqrt(constants[0]) - computed_constants[117] = pow(constants[0], 1.0/3.0) - computed_constants[118] = pow(constants[0], 1.0/constants[1]) - computed_constants[119] = pow(lt_func(constants[0], constants[1]), 1.0/gt_func(constants[3], constants[2])) - computed_constants[120] = pow(constants[0]+constants[1], 1.0/gt_func(constants[3], constants[2])) - computed_constants[121] = pow(constants[0], 1.0/gt_func(constants[2], constants[1])) - computed_constants[122] = pow(constants[0]-constants[1], 1.0/gt_func(constants[3], constants[2])) - computed_constants[123] = pow(-constants[0], 1.0/gt_func(constants[2], constants[1])) - computed_constants[124] = pow(constants[0]*constants[1], 1.0/gt_func(constants[3], constants[2])) - computed_constants[125] = pow(constants[0]/constants[1], 1.0/gt_func(constants[3], constants[2])) - computed_constants[126] = pow(lt_func(constants[0], constants[1]), 1.0/(constants[2]+constants[3])) - computed_constants[127] = pow(lt_func(constants[0], constants[1]), 1.0/constants[2]) - computed_constants[128] = pow(lt_func(constants[0], constants[1]), 1.0/(constants[2]-constants[3])) - computed_constants[129] = pow(lt_func(constants[0], constants[1]), 1.0/-constants[2]) - computed_constants[130] = pow(lt_func(constants[0], constants[1]), 1.0/(constants[2]*constants[3])) - computed_constants[131] = pow(lt_func(constants[0], constants[1]), 1.0/(constants[2]/constants[3])) - computed_constants[132] = pow(lt_func(constants[0], constants[1]), 1.0/pow(constants[2], constants[3])) - computed_constants[133] = pow(lt_func(constants[0], constants[1]), 1.0/pow(constants[2], 1.0/constants[3])) - computed_constants[134] = fabs(constants[0]) - computed_constants[135] = exp(constants[0]) - computed_constants[136] = log(constants[0]) - computed_constants[137] = log10(constants[0]) - computed_constants[138] = log(constants[0])/log(2.0) - computed_constants[139] = log10(constants[0]) - computed_constants[140] = log(constants[0])/log(constants[1]) - computed_constants[141] = ceil(constants[0]) - computed_constants[142] = floor(constants[0]) - computed_constants[143] = min(constants[0], constants[1]) - computed_constants[144] = min(constants[0], min(constants[1], constants[2])) - computed_constants[145] = max(constants[0], constants[1]) - computed_constants[146] = max(constants[0], max(constants[1], constants[2])) - computed_constants[147] = fmod(constants[0], constants[1]) - computed_constants[148] = sin(constants[0]) - computed_constants[149] = cos(constants[0]) - computed_constants[150] = tan(constants[0]) - computed_constants[151] = sec(constants[0]) - computed_constants[152] = csc(constants[0]) - computed_constants[153] = cot(constants[0]) - computed_constants[154] = sinh(constants[0]) - computed_constants[155] = cosh(constants[0]) - computed_constants[156] = tanh(constants[0]) - computed_constants[157] = sech(constants[0]) - computed_constants[158] = csch(constants[0]) - computed_constants[159] = coth(constants[0]) - computed_constants[160] = asin(constants[0]) - computed_constants[161] = acos(constants[0]) - computed_constants[162] = atan(constants[0]) - computed_constants[163] = asec(constants[0]) - computed_constants[164] = acsc(constants[0]) - computed_constants[165] = acot(constants[0]) - computed_constants[166] = asinh(constants[0]) - computed_constants[167] = acosh(constants[0]) - computed_constants[168] = atanh(constants[0]/2.0) - computed_constants[169] = asech(constants[0]) - computed_constants[170] = acsch(constants[0]) - computed_constants[171] = acoth(2.0*constants[0]) - computed_constants[172] = constants[0] if gt_func(constants[0], constants[1]) else nan - computed_constants[173] = constants[0] if gt_func(constants[0], constants[1]) else constants[2] - computed_constants[174] = constants[0] if gt_func(constants[0], constants[1]) else constants[2] if gt_func(constants[2], constants[3]) else constants[4] if gt_func(constants[4], constants[5]) else nan - computed_constants[175] = constants[0] if gt_func(constants[0], constants[1]) else constants[2] if gt_func(constants[2], constants[3]) else constants[4] if gt_func(constants[4], constants[5]) else constants[6] - computed_constants[176] = 123.0+(constants[0] if gt_func(constants[0], constants[1]) else nan) - computed_constants[181] = constants[0] - computed_constants[188] = and_func(constants[0], constants[1])+(constants[1] if gt_func(constants[2], constants[3]) else nan)+constants[4]+and_func(constants[5], constants[6]) - computed_constants[189] = and_func(constants[0], constants[1])-((constants[1] if gt_func(constants[2], constants[3]) else nan)-(constants[4]-(constants[1] if gt_func(constants[2], constants[3]) else nan)))-and_func(constants[5], constants[6]) - computed_constants[190] = and_func(constants[0], constants[1])*(constants[1] if gt_func(constants[2], constants[3]) else nan)*constants[4]*(constants[1] if gt_func(constants[2], constants[3]) else nan)*and_func(constants[5], constants[6]) - computed_constants[191] = and_func(constants[0], constants[1])/((constants[1] if gt_func(constants[2], constants[3]) else nan)/(constants[4]/(constants[1] if gt_func(constants[2], constants[3]) else nan))) - computed_constants[192] = and_func(or_func(constants[0], constants[1]), and_func(xor_func(constants[0], constants[1]), and_func(constants[1] if gt_func(constants[2], constants[3]) else nan, and_func(and_func(and_func(constants[4], constants[1] if gt_func(constants[2], constants[3]) else nan), xor_func(constants[0], constants[1])), or_func(constants[0], constants[1]))))) - computed_constants[193] = or_func(and_func(constants[0], constants[1]), or_func(xor_func(constants[0], constants[1]), or_func(constants[1] if gt_func(constants[2], constants[3]) else nan, or_func(or_func(or_func(constants[4], constants[1] if gt_func(constants[2], constants[3]) else nan), xor_func(constants[0], constants[1])), and_func(constants[0], constants[1]))))) - computed_constants[194] = xor_func(and_func(constants[0], constants[1]), xor_func(or_func(constants[0], constants[1]), xor_func(constants[1] if gt_func(constants[2], constants[3]) else nan, xor_func(xor_func(xor_func(constants[4], constants[1] if gt_func(constants[2], constants[3]) else nan), or_func(constants[0], constants[1])), and_func(constants[0], constants[1]))))) - computed_constants[195] = pow(and_func(constants[0], constants[1]), pow(constants[1] if gt_func(constants[2], constants[3]) else nan, pow(pow(constants[4], constants[1] if gt_func(constants[2], constants[3]) else nan), and_func(constants[0], constants[1])))) - computed_constants[196] = pow(pow(pow(and_func(constants[0], constants[1]), 1.0/pow(constants[1] if gt_func(constants[2], constants[3]) else nan, 1.0/constants[4])), 1.0/(constants[1] if gt_func(constants[2], constants[3]) else nan)), 1.0/and_func(constants[0], constants[1])) - computed_constants[197] = -and_func(constants[0], constants[1])+-(constants[1] if gt_func(constants[2], constants[3]) else nan) - - -def compute_rates(voi, states, rates, constants, computed_constants, algebraic): + computed_constants[116] = pow(constants[0], 1.0/3.0) + computed_constants[117] = pow(constants[0], 1.0/constants[1]) + computed_constants[118] = pow(lt_func(constants[0], constants[1]), 1.0/gt_func(constants[3], constants[2])) + computed_constants[119] = pow(constants[0]+constants[1], 1.0/gt_func(constants[3], constants[2])) + computed_constants[120] = pow(constants[0], 1.0/gt_func(constants[2], constants[1])) + computed_constants[121] = pow(constants[0]-constants[1], 1.0/gt_func(constants[3], constants[2])) + computed_constants[122] = pow(-constants[0], 1.0/gt_func(constants[2], constants[1])) + computed_constants[123] = pow(constants[0]*constants[1], 1.0/gt_func(constants[3], constants[2])) + computed_constants[124] = pow(constants[0]/constants[1], 1.0/gt_func(constants[3], constants[2])) + computed_constants[125] = pow(lt_func(constants[0], constants[1]), 1.0/(constants[2]+constants[3])) + computed_constants[126] = pow(lt_func(constants[0], constants[1]), 1.0/constants[2]) + computed_constants[127] = pow(lt_func(constants[0], constants[1]), 1.0/(constants[2]-constants[3])) + computed_constants[128] = pow(lt_func(constants[0], constants[1]), 1.0/-constants[2]) + computed_constants[129] = pow(lt_func(constants[0], constants[1]), 1.0/(constants[2]*constants[3])) + computed_constants[130] = pow(lt_func(constants[0], constants[1]), 1.0/(constants[2]/constants[3])) + computed_constants[131] = pow(lt_func(constants[0], constants[1]), 1.0/pow(constants[2], constants[3])) + computed_constants[132] = pow(lt_func(constants[0], constants[1]), 1.0/pow(constants[2], 1.0/constants[3])) + computed_constants[133] = fabs(constants[0]) + computed_constants[134] = exp(constants[0]) + computed_constants[135] = log(constants[0]) + computed_constants[136] = log10(constants[0]) + computed_constants[137] = log(constants[0])/log(2.0) + computed_constants[138] = log10(constants[0]) + computed_constants[139] = log(constants[0])/log(constants[1]) + computed_constants[140] = ceil(constants[0]) + computed_constants[141] = floor(constants[0]) + computed_constants[142] = min(constants[0], constants[1]) + computed_constants[143] = min(constants[0], min(constants[1], constants[2])) + computed_constants[144] = max(constants[0], constants[1]) + computed_constants[145] = max(constants[0], max(constants[1], constants[2])) + computed_constants[146] = fmod(constants[0], constants[1]) + computed_constants[147] = sin(constants[0]) + computed_constants[148] = cos(constants[0]) + computed_constants[149] = tan(constants[0]) + computed_constants[150] = sec(constants[0]) + computed_constants[151] = csc(constants[0]) + computed_constants[152] = cot(constants[0]) + computed_constants[153] = sinh(constants[0]) + computed_constants[154] = cosh(constants[0]) + computed_constants[155] = tanh(constants[0]) + computed_constants[156] = sech(constants[0]) + computed_constants[157] = csch(constants[0]) + computed_constants[158] = coth(constants[0]) + computed_constants[159] = asin(constants[0]) + computed_constants[160] = acos(constants[0]) + computed_constants[161] = atan(constants[0]) + computed_constants[162] = asec(constants[0]) + computed_constants[163] = acsc(constants[0]) + computed_constants[164] = acot(constants[0]) + computed_constants[165] = asinh(constants[0]) + computed_constants[166] = acosh(constants[0]) + computed_constants[167] = atanh(constants[0]/2.0) + computed_constants[168] = asech(constants[0]) + computed_constants[169] = acsch(constants[0]) + computed_constants[170] = acoth(2.0*constants[0]) + computed_constants[171] = constants[0] if gt_func(constants[0], constants[1]) else nan + computed_constants[172] = constants[0] if gt_func(constants[0], constants[1]) else constants[2] + computed_constants[173] = constants[0] if gt_func(constants[0], constants[1]) else constants[2] if gt_func(constants[2], constants[3]) else constants[4] if gt_func(constants[4], constants[5]) else nan + computed_constants[174] = constants[0] if gt_func(constants[0], constants[1]) else constants[2] if gt_func(constants[2], constants[3]) else constants[4] if gt_func(constants[4], constants[5]) else constants[6] + computed_constants[175] = 123.0+(constants[0] if gt_func(constants[0], constants[1]) else nan) + computed_constants[180] = constants[0] + computed_constants[187] = and_func(constants[0], constants[1])+(constants[1] if gt_func(constants[2], constants[3]) else nan)+constants[4]+and_func(constants[5], constants[6]) + computed_constants[188] = and_func(constants[0], constants[1])-((constants[1] if gt_func(constants[2], constants[3]) else nan)-(constants[4]-(constants[1] if gt_func(constants[2], constants[3]) else nan)))-and_func(constants[5], constants[6]) + computed_constants[189] = and_func(constants[0], constants[1])*(constants[1] if gt_func(constants[2], constants[3]) else nan)*constants[4]*(constants[1] if gt_func(constants[2], constants[3]) else nan)*and_func(constants[5], constants[6]) + computed_constants[190] = and_func(constants[0], constants[1])/((constants[1] if gt_func(constants[2], constants[3]) else nan)/(constants[4]/(constants[1] if gt_func(constants[2], constants[3]) else nan))) + computed_constants[191] = and_func(or_func(constants[0], constants[1]), and_func(xor_func(constants[0], constants[1]), and_func(constants[1] if gt_func(constants[2], constants[3]) else nan, and_func(and_func(and_func(constants[4], constants[1] if gt_func(constants[2], constants[3]) else nan), xor_func(constants[0], constants[1])), or_func(constants[0], constants[1]))))) + computed_constants[192] = or_func(and_func(constants[0], constants[1]), or_func(xor_func(constants[0], constants[1]), or_func(constants[1] if gt_func(constants[2], constants[3]) else nan, or_func(or_func(or_func(constants[4], constants[1] if gt_func(constants[2], constants[3]) else nan), xor_func(constants[0], constants[1])), and_func(constants[0], constants[1]))))) + computed_constants[193] = xor_func(and_func(constants[0], constants[1]), xor_func(or_func(constants[0], constants[1]), xor_func(constants[1] if gt_func(constants[2], constants[3]) else nan, xor_func(xor_func(xor_func(constants[4], constants[1] if gt_func(constants[2], constants[3]) else nan), or_func(constants[0], constants[1])), and_func(constants[0], constants[1]))))) + computed_constants[194] = pow(and_func(constants[0], constants[1]), pow(constants[1] if gt_func(constants[2], constants[3]) else nan, pow(pow(constants[4], constants[1] if gt_func(constants[2], constants[3]) else nan), and_func(constants[0], constants[1])))) + computed_constants[195] = pow(pow(pow(and_func(constants[0], constants[1]), 1.0/pow(constants[1] if gt_func(constants[2], constants[3]) else nan, 1.0/constants[4])), 1.0/(constants[1] if gt_func(constants[2], constants[3]) else nan)), 1.0/and_func(constants[0], constants[1])) + computed_constants[196] = -and_func(constants[0], constants[1])+-(constants[1] if gt_func(constants[2], constants[3]) else nan) + + +def compute_rates(voi, states, rates, constants, computed_constants, algebraic, externals, external_variable): rates[0] = 1.0 -def compute_variables(voi, states, rates, constants, computed_constants, algebraic): +def compute_variables(voi, states, rates, constants, computed_constants, algebraic, externals, external_variable): + externals[0] = external_variable(voi, states, rates, constants, computed_constants, algebraic, externals, 0) find_root_0(voi, states, rates, constants, computed_constants, algebraic) diff --git a/tests/resources/coverage/generator/model.out b/tests/resources/coverage/generator/model.out index acd776c9fa..6391e30e4c 100644 --- a/tests/resources/coverage/generator/model.out +++ b/tests/resources/coverage/generator/model.out @@ -85,6 +85,7 @@ typedef struct { double *constants; double *computedConstants; double *algebraic; + double *externals; } RootFindingInfo; extern void nlaSolve(void (*objectiveFunction)(double *, double *, void *), @@ -103,7 +104,7 @@ void objectiveFunction0(double *u, double *f, void *data) algebraic[1] = u[1]; f[0] = algebraic[0]+algebraic[1]+states[0]-0.0; - f[1] = algebraic[0]-algebraic[1]-(computedConstants[198]+computedConstants[199]); + f[1] = algebraic[0]-algebraic[1]-(computedConstants[197]+computedConstants[198]); } void findRoot0(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) @@ -120,32 +121,6 @@ void findRoot0(double voi, double *states, double *rates, double *constants, dou algebraic[1] = u[1]; } -void initialiseVariables(double *states, double *rates, double *constants, double *computedConstants, double *algebraic) -{ - states[0] = 0.0; - constants[0] = 1.0; - constants[1] = 2.0; - constants[2] = 3.0; - constants[3] = 4.0; - constants[4] = 5.0; - constants[5] = 6.0; - constants[6] = 7.0; - computedConstants[177] = 123.0; - computedConstants[178] = 123.456789; - computedConstants[179] = 123.0e99; - computedConstants[180] = 123.456789e99; - computedConstants[182] = 1.0; - computedConstants[183] = 0.0; - computedConstants[184] = 2.71828182845905; - computedConstants[185] = 3.14159265358979; - computedConstants[186] = INFINITY; - computedConstants[187] = NAN; - computedConstants[198] = 1.0; - computedConstants[199] = 3.0; - algebraic[0] = 1.0; - algebraic[1] = 2.0; -} - void computeComputedConstants(double *constants, double *computedConstants) { computedConstants[0] = constants[0] == constants[1]; @@ -209,136 +184,135 @@ void computeComputedConstants(double *constants, double *computedConstants) computedConstants[58] = (constants[0] < constants[1])^(constants[2]^^(1.0/constants[3])); computedConstants[59] = constants[0]/(constants[1]^constants[2]); computedConstants[60] = !constants[0]; - computedConstants[61] = constants[0]+constants[1]; - computedConstants[62] = constants[0]+constants[1]+constants[2]; - computedConstants[63] = (constants[0] < constants[1])+(constants[2] > constants[3]); - computedConstants[64] = constants[0]; - computedConstants[65] = constants[0]-constants[1]; - computedConstants[66] = (constants[0] < constants[1])-(constants[2] > constants[3]); - computedConstants[67] = (constants[0] < constants[1])-(constants[2]+constants[3]); - computedConstants[68] = (constants[0] < constants[1])-constants[2]; - computedConstants[69] = constants[0]-(-constants[1]); - computedConstants[70] = constants[0]-(-constants[1]*constants[2]); - computedConstants[71] = -constants[0]; - computedConstants[72] = -(constants[0] < constants[1]); - computedConstants[73] = constants[0]*constants[1]; - computedConstants[74] = constants[0]*constants[1]*constants[2]; - computedConstants[75] = (constants[0] < constants[1])*(constants[2] > constants[3]); - computedConstants[76] = (constants[0]+constants[1])*(constants[2] > constants[3]); - computedConstants[77] = constants[0]*(constants[1] > constants[2]); - computedConstants[78] = (constants[0]-constants[1])*(constants[2] > constants[3]); - computedConstants[79] = -constants[0]*(constants[1] > constants[2]); - computedConstants[80] = (constants[0] < constants[1])*(constants[2]+constants[3]); - computedConstants[81] = (constants[0] < constants[1])*constants[2]; - computedConstants[82] = (constants[0] < constants[1])*(constants[2]-constants[3]); - computedConstants[83] = (constants[0] < constants[1])*-constants[2]; - computedConstants[84] = constants[0]/constants[1]; - computedConstants[85] = (constants[0] < constants[1])/(constants[3] > constants[2]); - computedConstants[86] = (constants[0]+constants[1])/(constants[3] > constants[2]); - computedConstants[87] = constants[0]/(constants[2] > constants[1]); - computedConstants[88] = (constants[0]-constants[1])/(constants[3] > constants[2]); - computedConstants[89] = -constants[0]/(constants[2] > constants[1]); - computedConstants[90] = (constants[0] < constants[1])/(constants[2]+constants[3]); - computedConstants[91] = (constants[0] < constants[1])/constants[2]; - computedConstants[92] = (constants[0] < constants[1])/(constants[2]-constants[3]); - computedConstants[93] = (constants[0] < constants[1])/-constants[2]; - computedConstants[94] = (constants[0] < constants[1])/(constants[2]*constants[3]); - computedConstants[95] = (constants[0] < constants[1])/(constants[2]/constants[3]); - computedConstants[96] = sqrt(constants[0]); - computedConstants[97] = sqr(constants[0]); - computedConstants[98] = constants[0]^^3.0; - computedConstants[99] = constants[0]^^constants[1]; - computedConstants[100] = (constants[0] <= constants[1])^^(constants[2] >= constants[3]); - computedConstants[101] = (constants[0]+constants[1])^^(constants[2] >= constants[3]); - computedConstants[102] = constants[0]^^(constants[1] >= constants[2]); - computedConstants[103] = (constants[0]-constants[1])^^(constants[2] >= constants[3]); - computedConstants[104] = (-constants[0])^^(constants[1] >= constants[2]); - computedConstants[105] = (constants[0]*constants[1])^^(constants[2] >= constants[3]); - computedConstants[106] = (constants[0]/constants[1])^^(constants[2] >= constants[3]); - computedConstants[107] = (constants[0] <= constants[1])^^(constants[2]+constants[3]); - computedConstants[108] = (constants[0] <= constants[1])^^constants[2]; - computedConstants[109] = (constants[0] <= constants[1])^^constants[2]-constants[3]; - computedConstants[110] = (constants[0] <= constants[1])^^-constants[2]; - computedConstants[111] = (constants[0] <= constants[1])^^(constants[2]*constants[3]); - computedConstants[112] = (constants[0] <= constants[1])^^(constants[2]/constants[3]); - computedConstants[113] = (constants[0] <= constants[1])^^(constants[2]^^constants[3]); - computedConstants[114] = (constants[0] <= constants[1])^^(constants[2]^^(1.0/constants[3])); + computedConstants[61] = constants[0]+constants[1]+constants[2]; + computedConstants[62] = (constants[0] < constants[1])+(constants[2] > constants[3]); + computedConstants[63] = constants[0]; + computedConstants[64] = constants[0]-constants[1]; + computedConstants[65] = (constants[0] < constants[1])-(constants[2] > constants[3]); + computedConstants[66] = (constants[0] < constants[1])-(constants[2]+constants[3]); + computedConstants[67] = (constants[0] < constants[1])-constants[2]; + computedConstants[68] = constants[0]-(-constants[1]); + computedConstants[69] = constants[0]-(-constants[1]*constants[2]); + computedConstants[70] = -constants[0]; + computedConstants[71] = -(constants[0] < constants[1]); + computedConstants[72] = constants[0]*constants[1]; + computedConstants[73] = constants[0]*constants[1]*constants[2]; + computedConstants[74] = (constants[0] < constants[1])*(constants[2] > constants[3]); + computedConstants[75] = (constants[0]+constants[1])*(constants[2] > constants[3]); + computedConstants[76] = constants[0]*(constants[1] > constants[2]); + computedConstants[77] = (constants[0]-constants[1])*(constants[2] > constants[3]); + computedConstants[78] = -constants[0]*(constants[1] > constants[2]); + computedConstants[79] = (constants[0] < constants[1])*(constants[2]+constants[3]); + computedConstants[80] = (constants[0] < constants[1])*constants[2]; + computedConstants[81] = (constants[0] < constants[1])*(constants[2]-constants[3]); + computedConstants[82] = (constants[0] < constants[1])*-constants[2]; + computedConstants[83] = constants[0]/constants[1]; + computedConstants[84] = (constants[0] < constants[1])/(constants[3] > constants[2]); + computedConstants[85] = (constants[0]+constants[1])/(constants[3] > constants[2]); + computedConstants[86] = constants[0]/(constants[2] > constants[1]); + computedConstants[87] = (constants[0]-constants[1])/(constants[3] > constants[2]); + computedConstants[88] = -constants[0]/(constants[2] > constants[1]); + computedConstants[89] = (constants[0] < constants[1])/(constants[2]+constants[3]); + computedConstants[90] = (constants[0] < constants[1])/constants[2]; + computedConstants[91] = (constants[0] < constants[1])/(constants[2]-constants[3]); + computedConstants[92] = (constants[0] < constants[1])/-constants[2]; + computedConstants[93] = (constants[0] < constants[1])/(constants[2]*constants[3]); + computedConstants[94] = (constants[0] < constants[1])/(constants[2]/constants[3]); + computedConstants[95] = sqrt(constants[0]); + computedConstants[96] = sqr(constants[0]); + computedConstants[97] = constants[0]^^3.0; + computedConstants[98] = constants[0]^^constants[1]; + computedConstants[99] = (constants[0] <= constants[1])^^(constants[2] >= constants[3]); + computedConstants[100] = (constants[0]+constants[1])^^(constants[2] >= constants[3]); + computedConstants[101] = constants[0]^^(constants[1] >= constants[2]); + computedConstants[102] = (constants[0]-constants[1])^^(constants[2] >= constants[3]); + computedConstants[103] = (-constants[0])^^(constants[1] >= constants[2]); + computedConstants[104] = (constants[0]*constants[1])^^(constants[2] >= constants[3]); + computedConstants[105] = (constants[0]/constants[1])^^(constants[2] >= constants[3]); + computedConstants[106] = (constants[0] <= constants[1])^^(constants[2]+constants[3]); + computedConstants[107] = (constants[0] <= constants[1])^^constants[2]; + computedConstants[108] = (constants[0] <= constants[1])^^constants[2]-constants[3]; + computedConstants[109] = (constants[0] <= constants[1])^^-constants[2]; + computedConstants[110] = (constants[0] <= constants[1])^^(constants[2]*constants[3]); + computedConstants[111] = (constants[0] <= constants[1])^^(constants[2]/constants[3]); + computedConstants[112] = (constants[0] <= constants[1])^^(constants[2]^^constants[3]); + computedConstants[113] = (constants[0] <= constants[1])^^(constants[2]^^(1.0/constants[3])); + computedConstants[114] = sqrt(constants[0]); computedConstants[115] = sqrt(constants[0]); - computedConstants[116] = sqrt(constants[0]); - computedConstants[117] = constants[0]^^(1.0/3.0); - computedConstants[118] = constants[0]^^(1.0/constants[1]); - computedConstants[119] = (constants[0] < constants[1])^^(1.0/(constants[3] > constants[2])); - computedConstants[120] = (constants[0]+constants[1])^^(1.0/(constants[3] > constants[2])); - computedConstants[121] = constants[0]^^(1.0/(constants[2] > constants[1])); - computedConstants[122] = (constants[0]-constants[1])^^(1.0/(constants[3] > constants[2])); - computedConstants[123] = (-constants[0])^^(1.0/(constants[2] > constants[1])); - computedConstants[124] = (constants[0]*constants[1])^^(1.0/(constants[3] > constants[2])); - computedConstants[125] = (constants[0]/constants[1])^^(1.0/(constants[3] > constants[2])); - computedConstants[126] = (constants[0] < constants[1])^^(1.0/(constants[2]+constants[3])); - computedConstants[127] = (constants[0] < constants[1])^^(1.0/constants[2]); - computedConstants[128] = (constants[0] < constants[1])^^(1.0/(constants[2]-constants[3])); - computedConstants[129] = (constants[0] < constants[1])^^(1.0/(-constants[2])); - computedConstants[130] = (constants[0] < constants[1])^^(1.0/(constants[2]*constants[3])); - computedConstants[131] = (constants[0] < constants[1])^^(1.0/(constants[2]/constants[3])); - computedConstants[132] = (constants[0] < constants[1])^^(1.0/(constants[2]^^constants[3])); - computedConstants[133] = (constants[0] < constants[1])^^(1.0/(constants[2]^^(1.0/constants[3]))); - computedConstants[134] = fabs(constants[0]); - computedConstants[135] = exp(constants[0]); - computedConstants[136] = log(constants[0]); - computedConstants[137] = log10(constants[0]); - computedConstants[138] = log(constants[0])/log(2.0); - computedConstants[139] = log10(constants[0]); - computedConstants[140] = log(constants[0])/log(constants[1]); - computedConstants[141] = ceil(constants[0]); - computedConstants[142] = floor(constants[0]); - computedConstants[143] = min(constants[0], constants[1]); - computedConstants[144] = min(constants[0], min(constants[1], constants[2])); - computedConstants[145] = max(constants[0], constants[1]); - computedConstants[146] = max(constants[0], max(constants[1], constants[2])); - computedConstants[147] = fmod(constants[0], constants[1]); - computedConstants[148] = sin(constants[0]); - computedConstants[149] = cos(constants[0]); - computedConstants[150] = tan(constants[0]); - computedConstants[151] = sec(constants[0]); - computedConstants[152] = csc(constants[0]); - computedConstants[153] = cot(constants[0]); - computedConstants[154] = sinh(constants[0]); - computedConstants[155] = cosh(constants[0]); - computedConstants[156] = tanh(constants[0]); - computedConstants[157] = sech(constants[0]); - computedConstants[158] = csch(constants[0]); - computedConstants[159] = coth(constants[0]); - computedConstants[160] = asin(constants[0]); - computedConstants[161] = acos(constants[0]); - computedConstants[162] = atan(constants[0]); - computedConstants[163] = asec(constants[0]); - computedConstants[164] = acsc(constants[0]); - computedConstants[165] = acot(constants[0]); - computedConstants[166] = asinh(constants[0]); - computedConstants[167] = acosh(constants[0]); - computedConstants[168] = atanh(constants[0]/2.0); - computedConstants[169] = asech(constants[0]); - computedConstants[170] = acsch(constants[0]); - computedConstants[171] = acoth(2.0*constants[0]); - computedConstants[172] = piecewise(constants[0] > constants[1], constants[0], NAN); - computedConstants[173] = piecewise(constants[0] > constants[1], constants[0], constants[2]); - computedConstants[174] = piecewise(constants[0] > constants[1], constants[0], piecewise(constants[2] > constants[3], constants[2], piecewise(constants[4] > constants[5], constants[4], NAN))); - computedConstants[175] = piecewise(constants[0] > constants[1], constants[0], piecewise(constants[2] > constants[3], constants[2], piecewise(constants[4] > constants[5], constants[4], constants[6]))); - computedConstants[176] = 123.0+piecewise(constants[0] > constants[1], constants[0], NAN); - computedConstants[181] = constants[0]; - computedConstants[188] = (constants[0] && constants[1])+piecewise(constants[2] > constants[3], constants[1], NAN)+constants[4]+(constants[5] && constants[6]); - computedConstants[189] = (constants[0] && constants[1])-(piecewise(constants[2] > constants[3], constants[1], NAN)-(constants[4]-piecewise(constants[2] > constants[3], constants[1], NAN)))-(constants[5] && constants[6]); - computedConstants[190] = (constants[0] && constants[1])*piecewise(constants[2] > constants[3], constants[1], NAN)*constants[4]*piecewise(constants[2] > constants[3], constants[1], NAN)*(constants[5] && constants[6]); - computedConstants[191] = (constants[0] && constants[1])/(piecewise(constants[2] > constants[3], constants[1], NAN)/(constants[4]/piecewise(constants[2] > constants[3], constants[1], NAN))); - computedConstants[192] = (constants[0] || constants[1]) && (constants[0]^constants[1]) && piecewise(constants[2] > constants[3], constants[1], NAN) && constants[4] && piecewise(constants[2] > constants[3], constants[1], NAN) && (constants[0]^constants[1]) && (constants[0] || constants[1]); - computedConstants[193] = (constants[0] && constants[1]) || (constants[0]^constants[1]) || piecewise(constants[2] > constants[3], constants[1], NAN) || constants[4] || piecewise(constants[2] > constants[3], constants[1], NAN) || (constants[0]^constants[1]) || (constants[0] && constants[1]); - computedConstants[194] = (constants[0] && constants[1])^(constants[0] || constants[1])^piecewise(constants[2] > constants[3], constants[1], NAN)^constants[4]^piecewise(constants[2] > constants[3], constants[1], NAN)^(constants[0] || constants[1])^(constants[0] && constants[1]); - computedConstants[195] = (constants[0] && constants[1])^^(piecewise(constants[2] > constants[3], constants[1], NAN)^^(constants[4]^^piecewise(constants[2] > constants[3], constants[1], NAN)^^(constants[0] && constants[1]))); - computedConstants[196] = (constants[0] && constants[1])^^(1.0/(piecewise(constants[2] > constants[3], constants[1], NAN)^^(1.0/constants[4])))^^(1.0/piecewise(constants[2] > constants[3], constants[1], NAN))^^(1.0/(constants[0] && constants[1])); - computedConstants[197] = -(constants[0] && constants[1])+-piecewise(constants[2] > constants[3], constants[1], NAN); + computedConstants[116] = constants[0]^^(1.0/3.0); + computedConstants[117] = constants[0]^^(1.0/constants[1]); + computedConstants[118] = (constants[0] < constants[1])^^(1.0/(constants[3] > constants[2])); + computedConstants[119] = (constants[0]+constants[1])^^(1.0/(constants[3] > constants[2])); + computedConstants[120] = constants[0]^^(1.0/(constants[2] > constants[1])); + computedConstants[121] = (constants[0]-constants[1])^^(1.0/(constants[3] > constants[2])); + computedConstants[122] = (-constants[0])^^(1.0/(constants[2] > constants[1])); + computedConstants[123] = (constants[0]*constants[1])^^(1.0/(constants[3] > constants[2])); + computedConstants[124] = (constants[0]/constants[1])^^(1.0/(constants[3] > constants[2])); + computedConstants[125] = (constants[0] < constants[1])^^(1.0/(constants[2]+constants[3])); + computedConstants[126] = (constants[0] < constants[1])^^(1.0/constants[2]); + computedConstants[127] = (constants[0] < constants[1])^^(1.0/(constants[2]-constants[3])); + computedConstants[128] = (constants[0] < constants[1])^^(1.0/(-constants[2])); + computedConstants[129] = (constants[0] < constants[1])^^(1.0/(constants[2]*constants[3])); + computedConstants[130] = (constants[0] < constants[1])^^(1.0/(constants[2]/constants[3])); + computedConstants[131] = (constants[0] < constants[1])^^(1.0/(constants[2]^^constants[3])); + computedConstants[132] = (constants[0] < constants[1])^^(1.0/(constants[2]^^(1.0/constants[3]))); + computedConstants[133] = fabs(constants[0]); + computedConstants[134] = exp(constants[0]); + computedConstants[135] = log(constants[0]); + computedConstants[136] = log10(constants[0]); + computedConstants[137] = log(constants[0])/log(2.0); + computedConstants[138] = log10(constants[0]); + computedConstants[139] = log(constants[0])/log(constants[1]); + computedConstants[140] = ceil(constants[0]); + computedConstants[141] = floor(constants[0]); + computedConstants[142] = min(constants[0], constants[1]); + computedConstants[143] = min(constants[0], min(constants[1], constants[2])); + computedConstants[144] = max(constants[0], constants[1]); + computedConstants[145] = max(constants[0], max(constants[1], constants[2])); + computedConstants[146] = fmod(constants[0], constants[1]); + computedConstants[147] = sin(constants[0]); + computedConstants[148] = cos(constants[0]); + computedConstants[149] = tan(constants[0]); + computedConstants[150] = sec(constants[0]); + computedConstants[151] = csc(constants[0]); + computedConstants[152] = cot(constants[0]); + computedConstants[153] = sinh(constants[0]); + computedConstants[154] = cosh(constants[0]); + computedConstants[155] = tanh(constants[0]); + computedConstants[156] = sech(constants[0]); + computedConstants[157] = csch(constants[0]); + computedConstants[158] = coth(constants[0]); + computedConstants[159] = asin(constants[0]); + computedConstants[160] = acos(constants[0]); + computedConstants[161] = atan(constants[0]); + computedConstants[162] = asec(constants[0]); + computedConstants[163] = acsc(constants[0]); + computedConstants[164] = acot(constants[0]); + computedConstants[165] = asinh(constants[0]); + computedConstants[166] = acosh(constants[0]); + computedConstants[167] = atanh(constants[0]/2.0); + computedConstants[168] = asech(constants[0]); + computedConstants[169] = acsch(constants[0]); + computedConstants[170] = acoth(2.0*constants[0]); + computedConstants[171] = piecewise(constants[0] > constants[1], constants[0], NAN); + computedConstants[172] = piecewise(constants[0] > constants[1], constants[0], constants[2]); + computedConstants[173] = piecewise(constants[0] > constants[1], constants[0], piecewise(constants[2] > constants[3], constants[2], piecewise(constants[4] > constants[5], constants[4], NAN))); + computedConstants[174] = piecewise(constants[0] > constants[1], constants[0], piecewise(constants[2] > constants[3], constants[2], piecewise(constants[4] > constants[5], constants[4], constants[6]))); + computedConstants[175] = 123.0+piecewise(constants[0] > constants[1], constants[0], NAN); + computedConstants[180] = constants[0]; + computedConstants[187] = (constants[0] && constants[1])+piecewise(constants[2] > constants[3], constants[1], NAN)+constants[4]+(constants[5] && constants[6]); + computedConstants[188] = (constants[0] && constants[1])-(piecewise(constants[2] > constants[3], constants[1], NAN)-(constants[4]-piecewise(constants[2] > constants[3], constants[1], NAN)))-(constants[5] && constants[6]); + computedConstants[189] = (constants[0] && constants[1])*piecewise(constants[2] > constants[3], constants[1], NAN)*constants[4]*piecewise(constants[2] > constants[3], constants[1], NAN)*(constants[5] && constants[6]); + computedConstants[190] = (constants[0] && constants[1])/(piecewise(constants[2] > constants[3], constants[1], NAN)/(constants[4]/piecewise(constants[2] > constants[3], constants[1], NAN))); + computedConstants[191] = (constants[0] || constants[1]) && (constants[0]^constants[1]) && piecewise(constants[2] > constants[3], constants[1], NAN) && constants[4] && piecewise(constants[2] > constants[3], constants[1], NAN) && (constants[0]^constants[1]) && (constants[0] || constants[1]); + computedConstants[192] = (constants[0] && constants[1]) || (constants[0]^constants[1]) || piecewise(constants[2] > constants[3], constants[1], NAN) || constants[4] || piecewise(constants[2] > constants[3], constants[1], NAN) || (constants[0]^constants[1]) || (constants[0] && constants[1]); + computedConstants[193] = (constants[0] && constants[1])^(constants[0] || constants[1])^piecewise(constants[2] > constants[3], constants[1], NAN)^constants[4]^piecewise(constants[2] > constants[3], constants[1], NAN)^(constants[0] || constants[1])^(constants[0] && constants[1]); + computedConstants[194] = (constants[0] && constants[1])^^(piecewise(constants[2] > constants[3], constants[1], NAN)^^(constants[4]^^piecewise(constants[2] > constants[3], constants[1], NAN)^^(constants[0] && constants[1]))); + computedConstants[195] = (constants[0] && constants[1])^^(1.0/(piecewise(constants[2] > constants[3], constants[1], NAN)^^(1.0/constants[4])))^^(1.0/piecewise(constants[2] > constants[3], constants[1], NAN))^^(1.0/(constants[0] && constants[1])); + computedConstants[196] = -(constants[0] && constants[1])+-piecewise(constants[2] > constants[3], constants[1], NAN); } -void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) +void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, double *externals, ExternalVariable externalVariable) { rates[0] = 1.0; } diff --git a/tests/resources/coverage/generator/model.py b/tests/resources/coverage/generator/model.py index 779814e801..1fff7c3312 100644 --- a/tests/resources/coverage/generator/model.py +++ b/tests/resources/coverage/generator/model.py @@ -9,8 +9,9 @@ STATE_COUNT = 1 CONSTANT_COUNT = 7 -COMPUTED_CONSTANT_COUNT = 200 +COMPUTED_CONSTANT_COUNT = 199 ALGEBRAIC_COUNT = 2 +EXTERNAL_COUNT = 1 VOI_INFO = {"name": "t", "units": "second", "component": "my_component"} @@ -90,7 +91,6 @@ {"name": "eqnXorParenthesesRightRoot", "units": "dimensionless", "component": "my_component"}, {"name": "eqnXorCoverageParentheses", "units": "dimensionless", "component": "my_component"}, {"name": "eqnNot", "units": "dimensionless", "component": "my_component"}, - {"name": "eqnPlus", "units": "dimensionless", "component": "my_component"}, {"name": "eqnPlusMultiple", "units": "dimensionless", "component": "my_component"}, {"name": "eqnPlusParentheses", "units": "dimensionless", "component": "my_component"}, {"name": "eqnPlusUnary", "units": "dimensionless", "component": "my_component"}, @@ -236,6 +236,10 @@ {"name": "eqnNlaVariable2", "units": "dimensionless", "component": "my_component"} ] +EXTERNAL_INFO = [ + {"name": "eqnPlus", "units": "dimensionless", "component": "my_component"} +] + def eq_func(x, y): return 1.0 if x == y else 0.0 @@ -355,6 +359,10 @@ def create_algebraic_array(): return [nan]*ALGEBRAIC_COUNT +def create_externals_array(): + return [nan]*EXTERNAL_COUNT + + from nlasolver import nla_solve @@ -370,7 +378,7 @@ def objective_function_0(u, f, data): algebraic[1] = u[1] f[0] = algebraic[0]+algebraic[1]+states[0]-0.0 - f[1] = algebraic[0]-algebraic[1]-(computed_constants[198]+computed_constants[199]) + f[1] = algebraic[0]-algebraic[1]-(computed_constants[197]+computed_constants[198]) def find_root_0(voi, states, rates, constants, computed_constants, algebraic): @@ -394,18 +402,18 @@ def initialise_variables(states, rates, constants, computed_constants, algebraic constants[4] = 5.0 constants[5] = 6.0 constants[6] = 7.0 - computed_constants[177] = 123.0 - computed_constants[178] = 123.456789 - computed_constants[179] = 123.0e99 - computed_constants[180] = 123.456789e99 - computed_constants[182] = 1.0 - computed_constants[183] = 0.0 - computed_constants[184] = 2.71828182845905 - computed_constants[185] = 3.14159265358979 - computed_constants[186] = inf - computed_constants[187] = nan - computed_constants[198] = 1.0 - computed_constants[199] = 3.0 + computed_constants[176] = 123.0 + computed_constants[177] = 123.456789 + computed_constants[178] = 123.0e99 + computed_constants[179] = 123.456789e99 + computed_constants[181] = 1.0 + computed_constants[182] = 0.0 + computed_constants[183] = 2.71828182845905 + computed_constants[184] = 3.14159265358979 + computed_constants[185] = inf + computed_constants[186] = nan + computed_constants[197] = 1.0 + computed_constants[198] = 3.0 algebraic[0] = 1.0 algebraic[1] = 2.0 @@ -472,138 +480,138 @@ def compute_computed_constants(constants, computed_constants): computed_constants[58] = xor_func(lt_func(constants[0], constants[1]), pow(constants[2], 1.0/constants[3])) computed_constants[59] = constants[0]/xor_func(constants[1], constants[2]) computed_constants[60] = not_func(constants[0]) - computed_constants[61] = constants[0]+constants[1] - computed_constants[62] = constants[0]+constants[1]+constants[2] - computed_constants[63] = lt_func(constants[0], constants[1])+gt_func(constants[2], constants[3]) - computed_constants[64] = constants[0] - computed_constants[65] = constants[0]-constants[1] - computed_constants[66] = lt_func(constants[0], constants[1])-gt_func(constants[2], constants[3]) - computed_constants[67] = lt_func(constants[0], constants[1])-(constants[2]+constants[3]) - computed_constants[68] = lt_func(constants[0], constants[1])-constants[2] - computed_constants[69] = constants[0]-(-constants[1]) - computed_constants[70] = constants[0]-(-constants[1]*constants[2]) - computed_constants[71] = -constants[0] - computed_constants[72] = -lt_func(constants[0], constants[1]) - computed_constants[73] = constants[0]*constants[1] - computed_constants[74] = constants[0]*constants[1]*constants[2] - computed_constants[75] = lt_func(constants[0], constants[1])*gt_func(constants[2], constants[3]) - computed_constants[76] = (constants[0]+constants[1])*gt_func(constants[2], constants[3]) - computed_constants[77] = constants[0]*gt_func(constants[1], constants[2]) - computed_constants[78] = (constants[0]-constants[1])*gt_func(constants[2], constants[3]) - computed_constants[79] = -constants[0]*gt_func(constants[1], constants[2]) - computed_constants[80] = lt_func(constants[0], constants[1])*(constants[2]+constants[3]) - computed_constants[81] = lt_func(constants[0], constants[1])*constants[2] - computed_constants[82] = lt_func(constants[0], constants[1])*(constants[2]-constants[3]) - computed_constants[83] = lt_func(constants[0], constants[1])*-constants[2] - computed_constants[84] = constants[0]/constants[1] - computed_constants[85] = lt_func(constants[0], constants[1])/gt_func(constants[3], constants[2]) - computed_constants[86] = (constants[0]+constants[1])/gt_func(constants[3], constants[2]) - computed_constants[87] = constants[0]/gt_func(constants[2], constants[1]) - computed_constants[88] = (constants[0]-constants[1])/gt_func(constants[3], constants[2]) - computed_constants[89] = -constants[0]/gt_func(constants[2], constants[1]) - computed_constants[90] = lt_func(constants[0], constants[1])/(constants[2]+constants[3]) - computed_constants[91] = lt_func(constants[0], constants[1])/constants[2] - computed_constants[92] = lt_func(constants[0], constants[1])/(constants[2]-constants[3]) - computed_constants[93] = lt_func(constants[0], constants[1])/-constants[2] - computed_constants[94] = lt_func(constants[0], constants[1])/(constants[2]*constants[3]) - computed_constants[95] = lt_func(constants[0], constants[1])/(constants[2]/constants[3]) - computed_constants[96] = sqrt(constants[0]) - computed_constants[97] = pow(constants[0], 2.0) - computed_constants[98] = pow(constants[0], 3.0) - computed_constants[99] = pow(constants[0], constants[1]) - computed_constants[100] = pow(leq_func(constants[0], constants[1]), geq_func(constants[2], constants[3])) - computed_constants[101] = pow(constants[0]+constants[1], geq_func(constants[2], constants[3])) - computed_constants[102] = pow(constants[0], geq_func(constants[1], constants[2])) - computed_constants[103] = pow(constants[0]-constants[1], geq_func(constants[2], constants[3])) - computed_constants[104] = pow(-constants[0], geq_func(constants[1], constants[2])) - computed_constants[105] = pow(constants[0]*constants[1], geq_func(constants[2], constants[3])) - computed_constants[106] = pow(constants[0]/constants[1], geq_func(constants[2], constants[3])) - computed_constants[107] = pow(leq_func(constants[0], constants[1]), constants[2]+constants[3]) - computed_constants[108] = pow(leq_func(constants[0], constants[1]), constants[2]) - computed_constants[109] = pow(leq_func(constants[0], constants[1]), constants[2]-constants[3]) - computed_constants[110] = pow(leq_func(constants[0], constants[1]), -constants[2]) - computed_constants[111] = pow(leq_func(constants[0], constants[1]), constants[2]*constants[3]) - computed_constants[112] = pow(leq_func(constants[0], constants[1]), constants[2]/constants[3]) - computed_constants[113] = pow(leq_func(constants[0], constants[1]), pow(constants[2], constants[3])) - computed_constants[114] = pow(leq_func(constants[0], constants[1]), pow(constants[2], 1.0/constants[3])) + computed_constants[61] = constants[0]+constants[1]+constants[2] + computed_constants[62] = lt_func(constants[0], constants[1])+gt_func(constants[2], constants[3]) + computed_constants[63] = constants[0] + computed_constants[64] = constants[0]-constants[1] + computed_constants[65] = lt_func(constants[0], constants[1])-gt_func(constants[2], constants[3]) + computed_constants[66] = lt_func(constants[0], constants[1])-(constants[2]+constants[3]) + computed_constants[67] = lt_func(constants[0], constants[1])-constants[2] + computed_constants[68] = constants[0]-(-constants[1]) + computed_constants[69] = constants[0]-(-constants[1]*constants[2]) + computed_constants[70] = -constants[0] + computed_constants[71] = -lt_func(constants[0], constants[1]) + computed_constants[72] = constants[0]*constants[1] + computed_constants[73] = constants[0]*constants[1]*constants[2] + computed_constants[74] = lt_func(constants[0], constants[1])*gt_func(constants[2], constants[3]) + computed_constants[75] = (constants[0]+constants[1])*gt_func(constants[2], constants[3]) + computed_constants[76] = constants[0]*gt_func(constants[1], constants[2]) + computed_constants[77] = (constants[0]-constants[1])*gt_func(constants[2], constants[3]) + computed_constants[78] = -constants[0]*gt_func(constants[1], constants[2]) + computed_constants[79] = lt_func(constants[0], constants[1])*(constants[2]+constants[3]) + computed_constants[80] = lt_func(constants[0], constants[1])*constants[2] + computed_constants[81] = lt_func(constants[0], constants[1])*(constants[2]-constants[3]) + computed_constants[82] = lt_func(constants[0], constants[1])*-constants[2] + computed_constants[83] = constants[0]/constants[1] + computed_constants[84] = lt_func(constants[0], constants[1])/gt_func(constants[3], constants[2]) + computed_constants[85] = (constants[0]+constants[1])/gt_func(constants[3], constants[2]) + computed_constants[86] = constants[0]/gt_func(constants[2], constants[1]) + computed_constants[87] = (constants[0]-constants[1])/gt_func(constants[3], constants[2]) + computed_constants[88] = -constants[0]/gt_func(constants[2], constants[1]) + computed_constants[89] = lt_func(constants[0], constants[1])/(constants[2]+constants[3]) + computed_constants[90] = lt_func(constants[0], constants[1])/constants[2] + computed_constants[91] = lt_func(constants[0], constants[1])/(constants[2]-constants[3]) + computed_constants[92] = lt_func(constants[0], constants[1])/-constants[2] + computed_constants[93] = lt_func(constants[0], constants[1])/(constants[2]*constants[3]) + computed_constants[94] = lt_func(constants[0], constants[1])/(constants[2]/constants[3]) + computed_constants[95] = sqrt(constants[0]) + computed_constants[96] = pow(constants[0], 2.0) + computed_constants[97] = pow(constants[0], 3.0) + computed_constants[98] = pow(constants[0], constants[1]) + computed_constants[99] = pow(leq_func(constants[0], constants[1]), geq_func(constants[2], constants[3])) + computed_constants[100] = pow(constants[0]+constants[1], geq_func(constants[2], constants[3])) + computed_constants[101] = pow(constants[0], geq_func(constants[1], constants[2])) + computed_constants[102] = pow(constants[0]-constants[1], geq_func(constants[2], constants[3])) + computed_constants[103] = pow(-constants[0], geq_func(constants[1], constants[2])) + computed_constants[104] = pow(constants[0]*constants[1], geq_func(constants[2], constants[3])) + computed_constants[105] = pow(constants[0]/constants[1], geq_func(constants[2], constants[3])) + computed_constants[106] = pow(leq_func(constants[0], constants[1]), constants[2]+constants[3]) + computed_constants[107] = pow(leq_func(constants[0], constants[1]), constants[2]) + computed_constants[108] = pow(leq_func(constants[0], constants[1]), constants[2]-constants[3]) + computed_constants[109] = pow(leq_func(constants[0], constants[1]), -constants[2]) + computed_constants[110] = pow(leq_func(constants[0], constants[1]), constants[2]*constants[3]) + computed_constants[111] = pow(leq_func(constants[0], constants[1]), constants[2]/constants[3]) + computed_constants[112] = pow(leq_func(constants[0], constants[1]), pow(constants[2], constants[3])) + computed_constants[113] = pow(leq_func(constants[0], constants[1]), pow(constants[2], 1.0/constants[3])) + computed_constants[114] = sqrt(constants[0]) computed_constants[115] = sqrt(constants[0]) - computed_constants[116] = sqrt(constants[0]) - computed_constants[117] = pow(constants[0], 1.0/3.0) - computed_constants[118] = pow(constants[0], 1.0/constants[1]) - computed_constants[119] = pow(lt_func(constants[0], constants[1]), 1.0/gt_func(constants[3], constants[2])) - computed_constants[120] = pow(constants[0]+constants[1], 1.0/gt_func(constants[3], constants[2])) - computed_constants[121] = pow(constants[0], 1.0/gt_func(constants[2], constants[1])) - computed_constants[122] = pow(constants[0]-constants[1], 1.0/gt_func(constants[3], constants[2])) - computed_constants[123] = pow(-constants[0], 1.0/gt_func(constants[2], constants[1])) - computed_constants[124] = pow(constants[0]*constants[1], 1.0/gt_func(constants[3], constants[2])) - computed_constants[125] = pow(constants[0]/constants[1], 1.0/gt_func(constants[3], constants[2])) - computed_constants[126] = pow(lt_func(constants[0], constants[1]), 1.0/(constants[2]+constants[3])) - computed_constants[127] = pow(lt_func(constants[0], constants[1]), 1.0/constants[2]) - computed_constants[128] = pow(lt_func(constants[0], constants[1]), 1.0/(constants[2]-constants[3])) - computed_constants[129] = pow(lt_func(constants[0], constants[1]), 1.0/-constants[2]) - computed_constants[130] = pow(lt_func(constants[0], constants[1]), 1.0/(constants[2]*constants[3])) - computed_constants[131] = pow(lt_func(constants[0], constants[1]), 1.0/(constants[2]/constants[3])) - computed_constants[132] = pow(lt_func(constants[0], constants[1]), 1.0/pow(constants[2], constants[3])) - computed_constants[133] = pow(lt_func(constants[0], constants[1]), 1.0/pow(constants[2], 1.0/constants[3])) - computed_constants[134] = fabs(constants[0]) - computed_constants[135] = exp(constants[0]) - computed_constants[136] = log(constants[0]) - computed_constants[137] = log10(constants[0]) - computed_constants[138] = log(constants[0])/log(2.0) - computed_constants[139] = log10(constants[0]) - computed_constants[140] = log(constants[0])/log(constants[1]) - computed_constants[141] = ceil(constants[0]) - computed_constants[142] = floor(constants[0]) - computed_constants[143] = min(constants[0], constants[1]) - computed_constants[144] = min(constants[0], min(constants[1], constants[2])) - computed_constants[145] = max(constants[0], constants[1]) - computed_constants[146] = max(constants[0], max(constants[1], constants[2])) - computed_constants[147] = fmod(constants[0], constants[1]) - computed_constants[148] = sin(constants[0]) - computed_constants[149] = cos(constants[0]) - computed_constants[150] = tan(constants[0]) - computed_constants[151] = sec(constants[0]) - computed_constants[152] = csc(constants[0]) - computed_constants[153] = cot(constants[0]) - computed_constants[154] = sinh(constants[0]) - computed_constants[155] = cosh(constants[0]) - computed_constants[156] = tanh(constants[0]) - computed_constants[157] = sech(constants[0]) - computed_constants[158] = csch(constants[0]) - computed_constants[159] = coth(constants[0]) - computed_constants[160] = asin(constants[0]) - computed_constants[161] = acos(constants[0]) - computed_constants[162] = atan(constants[0]) - computed_constants[163] = asec(constants[0]) - computed_constants[164] = acsc(constants[0]) - computed_constants[165] = acot(constants[0]) - computed_constants[166] = asinh(constants[0]) - computed_constants[167] = acosh(constants[0]) - computed_constants[168] = atanh(constants[0]/2.0) - computed_constants[169] = asech(constants[0]) - computed_constants[170] = acsch(constants[0]) - computed_constants[171] = acoth(2.0*constants[0]) - computed_constants[172] = constants[0] if gt_func(constants[0], constants[1]) else nan - computed_constants[173] = constants[0] if gt_func(constants[0], constants[1]) else constants[2] - computed_constants[174] = constants[0] if gt_func(constants[0], constants[1]) else constants[2] if gt_func(constants[2], constants[3]) else constants[4] if gt_func(constants[4], constants[5]) else nan - computed_constants[175] = constants[0] if gt_func(constants[0], constants[1]) else constants[2] if gt_func(constants[2], constants[3]) else constants[4] if gt_func(constants[4], constants[5]) else constants[6] - computed_constants[176] = 123.0+(constants[0] if gt_func(constants[0], constants[1]) else nan) - computed_constants[181] = constants[0] - computed_constants[188] = and_func(constants[0], constants[1])+(constants[1] if gt_func(constants[2], constants[3]) else nan)+constants[4]+and_func(constants[5], constants[6]) - computed_constants[189] = and_func(constants[0], constants[1])-((constants[1] if gt_func(constants[2], constants[3]) else nan)-(constants[4]-(constants[1] if gt_func(constants[2], constants[3]) else nan)))-and_func(constants[5], constants[6]) - computed_constants[190] = and_func(constants[0], constants[1])*(constants[1] if gt_func(constants[2], constants[3]) else nan)*constants[4]*(constants[1] if gt_func(constants[2], constants[3]) else nan)*and_func(constants[5], constants[6]) - computed_constants[191] = and_func(constants[0], constants[1])/((constants[1] if gt_func(constants[2], constants[3]) else nan)/(constants[4]/(constants[1] if gt_func(constants[2], constants[3]) else nan))) - computed_constants[192] = and_func(or_func(constants[0], constants[1]), and_func(xor_func(constants[0], constants[1]), and_func(constants[1] if gt_func(constants[2], constants[3]) else nan, and_func(and_func(and_func(constants[4], constants[1] if gt_func(constants[2], constants[3]) else nan), xor_func(constants[0], constants[1])), or_func(constants[0], constants[1]))))) - computed_constants[193] = or_func(and_func(constants[0], constants[1]), or_func(xor_func(constants[0], constants[1]), or_func(constants[1] if gt_func(constants[2], constants[3]) else nan, or_func(or_func(or_func(constants[4], constants[1] if gt_func(constants[2], constants[3]) else nan), xor_func(constants[0], constants[1])), and_func(constants[0], constants[1]))))) - computed_constants[194] = xor_func(and_func(constants[0], constants[1]), xor_func(or_func(constants[0], constants[1]), xor_func(constants[1] if gt_func(constants[2], constants[3]) else nan, xor_func(xor_func(xor_func(constants[4], constants[1] if gt_func(constants[2], constants[3]) else nan), or_func(constants[0], constants[1])), and_func(constants[0], constants[1]))))) - computed_constants[195] = pow(and_func(constants[0], constants[1]), pow(constants[1] if gt_func(constants[2], constants[3]) else nan, pow(pow(constants[4], constants[1] if gt_func(constants[2], constants[3]) else nan), and_func(constants[0], constants[1])))) - computed_constants[196] = pow(pow(pow(and_func(constants[0], constants[1]), 1.0/pow(constants[1] if gt_func(constants[2], constants[3]) else nan, 1.0/constants[4])), 1.0/(constants[1] if gt_func(constants[2], constants[3]) else nan)), 1.0/and_func(constants[0], constants[1])) - computed_constants[197] = -and_func(constants[0], constants[1])+-(constants[1] if gt_func(constants[2], constants[3]) else nan) - - -def compute_rates(voi, states, rates, constants, computed_constants, algebraic): + computed_constants[116] = pow(constants[0], 1.0/3.0) + computed_constants[117] = pow(constants[0], 1.0/constants[1]) + computed_constants[118] = pow(lt_func(constants[0], constants[1]), 1.0/gt_func(constants[3], constants[2])) + computed_constants[119] = pow(constants[0]+constants[1], 1.0/gt_func(constants[3], constants[2])) + computed_constants[120] = pow(constants[0], 1.0/gt_func(constants[2], constants[1])) + computed_constants[121] = pow(constants[0]-constants[1], 1.0/gt_func(constants[3], constants[2])) + computed_constants[122] = pow(-constants[0], 1.0/gt_func(constants[2], constants[1])) + computed_constants[123] = pow(constants[0]*constants[1], 1.0/gt_func(constants[3], constants[2])) + computed_constants[124] = pow(constants[0]/constants[1], 1.0/gt_func(constants[3], constants[2])) + computed_constants[125] = pow(lt_func(constants[0], constants[1]), 1.0/(constants[2]+constants[3])) + computed_constants[126] = pow(lt_func(constants[0], constants[1]), 1.0/constants[2]) + computed_constants[127] = pow(lt_func(constants[0], constants[1]), 1.0/(constants[2]-constants[3])) + computed_constants[128] = pow(lt_func(constants[0], constants[1]), 1.0/-constants[2]) + computed_constants[129] = pow(lt_func(constants[0], constants[1]), 1.0/(constants[2]*constants[3])) + computed_constants[130] = pow(lt_func(constants[0], constants[1]), 1.0/(constants[2]/constants[3])) + computed_constants[131] = pow(lt_func(constants[0], constants[1]), 1.0/pow(constants[2], constants[3])) + computed_constants[132] = pow(lt_func(constants[0], constants[1]), 1.0/pow(constants[2], 1.0/constants[3])) + computed_constants[133] = fabs(constants[0]) + computed_constants[134] = exp(constants[0]) + computed_constants[135] = log(constants[0]) + computed_constants[136] = log10(constants[0]) + computed_constants[137] = log(constants[0])/log(2.0) + computed_constants[138] = log10(constants[0]) + computed_constants[139] = log(constants[0])/log(constants[1]) + computed_constants[140] = ceil(constants[0]) + computed_constants[141] = floor(constants[0]) + computed_constants[142] = min(constants[0], constants[1]) + computed_constants[143] = min(constants[0], min(constants[1], constants[2])) + computed_constants[144] = max(constants[0], constants[1]) + computed_constants[145] = max(constants[0], max(constants[1], constants[2])) + computed_constants[146] = fmod(constants[0], constants[1]) + computed_constants[147] = sin(constants[0]) + computed_constants[148] = cos(constants[0]) + computed_constants[149] = tan(constants[0]) + computed_constants[150] = sec(constants[0]) + computed_constants[151] = csc(constants[0]) + computed_constants[152] = cot(constants[0]) + computed_constants[153] = sinh(constants[0]) + computed_constants[154] = cosh(constants[0]) + computed_constants[155] = tanh(constants[0]) + computed_constants[156] = sech(constants[0]) + computed_constants[157] = csch(constants[0]) + computed_constants[158] = coth(constants[0]) + computed_constants[159] = asin(constants[0]) + computed_constants[160] = acos(constants[0]) + computed_constants[161] = atan(constants[0]) + computed_constants[162] = asec(constants[0]) + computed_constants[163] = acsc(constants[0]) + computed_constants[164] = acot(constants[0]) + computed_constants[165] = asinh(constants[0]) + computed_constants[166] = acosh(constants[0]) + computed_constants[167] = atanh(constants[0]/2.0) + computed_constants[168] = asech(constants[0]) + computed_constants[169] = acsch(constants[0]) + computed_constants[170] = acoth(2.0*constants[0]) + computed_constants[171] = constants[0] if gt_func(constants[0], constants[1]) else nan + computed_constants[172] = constants[0] if gt_func(constants[0], constants[1]) else constants[2] + computed_constants[173] = constants[0] if gt_func(constants[0], constants[1]) else constants[2] if gt_func(constants[2], constants[3]) else constants[4] if gt_func(constants[4], constants[5]) else nan + computed_constants[174] = constants[0] if gt_func(constants[0], constants[1]) else constants[2] if gt_func(constants[2], constants[3]) else constants[4] if gt_func(constants[4], constants[5]) else constants[6] + computed_constants[175] = 123.0+(constants[0] if gt_func(constants[0], constants[1]) else nan) + computed_constants[180] = constants[0] + computed_constants[187] = and_func(constants[0], constants[1])+(constants[1] if gt_func(constants[2], constants[3]) else nan)+constants[4]+and_func(constants[5], constants[6]) + computed_constants[188] = and_func(constants[0], constants[1])-((constants[1] if gt_func(constants[2], constants[3]) else nan)-(constants[4]-(constants[1] if gt_func(constants[2], constants[3]) else nan)))-and_func(constants[5], constants[6]) + computed_constants[189] = and_func(constants[0], constants[1])*(constants[1] if gt_func(constants[2], constants[3]) else nan)*constants[4]*(constants[1] if gt_func(constants[2], constants[3]) else nan)*and_func(constants[5], constants[6]) + computed_constants[190] = and_func(constants[0], constants[1])/((constants[1] if gt_func(constants[2], constants[3]) else nan)/(constants[4]/(constants[1] if gt_func(constants[2], constants[3]) else nan))) + computed_constants[191] = and_func(or_func(constants[0], constants[1]), and_func(xor_func(constants[0], constants[1]), and_func(constants[1] if gt_func(constants[2], constants[3]) else nan, and_func(and_func(and_func(constants[4], constants[1] if gt_func(constants[2], constants[3]) else nan), xor_func(constants[0], constants[1])), or_func(constants[0], constants[1]))))) + computed_constants[192] = or_func(and_func(constants[0], constants[1]), or_func(xor_func(constants[0], constants[1]), or_func(constants[1] if gt_func(constants[2], constants[3]) else nan, or_func(or_func(or_func(constants[4], constants[1] if gt_func(constants[2], constants[3]) else nan), xor_func(constants[0], constants[1])), and_func(constants[0], constants[1]))))) + computed_constants[193] = xor_func(and_func(constants[0], constants[1]), xor_func(or_func(constants[0], constants[1]), xor_func(constants[1] if gt_func(constants[2], constants[3]) else nan, xor_func(xor_func(xor_func(constants[4], constants[1] if gt_func(constants[2], constants[3]) else nan), or_func(constants[0], constants[1])), and_func(constants[0], constants[1]))))) + computed_constants[194] = pow(and_func(constants[0], constants[1]), pow(constants[1] if gt_func(constants[2], constants[3]) else nan, pow(pow(constants[4], constants[1] if gt_func(constants[2], constants[3]) else nan), and_func(constants[0], constants[1])))) + computed_constants[195] = pow(pow(pow(and_func(constants[0], constants[1]), 1.0/pow(constants[1] if gt_func(constants[2], constants[3]) else nan, 1.0/constants[4])), 1.0/(constants[1] if gt_func(constants[2], constants[3]) else nan)), 1.0/and_func(constants[0], constants[1])) + computed_constants[196] = -and_func(constants[0], constants[1])+-(constants[1] if gt_func(constants[2], constants[3]) else nan) + + +def compute_rates(voi, states, rates, constants, computed_constants, algebraic, externals, external_variable): rates[0] = 1.0 -def compute_variables(voi, states, rates, constants, computed_constants, algebraic): +def compute_variables(voi, states, rates, constants, computed_constants, algebraic, externals, external_variable): + externals[0] = external_variable(voi, states, rates, constants, computed_constants, algebraic, externals, 0) find_root_0(voi, states, rates, constants, computed_constants, algebraic) From 68ad0fc67712b50b003cd9c3ced68d38982bc547 Mon Sep 17 00:00:00 2001 From: Alan Garny Date: Wed, 28 Aug 2024 17:22:19 +0200 Subject: [PATCH 48/85] Some minor cleaning up. --- src/analyser.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/analyser.cpp b/src/analyser.cpp index e1a3ca780f..6597ba0afd 100644 --- a/src/analyser.cpp +++ b/src/analyser.cpp @@ -906,21 +906,20 @@ void Analyser::AnalyserImpl::analyseComponentVariables(const ComponentPtr &compo if ((variable != internalVariable->mVariable) && !variable->initialValue().empty()) { auto issue = Issue::IssueImpl::create(); - auto trackedVariableComponent = owningComponent(internalVariable->mVariable); issue->mPimpl->setDescription("Variable '" + variable->name() + "' in component '" + component->name() + "' and variable '" + internalVariable->mVariable->name() - + "' in component '" + trackedVariableComponent->name() + + "' in component '" + owningComponent(internalVariable->mVariable)->name() + "' are equivalent and cannot therefore both be initialised."); issue->mPimpl->setReferenceRule(Issue::ReferenceRule::ANALYSER_VARIABLE_INITIALISED_MORE_THAN_ONCE); issue->mPimpl->mItem->mPimpl->setVariable(variable); addIssue(issue); - } else if (!internalVariable->mVariable->initialValue().empty() - && !isCellMLReal(internalVariable->mVariable->initialValue())) { - auto initialisingComponent = owningComponent(internalVariable->mVariable); - auto initialisingVariable = initialisingComponent->variable(internalVariable->mVariable->initialValue()); + } else if (!variable->initialValue().empty() + && !isCellMLReal(variable->initialValue())) { + auto initialisingComponent = owningComponent(variable); + auto initialisingVariable = initialisingComponent->variable(variable->initialValue()); auto initialisingInternalVariable = Analyser::AnalyserImpl::internalVariable(initialisingVariable); if (initialisingInternalVariable->mType != AnalyserInternalVariable::Type::INITIALISED) { @@ -928,7 +927,7 @@ void Analyser::AnalyserImpl::analyseComponentVariables(const ComponentPtr &compo issue->mPimpl->setDescription("Variable '" + variable->name() + "' in component '" + component->name() - + "' is initialised using variable '" + internalVariable->mVariable->initialValue() + + "' is initialised using variable '" + variable->initialValue() + "', which is not a constant."); issue->mPimpl->setReferenceRule(Issue::ReferenceRule::ANALYSER_VARIABLE_NON_CONSTANT_INITIALISATION); issue->mPimpl->mItem->mPimpl->setVariable(variable); From ff5a1a2ea50f98de06e62792ee408582591adae4 Mon Sep 17 00:00:00 2001 From: Alan Garny Date: Tue, 27 Aug 2024 18:24:46 +0200 Subject: [PATCH 49/85] Analyser: improved unit scaling. --- src/analyser.cpp | 19 +- src/generator.cpp | 76 +++++--- src/generator_p.h | 2 + tests/generator/generator.cpp | 7 +- .../cellml_unit_scaling_constant/model.c | 48 +++++- .../cellml_unit_scaling_constant/model.cellml | 163 ++++++++++++++++-- .../cellml_unit_scaling_constant/model.h | 4 +- .../cellml_unit_scaling_constant/model.py | 48 +++++- 8 files changed, 307 insertions(+), 60 deletions(-) diff --git a/src/analyser.cpp b/src/analyser.cpp index 6597ba0afd..07e3d71032 100644 --- a/src/analyser.cpp +++ b/src/analyser.cpp @@ -918,8 +918,7 @@ void Analyser::AnalyserImpl::analyseComponentVariables(const ComponentPtr &compo addIssue(issue); } else if (!variable->initialValue().empty() && !isCellMLReal(variable->initialValue())) { - auto initialisingComponent = owningComponent(variable); - auto initialisingVariable = initialisingComponent->variable(variable->initialValue()); + auto initialisingVariable = owningComponent(variable)->variable(variable->initialValue()); auto initialisingInternalVariable = Analyser::AnalyserImpl::internalVariable(initialisingVariable); if (initialisingInternalVariable->mType != AnalyserInternalVariable::Type::INITIALISED) { @@ -933,6 +932,22 @@ void Analyser::AnalyserImpl::analyseComponentVariables(const ComponentPtr &compo issue->mPimpl->mItem->mPimpl->setVariable(variable); addIssue(issue); + } else { + auto scalingFactor = Units::scalingFactor(variable->units(), initialisingVariable->units()); + + if (!areNearlyEqual(scalingFactor, 1.0)) { + auto issue = Issue::IssueImpl::create(); + + issue->mPimpl->setDescription("Variable '" + variable->name() + + "' in component '" + component->name() + + "' is initialised using variable '" + variable->initialValue() + + "' which has different units."); + issue->mPimpl->setLevel(Issue::Level::WARNING); + issue->mPimpl->setReferenceRule(Issue::ReferenceRule::ANALYSER_VARIABLE_NON_CONSTANT_INITIALISATION); + issue->mPimpl->mItem->mPimpl->setVariable(variable); + + addIssue(issue); + } } } } diff --git a/src/generator.cpp b/src/generator.cpp index ac689f9058..9483d58690 100644 --- a/src/generator.cpp +++ b/src/generator.cpp @@ -106,9 +106,22 @@ AnalyserVariablePtr Generator::GeneratorImpl::analyserVariable(const VariablePtr double Generator::GeneratorImpl::scalingFactor(const VariablePtr &variable) const { - // Return the scaling factor for the given variable. + // Return the scaling factor for the given variable, accounting for the fact that a constant may be initialised by + // another variable which initial value may be defined in a different component. - return Units::scalingFactor(variable->units(), analyserVariable(variable)->variable()->units()); + auto analyserVariable = Generator::GeneratorImpl::analyserVariable(variable); + + if ((analyserVariable->type() == AnalyserVariable::Type::CONSTANT) + && !isCellMLReal(variable->initialValue())) { + auto initialValueVariable = owningComponent(variable)->variable(variable->initialValue()); + auto initialValueAnalyserVariable = Generator::GeneratorImpl::analyserVariable(initialValueVariable); + + if (owningComponent(variable) != owningComponent(initialValueAnalyserVariable->variable())) { + return Units::scalingFactor(initialValueVariable->units(), variable->units()); + } + } + + return Units::scalingFactor(analyserVariable->variable()->units(), variable->units()); } bool Generator::GeneratorImpl::isNegativeNumber(const AnalyserEquationAstPtr &ast) const @@ -882,8 +895,8 @@ std::string Generator::GeneratorImpl::generateDoubleOrConstantVariableNameCode(c return generateDoubleCode(variable->initialValue()); } - auto initValueVariable = owningComponent(variable)->variable(variable->initialValue()); - auto analyserInitialValueVariable = analyserVariable(initValueVariable); + auto initialValueVariable = owningComponent(variable)->variable(variable->initialValue()); + auto analyserInitialValueVariable = analyserVariable(initialValueVariable); return mProfile->constantsArrayString() + mProfile->openArrayString() + convertToString(analyserInitialValueVariable->index()) + mProfile->closeArrayString(); } @@ -1687,7 +1700,7 @@ std::string Generator::GeneratorImpl::generateInitialisationCode(const AnalyserV std::string scalingFactorCode; if (!areNearlyEqual(scalingFactor, 1.0)) { - scalingFactorCode = generateDoubleCode(convertToString(1.0 / scalingFactor)) + mProfile->timesString(); + scalingFactorCode = generateDoubleCode(convertToString(scalingFactor)) + mProfile->timesString(); } return mProfile->indentString() @@ -1803,6 +1816,31 @@ void Generator::GeneratorImpl::addInterfaceComputeModelMethodsCode() } } +std::string Generator::GeneratorImpl::generateConstantInitialisationCode(const std::vector::iterator constant, + std::vector &remainingConstants) +{ + auto initialisingVariable = (*constant)->initialisingVariable(); + auto initialValue = initialisingVariable->initialValue(); + + if (!isCellMLReal(initialValue)) { + auto initialisingComponent = owningComponent(initialisingVariable); + auto crtConstant = std::find_if(remainingConstants.begin(), remainingConstants.end(), + [=](const AnalyserVariablePtr &av) -> bool { + return initialisingComponent->variable(initialValue) == av->variable(); + }); + + if (crtConstant != remainingConstants.end()) { + return generateConstantInitialisationCode(crtConstant, remainingConstants); + } + } + + auto code = generateInitialisationCode(*constant); + + remainingConstants.erase(constant); + + return code; +} + void Generator::GeneratorImpl::addImplementationInitialiseVariablesMethodCode(std::vector &remainingEquations) { auto implementationInitialiseVariablesMethodString = mProfile->implementationInitialiseVariablesMethodString(modelHasOdes()); @@ -1816,25 +1854,17 @@ void Generator::GeneratorImpl::addImplementationInitialiseVariablesMethodCode(st for (const auto &state : mModel->states()) { auto initialisingVariable = state->initialisingVariable(); auto initialValue = initialisingVariable->initialValue(); - auto constant = constants.end(); - while (!isCellMLReal(initialValue)) { - // The initial value references another variable, so look for it keeping in mind that its initial value may - // reference another variable, and so on. + if (!isCellMLReal(initialValue)) { + // The initial value references a constant. auto initialisingComponent = owningComponent(initialisingVariable); - auto crtConstant = std::find_if(constants.begin(), constants.end(), - [=](const AnalyserVariablePtr &av) -> bool { return initialisingComponent->variable(initialValue)->hasEquivalentVariable(av->variable()); }); - - constant = crtConstant; - initialisingVariable = (*constant)->variable(); - initialValue = initialisingVariable->initialValue(); - } - - if (constant != constants.end()) { - methodBody += generateInitialisationCode(*constant); + auto constant = std::find_if(constants.begin(), constants.end(), + [=](const AnalyserVariablePtr &av) -> bool { + return initialisingComponent->variable(initialValue)->hasEquivalentVariable(av->variable()); + }); - constants.erase(constant); + methodBody += generateConstantInitialisationCode(constant, constants); } methodBody += generateInitialisationCode(state); @@ -1849,10 +1879,10 @@ void Generator::GeneratorImpl::addImplementationInitialiseVariablesMethodCode(st } } - // Initialise our constants. + // Initialise our (remaining) constants. - for (const auto &constant : constants) { - methodBody += generateInitialisationCode(constant); + while (!constants.empty()) { + methodBody += generateConstantInitialisationCode(constants.begin(), constants); } // Initialise our computed constants that are initialised using an equation (e.g., x = 3 rather than x with an diff --git a/src/generator_p.h b/src/generator_p.h index 8e4308c9cc..d85e8e2f44 100644 --- a/src/generator_p.h +++ b/src/generator_p.h @@ -138,6 +138,8 @@ struct Generator::GeneratorImpl std::vector &remainingEquations); void addInterfaceComputeModelMethodsCode(); + std::string generateConstantInitialisationCode(const std::vector::iterator constant, + std::vector &remainingConstants); void addImplementationInitialiseVariablesMethodCode(std::vector &remainingEquations); void addImplementationComputeComputedConstantsMethodCode(std::vector &remainingEquations); void addImplementationComputeRatesMethodCode(std::vector &remainingEquations); diff --git a/tests/generator/generator.cpp b/tests/generator/generator.cpp index 1808a8d52c..e6e327a4a3 100644 --- a/tests/generator/generator.cpp +++ b/tests/generator/generator.cpp @@ -889,9 +889,14 @@ TEST(Generator, cellmlUnitScalingConstant) auto analyser = libcellml::Analyser::create(); + const std::vector expectedIssues = { + "Variable 'c_M' in component 'constants' is initialised using variable 'c' which has different units.", + "Variable 'oc_mM' in component 'other_constants' is initialised using variable 'c' which has different units.", + }; + analyser->analyseModel(model); - EXPECT_EQ(size_t(0), analyser->errorCount()); + EXPECT_EQ_ISSUES(expectedIssues, analyser); auto analyserModel = analyser->model(); auto generator = libcellml::Generator::create(); diff --git a/tests/resources/generator/cellml_unit_scaling_constant/model.c b/tests/resources/generator/cellml_unit_scaling_constant/model.c index 3d259be889..4b9bc87bc2 100644 --- a/tests/resources/generator/cellml_unit_scaling_constant/model.c +++ b/tests/resources/generator/cellml_unit_scaling_constant/model.c @@ -8,17 +8,33 @@ const char VERSION[] = "0.6.0"; const char LIBCELLML_VERSION[] = "0.5.0"; -const size_t CONSTANT_COUNT = 1; -const size_t COMPUTED_CONSTANT_COUNT = 2; +const size_t CONSTANT_COUNT = 9; +const size_t COMPUTED_CONSTANT_COUNT = 10; const size_t ALGEBRAIC_COUNT = 0; const VariableInfo CONSTANT_INFO[] = { - {"k", "mM", "constants"} + {"ind_c_mM", "mM", "constants"}, + {"c_mM", "mM", "constants"}, + {"c", "mM", "constants"}, + {"c_M", "M", "constants"}, + {"ind_c_M", "M", "constants"}, + {"ind_oc_mM", "mM", "other_constants"}, + {"oc_mM", "mM", "other_constants"}, + {"oc_M", "M", "other_constants"}, + {"ind_oc_M", "M", "other_constants"} }; const VariableInfo COMPUTED_CONSTANT_INFO[] = { - {"x", "mM", "main"}, - {"y", "M", "main"} + {"comp_c_mM_mM", "mM", "main"}, + {"comp_c_mM_M", "M", "main"}, + {"comp_c_M_mM", "mM", "main"}, + {"comp_c_M_M", "M", "main"}, + {"comp_k_mM", "mM", "main"}, + {"comp_k_M", "M", "main"}, + {"comp_oc_mM_mM", "mM", "main"}, + {"comp_oc_mM_M", "M", "main"}, + {"comp_oc_M_mM", "mM", "main"}, + {"comp_oc_M_M", "M", "main"} }; const VariableInfo ALGEBRAIC_INFO[] = { @@ -64,13 +80,29 @@ void deleteArray(double *array) void initialiseVariables(double *constants, double *computedConstants, double *algebraic) { - constants[0] = 123.0; + constants[2] = 123.0; + constants[1] = constants[2]; + constants[0] = constants[1]; + constants[3] = constants[2]; + constants[4] = constants[3]; + constants[6] = 0.001*constants[2]; + constants[5] = constants[6]; + constants[7] = constants[2]; + constants[8] = constants[7]; } void computeComputedConstants(double *constants, double *computedConstants) { - computedConstants[0] = constants[0]+constants[0]; - computedConstants[1] = 0.001*constants[0]+0.001*constants[0]; + computedConstants[0] = constants[1]+constants[0]; + computedConstants[1] = 0.001*constants[1]+0.001*constants[0]; + computedConstants[2] = 1000.0*constants[3]+1000.0*constants[4]; + computedConstants[3] = constants[3]+constants[4]; + computedConstants[4] = constants[2]+constants[2]; + computedConstants[5] = 0.001*constants[2]+0.001*constants[2]; + computedConstants[6] = constants[6]+constants[5]; + computedConstants[7] = 0.001*constants[6]+0.001*constants[5]; + computedConstants[8] = 1000.0*constants[7]+1000.0*constants[8]; + computedConstants[9] = constants[7]+constants[8]; } void computeVariables(double *constants, double *computedConstants, double *algebraic) diff --git a/tests/resources/generator/cellml_unit_scaling_constant/model.cellml b/tests/resources/generator/cellml_unit_scaling_constant/model.cellml index bc52f483e9..08556a82c5 100644 --- a/tests/resources/generator/cellml_unit_scaling_constant/model.cellml +++ b/tests/resources/generator/cellml_unit_scaling_constant/model.cellml @@ -1,8 +1,11 @@ - + @@ -14,36 +17,164 @@ - + + + + + + + + + + + + - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + - x + comp_c_mM_mM + + + c_mM_mM + ind_c_mM_mM + + + + + comp_c_mM_M + + + c_mM_M + ind_c_mM_M + + + + + comp_c_M_mM - k_x - k_x + c_M_mM + ind_c_M_mM - y + comp_c_M_M - k_y - k_y + c_M_M + ind_c_M_M + + + + + comp_k_mM + + + k_mM + k_mM + + + + + comp_k_M + + + k_M + k_M + + + + + comp_oc_mM_mM + + + oc_mM_mM + ind_oc_mM_mM + + + + + comp_oc_mM_M + + + oc_mM_M + ind_oc_mM_M + + + + + comp_oc_M_mM + + + oc_M_mM + ind_oc_M_mM + + + + + comp_oc_M_M + + + oc_M_M + ind_oc_M_M - - + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/resources/generator/cellml_unit_scaling_constant/model.h b/tests/resources/generator/cellml_unit_scaling_constant/model.h index 1e51b94dde..4ee62c7c60 100644 --- a/tests/resources/generator/cellml_unit_scaling_constant/model.h +++ b/tests/resources/generator/cellml_unit_scaling_constant/model.h @@ -12,9 +12,9 @@ extern const size_t COMPUTED_CONSTANT_COUNT; extern const size_t ALGEBRAIC_COUNT; typedef struct { - char name[2]; + char name[14]; char units[3]; - char component[10]; + char component[16]; } VariableInfo; extern const VariableInfo CONSTANT_INFO[]; diff --git a/tests/resources/generator/cellml_unit_scaling_constant/model.py b/tests/resources/generator/cellml_unit_scaling_constant/model.py index 16717c06e4..b065335d35 100644 --- a/tests/resources/generator/cellml_unit_scaling_constant/model.py +++ b/tests/resources/generator/cellml_unit_scaling_constant/model.py @@ -7,17 +7,33 @@ __version__ = "0.5.0" LIBCELLML_VERSION = "0.5.0" -CONSTANT_COUNT = 1 -COMPUTED_CONSTANT_COUNT = 2 +CONSTANT_COUNT = 9 +COMPUTED_CONSTANT_COUNT = 10 ALGEBRAIC_COUNT = 0 CONSTANT_INFO = [ - {"name": "k", "units": "mM", "component": "constants"} + {"name": "ind_c_mM", "units": "mM", "component": "constants"}, + {"name": "c_mM", "units": "mM", "component": "constants"}, + {"name": "c", "units": "mM", "component": "constants"}, + {"name": "c_M", "units": "M", "component": "constants"}, + {"name": "ind_c_M", "units": "M", "component": "constants"}, + {"name": "ind_oc_mM", "units": "mM", "component": "other_constants"}, + {"name": "oc_mM", "units": "mM", "component": "other_constants"}, + {"name": "oc_M", "units": "M", "component": "other_constants"}, + {"name": "ind_oc_M", "units": "M", "component": "other_constants"} ] COMPUTED_CONSTANT_INFO = [ - {"name": "x", "units": "mM", "component": "main"}, - {"name": "y", "units": "M", "component": "main"} + {"name": "comp_c_mM_mM", "units": "mM", "component": "main"}, + {"name": "comp_c_mM_M", "units": "M", "component": "main"}, + {"name": "comp_c_M_mM", "units": "mM", "component": "main"}, + {"name": "comp_c_M_M", "units": "M", "component": "main"}, + {"name": "comp_k_mM", "units": "mM", "component": "main"}, + {"name": "comp_k_M", "units": "M", "component": "main"}, + {"name": "comp_oc_mM_mM", "units": "mM", "component": "main"}, + {"name": "comp_oc_mM_M", "units": "M", "component": "main"}, + {"name": "comp_oc_M_mM", "units": "mM", "component": "main"}, + {"name": "comp_oc_M_M", "units": "M", "component": "main"} ] ALGEBRAIC_INFO = [ @@ -37,12 +53,28 @@ def create_algebraic_array(): def initialise_variables(constants, computed_constants, algebraic): - constants[0] = 123.0 + constants[2] = 123.0 + constants[1] = constants[2] + constants[0] = constants[1] + constants[3] = constants[2] + constants[4] = constants[3] + constants[6] = 0.001*constants[2] + constants[5] = constants[6] + constants[7] = constants[2] + constants[8] = constants[7] def compute_computed_constants(constants, computed_constants): - computed_constants[0] = constants[0]+constants[0] - computed_constants[1] = 0.001*constants[0]+0.001*constants[0] + computed_constants[0] = constants[1]+constants[0] + computed_constants[1] = 0.001*constants[1]+0.001*constants[0] + computed_constants[2] = 1000.0*constants[3]+1000.0*constants[4] + computed_constants[3] = constants[3]+constants[4] + computed_constants[4] = constants[2]+constants[2] + computed_constants[5] = 0.001*constants[2]+0.001*constants[2] + computed_constants[6] = constants[6]+constants[5] + computed_constants[7] = 0.001*constants[6]+0.001*constants[5] + computed_constants[8] = 1000.0*constants[7]+1000.0*constants[8] + computed_constants[9] = constants[7]+constants[8] def compute_variables(constants, computed_constants, algebraic): From c83f5c7b7aacd85c4cef5c8e6c15ed0fdbe003bd Mon Sep 17 00:00:00 2001 From: Alan Garny Date: Mon, 2 Sep 2024 23:21:04 +1200 Subject: [PATCH 50/85] Some minor cleaning up. --- src/debug.cpp | 8 +++----- src/generator.cpp | 8 +------- tests/bindings/javascript/analysermodel.test.js | 5 +++++ tests/bindings/javascript/analyservariable.test.js | 1 + 4 files changed, 10 insertions(+), 12 deletions(-) diff --git a/src/debug.cpp b/src/debug.cpp index f16c754561..8a7b330e6b 100644 --- a/src/debug.cpp +++ b/src/debug.cpp @@ -29,8 +29,6 @@ limitations under the License. #include "commonutils.h" #include "utilities.h" -#include "libcellml/undefines.h" - namespace libcellml { std::string astAsCode(const AnalyserEquationAstPtr &ast) @@ -116,7 +114,7 @@ void printAnalyserModelEquations(const AnalyserModelPtr &model) Debug() << "\nNo algebraic variables"; } - if (eqn->algebraicCount() != 0) { + if (eqn->externalCount() != 0) { Debug() << "\nExternal variables:"; for (const auto &var : eqn->externals()) { @@ -150,7 +148,7 @@ void printAnalyserModelEquations(const AnalyserModelPtr &model) if (nlaSibling->ast() != nullptr) { Debug() << " - " << astAsCode(nlaSibling->ast()); } else if (nlaSibling->type() == AnalyserEquation::Type::EXTERNAL) { - Debug() << " - External equation for '" << nlaSibling->algebraic(0)->variable()->name() << "'"; + Debug() << " - External equation for '" << nlaSibling->external(0)->variable()->name() << "'"; } else { Debug() << " - ??? [" << AnalyserEquation::typeAsString(nlaSibling->type()) << "]"; } @@ -180,7 +178,7 @@ void printAnalyserModelVariables(const AnalyserModelPtr &model) if (eqn->ast() != nullptr) { Debug() << " - " << astAsCode(eqn->ast()); } else if (eqn->type() == AnalyserEquation::Type::EXTERNAL) { - Debug() << " - External equation for '" << eqn->algebraic(0)->variable()->name() << "'"; + Debug() << " - External equation for '" << eqn->external(0)->variable()->name() << "'"; } else { Debug() << " - ??? [" << AnalyserEquation::typeAsString(eqn->type()) << "]"; } diff --git a/src/generator.cpp b/src/generator.cpp index 9483d58690..38d25b7eef 100644 --- a/src/generator.cpp +++ b/src/generator.cpp @@ -484,11 +484,7 @@ void Generator::GeneratorImpl::doAddImplementationVariableInfoCode(const std::st void Generator::GeneratorImpl::addImplementationVariableInfoCode() { if (modelHasOdes()) { - std::vector variables; - - variables.push_back(mModel->voi()); - - doAddImplementationVariableInfoCode(mProfile->implementationVoiInfoString(), variables, true); + doAddImplementationVariableInfoCode(mProfile->implementationVoiInfoString(), {mModel->voi()}, true); } if (modelHasOdes()) { @@ -496,9 +492,7 @@ void Generator::GeneratorImpl::addImplementationVariableInfoCode() } doAddImplementationVariableInfoCode(mProfile->implementationConstantInfoString(), mModel->constants(), false); - doAddImplementationVariableInfoCode(mProfile->implementationComputedConstantInfoString(), mModel->computedConstants(), false); - doAddImplementationVariableInfoCode(mProfile->implementationAlgebraicInfoString(), mModel->algebraic(), false); if (mModel->hasExternalVariables()) { diff --git a/tests/bindings/javascript/analysermodel.test.js b/tests/bindings/javascript/analysermodel.test.js index 7c5ea9ada0..3fe868c7a7 100644 --- a/tests/bindings/javascript/analysermodel.test.js +++ b/tests/bindings/javascript/analysermodel.test.js @@ -76,6 +76,11 @@ describe("Analyser Model tests", () => { expect(am.algebraicVariables().size()).toBe(10) expect(am.algebraicVariable(2).variable().name()).toBe("i_K") }); + test('Checking Analyser Model external variables related API.', () => { + expect(am.externalCount()).toBe(0) + expect(am.externals().size()).toBe(0) + expect(am.external(0)).toBeNull() + }); test('Checking Analyser Model need* API.', () => { expect(am.needEqFunction()).toBe(false) expect(am.needNeqFunction()).toBe(false) diff --git a/tests/bindings/javascript/analyservariable.test.js b/tests/bindings/javascript/analyservariable.test.js index 8026126561..aa9cbb501f 100644 --- a/tests/bindings/javascript/analyservariable.test.js +++ b/tests/bindings/javascript/analyservariable.test.js @@ -40,6 +40,7 @@ describe("Analyser Variable tests", () => { expect(am.constantCount()).toBe(5) expect(am.computedConstantCount()).toBe(3) expect(am.algebraicCount()).toBe(10) + expect(am.externalCount()).toBe(0) }); test('Checking Analyser Variable type.', () => { const av = am.algebraicVariable(0) From 26ba852409a51cd7f6d94547cf4892c994f0f769 Mon Sep 17 00:00:00 2001 From: Alan Garny Date: Tue, 3 Sep 2024 14:54:34 +1200 Subject: [PATCH 51/85] Generator: make sure that NLA systems have access to external variables. --- src/api/libcellml/generatorprofile.h | 32 +- src/generator.cpp | 16 +- src/generatorprofile.cpp | 332 +++++++++++++----- src/generatorprofile_p.h | 40 ++- src/generatorprofilesha1values.h | 4 +- src/generatorprofiletools.cpp | 24 +- .../javascript/generatorprofile.test.js | 56 ++- .../bindings/python/test_generator_profile.py | 80 +++-- tests/coverage/coverage.cpp | 36 +- tests/generator/generatorprofile.cpp | 141 ++++++-- tests/resources/coverage/generator/model.c | 7 +- .../generator/model.implementation.out | 7 +- .../generator/model.modified.profile.c | 7 +- .../generator/model.modified.profile.py | 7 +- tests/resources/coverage/generator/model.out | 5 +- tests/resources/coverage/generator/model.py | 7 +- .../model.py | 1 + .../model.py | 1 + .../model.not.ordered.py | 1 + .../model.ordered.py | 1 + 20 files changed, 575 insertions(+), 230 deletions(-) diff --git a/src/api/libcellml/generatorprofile.h b/src/api/libcellml/generatorprofile.h index 12e14cc260..8608cc8d8c 100644 --- a/src/api/libcellml/generatorprofile.h +++ b/src/api/libcellml/generatorprofile.h @@ -3266,10 +3266,13 @@ class LIBCELLML_EXPORT GeneratorProfile * * @param forDifferentialModel Whether the call to the find root method is * for a differential model, as opposed to an algebraic model. + * @param withExternalVariables Whether the call to the find root method is + * for a model with external variables. * * @return The @c std::string for the call to the find root method. */ - std::string findRootCallString(bool forDifferentialModel) const; + std::string findRootCallString(bool forDifferentialModel, + bool withExternalVariables) const; /** * @brief Set the @c std::string for the call to the find root method. @@ -3280,10 +3283,13 @@ class LIBCELLML_EXPORT GeneratorProfile * * @param forDifferentialModel Whether the call to the find root method is * for a differential model, as opposed to an algebraic model. + * @param withExternalVariables Whether the call to the find root method is + * for a model with external variables. * @param findRootCallString The @c std::string to use for the call to the * find root method. */ void setFindRootCallString(bool forDifferentialModel, + bool withExternalVariables, const std::string &findRootCallString); /** @@ -3293,10 +3299,13 @@ class LIBCELLML_EXPORT GeneratorProfile * * @param forDifferentialModel Whether the call to the find root method is * for a differential model, as opposed to an algebraic model. + * @param withExternalVariables Whether the call to the find root method is + * for a model with external variables. * * @return The @c std::string for the find root method. */ - std::string findRootMethodString(bool forDifferentialModel) const; + std::string findRootMethodString(bool forDifferentialModel, + bool withExternalVariables) const; /** * @brief Set the @c std::string for the find root method. @@ -3311,10 +3320,13 @@ class LIBCELLML_EXPORT GeneratorProfile * * @param forDifferentialModel Whether the call to the find root method is * for a differential model, as opposed to an algebraic model. + * @param withExternalVariables Whether the call to the find root method is + * for a model with external variables. * @param findRootMethodString The @c std::string to use for the find root * method. */ void setFindRootMethodString(bool forDifferentialModel, + bool withExternalVariables, const std::string &findRootMethodString); /** @@ -3324,10 +3336,13 @@ class LIBCELLML_EXPORT GeneratorProfile * * @param forDifferentialModel Whether the call to the NLA solve method is * for a differential model, as opposed to an algebraic model. + * @param withExternalVariables Whether the call to the NLA solve method is + * for a model with external variables. * * @return The @c std::string for the call to the NLA solve method. */ - std::string nlaSolveCallString(bool forDifferentialModel) const; + std::string nlaSolveCallString(bool forDifferentialModel, + bool withExternalVariables) const; /** * @brief Set the @c std::string for the call to the NLA solve method. @@ -3341,10 +3356,13 @@ class LIBCELLML_EXPORT GeneratorProfile * * @param forDifferentialModel Whether the call to the NLA solve method is * for a differential model, as opposed to an algebraic model. + * @param withExternalVariables Whether the call to the NLA solve method is + * for a model with external variables. * @param nlaSolveCallString The @c std::string to use for the call to the * NLA solve method. */ void setNlaSolveCallString(bool forDifferentialModel, + bool withExternalVariables, const std::string &nlaSolveCallString); /** @@ -3354,10 +3372,13 @@ class LIBCELLML_EXPORT GeneratorProfile * * @param forDifferentialModel Whether the call to the objective function * method is for a differential model, as opposed to an algebraic model. + * @param withExternalVariables Whether the call to the objective function + * method is for a model with external variables. * * @return The @c std::string for the objective function method. */ - std::string objectiveFunctionMethodString(bool forDifferentialModel) const; + std::string objectiveFunctionMethodString(bool forDifferentialModel, + bool withExternalVariables) const; /** * @brief Set the @c std::string for the objective function method. @@ -3369,10 +3390,13 @@ class LIBCELLML_EXPORT GeneratorProfile * * @param forDifferentialModel Whether the call to the objective function * method is for a differential model, as opposed to an algebraic model. + * @param withExternalVariables Whether the call to the objective function + * method is for a model with external variables. * @param objectiveFunctionMethodString The @c std::string to use for the * objective function method. */ void setObjectiveFunctionMethodString(bool forDifferentialModel, + bool withExternalVariables, const std::string &objectiveFunctionMethodString); /** diff --git a/src/generator.cpp b/src/generator.cpp index 38d25b7eef..c8ce8d87c3 100644 --- a/src/generator.cpp +++ b/src/generator.cpp @@ -755,9 +755,9 @@ void Generator::GeneratorImpl::addExternNlaSolveMethodCode() void Generator::GeneratorImpl::addNlaSystemsCode() { if (modelHasNlas() - && !mProfile->objectiveFunctionMethodString(modelHasOdes()).empty() - && !mProfile->findRootMethodString(modelHasOdes()).empty() - && !mProfile->nlaSolveCallString(modelHasOdes()).empty()) { + && !mProfile->objectiveFunctionMethodString(modelHasOdes(), mModel->hasExternalVariables()).empty() + && !mProfile->findRootMethodString(modelHasOdes(), mModel->hasExternalVariables()).empty() + && !mProfile->nlaSolveCallString(modelHasOdes(), mModel->hasExternalVariables()).empty()) { // Note: only states and algebraic variables can be computed through an NLA system. Constants, computed // constants, and external variables cannot, by definition, be computed through an NLA system. @@ -805,7 +805,7 @@ void Generator::GeneratorImpl::addNlaSystemsCode() } mCode += newLineIfNeeded() - + replace(replace(mProfile->objectiveFunctionMethodString(modelHasOdes()), + + replace(replace(mProfile->objectiveFunctionMethodString(modelHasOdes(), mModel->hasExternalVariables()), "[INDEX]", convertToString(equation->nlaSystemIndex())), "[CODE]", generateMethodBodyCode(methodBody)); @@ -829,7 +829,7 @@ void Generator::GeneratorImpl::addNlaSystemsCode() methodBody += newLineIfNeeded() + mProfile->indentString() - + replace(replace(mProfile->nlaSolveCallString(modelHasOdes()), + + replace(replace(mProfile->nlaSolveCallString(modelHasOdes(), mModel->hasExternalVariables()), "[INDEX]", convertToString(equation->nlaSystemIndex())), "[SIZE]", convertToString(variablesCount)); @@ -850,7 +850,7 @@ void Generator::GeneratorImpl::addNlaSystemsCode() } mCode += newLineIfNeeded() - + replace(replace(replace(mProfile->findRootMethodString(modelHasOdes()), + + replace(replace(replace(mProfile->findRootMethodString(modelHasOdes(), mModel->hasExternalVariables()), "[INDEX]", convertToString(equation->nlaSystemIndex())), "[SIZE]", convertToString(variablesCount)), "[CODE]", generateMethodBodyCode(methodBody)); @@ -1752,9 +1752,9 @@ std::string Generator::GeneratorImpl::generateEquationCode(const AnalyserEquatio break; case AnalyserEquation::Type::NLA: - if (!mProfile->findRootCallString(modelHasOdes()).empty()) { + if (!mProfile->findRootCallString(modelHasOdes(), mModel->hasExternalVariables()).empty()) { res += mProfile->indentString() - + replace(mProfile->findRootCallString(modelHasOdes()), + + replace(mProfile->findRootCallString(modelHasOdes(), mModel->hasExternalVariables()), "[INDEX]", convertToString(equation->nlaSystemIndex())); } diff --git a/src/generatorprofile.cpp b/src/generatorprofile.cpp index b388edeebd..cb57072f17 100644 --- a/src/generatorprofile.cpp +++ b/src/generatorprofile.cpp @@ -307,7 +307,6 @@ void GeneratorProfile::GeneratorProfileImpl::loadProfile(GeneratorProfile::Profi " double *algebraic;\n" " double *externals;\n" "} RootFindingInfo;\n"; - mRootFindingInfoObjectFdmWoevString = "typedef struct {\n" " double voi;\n" " double *states;\n" @@ -328,43 +327,87 @@ void GeneratorProfile::GeneratorProfileImpl::loadProfile(GeneratorProfile::Profi mExternNlaSolveMethodString = "extern void nlaSolve(void (*objectiveFunction)(double *, double *, void *),\n" " double *u, size_t n, void *data);\n"; - mFindRootCallFamString = "findRoot[INDEX](constants, computedConstants, algebraic);\n"; - mFindRootCallFdmString = "findRoot[INDEX](voi, states, rates, constants, computedConstants, algebraic);\n"; - mFindRootMethodFamString = "void findRoot[INDEX](double *constants, double *computedConstants, double *algebraic)\n" - "{\n" - " RootFindingInfo rfi = { constants, computedConstants, algebraic };\n" - " double u[[SIZE]];\n" - "\n" - "[CODE]" - "}\n"; - mFindRootMethodFdmString = "void findRoot[INDEX](double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic)\n" - "{\n" - " RootFindingInfo rfi = { voi, states, rates, constants, computedConstants, algebraic };\n" - " double u[[SIZE]];\n" - "\n" - "[CODE]" - "}\n"; - mNlaSolveCallFamString = "nlaSolve(objectiveFunction[INDEX], u, [SIZE], &rfi);\n"; - mNlaSolveCallFdmString = "nlaSolve(objectiveFunction[INDEX], u, [SIZE], &rfi);\n"; - mObjectiveFunctionMethodFamString = "void objectiveFunction[INDEX](double *u, double *f, void *data)\n" - "{\n" - " double *constants = ((RootFindingInfo *) data)->constants;\n" - " double *computedConstants = ((RootFindingInfo *) data)->computedConstants;\n" - " double *algebraic = ((RootFindingInfo *) data)->algebraic;\n" - "\n" - "[CODE]" - "}\n"; - mObjectiveFunctionMethodFdmString = "void objectiveFunction[INDEX](double *u, double *f, void *data)\n" - "{\n" - " double voi = ((RootFindingInfo *) data)->voi;\n" - " double *states = ((RootFindingInfo *) data)->states;\n" - " double *rates = ((RootFindingInfo *) data)->rates;\n" - " double *constants = ((RootFindingInfo *) data)->constants;\n" - " double *computedConstants = ((RootFindingInfo *) data)->computedConstants;\n" - " double *algebraic = ((RootFindingInfo *) data)->algebraic;\n" - "\n" - "[CODE]" - "}\n"; + + mFindRootCallFamWoevString = "findRoot[INDEX](constants, computedConstants, algebraic);\n"; + mFindRootCallFamWevString = "findRoot[INDEX](constants, computedConstants, algebraic, externals);\n"; + mFindRootCallFdmWoevString = "findRoot[INDEX](voi, states, rates, constants, computedConstants, algebraic);\n"; + mFindRootCallFdmWevString = "findRoot[INDEX](voi, states, rates, constants, computedConstants, algebraic, externals);\n"; + + mFindRootMethodFamWoevString = "void findRoot[INDEX](double *constants, double *computedConstants, double *algebraic)\n" + "{\n" + " RootFindingInfo rfi = { constants, computedConstants, algebraic };\n" + " double u[[SIZE]];\n" + "\n" + "[CODE]" + "}\n"; + mFindRootMethodFamWevString = "void findRoot[INDEX](double *constants, double *computedConstants, double *algebraic, double *externals)\n" + "{\n" + " RootFindingInfo rfi = { constants, computedConstants, algebraic, externals };\n" + " double u[[SIZE]];\n" + "\n" + "[CODE]" + "}\n"; + mFindRootMethodFdmWoevString = "void findRoot[INDEX](double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic)\n" + "{\n" + " RootFindingInfo rfi = { voi, states, rates, constants, computedConstants, algebraic };\n" + " double u[[SIZE]];\n" + "\n" + "[CODE]" + "}\n"; + mFindRootMethodFdmWevString = "void findRoot[INDEX](double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, double *externals)\n" + "{\n" + " RootFindingInfo rfi = { voi, states, rates, constants, computedConstants, algebraic, externals };\n" + " double u[[SIZE]];\n" + "\n" + "[CODE]" + "}\n"; + + mNlaSolveCallFamWoevString = "nlaSolve(objectiveFunction[INDEX], u, [SIZE], &rfi);\n"; + mNlaSolveCallFamWevString = "nlaSolve(objectiveFunction[INDEX], u, [SIZE], &rfi);\n"; + mNlaSolveCallFdmWoevString = "nlaSolve(objectiveFunction[INDEX], u, [SIZE], &rfi);\n"; + mNlaSolveCallFdmWevString = "nlaSolve(objectiveFunction[INDEX], u, [SIZE], &rfi);\n"; + + mObjectiveFunctionMethodFamWoevString = "void objectiveFunction[INDEX](double *u, double *f, void *data)\n" + "{\n" + " double *constants = ((RootFindingInfo *) data)->constants;\n" + " double *computedConstants = ((RootFindingInfo *) data)->computedConstants;\n" + " double *algebraic = ((RootFindingInfo *) data)->algebraic;\n" + "\n" + "[CODE]" + "}\n"; + mObjectiveFunctionMethodFamWevString = "void objectiveFunction[INDEX](double *u, double *f, void *data)\n" + "{\n" + " double *constants = ((RootFindingInfo *) data)->constants;\n" + " double *computedConstants = ((RootFindingInfo *) data)->computedConstants;\n" + " double *algebraic = ((RootFindingInfo *) data)->algebraic;\n" + " double *externals = ((RootFindingInfo *) data)->externals;\n" + "\n" + "[CODE]" + "}\n"; + mObjectiveFunctionMethodFdmWoevString = "void objectiveFunction[INDEX](double *u, double *f, void *data)\n" + "{\n" + " double voi = ((RootFindingInfo *) data)->voi;\n" + " double *states = ((RootFindingInfo *) data)->states;\n" + " double *rates = ((RootFindingInfo *) data)->rates;\n" + " double *constants = ((RootFindingInfo *) data)->constants;\n" + " double *computedConstants = ((RootFindingInfo *) data)->computedConstants;\n" + " double *algebraic = ((RootFindingInfo *) data)->algebraic;\n" + "\n" + "[CODE]" + "}\n"; + mObjectiveFunctionMethodFdmWevString = "void objectiveFunction[INDEX](double *u, double *f, void *data)\n" + "{\n" + " double voi = ((RootFindingInfo *) data)->voi;\n" + " double *states = ((RootFindingInfo *) data)->states;\n" + " double *rates = ((RootFindingInfo *) data)->rates;\n" + " double *constants = ((RootFindingInfo *) data)->constants;\n" + " double *computedConstants = ((RootFindingInfo *) data)->computedConstants;\n" + " double *algebraic = ((RootFindingInfo *) data)->algebraic;\n" + " double *externals = ((RootFindingInfo *) data)->externals;\n" + "\n" + "[CODE]" + "}\n"; + mUArrayString = "u"; mFArrayString = "f"; @@ -764,44 +807,81 @@ void GeneratorProfile::GeneratorProfileImpl::loadProfile(GeneratorProfile::Profi mRootFindingInfoObjectFamWoevString = ""; mRootFindingInfoObjectFamWevString = ""; - mRootFindingInfoObjectFdmWoevString = ""; mRootFindingInfoObjectFdmWevString = ""; mExternNlaSolveMethodString = "\n" "from nlasolver import nla_solve" "\n"; - mFindRootCallFamString = "find_root_[INDEX](constants, computed_constants, algebraic)\n"; - mFindRootCallFdmString = "find_root_[INDEX](voi, states, rates, constants, computed_constants, algebraic)\n"; - mFindRootMethodFamString = "\n" - "def find_root_[INDEX](constants, computed_constants, algebraic):\n" - " u = [nan]*[SIZE]\n" - "\n" - "[CODE]"; - mFindRootMethodFdmString = "\n" - "def find_root_[INDEX](voi, states, rates, constants, computed_constants, algebraic):\n" - " u = [nan]*[SIZE]\n" - "\n" - "[CODE]"; - mNlaSolveCallFamString = "u = nla_solve(objective_function_[INDEX], u, [SIZE], [constants, computed_constants, algebraic])\n"; - mNlaSolveCallFdmString = "u = nla_solve(objective_function_[INDEX], u, [SIZE], [voi, states, rates, constants, computed_constants, algebraic])\n"; - mObjectiveFunctionMethodFamString = "\n" - "def objective_function_[INDEX](u, f, data):\n" - " constants = data[0]\n" - " computed_constants = data[1]\n" - " algebraic = data[2]\n" - "\n" - "[CODE]"; - mObjectiveFunctionMethodFdmString = "\n" - "def objective_function_[INDEX](u, f, data):\n" - " voi = data[0]\n" - " states = data[1]\n" - " rates = data[2]\n" - " constants = data[3]\n" - " computed_constants = data[4]\n" - " algebraic = data[5]\n" - "\n" - "[CODE]"; + + mFindRootCallFamWoevString = "find_root_[INDEX](constants, computed_constants, algebraic)\n"; + mFindRootCallFamWevString = "find_root_[INDEX](constants, computed_constants, algebraic, externals)\n"; + mFindRootCallFdmWoevString = "find_root_[INDEX](voi, states, rates, constants, computed_constants, algebraic)\n"; + mFindRootCallFdmWevString = "find_root_[INDEX](voi, states, rates, constants, computed_constants, algebraic, externals)\n"; + + mFindRootMethodFamWoevString = "\n" + "def find_root_[INDEX](constants, computed_constants, algebraic):\n" + " u = [nan]*[SIZE]\n" + "\n" + "[CODE]"; + mFindRootMethodFamWevString = "\n" + "def find_root_[INDEX](constants, computed_constants, algebraic, externals):\n" + " u = [nan]*[SIZE]\n" + "\n" + "[CODE]"; + mFindRootMethodFdmWoevString = "\n" + "def find_root_[INDEX](voi, states, rates, constants, computed_constants, algebraic):\n" + " u = [nan]*[SIZE]\n" + "\n" + "[CODE]"; + mFindRootMethodFdmWevString = "\n" + "def find_root_[INDEX](voi, states, rates, constants, computed_constants, algebraic, externals):\n" + " u = [nan]*[SIZE]\n" + "\n" + "[CODE]"; + + mNlaSolveCallFamWoevString = "u = nla_solve(objective_function_[INDEX], u, [SIZE], [constants, computed_constants, algebraic])\n"; + mNlaSolveCallFamWevString = "u = nla_solve(objective_function_[INDEX], u, [SIZE], [constants, computed_constants, algebraic, externals])\n"; + mNlaSolveCallFdmWoevString = "u = nla_solve(objective_function_[INDEX], u, [SIZE], [voi, states, rates, constants, computed_constants, algebraic])\n"; + mNlaSolveCallFdmWevString = "u = nla_solve(objective_function_[INDEX], u, [SIZE], [voi, states, rates, constants, computed_constants, algebraic, externals])\n"; + + mObjectiveFunctionMethodFamWoevString = "\n" + "def objective_function_[INDEX](u, f, data):\n" + " constants = data[0]\n" + " computed_constants = data[1]\n" + " algebraic = data[2]\n" + " externals = data[3]\n" + "\n" + "[CODE]"; + mObjectiveFunctionMethodFamWevString = "\n" + "def objective_function_[INDEX](u, f, data):\n" + " constants = data[0]\n" + " computed_constants = data[1]\n" + " algebraic = data[2]\n" + "\n" + "[CODE]"; + mObjectiveFunctionMethodFdmWoevString = "\n" + "def objective_function_[INDEX](u, f, data):\n" + " voi = data[0]\n" + " states = data[1]\n" + " rates = data[2]\n" + " constants = data[3]\n" + " computed_constants = data[4]\n" + " algebraic = data[5]\n" + "\n" + "[CODE]"; + mObjectiveFunctionMethodFdmWevString = "\n" + "def objective_function_[INDEX](u, f, data):\n" + " voi = data[0]\n" + " states = data[1]\n" + " rates = data[2]\n" + " constants = data[3]\n" + " computed_constants = data[4]\n" + " algebraic = data[5]\n" + " externals = data[6]\n" + "\n" + "[CODE]"; + mUArrayString = "u"; mFArrayString = "f"; @@ -2396,79 +2476,151 @@ void GeneratorProfile::setExternNlaSolveMethodString(const std::string &externNl mPimpl->mExternNlaSolveMethodString = externNlaSolveMethodString; } -std::string GeneratorProfile::findRootCallString(bool forDifferentialModel) const +std::string GeneratorProfile::findRootCallString(bool forDifferentialModel, + bool withExternalVariables) const { if (forDifferentialModel) { - return mPimpl->mFindRootCallFdmString; + if (withExternalVariables) { + return mPimpl->mFindRootCallFdmWevString; + } + + return mPimpl->mFindRootCallFdmWoevString; } - return mPimpl->mFindRootCallFamString; + if (withExternalVariables) { + return mPimpl->mFindRootCallFamWevString; + } + + return mPimpl->mFindRootCallFamWoevString; } void GeneratorProfile::setFindRootCallString(bool forDifferentialModel, + bool withExternalVariables, const std::string &findRootCallString) { if (forDifferentialModel) { - mPimpl->mFindRootCallFdmString = findRootCallString; + if (withExternalVariables) { + mPimpl->mFindRootCallFdmWevString = findRootCallString; + } else { + mPimpl->mFindRootCallFdmWoevString = findRootCallString; + } } else { - mPimpl->mFindRootCallFamString = findRootCallString; + if (withExternalVariables) { + mPimpl->mFindRootCallFamWevString = findRootCallString; + } else { + mPimpl->mFindRootCallFamWoevString = findRootCallString; + } } } -std::string GeneratorProfile::findRootMethodString(bool forDifferentialModel) const +std::string GeneratorProfile::findRootMethodString(bool forDifferentialModel, + bool withExternalVariables) const { if (forDifferentialModel) { - return mPimpl->mFindRootMethodFdmString; + if (withExternalVariables) { + return mPimpl->mFindRootMethodFdmWevString; + } + + return mPimpl->mFindRootMethodFdmWoevString; + } + + if (withExternalVariables) { + return mPimpl->mFindRootMethodFamWevString; } - return mPimpl->mFindRootMethodFamString; + return mPimpl->mFindRootMethodFamWoevString; } void GeneratorProfile::setFindRootMethodString(bool forDifferentialModel, + bool withExternalVariables, const std::string &findRootMethodString) { if (forDifferentialModel) { - mPimpl->mFindRootMethodFdmString = findRootMethodString; + if (withExternalVariables) { + mPimpl->mFindRootMethodFdmWevString = findRootMethodString; + } else { + mPimpl->mFindRootMethodFdmWoevString = findRootMethodString; + } } else { - mPimpl->mFindRootMethodFamString = findRootMethodString; + if (withExternalVariables) { + mPimpl->mFindRootMethodFamWevString = findRootMethodString; + } else { + mPimpl->mFindRootMethodFamWoevString = findRootMethodString; + } } } -std::string GeneratorProfile::nlaSolveCallString(bool forDifferentialModel) const +std::string GeneratorProfile::nlaSolveCallString(bool forDifferentialModel, + bool withExternalVariables) const { if (forDifferentialModel) { - return mPimpl->mNlaSolveCallFdmString; + if (withExternalVariables) { + return mPimpl->mNlaSolveCallFdmWevString; + } + + return mPimpl->mNlaSolveCallFdmWoevString; + } + + if (withExternalVariables) { + return mPimpl->mNlaSolveCallFamWevString; } - return mPimpl->mNlaSolveCallFamString; + return mPimpl->mNlaSolveCallFamWoevString; } void GeneratorProfile::setNlaSolveCallString(bool forDifferentialModel, + bool withExternalVariables, const std::string &nlaSolveCallString) { if (forDifferentialModel) { - mPimpl->mNlaSolveCallFdmString = nlaSolveCallString; + if (withExternalVariables) { + mPimpl->mNlaSolveCallFdmWevString = nlaSolveCallString; + } else { + mPimpl->mNlaSolveCallFdmWoevString = nlaSolveCallString; + } } else { - mPimpl->mNlaSolveCallFamString = nlaSolveCallString; + if (withExternalVariables) { + mPimpl->mNlaSolveCallFamWevString = nlaSolveCallString; + } else { + mPimpl->mNlaSolveCallFamWoevString = nlaSolveCallString; + } } } -std::string GeneratorProfile::objectiveFunctionMethodString(bool forDifferentialModel) const +std::string GeneratorProfile::objectiveFunctionMethodString(bool forDifferentialModel, + bool withExternalVariables) const { if (forDifferentialModel) { - return mPimpl->mObjectiveFunctionMethodFdmString; + if (withExternalVariables) { + return mPimpl->mObjectiveFunctionMethodFdmWevString; + } + + return mPimpl->mObjectiveFunctionMethodFdmWoevString; } - return mPimpl->mObjectiveFunctionMethodFamString; + if (withExternalVariables) { + return mPimpl->mObjectiveFunctionMethodFamWevString; + } + + return mPimpl->mObjectiveFunctionMethodFamWoevString; } void GeneratorProfile::setObjectiveFunctionMethodString(bool forDifferentialModel, + bool withExternalVariables, const std::string &objectiveFunctionMethodString) { if (forDifferentialModel) { - mPimpl->mObjectiveFunctionMethodFdmString = objectiveFunctionMethodString; + if (withExternalVariables) { + mPimpl->mObjectiveFunctionMethodFdmWevString = objectiveFunctionMethodString; + } else { + mPimpl->mObjectiveFunctionMethodFdmWoevString = objectiveFunctionMethodString; + } } else { - mPimpl->mObjectiveFunctionMethodFamString = objectiveFunctionMethodString; + if (withExternalVariables) { + mPimpl->mObjectiveFunctionMethodFamWevString = objectiveFunctionMethodString; + } else { + mPimpl->mObjectiveFunctionMethodFamWoevString = objectiveFunctionMethodString; + } } } diff --git a/src/generatorprofile_p.h b/src/generatorprofile_p.h index fda7cf543d..0a44b83d04 100644 --- a/src/generatorprofile_p.h +++ b/src/generatorprofile_p.h @@ -227,19 +227,31 @@ struct GeneratorProfile::GeneratorProfileImpl std::string mRootFindingInfoObjectFamWoevString; std::string mRootFindingInfoObjectFamWevString; - std::string mRootFindingInfoObjectFdmWoevString; std::string mRootFindingInfoObjectFdmWevString; std::string mExternNlaSolveMethodString; - std::string mFindRootCallFamString; - std::string mFindRootCallFdmString; - std::string mFindRootMethodFamString; - std::string mFindRootMethodFdmString; - std::string mNlaSolveCallFamString; - std::string mNlaSolveCallFdmString; - std::string mObjectiveFunctionMethodFamString; - std::string mObjectiveFunctionMethodFdmString; + + std::string mFindRootCallFamWoevString; + std::string mFindRootCallFamWevString; + std::string mFindRootCallFdmWoevString; + std::string mFindRootCallFdmWevString; + + std::string mFindRootMethodFamWoevString; + std::string mFindRootMethodFamWevString; + std::string mFindRootMethodFdmWoevString; + std::string mFindRootMethodFdmWevString; + + std::string mNlaSolveCallFamWoevString; + std::string mNlaSolveCallFamWevString; + std::string mNlaSolveCallFdmWoevString; + std::string mNlaSolveCallFdmWevString; + + std::string mObjectiveFunctionMethodFamWoevString; + std::string mObjectiveFunctionMethodFamWevString; + std::string mObjectiveFunctionMethodFdmWoevString; + std::string mObjectiveFunctionMethodFdmWevString; + std::string mUArrayString; std::string mFArrayString; @@ -277,15 +289,13 @@ struct GeneratorProfile::GeneratorProfileImpl std::string mImplementationComputeRatesMethodWevString; std::string mInterfaceComputeVariablesMethodFamWoevString; - std::string mImplementationComputeVariablesMethodFamWoevString; - std::string mInterfaceComputeVariablesMethodFamWevString; - std::string mImplementationComputeVariablesMethodFamWevString; - std::string mInterfaceComputeVariablesMethodFdmWoevString; - std::string mImplementationComputeVariablesMethodFdmWoevString; - std::string mInterfaceComputeVariablesMethodFdmWevString; + + std::string mImplementationComputeVariablesMethodFamWoevString; + std::string mImplementationComputeVariablesMethodFamWevString; + std::string mImplementationComputeVariablesMethodFdmWoevString; std::string mImplementationComputeVariablesMethodFdmWevString; std::string mEmptyMethodString; diff --git a/src/generatorprofilesha1values.h b/src/generatorprofilesha1values.h index 1c6ba04d83..8c6df4ed7d 100644 --- a/src/generatorprofilesha1values.h +++ b/src/generatorprofilesha1values.h @@ -24,7 +24,7 @@ namespace libcellml { * The content of this file is generated, do not edit this file directly. * See docs/dev_utilities.rst for further information. */ -static const char C_GENERATOR_PROFILE_SHA1[] = "d3c84f25e69c62eaf1a154bf75d4394185cf7e23"; -static const char PYTHON_GENERATOR_PROFILE_SHA1[] = "06014d14cb0b183d9ba4952c56eb36388da5de28"; +static const char C_GENERATOR_PROFILE_SHA1[] = "f0d3add475025d2d4b805747828dbaf2f1345b2f"; +static const char PYTHON_GENERATOR_PROFILE_SHA1[] = "704a899325e7a0ad40c0275ff5dcd5586ad64bf5"; } // namespace libcellml diff --git a/src/generatorprofiletools.cpp b/src/generatorprofiletools.cpp index c85fe94110..9b4d0086d9 100644 --- a/src/generatorprofiletools.cpp +++ b/src/generatorprofiletools.cpp @@ -496,14 +496,22 @@ std::string generatorProfileAsString(const GeneratorProfilePtr &generatorProfile + generatorProfile->rootFindingInfoObjectString(true, false) + generatorProfile->rootFindingInfoObjectString(true, true) + generatorProfile->externNlaSolveMethodString() - + generatorProfile->findRootCallString(false) - + generatorProfile->findRootCallString(true) - + generatorProfile->findRootMethodString(false) - + generatorProfile->findRootMethodString(true) - + generatorProfile->nlaSolveCallString(false) - + generatorProfile->nlaSolveCallString(true) - + generatorProfile->objectiveFunctionMethodString(false) - + generatorProfile->objectiveFunctionMethodString(true) + + generatorProfile->findRootCallString(false, false) + + generatorProfile->findRootCallString(false, true) + + generatorProfile->findRootCallString(true, false) + + generatorProfile->findRootCallString(true, true) + + generatorProfile->findRootMethodString(false, false) + + generatorProfile->findRootMethodString(false, true) + + generatorProfile->findRootMethodString(true, false) + + generatorProfile->findRootMethodString(true, true) + + generatorProfile->nlaSolveCallString(false, false) + + generatorProfile->nlaSolveCallString(false, true) + + generatorProfile->nlaSolveCallString(true, false) + + generatorProfile->nlaSolveCallString(true, true) + + generatorProfile->objectiveFunctionMethodString(false, false) + + generatorProfile->objectiveFunctionMethodString(false, true) + + generatorProfile->objectiveFunctionMethodString(true, false) + + generatorProfile->objectiveFunctionMethodString(true, true) + generatorProfile->uArrayString() + generatorProfile->fArrayString(); diff --git a/tests/bindings/javascript/generatorprofile.test.js b/tests/bindings/javascript/generatorprofile.test.js index 1b728eec35..e3c40bfe40 100644 --- a/tests/bindings/javascript/generatorprofile.test.js +++ b/tests/bindings/javascript/generatorprofile.test.js @@ -840,38 +840,62 @@ describe("GeneratorProfile tests", () => { test("Checking GeneratorProfile.findRootCallString.", () => { const x = new libcellml.GeneratorProfile(libcellml.GeneratorProfile.Profile.C) - x.setFindRootCallString(false, "something") - expect(x.findRootCallString(false)).toBe("something") + x.setFindRootCallString(false, false, "something") + expect(x.findRootCallString(false, false)).toBe("something") - x.setFindRootCallString(true, "something") - expect(x.findRootCallString(true)).toBe("something") + x.setFindRootCallString(false, true, "something") + expect(x.findRootCallString(false, true)).toBe("something") + + x.setFindRootCallString(true, false, "something") + expect(x.findRootCallString(true, false)).toBe("something") + + x.setFindRootCallString(true, true, "something") + expect(x.findRootCallString(true, true)).toBe("something") }); test("Checking GeneratorProfile.findRootMethodString.", () => { const x = new libcellml.GeneratorProfile(libcellml.GeneratorProfile.Profile.C) - x.setFindRootMethodString(false, "something") - expect(x.findRootMethodString(false)).toBe("something") + x.setFindRootMethodString(false, false, "something") + expect(x.findRootMethodString(false, false)).toBe("something") + + x.setFindRootMethodString(false, true, "something") + expect(x.findRootMethodString(false, true)).toBe("something") + + x.setFindRootMethodString(true, false, "something") + expect(x.findRootMethodString(true, false)).toBe("something") - x.setFindRootMethodString(true, "something") - expect(x.findRootMethodString(true)).toBe("something") + x.setFindRootMethodString(true, true, "something") + expect(x.findRootMethodString(true, true)).toBe("something") }); test("Checking GeneratorProfile.nlaSolveCallString.", () => { const x = new libcellml.GeneratorProfile(libcellml.GeneratorProfile.Profile.C) - x.setNlaSolveCallString(false, "something") - expect(x.nlaSolveCallString(false)).toBe("something") + x.setNlaSolveCallString(false, false, "something") + expect(x.nlaSolveCallString(false, false)).toBe("something") - x.setNlaSolveCallString(true, "something") - expect(x.nlaSolveCallString(true)).toBe("something") + x.setNlaSolveCallString(false, true, "something") + expect(x.nlaSolveCallString(false, true)).toBe("something") + + x.setNlaSolveCallString(true, false, "something") + expect(x.nlaSolveCallString(true, false)).toBe("something") + + x.setNlaSolveCallString(true, true, "something") + expect(x.nlaSolveCallString(true, true)).toBe("something") }); test("Checking GeneratorProfile.objectiveFunctionMethodString.", () => { const x = new libcellml.GeneratorProfile(libcellml.GeneratorProfile.Profile.C) - x.setObjectiveFunctionMethodString(false, "something") - expect(x.objectiveFunctionMethodString(false)).toBe("something") + x.setObjectiveFunctionMethodString(false, false, "something") + expect(x.objectiveFunctionMethodString(false, false)).toBe("something") + + x.setObjectiveFunctionMethodString(false, true, "something") + expect(x.objectiveFunctionMethodString(false, true)).toBe("something") + + x.setObjectiveFunctionMethodString(true, false, "something") + expect(x.objectiveFunctionMethodString(true, false)).toBe("something") - x.setObjectiveFunctionMethodString(true, "something") - expect(x.objectiveFunctionMethodString(true)).toBe("something") + x.setObjectiveFunctionMethodString(true, true, "something") + expect(x.objectiveFunctionMethodString(true, true)).toBe("something") }); test("Checking GeneratorProfile.uArrayString.", () => { const x = new libcellml.GeneratorProfile(libcellml.GeneratorProfile.Profile.C) diff --git a/tests/bindings/python/test_generator_profile.py b/tests/bindings/python/test_generator_profile.py index b3bb6ad3ae..54befa0120 100644 --- a/tests/bindings/python/test_generator_profile.py +++ b/tests/bindings/python/test_generator_profile.py @@ -1738,52 +1738,84 @@ def test_find_root_call_string(self): g = GeneratorProfile() - self.assertEqual('findRoot[INDEX](constants, computedConstants, algebraic);\n', g.findRootCallString(False)) - g.setFindRootCallString(False, GeneratorProfileTestCase.VALUE) - self.assertEqual(GeneratorProfileTestCase.VALUE, g.findRootCallString(False)) + self.assertEqual('findRoot[INDEX](constants, computedConstants, algebraic);\n', g.findRootCallString(False, False)) + g.setFindRootCallString(False, False, GeneratorProfileTestCase.VALUE) + self.assertEqual(GeneratorProfileTestCase.VALUE, g.findRootCallString(False, False)) - self.assertEqual('findRoot[INDEX](voi, states, rates, constants, computedConstants, algebraic);\n', g.findRootCallString(True)) - g.setFindRootCallString(True, GeneratorProfileTestCase.VALUE) - self.assertEqual(GeneratorProfileTestCase.VALUE, g.findRootCallString(True)) + self.assertEqual('findRoot[INDEX](constants, computedConstants, algebraic, externals);\n', g.findRootCallString(False, True)) + g.setFindRootCallString(False, True, GeneratorProfileTestCase.VALUE) + self.assertEqual(GeneratorProfileTestCase.VALUE, g.findRootCallString(False, True)) + + self.assertEqual('findRoot[INDEX](voi, states, rates, constants, computedConstants, algebraic);\n', g.findRootCallString(True, False)) + g.setFindRootCallString(True, False, GeneratorProfileTestCase.VALUE) + self.assertEqual(GeneratorProfileTestCase.VALUE, g.findRootCallString(True, False)) + + self.assertEqual('findRoot[INDEX](voi, states, rates, constants, computedConstants, algebraic, externals);\n', g.findRootCallString(True, True)) + g.setFindRootCallString(True, True, GeneratorProfileTestCase.VALUE) + self.assertEqual(GeneratorProfileTestCase.VALUE, g.findRootCallString(True, True)) def test_find_root_method_string(self): from libcellml import GeneratorProfile g = GeneratorProfile() - self.assertEqual('void findRoot[INDEX](double *constants, double *computedConstants, double *algebraic)\n{\n RootFindingInfo rfi = { constants, computedConstants, algebraic };\n double u[[SIZE]];\n\n[CODE]}\n', g.findRootMethodString(False)) - g.setFindRootMethodString(False, GeneratorProfileTestCase.VALUE) - self.assertEqual(GeneratorProfileTestCase.VALUE, g.findRootMethodString(False)) + self.assertEqual('void findRoot[INDEX](double *constants, double *computedConstants, double *algebraic)\n{\n RootFindingInfo rfi = { constants, computedConstants, algebraic };\n double u[[SIZE]];\n\n[CODE]}\n', g.findRootMethodString(False, False)) + g.setFindRootMethodString(False, False, GeneratorProfileTestCase.VALUE) + self.assertEqual(GeneratorProfileTestCase.VALUE, g.findRootMethodString(False, False)) + + self.assertEqual('void findRoot[INDEX](double *constants, double *computedConstants, double *algebraic, double *externals)\n{\n RootFindingInfo rfi = { constants, computedConstants, algebraic, externals };\n double u[[SIZE]];\n\n[CODE]}\n', g.findRootMethodString(False, True)) + g.setFindRootMethodString(False, True, GeneratorProfileTestCase.VALUE) + self.assertEqual(GeneratorProfileTestCase.VALUE, g.findRootMethodString(False, True)) + + self.assertEqual('void findRoot[INDEX](double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic)\n{\n RootFindingInfo rfi = { voi, states, rates, constants, computedConstants, algebraic };\n double u[[SIZE]];\n\n[CODE]}\n', g.findRootMethodString(True, False)) + g.setFindRootMethodString(True, False, GeneratorProfileTestCase.VALUE) + self.assertEqual(GeneratorProfileTestCase.VALUE, g.findRootMethodString(True, False)) - self.assertEqual('void findRoot[INDEX](double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic)\n{\n RootFindingInfo rfi = { voi, states, rates, constants, computedConstants, algebraic };\n double u[[SIZE]];\n\n[CODE]}\n', g.findRootMethodString(True)) - g.setFindRootMethodString(True, GeneratorProfileTestCase.VALUE) - self.assertEqual(GeneratorProfileTestCase.VALUE, g.findRootMethodString(True)) + self.assertEqual('void findRoot[INDEX](double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, double *externals)\n{\n RootFindingInfo rfi = { voi, states, rates, constants, computedConstants, algebraic, externals };\n double u[[SIZE]];\n\n[CODE]}\n', g.findRootMethodString(True, True)) + g.setFindRootMethodString(True, True, GeneratorProfileTestCase.VALUE) + self.assertEqual(GeneratorProfileTestCase.VALUE, g.findRootMethodString(True, True)) def test_nla_solve_call_string(self): from libcellml import GeneratorProfile g = GeneratorProfile() - self.assertEqual('nlaSolve(objectiveFunction[INDEX], u, [SIZE], &rfi);\n', g.nlaSolveCallString(False)) - g.setNlaSolveCallString(False, GeneratorProfileTestCase.VALUE) - self.assertEqual(GeneratorProfileTestCase.VALUE, g.nlaSolveCallString(False)) + self.assertEqual('nlaSolve(objectiveFunction[INDEX], u, [SIZE], &rfi);\n', g.nlaSolveCallString(False, False)) + g.setNlaSolveCallString(False, False, GeneratorProfileTestCase.VALUE) + self.assertEqual(GeneratorProfileTestCase.VALUE, g.nlaSolveCallString(False, False)) - self.assertEqual('nlaSolve(objectiveFunction[INDEX], u, [SIZE], &rfi);\n', g.nlaSolveCallString(True)) - g.setNlaSolveCallString(True, GeneratorProfileTestCase.VALUE) - self.assertEqual(GeneratorProfileTestCase.VALUE, g.nlaSolveCallString(True)) + self.assertEqual('nlaSolve(objectiveFunction[INDEX], u, [SIZE], &rfi);\n', g.nlaSolveCallString(False, True)) + g.setNlaSolveCallString(False, True, GeneratorProfileTestCase.VALUE) + self.assertEqual(GeneratorProfileTestCase.VALUE, g.nlaSolveCallString(False, True)) + + self.assertEqual('nlaSolve(objectiveFunction[INDEX], u, [SIZE], &rfi);\n', g.nlaSolveCallString(True, False)) + g.setNlaSolveCallString(True, False, GeneratorProfileTestCase.VALUE) + self.assertEqual(GeneratorProfileTestCase.VALUE, g.nlaSolveCallString(True, False)) + + self.assertEqual('nlaSolve(objectiveFunction[INDEX], u, [SIZE], &rfi);\n', g.nlaSolveCallString(True, True)) + g.setNlaSolveCallString(True, True, GeneratorProfileTestCase.VALUE) + self.assertEqual(GeneratorProfileTestCase.VALUE, g.nlaSolveCallString(True, True)) def test_objective_function_method_string(self): from libcellml import GeneratorProfile g = GeneratorProfile() - self.assertEqual('void objectiveFunction[INDEX](double *u, double *f, void *data)\n{\n double *constants = ((RootFindingInfo *) data)->constants;\n double *computedConstants = ((RootFindingInfo *) data)->computedConstants;\n double *algebraic = ((RootFindingInfo *) data)->algebraic;\n\n[CODE]}\n', g.objectiveFunctionMethodString(False)) - g.setObjectiveFunctionMethodString(False, GeneratorProfileTestCase.VALUE) - self.assertEqual(GeneratorProfileTestCase.VALUE, g.objectiveFunctionMethodString(False)) + self.assertEqual('void objectiveFunction[INDEX](double *u, double *f, void *data)\n{\n double *constants = ((RootFindingInfo *) data)->constants;\n double *computedConstants = ((RootFindingInfo *) data)->computedConstants;\n double *algebraic = ((RootFindingInfo *) data)->algebraic;\n\n[CODE]}\n', g.objectiveFunctionMethodString(False, False)) + g.setObjectiveFunctionMethodString(False, False, GeneratorProfileTestCase.VALUE) + self.assertEqual(GeneratorProfileTestCase.VALUE, g.objectiveFunctionMethodString(False, False)) + + self.assertEqual('void objectiveFunction[INDEX](double *u, double *f, void *data)\n{\n double *constants = ((RootFindingInfo *) data)->constants;\n double *computedConstants = ((RootFindingInfo *) data)->computedConstants;\n double *algebraic = ((RootFindingInfo *) data)->algebraic;\n double *externals = ((RootFindingInfo *) data)->externals;\n\n[CODE]}\n', g.objectiveFunctionMethodString(False, True)) + g.setObjectiveFunctionMethodString(False, True, GeneratorProfileTestCase.VALUE) + self.assertEqual(GeneratorProfileTestCase.VALUE, g.objectiveFunctionMethodString(False, True)) + + self.assertEqual('void objectiveFunction[INDEX](double *u, double *f, void *data)\n{\n double voi = ((RootFindingInfo *) data)->voi;\n double *states = ((RootFindingInfo *) data)->states;\n double *rates = ((RootFindingInfo *) data)->rates;\n double *constants = ((RootFindingInfo *) data)->constants;\n double *computedConstants = ((RootFindingInfo *) data)->computedConstants;\n double *algebraic = ((RootFindingInfo *) data)->algebraic;\n\n[CODE]}\n', g.objectiveFunctionMethodString(True, False)) + g.setObjectiveFunctionMethodString(True, False, GeneratorProfileTestCase.VALUE) + self.assertEqual(GeneratorProfileTestCase.VALUE, g.objectiveFunctionMethodString(True, False)) - self.assertEqual('void objectiveFunction[INDEX](double *u, double *f, void *data)\n{\n double voi = ((RootFindingInfo *) data)->voi;\n double *states = ((RootFindingInfo *) data)->states;\n double *rates = ((RootFindingInfo *) data)->rates;\n double *constants = ((RootFindingInfo *) data)->constants;\n double *computedConstants = ((RootFindingInfo *) data)->computedConstants;\n double *algebraic = ((RootFindingInfo *) data)->algebraic;\n\n[CODE]}\n', g.objectiveFunctionMethodString(True)) - g.setObjectiveFunctionMethodString(True, GeneratorProfileTestCase.VALUE) - self.assertEqual(GeneratorProfileTestCase.VALUE, g.objectiveFunctionMethodString(True)) + self.assertEqual('void objectiveFunction[INDEX](double *u, double *f, void *data)\n{\n double voi = ((RootFindingInfo *) data)->voi;\n double *states = ((RootFindingInfo *) data)->states;\n double *rates = ((RootFindingInfo *) data)->rates;\n double *constants = ((RootFindingInfo *) data)->constants;\n double *computedConstants = ((RootFindingInfo *) data)->computedConstants;\n double *algebraic = ((RootFindingInfo *) data)->algebraic;\n double *externals = ((RootFindingInfo *) data)->externals;\n\n[CODE]}\n', g.objectiveFunctionMethodString(True, True)) + g.setObjectiveFunctionMethodString(True, True, GeneratorProfileTestCase.VALUE) + self.assertEqual(GeneratorProfileTestCase.VALUE, g.objectiveFunctionMethodString(True, True)) def test_u_array_string(self): from libcellml import GeneratorProfile diff --git a/tests/coverage/coverage.cpp b/tests/coverage/coverage.cpp index c0ff65534d..4e71511c89 100644 --- a/tests/coverage/coverage.cpp +++ b/tests/coverage/coverage.cpp @@ -893,8 +893,10 @@ TEST(Coverage, generator) profile->setInterfaceHeaderString(""); profile->setMaxFunctionString(""); profile->setMinFunctionString(""); - profile->setObjectiveFunctionMethodString(false, ""); - profile->setObjectiveFunctionMethodString(true, ""); + profile->setObjectiveFunctionMethodString(false, false, ""); + profile->setObjectiveFunctionMethodString(false, true, ""); + profile->setObjectiveFunctionMethodString(true, false, ""); + profile->setObjectiveFunctionMethodString(true, true, ""); profile->setSecFunctionString(""); profile->setSechFunctionString(""); profile->setVariableInfoEntryString(""); @@ -904,10 +906,14 @@ TEST(Coverage, generator) profile->setArrayElementSeparatorString(""); profile->setCommentString("xxx"); - profile->setFindRootMethodString(false, ""); - profile->setFindRootMethodString(true, ""); - profile->setObjectiveFunctionMethodString(false, "xxx"); - profile->setObjectiveFunctionMethodString(true, "xxx"); + profile->setFindRootMethodString(false, false, ""); + profile->setFindRootMethodString(false, true, ""); + profile->setFindRootMethodString(true, false, ""); + profile->setFindRootMethodString(true, true, ""); + profile->setObjectiveFunctionMethodString(false, false, "xxx"); + profile->setObjectiveFunctionMethodString(false, true, "xxx"); + profile->setObjectiveFunctionMethodString(true, false, "xxx"); + profile->setObjectiveFunctionMethodString(true, true, "xxx"); profile->setOriginCommentString(""); profile->setVariableInfoEntryString("xxx"); @@ -915,12 +921,18 @@ TEST(Coverage, generator) profile->setArrayElementSeparatorString("xxx"); profile->setExternNlaSolveMethodString(""); - profile->setFindRootMethodString(false, "xxx"); - profile->setFindRootMethodString(true, "xxx"); - profile->setFindRootCallString(false, ""); - profile->setFindRootCallString(true, ""); - profile->setNlaSolveCallString(false, ""); - profile->setNlaSolveCallString(true, ""); + profile->setFindRootMethodString(false, false, "xxx"); + profile->setFindRootMethodString(false, true, "xxx"); + profile->setFindRootMethodString(true, false, "xxx"); + profile->setFindRootMethodString(true, true, "xxx"); + profile->setFindRootCallString(false, false, ""); + profile->setFindRootCallString(false, true, ""); + profile->setFindRootCallString(true, false, ""); + profile->setFindRootCallString(true, true, ""); + profile->setNlaSolveCallString(false, false, ""); + profile->setNlaSolveCallString(false, true, ""); + profile->setNlaSolveCallString(true, false, ""); + profile->setNlaSolveCallString(true, true, ""); generator->implementationCode(); diff --git a/tests/generator/generatorprofile.cpp b/tests/generator/generatorprofile.cpp index c61172e51d..1b8071fbf8 100644 --- a/tests/generator/generatorprofile.cpp +++ b/tests/generator/generatorprofile.cpp @@ -384,9 +384,13 @@ TEST(GeneratorProfile, defaultMiscellaneousValues) " double *u, size_t n, void *data);\n", generatorProfile->externNlaSolveMethodString()); EXPECT_EQ("findRoot[INDEX](constants, computedConstants, algebraic);\n", - generatorProfile->findRootCallString(false)); + generatorProfile->findRootCallString(false, false)); + EXPECT_EQ("findRoot[INDEX](constants, computedConstants, algebraic, externals);\n", + generatorProfile->findRootCallString(false, true)); EXPECT_EQ("findRoot[INDEX](voi, states, rates, constants, computedConstants, algebraic);\n", - generatorProfile->findRootCallString(true)); + generatorProfile->findRootCallString(true, false)); + EXPECT_EQ("findRoot[INDEX](voi, states, rates, constants, computedConstants, algebraic, externals);\n", + generatorProfile->findRootCallString(true, true)); EXPECT_EQ("void findRoot[INDEX](double *constants, double *computedConstants, double *algebraic)\n" "{\n" " RootFindingInfo rfi = { constants, computedConstants, algebraic };\n" @@ -394,7 +398,15 @@ TEST(GeneratorProfile, defaultMiscellaneousValues) "\n" "[CODE]" "}\n", - generatorProfile->findRootMethodString(false)); + generatorProfile->findRootMethodString(false, false)); + EXPECT_EQ("void findRoot[INDEX](double *constants, double *computedConstants, double *algebraic, double *externals)\n" + "{\n" + " RootFindingInfo rfi = { constants, computedConstants, algebraic, externals };\n" + " double u[[SIZE]];\n" + "\n" + "[CODE]" + "}\n", + generatorProfile->findRootMethodString(false, true)); EXPECT_EQ("void findRoot[INDEX](double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic)\n" "{\n" " RootFindingInfo rfi = { voi, states, rates, constants, computedConstants, algebraic };\n" @@ -402,11 +414,23 @@ TEST(GeneratorProfile, defaultMiscellaneousValues) "\n" "[CODE]" "}\n", - generatorProfile->findRootMethodString(true)); + generatorProfile->findRootMethodString(true, false)); + EXPECT_EQ("void findRoot[INDEX](double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, double *externals)\n" + "{\n" + " RootFindingInfo rfi = { voi, states, rates, constants, computedConstants, algebraic, externals };\n" + " double u[[SIZE]];\n" + "\n" + "[CODE]" + "}\n", + generatorProfile->findRootMethodString(true, true)); + EXPECT_EQ("nlaSolve(objectiveFunction[INDEX], u, [SIZE], &rfi);\n", + generatorProfile->nlaSolveCallString(false, false)); + EXPECT_EQ("nlaSolve(objectiveFunction[INDEX], u, [SIZE], &rfi);\n", + generatorProfile->nlaSolveCallString(false, true)); EXPECT_EQ("nlaSolve(objectiveFunction[INDEX], u, [SIZE], &rfi);\n", - generatorProfile->nlaSolveCallString(false)); + generatorProfile->nlaSolveCallString(true, false)); EXPECT_EQ("nlaSolve(objectiveFunction[INDEX], u, [SIZE], &rfi);\n", - generatorProfile->nlaSolveCallString(true)); + generatorProfile->nlaSolveCallString(true, true)); EXPECT_EQ("void objectiveFunction[INDEX](double *u, double *f, void *data)\n" "{\n" " double *constants = ((RootFindingInfo *) data)->constants;\n" @@ -415,7 +439,29 @@ TEST(GeneratorProfile, defaultMiscellaneousValues) "\n" "[CODE]" "}\n", - generatorProfile->objectiveFunctionMethodString(false)); + generatorProfile->objectiveFunctionMethodString(false, false)); + EXPECT_EQ("void objectiveFunction[INDEX](double *u, double *f, void *data)\n" + "{\n" + " double *constants = ((RootFindingInfo *) data)->constants;\n" + " double *computedConstants = ((RootFindingInfo *) data)->computedConstants;\n" + " double *algebraic = ((RootFindingInfo *) data)->algebraic;\n" + " double *externals = ((RootFindingInfo *) data)->externals;\n" + "\n" + "[CODE]" + "}\n", + generatorProfile->objectiveFunctionMethodString(false, true)); + EXPECT_EQ("void objectiveFunction[INDEX](double *u, double *f, void *data)\n" + "{\n" + " double voi = ((RootFindingInfo *) data)->voi;\n" + " double *states = ((RootFindingInfo *) data)->states;\n" + " double *rates = ((RootFindingInfo *) data)->rates;\n" + " double *constants = ((RootFindingInfo *) data)->constants;\n" + " double *computedConstants = ((RootFindingInfo *) data)->computedConstants;\n" + " double *algebraic = ((RootFindingInfo *) data)->algebraic;\n" + "\n" + "[CODE]" + "}\n", + generatorProfile->objectiveFunctionMethodString(true, false)); EXPECT_EQ("void objectiveFunction[INDEX](double *u, double *f, void *data)\n" "{\n" " double voi = ((RootFindingInfo *) data)->voi;\n" @@ -424,10 +470,11 @@ TEST(GeneratorProfile, defaultMiscellaneousValues) " double *constants = ((RootFindingInfo *) data)->constants;\n" " double *computedConstants = ((RootFindingInfo *) data)->computedConstants;\n" " double *algebraic = ((RootFindingInfo *) data)->algebraic;\n" + " double *externals = ((RootFindingInfo *) data)->externals;\n" "\n" "[CODE]" "}\n", - generatorProfile->objectiveFunctionMethodString(true)); + generatorProfile->objectiveFunctionMethodString(true, true)); EXPECT_EQ("u", generatorProfile->uArrayString()); EXPECT_EQ("f", @@ -960,15 +1007,29 @@ TEST(GeneratorProfile, miscellaneous) generatorProfile->setRootFindingInfoObjectString(false, true, value); generatorProfile->setRootFindingInfoObjectString(true, false, value); generatorProfile->setRootFindingInfoObjectString(true, true, value); + generatorProfile->setExternNlaSolveMethodString(value); - generatorProfile->setFindRootCallString(false, value); - generatorProfile->setFindRootCallString(true, value); - generatorProfile->setFindRootMethodString(false, value); - generatorProfile->setFindRootMethodString(true, value); - generatorProfile->setNlaSolveCallString(false, value); - generatorProfile->setNlaSolveCallString(true, value); - generatorProfile->setObjectiveFunctionMethodString(false, value); - generatorProfile->setObjectiveFunctionMethodString(true, value); + + generatorProfile->setFindRootCallString(false, false, value); + generatorProfile->setFindRootCallString(false, true, value); + generatorProfile->setFindRootCallString(true, false, value); + generatorProfile->setFindRootCallString(true, true, value); + + generatorProfile->setFindRootMethodString(false, false, value); + generatorProfile->setFindRootMethodString(false, true, value); + generatorProfile->setFindRootMethodString(true, false, value); + generatorProfile->setFindRootMethodString(true, true, value); + + generatorProfile->setNlaSolveCallString(false, false, value); + generatorProfile->setNlaSolveCallString(false, true, value); + generatorProfile->setNlaSolveCallString(true, false, value); + generatorProfile->setNlaSolveCallString(true, true, value); + + generatorProfile->setObjectiveFunctionMethodString(false, false, value); + generatorProfile->setObjectiveFunctionMethodString(false, true, value); + generatorProfile->setObjectiveFunctionMethodString(true, false, value); + generatorProfile->setObjectiveFunctionMethodString(true, true, value); + generatorProfile->setUArrayString(value); generatorProfile->setFArrayString(value); @@ -991,30 +1052,28 @@ TEST(GeneratorProfile, miscellaneous) generatorProfile->setImplementationDeleteArrayMethodString(value); generatorProfile->setInterfaceInitialiseVariablesMethodString(false, value); - generatorProfile->setImplementationInitialiseVariablesMethodString(false, value); - generatorProfile->setInterfaceInitialiseVariablesMethodString(true, value); + + generatorProfile->setImplementationInitialiseVariablesMethodString(false, value); generatorProfile->setImplementationInitialiseVariablesMethodString(true, value); generatorProfile->setInterfaceComputeComputedConstantsMethodString(value); generatorProfile->setImplementationComputeComputedConstantsMethodString(value); generatorProfile->setInterfaceComputeRatesMethodString(false, value); - generatorProfile->setImplementationComputeRatesMethodString(false, value); - generatorProfile->setInterfaceComputeRatesMethodString(true, value); + + generatorProfile->setImplementationComputeRatesMethodString(false, value); generatorProfile->setImplementationComputeRatesMethodString(true, value); generatorProfile->setInterfaceComputeVariablesMethodString(false, false, value); - generatorProfile->setImplementationComputeVariablesMethodString(false, false, value); - generatorProfile->setInterfaceComputeVariablesMethodString(false, true, value); - generatorProfile->setImplementationComputeVariablesMethodString(false, true, value); - generatorProfile->setInterfaceComputeVariablesMethodString(true, false, value); - generatorProfile->setImplementationComputeVariablesMethodString(true, false, value); - generatorProfile->setInterfaceComputeVariablesMethodString(true, true, value); + + generatorProfile->setImplementationComputeVariablesMethodString(false, false, value); + generatorProfile->setImplementationComputeVariablesMethodString(false, true, value); + generatorProfile->setImplementationComputeVariablesMethodString(true, false, value); generatorProfile->setImplementationComputeVariablesMethodString(true, true, value); generatorProfile->setEmptyMethodString(value); @@ -1103,15 +1162,29 @@ TEST(GeneratorProfile, miscellaneous) EXPECT_EQ(value, generatorProfile->rootFindingInfoObjectString(false, true)); EXPECT_EQ(value, generatorProfile->rootFindingInfoObjectString(true, false)); EXPECT_EQ(value, generatorProfile->rootFindingInfoObjectString(true, true)); + EXPECT_EQ(value, generatorProfile->externNlaSolveMethodString()); - EXPECT_EQ(value, generatorProfile->findRootCallString(false)); - EXPECT_EQ(value, generatorProfile->findRootCallString(true)); - EXPECT_EQ(value, generatorProfile->findRootMethodString(false)); - EXPECT_EQ(value, generatorProfile->findRootMethodString(true)); - EXPECT_EQ(value, generatorProfile->nlaSolveCallString(false)); - EXPECT_EQ(value, generatorProfile->nlaSolveCallString(true)); - EXPECT_EQ(value, generatorProfile->objectiveFunctionMethodString(false)); - EXPECT_EQ(value, generatorProfile->objectiveFunctionMethodString(true)); + + EXPECT_EQ(value, generatorProfile->findRootCallString(false, false)); + EXPECT_EQ(value, generatorProfile->findRootCallString(false, true)); + EXPECT_EQ(value, generatorProfile->findRootCallString(true, false)); + EXPECT_EQ(value, generatorProfile->findRootCallString(true, true)); + + EXPECT_EQ(value, generatorProfile->findRootMethodString(false, false)); + EXPECT_EQ(value, generatorProfile->findRootMethodString(false, true)); + EXPECT_EQ(value, generatorProfile->findRootMethodString(true, false)); + EXPECT_EQ(value, generatorProfile->findRootMethodString(true, true)); + + EXPECT_EQ(value, generatorProfile->nlaSolveCallString(false, false)); + EXPECT_EQ(value, generatorProfile->nlaSolveCallString(false, true)); + EXPECT_EQ(value, generatorProfile->nlaSolveCallString(true, false)); + EXPECT_EQ(value, generatorProfile->nlaSolveCallString(true, true)); + + EXPECT_EQ(value, generatorProfile->objectiveFunctionMethodString(false, false)); + EXPECT_EQ(value, generatorProfile->objectiveFunctionMethodString(false, true)); + EXPECT_EQ(value, generatorProfile->objectiveFunctionMethodString(true, false)); + EXPECT_EQ(value, generatorProfile->objectiveFunctionMethodString(true, true)); + EXPECT_EQ(value, generatorProfile->uArrayString()); EXPECT_EQ(value, generatorProfile->fArrayString()); diff --git a/tests/resources/coverage/generator/model.c b/tests/resources/coverage/generator/model.c index 7560c12833..f5a5cb554c 100644 --- a/tests/resources/coverage/generator/model.c +++ b/tests/resources/coverage/generator/model.c @@ -403,6 +403,7 @@ void objectiveFunction0(double *u, double *f, void *data) double *constants = ((RootFindingInfo *) data)->constants; double *computedConstants = ((RootFindingInfo *) data)->computedConstants; double *algebraic = ((RootFindingInfo *) data)->algebraic; + double *externals = ((RootFindingInfo *) data)->externals; algebraic[0] = u[0]; algebraic[1] = u[1]; @@ -411,9 +412,9 @@ void objectiveFunction0(double *u, double *f, void *data) f[1] = algebraic[0]-algebraic[1]-(computedConstants[197]+computedConstants[198]); } -void findRoot0(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) +void findRoot0(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, double *externals) { - RootFindingInfo rfi = { voi, states, rates, constants, computedConstants, algebraic }; + RootFindingInfo rfi = { voi, states, rates, constants, computedConstants, algebraic, externals }; double u[2]; u[0] = algebraic[0]; @@ -650,5 +651,5 @@ void computeRates(double voi, double *states, double *rates, double *constants, void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, double *externals, ExternalVariable externalVariable) { externals[0] = externalVariable(voi, states, rates, constants, computedConstants, algebraic, externals, 0); - findRoot0(voi, states, rates, constants, computedConstants, algebraic); + findRoot0(voi, states, rates, constants, computedConstants, algebraic, externals); } diff --git a/tests/resources/coverage/generator/model.implementation.out b/tests/resources/coverage/generator/model.implementation.out index 3f78260f61..e08d72c8ba 100644 --- a/tests/resources/coverage/generator/model.implementation.out +++ b/tests/resources/coverage/generator/model.implementation.out @@ -162,6 +162,7 @@ void objectiveFunction0(double *u, double *f, void *data) double *constants = ((RootFindingInfo *) data)->constants; double *computedConstants = ((RootFindingInfo *) data)->computedConstants; double *algebraic = ((RootFindingInfo *) data)->algebraic; + double *externals = ((RootFindingInfo *) data)->externals; algebraic[0] = u[0]; algebraic[1] = u[1]; @@ -170,9 +171,9 @@ void objectiveFunction0(double *u, double *f, void *data) f[1] = algebraic[0]-algebraic[1]-(computedConstants[197]+computedConstants[198]); } -void findRoot0(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) +void findRoot0(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, double *externals) { - RootFindingInfo rfi = { voi, states, rates, constants, computedConstants, algebraic }; + RootFindingInfo rfi = { voi, states, rates, constants, computedConstants, algebraic, externals }; double u[2]; u[0] = algebraic[0]; @@ -409,5 +410,5 @@ void computeRates(double voi, double *states, double *rates, double *constants, void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, double *externals, ExternalVariable externalVariable) { externals[0] = externalVariable(voi, states, rates, constants, computedConstants, algebraic, externals, 0); - findRoot0(voi, states, rates, constants, computedConstants, algebraic); + findRoot0(voi, states, rates, constants, computedConstants, algebraic, externals); } diff --git a/tests/resources/coverage/generator/model.modified.profile.c b/tests/resources/coverage/generator/model.modified.profile.c index a539d57047..ad04e9ad0b 100644 --- a/tests/resources/coverage/generator/model.modified.profile.c +++ b/tests/resources/coverage/generator/model.modified.profile.c @@ -403,6 +403,7 @@ void objectiveFunction0(double *u, double *f, void *data) double *constants = ((RootFindingInfo *) data)->constants; double *computedConstants = ((RootFindingInfo *) data)->computedConstants; double *algebraic = ((RootFindingInfo *) data)->algebraic; + double *externals = ((RootFindingInfo *) data)->externals; algebraic[0] = u[0]; algebraic[1] = u[1]; @@ -411,9 +412,9 @@ void objectiveFunction0(double *u, double *f, void *data) f[1] = algebraic[0]-algebraic[1]-(computedConstants[197]+computedConstants[198]); } -void findRoot0(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) +void findRoot0(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, double *externals) { - RootFindingInfo rfi = { voi, states, rates, constants, computedConstants, algebraic }; + RootFindingInfo rfi = { voi, states, rates, constants, computedConstants, algebraic, externals }; double u[2]; u[0] = algebraic[0]; @@ -650,5 +651,5 @@ void computeRates(double voi, double *states, double *rates, double *constants, void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, double *externals, ExternalVariable externalVariable) { externals[0] = externalVariable(voi, states, rates, constants, computedConstants, algebraic, externals, 0); - findRoot0(voi, states, rates, constants, computedConstants, algebraic); + findRoot0(voi, states, rates, constants, computedConstants, algebraic, externals); } diff --git a/tests/resources/coverage/generator/model.modified.profile.py b/tests/resources/coverage/generator/model.modified.profile.py index a953afffa8..f6a8f403f8 100644 --- a/tests/resources/coverage/generator/model.modified.profile.py +++ b/tests/resources/coverage/generator/model.modified.profile.py @@ -373,6 +373,7 @@ def objective_function_0(u, f, data): constants = data[3] computed_constants = data[4] algebraic = data[5] + externals = data[6] algebraic[0] = u[0] algebraic[1] = u[1] @@ -381,13 +382,13 @@ def objective_function_0(u, f, data): f[1] = algebraic[0]-algebraic[1]-(computed_constants[197]+computed_constants[198]) -def find_root_0(voi, states, rates, constants, computed_constants, algebraic): +def find_root_0(voi, states, rates, constants, computed_constants, algebraic, externals): u = [nan]*2 u[0] = algebraic[0] u[1] = algebraic[1] - u = nla_solve(objective_function_0, u, 2, [voi, states, rates, constants, computed_constants, algebraic]) + u = nla_solve(objective_function_0, u, 2, [voi, states, rates, constants, computed_constants, algebraic, externals]) algebraic[0] = u[0] algebraic[1] = u[1] @@ -614,4 +615,4 @@ def compute_rates(voi, states, rates, constants, computed_constants, algebraic, def compute_variables(voi, states, rates, constants, computed_constants, algebraic, externals, external_variable): externals[0] = external_variable(voi, states, rates, constants, computed_constants, algebraic, externals, 0) - find_root_0(voi, states, rates, constants, computed_constants, algebraic) + find_root_0(voi, states, rates, constants, computed_constants, algebraic, externals) diff --git a/tests/resources/coverage/generator/model.out b/tests/resources/coverage/generator/model.out index 6391e30e4c..1d349599c0 100644 --- a/tests/resources/coverage/generator/model.out +++ b/tests/resources/coverage/generator/model.out @@ -99,6 +99,7 @@ void objectiveFunction0(double *u, double *f, void *data) double *constants = ((RootFindingInfo *) data)->constants; double *computedConstants = ((RootFindingInfo *) data)->computedConstants; double *algebraic = ((RootFindingInfo *) data)->algebraic; + double *externals = ((RootFindingInfo *) data)->externals; algebraic[0] = u[0]; algebraic[1] = u[1]; @@ -107,9 +108,9 @@ void objectiveFunction0(double *u, double *f, void *data) f[1] = algebraic[0]-algebraic[1]-(computedConstants[197]+computedConstants[198]); } -void findRoot0(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) +void findRoot0(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, double *externals) { - RootFindingInfo rfi = { voi, states, rates, constants, computedConstants, algebraic }; + RootFindingInfo rfi = { voi, states, rates, constants, computedConstants, algebraic, externals }; double u[2]; u[0] = algebraic[0]; diff --git a/tests/resources/coverage/generator/model.py b/tests/resources/coverage/generator/model.py index 1fff7c3312..06e4823cf4 100644 --- a/tests/resources/coverage/generator/model.py +++ b/tests/resources/coverage/generator/model.py @@ -373,6 +373,7 @@ def objective_function_0(u, f, data): constants = data[3] computed_constants = data[4] algebraic = data[5] + externals = data[6] algebraic[0] = u[0] algebraic[1] = u[1] @@ -381,13 +382,13 @@ def objective_function_0(u, f, data): f[1] = algebraic[0]-algebraic[1]-(computed_constants[197]+computed_constants[198]) -def find_root_0(voi, states, rates, constants, computed_constants, algebraic): +def find_root_0(voi, states, rates, constants, computed_constants, algebraic, externals): u = [nan]*2 u[0] = algebraic[0] u[1] = algebraic[1] - u = nla_solve(objective_function_0, u, 2, [voi, states, rates, constants, computed_constants, algebraic]) + u = nla_solve(objective_function_0, u, 2, [voi, states, rates, constants, computed_constants, algebraic, externals]) algebraic[0] = u[0] algebraic[1] = u[1] @@ -614,4 +615,4 @@ def compute_rates(voi, states, rates, constants, computed_constants, algebraic, def compute_variables(voi, states, rates, constants, computed_constants, algebraic, externals, external_variable): externals[0] = external_variable(voi, states, rates, constants, computed_constants, algebraic, externals, 0) - find_root_0(voi, states, rates, constants, computed_constants, algebraic) + find_root_0(voi, states, rates, constants, computed_constants, algebraic, externals) diff --git a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.py b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.py index 0e3d3346d9..7d7cc6c895 100644 --- a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.py +++ b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.py @@ -44,6 +44,7 @@ def objective_function_0(u, f, data): constants = data[0] computed_constants = data[1] algebraic = data[2] + externals = data[3] algebraic[0] = u[0] diff --git a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.py b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.py index 64d9589228..fbea6af5a3 100644 --- a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.py +++ b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.py @@ -43,6 +43,7 @@ def objective_function_0(u, f, data): constants = data[0] computed_constants = data[1] algebraic = data[2] + externals = data[3] algebraic[0] = u[0] algebraic[1] = u[1] diff --git a/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.py b/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.py index 9398a2d159..e0fce8b035 100644 --- a/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.py +++ b/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.py @@ -46,6 +46,7 @@ def objective_function_0(u, f, data): constants = data[0] computed_constants = data[1] algebraic = data[2] + externals = data[3] algebraic[2] = u[0] algebraic[1] = u[1] diff --git a/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.py b/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.py index 780f9aac86..62bfe3cd5b 100644 --- a/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.py +++ b/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.py @@ -46,6 +46,7 @@ def objective_function_0(u, f, data): constants = data[0] computed_constants = data[1] algebraic = data[2] + externals = data[3] algebraic[0] = u[0] algebraic[1] = u[1] From 68c98950136581418998186f5789a8afb2454d59 Mon Sep 17 00:00:00 2001 From: Alan Garny Date: Thu, 5 Sep 2024 20:48:04 +1200 Subject: [PATCH 52/85] Generator: fixed a small issue with our Python profile. --- src/generatorprofile.cpp | 2 +- src/generatorprofilesha1values.h | 2 +- .../algebraic_eqn_with_one_non_isolated_unknown/model.py | 1 - .../algebraic_system_with_three_linked_unknowns/model.py | 1 - .../model.not.ordered.py | 1 - .../algebraic_system_with_various_dependencies/model.ordered.py | 1 - 6 files changed, 2 insertions(+), 6 deletions(-) diff --git a/src/generatorprofile.cpp b/src/generatorprofile.cpp index cb57072f17..2d1a11d2f4 100644 --- a/src/generatorprofile.cpp +++ b/src/generatorprofile.cpp @@ -850,7 +850,6 @@ void GeneratorProfile::GeneratorProfileImpl::loadProfile(GeneratorProfile::Profi " constants = data[0]\n" " computed_constants = data[1]\n" " algebraic = data[2]\n" - " externals = data[3]\n" "\n" "[CODE]"; mObjectiveFunctionMethodFamWevString = "\n" @@ -858,6 +857,7 @@ void GeneratorProfile::GeneratorProfileImpl::loadProfile(GeneratorProfile::Profi " constants = data[0]\n" " computed_constants = data[1]\n" " algebraic = data[2]\n" + " externals = data[3]\n" "\n" "[CODE]"; mObjectiveFunctionMethodFdmWoevString = "\n" diff --git a/src/generatorprofilesha1values.h b/src/generatorprofilesha1values.h index 8c6df4ed7d..1bb721da23 100644 --- a/src/generatorprofilesha1values.h +++ b/src/generatorprofilesha1values.h @@ -25,6 +25,6 @@ namespace libcellml { * See docs/dev_utilities.rst for further information. */ static const char C_GENERATOR_PROFILE_SHA1[] = "f0d3add475025d2d4b805747828dbaf2f1345b2f"; -static const char PYTHON_GENERATOR_PROFILE_SHA1[] = "704a899325e7a0ad40c0275ff5dcd5586ad64bf5"; +static const char PYTHON_GENERATOR_PROFILE_SHA1[] = "35838d23a1b89fe47293f75e2684ba6d230cf4a8"; } // namespace libcellml diff --git a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.py b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.py index 7d7cc6c895..0e3d3346d9 100644 --- a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.py +++ b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.py @@ -44,7 +44,6 @@ def objective_function_0(u, f, data): constants = data[0] computed_constants = data[1] algebraic = data[2] - externals = data[3] algebraic[0] = u[0] diff --git a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.py b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.py index fbea6af5a3..64d9589228 100644 --- a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.py +++ b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.py @@ -43,7 +43,6 @@ def objective_function_0(u, f, data): constants = data[0] computed_constants = data[1] algebraic = data[2] - externals = data[3] algebraic[0] = u[0] algebraic[1] = u[1] diff --git a/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.py b/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.py index e0fce8b035..9398a2d159 100644 --- a/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.py +++ b/tests/resources/generator/algebraic_system_with_various_dependencies/model.not.ordered.py @@ -46,7 +46,6 @@ def objective_function_0(u, f, data): constants = data[0] computed_constants = data[1] algebraic = data[2] - externals = data[3] algebraic[2] = u[0] algebraic[1] = u[1] diff --git a/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.py b/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.py index 62bfe3cd5b..780f9aac86 100644 --- a/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.py +++ b/tests/resources/generator/algebraic_system_with_various_dependencies/model.ordered.py @@ -46,7 +46,6 @@ def objective_function_0(u, f, data): constants = data[0] computed_constants = data[1] algebraic = data[2] - externals = data[3] algebraic[0] = u[0] algebraic[1] = u[1] From f0957e0890ad141252caf040ef45d1bef725e999 Mon Sep 17 00:00:00 2001 From: Alan Garny Date: Fri, 6 Sep 2024 10:33:32 +1200 Subject: [PATCH 53/85] Tests: added a test to generate some code for the DAE version of the HH52 model with various external variables. --- tests/generator/generator.cpp | 45 +- .../model.dae.external.c | 562 ++++++++++++++++++ .../model.dae.external.h | 42 ++ .../model.dae.external.py | 478 +++++++++++++++ 4 files changed, 1126 insertions(+), 1 deletion(-) create mode 100644 tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.external.c create mode 100644 tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.external.h create mode 100644 tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.external.py diff --git a/tests/generator/generator.cpp b/tests/generator/generator.cpp index e6e327a4a3..bfb2d35c80 100644 --- a/tests/generator/generator.cpp +++ b/tests/generator/generator.cpp @@ -1599,7 +1599,7 @@ TEST(Generator, hodgkinHuxleySquidAxonModel1952WithVariousExternalVariables) EXPECT_EQ_FILE_CONTENTS("generator/hodgkin_huxley_squid_axon_model_1952/model.external.py", generator->implementationCode()); } -TEST(Generator, hodgkinHuxleySquidAxonModel1952Nla) +TEST(Generator, hodgkinHuxleySquidAxonModel195Dae) { // Same as the hodgkinHuxleySquidAxonModel1952 test, except that all the // algebraic equations are to be computed using NLA systems of one equation. @@ -1634,6 +1634,49 @@ TEST(Generator, hodgkinHuxleySquidAxonModel1952Nla) EXPECT_EQ_FILE_CONTENTS("generator/hodgkin_huxley_squid_axon_model_1952/model.dae.py", generator->implementationCode()); } +TEST(Generator, hodgkinHuxleySquidAxonModel1952DaeWithVariousExternalVariables) +{ + // Same as hodgkinHuxleySquidAxonModel1952WithVariousExternalVariables but with the DAE version of the HH52 model. + + auto parser = libcellml::Parser::create(); + auto model = parser->parseModel(fileContents("generator/hodgkin_huxley_squid_axon_model_1952/model.dae.cellml")); + + EXPECT_EQ(size_t(0), parser->issueCount()); + + auto analyser = libcellml::Analyser::create(); + auto potassium_channel_n_gate_alpha_n = model->component("potassium_channel_n_gate")->variable("alpha_n"); + auto external_sodium_channel_i_Na = libcellml::AnalyserExternalVariable::create(model->component("sodium_channel")->variable("i_Na")); + + external_sodium_channel_i_Na->addDependency(potassium_channel_n_gate_alpha_n); + external_sodium_channel_i_Na->addDependency(model->component("sodium_channel_h_gate")->variable("h")); + + analyser->addExternalVariable(libcellml::AnalyserExternalVariable::create(model->component("membrane")->variable("V"))); + analyser->addExternalVariable(external_sodium_channel_i_Na); + analyser->addExternalVariable(libcellml::AnalyserExternalVariable::create(potassium_channel_n_gate_alpha_n)); + + analyser->analyseModel(model); + + EXPECT_EQ(size_t(0), analyser->errorCount()); + + auto analyserModel = analyser->model(); + auto generator = libcellml::Generator::create(); + + generator->setModel(analyserModel); + + auto profile = generator->profile(); + + profile->setInterfaceFileNameString("model.dae.external.h"); + + EXPECT_EQ_FILE_CONTENTS("generator/hodgkin_huxley_squid_axon_model_1952/model.dae.external.h", generator->interfaceCode()); + EXPECT_EQ_FILE_CONTENTS("generator/hodgkin_huxley_squid_axon_model_1952/model.dae.external.c", generator->implementationCode()); + + profile = libcellml::GeneratorProfile::create(libcellml::GeneratorProfile::Profile::PYTHON); + + generator->setProfile(profile); + + EXPECT_EQ_FILE_CONTENTS("generator/hodgkin_huxley_squid_axon_model_1952/model.dae.external.py", generator->implementationCode()); +} + TEST(Generator, nobleModel1962) { auto parser = libcellml::Parser::create(); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.external.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.external.c new file mode 100644 index 0000000000..3d179b3e08 --- /dev/null +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.external.c @@ -0,0 +1,562 @@ +/* The content of this file was generated using the C profile of libCellML 0.5.0. */ + +#include "model.dae.external.h" + +#include +#include + +const char VERSION[] = "0.6.0"; +const char LIBCELLML_VERSION[] = "0.5.0"; + +const size_t STATE_COUNT = 3; +const size_t CONSTANT_COUNT = 5; +const size_t COMPUTED_CONSTANT_COUNT = 0; +const size_t ALGEBRAIC_COUNT = 11; +const size_t EXTERNAL_COUNT = 3; + +const VariableInfo VOI_INFO = {"time", "millisecond", "environment"}; + +const VariableInfo STATE_INFO[] = { + {"h", "dimensionless", "sodium_channel_h_gate"}, + {"m", "dimensionless", "sodium_channel_m_gate"}, + {"n", "dimensionless", "potassium_channel_n_gate"} +}; + +const VariableInfo CONSTANT_INFO[] = { + {"Cm", "microF_per_cm2", "membrane"}, + {"E_R", "millivolt", "membrane"}, + {"g_L", "milliS_per_cm2", "leakage_current"}, + {"g_Na", "milliS_per_cm2", "sodium_channel"}, + {"g_K", "milliS_per_cm2", "potassium_channel"} +}; + +const VariableInfo COMPUTED_CONSTANT_INFO[] = { +}; + +const VariableInfo ALGEBRAIC_INFO[] = { + {"i_Stim", "microA_per_cm2", "membrane"}, + {"i_L", "microA_per_cm2", "leakage_current"}, + {"i_K", "microA_per_cm2", "potassium_channel"}, + {"E_L", "millivolt", "leakage_current"}, + {"E_Na", "millivolt", "sodium_channel"}, + {"alpha_m", "per_millisecond", "sodium_channel_m_gate"}, + {"beta_m", "per_millisecond", "sodium_channel_m_gate"}, + {"alpha_h", "per_millisecond", "sodium_channel_h_gate"}, + {"beta_h", "per_millisecond", "sodium_channel_h_gate"}, + {"E_K", "millivolt", "potassium_channel"}, + {"beta_n", "per_millisecond", "potassium_channel_n_gate"} +}; + +const VariableInfo EXTERNAL_INFO[] = { + {"V", "millivolt", "membrane"}, + {"i_Na", "microA_per_cm2", "sodium_channel"}, + {"alpha_n", "per_millisecond", "potassium_channel_n_gate"} +}; + +double * createStatesArray() +{ + double *res = (double *) malloc(STATE_COUNT*sizeof(double)); + + for (size_t i = 0; i < STATE_COUNT; ++i) { + res[i] = NAN; + } + + return res; +} + +double * createConstantsArray() +{ + double *res = (double *) malloc(CONSTANT_COUNT*sizeof(double)); + + for (size_t i = 0; i < CONSTANT_COUNT; ++i) { + res[i] = NAN; + } + + return res; +} + +double * createComputedConstantsArray() +{ + double *res = (double *) malloc(COMPUTED_CONSTANT_COUNT*sizeof(double)); + + for (size_t i = 0; i < COMPUTED_CONSTANT_COUNT; ++i) { + res[i] = NAN; + } + + return res; +} + +double * createAlgebraicArray() +{ + double *res = (double *) malloc(ALGEBRAIC_COUNT*sizeof(double)); + + for (size_t i = 0; i < ALGEBRAIC_COUNT; ++i) { + res[i] = NAN; + } + + return res; +} + +double * createExternalsArray() +{ + double *res = (double *) malloc(EXTERNAL_COUNT*sizeof(double)); + + for (size_t i = 0; i < EXTERNAL_COUNT; ++i) { + res[i] = NAN; + } + + return res; +} + +void deleteArray(double *array) +{ + free(array); +} + +typedef struct { + double voi; + double *states; + double *rates; + double *constants; + double *computedConstants; + double *algebraic; + double *externals; +} RootFindingInfo; + +extern void nlaSolve(void (*objectiveFunction)(double *, double *, void *), + double *u, size_t n, void *data); + +void objectiveFunction0(double *u, double *f, void *data) +{ + double voi = ((RootFindingInfo *) data)->voi; + double *states = ((RootFindingInfo *) data)->states; + double *rates = ((RootFindingInfo *) data)->rates; + double *constants = ((RootFindingInfo *) data)->constants; + double *computedConstants = ((RootFindingInfo *) data)->computedConstants; + double *algebraic = ((RootFindingInfo *) data)->algebraic; + double *externals = ((RootFindingInfo *) data)->externals; + + algebraic[0] = u[0]; + + f[0] = algebraic[0]-(((voi >= 10.0) && (voi <= 10.5))?-20.0:0.0)-0.0; +} + +void findRoot0(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, double *externals) +{ + RootFindingInfo rfi = { voi, states, rates, constants, computedConstants, algebraic, externals }; + double u[1]; + + u[0] = algebraic[0]; + + nlaSolve(objectiveFunction0, u, 1, &rfi); + + algebraic[0] = u[0]; +} + +void objectiveFunction2(double *u, double *f, void *data) +{ + double voi = ((RootFindingInfo *) data)->voi; + double *states = ((RootFindingInfo *) data)->states; + double *rates = ((RootFindingInfo *) data)->rates; + double *constants = ((RootFindingInfo *) data)->constants; + double *computedConstants = ((RootFindingInfo *) data)->computedConstants; + double *algebraic = ((RootFindingInfo *) data)->algebraic; + double *externals = ((RootFindingInfo *) data)->externals; + + algebraic[3] = u[0]; + + f[0] = algebraic[3]-(constants[1]-10.613)-0.0; +} + +void findRoot2(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, double *externals) +{ + RootFindingInfo rfi = { voi, states, rates, constants, computedConstants, algebraic, externals }; + double u[1]; + + u[0] = algebraic[3]; + + nlaSolve(objectiveFunction2, u, 1, &rfi); + + algebraic[3] = u[0]; +} + +void objectiveFunction3(double *u, double *f, void *data) +{ + double voi = ((RootFindingInfo *) data)->voi; + double *states = ((RootFindingInfo *) data)->states; + double *rates = ((RootFindingInfo *) data)->rates; + double *constants = ((RootFindingInfo *) data)->constants; + double *computedConstants = ((RootFindingInfo *) data)->computedConstants; + double *algebraic = ((RootFindingInfo *) data)->algebraic; + double *externals = ((RootFindingInfo *) data)->externals; + + algebraic[1] = u[0]; + + f[0] = algebraic[1]-constants[2]*(externals[0]-algebraic[3])-0.0; +} + +void findRoot3(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, double *externals) +{ + RootFindingInfo rfi = { voi, states, rates, constants, computedConstants, algebraic, externals }; + double u[1]; + + u[0] = algebraic[1]; + + nlaSolve(objectiveFunction3, u, 1, &rfi); + + algebraic[1] = u[0]; +} + +void objectiveFunction4(double *u, double *f, void *data) +{ + double voi = ((RootFindingInfo *) data)->voi; + double *states = ((RootFindingInfo *) data)->states; + double *rates = ((RootFindingInfo *) data)->rates; + double *constants = ((RootFindingInfo *) data)->constants; + double *computedConstants = ((RootFindingInfo *) data)->computedConstants; + double *algebraic = ((RootFindingInfo *) data)->algebraic; + double *externals = ((RootFindingInfo *) data)->externals; + + algebraic[4] = u[0]; + + f[0] = algebraic[4]-(constants[1]-115.0)-0.0; +} + +void findRoot4(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, double *externals) +{ + RootFindingInfo rfi = { voi, states, rates, constants, computedConstants, algebraic, externals }; + double u[1]; + + u[0] = algebraic[4]; + + nlaSolve(objectiveFunction4, u, 1, &rfi); + + algebraic[4] = u[0]; +} + +void objectiveFunction6(double *u, double *f, void *data) +{ + double voi = ((RootFindingInfo *) data)->voi; + double *states = ((RootFindingInfo *) data)->states; + double *rates = ((RootFindingInfo *) data)->rates; + double *constants = ((RootFindingInfo *) data)->constants; + double *computedConstants = ((RootFindingInfo *) data)->computedConstants; + double *algebraic = ((RootFindingInfo *) data)->algebraic; + double *externals = ((RootFindingInfo *) data)->externals; + + algebraic[5] = u[0]; + + f[0] = algebraic[5]-0.1*(externals[0]+25.0)/(exp((externals[0]+25.0)/10.0)-1.0)-0.0; +} + +void findRoot6(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, double *externals) +{ + RootFindingInfo rfi = { voi, states, rates, constants, computedConstants, algebraic, externals }; + double u[1]; + + u[0] = algebraic[5]; + + nlaSolve(objectiveFunction6, u, 1, &rfi); + + algebraic[5] = u[0]; +} + +void objectiveFunction7(double *u, double *f, void *data) +{ + double voi = ((RootFindingInfo *) data)->voi; + double *states = ((RootFindingInfo *) data)->states; + double *rates = ((RootFindingInfo *) data)->rates; + double *constants = ((RootFindingInfo *) data)->constants; + double *computedConstants = ((RootFindingInfo *) data)->computedConstants; + double *algebraic = ((RootFindingInfo *) data)->algebraic; + double *externals = ((RootFindingInfo *) data)->externals; + + algebraic[6] = u[0]; + + f[0] = algebraic[6]-4.0*exp(externals[0]/18.0)-0.0; +} + +void findRoot7(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, double *externals) +{ + RootFindingInfo rfi = { voi, states, rates, constants, computedConstants, algebraic, externals }; + double u[1]; + + u[0] = algebraic[6]; + + nlaSolve(objectiveFunction7, u, 1, &rfi); + + algebraic[6] = u[0]; +} + +void objectiveFunction8(double *u, double *f, void *data) +{ + double voi = ((RootFindingInfo *) data)->voi; + double *states = ((RootFindingInfo *) data)->states; + double *rates = ((RootFindingInfo *) data)->rates; + double *constants = ((RootFindingInfo *) data)->constants; + double *computedConstants = ((RootFindingInfo *) data)->computedConstants; + double *algebraic = ((RootFindingInfo *) data)->algebraic; + double *externals = ((RootFindingInfo *) data)->externals; + + rates[1] = u[0]; + + f[0] = rates[1]-(algebraic[5]*(1.0-states[1])-algebraic[6]*states[1])-0.0; +} + +void findRoot8(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, double *externals) +{ + RootFindingInfo rfi = { voi, states, rates, constants, computedConstants, algebraic, externals }; + double u[1]; + + u[0] = rates[1]; + + nlaSolve(objectiveFunction8, u, 1, &rfi); + + rates[1] = u[0]; +} + +void objectiveFunction9(double *u, double *f, void *data) +{ + double voi = ((RootFindingInfo *) data)->voi; + double *states = ((RootFindingInfo *) data)->states; + double *rates = ((RootFindingInfo *) data)->rates; + double *constants = ((RootFindingInfo *) data)->constants; + double *computedConstants = ((RootFindingInfo *) data)->computedConstants; + double *algebraic = ((RootFindingInfo *) data)->algebraic; + double *externals = ((RootFindingInfo *) data)->externals; + + algebraic[7] = u[0]; + + f[0] = algebraic[7]-0.07*exp(externals[0]/20.0)-0.0; +} + +void findRoot9(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, double *externals) +{ + RootFindingInfo rfi = { voi, states, rates, constants, computedConstants, algebraic, externals }; + double u[1]; + + u[0] = algebraic[7]; + + nlaSolve(objectiveFunction9, u, 1, &rfi); + + algebraic[7] = u[0]; +} + +void objectiveFunction10(double *u, double *f, void *data) +{ + double voi = ((RootFindingInfo *) data)->voi; + double *states = ((RootFindingInfo *) data)->states; + double *rates = ((RootFindingInfo *) data)->rates; + double *constants = ((RootFindingInfo *) data)->constants; + double *computedConstants = ((RootFindingInfo *) data)->computedConstants; + double *algebraic = ((RootFindingInfo *) data)->algebraic; + double *externals = ((RootFindingInfo *) data)->externals; + + algebraic[8] = u[0]; + + f[0] = algebraic[8]-1.0/(exp((externals[0]+30.0)/10.0)+1.0)-0.0; +} + +void findRoot10(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, double *externals) +{ + RootFindingInfo rfi = { voi, states, rates, constants, computedConstants, algebraic, externals }; + double u[1]; + + u[0] = algebraic[8]; + + nlaSolve(objectiveFunction10, u, 1, &rfi); + + algebraic[8] = u[0]; +} + +void objectiveFunction11(double *u, double *f, void *data) +{ + double voi = ((RootFindingInfo *) data)->voi; + double *states = ((RootFindingInfo *) data)->states; + double *rates = ((RootFindingInfo *) data)->rates; + double *constants = ((RootFindingInfo *) data)->constants; + double *computedConstants = ((RootFindingInfo *) data)->computedConstants; + double *algebraic = ((RootFindingInfo *) data)->algebraic; + double *externals = ((RootFindingInfo *) data)->externals; + + rates[0] = u[0]; + + f[0] = rates[0]-(algebraic[7]*(1.0-states[0])-algebraic[8]*states[0])-0.0; +} + +void findRoot11(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, double *externals) +{ + RootFindingInfo rfi = { voi, states, rates, constants, computedConstants, algebraic, externals }; + double u[1]; + + u[0] = rates[0]; + + nlaSolve(objectiveFunction11, u, 1, &rfi); + + rates[0] = u[0]; +} + +void objectiveFunction12(double *u, double *f, void *data) +{ + double voi = ((RootFindingInfo *) data)->voi; + double *states = ((RootFindingInfo *) data)->states; + double *rates = ((RootFindingInfo *) data)->rates; + double *constants = ((RootFindingInfo *) data)->constants; + double *computedConstants = ((RootFindingInfo *) data)->computedConstants; + double *algebraic = ((RootFindingInfo *) data)->algebraic; + double *externals = ((RootFindingInfo *) data)->externals; + + algebraic[9] = u[0]; + + f[0] = algebraic[9]-(constants[1]+12.0)-0.0; +} + +void findRoot12(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, double *externals) +{ + RootFindingInfo rfi = { voi, states, rates, constants, computedConstants, algebraic, externals }; + double u[1]; + + u[0] = algebraic[9]; + + nlaSolve(objectiveFunction12, u, 1, &rfi); + + algebraic[9] = u[0]; +} + +void objectiveFunction13(double *u, double *f, void *data) +{ + double voi = ((RootFindingInfo *) data)->voi; + double *states = ((RootFindingInfo *) data)->states; + double *rates = ((RootFindingInfo *) data)->rates; + double *constants = ((RootFindingInfo *) data)->constants; + double *computedConstants = ((RootFindingInfo *) data)->computedConstants; + double *algebraic = ((RootFindingInfo *) data)->algebraic; + double *externals = ((RootFindingInfo *) data)->externals; + + algebraic[2] = u[0]; + + f[0] = algebraic[2]-constants[4]*pow(states[2], 4.0)*(externals[0]-algebraic[9])-0.0; +} + +void findRoot13(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, double *externals) +{ + RootFindingInfo rfi = { voi, states, rates, constants, computedConstants, algebraic, externals }; + double u[1]; + + u[0] = algebraic[2]; + + nlaSolve(objectiveFunction13, u, 1, &rfi); + + algebraic[2] = u[0]; +} + +void objectiveFunction15(double *u, double *f, void *data) +{ + double voi = ((RootFindingInfo *) data)->voi; + double *states = ((RootFindingInfo *) data)->states; + double *rates = ((RootFindingInfo *) data)->rates; + double *constants = ((RootFindingInfo *) data)->constants; + double *computedConstants = ((RootFindingInfo *) data)->computedConstants; + double *algebraic = ((RootFindingInfo *) data)->algebraic; + double *externals = ((RootFindingInfo *) data)->externals; + + algebraic[10] = u[0]; + + f[0] = algebraic[10]-0.125*exp(externals[0]/80.0)-0.0; +} + +void findRoot15(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, double *externals) +{ + RootFindingInfo rfi = { voi, states, rates, constants, computedConstants, algebraic, externals }; + double u[1]; + + u[0] = algebraic[10]; + + nlaSolve(objectiveFunction15, u, 1, &rfi); + + algebraic[10] = u[0]; +} + +void objectiveFunction16(double *u, double *f, void *data) +{ + double voi = ((RootFindingInfo *) data)->voi; + double *states = ((RootFindingInfo *) data)->states; + double *rates = ((RootFindingInfo *) data)->rates; + double *constants = ((RootFindingInfo *) data)->constants; + double *computedConstants = ((RootFindingInfo *) data)->computedConstants; + double *algebraic = ((RootFindingInfo *) data)->algebraic; + double *externals = ((RootFindingInfo *) data)->externals; + + rates[2] = u[0]; + + f[0] = rates[2]-(externals[2]*(1.0-states[2])-algebraic[10]*states[2])-0.0; +} + +void findRoot16(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, double *externals) +{ + RootFindingInfo rfi = { voi, states, rates, constants, computedConstants, algebraic, externals }; + double u[1]; + + u[0] = rates[2]; + + nlaSolve(objectiveFunction16, u, 1, &rfi); + + rates[2] = u[0]; +} + +void initialiseVariables(double *states, double *rates, double *constants, double *computedConstants, double *algebraic) +{ + states[0] = 0.6; + states[1] = 0.05; + states[2] = 0.325; + rates[0] = 0.0; + rates[1] = 0.0; + rates[2] = 0.0; + constants[0] = 1.0; + constants[1] = 0.0; + constants[2] = 0.3; + constants[3] = 120.0; + constants[4] = 36.0; + algebraic[0] = 0.0; + algebraic[1] = 0.0; + algebraic[2] = 0.0; + algebraic[3] = 0.0; + algebraic[4] = 0.0; + algebraic[5] = 0.0; + algebraic[6] = 0.0; + algebraic[7] = 0.0; + algebraic[8] = 0.0; + algebraic[9] = 0.0; + algebraic[10] = 0.0; +} + +void computeComputedConstants(double *constants, double *computedConstants) +{ +} + +void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, double *externals, ExternalVariable externalVariable) +{ + externals[0] = externalVariable(voi, states, rates, constants, computedConstants, algebraic, externals, 0); + findRoot6(voi, states, rates, constants, computedConstants, algebraic, externals); + findRoot7(voi, states, rates, constants, computedConstants, algebraic, externals); + findRoot8(voi, states, rates, constants, computedConstants, algebraic, externals); + findRoot9(voi, states, rates, constants, computedConstants, algebraic, externals); + findRoot10(voi, states, rates, constants, computedConstants, algebraic, externals); + findRoot11(voi, states, rates, constants, computedConstants, algebraic, externals); + externals[2] = externalVariable(voi, states, rates, constants, computedConstants, algebraic, externals, 2); + findRoot15(voi, states, rates, constants, computedConstants, algebraic, externals); + findRoot16(voi, states, rates, constants, computedConstants, algebraic, externals); +} + +void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, double *externals, ExternalVariable externalVariable) +{ + findRoot0(voi, states, rates, constants, computedConstants, algebraic, externals); + findRoot2(voi, states, rates, constants, computedConstants, algebraic, externals); + externals[0] = externalVariable(voi, states, rates, constants, computedConstants, algebraic, externals, 0); + findRoot3(voi, states, rates, constants, computedConstants, algebraic, externals); + findRoot4(voi, states, rates, constants, computedConstants, algebraic, externals); + findRoot12(voi, states, rates, constants, computedConstants, algebraic, externals); + findRoot13(voi, states, rates, constants, computedConstants, algebraic, externals); + externals[2] = externalVariable(voi, states, rates, constants, computedConstants, algebraic, externals, 2); + externals[1] = externalVariable(voi, states, rates, constants, computedConstants, algebraic, externals, 1); +} diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.external.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.external.h new file mode 100644 index 0000000000..f07a94f94f --- /dev/null +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.external.h @@ -0,0 +1,42 @@ +/* The content of this file was generated using the C profile of libCellML 0.5.0. */ + +#pragma once + +#include + +extern const char VERSION[]; +extern const char LIBCELLML_VERSION[]; + +extern const size_t STATE_COUNT; +extern const size_t CONSTANT_COUNT; +extern const size_t COMPUTED_CONSTANT_COUNT; +extern const size_t ALGEBRAIC_COUNT; +extern const size_t EXTERNAL_COUNT; + +typedef struct { + char name[8]; + char units[16]; + char component[25]; +} VariableInfo; + +extern const VariableInfo VOI_INFO; +extern const VariableInfo STATE_INFO[]; +extern const VariableInfo CONSTANT_INFO[]; +extern const VariableInfo COMPUTED_CONSTANT_INFO[]; +extern const VariableInfo ALGEBRAIC_INFO[]; +extern const VariableInfo EXTERNAL_INFO[]; + +double * createStatesArray(); +double * createConstantsArray(); +double * createComputedConstantsArray(); +double * createAlgebraicArray(); +double * createExternalsArray(); + +void deleteArray(double *array); + +typedef double (* ExternalVariable)(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, double *externals, size_t index); + +void initialiseVariables(double *states, double *rates, double *constants, double *computedConstants, double *algebraic); +void computeComputedConstants(double *constants, double *computedConstants); +void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, double *externals, ExternalVariable externalVariable); +void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, double *externals, ExternalVariable externalVariable); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.external.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.external.py new file mode 100644 index 0000000000..2c8ccfc186 --- /dev/null +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.external.py @@ -0,0 +1,478 @@ +# The content of this file was generated using the Python profile of libCellML 0.5.0. + +from enum import Enum +from math import * + + +__version__ = "0.5.0" +LIBCELLML_VERSION = "0.5.0" + +STATE_COUNT = 3 +CONSTANT_COUNT = 5 +COMPUTED_CONSTANT_COUNT = 0 +ALGEBRAIC_COUNT = 11 +EXTERNAL_COUNT = 3 + +VOI_INFO = {"name": "time", "units": "millisecond", "component": "environment"} + +STATE_INFO = [ + {"name": "h", "units": "dimensionless", "component": "sodium_channel_h_gate"}, + {"name": "m", "units": "dimensionless", "component": "sodium_channel_m_gate"}, + {"name": "n", "units": "dimensionless", "component": "potassium_channel_n_gate"} +] + +CONSTANT_INFO = [ + {"name": "Cm", "units": "microF_per_cm2", "component": "membrane"}, + {"name": "E_R", "units": "millivolt", "component": "membrane"}, + {"name": "g_L", "units": "milliS_per_cm2", "component": "leakage_current"}, + {"name": "g_Na", "units": "milliS_per_cm2", "component": "sodium_channel"}, + {"name": "g_K", "units": "milliS_per_cm2", "component": "potassium_channel"} +] + +COMPUTED_CONSTANT_INFO = [ +] + +ALGEBRAIC_INFO = [ + {"name": "i_Stim", "units": "microA_per_cm2", "component": "membrane"}, + {"name": "i_L", "units": "microA_per_cm2", "component": "leakage_current"}, + {"name": "i_K", "units": "microA_per_cm2", "component": "potassium_channel"}, + {"name": "E_L", "units": "millivolt", "component": "leakage_current"}, + {"name": "E_Na", "units": "millivolt", "component": "sodium_channel"}, + {"name": "alpha_m", "units": "per_millisecond", "component": "sodium_channel_m_gate"}, + {"name": "beta_m", "units": "per_millisecond", "component": "sodium_channel_m_gate"}, + {"name": "alpha_h", "units": "per_millisecond", "component": "sodium_channel_h_gate"}, + {"name": "beta_h", "units": "per_millisecond", "component": "sodium_channel_h_gate"}, + {"name": "E_K", "units": "millivolt", "component": "potassium_channel"}, + {"name": "beta_n", "units": "per_millisecond", "component": "potassium_channel_n_gate"} +] + +EXTERNAL_INFO = [ + {"name": "V", "units": "millivolt", "component": "membrane"}, + {"name": "i_Na", "units": "microA_per_cm2", "component": "sodium_channel"}, + {"name": "alpha_n", "units": "per_millisecond", "component": "potassium_channel_n_gate"} +] + + +def leq_func(x, y): + return 1.0 if x <= y else 0.0 + + +def geq_func(x, y): + return 1.0 if x >= y else 0.0 + + +def and_func(x, y): + return 1.0 if bool(x) & bool(y) else 0.0 + + +def create_states_array(): + return [nan]*STATE_COUNT + + +def create_constants_array(): + return [nan]*CONSTANT_COUNT + + +def create_computed_constants_array(): + return [nan]*COMPUTED_CONSTANT_COUNT + + +def create_algebraic_array(): + return [nan]*ALGEBRAIC_COUNT + + +def create_externals_array(): + return [nan]*EXTERNAL_COUNT + + +from nlasolver import nla_solve + + +def objective_function_0(u, f, data): + voi = data[0] + states = data[1] + rates = data[2] + constants = data[3] + computed_constants = data[4] + algebraic = data[5] + externals = data[6] + + algebraic[0] = u[0] + + f[0] = algebraic[0]-(-20.0 if and_func(geq_func(voi, 10.0), leq_func(voi, 10.5)) else 0.0)-0.0 + + +def find_root_0(voi, states, rates, constants, computed_constants, algebraic, externals): + u = [nan]*1 + + u[0] = algebraic[0] + + u = nla_solve(objective_function_0, u, 1, [voi, states, rates, constants, computed_constants, algebraic, externals]) + + algebraic[0] = u[0] + + +def objective_function_2(u, f, data): + voi = data[0] + states = data[1] + rates = data[2] + constants = data[3] + computed_constants = data[4] + algebraic = data[5] + externals = data[6] + + algebraic[3] = u[0] + + f[0] = algebraic[3]-(constants[1]-10.613)-0.0 + + +def find_root_2(voi, states, rates, constants, computed_constants, algebraic, externals): + u = [nan]*1 + + u[0] = algebraic[3] + + u = nla_solve(objective_function_2, u, 1, [voi, states, rates, constants, computed_constants, algebraic, externals]) + + algebraic[3] = u[0] + + +def objective_function_3(u, f, data): + voi = data[0] + states = data[1] + rates = data[2] + constants = data[3] + computed_constants = data[4] + algebraic = data[5] + externals = data[6] + + algebraic[1] = u[0] + + f[0] = algebraic[1]-constants[2]*(externals[0]-algebraic[3])-0.0 + + +def find_root_3(voi, states, rates, constants, computed_constants, algebraic, externals): + u = [nan]*1 + + u[0] = algebraic[1] + + u = nla_solve(objective_function_3, u, 1, [voi, states, rates, constants, computed_constants, algebraic, externals]) + + algebraic[1] = u[0] + + +def objective_function_4(u, f, data): + voi = data[0] + states = data[1] + rates = data[2] + constants = data[3] + computed_constants = data[4] + algebraic = data[5] + externals = data[6] + + algebraic[4] = u[0] + + f[0] = algebraic[4]-(constants[1]-115.0)-0.0 + + +def find_root_4(voi, states, rates, constants, computed_constants, algebraic, externals): + u = [nan]*1 + + u[0] = algebraic[4] + + u = nla_solve(objective_function_4, u, 1, [voi, states, rates, constants, computed_constants, algebraic, externals]) + + algebraic[4] = u[0] + + +def objective_function_6(u, f, data): + voi = data[0] + states = data[1] + rates = data[2] + constants = data[3] + computed_constants = data[4] + algebraic = data[5] + externals = data[6] + + algebraic[5] = u[0] + + f[0] = algebraic[5]-0.1*(externals[0]+25.0)/(exp((externals[0]+25.0)/10.0)-1.0)-0.0 + + +def find_root_6(voi, states, rates, constants, computed_constants, algebraic, externals): + u = [nan]*1 + + u[0] = algebraic[5] + + u = nla_solve(objective_function_6, u, 1, [voi, states, rates, constants, computed_constants, algebraic, externals]) + + algebraic[5] = u[0] + + +def objective_function_7(u, f, data): + voi = data[0] + states = data[1] + rates = data[2] + constants = data[3] + computed_constants = data[4] + algebraic = data[5] + externals = data[6] + + algebraic[6] = u[0] + + f[0] = algebraic[6]-4.0*exp(externals[0]/18.0)-0.0 + + +def find_root_7(voi, states, rates, constants, computed_constants, algebraic, externals): + u = [nan]*1 + + u[0] = algebraic[6] + + u = nla_solve(objective_function_7, u, 1, [voi, states, rates, constants, computed_constants, algebraic, externals]) + + algebraic[6] = u[0] + + +def objective_function_8(u, f, data): + voi = data[0] + states = data[1] + rates = data[2] + constants = data[3] + computed_constants = data[4] + algebraic = data[5] + externals = data[6] + + rates[1] = u[0] + + f[0] = rates[1]-(algebraic[5]*(1.0-states[1])-algebraic[6]*states[1])-0.0 + + +def find_root_8(voi, states, rates, constants, computed_constants, algebraic, externals): + u = [nan]*1 + + u[0] = rates[1] + + u = nla_solve(objective_function_8, u, 1, [voi, states, rates, constants, computed_constants, algebraic, externals]) + + rates[1] = u[0] + + +def objective_function_9(u, f, data): + voi = data[0] + states = data[1] + rates = data[2] + constants = data[3] + computed_constants = data[4] + algebraic = data[5] + externals = data[6] + + algebraic[7] = u[0] + + f[0] = algebraic[7]-0.07*exp(externals[0]/20.0)-0.0 + + +def find_root_9(voi, states, rates, constants, computed_constants, algebraic, externals): + u = [nan]*1 + + u[0] = algebraic[7] + + u = nla_solve(objective_function_9, u, 1, [voi, states, rates, constants, computed_constants, algebraic, externals]) + + algebraic[7] = u[0] + + +def objective_function_10(u, f, data): + voi = data[0] + states = data[1] + rates = data[2] + constants = data[3] + computed_constants = data[4] + algebraic = data[5] + externals = data[6] + + algebraic[8] = u[0] + + f[0] = algebraic[8]-1.0/(exp((externals[0]+30.0)/10.0)+1.0)-0.0 + + +def find_root_10(voi, states, rates, constants, computed_constants, algebraic, externals): + u = [nan]*1 + + u[0] = algebraic[8] + + u = nla_solve(objective_function_10, u, 1, [voi, states, rates, constants, computed_constants, algebraic, externals]) + + algebraic[8] = u[0] + + +def objective_function_11(u, f, data): + voi = data[0] + states = data[1] + rates = data[2] + constants = data[3] + computed_constants = data[4] + algebraic = data[5] + externals = data[6] + + rates[0] = u[0] + + f[0] = rates[0]-(algebraic[7]*(1.0-states[0])-algebraic[8]*states[0])-0.0 + + +def find_root_11(voi, states, rates, constants, computed_constants, algebraic, externals): + u = [nan]*1 + + u[0] = rates[0] + + u = nla_solve(objective_function_11, u, 1, [voi, states, rates, constants, computed_constants, algebraic, externals]) + + rates[0] = u[0] + + +def objective_function_12(u, f, data): + voi = data[0] + states = data[1] + rates = data[2] + constants = data[3] + computed_constants = data[4] + algebraic = data[5] + externals = data[6] + + algebraic[9] = u[0] + + f[0] = algebraic[9]-(constants[1]+12.0)-0.0 + + +def find_root_12(voi, states, rates, constants, computed_constants, algebraic, externals): + u = [nan]*1 + + u[0] = algebraic[9] + + u = nla_solve(objective_function_12, u, 1, [voi, states, rates, constants, computed_constants, algebraic, externals]) + + algebraic[9] = u[0] + + +def objective_function_13(u, f, data): + voi = data[0] + states = data[1] + rates = data[2] + constants = data[3] + computed_constants = data[4] + algebraic = data[5] + externals = data[6] + + algebraic[2] = u[0] + + f[0] = algebraic[2]-constants[4]*pow(states[2], 4.0)*(externals[0]-algebraic[9])-0.0 + + +def find_root_13(voi, states, rates, constants, computed_constants, algebraic, externals): + u = [nan]*1 + + u[0] = algebraic[2] + + u = nla_solve(objective_function_13, u, 1, [voi, states, rates, constants, computed_constants, algebraic, externals]) + + algebraic[2] = u[0] + + +def objective_function_15(u, f, data): + voi = data[0] + states = data[1] + rates = data[2] + constants = data[3] + computed_constants = data[4] + algebraic = data[5] + externals = data[6] + + algebraic[10] = u[0] + + f[0] = algebraic[10]-0.125*exp(externals[0]/80.0)-0.0 + + +def find_root_15(voi, states, rates, constants, computed_constants, algebraic, externals): + u = [nan]*1 + + u[0] = algebraic[10] + + u = nla_solve(objective_function_15, u, 1, [voi, states, rates, constants, computed_constants, algebraic, externals]) + + algebraic[10] = u[0] + + +def objective_function_16(u, f, data): + voi = data[0] + states = data[1] + rates = data[2] + constants = data[3] + computed_constants = data[4] + algebraic = data[5] + externals = data[6] + + rates[2] = u[0] + + f[0] = rates[2]-(externals[2]*(1.0-states[2])-algebraic[10]*states[2])-0.0 + + +def find_root_16(voi, states, rates, constants, computed_constants, algebraic, externals): + u = [nan]*1 + + u[0] = rates[2] + + u = nla_solve(objective_function_16, u, 1, [voi, states, rates, constants, computed_constants, algebraic, externals]) + + rates[2] = u[0] + + +def initialise_variables(states, rates, constants, computed_constants, algebraic): + states[0] = 0.6 + states[1] = 0.05 + states[2] = 0.325 + rates[0] = 0.0 + rates[1] = 0.0 + rates[2] = 0.0 + constants[0] = 1.0 + constants[1] = 0.0 + constants[2] = 0.3 + constants[3] = 120.0 + constants[4] = 36.0 + algebraic[0] = 0.0 + algebraic[1] = 0.0 + algebraic[2] = 0.0 + algebraic[3] = 0.0 + algebraic[4] = 0.0 + algebraic[5] = 0.0 + algebraic[6] = 0.0 + algebraic[7] = 0.0 + algebraic[8] = 0.0 + algebraic[9] = 0.0 + algebraic[10] = 0.0 + + +def compute_computed_constants(constants, computed_constants): + pass + + +def compute_rates(voi, states, rates, constants, computed_constants, algebraic, externals, external_variable): + externals[0] = external_variable(voi, states, rates, constants, computed_constants, algebraic, externals, 0) + find_root_6(voi, states, rates, constants, computed_constants, algebraic, externals) + find_root_7(voi, states, rates, constants, computed_constants, algebraic, externals) + find_root_8(voi, states, rates, constants, computed_constants, algebraic, externals) + find_root_9(voi, states, rates, constants, computed_constants, algebraic, externals) + find_root_10(voi, states, rates, constants, computed_constants, algebraic, externals) + find_root_11(voi, states, rates, constants, computed_constants, algebraic, externals) + externals[2] = external_variable(voi, states, rates, constants, computed_constants, algebraic, externals, 2) + find_root_15(voi, states, rates, constants, computed_constants, algebraic, externals) + find_root_16(voi, states, rates, constants, computed_constants, algebraic, externals) + + +def compute_variables(voi, states, rates, constants, computed_constants, algebraic, externals, external_variable): + find_root_0(voi, states, rates, constants, computed_constants, algebraic, externals) + find_root_2(voi, states, rates, constants, computed_constants, algebraic, externals) + externals[0] = external_variable(voi, states, rates, constants, computed_constants, algebraic, externals, 0) + find_root_3(voi, states, rates, constants, computed_constants, algebraic, externals) + find_root_4(voi, states, rates, constants, computed_constants, algebraic, externals) + find_root_12(voi, states, rates, constants, computed_constants, algebraic, externals) + find_root_13(voi, states, rates, constants, computed_constants, algebraic, externals) + externals[2] = external_variable(voi, states, rates, constants, computed_constants, algebraic, externals, 2) + externals[1] = external_variable(voi, states, rates, constants, computed_constants, algebraic, externals, 1) From 49b3a4fdde1dd478b9f1c266e5322850bcaba28e Mon Sep 17 00:00:00 2001 From: Alan Garny Date: Fri, 6 Sep 2024 13:24:12 +1200 Subject: [PATCH 54/85] Tests: changed the external variable in algebraicEqnWithOneNonIsolatedUnknownWithExternalVariable. This is so that we can test an algebraic model with an external variable (in https://github.com/agarny/libCellMLGeneratedCodeTests). --- tests/generator/generator.cpp | 2 +- .../model.external.c | 47 ++++++++++++++++--- .../model.external.py | 37 ++++++++++++--- 3 files changed, 73 insertions(+), 13 deletions(-) diff --git a/tests/generator/generator.cpp b/tests/generator/generator.cpp index bfb2d35c80..d84acefb86 100644 --- a/tests/generator/generator.cpp +++ b/tests/generator/generator.cpp @@ -335,7 +335,7 @@ TEST(Generator, algebraicEqnWithOneNonIsolatedUnknownWithExternalVariable) auto analyser = libcellml::Analyser::create(); - analyser->addExternalVariable(libcellml::AnalyserExternalVariable::create(model->component("my_algebraic_eqn")->variable("a"))); + analyser->addExternalVariable(libcellml::AnalyserExternalVariable::create(model->component("my_algebraic_eqn")->variable("c"))); analyser->analyseModel(model); diff --git a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.c b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.c index a1a60e49f2..e14101caba 100644 --- a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.c +++ b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.c @@ -9,8 +9,8 @@ const char VERSION[] = "0.6.0"; const char LIBCELLML_VERSION[] = "0.5.0"; const size_t CONSTANT_COUNT = 0; -const size_t COMPUTED_CONSTANT_COUNT = 3; -const size_t ALGEBRAIC_COUNT = 0; +const size_t COMPUTED_CONSTANT_COUNT = 2; +const size_t ALGEBRAIC_COUNT = 1; const size_t EXTERNAL_COUNT = 1; const VariableInfo CONSTANT_INFO[] = { @@ -18,15 +18,15 @@ const VariableInfo CONSTANT_INFO[] = { const VariableInfo COMPUTED_CONSTANT_INFO[] = { {"b", "dimensionless", "my_algebraic_eqn"}, - {"c", "dimensionless", "my_algebraic_eqn"}, {"d", "dimensionless", "my_algebraic_eqn"} }; const VariableInfo ALGEBRAIC_INFO[] = { + {"a", "dimensionless", "my_algebraic_eqn"} }; const VariableInfo EXTERNAL_INFO[] = { - {"a", "dimensionless", "my_algebraic_eqn"} + {"c", "dimensionless", "my_algebraic_eqn"} }; double * createConstantsArray() @@ -78,11 +78,45 @@ void deleteArray(double *array) free(array); } +typedef struct { + double *constants; + double *computedConstants; + double *algebraic; + double *externals; +} RootFindingInfo; + +extern void nlaSolve(void (*objectiveFunction)(double *, double *, void *), + double *u, size_t n, void *data); + +void objectiveFunction0(double *u, double *f, void *data) +{ + double *constants = ((RootFindingInfo *) data)->constants; + double *computedConstants = ((RootFindingInfo *) data)->computedConstants; + double *algebraic = ((RootFindingInfo *) data)->algebraic; + double *externals = ((RootFindingInfo *) data)->externals; + + algebraic[0] = u[0]; + + f[0] = algebraic[0]+computedConstants[0]-(externals[0]+computedConstants[1]); +} + +void findRoot0(double *constants, double *computedConstants, double *algebraic, double *externals) +{ + RootFindingInfo rfi = { constants, computedConstants, algebraic, externals }; + double u[1]; + + u[0] = algebraic[0]; + + nlaSolve(objectiveFunction0, u, 1, &rfi); + + algebraic[0] = u[0]; +} + void initialiseVariables(double *constants, double *computedConstants, double *algebraic) { computedConstants[0] = 3.0; - computedConstants[1] = 5.0; - computedConstants[2] = 7.0; + computedConstants[1] = 7.0; + algebraic[0] = 1.0; } void computeComputedConstants(double *constants, double *computedConstants) @@ -92,4 +126,5 @@ void computeComputedConstants(double *constants, double *computedConstants) void computeVariables(double *constants, double *computedConstants, double *algebraic, double *externals, ExternalVariable externalVariable) { externals[0] = externalVariable(constants, computedConstants, algebraic, externals, 0); + findRoot0(constants, computedConstants, algebraic, externals); } diff --git a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.py b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.py index 927ddba3f2..327ffac698 100644 --- a/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.py +++ b/tests/resources/generator/algebraic_eqn_with_one_non_isolated_unknown/model.external.py @@ -8,8 +8,8 @@ LIBCELLML_VERSION = "0.5.0" CONSTANT_COUNT = 0 -COMPUTED_CONSTANT_COUNT = 3 -ALGEBRAIC_COUNT = 0 +COMPUTED_CONSTANT_COUNT = 2 +ALGEBRAIC_COUNT = 1 EXTERNAL_COUNT = 1 CONSTANT_INFO = [ @@ -17,15 +17,15 @@ COMPUTED_CONSTANT_INFO = [ {"name": "b", "units": "dimensionless", "component": "my_algebraic_eqn"}, - {"name": "c", "units": "dimensionless", "component": "my_algebraic_eqn"}, {"name": "d", "units": "dimensionless", "component": "my_algebraic_eqn"} ] ALGEBRAIC_INFO = [ + {"name": "a", "units": "dimensionless", "component": "my_algebraic_eqn"} ] EXTERNAL_INFO = [ - {"name": "a", "units": "dimensionless", "component": "my_algebraic_eqn"} + {"name": "c", "units": "dimensionless", "component": "my_algebraic_eqn"} ] @@ -45,10 +45,34 @@ def create_externals_array(): return [nan]*EXTERNAL_COUNT +from nlasolver import nla_solve + + +def objective_function_0(u, f, data): + constants = data[0] + computed_constants = data[1] + algebraic = data[2] + externals = data[3] + + algebraic[0] = u[0] + + f[0] = algebraic[0]+computed_constants[0]-(externals[0]+computed_constants[1]) + + +def find_root_0(constants, computed_constants, algebraic, externals): + u = [nan]*1 + + u[0] = algebraic[0] + + u = nla_solve(objective_function_0, u, 1, [constants, computed_constants, algebraic, externals]) + + algebraic[0] = u[0] + + def initialise_variables(constants, computed_constants, algebraic): computed_constants[0] = 3.0 - computed_constants[1] = 5.0 - computed_constants[2] = 7.0 + computed_constants[1] = 7.0 + algebraic[0] = 1.0 def compute_computed_constants(constants, computed_constants): @@ -57,3 +81,4 @@ def compute_computed_constants(constants, computed_constants): def compute_variables(constants, computed_constants, algebraic, externals, external_variable): externals[0] = external_variable(constants, computed_constants, algebraic, externals, 0) + find_root_0(constants, computed_constants, algebraic, externals) From 6b74014367366addec366bddaf2e8ce8a96c8db4 Mon Sep 17 00:00:00 2001 From: Alan Garny Date: Tue, 10 Sep 2024 15:16:54 +1200 Subject: [PATCH 55/85] Python: improved the API documentation. --- src/bindings/interface/generatorprofile.i | 54 +++++++++++------------ 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/src/bindings/interface/generatorprofile.i b/src/bindings/interface/generatorprofile.i index 426cd08a21..62cb5f26d6 100644 --- a/src/bindings/interface/generatorprofile.i +++ b/src/bindings/interface/generatorprofile.i @@ -611,15 +611,15 @@ "Returns the string for a comment."; %feature("docstring") libcellml::GeneratorProfile::setCommentString -"Sets the string for a comment. To be useful, the string should contain the tag, which will be replaced +"Sets the string for a comment. To be useful, the string should contain the [CODE] tag, which will be replaced with a (proper) comment."; %feature("docstring") libcellml::GeneratorProfile::originCommentString "Returns the string for an origin comment."; %feature("docstring") libcellml::GeneratorProfile::setOriginCommentString -"Sets the string for an origin comment. To be useful, the string should contain the and - tags, which will be replaced with a statement about the profile and the version of libCellML +"Sets the string for an origin comment. To be useful, the string should contain the [PROFILE_INFORMATION] and +[LIBCELLML_VERSION] tags, which will be replaced with a statement about the profile and the version of libCellML used respectively."; %feature("docstring") libcellml::GeneratorProfile::interfaceFileNameString @@ -675,7 +675,7 @@ used respectively."; %feature("docstring") libcellml::GeneratorProfile::setImplementationStateCountString "Sets the string for the implementation of the state count constant. To be useful, the string should contain the - tag, which will be replaced with the number of states in the model."; +[STATE_COUNT] tag, which will be replaced with the number of states in the model."; %feature("docstring") libcellml::GeneratorProfile::interfaceConstantCountString "Returns the string for the interface of the constant count constant."; @@ -688,7 +688,7 @@ used respectively."; %feature("docstring") libcellml::GeneratorProfile::setImplementationConstantCountString "Sets the string for the implementation of the constant count constant. To be useful, the string should contain -the tag, which will be replaced with the number of states in the model."; +the [CONSTANT_COUNT] tag, which will be replaced with the number of states in the model."; %feature("docstring") libcellml::GeneratorProfile::interfaceComputedConstantCountString "Returns the string for the interface of the computed constant count constant."; @@ -701,7 +701,7 @@ the tag, which will be replaced with the number of states in th %feature("docstring") libcellml::GeneratorProfile::setImplementationComputedConstantCountString "Sets the string for the implementation of the computed constant count constant. To be useful, the string should contain -the tag, which will be replaced with the number of states in the model."; +the [COMPUTED_CONSTANT_COUNT] tag, which will be replaced with the number of states in the model."; %feature("docstring") libcellml::GeneratorProfile::interfaceAlgebraicCountString "Returns the string for the interface of the algebraic count constant."; @@ -714,7 +714,7 @@ the tag, which will be replaced with the number of sta %feature("docstring") libcellml::GeneratorProfile::setImplementationAlgebraicCountString "Sets the string for the implementation of the algebraic count constant. To be useful, the string should contain -the tag, which will be replaced with the number of states in the model."; +the [ALGEBRAIC_COUNT] tag, which will be replaced with the number of states in the model."; %feature("docstring") libcellml::GeneratorProfile::interfaceExternalCountString "Returns the string for the interface of the external count constant."; @@ -727,14 +727,14 @@ the tag, which will be replaced with the number of states in t %feature("docstring") libcellml::GeneratorProfile::setImplementationExternalCountString "Sets the string for the implementation of the external count constant. To be useful, the string should contain -the tag, which will be replaced with the number of states in the model."; +the [EXTERNAL_COUNT] tag, which will be replaced with the number of states in the model."; %feature("docstring") libcellml::GeneratorProfile::variableInfoObjectString "Returns the string for the data structure for the variable information object."; %feature("docstring") libcellml::GeneratorProfile::setVariableInfoObjectString "Sets the string for the data structure for the variable information object. To be useful, the string should -contain the , and tags, which will be replaced with the maximum size of +contain the [NAME_SIZE], [UNITS_SIZE] and [COMPONENT_SIZE] tags, which will be replaced with the maximum size of a string for holding the name of a component, variable and units, respectively."; %feature("docstring") libcellml::GeneratorProfile::interfaceVoiInfoString @@ -748,7 +748,7 @@ a string for holding the name of a component, variable and units, respectively." %feature("docstring") libcellml::GeneratorProfile::setImplementationVoiInfoString "Sets the string for the implementation of some information about the variable of integration. To be useful, the -string should contain the tag, which will be replaced with some information about the variable of +string should contain the [CODE] tag, which will be replaced with some information about the variable of integration."; %feature("docstring") libcellml::GeneratorProfile::interfaceStateInfoString @@ -762,7 +762,7 @@ integration."; %feature("docstring") libcellml::GeneratorProfile::setImplementationStateInfoString "Sets the string for the implementation of some information about the different states. To be useful, the string -should contain the tag, which will be replaced with some information about the different states."; +should contain the [CODE] tag, which will be replaced with some information about the different states."; %feature("docstring") libcellml::GeneratorProfile::interfaceConstantInfoString "Returns the string for the interface of some information about the different constants."; @@ -775,7 +775,7 @@ should contain the tag, which will be replaced with some information abou %feature("docstring") libcellml::GeneratorProfile::setImplementationConstantInfoString "Sets the string for the implementation of some information about the different constants. To be useful, the string -should contain the tag, which will be replaced with some information about the different constants."; +should contain the [CODE] tag, which will be replaced with some information about the different constants."; %feature("docstring") libcellml::GeneratorProfile::interfaceComputedConstantInfoString "Returns the string for the interface of some information about the different computed constants."; @@ -788,7 +788,7 @@ should contain the tag, which will be replaced with some information abou %feature("docstring") libcellml::GeneratorProfile::setImplementationComputedConstantInfoString "Sets the string for the implementation of some information about the different computed constants. To be useful, the string -should contain the tag, which will be replaced with some information about the different computed constants."; +should contain the [CODE] tag, which will be replaced with some information about the different computed constants."; %feature("docstring") libcellml::GeneratorProfile::interfaceAlgebraicInfoString "Returns the string for the interface of some information about the different algebraic variables."; @@ -801,7 +801,7 @@ should contain the tag, which will be replaced with some information abou %feature("docstring") libcellml::GeneratorProfile::setImplementationAlgebraicInfoString "Sets the string for the implementation of some information about the different algebraic variables. To be useful, the string -should contain the tag, which will be replaced with some information about the different algebraic variables."; +should contain the [CODE] tag, which will be replaced with some information about the different algebraic variables."; %feature("docstring") libcellml::GeneratorProfile::interfaceExternalInfoString "Returns the string for the interface of some information about the different external variables."; @@ -814,14 +814,14 @@ should contain the tag, which will be replaced with some information abou %feature("docstring") libcellml::GeneratorProfile::setImplementationExternalInfoString "Sets the string for the implementation of some information about the different external variables. To be useful, the string -should contain the tag, which will be replaced with some information about the different external variables."; +should contain the [CODE] tag, which will be replaced with some information about the different external variables."; %feature("docstring") libcellml::GeneratorProfile::variableInfoEntryString "Returns the string for an entry in an array for some information about a variable."; %feature("docstring") libcellml::GeneratorProfile::setVariableInfoEntryString "Sets the string for an entry in an array for some information about a variable. To be useful, the string should -contain the , and tags, which will be replaced with the name of the component, name +contain the [COMPONENT], [NAME] and [UNITS] tags, which will be replaced with the name of the component, name and units of a variable respectively."; %feature("docstring") libcellml::GeneratorProfile::voiString @@ -927,14 +927,14 @@ and units of a variable respectively."; "Sets the string for the f array used in the objective function and find root methods."; %feature("docstring") libcellml::GeneratorProfile::setReturnCreatedArrayString -"Sets the string for returning a created array. To be useful, the string should contain the tag, +"Sets the string for returning a created array. To be useful, the string should contain the [ARRAY_SIZE] tag, which will be replaced with the size of the array to be created."; %feature("docstring") libcellml::GeneratorProfile::interfaceCreateStatesArrayMethodString "Returns the string for the interface to create the states array."; %feature("docstring") libcellml::GeneratorProfile::setInterfaceCreateStatesArrayMethodString -"Sets the string for the interface to create the states array. To be useful, the string should contain the +"Sets the string for the interface to create the states array. To be useful, the string should contain the [CODE] tag, which will be replaced with some code to create the states array."; %feature("docstring") libcellml::GeneratorProfile::implementationCreateStatesArrayMethodString @@ -942,13 +942,13 @@ tag, which will be replaced with some code to create the states array."; %feature("docstring") libcellml::GeneratorProfile::setImplementationCreateStatesArrayMethodString "Sets the string for the implementation to create the states array. To be useful, the string should contain the - tag, which will be replaced with some code to create the states array."; +[CODE] tag, which will be replaced with some code to create the states array."; %feature("docstring") libcellml::GeneratorProfile::interfaceCreateConstantsArrayMethodString "Returns the string for the interface to create the constants array."; %feature("docstring") libcellml::GeneratorProfile::setInterfaceCreateConstantsArrayMethodString -"Sets the string for the interface to create the constants array. To be useful, the string should contain the +"Sets the string for the interface to create the constants array. To be useful, the string should contain the [CODE] tag, which will be replaced with some code to create the constants array."; %feature("docstring") libcellml::GeneratorProfile::implementationCreateConstantsArrayMethodString @@ -956,13 +956,13 @@ tag, which will be replaced with some code to create the constants array."; %feature("docstring") libcellml::GeneratorProfile::setImplementationCreateConstantsArrayMethodString "Sets the string for the implementation to create the constants array. To be useful, the string should contain the - tag, which will be replaced with some code to create the constants array."; +[CODE] tag, which will be replaced with some code to create the constants array."; %feature("docstring") libcellml::GeneratorProfile::interfaceCreateComputedConstantsArrayMethodString "Returns the string for the interface to create the computed constants array."; %feature("docstring") libcellml::GeneratorProfile::setInterfaceCreateComputedConstantsArrayMethodString -"Sets the string for the interface to create the computed constants array. To be useful, the string should contain the +"Sets the string for the interface to create the computed constants array. To be useful, the string should contain the [CODE] tag, which will be replaced with some code to create the computed constants array."; %feature("docstring") libcellml::GeneratorProfile::implementationCreateComputedConstantsArrayMethodString @@ -970,13 +970,13 @@ tag, which will be replaced with some code to create the computed constants arra %feature("docstring") libcellml::GeneratorProfile::setImplementationCreateComputedConstantsArrayMethodString "Sets the string for the implementation to create the computed constants array. To be useful, the string should contain the - tag, which will be replaced with some code to create the computed constants array."; +[CODE] tag, which will be replaced with some code to create the computed constants array."; %feature("docstring") libcellml::GeneratorProfile::interfaceCreateAlgebraicArrayMethodString "Returns the string for the interface to create the algebraic array."; %feature("docstring") libcellml::GeneratorProfile::setInterfaceCreateAlgebraicArrayMethodString -"Sets the string for the interface to create the algebraic array. To be useful, the string should contain the +"Sets the string for the interface to create the algebraic array. To be useful, the string should contain the [CODE] tag, which will be replaced with some code to create the algebraic array."; %feature("docstring") libcellml::GeneratorProfile::implementationCreateAlgebraicArrayMethodString @@ -984,13 +984,13 @@ tag, which will be replaced with some code to create the algebraic array."; %feature("docstring") libcellml::GeneratorProfile::setImplementationCreateAlgebraicArrayMethodString "Sets the string for the implementation to create the algebraic array. To be useful, the string should contain the - tag, which will be replaced with some code to create the algebraic array."; +[CODE] tag, which will be replaced with some code to create the algebraic array."; %feature("docstring") libcellml::GeneratorProfile::interfaceCreateExternalsArrayMethodString "Returns the string for the interface to create the externals array."; %feature("docstring") libcellml::GeneratorProfile::setInterfaceCreateExternalsArrayMethodString -"Sets the string for the interface to create the externals array. To be useful, the string should contain the +"Sets the string for the interface to create the externals array. To be useful, the string should contain the [CODE] tag, which will be replaced with some code to create the externals array."; %feature("docstring") libcellml::GeneratorProfile::implementationCreateExternalsArrayMethodString @@ -998,7 +998,7 @@ tag, which will be replaced with some code to create the externals array."; %feature("docstring") libcellml::GeneratorProfile::setImplementationCreateExternalsArrayMethodString "Sets the string for the implementation to create the externals array. To be useful, the string should contain the - tag, which will be replaced with some code to create the externals array."; +[CODE] tag, which will be replaced with some code to create the externals array."; %feature("docstring") libcellml::GeneratorProfile::interfaceDeleteArrayMethodString "Returns the string for the interface to delete an array."; From dcbd03817694897efb75349b77997202c85954e4 Mon Sep 17 00:00:00 2001 From: Alan Garny Date: Tue, 10 Sep 2024 16:44:23 +1200 Subject: [PATCH 56/85] Some minor cleaning up. --- src/debug.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/debug.cpp b/src/debug.cpp index 8a7b330e6b..a41ed57b4e 100644 --- a/src/debug.cpp +++ b/src/debug.cpp @@ -194,7 +194,6 @@ void printHistory(const History &history) for (const auto &h : history) { printHistoryEpoch(h); } - } void printHistoryEpoch(const HistoryEpochPtr &historyEpoch) @@ -234,7 +233,8 @@ void printEquivalenceMap(const EquivalenceMap &map) void printEquivalenceMapWithModelInfo(const EquivalenceMap &map, const ModelPtr &model) { for (const auto &iter : map) { - auto key = iter.first; Debug(false) << "key: "; + auto key = iter.first; + Debug(false) << "key: "; printStackWithModelInfo(key, model); auto vector = iter.second; for (const auto &vectorIt : vector) { From bc97102ba4b10d394d7fa78607296d0f755989ae Mon Sep 17 00:00:00 2001 From: Alan Garny Date: Tue, 15 Oct 2024 12:18:31 +1300 Subject: [PATCH 57/85] AnalyserEquationAst: don't include "libcellml/undefines.h" in the .cpp file. It's already included in the corresponding .h file. --- src/analyserequationast.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/analyserequationast.cpp b/src/analyserequationast.cpp index f543f766f1..ccb0a915a6 100644 --- a/src/analyserequationast.cpp +++ b/src/analyserequationast.cpp @@ -18,8 +18,6 @@ limitations under the License. #include "analyserequationast_p.h" -#include "libcellml/undefines.h" - namespace libcellml { void AnalyserEquationAst::AnalyserEquationAstImpl::populate(AnalyserEquationAst::Type type, From a581c7fb3769a2c985151ed6c35b6d1cf7f11d58 Mon Sep 17 00:00:00 2001 From: Alan Garny Date: Tue, 15 Oct 2024 12:41:14 +1300 Subject: [PATCH 58/85] SWIG: make it work with Clang 19 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Indeed, from https://releases.llvm.org/19.1.0/tools/clang/docs/ReleaseNotes.html: Added the INFINITY and NAN macros to Clang’s freestanding implementation; these macros were defined in in C99 but C23 added them to in WG14 N2848. --- src/bindings/interface/analyserequationast.i | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/bindings/interface/analyserequationast.i b/src/bindings/interface/analyserequationast.i index 3d064c706f..d8d42695f6 100644 --- a/src/bindings/interface/analyserequationast.i +++ b/src/bindings/interface/analyserequationast.i @@ -53,6 +53,9 @@ "Swaps the left and right children of this :class:`AnalyserEquationAst` object."; %{ +#include +#include + #include "libcellml/analyserequationast.h" %} From c07412bbcd47476d9c64828daae710d2ec2431eb Mon Sep 17 00:00:00 2001 From: Alan Garny Date: Tue, 15 Oct 2024 16:56:34 +1300 Subject: [PATCH 59/85] API: simplifed/improved the API for external variables. --- src/analyser.cpp | 45 ++++--- src/api/libcellml/analyser.h | 138 ++++++++------------- src/bindings/interface/analyser.i | 9 +- src/bindings/javascript/analyser.cpp | 10 +- tests/analyser/analyser.cpp | 121 ++++++++++-------- tests/bindings/javascript/analyser.test.js | 42 ++++--- tests/bindings/python/test_analyser.py | 6 +- 7 files changed, 182 insertions(+), 189 deletions(-) diff --git a/src/analyser.cpp b/src/analyser.cpp index 8b7c869481..dd7f327e77 100644 --- a/src/analyser.cpp +++ b/src/analyser.cpp @@ -622,9 +622,7 @@ class Analyser::AnalyserImpl: public Logger::LoggerImpl void analyseModel(const ModelPtr &model); - AnalyserExternalVariablePtrs::const_iterator findExternalVariable(const ModelPtr &model, - const std::string &componentName, - const std::string &variableName) const; + AnalyserExternalVariablePtrs::const_iterator findExternalVariable(const VariablePtr &variable) const; AnalyserExternalVariablePtrs::const_iterator findExternalVariable(const AnalyserExternalVariablePtr &externalVariable) const; }; @@ -3290,16 +3288,10 @@ void Analyser::AnalyserImpl::analyseModel(const ModelPtr &model) } } -AnalyserExternalVariablePtrs::const_iterator Analyser::AnalyserImpl::findExternalVariable(const ModelPtr &model, - const std::string &componentName, - const std::string &variableName) const +AnalyserExternalVariablePtrs::const_iterator Analyser::AnalyserImpl::findExternalVariable(const VariablePtr &variable) const { return std::find_if(mExternalVariables.begin(), mExternalVariables.end(), [=](const auto &ev) { - auto variable = ev->variable(); - - return (owningModel(variable) == model) - && (owningComponent(variable)->name() == componentName) - && (variable->name() == variableName); + return ev->variable() == variable; }); } @@ -3387,6 +3379,19 @@ void Analyser::analyseModel(const ModelPtr &model) } } +bool Analyser::addExternalVariable(const VariablePtr &variable) +{ + for (const auto &externalVariable : pFunc()->mExternalVariables) { + if (externalVariable->variable() == variable) { + return false; + } + } + + pFunc()->mExternalVariables.push_back(AnalyserExternalVariable::create(variable)); + + return true; +} + bool Analyser::addExternalVariable(const AnalyserExternalVariablePtr &externalVariable) { if (std::find(pFunc()->mExternalVariables.begin(), pFunc()->mExternalVariables.end(), externalVariable) == pFunc()->mExternalVariables.end()) { @@ -3409,11 +3414,9 @@ bool Analyser::removeExternalVariable(size_t index) return false; } -bool Analyser::removeExternalVariable(const ModelPtr &model, - const std::string &componentName, - const std::string &variableName) +bool Analyser::removeExternalVariable(const VariablePtr &variable) { - auto result = pFunc()->findExternalVariable(model, componentName, variableName); + auto result = pFunc()->findExternalVariable(variable); if (result != pFunc()->mExternalVariables.end()) { pFunc()->mExternalVariables.erase(result); @@ -3442,11 +3445,9 @@ void Analyser::removeAllExternalVariables() pFunc()->mExternalVariables.clear(); } -bool Analyser::containsExternalVariable(const ModelPtr &model, - const std::string &componentName, - const std::string &variableName) const +bool Analyser::containsExternalVariable(const VariablePtr &variable) const { - return pFunc()->findExternalVariable(model, componentName, variableName) != pFunc()->mExternalVariables.end(); + return pFunc()->findExternalVariable(variable) != pFunc()->mExternalVariables.end(); } bool Analyser::containsExternalVariable(const AnalyserExternalVariablePtr &externalVariable) const @@ -3463,11 +3464,9 @@ AnalyserExternalVariablePtr Analyser::externalVariable(size_t index) const return nullptr; } -AnalyserExternalVariablePtr Analyser::externalVariable(const ModelPtr &model, - const std::string &componentName, - const std::string &variableName) const +AnalyserExternalVariablePtr Analyser::externalVariable(const VariablePtr &variable) const { - auto result = pFunc()->findExternalVariable(model, componentName, variableName); + auto result = pFunc()->findExternalVariable(variable); if (result != pFunc()->mExternalVariables.end()) { return *result; diff --git a/src/api/libcellml/analyser.h b/src/api/libcellml/analyser.h index 765c4a9946..eff53741e4 100644 --- a/src/api/libcellml/analyser.h +++ b/src/api/libcellml/analyser.h @@ -59,10 +59,23 @@ class LIBCELLML_EXPORT Analyser: public Logger void analyseModel(const ModelPtr &model); /** + * @brief Add a @ref VariablePtr as an external variable to this @ref Analyser. + * + * Add the given @ref VariablePtr as an external variable to this @ref Analyser, but only if it has not already been + * added. + * + * @param variable The @ref Variable to add as an external variable. + * + * @return @c true if the variable was added, @c false otherwise. + */ + bool addExternalVariable(const VariablePtr &variable); + + /** + * @overload + * * @brief Add an @ref AnalyserExternalVariable to this @ref Analyser. * - * Add the given @ref AnalyserExternalVariable to this @ref Analyser, but only - * if the given @ref AnalyserExternalVariable has not already been added. + * Add the given @ref AnalyserExternalVariable to this @ref Analyser, but only if it has not already been added. * * @param externalVariable The @ref AnalyserExternalVariable to add. * @@ -73,150 +86,107 @@ class LIBCELLML_EXPORT Analyser: public Logger /** * @brief Remove the @ref AnalyserExternalVariable at the given @p index. * - * Remove the @ref AnalyserExternalVariable with the given @p index. The - * @p index must be in the range [0, \#externalVariables). + * Remove the @ref AnalyserExternalVariable with the given @p index. The @p index must be in the range + * [0, \#externalVariables). * * @param index The index of the @ref AnalyserExternalVariable to remove. * - * @return @c true if the @ref AnalyserExternalVariable was removed, @c false - * otherwise. + * @return @c true if the @ref AnalyserExternalVariable was removed, @c false otherwise. */ bool removeExternalVariable(size_t index); /** * @overload * - * @brief Remove the @ref AnalyserExternalVariable with the given - * @p variableName in the @ref Component with the given @p componentName in - * the given @p model. + * @brief Remove the @ref AnalyserExternalVariable for the given @p variable. * - * Remove the @ref AnalyserExternalVariable found that matches the given - * @p variableName in the @ref Component with the given @p componentName in - * the given @p model. + * Remove the @ref AnalyserExternalVariable found that matches the given @p variable. * - * @param model The pointer to the @ref Model which contains the - * @ref AnalyserExternalVariable to remove. - * @param componentName The name of the @ref Component which contains the - * @ref AnalyserExternalVariable to remove. - * @param variableName The name of the @ref AnalyserExternalVariable to - * remove. + * @param variable The @ref Variable for which to remove the @ref AnalyserExternalVariable. * - * @return @c true if the @ref AnalyserExternalVariable was removed, @c false - * otherwise. + * @return @c true if the @ref AnalyserExternalVariable was removed, @c false otherwise. */ - bool removeExternalVariable(const ModelPtr &model, - const std::string &componentName, - const std::string &variableName); + bool removeExternalVariable(const VariablePtr &variable); /** * @overload * - * @brief Remove the @ref AnalyserExternalVariable with the given pointer. + * @brief Remove the @ref AnalyserExternalVariable for the given @p externalVariable. * - * Remove the @ref AnalyserExternalVariable with the pointer - * @p externalVariable. + * Remove the @ref AnalyserExternalVariable for the given @p externalVariable. * - * @param externalVariable The pointer to the @ref AnalyserExternalVariable to remove. + * @param externalVariable The @ref AnalyserExternalVariable to remove. * - * @return @c true if the @ref AnalyserExternalVariable was removed, @c false - * otherwise. + * @return @c true if the @ref AnalyserExternalVariable was removed, @c false otherwise. */ bool removeExternalVariable(const AnalyserExternalVariablePtr &externalVariable); /** - * @brief Remove all @ref AnalyserExternalVariable items from this - * @ref Analyser. + * @brief Remove all the @ref AnalyserExternalVariable items from this @ref Analyser. * - * Clear all @ref AnalyserExternalVariable items that have been added to this - * @ref Analyser. + * Remove all the @ref AnalyserExternalVariable items that were added to this @ref Analyser. */ void removeAllExternalVariables(); /** - * @brief Test to see if the @ref AnalyserExternalVariable with the given - * @p variableName in the @ref Component with the given @p componentName in - * the given @p model is contained within this @ref Analyser. - * - * Test to see if the @ref AnalyserExternalVariable with the the given - * @p variableName in the @ref Component with the given @p componentName in - * the given @p model is contained within this @ref Analyser. Return @c true - * if the @ref AnalyserExternalVariable is in the @ref Analyser and @c false + * @brief Test to see if an @ref AnalyserExternalVariable for the given @p variable is contained within this + * @ref Analyser. + * + * Test to see if an @ref AnalyserExternalVariable for the the given @p variable is contained within this + * @ref Analyser. Return @c true if an @ref AnalyserExternalVariable is in this @ref Analyser and @c false * otherwise. * - * @param model The pointer to the @ref Model which contains the - * @ref AnalyserExternalVariable to test. - * @param componentName The name of the @ref Component which contains the - * @ref AnalyserExternalVariable to test. - * @param variableName The name of the @ref AnalyserExternalVariable to test. + * @param variable The @ref Variable to test. * - * @return @c true if the @ref AnalyserExternalVariable is in this @ref Analyser - * and @c false otherwise. + * @return @c true if an @ref AnalyserExternalVariable is in this @ref Analyser, @c false otherwise. */ - bool containsExternalVariable(const ModelPtr &model, - const std::string &componentName, - const std::string &variableName) const; + bool containsExternalVariable(const VariablePtr &variable) const; /** * @overload * - * @brief Test to see if the @ref AnalyserExternalVariable with the given - * pointer is contained within this @ref Analyser. + * @brief Test to see if an @ref AnalyserExternalVariable for the given @p externalVariable is contained within this + * @ref Analyser. * - * Test to see if the @ref AnalyserExternalVariable with the given pointer is - * contained within this @ref Analyser. Return @c true if the - * @ref AnalyserExternalVariable is in the @ref Analyser and @c false otherwise. + * Test to see if an @ref AnalyserExternalVariable for the given @p externalVariable is contained within this + * @ref Analyser. Return @c true if an @ref AnalyserExternalVariable is in this @ref Analyser, @c false otherwise. * - * @param externalVariable The pointer to the @ref AnalyserExternalVariable to remove. + * @param externalVariable The @ref AnalyserExternalVariable to test. * - * @return @c true if the @ref AnalyserExternalVariable is in this @ref Analyser - * and @c false otherwise. + * @return @c true if an @ref AnalyserExternalVariable is in this @ref Analyser, @c false otherwise. */ bool containsExternalVariable(const AnalyserExternalVariablePtr &externalVariable) const; /** * @brief Get the @ref AnalyserExternalVariable at the given @p index. * - * Return a reference to the @ref AnalyserExternalVariable at the given - * @p index. The @p index must be in the range [0, \#externalVariables). + * Return the @ref AnalyserExternalVariable at the given @p index. The @p index must be in the range + * [0, \#externalVariables). * * @param index The index of the @ref AnalyserExternalVariable to return. * - * @return The @ref AnalyserExternalVariable at the given @p index on success, - * @c nullptr on failure. + * @return The @ref AnalyserExternalVariable at the given @p index on success, @c nullptr on failure. */ AnalyserExternalVariablePtr externalVariable(size_t index) const; /** * @overload * - * @brief Get the @ref AnalyserExternalVariable with the given @p name. + * @brief Get the @ref AnalyserExternalVariable for the given @p variable. * - * Return the @ref AnalyserExternalVariable with the given @p variableName in - * the @ref Component with the given @p componentName in the given @p model. - * If no such @ref AnalyserExternalVariable is contained within the - * @ref Analyser, a @c nullptr is returned. + * Return the @ref AnalyserExternalVariable for the given @p variable. If no such @ref AnalyserExternalVariable is + * contained within this @ref Analyser, a @c nullptr is returned. * - * @param model The pointer to the @ref Model which contains the - * @ref AnalyserExternalVariable to retrieve. - * @param componentName The name of the @ref Component which contains the - * @ref AnalyserExternalVariable to retrieve. - * @param variableName The name of the @ref AnalyserExternalVariable to - * retrieve. + * @param variable The @ref Variable for which to retrieve the @ref AnalyserExternalVariable. * - * @return The @ref AnalyserExternalVariable with the given @p variableName in - * the @ref Component with the given @p componentName in the given @p model on - * success, @c nullptr on failure. + * @return The @ref AnalyserExternalVariable for the given @p variable on success, @c nullptr on failure. */ - AnalyserExternalVariablePtr externalVariable(const ModelPtr &model, - const std::string &componentName, - const std::string &variableName) const; + AnalyserExternalVariablePtr externalVariable(const VariablePtr &variable) const; /** - * @brief Get the number of @ref AnalyserExternalVariable items in this - * @ref Analyser. + * @brief Get the number of @ref AnalyserExternalVariable items in this @ref Analyser. * - * Return the number of @ref AnalyserExternalVariable items the @ref Analyser - * contains. + * Return the number of @ref AnalyserExternalVariable items this @ref Analyser contains. * * @return The number of @ref AnalyserExternalVariable items. */ diff --git a/src/bindings/interface/analyser.i b/src/bindings/interface/analyser.i index 050cfd0999..8ae80be210 100644 --- a/src/bindings/interface/analyser.i +++ b/src/bindings/interface/analyser.i @@ -17,19 +17,16 @@ "Adds a variable as an external variable to this analyser."; %feature("docstring") libcellml::Analyser::removeExternalVariable -"Removes an external variable specified by 1) an index, 2) a :class:`Model` object, component name and variable -name, or 3) a :class:`Variable` object. Returns `True` on success."; +"Removes an external variable specified by 1) an index, 2) a :class:`Variable` object, or 3) an :class:`AnalyserExternalVariable` object. Returns `True` on success."; %feature("docstring") libcellml::Analyser::removeAllExternalVariables "Removes all external variables from this analyser."; %feature("docstring") libcellml::Analyser::containsExternalVariable -"Tests if an external variable, specified by 1) a :class:`Model` object, component name and variable name, or 2) -an :class:`AnalyserExternalVariable` object, is contained within this analyser."; +"Tests if an external variable, specified by 1) a :class:`Variable` object, or 2) an :class:`AnalyserExternalVariable` object, is contained within this analyser."; %feature("docstring") libcellml::Analyser::externalVariable -"Returns the external variable, specified by 1) an index, or 2) a :class:`Model` object, component name and -variable name."; +"Returns the external variable, specified by 1) an index, or 2) a :class:`Variable` object."; %feature("docstring") libcellml::Analyser::externalVariableCount "Returns the number of external variables this analyser contains."; diff --git a/src/bindings/javascript/analyser.cpp b/src/bindings/javascript/analyser.cpp index 99835a9f50..ce99fa6f79 100644 --- a/src/bindings/javascript/analyser.cpp +++ b/src/bindings/javascript/analyser.cpp @@ -25,17 +25,17 @@ EMSCRIPTEN_BINDINGS(libcellml_analyser) class_>("Analyser") .smart_ptr_constructor("Analyser", &libcellml::Analyser::create) .function("analyseModel", &libcellml::Analyser::analyseModel) - .function("addExternalVariable", &libcellml::Analyser::addExternalVariable) + .function("addExternalVariableByVariable", select_overload(&libcellml::Analyser::addExternalVariable)) + .function("addExternalVariableByExternalVariable", select_overload(&libcellml::Analyser::addExternalVariable)) .function("removeExternalVariableByIndex", select_overload(&libcellml::Analyser::removeExternalVariable)) - .function("removeExternalVariableByModel", select_overload(&libcellml::Analyser::removeExternalVariable)) + .function("removeExternalVariableByVariable", select_overload(&libcellml::Analyser::removeExternalVariable)) .function("removeExternalVariableByExternalVariable", select_overload(&libcellml::Analyser::removeExternalVariable)) .function("removeAllExternalVariables", &libcellml::Analyser::removeAllExternalVariables) - .function("containsExternalVariableByModel", select_overload(&libcellml::Analyser::containsExternalVariable)) + .function("containsExternalVariableByVariable", select_overload(&libcellml::Analyser::containsExternalVariable)) .function("containsExternalVariableByExternalVariable", select_overload(&libcellml::Analyser::containsExternalVariable)) .function("externalVariableByIndex", select_overload(&libcellml::Analyser::externalVariable)) - .function("externalVariableByModel", select_overload(&libcellml::Analyser::externalVariable)) + .function("externalVariableByVariable", select_overload(&libcellml::Analyser::externalVariable)) .function("externalVariableCount", &libcellml::Analyser::externalVariableCount) .function("model", &libcellml::Analyser::model) ; } - diff --git a/tests/analyser/analyser.cpp b/tests/analyser/analyser.cpp index c7e1678b95..59c6570959 100644 --- a/tests/analyser/analyser.cpp +++ b/tests/analyser/analyser.cpp @@ -398,7 +398,26 @@ TEST(Analyser, unsuitablyConstrained) EXPECT_EQ(libcellml::AnalyserModel::Type::UNSUITABLY_CONSTRAINED, analyser->model()->type()); } -TEST(Analyser, addSameExternalVariable) +TEST(Analyser, addSameExternalVariableAsVariable) +{ + auto parser = libcellml::Parser::create(); + auto model = parser->parseModel(fileContents("generator/hodgkin_huxley_squid_axon_model_1952/model.cellml")); + + EXPECT_EQ(size_t(0), parser->issueCount()); + + auto analyser = libcellml::Analyser::create(); + auto variable = model->component("membrane")->variable("V"); + + analyser->addExternalVariable(variable); + + EXPECT_EQ(size_t(1), analyser->externalVariableCount()); + + analyser->addExternalVariable(variable); + + EXPECT_EQ(size_t(1), analyser->externalVariableCount()); +} + +TEST(Analyser, addSameExternalVariableAsExternalVariable) { auto parser = libcellml::Parser::create(); auto model = parser->parseModel(fileContents("generator/hodgkin_huxley_squid_axon_model_1952/model.cellml")); @@ -434,8 +453,8 @@ TEST(Analyser, addExternalVariableFromDifferentModels) auto analyser = libcellml::Analyser::create(); - analyser->addExternalVariable(libcellml::AnalyserExternalVariable::create(model->component("membrane")->variable("V"))); - analyser->addExternalVariable(libcellml::AnalyserExternalVariable::create(other_model->component("membrane")->variable("V"))); + analyser->addExternalVariable(model->component("membrane")->variable("V")); + analyser->addExternalVariable(other_model->component("membrane")->variable("V")); EXPECT_EQ(size_t(2), analyser->externalVariableCount()); @@ -463,7 +482,7 @@ TEST(Analyser, removeExternalVariableByIndex) EXPECT_FALSE(analyser->removeExternalVariable(0)); - analyser->addExternalVariable(libcellml::AnalyserExternalVariable::create(model->component("membrane")->variable("V"))); + analyser->addExternalVariable(model->component("membrane")->variable("V")); EXPECT_TRUE(analyser->removeExternalVariable(0)); EXPECT_FALSE(analyser->removeExternalVariable(1)); @@ -477,16 +496,16 @@ TEST(Analyser, removeExternalVariableByName) EXPECT_EQ(size_t(0), parser->issueCount()); auto analyser = libcellml::Analyser::create(); + auto variable = model->component("membrane")->variable("V"); - EXPECT_FALSE(analyser->removeExternalVariable(model, "membrane", "V")); + EXPECT_FALSE(analyser->removeExternalVariable(variable)); - analyser->addExternalVariable(libcellml::AnalyserExternalVariable::create(model->component("membrane")->variable("V"))); + analyser->addExternalVariable(variable); - EXPECT_FALSE(analyser->removeExternalVariable(nullptr, "membrane", "V")); - EXPECT_FALSE(analyser->removeExternalVariable(model, "X", "V")); - EXPECT_FALSE(analyser->removeExternalVariable(model, "membrane", "X")); - EXPECT_TRUE(analyser->removeExternalVariable(model, "membrane", "V")); - EXPECT_FALSE(analyser->removeExternalVariable(model, "membrane", "V")); + EXPECT_FALSE(analyser->removeExternalVariable(static_cast(nullptr))); + EXPECT_FALSE(analyser->removeExternalVariable(model->component("membrane")->variable("Cm"))); + EXPECT_TRUE(analyser->removeExternalVariable(variable)); + EXPECT_FALSE(analyser->removeExternalVariable(variable)); } TEST(Analyser, removeExternalVariableByPointer) @@ -503,7 +522,7 @@ TEST(Analyser, removeExternalVariableByPointer) analyser->addExternalVariable(externalVariable); - EXPECT_FALSE(analyser->removeExternalVariable(nullptr)); + EXPECT_FALSE(analyser->removeExternalVariable(static_cast(nullptr))); EXPECT_TRUE(analyser->removeExternalVariable(externalVariable)); EXPECT_FALSE(analyser->removeExternalVariable(externalVariable)); } @@ -517,9 +536,9 @@ TEST(Analyser, removeAllExternalVariables) auto analyser = libcellml::Analyser::create(); - analyser->addExternalVariable(libcellml::AnalyserExternalVariable::create(model->component("membrane")->variable("V"))); - analyser->addExternalVariable(libcellml::AnalyserExternalVariable::create(model->component("sodium_channel")->variable("V"))); - analyser->addExternalVariable(libcellml::AnalyserExternalVariable::create(model->component("potassium_channel")->variable("V"))); + analyser->addExternalVariable(model->component("membrane")->variable("V")); + analyser->addExternalVariable(model->component("sodium_channel")->variable("V")); + analyser->addExternalVariable(model->component("potassium_channel")->variable("V")); EXPECT_EQ(size_t(3), analyser->externalVariableCount()); @@ -536,11 +555,13 @@ TEST(Analyser, containsExternalVariableByName) EXPECT_EQ(size_t(0), parser->issueCount()); auto analyser = libcellml::Analyser::create(); + auto variable = model->component("membrane")->variable("V"); - analyser->addExternalVariable(libcellml::AnalyserExternalVariable::create(model->component("membrane")->variable("V"))); + analyser->addExternalVariable(variable); - EXPECT_TRUE(analyser->containsExternalVariable(model, "membrane", "V")); - EXPECT_FALSE(analyser->containsExternalVariable(model, "membrane", "X")); + EXPECT_TRUE(analyser->containsExternalVariable(variable)); + EXPECT_FALSE(analyser->containsExternalVariable(static_cast(nullptr))); + EXPECT_FALSE(analyser->containsExternalVariable(model->component("membrane")->variable("Cm"))); } TEST(Analyser, containsExternalVariableByPointer) @@ -556,7 +577,7 @@ TEST(Analyser, containsExternalVariableByPointer) analyser->addExternalVariable(externalVariable); EXPECT_TRUE(analyser->containsExternalVariable(externalVariable)); - EXPECT_FALSE(analyser->containsExternalVariable(nullptr)); + EXPECT_FALSE(analyser->containsExternalVariable(static_cast(nullptr))); } TEST(Analyser, externalVariableByIndex) @@ -586,15 +607,17 @@ TEST(Analyser, externalVariableByName) EXPECT_EQ(size_t(0), parser->issueCount()); auto analyser = libcellml::Analyser::create(); + auto variable = model->component("membrane")->variable("V"); - EXPECT_EQ(nullptr, analyser->externalVariable(model, "membrane", "V")); + EXPECT_EQ(nullptr, analyser->externalVariable(variable)); auto externalVariable = libcellml::AnalyserExternalVariable::create(model->component("membrane")->variable("V")); analyser->addExternalVariable(externalVariable); - EXPECT_EQ(externalVariable, analyser->externalVariable(model, "membrane", "V")); - EXPECT_EQ(nullptr, analyser->externalVariable(model, "membrane", "X")); + EXPECT_EQ(externalVariable, analyser->externalVariable(variable)); + EXPECT_EQ(nullptr, analyser->externalVariable(static_cast(nullptr))); + EXPECT_EQ(nullptr, analyser->externalVariable(model->component("membrane")->variable("Cm"))); } TEST(Analyser, onePrimaryVoiExternalVariable) @@ -610,7 +633,7 @@ TEST(Analyser, onePrimaryVoiExternalVariable) auto analyser = libcellml::Analyser::create(); - analyser->addExternalVariable(libcellml::AnalyserExternalVariable::create(model->component("environment")->variable("time"))); + analyser->addExternalVariable(model->component("environment")->variable("time")); analyser->analyseModel(model); @@ -630,7 +653,7 @@ TEST(Analyser, oneNonPrimaryVoiExternalVariable) auto analyser = libcellml::Analyser::create(); - analyser->addExternalVariable(libcellml::AnalyserExternalVariable::create(model->component("membrane")->variable("time"))); + analyser->addExternalVariable(model->component("membrane")->variable("time")); analyser->analyseModel(model); @@ -650,8 +673,8 @@ TEST(Analyser, twoEquivalentVoiExternalVariablesIncludingPrimaryVariable) auto analyser = libcellml::Analyser::create(); - analyser->addExternalVariable(libcellml::AnalyserExternalVariable::create(model->component("environment")->variable("time"))); - analyser->addExternalVariable(libcellml::AnalyserExternalVariable::create(model->component("membrane")->variable("time"))); + analyser->addExternalVariable(model->component("environment")->variable("time")); + analyser->addExternalVariable(model->component("membrane")->variable("time")); analyser->analyseModel(model); @@ -676,8 +699,8 @@ TEST(Analyser, twoEquivalentVoiExternalVariablesNotIncludingPrimaryVariable) auto analyser = libcellml::Analyser::create(); - analyser->addExternalVariable(libcellml::AnalyserExternalVariable::create(model->component("membrane")->variable("time"))); - analyser->addExternalVariable(libcellml::AnalyserExternalVariable::create(model->component("sodium_channel")->variable("time"))); + analyser->addExternalVariable(model->component("membrane")->variable("time")); + analyser->addExternalVariable(model->component("sodium_channel")->variable("time")); analyser->analyseModel(model); @@ -702,9 +725,9 @@ TEST(Analyser, threeEquivalentVoiExternalVariablesIncludingPrimaryVariable) auto analyser = libcellml::Analyser::create(); - analyser->addExternalVariable(libcellml::AnalyserExternalVariable::create(model->component("environment")->variable("time"))); - analyser->addExternalVariable(libcellml::AnalyserExternalVariable::create(model->component("membrane")->variable("time"))); - analyser->addExternalVariable(libcellml::AnalyserExternalVariable::create(model->component("sodium_channel")->variable("time"))); + analyser->addExternalVariable(model->component("environment")->variable("time")); + analyser->addExternalVariable(model->component("membrane")->variable("time")); + analyser->addExternalVariable(model->component("sodium_channel")->variable("time")); analyser->analyseModel(model); @@ -729,9 +752,9 @@ TEST(Analyser, threeEquivalentVoiExternalVariablesNotIncludingPrimaryVariable) auto analyser = libcellml::Analyser::create(); - analyser->addExternalVariable(libcellml::AnalyserExternalVariable::create(model->component("membrane")->variable("time"))); - analyser->addExternalVariable(libcellml::AnalyserExternalVariable::create(model->component("sodium_channel")->variable("time"))); - analyser->addExternalVariable(libcellml::AnalyserExternalVariable::create(model->component("potassium_channel")->variable("time"))); + analyser->addExternalVariable(model->component("membrane")->variable("time")); + analyser->addExternalVariable(model->component("sodium_channel")->variable("time")); + analyser->addExternalVariable(model->component("potassium_channel")->variable("time")); analyser->analyseModel(model); @@ -752,7 +775,7 @@ TEST(Analyser, onePrimaryExternalVariable) auto analyser = libcellml::Analyser::create(); - analyser->addExternalVariable(libcellml::AnalyserExternalVariable::create(model->component("membrane")->variable("V"))); + analyser->addExternalVariable(model->component("membrane")->variable("V")); analyser->analyseModel(model); @@ -772,7 +795,7 @@ TEST(Analyser, oneNonPrimaryExternalVariable) auto analyser = libcellml::Analyser::create(); - analyser->addExternalVariable(libcellml::AnalyserExternalVariable::create(model->component("sodium_channel")->variable("V"))); + analyser->addExternalVariable(model->component("sodium_channel")->variable("V")); analyser->analyseModel(model); @@ -797,8 +820,8 @@ TEST(Analyser, twoEquivalentExternalVariablesIncludingPrimaryVariable) auto analyser = libcellml::Analyser::create(); - analyser->addExternalVariable(libcellml::AnalyserExternalVariable::create(model->component("membrane")->variable("V"))); - analyser->addExternalVariable(libcellml::AnalyserExternalVariable::create(model->component("sodium_channel")->variable("V"))); + analyser->addExternalVariable(model->component("membrane")->variable("V")); + analyser->addExternalVariable(model->component("sodium_channel")->variable("V")); analyser->analyseModel(model); @@ -823,8 +846,8 @@ TEST(Analyser, twoEquivalentExternalVariablesNotIncludingPrimaryVariable) auto analyser = libcellml::Analyser::create(); - analyser->addExternalVariable(libcellml::AnalyserExternalVariable::create(model->component("sodium_channel")->variable("V"))); - analyser->addExternalVariable(libcellml::AnalyserExternalVariable::create(model->component("potassium_channel")->variable("V"))); + analyser->addExternalVariable(model->component("sodium_channel")->variable("V")); + analyser->addExternalVariable(model->component("potassium_channel")->variable("V")); analyser->analyseModel(model); @@ -849,9 +872,9 @@ TEST(Analyser, threeEquivalentExternalVariablesIncludingPrimaryVariable) auto analyser = libcellml::Analyser::create(); - analyser->addExternalVariable(libcellml::AnalyserExternalVariable::create(model->component("membrane")->variable("V"))); - analyser->addExternalVariable(libcellml::AnalyserExternalVariable::create(model->component("sodium_channel")->variable("V"))); - analyser->addExternalVariable(libcellml::AnalyserExternalVariable::create(model->component("potassium_channel")->variable("V"))); + analyser->addExternalVariable(model->component("membrane")->variable("V")); + analyser->addExternalVariable(model->component("sodium_channel")->variable("V")); + analyser->addExternalVariable(model->component("potassium_channel")->variable("V")); analyser->analyseModel(model); @@ -876,9 +899,9 @@ TEST(Analyser, threeEquivalentExternalVariablesNotIncludingPrimaryVariable) auto analyser = libcellml::Analyser::create(); - analyser->addExternalVariable(libcellml::AnalyserExternalVariable::create(model->component("sodium_channel")->variable("V"))); - analyser->addExternalVariable(libcellml::AnalyserExternalVariable::create(model->component("potassium_channel")->variable("V"))); - analyser->addExternalVariable(libcellml::AnalyserExternalVariable::create(model->component("leakage_current")->variable("V"))); + analyser->addExternalVariable(model->component("sodium_channel")->variable("V")); + analyser->addExternalVariable(model->component("potassium_channel")->variable("V")); + analyser->addExternalVariable(model->component("leakage_current")->variable("V")); analyser->analyseModel(model); @@ -904,7 +927,7 @@ TEST(Analyser, algebraicSystemWithThreeLinkedUnknownsWithOneExternalVariable) auto analyser = libcellml::Analyser::create(); - analyser->addExternalVariable(libcellml::AnalyserExternalVariable::create(model->component("my_algebraic_system")->variable("x"))); + analyser->addExternalVariable(model->component("my_algebraic_system")->variable("x")); analyser->analyseModel(model); @@ -931,8 +954,8 @@ TEST(Analyser, algebraicSystemWithThreeLinkedUnknownsWithTwoExternalVariables) auto analyser = libcellml::Analyser::create(); - analyser->addExternalVariable(libcellml::AnalyserExternalVariable::create(model->component("my_algebraic_system")->variable("x"))); - analyser->addExternalVariable(libcellml::AnalyserExternalVariable::create(model->component("my_algebraic_system")->variable("z"))); + analyser->addExternalVariable(model->component("my_algebraic_system")->variable("x")); + analyser->addExternalVariable(model->component("my_algebraic_system")->variable("z")); analyser->analyseModel(model); diff --git a/tests/bindings/javascript/analyser.test.js b/tests/bindings/javascript/analyser.test.js index c103c60b55..c9ce49f4ba 100644 --- a/tests/bindings/javascript/analyser.test.js +++ b/tests/bindings/javascript/analyser.test.js @@ -23,6 +23,7 @@ describe("Analyser tests", () => { let m let a let aev + let v beforeAll(async () => { libcellml = await libCellMLModule(); @@ -35,7 +36,7 @@ describe("Analyser tests", () => { a.analyseModel(m) expect(a.issueCount()).toBe(0) - const v = m.componentByIndex(0).variableByIndex(0) + v = m.componentByIndex(0).variableByIndex(0) aev = new libcellml.AnalyserExternalVariable(v) }); test("Checking Analyser.analyseModel.", () => { @@ -49,54 +50,57 @@ describe("Analyser tests", () => { expect(a.issueCount()).toBe(1) expect(a.issue(0).description()).toBe("Variable 'time' in component 'my_component' cannot be both a variable of integration and initialised.") }); - test("Checking Analyser.addExternalVariable.", () => { - expect(a.addExternalVariable(aev)).toBe(true) + test("Checking Analyser.addExternalVariableByVariable.", () => { + expect(a.addExternalVariableByVariable(v)).toBe(true) + }); + test("Checking Analyser.addExternalVariableByExternalVariable.", () => { + expect(a.addExternalVariableByExternalVariable(aev)).toBe(true) }); test("Checking Analyser.removeExternalVariableByIndex.", () => { - a.addExternalVariable(aev) + a.addExternalVariableByVariable(v) expect(a.externalVariableCount()).toBe(1) a.removeExternalVariableByIndex(0) expect(a.externalVariableCount()).toBe(0) }); - test("Checking Analyser.removeExternalVariableByModel.", () => { - a.addExternalVariable(aev) + test("Checking Analyser.removeExternalVariableByVariable.", () => { + a.addExternalVariableByVariable(v) expect(a.externalVariableCount()).toBe(1) - a.removeExternalVariableByModel(m, "component", "time") + a.removeExternalVariableByVariable(v) expect(a.externalVariableCount()).toBe(0) }); test("Checking Analyser.removeExternalVariableByExternalVariable.", () => { - a.addExternalVariable(aev) + a.addExternalVariableByExternalVariable(aev) expect(a.externalVariableCount()).toBe(1) a.removeExternalVariableByExternalVariable(aev) expect(a.externalVariableCount()).toBe(0) }); test("Checking Analyser.removeAllExternalVariables.", () => { - a.addExternalVariable(aev) + a.addExternalVariableByVariable(v) expect(a.externalVariableCount()).toBe(1) a.removeAllExternalVariables() expect(a.externalVariableCount()).toBe(0) }); - test("Checking Analyser.containsExternalVariableByModel.", () => { - expect(a.containsExternalVariableByModel(m, "component", "time")).toBe(false) - a.addExternalVariable(aev) - expect(a.containsExternalVariableByModel(m, "component", "time")).toBe(true) + test("Checking Analyser.containsExternalVariableByVariable.", () => { + expect(a.containsExternalVariableByVariable(v)).toBe(false) + a.addExternalVariableByVariable(v) + expect(a.containsExternalVariableByVariable(v)).toBe(true) }); test("Checking Analyser.containsExternalVariableByExternalVariable.", () => { expect(a.containsExternalVariableByExternalVariable(aev)).toBe(false) - a.addExternalVariable(aev) + a.addExternalVariableByExternalVariable(aev) expect(a.containsExternalVariableByExternalVariable(aev)).toBe(true) }); test("Checking Analyser.externalVariableByIndex.", () => { - a.addExternalVariable(aev) + a.addExternalVariableByExternalVariable(aev) expect(a.externalVariableByIndex(0)).toStrictEqual(aev) }); - test("Checking Analyser.externalVariableByModel.", () => { - a.addExternalVariable(aev) - expect(a.externalVariableByModel(m, "component", "time")).toStrictEqual(aev) + test("Checking Analyser.externalVariableByVariable.", () => { + a.addExternalVariableByExternalVariable(aev) + expect(a.externalVariableByVariable(v)).toStrictEqual(aev) }); test("Checking Analyser.externalVariableCount.", () => { expect(a.externalVariableCount()).toBe(0) - a.addExternalVariable(aev) + a.addExternalVariableByVariable(v) expect(a.externalVariableCount()).toBe(1) }); test("Checking Analyser.model.", () => { diff --git a/tests/bindings/python/test_analyser.py b/tests/bindings/python/test_analyser.py index 654daf1a20..6e4a248c35 100644 --- a/tests/bindings/python/test_analyser.py +++ b/tests/bindings/python/test_analyser.py @@ -82,10 +82,10 @@ def test_coverage(self): self.assertTrue(a.addExternalVariable(aev)) self.assertTrue(a.containsExternalVariable(aev)) - self.assertTrue(a.containsExternalVariable(m, c.name(), v0.name())) + self.assertTrue(a.containsExternalVariable(v0)) self.assertEqual(aev.variable().name(), a.externalVariable(0).variable().name()) - self.assertEqual(aev.variable().name(), a.externalVariable(m, c.name(), v0.name()).variable().name()) + self.assertEqual(aev.variable().name(), a.externalVariable(v0).variable().name()) v2 = c.variable(2) @@ -97,7 +97,7 @@ def test_coverage(self): self.assertTrue(a.removeExternalVariable(1)) self.assertTrue(a.removeExternalVariable(aev)) - self.assertTrue(a.removeExternalVariable(m, c.name(), v2.name())) + self.assertTrue(a.removeExternalVariable(v2)) a.removeAllExternalVariables() From 5febd95cbf9e58e1bafbeda56cb4984e617362d9 Mon Sep 17 00:00:00 2001 From: Alan Garny Date: Wed, 16 Oct 2024 09:46:14 +1300 Subject: [PATCH 60/85] CI: added some "basic" GitHub Actions. --- .github/workflows/ci.yml | 111 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 111 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000000..b279063427 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,111 @@ +name: CI + +on: + pull_request: + branches: [ main ] + workflow_dispatch: + +env: + BUILDCACHE_ACCURACY: STRICT + BUILDCACHE_COMPRESS_FORMAT: ZSTD + BUILDCACHE_DEBUG: -1 + BUILDCACHE_LOG_FILE: "" + +jobs: + cpp_python: + name: ${{ matrix.name }} + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + include: + - name: 'Windows static (BPT)' + os: windows-latest + bindings_python: ON + build_shared: OFF + unit_tests: ON + set_path: $env:Path="C:\libxml2\bin;C:\zlib\bin;"+$env:Path + additional_cmake_options: -DLIBXML2_INCLUDE_DIR="C:\libxml2\include\libxml2" -DLIBXML2_LIBRARY="C:\libxml2\lib\libxml2.lib" -DZLIB_INCLUDE_DIR="C:\zlib\include" -DZLIB_LIBRARY="C:\zlib\lib\z_dll.lib" + - name: 'Windows shared (BPT)' + os: windows-latest + bindings_python: ON + build_shared: ON + unit_tests: ON + set_path: $env:Path="C:\libxml2\bin;C:\zlib\bin;"+$env:Path + additional_cmake_options: -DLIBXML2_INCLUDE_DIR="C:\libxml2\include\libxml2" -DLIBXML2_LIBRARY="C:\libxml2\lib\libxml2.lib" -DZLIB_INCLUDE_DIR="C:\zlib\include" -DZLIB_LIBRARY="C:\zlib\lib\z_dll.lib" + - name: 'Linux static (B)' + os: ubuntu-latest + bindings_python: OFF + build_shared: OFF + unit_tests: OFF + - name: 'Linux shared (BPT)' + os: ubuntu-latest + bindings_python: ON + build_shared: ON + unit_tests: ON + - name: 'macOS static (Intel) (BT)' + os: macos-13 + bindings_python: OFF + build_shared: OFF + unit_tests: ON + - name: 'macOS shared (Intel) (BPT)' + os: macos-13 + bindings_python: ON + build_shared: ON + unit_tests: ON + - name: 'macOS static (ARM) (BT)' + os: macos-latest + bindings_python: OFF + build_shared: OFF + unit_tests: ON + - name: 'macOS shared (ARM) (BPT)' + os: macos-latest + bindings_python: ON + build_shared: ON + unit_tests: ON + steps: + - name: Check out libCellML + uses: actions/checkout@v4 + - name: Install Python (if needed) + if: ${{ matrix.bindings_python == 'ON' }} + uses: actions/setup-python@v5 + with: + python-version: '3.13' + - name: Install CMake and Ninja + uses: lukka/get-cmake@latest + - name: Install buildcache + uses: mikehardy/buildcache-action@v2 + with: + cache_key: ${{ matrix.os }}-${{ matrix.build_shared }} + - name: Configure MSVC (Windows only) + if: ${{ runner.os == 'Windows' }} + uses: ilammy/msvc-dev-cmd@v1 + - name: Install libxml2 (Windows only) + if: ${{ runner.os == 'Windows' }} + run: | + Invoke-WebRequest -UseBasicParsing https://github.com/cellml/gha/releases/download/gha/libxml2.zip -OutFile libxml2.zip + Expand-Archive -LiteralPath libxml2.zip -DestinationPath C:\ + - name: Install SWIG (macOS only and if needed) + if: ${{ runner.os == 'macOS' && matrix.bindings_python == 'ON' }} + run: | + brew install swig + - name: Install zlib (Windows only) + if: ${{ runner.os == 'Windows' }} + run: | + Invoke-WebRequest -UseBasicParsing https://github.com/cellml/gha/releases/download/gha/zlib.zip -OutFile zlib.zip + Expand-Archive -LiteralPath zlib.zip -DestinationPath C:\ + - name: Configure libCellML + run: | + mkdir build + cd build + ${{ matrix.set_path }} + cmake -G Ninja -DBINDINGS_PYTHON=${{ matrix.bindings_python }} -DBUILD_SHARED=${{ matrix.build_shared }} -DCOVERAGE=OFF -DLLVM_COVERAGE=OFF -DMEMCHECK=OFF -DUNIT_TESTS=${{ matrix.unit_tests }} ${{ matrix.additional_cmake_options }} .. + - name: Build libCellML + run: | + cd build + ninja + - name: Unit testing + if: ${{ matrix.unit_tests == 'ON' }} + run: | + cd build + ninja test From cf90c3bd3deeb7818375112e078b4d3aeeb18488 Mon Sep 17 00:00:00 2001 From: Alan Garny Date: Wed, 16 Oct 2024 13:41:15 +1300 Subject: [PATCH 61/85] CI: added some "basic" GitHub Actions. --- .github/workflows/ci.yml | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b279063427..8ef4447caf 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -109,3 +109,26 @@ jobs: run: | cd build ninja test + code_formatting: + name: Code formatting + runs-on: ubuntu-latest + strategy: + fail-fast: false + steps: + - name: Check out libCellML + uses: actions/checkout@v4 + - name: Install ClangFormat + run: | + sudo apt update + sudo apt install clang-format + - name: Install CMake and Ninja + uses: lukka/get-cmake@latest + - name: Configure libCellML + run: | + mkdir build + cd build + cmake -G Ninja .. + - name: Code formatting + run: | + cd build + ninja test_clang_format From 96877a67512dfa4547d9fe1f63827d28949ce4af Mon Sep 17 00:00:00 2001 From: Alan Garny Date: Wed, 16 Oct 2024 14:00:00 +1300 Subject: [PATCH 62/85] CI: added some "basic" GitHub Actions. --- .github/workflows/ci.yml | 32 ++++++++++++++ cmake/environmentchecks.cmake | 2 + docs/CMakeLists.txt | 5 +-- docs/conf.in.py | 66 ++++++++++++++-------------- src/api/libcellml/generatorprofile.h | 2 +- 5 files changed, 70 insertions(+), 37 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8ef4447caf..067e470736 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -132,3 +132,35 @@ jobs: run: | cd build ninja test_clang_format + documentation: + name: Documentation + runs-on: ubuntu-latest + strategy: + fail-fast: false + steps: + - name: Check out libCellML + uses: actions/checkout@v4 + - name: Install CMake and Ninja + uses: lukka/get-cmake@latest + - name: Install buildcache + uses: mikehardy/buildcache-action@v2 + - name: Install dot + run: | + sudo apt update + sudo apt install graphviz + - name: Install Doxygen + run: | + sudo apt update + sudo apt install doxygen + - name: Install Sphinx + run: | + pip3 install sphinx + - name: Configure libCellML + run: | + mkdir build + cd build + cmake -G Ninja -DBINDINGS_PYTHON=OFF .. + - name: Documentation + run: | + cd build + ninja docs diff --git a/cmake/environmentchecks.cmake b/cmake/environmentchecks.cmake index 071e33682c..59c61a3baf 100644 --- a/cmake/environmentchecks.cmake +++ b/cmake/environmentchecks.cmake @@ -45,6 +45,7 @@ else () endif() find_program(CLANG_FORMAT_EXE NAMES ${PREFERRED_CLANG_FORMAT_NAMES} clang-format) find_program(CLANG_TIDY_EXE NAMES ${PREFERRED_CLANG_TIDY_NAMES} clang-tidy) + find_program(DOT_EXE NAMES ${PREFERRED_FIND_NAMES} dot) find_program(FIND_EXE NAMES ${PREFERRED_FIND_NAMES} find) find_program(GCOV_EXE NAMES ${PREFERRED_GCOV_NAMES} gcov) find_program(LLVM_COV_EXE NAMES ${PREFERRED_LLVM_COV_NAMES} llvm-cov HINTS ${LLVM_BIN_DIR} /Library/Developer/CommandLineTools/usr/bin/) @@ -93,6 +94,7 @@ else () BUILDCACHE_EXE CLANG_TIDY_EXE CLANG_FORMAT_EXE + DOT_EXE FIND_EXE GCC_COVERAGE_COMPILER_FLAGS_OK GCOV_EXE diff --git a/docs/CMakeLists.txt b/docs/CMakeLists.txt index 6795596e50..8498fc7b4a 100644 --- a/docs/CMakeLists.txt +++ b/docs/CMakeLists.txt @@ -49,7 +49,7 @@ if(SPHINX_FOUND) COMMENT "Building HTML documentation with Sphinx") endif() -if(DOXYGEN_FOUND) +if(DOXYGEN_FOUND AND DOT_EXE) set(DOXYGEN_DOCS_TARGET api_docs) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in.config ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile @ONLY) add_custom_target(${DOXYGEN_DOCS_TARGET} @@ -76,7 +76,7 @@ if(LIBCELLML_COVERAGE) COMMENT "Running coverage tests with html output") endif() -if(SPHINX_FOUND OR DOXYGEN_FOUND OR LIBCELLML_COVERAGE) +if(SPHINX_FOUND AND DOXYGEN_FOUND AND LIBCELLML_COVERAGE) add_custom_target(docs DEPENDS ${SPHINX_DOCS_TARGET} ${DOXYGEN_DOCS_TARGET} ${COVERAGE_DOCS_TARGET} ${DOXYGEN_API_XML_DOCS_TARGET} COMMENT "Generating documentation") @@ -86,4 +86,3 @@ if(SPHINX_FOUND OR DOXYGEN_FOUND OR LIBCELLML_COVERAGE) COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_CURRENT_BINARY_DIR}/_doctrees COMMENT "Cleaning documentation") endif() - diff --git a/docs/conf.in.py b/docs/conf.in.py index 1fad261573..b671f63111 100644 --- a/docs/conf.in.py +++ b/docs/conf.in.py @@ -47,42 +47,42 @@ # These are the shorthand for external links. Use them in the other pages as: # :shortcut:`Shortcut text ` NB space before < # Declare below as: -# 'shortcut': ('http://linkhere/%s',''), NB have to put the string insertion %s to make it work +# 'shortcut': ('http://linkhere/%s', None), NB have to put the string insertion %s to make it work extlinks = { # NB for deployment outside of the libcellml.org domain, you will need to include the root of the href for the # :api: shortcut here. This only works internally. - 'api': ('/documentation/latest/api/classlibcellml_1_1%s', ''), - 'buildbot': ('https://buildbot.net/%s',''), - 'cellml': ('https://www.cellml.org/%s',''), - 'cellml2spec': ('https://www.cellml.org/specifications/cellml_2.0%s', ''), - 'clang': ('https://clang.llvm.org/%s',''), - 'cmake': ('https://cmake.org/%s',''), - 'doxygen': ('http://www.doxygen.nl/%s',''), - 'forcescheduler': ('http://docs.buildbot.net/latest/developer/cls-forcesched.html%s',''), - 'gcc': ('https://gcc.gnu.org/%s',''), - 'gcovr': ('https://gcovr.com/%s',''), - 'git': ('https://git-scm.com/%s',''), - 'github': ('https://github.com/%s',''), - 'github_desktop': ('https://desktop.github.com/%s',''), - 'github_help': ('https://help.github.com%s',''), - 'github_rtd': ('https://github.com/rtfd/readthedocs.org/issues%s',''), - 'google_style_guide': ('https://google.github.io/styleguide/cppguide.html%s',''), - 'graphviz': ('http://graphviz.org%s',''), - 'htpasswd': ('https://httpd.apache.org/docs/current/programs/htpasswd.html%s',''), - 'libcellml_repo': ('https://github.com/cellml/libcellml/%s',''), - 'libcellml_buildbot': ('https://autotest.bioeng.auckland.ac.nz/buildbot/libcellml/#/builders%s',''), - 'libxml2': ('http://xmlsoft.org/%s',''), - 'mathml': ('https://www.w3.org/Math/%s',''), - 'msvs': ('https://visualstudio.microsoft.com%s',''), - 'opencmiss_libxml2_repo': ('https://github.com/OpenCMISS-Dependencies/libxml2/releases%s',''), - 'opencmiss_zlib_repo': ('https://github.com/OpenCMISS-Dependencies/zlib/releases%s',''), - 'python': ('https://www.python.org/%s',''), - 'sphinx': ('http://www.sphinx-doc.org/en/master/%s',''), - 'swig':('http://swig.org%s',''), - 'swigwin_download': ('https://sourceforge.net/projects/swig/files/swigwin/%s',''), - 'wikipedia': ('https://en.wikipedia.org/wiki%s',''), - 'xml': ('https://www.w3.org/XML/%s',''), - 'zlib': ('https://www.zlib.net/%s',''), + 'api': ('/documentation/latest/api/classlibcellml_1_1%s', None), + 'buildbot': ('https://buildbot.net/%s', None), + 'cellml': ('https://www.cellml.org/%s', None), + 'cellml2spec': ('https://www.cellml.org/specifications/cellml_2.0%s', None), + 'clang': ('https://clang.llvm.org/%s', None), + 'cmake': ('https://cmake.org/%s', None), + 'doxygen': ('http://www.doxygen.nl/%s', None), + 'forcescheduler': ('http://docs.buildbot.net/latest/developer/cls-forcesched.html%s', None), + 'gcc': ('https://gcc.gnu.org/%s', None), + 'gcovr': ('https://gcovr.com/%s', None), + 'git': ('https://git-scm.com/%s', None), + 'github': ('https://github.com/%s', None), + 'github_desktop': ('https://desktop.github.com/%s', None), + 'github_help': ('https://help.github.com%s', None), + 'github_rtd': ('https://github.com/rtfd/readthedocs.org/issues%s', None), + 'google_style_guide': ('https://google.github.io/styleguide/cppguide.html%s', None), + 'graphviz': ('http://graphviz.org%s', None), + 'htpasswd': ('https://httpd.apache.org/docs/current/programs/htpasswd.html%s', None), + 'libcellml_repo': ('https://github.com/cellml/libcellml/%s', None), + 'libcellml_buildbot': ('https://autotest.bioeng.auckland.ac.nz/buildbot/libcellml/#/builders%s', None), + 'libxml2': ('http://xmlsoft.org/%s', None), + 'mathml': ('https://www.w3.org/Math/%s', None), + 'msvs': ('https://visualstudio.microsoft.com%s', None), + 'opencmiss_libxml2_repo': ('https://github.com/OpenCMISS-Dependencies/libxml2/releases%s', None), + 'opencmiss_zlib_repo': ('https://github.com/OpenCMISS-Dependencies/zlib/releases%s', None), + 'python': ('https://www.python.org/%s', None), + 'sphinx': ('http://www.sphinx-doc.org/en/master/%s', None), + 'swig':('http://swig.org%s', None), + 'swigwin_download': ('https://sourceforge.net/projects/swig/files/swigwin/%s', None), + 'wikipedia': ('https://en.wikipedia.org/wiki%s', None), + 'xml': ('https://www.w3.org/XML/%s', None), + 'zlib': ('https://www.zlib.net/%s', None), } # The master toctree document. diff --git a/src/api/libcellml/generatorprofile.h b/src/api/libcellml/generatorprofile.h index 10335d24d8..fb9c90510c 100644 --- a/src/api/libcellml/generatorprofile.h +++ b/src/api/libcellml/generatorprofile.h @@ -2587,7 +2587,7 @@ class LIBCELLML_EXPORT GeneratorProfile * Set the @c std::string for the name of the state variable type that is * used in a differential model. * - * @param stateTypeString The @c std::string to use for the name of the + * @param stateVariableTypeString The @c std::string to use for the name of the * state variable type. */ void setStateVariableTypeString(const std::string &stateVariableTypeString); From b6d52b0900c11c9b11ed3c70c38377f6deb581b0 Mon Sep 17 00:00:00 2001 From: Alan Garny Date: Wed, 16 Oct 2024 15:34:08 +1300 Subject: [PATCH 63/85] CI: added some "basic" GitHub Actions. --- .github/workflows/ci.yml | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 067e470736..49f3d1d342 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -164,3 +164,29 @@ jobs: run: | cd build ninja docs + coverage: + name: Code coverage + runs-on: macos-latest + strategy: + fail-fast: false + steps: + - name: Check out libCellML + uses: actions/checkout@v4 + - name: Install CMake and Ninja + uses: lukka/get-cmake@latest + - name: Install buildcache + uses: mikehardy/buildcache-action@v2 + - name: Install LLVM + run: | + brew install --overwrite llvm + brew info llvm + - name: Configure libCellML + run: | + mkdir build + cd build + cmake -G Ninja -DBINDINGS_PYTHON=OFF .. + - name: Code coverage + run: | + cd build + ninja llvm_coverage + if [ `ninja llvm_coverage | grep TOTAL | sed 's/ /\n/g' | grep "100.00%" | wc -l | sed 's/ //g'` -eq 4 ]; then exit 0; else exit 1; fi From 1add1b6cabd8e4249d6f50dbc5e06430c53813c6 Mon Sep 17 00:00:00 2001 From: Alan Garny Date: Wed, 16 Oct 2024 15:53:43 +1300 Subject: [PATCH 64/85] CI: added some "basic" GitHub Actions. --- .github/workflows/ci.yml | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 49f3d1d342..679cfeba9a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -190,3 +190,28 @@ jobs: cd build ninja llvm_coverage if [ `ninja llvm_coverage | grep TOTAL | sed 's/ /\n/g' | grep "100.00%" | wc -l | sed 's/ //g'` -eq 4 ]; then exit 0; else exit 1; fi + memory_leaks: + name: Memory leaks + runs-on: ubuntu-latest + strategy: + fail-fast: false + steps: + - name: Check out libCellML + uses: actions/checkout@v4 + - name: Install CMake and Ninja + uses: lukka/get-cmake@latest + - name: Install buildcache + uses: mikehardy/buildcache-action@v2 + - name: Install Valgrind + run: | + sudo apt update + sudo apt install valgrind + - name: Configure libCellML + run: | + mkdir build + cd build + cmake -G Ninja -DBINDINGS_PYTHON=OFF .. + - name: Memory leaks + run: | + cd build + ninja memcheck From 1dce2018b41cb759be0e6f29afb1025d666ec44a Mon Sep 17 00:00:00 2001 From: Alan Garny Date: Wed, 16 Oct 2024 16:58:15 +1300 Subject: [PATCH 65/85] CI: added some "basic" GitHub Actions. --- .github/workflows/ci.yml | 50 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 679cfeba9a..6b4eb835a2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -215,3 +215,53 @@ jobs: run: | cd build ninja memcheck + javascript: + name: JavaScript (BT) + runs-on: macos-latest + strategy: + fail-fast: false + env: + LIBCELLML_WASM_DIR: wasm + LIBXML2_VERSION: 2.9.10 + ZLIB_VERSION: 1.2.3 + steps: + - name: Check out libCellML + uses: actions/checkout@v4 + - name: Install CMake and Ninja + uses: lukka/get-cmake@latest + - name: Install buildcache + uses: mikehardy/buildcache-action@v2 + - name: Install Emscripten + run: | + brew install --overwrite emscripten + - name: Set up the build directory + run: | + mkdir build + - name: Build zlib + run: | + cd build + ZLIB_BUILD_DIR=zlib-wasm + git clone https://github.com/OpenCMISS-Dependencies/zlib.git -b v${ZLIB_VERSION} + mkdir ${ZLIB_BUILD_DIR} + emcmake cmake -G Ninja -S zlib -B ${ZLIB_BUILD_DIR} -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=~/${LIBCELLML_WASM_DIR} -DBUILD_SHARED_LIBS=OFF + cmake --build ${ZLIB_BUILD_DIR} + cmake --install ${ZLIB_BUILD_DIR} + - name: Build libxml2 + run: | + cd build + LIBXML2_BUILD_DIR=libxml2-wasm + git clone https://github.com/OpenCMISS-Dependencies/libxml2.git -b v${LIBXML2_VERSION} + mkdir ${LIBXML2_BUILD_DIR} + emcmake cmake -G Ninja -S libxml2 -B ${LIBXML2_BUILD_DIR} -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=~/${LIBCELLML_WASM_DIR} -DZLIB_DIR=~/${LIBCELLML_WASM_DIR}/lib/cmake/ZLIB-${ZLIB_VERSION} -DBUILD_SHARED_LIBS=OFF -DLIBXML2_WITH_ICONV=OFF -DLIBXML2_WITH_LZMA=OFF -DLIBXML2_WITH_PYTHON=OFF -DLIBXML2_WITH_TESTS=OFF -DLIBXML2_WITH_PROGRAMS=OFF + cmake --build ${LIBXML2_BUILD_DIR} + cmake --install ${LIBXML2_BUILD_DIR} + - name: Build libCellML + run: | + cd build + mkdir ${LIBCELLML_WASM_DIR} + emcmake cmake -G Ninja -S .. -B ${LIBCELLML_WASM_DIR} -DLibXml2_DIR=~/${LIBCELLML_WASM_DIR}/lib/cmake/libxml2-${LIBXML2_VERSION} -DBUILD_TYPE=Release + cmake --build ${LIBCELLML_WASM_DIR} + - name: Unit testing + run: | + cd build + cmake --build ${LIBCELLML_WASM_DIR} --target jest_test From aefa695f16ecacd271e9cdaf3de208167b8e1fa3 Mon Sep 17 00:00:00 2001 From: Alan Garny Date: Wed, 16 Oct 2024 17:42:03 +1300 Subject: [PATCH 66/85] CI: added some "basic" GitHub Actions. --- .github/workflows/ci.yml | 142 +++++++++++++++++++-------------------- 1 file changed, 71 insertions(+), 71 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6b4eb835a2..86d33ff01f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,46 +19,46 @@ jobs: fail-fast: false matrix: include: - - name: 'Windows static (BPT)' + - name: 'Windows static - C++/Python' os: windows-latest bindings_python: ON build_shared: OFF unit_tests: ON set_path: $env:Path="C:\libxml2\bin;C:\zlib\bin;"+$env:Path additional_cmake_options: -DLIBXML2_INCLUDE_DIR="C:\libxml2\include\libxml2" -DLIBXML2_LIBRARY="C:\libxml2\lib\libxml2.lib" -DZLIB_INCLUDE_DIR="C:\zlib\include" -DZLIB_LIBRARY="C:\zlib\lib\z_dll.lib" - - name: 'Windows shared (BPT)' + - name: 'Windows shared - C++/Python' os: windows-latest bindings_python: ON build_shared: ON unit_tests: ON set_path: $env:Path="C:\libxml2\bin;C:\zlib\bin;"+$env:Path additional_cmake_options: -DLIBXML2_INCLUDE_DIR="C:\libxml2\include\libxml2" -DLIBXML2_LIBRARY="C:\libxml2\lib\libxml2.lib" -DZLIB_INCLUDE_DIR="C:\zlib\include" -DZLIB_LIBRARY="C:\zlib\lib\z_dll.lib" - - name: 'Linux static (B)' + - name: 'Linux static - C++ (build only)' os: ubuntu-latest bindings_python: OFF build_shared: OFF unit_tests: OFF - - name: 'Linux shared (BPT)' + - name: 'Linux shared - C++/Python' os: ubuntu-latest bindings_python: ON build_shared: ON unit_tests: ON - - name: 'macOS static (Intel) (BT)' + - name: 'macOS static - C++ (Intel)' os: macos-13 bindings_python: OFF build_shared: OFF unit_tests: ON - - name: 'macOS shared (Intel) (BPT)' + - name: 'macOS shared - C++/Python (Intel)' os: macos-13 bindings_python: ON build_shared: ON unit_tests: ON - - name: 'macOS static (ARM) (BT)' + - name: 'macOS static - C++ (ARM)' os: macos-latest bindings_python: OFF build_shared: OFF unit_tests: ON - - name: 'macOS shared (ARM) (BPT)' + - name: 'macOS shared - C++/Python (ARM)' os: macos-latest bindings_python: ON build_shared: ON @@ -109,61 +109,79 @@ jobs: run: | cd build ninja test - code_formatting: - name: Code formatting - runs-on: ubuntu-latest + javascript: + name: JavaScript + runs-on: macos-latest strategy: fail-fast: false + env: + LIBCELLML_WASM_DIR: wasm + LIBXML2_VERSION: 2.9.10 + ZLIB_VERSION: 1.2.3 steps: - name: Check out libCellML uses: actions/checkout@v4 - - name: Install ClangFormat - run: | - sudo apt update - sudo apt install clang-format - name: Install CMake and Ninja uses: lukka/get-cmake@latest - - name: Configure libCellML + - name: Install buildcache + uses: mikehardy/buildcache-action@v2 + - name: Install Emscripten + run: | + brew install --overwrite emscripten + - name: Set up the build directory run: | mkdir build + - name: Build zlib + run: | cd build - cmake -G Ninja .. - - name: Code formatting + ZLIB_BUILD_DIR=zlib-wasm + git clone https://github.com/OpenCMISS-Dependencies/zlib.git -b v${ZLIB_VERSION} + mkdir ${ZLIB_BUILD_DIR} + emcmake cmake -G Ninja -S zlib -B ${ZLIB_BUILD_DIR} -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=~/${LIBCELLML_WASM_DIR} -DBUILD_SHARED_LIBS=OFF + cmake --build ${ZLIB_BUILD_DIR} + cmake --install ${ZLIB_BUILD_DIR} + - name: Build libxml2 run: | cd build - ninja test_clang_format - documentation: - name: Documentation + LIBXML2_BUILD_DIR=libxml2-wasm + git clone https://github.com/OpenCMISS-Dependencies/libxml2.git -b v${LIBXML2_VERSION} + mkdir ${LIBXML2_BUILD_DIR} + emcmake cmake -G Ninja -S libxml2 -B ${LIBXML2_BUILD_DIR} -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=~/${LIBCELLML_WASM_DIR} -DZLIB_DIR=~/${LIBCELLML_WASM_DIR}/lib/cmake/ZLIB-${ZLIB_VERSION} -DBUILD_SHARED_LIBS=OFF -DLIBXML2_WITH_ICONV=OFF -DLIBXML2_WITH_LZMA=OFF -DLIBXML2_WITH_PYTHON=OFF -DLIBXML2_WITH_TESTS=OFF -DLIBXML2_WITH_PROGRAMS=OFF + cmake --build ${LIBXML2_BUILD_DIR} + cmake --install ${LIBXML2_BUILD_DIR} + - name: Build libCellML + run: | + cd build + mkdir ${LIBCELLML_WASM_DIR} + emcmake cmake -G Ninja -S .. -B ${LIBCELLML_WASM_DIR} -DLibXml2_DIR=~/${LIBCELLML_WASM_DIR}/lib/cmake/libxml2-${LIBXML2_VERSION} -DBUILD_TYPE=Release + cmake --build ${LIBCELLML_WASM_DIR} + - name: Unit testing + run: | + cd build + cmake --build ${LIBCELLML_WASM_DIR} --target jest_test + code_formatting: + name: Code formatting runs-on: ubuntu-latest strategy: fail-fast: false steps: - name: Check out libCellML uses: actions/checkout@v4 - - name: Install CMake and Ninja - uses: lukka/get-cmake@latest - - name: Install buildcache - uses: mikehardy/buildcache-action@v2 - - name: Install dot - run: | - sudo apt update - sudo apt install graphviz - - name: Install Doxygen + - name: Install ClangFormat run: | sudo apt update - sudo apt install doxygen - - name: Install Sphinx - run: | - pip3 install sphinx + sudo apt install clang-format + - name: Install CMake and Ninja + uses: lukka/get-cmake@latest - name: Configure libCellML run: | mkdir build cd build - cmake -G Ninja -DBINDINGS_PYTHON=OFF .. - - name: Documentation + cmake -G Ninja .. + - name: Code formatting run: | cd build - ninja docs + ninja test_clang_format coverage: name: Code coverage runs-on: macos-latest @@ -215,15 +233,11 @@ jobs: run: | cd build ninja memcheck - javascript: - name: JavaScript (BT) - runs-on: macos-latest + documentation: + name: Documentation + runs-on: ubuntu-latest strategy: fail-fast: false - env: - LIBCELLML_WASM_DIR: wasm - LIBXML2_VERSION: 2.9.10 - ZLIB_VERSION: 1.2.3 steps: - name: Check out libCellML uses: actions/checkout@v4 @@ -231,37 +245,23 @@ jobs: uses: lukka/get-cmake@latest - name: Install buildcache uses: mikehardy/buildcache-action@v2 - - name: Install Emscripten - run: | - brew install --overwrite emscripten - - name: Set up the build directory + - name: Install dot run: | - mkdir build - - name: Build zlib + sudo apt update + sudo apt install graphviz + - name: Install Doxygen run: | - cd build - ZLIB_BUILD_DIR=zlib-wasm - git clone https://github.com/OpenCMISS-Dependencies/zlib.git -b v${ZLIB_VERSION} - mkdir ${ZLIB_BUILD_DIR} - emcmake cmake -G Ninja -S zlib -B ${ZLIB_BUILD_DIR} -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=~/${LIBCELLML_WASM_DIR} -DBUILD_SHARED_LIBS=OFF - cmake --build ${ZLIB_BUILD_DIR} - cmake --install ${ZLIB_BUILD_DIR} - - name: Build libxml2 + sudo apt update + sudo apt install doxygen + - name: Install Sphinx run: | - cd build - LIBXML2_BUILD_DIR=libxml2-wasm - git clone https://github.com/OpenCMISS-Dependencies/libxml2.git -b v${LIBXML2_VERSION} - mkdir ${LIBXML2_BUILD_DIR} - emcmake cmake -G Ninja -S libxml2 -B ${LIBXML2_BUILD_DIR} -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=~/${LIBCELLML_WASM_DIR} -DZLIB_DIR=~/${LIBCELLML_WASM_DIR}/lib/cmake/ZLIB-${ZLIB_VERSION} -DBUILD_SHARED_LIBS=OFF -DLIBXML2_WITH_ICONV=OFF -DLIBXML2_WITH_LZMA=OFF -DLIBXML2_WITH_PYTHON=OFF -DLIBXML2_WITH_TESTS=OFF -DLIBXML2_WITH_PROGRAMS=OFF - cmake --build ${LIBXML2_BUILD_DIR} - cmake --install ${LIBXML2_BUILD_DIR} - - name: Build libCellML + pip3 install sphinx + - name: Configure libCellML run: | + mkdir build cd build - mkdir ${LIBCELLML_WASM_DIR} - emcmake cmake -G Ninja -S .. -B ${LIBCELLML_WASM_DIR} -DLibXml2_DIR=~/${LIBCELLML_WASM_DIR}/lib/cmake/libxml2-${LIBXML2_VERSION} -DBUILD_TYPE=Release - cmake --build ${LIBCELLML_WASM_DIR} - - name: Unit testing + cmake -G Ninja -DBINDINGS_PYTHON=OFF .. + - name: Documentation run: | cd build - cmake --build ${LIBCELLML_WASM_DIR} --target jest_test + ninja docs From ffd073f8b5805d57346c3e28da36aeb0b1e5cb46 Mon Sep 17 00:00:00 2001 From: Alan Garny Date: Fri, 18 Oct 2024 12:38:28 +1300 Subject: [PATCH 67/85] CMake: don't use hints to find llvm-cov and llvm-profdata. Someone might have a version of llvm-cov and llvm-profdata that they use and which is not located in /Library/Developer/CommandLineTools/usr/bin. This means that they will need to provide LLVM_BIN_DIR which is not ideal, not least since there are PREFERRED_LLVM_COV_NAMES and PREFERRED_LLVM_PROFDATA_NAMES to play with, if needed. --- cmake/environmentchecks.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmake/environmentchecks.cmake b/cmake/environmentchecks.cmake index 071e33682c..f94472b9b3 100644 --- a/cmake/environmentchecks.cmake +++ b/cmake/environmentchecks.cmake @@ -47,8 +47,8 @@ else () find_program(CLANG_TIDY_EXE NAMES ${PREFERRED_CLANG_TIDY_NAMES} clang-tidy) find_program(FIND_EXE NAMES ${PREFERRED_FIND_NAMES} find) find_program(GCOV_EXE NAMES ${PREFERRED_GCOV_NAMES} gcov) - find_program(LLVM_COV_EXE NAMES ${PREFERRED_LLVM_COV_NAMES} llvm-cov HINTS ${LLVM_BIN_DIR} /Library/Developer/CommandLineTools/usr/bin/) - find_program(LLVM_PROFDATA_EXE NAMES ${PREFERRED_LLVM_PROFDATA_NAMES} llvm-profdata HINTS ${LLVM_BIN_DIR} /Library/Developer/CommandLineTools/usr/bin/) + find_program(LLVM_COV_EXE NAMES ${PREFERRED_LLVM_COV_NAMES} llvm-cov) + find_program(LLVM_PROFDATA_EXE NAMES ${PREFERRED_LLVM_PROFDATA_NAMES} llvm-profdata) find_program(VALGRIND_EXE NAMES ${PREFERRED_VALGRIND_NAMES} valgrind) find_program(INSTALL_NAME_TOOL_EXE NAMES ${PREFERRED_INSTALL_NAME_TOOL_NAMES} install_name_tool) From 69aa6caef85b417845f3a713fb63e61b6b9e8102 Mon Sep 17 00:00:00 2001 From: Alan Garny Date: Fri, 18 Oct 2024 12:43:32 +1300 Subject: [PATCH 68/85] CMake: let the user know where the coverage report can be found. --- tests/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index cf64a66c27..1dbf26da87 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -191,6 +191,7 @@ if(LIBCELLML_LLVM_COVERAGE) add_custom_target(llvm_coverage_report COMMAND ${LLVM_COV_EXE} show $ -instr-profile=${DATA_PROFILE_FILENAME} -format=html -Xdemangler c++filt -Xdemangler -n -o coverage_report --show-expansions --show-branches=count + COMMAND echo "The coverage report can be found at ${CMAKE_CURRENT_BINARY_DIR}/${COVERAGE_REPORT_DIR}coverage_report/index.html." DEPENDS prepare_llvm_coverage WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMENT "Running LLVM coverage missing lines command") From c0eef396ddabce7964a80325f65f7b47567d0652 Mon Sep 17 00:00:00 2001 From: Alan Garny Date: Tue, 22 Oct 2024 11:10:20 +1300 Subject: [PATCH 69/85] Some minor cleaning up. --- src/analyser_p.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/analyser_p.h b/src/analyser_p.h index f79606e065..97779631aa 100644 --- a/src/analyser_p.h +++ b/src/analyser_p.h @@ -257,9 +257,7 @@ class Analyser::AnalyserImpl: public Logger::LoggerImpl void analyseModel(const ModelPtr &model); - AnalyserExternalVariablePtrs::const_iterator findExternalVariable(const ModelPtr &model, - const std::string &componentName, - const std::string &variableName) const; + AnalyserExternalVariablePtrs::const_iterator findExternalVariable(const VariablePtr &variable) const; AnalyserExternalVariablePtrs::const_iterator findExternalVariable(const AnalyserExternalVariablePtr &externalVariable) const; }; From 8563e4bbf34b6e330a300011566be02dfcaa230c Mon Sep 17 00:00:00 2001 From: Alan Garny Date: Tue, 22 Oct 2024 11:15:09 +1300 Subject: [PATCH 70/85] Some minor cleaning up. --- src/analyser_p.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/analyser_p.h b/src/analyser_p.h index f79606e065..97779631aa 100644 --- a/src/analyser_p.h +++ b/src/analyser_p.h @@ -257,9 +257,7 @@ class Analyser::AnalyserImpl: public Logger::LoggerImpl void analyseModel(const ModelPtr &model); - AnalyserExternalVariablePtrs::const_iterator findExternalVariable(const ModelPtr &model, - const std::string &componentName, - const std::string &variableName) const; + AnalyserExternalVariablePtrs::const_iterator findExternalVariable(const VariablePtr &variable) const; AnalyserExternalVariablePtrs::const_iterator findExternalVariable(const AnalyserExternalVariablePtr &externalVariable) const; }; From aeea86c6d1a2e4b177d5293f0fc3b4e51394820b Mon Sep 17 00:00:00 2001 From: Alan Garny Date: Tue, 22 Oct 2024 11:39:53 +1300 Subject: [PATCH 71/85] Some minor cleaning up. --- .../model.external.c | 4 ++-- .../model.external.h | 2 +- .../model.external.py | 4 ++-- .../hodgkin_huxley_squid_axon_model_1952/model.dae.external.c | 4 ++-- .../hodgkin_huxley_squid_axon_model_1952/model.dae.external.h | 2 +- .../model.dae.external.py | 4 ++-- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.external.c b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.external.c index d58310558e..4973adedc3 100644 --- a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.external.c +++ b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.external.c @@ -1,4 +1,4 @@ -/* The content of this file was generated using the C profile of libCellML 0.5.0. */ +/* The content of this file was generated using the C profile of libCellML 0.6.0. */ #include "model.external.h" @@ -6,7 +6,7 @@ #include const char VERSION[] = "0.6.0"; -const char LIBCELLML_VERSION[] = "0.5.0"; +const char LIBCELLML_VERSION[] = "0.6.0"; const size_t CONSTANT_COUNT = 0; const size_t COMPUTED_CONSTANT_COUNT = 0; diff --git a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.external.h b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.external.h index eb786b5874..cf20925070 100644 --- a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.external.h +++ b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.external.h @@ -1,4 +1,4 @@ -/* The content of this file was generated using the C profile of libCellML 0.5.0. */ +/* The content of this file was generated using the C profile of libCellML 0.6.0. */ #pragma once diff --git a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.external.py b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.external.py index e72866bd38..eabc3752c5 100644 --- a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.external.py +++ b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.external.py @@ -1,11 +1,11 @@ -# The content of this file was generated using the Python profile of libCellML 0.5.0. +# The content of this file was generated using the Python profile of libCellML 0.6.0. from enum import Enum from math import * __version__ = "0.5.0" -LIBCELLML_VERSION = "0.5.0" +LIBCELLML_VERSION = "0.6.0" CONSTANT_COUNT = 0 COMPUTED_CONSTANT_COUNT = 0 diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.external.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.external.c index 3d179b3e08..4998481cb1 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.external.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.external.c @@ -1,4 +1,4 @@ -/* The content of this file was generated using the C profile of libCellML 0.5.0. */ +/* The content of this file was generated using the C profile of libCellML 0.6.0. */ #include "model.dae.external.h" @@ -6,7 +6,7 @@ #include const char VERSION[] = "0.6.0"; -const char LIBCELLML_VERSION[] = "0.5.0"; +const char LIBCELLML_VERSION[] = "0.6.0"; const size_t STATE_COUNT = 3; const size_t CONSTANT_COUNT = 5; diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.external.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.external.h index f07a94f94f..a4fb541db7 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.external.h +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.external.h @@ -1,4 +1,4 @@ -/* The content of this file was generated using the C profile of libCellML 0.5.0. */ +/* The content of this file was generated using the C profile of libCellML 0.6.0. */ #pragma once diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.external.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.external.py index 2c8ccfc186..5ae1b2523f 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.external.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.external.py @@ -1,11 +1,11 @@ -# The content of this file was generated using the Python profile of libCellML 0.5.0. +# The content of this file was generated using the Python profile of libCellML 0.6.0. from enum import Enum from math import * __version__ = "0.5.0" -LIBCELLML_VERSION = "0.5.0" +LIBCELLML_VERSION = "0.6.0" STATE_COUNT = 3 CONSTANT_COUNT = 5 From c055c696f3d45fe5ae55460fa944c40b684715b5 Mon Sep 17 00:00:00 2001 From: Alan Garny Date: Tue, 22 Oct 2024 12:19:40 +1300 Subject: [PATCH 72/85] Make sure that we can find the version of llvm-cov that we installed. --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 86d33ff01f..13c2affa03 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -197,7 +197,7 @@ jobs: - name: Install LLVM run: | brew install --overwrite llvm - brew info llvm + echo 'export PATH="/opt/homebrew/opt/llvm/bin:$PATH"' >> ~/.bash_profile - name: Configure libCellML run: | mkdir build From 6c63b5c6c4a983e9bd0d5dbdb9bab2c8fa18671f Mon Sep 17 00:00:00 2001 From: Alan Garny Date: Tue, 22 Oct 2024 12:41:01 +1300 Subject: [PATCH 73/85] CMake: use the PATH as a hint to find llvm-cov and llvm-profdata. Indeed, someone might have a version of llvm-cov and llvm-profdata that they use and which is not located in /Library/Developer/CommandLineTools/usr/bin. --- cmake/environmentchecks.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmake/environmentchecks.cmake b/cmake/environmentchecks.cmake index 59c61a3baf..4a66b37fab 100644 --- a/cmake/environmentchecks.cmake +++ b/cmake/environmentchecks.cmake @@ -48,8 +48,8 @@ else () find_program(DOT_EXE NAMES ${PREFERRED_FIND_NAMES} dot) find_program(FIND_EXE NAMES ${PREFERRED_FIND_NAMES} find) find_program(GCOV_EXE NAMES ${PREFERRED_GCOV_NAMES} gcov) - find_program(LLVM_COV_EXE NAMES ${PREFERRED_LLVM_COV_NAMES} llvm-cov HINTS ${LLVM_BIN_DIR} /Library/Developer/CommandLineTools/usr/bin/) - find_program(LLVM_PROFDATA_EXE NAMES ${PREFERRED_LLVM_PROFDATA_NAMES} llvm-profdata HINTS ${LLVM_BIN_DIR} /Library/Developer/CommandLineTools/usr/bin/) + find_program(LLVM_COV_EXE NAMES ${PREFERRED_LLVM_COV_NAMES} llvm-cov HINTS ${LLVM_BIN_DIR} ENV PATH /Library/Developer/CommandLineTools/usr/bin/) + find_program(LLVM_PROFDATA_EXE NAMES ${PREFERRED_LLVM_PROFDATA_NAMES} llvm-profdata HINTS ${LLVM_BIN_DIR} ENV PATH /Library/Developer/CommandLineTools/usr/bin/) find_program(VALGRIND_EXE NAMES ${PREFERRED_VALGRIND_NAMES} valgrind) find_program(INSTALL_NAME_TOOL_EXE NAMES ${PREFERRED_INSTALL_NAME_TOOL_NAMES} install_name_tool) From 62a53310665f0cc88c635d6d8e3457c24f811465 Mon Sep 17 00:00:00 2001 From: Alan Garny Date: Tue, 22 Oct 2024 12:41:15 +1300 Subject: [PATCH 74/85] CMake: let the user know where the coverage report can be found. --- tests/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index cf64a66c27..1dbf26da87 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -191,6 +191,7 @@ if(LIBCELLML_LLVM_COVERAGE) add_custom_target(llvm_coverage_report COMMAND ${LLVM_COV_EXE} show $ -instr-profile=${DATA_PROFILE_FILENAME} -format=html -Xdemangler c++filt -Xdemangler -n -o coverage_report --show-expansions --show-branches=count + COMMAND echo "The coverage report can be found at ${CMAKE_CURRENT_BINARY_DIR}/${COVERAGE_REPORT_DIR}coverage_report/index.html." DEPENDS prepare_llvm_coverage WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMENT "Running LLVM coverage missing lines command") From 4c4842f2dae10f4963cc616e94c58d6a0f90a631 Mon Sep 17 00:00:00 2001 From: Alan Garny Date: Tue, 22 Oct 2024 13:03:29 +1300 Subject: [PATCH 75/85] Some minor cleaning up. --- .../model.external.c | 4 ++-- .../model.external.h | 2 +- .../model.external.py | 4 ++-- .../hodgkin_huxley_squid_axon_model_1952/model.dae.external.c | 4 ++-- .../hodgkin_huxley_squid_axon_model_1952/model.dae.external.h | 2 +- .../model.dae.external.py | 4 ++-- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.external.c b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.external.c index d58310558e..4973adedc3 100644 --- a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.external.c +++ b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.external.c @@ -1,4 +1,4 @@ -/* The content of this file was generated using the C profile of libCellML 0.5.0. */ +/* The content of this file was generated using the C profile of libCellML 0.6.0. */ #include "model.external.h" @@ -6,7 +6,7 @@ #include const char VERSION[] = "0.6.0"; -const char LIBCELLML_VERSION[] = "0.5.0"; +const char LIBCELLML_VERSION[] = "0.6.0"; const size_t CONSTANT_COUNT = 0; const size_t COMPUTED_CONSTANT_COUNT = 0; diff --git a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.external.h b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.external.h index eb786b5874..cf20925070 100644 --- a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.external.h +++ b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.external.h @@ -1,4 +1,4 @@ -/* The content of this file was generated using the C profile of libCellML 0.5.0. */ +/* The content of this file was generated using the C profile of libCellML 0.6.0. */ #pragma once diff --git a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.external.py b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.external.py index e72866bd38..eabc3752c5 100644 --- a/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.external.py +++ b/tests/resources/generator/algebraic_system_with_three_linked_unknowns/model.external.py @@ -1,11 +1,11 @@ -# The content of this file was generated using the Python profile of libCellML 0.5.0. +# The content of this file was generated using the Python profile of libCellML 0.6.0. from enum import Enum from math import * __version__ = "0.5.0" -LIBCELLML_VERSION = "0.5.0" +LIBCELLML_VERSION = "0.6.0" CONSTANT_COUNT = 0 COMPUTED_CONSTANT_COUNT = 0 diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.external.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.external.c index 3d179b3e08..4998481cb1 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.external.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.external.c @@ -1,4 +1,4 @@ -/* The content of this file was generated using the C profile of libCellML 0.5.0. */ +/* The content of this file was generated using the C profile of libCellML 0.6.0. */ #include "model.dae.external.h" @@ -6,7 +6,7 @@ #include const char VERSION[] = "0.6.0"; -const char LIBCELLML_VERSION[] = "0.5.0"; +const char LIBCELLML_VERSION[] = "0.6.0"; const size_t STATE_COUNT = 3; const size_t CONSTANT_COUNT = 5; diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.external.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.external.h index f07a94f94f..a4fb541db7 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.external.h +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.external.h @@ -1,4 +1,4 @@ -/* The content of this file was generated using the C profile of libCellML 0.5.0. */ +/* The content of this file was generated using the C profile of libCellML 0.6.0. */ #pragma once diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.external.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.external.py index 2c8ccfc186..5ae1b2523f 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.external.py +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dae.external.py @@ -1,11 +1,11 @@ -# The content of this file was generated using the Python profile of libCellML 0.5.0. +# The content of this file was generated using the Python profile of libCellML 0.6.0. from enum import Enum from math import * __version__ = "0.5.0" -LIBCELLML_VERSION = "0.5.0" +LIBCELLML_VERSION = "0.6.0" STATE_COUNT = 3 CONSTANT_COUNT = 5 From ee1e56180ec2b5961195e40f76d1609eb3a42f94 Mon Sep 17 00:00:00 2001 From: Alan Garny Date: Tue, 22 Oct 2024 13:42:27 +1300 Subject: [PATCH 76/85] Some minor cleaning up. --- src/analyser.cpp | 8 +++++--- src/analyserexternalvariable.cpp | 1 - src/analyservariable.cpp | 1 - src/analyservariable_p.h | 1 - src/annotator.cpp | 1 - src/api/libcellml/generator.h | 5 ++--- src/component.cpp | 1 - src/debug.cpp | 1 - src/generator.cpp | 8 +++----- src/importer.cpp | 1 - src/model.cpp | 1 - src/printer.cpp | 1 - src/units.cpp | 1 - src/utilities.cpp | 1 - src/utilities.h | 1 + src/validator.cpp | 1 - 16 files changed, 11 insertions(+), 23 deletions(-) diff --git a/src/analyser.cpp b/src/analyser.cpp index 7fd91c6667..c3a68d105c 100644 --- a/src/analyser.cpp +++ b/src/analyser.cpp @@ -376,6 +376,8 @@ Analyser::AnalyserImpl::AnalyserImpl() mGeneratorProfile->setAbsoluteValueString("abs"); mGeneratorProfile->setNaturalLogarithmString("ln"); mGeneratorProfile->setCommonLogarithmString("log"); + mGeneratorProfile->setMinString("min"); + mGeneratorProfile->setMaxString("max"); mGeneratorProfile->setRemString("rem"); mGeneratorProfile->setAsinString("arcsin"); mGeneratorProfile->setAcosString("arccos"); @@ -2440,9 +2442,9 @@ void Analyser::AnalyserImpl::analyseModel(const ModelPtr &model) + "' is"; description += hasPrimaryVariable ? " the" : - (equivalentVariableCount == 1) ? - " its corresponding" : - " their corresponding"; + ((equivalentVariableCount == 1) ? + " its corresponding" : + " their corresponding"); description += " primary variable and will therefore be the one used as an external variable."; referenceRule = Issue::ReferenceRule::ANALYSER_EXTERNAL_VARIABLE_USE_PRIMARY_VARIABLE; diff --git a/src/analyserexternalvariable.cpp b/src/analyserexternalvariable.cpp index 41a9606ff9..b1910f8843 100644 --- a/src/analyserexternalvariable.cpp +++ b/src/analyserexternalvariable.cpp @@ -17,7 +17,6 @@ limitations under the License. #include "libcellml/analyserexternalvariable.h" #include "analyserexternalvariable_p.h" -#include "commonutils.h" #include "utilities.h" namespace libcellml { diff --git a/src/analyservariable.cpp b/src/analyservariable.cpp index 3c03d84734..bcda865b32 100644 --- a/src/analyservariable.cpp +++ b/src/analyservariable.cpp @@ -40,7 +40,6 @@ void AnalyserVariable::AnalyserVariableImpl::populate(AnalyserVariable::Type typ mIndex = index; mInitialisingVariable = initialisingVariable; mVariable = variable; - mComponent = owningComponent(mVariable); std::copy(equations.begin(), equations.end(), back_inserter(mEquations)); } diff --git a/src/analyservariable_p.h b/src/analyservariable_p.h index 98f0462a94..71a146da4c 100644 --- a/src/analyservariable_p.h +++ b/src/analyservariable_p.h @@ -33,7 +33,6 @@ struct AnalyserVariable::AnalyserVariableImpl size_t mIndex = 0; VariablePtr mInitialisingVariable; VariablePtr mVariable; - ComponentPtr mComponent; std::vector mEquations; static AnalyserVariablePtr create(); diff --git a/src/annotator.cpp b/src/annotator.cpp index 715997d9af..85d401b09c 100644 --- a/src/annotator.cpp +++ b/src/annotator.cpp @@ -29,7 +29,6 @@ limitations under the License. #include "libcellml/variable.h" #include "anycellmlelement_p.h" -#include "commonutils.h" #include "internaltypes.h" #include "issue_p.h" #include "logger_p.h" diff --git a/src/api/libcellml/generator.h b/src/api/libcellml/generator.h index 85d5b71eb1..4bebebfd6d 100644 --- a/src/api/libcellml/generator.h +++ b/src/api/libcellml/generator.h @@ -111,13 +111,12 @@ class LIBCELLML_EXPORT Generator * Return the equation code for the given @ref AnalyserEquationAst using @ref GeneratorProfile. * * @param ast The @ref AnalyserEquationAst for which we want to generate some code. - * @param generatorProfile The @ref GeneratorProfile, if any, to use to generate the equation code. If no + * @param profile The @ref GeneratorProfile, if any, to use to generate the equation code. If no * @ref GeneratorProfile is provided then the default @ref GeneratorProfile is used. * * @return The equation code as a @c std::string. */ - static std::string equationCode(const AnalyserEquationAstPtr &ast, - const GeneratorProfilePtr &generatorProfile); + static std::string equationCode(const AnalyserEquationAstPtr &ast, const GeneratorProfilePtr &profile); /** * @brief Get the equation code for the given @ref AnalyserEquationAst using a default @ref GeneratorProfile. diff --git a/src/component.cpp b/src/component.cpp index 207d731e6a..43be7989b9 100644 --- a/src/component.cpp +++ b/src/component.cpp @@ -27,7 +27,6 @@ limitations under the License. #include "libcellml/reset.h" #include "libcellml/variable.h" -#include "commonutils.h" #include "component_p.h" #include "reset_p.h" #include "utilities.h" diff --git a/src/debug.cpp b/src/debug.cpp index a41ed57b4e..e999003345 100644 --- a/src/debug.cpp +++ b/src/debug.cpp @@ -26,7 +26,6 @@ limitations under the License. #include "libcellml/model.h" #include "libcellml/variable.h" -#include "commonutils.h" #include "utilities.h" namespace libcellml { diff --git a/src/generator.cpp b/src/generator.cpp index c8ce8d87c3..8b99a40204 100644 --- a/src/generator.cpp +++ b/src/generator.cpp @@ -27,7 +27,6 @@ limitations under the License. #include "libcellml/units.h" #include "libcellml/version.h" -#include "commonutils.h" #include "generator_p.h" #include "generatorprofilesha1values.h" #include "generatorprofiletools.h" @@ -2152,13 +2151,12 @@ std::string Generator::implementationCode() const return mPimpl->mCode; } -std::string Generator::equationCode(const AnalyserEquationAstPtr &ast, - const GeneratorProfilePtr &generatorProfile) +std::string Generator::equationCode(const AnalyserEquationAstPtr &ast, const GeneratorProfilePtr &profile) { GeneratorPtr generator = libcellml::Generator::create(); - if (generatorProfile != nullptr) { - generator->setProfile(generatorProfile); + if (profile != nullptr) { + generator->setProfile(profile); } return generator->mPimpl->generateCode(ast); diff --git a/src/importer.cpp b/src/importer.cpp index 7e74657fa5..01092d3adc 100644 --- a/src/importer.cpp +++ b/src/importer.cpp @@ -32,7 +32,6 @@ limitations under the License. #include "libcellml/variable.h" #include "anycellmlelement_p.h" -#include "commonutils.h" #include "issue_p.h" #include "logger_p.h" #include "utilities.h" diff --git a/src/model.cpp b/src/model.cpp index 7f89305ded..a429333d03 100644 --- a/src/model.cpp +++ b/src/model.cpp @@ -30,7 +30,6 @@ limitations under the License. #include "libcellml/units.h" #include "libcellml/variable.h" -#include "commonutils.h" #include "component_p.h" #include "componententity_p.h" #include "internaltypes.h" diff --git a/src/printer.cpp b/src/printer.cpp index db5ca8727c..b4b1dfa4db 100644 --- a/src/printer.cpp +++ b/src/printer.cpp @@ -33,7 +33,6 @@ limitations under the License. #include "libcellml/variable.h" #include "anycellmlelement_p.h" -#include "commonutils.h" #include "internaltypes.h" #include "issue_p.h" #include "logger_p.h" diff --git a/src/units.cpp b/src/units.cpp index 87800cdd88..398c74486c 100644 --- a/src/units.cpp +++ b/src/units.cpp @@ -30,7 +30,6 @@ limitations under the License. #include #include -#include "commonutils.h" #include "units_p.h" #include "utilities.h" diff --git a/src/utilities.cpp b/src/utilities.cpp index 996fc653f3..4fdc46fe4d 100644 --- a/src/utilities.cpp +++ b/src/utilities.cpp @@ -36,7 +36,6 @@ limitations under the License. #include "libcellml/units.h" #include "libcellml/variable.h" -#include "commonutils.h" #include "xmldoc.h" #include "xmlutils.h" diff --git a/src/utilities.h b/src/utilities.h index 87beda8aff..df5083fb6c 100644 --- a/src/utilities.h +++ b/src/utilities.h @@ -26,6 +26,7 @@ limitations under the License. #include "libcellml/types.h" #include "libcellml/variable.h" +#include "commonutils.h" #include "internaltypes.h" #include "xmldoc.h" diff --git a/src/validator.cpp b/src/validator.cpp index 10cf488738..19a0d80712 100644 --- a/src/validator.cpp +++ b/src/validator.cpp @@ -33,7 +33,6 @@ limitations under the License. #include "libcellml/variable.h" #include "anycellmlelement_p.h" -#include "commonutils.h" #include "issue_p.h" #include "logger_p.h" #include "namespaces.h" From 7c13a040d9a8018e0b5f5ed7fa309c894efd05e7 Mon Sep 17 00:00:00 2001 From: Alan Garny Date: Tue, 22 Oct 2024 14:45:45 +1300 Subject: [PATCH 77/85] Moved areNearlyEqual() from utilties to commonutils. --- src/commonutils.cpp | 51 +++++++++++++++++++++++++++++++++++++++++++++ src/commonutils.h | 17 +++++++++++++++ src/utilities.cpp | 48 ------------------------------------------ src/utilities.h | 17 --------------- 4 files changed, 68 insertions(+), 65 deletions(-) diff --git a/src/commonutils.cpp b/src/commonutils.cpp index 412691ff77..e5581e9915 100644 --- a/src/commonutils.cpp +++ b/src/commonutils.cpp @@ -16,6 +16,9 @@ limitations under the License. #include "commonutils.h" +#include +#include + #include "libcellml/component.h" #include "libcellml/model.h" @@ -40,6 +43,54 @@ libcellml::ComponentPtr owningComponent(const libcellml::ParentedEntityConstPtr return std::dynamic_pointer_cast(entity->parent()); } +uint64_t ulpsDistance(double a, double b) +{ + static const auto max = std::numeric_limits::max(); + + // Max distance for NaN. + if (std::isnan(a) || std::isnan(b)) { + return max; + } + + // If one's infinite and they're not equal, max distance. + if (std::isinf(a) != std::isinf(b)) { + return max; + } + + static const int SIZE_OF_DOUBLE = sizeof(double); + + uint64_t ia; + uint64_t ib; + memcpy(&ia, &a, SIZE_OF_DOUBLE); + memcpy(&ib, &b, SIZE_OF_DOUBLE); + + // Return the absolute value of the distance in ULPs. + uint64_t distance = max; + if (ia < ib) { + distance = ib + ~ia + 1; + } else { + distance = ia + ~ib + 1; + } + return distance; +} + +bool areNearlyEqual(double a, double b) +{ + static const double fixedEpsilon = std::numeric_limits::epsilon(); + static const ptrdiff_t ulpsEpsilon = 1; + + if (fabs(a - b) <= fixedEpsilon) { + return true; + } + + // If they are not the same sign then return false. + if ((a < 0.0) != (b < 0.0)) { + return false; + } + + return ulpsDistance(a, b) <= ulpsEpsilon; +} + #ifndef TEST_UTILS } // namespace libcellml #endif diff --git a/src/commonutils.h b/src/commonutils.h index dc5ad20c00..66fff07a08 100644 --- a/src/commonutils.h +++ b/src/commonutils.h @@ -45,6 +45,23 @@ libcellml::ModelPtr TEST_EXPORT owningModel(const libcellml::ParentedEntityConst */ libcellml::ComponentPtr TEST_EXPORT owningComponent(const libcellml::ParentedEntityConstPtr &entity); +/** + * @brief Decide if two doubles are nearly equal. + * + * Test two doubles to determine if they are close enough + * to be considered equal. + * + * Uses a modified form of comparing floats: + * + * https://bitbashing.io/comparing-floats.html + * + * @param a A @c double to test. + * @param b A @c double to test. + * + * @return @c true if the given doubles are considered close, @c false otherwise. + */ +bool TEST_EXPORT areNearlyEqual(double a, double b); + #ifndef TEST_UTILS } // namespace libcellml diff --git a/src/utilities.cpp b/src/utilities.cpp index 4fdc46fe4d..7e5fc772e5 100644 --- a/src/utilities.cpp +++ b/src/utilities.cpp @@ -268,54 +268,6 @@ bool areEqual(double a, double b) return convertToString(a + 0.0) == convertToString(b + 0.0); } -uint64_t ulpsDistance(double a, double b) -{ - static const auto max = std::numeric_limits::max(); - - // Max distance for NaN. - if (std::isnan(a) || std::isnan(b)) { - return max; - } - - // If one's infinite and they're not equal, max distance. - if (std::isinf(a) != std::isinf(b)) { - return max; - } - - static const int SIZE_OF_DOUBLE = sizeof(double); - - uint64_t ia; - uint64_t ib; - memcpy(&ia, &a, SIZE_OF_DOUBLE); - memcpy(&ib, &b, SIZE_OF_DOUBLE); - - // Return the absolute value of the distance in ULPs. - uint64_t distance = max; - if (ia < ib) { - distance = ib + ~ia + 1; - } else { - distance = ia + ~ib + 1; - } - return distance; -} - -bool areNearlyEqual(double a, double b) -{ - static const double fixedEpsilon = std::numeric_limits::epsilon(); - static const ptrdiff_t ulpsEpsilon = 1; - - if (fabs(a - b) <= fixedEpsilon) { - return true; - } - - // If they are not the same sign then return false. - if ((a < 0.0) != (b < 0.0)) { - return false; - } - - return ulpsDistance(a, b) <= ulpsEpsilon; -} - std::vector getImportedComponents(const ComponentEntityConstPtr &componentEntity) { std::vector importedComponents; diff --git a/src/utilities.h b/src/utilities.h index df5083fb6c..00d06ccd62 100644 --- a/src/utilities.h +++ b/src/utilities.h @@ -333,23 +333,6 @@ bool isCellMLReal(const std::string &candidate); */ bool areEqual(double a, double b); -/** - * @brief Decide if two doubles are nearly equal. - * - * Test two doubles to determine if they are close enough - * to be considered equal. - * - * Uses a modified form of comparing floats: - * - * https://bitbashing.io/comparing-floats.html - * - * @param a A @c double to test. - * @param b A @c double to test. - * - * @return @c true if the given doubles are considered close, @c false otherwise. - */ -bool areNearlyEqual(double a, double b); - /** * @brief Compare strings to determine if they are equal. * From c029d7e5539d8e63e84e2d6e8a90c1aeae848543 Mon Sep 17 00:00:00 2001 From: Alan Garny Date: Tue, 22 Oct 2024 14:41:34 +1300 Subject: [PATCH 78/85] Analyser: account for the case where a piecewise statement doesn't have any children. --- src/analyser.cpp | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/src/analyser.cpp b/src/analyser.cpp index c3a68d105c..1ebf42d134 100644 --- a/src/analyser.cpp +++ b/src/analyser.cpp @@ -688,30 +688,32 @@ void Analyser::AnalyserImpl::analyseNode(const XmlNodePtr &node, ast->mPimpl->populate(AnalyserEquationAst::Type::PIECEWISE, astParent); - analyseNode(mathmlChildNode(node, 0), ast->mPimpl->mOwnedLeftChild, ast, component, equation); + if (childCount >= 1) { + analyseNode(mathmlChildNode(node, 0), ast->mPimpl->mOwnedLeftChild, ast, component, equation); - if (childCount >= 2) { - AnalyserEquationAstPtr astRight; - AnalyserEquationAstPtr tempAst; + if (childCount >= 2) { + AnalyserEquationAstPtr astRight; + AnalyserEquationAstPtr tempAst; - analyseNode(mathmlChildNode(node, childCount - 1), astRight, nullptr, component, equation); + analyseNode(mathmlChildNode(node, childCount - 1), astRight, nullptr, component, equation); - for (auto i = childCount - 2; i > 0; --i) { - tempAst = AnalyserEquationAst::create(); + for (auto i = childCount - 2; i > 0; --i) { + tempAst = AnalyserEquationAst::create(); - tempAst->mPimpl->populate(AnalyserEquationAst::Type::PIECEWISE, astParent); + tempAst->mPimpl->populate(AnalyserEquationAst::Type::PIECEWISE, astParent); - analyseNode(mathmlChildNode(node, i), tempAst->mPimpl->mOwnedLeftChild, tempAst, component, equation); + analyseNode(mathmlChildNode(node, i), tempAst->mPimpl->mOwnedLeftChild, tempAst, component, equation); - astRight->mPimpl->mParent = tempAst; + astRight->mPimpl->mParent = tempAst; - tempAst->mPimpl->mOwnedRightChild = astRight; - astRight = tempAst; - } + tempAst->mPimpl->mOwnedRightChild = astRight; + astRight = tempAst; + } - astRight->mPimpl->mParent = ast; + astRight->mPimpl->mParent = ast; - ast->mPimpl->mOwnedRightChild = astRight; + ast->mPimpl->mOwnedRightChild = astRight; + } } } else if (node->isMathmlElement("piece")) { ast->mPimpl->populate(AnalyserEquationAst::Type::PIECE, astParent); From 6b4889f3c61d9077876eb8ee56154e2eb007fb3d Mon Sep 17 00:00:00 2001 From: Alan Garny Date: Tue, 22 Oct 2024 15:44:27 +1300 Subject: [PATCH 79/85] Debug: improved printAstAsTree(). --- src/debug.cpp | 60 +++++++++++++++++++++++++++++++++-------------- src/debug.h | 2 +- src/generator.cpp | 24 +++++++++---------- src/generator_p.h | 4 ++-- 4 files changed, 58 insertions(+), 32 deletions(-) diff --git a/src/debug.cpp b/src/debug.cpp index e999003345..2c9dbcd8ac 100644 --- a/src/debug.cpp +++ b/src/debug.cpp @@ -26,6 +26,7 @@ limitations under the License. #include "libcellml/model.h" #include "libcellml/variable.h" +#include "generator_p.h" #include "utilities.h" namespace libcellml { @@ -76,7 +77,8 @@ void printAnalyserModelEquations(const AnalyserModelPtr &model) Debug() << "\n---------------------------------------[API equation #" << ++eqnNb << "]"; if (eqn->ast() != nullptr) { - Debug() << "\n" << astAsCode(eqn->ast()); + Debug() << "\n" + << astAsCode(eqn->ast()); } else { Debug() << "\nNo equation"; } @@ -336,7 +338,29 @@ std::string doPrintAstAsTree(AnalyserEquationAstTrunk *trunk) return res + trunk->mStr; } -std::string doPrintAstAsTree(const AnalyserEquationAstPtr &ast) +std::string ciValue(const AnalyserVariablePtr &analyserVariable, bool rate) +{ + std::string res = (analyserVariable->type() == AnalyserVariable::Type::STATE) ? + (rate ? + "rates" : + "states") : + ((analyserVariable->type() == AnalyserVariable::Type::CONSTANT) ? + "constants" : + ((analyserVariable->type() == AnalyserVariable::Type::COMPUTED_CONSTANT) ? + "computedConstants" : + ((analyserVariable->type() == AnalyserVariable::Type::ALGEBRAIC) ? + "algebraic" : + "externals"))); + auto variable = analyserVariable->variable(); + + res += "[" + std::to_string(analyserVariable->index()) + "] | " + + owningComponent(variable)->name() + " | " + + variable->name() + std::string(rate ? "'" : ""); + + return res; +} + +std::string doPrintAstAsTree(const AnalyserModelPtr &model, const AnalyserEquationAstPtr &ast) { std::string res; @@ -577,15 +601,11 @@ std::string doPrintAstAsTree(const AnalyserEquationAstPtr &ast) // Token elements. - case AnalyserEquationAst::Type::CI: { - auto astVariable = ast->variable(); - - if (astVariable != nullptr) { - res = astVariable->name(); - } + case AnalyserEquationAst::Type::CI: + res = ciValue(libcellml::analyserVariable(model, ast->variable()), + ast->parent()->type() == AnalyserEquationAst::Type::DIFF); break; - } case AnalyserEquationAst::Type::CN: res = ast->value(); @@ -637,7 +657,7 @@ std::string doPrintAstAsTree(const AnalyserEquationAstPtr &ast) return res; } -std::string doPrintAstAsTree(const AnalyserEquationAstPtr &ast, +std::string doPrintAstAsTree(const AnalyserModelPtr &model, const AnalyserEquationAstPtr &ast, AnalyserEquationAstTrunk *prevTrunk, bool isLeft) { if (ast == nullptr) { @@ -650,7 +670,7 @@ std::string doPrintAstAsTree(const AnalyserEquationAstPtr &ast, auto astLeftChild = ast->leftChild(); if (astLeftChild != nullptr) { - res += doPrintAstAsTree(astLeftChild, &trunk, true); + res += doPrintAstAsTree(model, astLeftChild, &trunk, true); } if (prevTrunk == nullptr) { @@ -663,7 +683,15 @@ std::string doPrintAstAsTree(const AnalyserEquationAstPtr &ast, prevTrunk->mStr = prevStr; } - res += doPrintAstAsTree(&trunk) + doPrintAstAsTree(ast) + "\n"; + auto astRightChild = ast->rightChild(); + + res += doPrintAstAsTree(&trunk); + + if (astLeftChild != nullptr) { + res += (astRightChild != nullptr) ? "┤" : "┘"; + } + + res += " " + doPrintAstAsTree(model, ast) + "\n"; if (prevTrunk != nullptr) { prevTrunk->mStr = prevStr; @@ -671,18 +699,16 @@ std::string doPrintAstAsTree(const AnalyserEquationAstPtr &ast, trunk.mStr = TRUNK; - auto astRightChild = ast->rightChild(); - if (astRightChild != nullptr) { - res += doPrintAstAsTree(astRightChild, &trunk, false); + res += doPrintAstAsTree(model, astRightChild, &trunk, false); } return res; } -void printAstAsTree(const AnalyserEquationAstPtr &ast) +void printAstAsTree(const AnalyserModelPtr &model, const AnalyserEquationAstPtr &ast) { - Debug() << doPrintAstAsTree(ast, nullptr, false); + Debug() << doPrintAstAsTree(model, ast, nullptr, false); } void printAstAsCode(const AnalyserEquationAstPtr &ast) diff --git a/src/debug.h b/src/debug.h index 0c6f861ad4..37a02618e3 100644 --- a/src/debug.h +++ b/src/debug.h @@ -95,7 +95,7 @@ struct Debug void printAnalyserModelEquations(const AnalyserModelPtr &model); void printAnalyserModelVariables(const AnalyserModelPtr &model); -void printAstAsTree(const AnalyserEquationAstPtr &ast); +void printAstAsTree(const AnalyserModelPtr &model, const AnalyserEquationAstPtr &ast); void printAstAsCode(const AnalyserEquationAstPtr &ast); void printComponentMap(const ComponentMap &map); void printConnectionMap(const ConnectionMap &map); diff --git a/src/generator.cpp b/src/generator.cpp index 8b99a40204..1a8b0a2c71 100644 --- a/src/generator.cpp +++ b/src/generator.cpp @@ -63,22 +63,22 @@ bool Generator::GeneratorImpl::modelHasNlas() const } } -AnalyserVariablePtr Generator::GeneratorImpl::analyserVariable(const VariablePtr &variable) const +AnalyserVariablePtr analyserVariable(const AnalyserModelPtr &model, const VariablePtr &variable) { // Find and return the analyser variable associated with the given variable. AnalyserVariablePtr res; - auto modelVoi = mModel->voi(); - VariablePtr modelVoiVariable = (modelVoi != nullptr) ? modelVoi->variable() : nullptr; + auto modelVoi = model->voi(); + auto modelVoiVariable = (modelVoi != nullptr) ? modelVoi->variable() : nullptr; if ((modelVoiVariable != nullptr) - && mModel->areEquivalentVariables(variable, modelVoiVariable)) { + && model->areEquivalentVariables(variable, modelVoiVariable)) { res = modelVoi; } else { // Normally, we would have something like: // - // for (const auto &modelVariable : variables(mModel)) { - // if (mModel->areEquivalentVariables(variable, modelVariable->variable())) { + // for (const auto &modelVariable : variables(model)) { + // if (model->areEquivalentVariables(variable, modelVariable->variable())) { // res = modelVariable; // // break; @@ -88,11 +88,11 @@ AnalyserVariablePtr Generator::GeneratorImpl::analyserVariable(const VariablePtr // but we always have variables, so llvm-cov will complain that the false branch of our for loop is never // reached. The below code is a bit more verbose but at least it makes llvm-cov happy. - auto modelVariables = variables(mModel); + auto modelVariables = variables(model); auto modelVariable = modelVariables.begin(); do { - if (mModel->areEquivalentVariables(variable, (*modelVariable)->variable())) { + if (model->areEquivalentVariables(variable, (*modelVariable)->variable())) { res = *modelVariable; } else { ++modelVariable; @@ -108,12 +108,12 @@ double Generator::GeneratorImpl::scalingFactor(const VariablePtr &variable) cons // Return the scaling factor for the given variable, accounting for the fact that a constant may be initialised by // another variable which initial value may be defined in a different component. - auto analyserVariable = Generator::GeneratorImpl::analyserVariable(variable); + auto analyserVariable = libcellml::analyserVariable(mModel, variable); if ((analyserVariable->type() == AnalyserVariable::Type::CONSTANT) && !isCellMLReal(variable->initialValue())) { auto initialValueVariable = owningComponent(variable)->variable(variable->initialValue()); - auto initialValueAnalyserVariable = Generator::GeneratorImpl::analyserVariable(initialValueVariable); + auto initialValueAnalyserVariable = libcellml::analyserVariable(mModel, initialValueVariable); if (owningComponent(variable) != owningComponent(initialValueAnalyserVariable->variable())) { return Units::scalingFactor(initialValueVariable->units(), variable->units()); @@ -889,7 +889,7 @@ std::string Generator::GeneratorImpl::generateDoubleOrConstantVariableNameCode(c } auto initialValueVariable = owningComponent(variable)->variable(variable->initialValue()); - auto analyserInitialValueVariable = analyserVariable(initialValueVariable); + auto analyserInitialValueVariable = analyserVariable(mModel, initialValueVariable); return mProfile->constantsArrayString() + mProfile->openArrayString() + convertToString(analyserInitialValueVariable->index()) + mProfile->closeArrayString(); } @@ -906,7 +906,7 @@ std::string Generator::GeneratorImpl::generateVariableNameCode(const VariablePtr return variable->name(); } - auto analyserVariable = Generator::GeneratorImpl::analyserVariable(variable); + auto analyserVariable = libcellml::analyserVariable(mModel, variable); if (analyserVariable->type() == AnalyserVariable::Type::VARIABLE_OF_INTEGRATION) { return mProfile->voiString(); diff --git a/src/generator_p.h b/src/generator_p.h index d85e8e2f44..fce8d2e7d7 100644 --- a/src/generator_p.h +++ b/src/generator_p.h @@ -26,6 +26,8 @@ namespace libcellml { std::string generateDoubleCode(const std::string &value); +AnalyserVariablePtr analyserVariable(const AnalyserModelPtr &model, const VariablePtr &variable); + /** * @brief The Generator::GeneratorImpl struct. * @@ -44,8 +46,6 @@ struct Generator::GeneratorImpl bool modelHasOdes() const; bool modelHasNlas() const; - AnalyserVariablePtr analyserVariable(const VariablePtr &variable) const; - double scalingFactor(const VariablePtr &variable) const; bool isNegativeNumber(const AnalyserEquationAstPtr &ast) const; From b61141d1eaf291dc42f8a20da4fb4acdcf70469d Mon Sep 17 00:00:00 2001 From: Alan Garny Date: Tue, 22 Oct 2024 16:19:58 +1300 Subject: [PATCH 80/85] Have our debug.* files formatted. --- CMakeLists.txt | 4 +++- src/CMakeLists.txt | 3 +++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1dd1554065..1d5a5ed396 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -249,8 +249,10 @@ if(CLANG_FORMAT_AVAILABLE) ${SOURCE_FILES} ${HEADER_FILES} ${CONFIG_FILES} - ${TESTS_HEADER_FILES} + ${DEBUG_SOURCE_FILES} + ${DEBUG_HEADER_FILES} ${TESTS_SOURCE_FILES} + ${TESTS_HEADER_FILES} ) set(CHECK_CODE_FORMATTING_SCRIPT ${CMAKE_CURRENT_BINARY_DIR}/cmake_command_check_code_formatting.cmake) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 82d4676d18..17601cb516 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -379,3 +379,6 @@ set(CONFIG_FILES ${LIBCELLML_VERSIONCONFIG_H_IN} PARENT_SCOPE ) + +set(DEBUG_SOURCE_FILES ${DEBUG_SOURCE_FILES} PARENT_SCOPE) +set(DEBUG_HEADER_FILES ${DEBUG_HEADER_FILES} PARENT_SCOPE) From 8308d8e1ca8d7b349436849372abf607eded9e14 Mon Sep 17 00:00:00 2001 From: Alan Garny Date: Tue, 22 Oct 2024 16:14:54 +1300 Subject: [PATCH 81/85] Moved parts of our Generator class to our new GeneratorInterpreter class. --- src/CMakeLists.txt | 3 + src/analyser.cpp | 1 + src/debug.cpp | 2 +- src/generator.cpp | 1533 ++-------------------------------- src/generator_p.h | 70 +- src/generatorinterpreter.cpp | 1512 +++++++++++++++++++++++++++++++++ src/generatorinterpreter.h | 92 ++ src/generatorinterpreter_p.h | 108 +++ 8 files changed, 1789 insertions(+), 1532 deletions(-) create mode 100644 src/generatorinterpreter.cpp create mode 100644 src/generatorinterpreter.h create mode 100644 src/generatorinterpreter_p.h diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 17601cb516..ab771dfb08 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -49,6 +49,7 @@ set(SOURCE_FILES ${CMAKE_CURRENT_SOURCE_DIR}/entity.cpp ${CMAKE_CURRENT_SOURCE_DIR}/enums.cpp ${CMAKE_CURRENT_SOURCE_DIR}/generator.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/generatorinterpreter.cpp ${CMAKE_CURRENT_SOURCE_DIR}/generatorprofile.cpp ${CMAKE_CURRENT_SOURCE_DIR}/generatorprofiletools.cpp ${CMAKE_CURRENT_SOURCE_DIR}/importedentity.cpp @@ -133,6 +134,8 @@ set(GIT_HEADER_FILES ${CMAKE_CURRENT_SOURCE_DIR}/debug.h ${CMAKE_CURRENT_SOURCE_DIR}/entity_p.h ${CMAKE_CURRENT_SOURCE_DIR}/generator_p.h + ${CMAKE_CURRENT_SOURCE_DIR}/generatorinterpreter_p.h + ${CMAKE_CURRENT_SOURCE_DIR}/generatorinterpreter.h ${CMAKE_CURRENT_SOURCE_DIR}/generatorprofile_p.h ${CMAKE_CURRENT_SOURCE_DIR}/generatorprofilesha1values.h ${CMAKE_CURRENT_SOURCE_DIR}/generatorprofiletools.h diff --git a/src/analyser.cpp b/src/analyser.cpp index 1ebf42d134..0bb84b717e 100644 --- a/src/analyser.cpp +++ b/src/analyser.cpp @@ -34,6 +34,7 @@ limitations under the License. #include "analyservariable_p.h" #include "commonutils.h" #include "generator_p.h" +#include "generatorinterpreter_p.h" #include "xmlutils.h" namespace libcellml { diff --git a/src/debug.cpp b/src/debug.cpp index 2c9dbcd8ac..ff462fec15 100644 --- a/src/debug.cpp +++ b/src/debug.cpp @@ -26,7 +26,7 @@ limitations under the License. #include "libcellml/model.h" #include "libcellml/variable.h" -#include "generator_p.h" +#include "generatorinterpreter_p.h" #include "utilities.h" namespace libcellml { diff --git a/src/generator.cpp b/src/generator.cpp index 1a8b0a2c71..8ebe9c958f 100644 --- a/src/generator.cpp +++ b/src/generator.cpp @@ -28,6 +28,7 @@ limitations under the License. #include "libcellml/version.h" #include "generator_p.h" +#include "generatorinterpreter_p.h" #include "generatorprofilesha1values.h" #include "generatorprofiletools.h" #include "utilities.h" @@ -41,186 +42,6 @@ void Generator::GeneratorImpl::reset() mCode = {}; } -bool Generator::GeneratorImpl::modelHasOdes() const -{ - switch (mModel->type()) { - case AnalyserModel::Type::ODE: - case AnalyserModel::Type::DAE: - return true; - default: - return false; - } -} - -bool Generator::GeneratorImpl::modelHasNlas() const -{ - switch (mModel->type()) { - case AnalyserModel::Type::NLA: - case AnalyserModel::Type::DAE: - return true; - default: - return false; - } -} - -AnalyserVariablePtr analyserVariable(const AnalyserModelPtr &model, const VariablePtr &variable) -{ - // Find and return the analyser variable associated with the given variable. - - AnalyserVariablePtr res; - auto modelVoi = model->voi(); - auto modelVoiVariable = (modelVoi != nullptr) ? modelVoi->variable() : nullptr; - - if ((modelVoiVariable != nullptr) - && model->areEquivalentVariables(variable, modelVoiVariable)) { - res = modelVoi; - } else { - // Normally, we would have something like: - // - // for (const auto &modelVariable : variables(model)) { - // if (model->areEquivalentVariables(variable, modelVariable->variable())) { - // res = modelVariable; - // - // break; - // } - // } - // - // but we always have variables, so llvm-cov will complain that the false branch of our for loop is never - // reached. The below code is a bit more verbose but at least it makes llvm-cov happy. - - auto modelVariables = variables(model); - auto modelVariable = modelVariables.begin(); - - do { - if (model->areEquivalentVariables(variable, (*modelVariable)->variable())) { - res = *modelVariable; - } else { - ++modelVariable; - } - } while (res == nullptr); - } - - return res; -} - -double Generator::GeneratorImpl::scalingFactor(const VariablePtr &variable) const -{ - // Return the scaling factor for the given variable, accounting for the fact that a constant may be initialised by - // another variable which initial value may be defined in a different component. - - auto analyserVariable = libcellml::analyserVariable(mModel, variable); - - if ((analyserVariable->type() == AnalyserVariable::Type::CONSTANT) - && !isCellMLReal(variable->initialValue())) { - auto initialValueVariable = owningComponent(variable)->variable(variable->initialValue()); - auto initialValueAnalyserVariable = libcellml::analyserVariable(mModel, initialValueVariable); - - if (owningComponent(variable) != owningComponent(initialValueAnalyserVariable->variable())) { - return Units::scalingFactor(initialValueVariable->units(), variable->units()); - } - } - - return Units::scalingFactor(analyserVariable->variable()->units(), variable->units()); -} - -bool Generator::GeneratorImpl::isNegativeNumber(const AnalyserEquationAstPtr &ast) const -{ - if (ast->type() == AnalyserEquationAst::Type::CN) { - double doubleValue; - - convertToDouble(ast->value(), doubleValue); - - return doubleValue < 0.0; - } - - return false; -} - -bool Generator::GeneratorImpl::isRelationalOperator(const AnalyserEquationAstPtr &ast) const -{ - switch (ast->type()) { - case AnalyserEquationAst::Type::EQ: - return mProfile->hasEqOperator(); - case AnalyserEquationAst::Type::NEQ: - return mProfile->hasNeqOperator(); - case AnalyserEquationAst::Type::LT: - return mProfile->hasLtOperator(); - case AnalyserEquationAst::Type::LEQ: - return mProfile->hasLeqOperator(); - case AnalyserEquationAst::Type::GT: - return mProfile->hasGtOperator(); - case AnalyserEquationAst::Type::GEQ: - return mProfile->hasGeqOperator(); - default: - return false; - } -} - -bool Generator::GeneratorImpl::isAndOperator(const AnalyserEquationAstPtr &ast) const -{ - return (ast->type() == AnalyserEquationAst::Type::AND) - && mProfile->hasAndOperator(); -} - -bool Generator::GeneratorImpl::isOrOperator(const AnalyserEquationAstPtr &ast) const -{ - return (ast->type() == AnalyserEquationAst::Type::OR) - && mProfile->hasOrOperator(); -} - -bool Generator::GeneratorImpl::isXorOperator(const AnalyserEquationAstPtr &ast) const -{ - return (ast->type() == AnalyserEquationAst::Type::XOR) - && mProfile->hasXorOperator(); -} - -bool Generator::GeneratorImpl::isLogicalOperator(const AnalyserEquationAstPtr &ast) const -{ - // Note: AnalyserEquationAst::Type::NOT is a unary logical operator, hence - // we don't include it here since this method is only used to - // determine whether parentheses should be added around some code. - - return isAndOperator(ast) || isOrOperator(ast) || isXorOperator(ast); -} - -bool Generator::GeneratorImpl::isPlusOperator(const AnalyserEquationAstPtr &ast) const -{ - return ast->type() == AnalyserEquationAst::Type::PLUS; -} - -bool Generator::GeneratorImpl::isMinusOperator(const AnalyserEquationAstPtr &ast) const -{ - return ast->type() == AnalyserEquationAst::Type::MINUS; -} - -bool Generator::GeneratorImpl::isTimesOperator(const AnalyserEquationAstPtr &ast) const -{ - return ast->type() == AnalyserEquationAst::Type::TIMES; -} - -bool Generator::GeneratorImpl::isDivideOperator(const AnalyserEquationAstPtr &ast) const -{ - return ast->type() == AnalyserEquationAst::Type::DIVIDE; -} - -bool Generator::GeneratorImpl::isPowerOperator(const AnalyserEquationAstPtr &ast) const -{ - return (ast->type() == AnalyserEquationAst::Type::POWER) - && mProfile->hasPowerOperator(); -} - -bool Generator::GeneratorImpl::isRootOperator(const AnalyserEquationAstPtr &ast) const -{ - return (ast->type() == AnalyserEquationAst::Type::ROOT) - && mProfile->hasPowerOperator(); -} - -bool Generator::GeneratorImpl::isPiecewiseStatement(const AnalyserEquationAstPtr &ast) const -{ - return (ast->type() == AnalyserEquationAst::Type::PIECEWISE) - && mProfile->hasConditionalOperator(); -} - void Generator::GeneratorImpl::updateVariableInfoSizes(size_t &componentSize, size_t &nameSize, size_t &unitsSize, @@ -246,11 +67,6 @@ bool Generator::GeneratorImpl::modifiedProfile() const sha1(profileContents) != PYTHON_GENERATOR_PROFILE_SHA1; } -std::string Generator::GeneratorImpl::newLineIfNeeded() -{ - return mCode.empty() ? "" : "\n"; -} - void Generator::GeneratorImpl::addOriginCommentCode() { if (!mProfile->commentString().empty() @@ -264,7 +80,7 @@ void Generator::GeneratorImpl::addOriginCommentCode() "Python"; profileInformation += " profile of"; - mCode += newLineIfNeeded() + mCode += newLineIfNeeded(mCode) + replace(mProfile->commentString(), "[CODE]", replace(replace(mProfile->originCommentString(), "[PROFILE_INFORMATION]", profileInformation), "[LIBCELLML_VERSION]", versionString())); } @@ -273,7 +89,7 @@ void Generator::GeneratorImpl::addOriginCommentCode() void Generator::GeneratorImpl::addInterfaceHeaderCode() { if (!mProfile->interfaceHeaderString().empty()) { - mCode += newLineIfNeeded() + mCode += newLineIfNeeded(mCode) + mProfile->interfaceHeaderString(); } } @@ -287,7 +103,7 @@ void Generator::GeneratorImpl::addImplementationHeaderCode() if (!mProfile->implementationHeaderString().empty() && ((hasInterfaceFileName && !mProfile->interfaceFileNameString().empty()) || !hasInterfaceFileName)) { - mCode += newLineIfNeeded() + mCode += newLineIfNeeded(mCode) + replace(mProfile->implementationHeaderString(), "[INTERFACE_FILE_NAME]", mProfile->interfaceFileNameString()); } @@ -321,7 +137,7 @@ void Generator::GeneratorImpl::addVersionAndLibcellmlVersionCode(bool interface) } if (!code.empty()) { - mCode += newLineIfNeeded() + mCode += newLineIfNeeded(mCode) + code; } } @@ -330,7 +146,7 @@ void Generator::GeneratorImpl::addStateAndVariableCountCode(bool interface) { std::string code; - if (modelHasOdes() + if (mModelHasOdes && ((interface && !mProfile->interfaceStateCountString().empty()) || (!interface && !mProfile->implementationStateCountString().empty()))) { code += interface ? @@ -373,7 +189,7 @@ void Generator::GeneratorImpl::addStateAndVariableCountCode(bool interface) } if (!code.empty()) { - mCode += newLineIfNeeded() + mCode += newLineIfNeeded(mCode) + code; } } @@ -397,7 +213,7 @@ std::string Generator::GeneratorImpl::generateVariableInfoObjectCode(const std:: void Generator::GeneratorImpl::addVariableInfoObjectCode() { if (!mProfile->variableInfoObjectString().empty()) { - mCode += newLineIfNeeded() + mCode += newLineIfNeeded(mCode) + generateVariableInfoObjectCode(mProfile->variableInfoObjectString()); } } @@ -416,12 +232,12 @@ void Generator::GeneratorImpl::addInterfaceVariableInfoCode() { std::string code; - if (modelHasOdes() + if (mModelHasOdes && !mProfile->interfaceVoiInfoString().empty()) { code += mProfile->interfaceVoiInfoString(); } - if (modelHasOdes() + if (mModelHasOdes && !mProfile->interfaceStateInfoString().empty()) { code += mProfile->interfaceStateInfoString(); } @@ -444,7 +260,7 @@ void Generator::GeneratorImpl::addInterfaceVariableInfoCode() } if (!code.empty()) { - mCode += newLineIfNeeded() + mCode += newLineIfNeeded(mCode) + code; } } @@ -475,18 +291,18 @@ void Generator::GeneratorImpl::doAddImplementationVariableInfoCode(const std::st infoElementsCode += "\n"; } - mCode += newLineIfNeeded() + mCode += newLineIfNeeded(mCode) + replace(variableInfoString, "[CODE]", infoElementsCode); } } void Generator::GeneratorImpl::addImplementationVariableInfoCode() { - if (modelHasOdes()) { + if (mModelHasOdes) { doAddImplementationVariableInfoCode(mProfile->implementationVoiInfoString(), {mModel->voi()}, true); } - if (modelHasOdes()) { + if (mModelHasOdes) { doAddImplementationVariableInfoCode(mProfile->implementationStateInfoString(), mModel->states(), false); } @@ -503,73 +319,73 @@ void Generator::GeneratorImpl::addArithmeticFunctionsCode() { if (mModel->needEqFunction() && !mProfile->hasEqOperator() && !mProfile->eqFunctionString().empty()) { - mCode += newLineIfNeeded() + mCode += newLineIfNeeded(mCode) + mProfile->eqFunctionString(); } if (mModel->needNeqFunction() && !mProfile->hasNeqOperator() && !mProfile->neqFunctionString().empty()) { - mCode += newLineIfNeeded() + mCode += newLineIfNeeded(mCode) + mProfile->neqFunctionString(); } if (mModel->needLtFunction() && !mProfile->hasLtOperator() && !mProfile->ltFunctionString().empty()) { - mCode += newLineIfNeeded() + mCode += newLineIfNeeded(mCode) + mProfile->ltFunctionString(); } if (mModel->needLeqFunction() && !mProfile->hasLeqOperator() && !mProfile->leqFunctionString().empty()) { - mCode += newLineIfNeeded() + mCode += newLineIfNeeded(mCode) + mProfile->leqFunctionString(); } if (mModel->needGtFunction() && !mProfile->hasGtOperator() && !mProfile->gtFunctionString().empty()) { - mCode += newLineIfNeeded() + mCode += newLineIfNeeded(mCode) + mProfile->gtFunctionString(); } if (mModel->needGeqFunction() && !mProfile->hasGeqOperator() && !mProfile->geqFunctionString().empty()) { - mCode += newLineIfNeeded() + mCode += newLineIfNeeded(mCode) + mProfile->geqFunctionString(); } if (mModel->needAndFunction() && !mProfile->hasAndOperator() && !mProfile->andFunctionString().empty()) { - mCode += newLineIfNeeded() + mCode += newLineIfNeeded(mCode) + mProfile->andFunctionString(); } if (mModel->needOrFunction() && !mProfile->hasOrOperator() && !mProfile->orFunctionString().empty()) { - mCode += newLineIfNeeded() + mCode += newLineIfNeeded(mCode) + mProfile->orFunctionString(); } if (mModel->needXorFunction() && !mProfile->hasXorOperator() && !mProfile->xorFunctionString().empty()) { - mCode += newLineIfNeeded() + mCode += newLineIfNeeded(mCode) + mProfile->xorFunctionString(); } if (mModel->needNotFunction() && !mProfile->hasNotOperator() && !mProfile->notFunctionString().empty()) { - mCode += newLineIfNeeded() + mCode += newLineIfNeeded(mCode) + mProfile->notFunctionString(); } if (mModel->needMinFunction() && !mProfile->minFunctionString().empty()) { - mCode += newLineIfNeeded() + mCode += newLineIfNeeded(mCode) + mProfile->minFunctionString(); } if (mModel->needMaxFunction() && !mProfile->maxFunctionString().empty()) { - mCode += newLineIfNeeded() + mCode += newLineIfNeeded(mCode) + mProfile->maxFunctionString(); } } @@ -578,73 +394,73 @@ void Generator::GeneratorImpl::addTrigonometricFunctionsCode() { if (mModel->needSecFunction() && !mProfile->secFunctionString().empty()) { - mCode += newLineIfNeeded() + mCode += newLineIfNeeded(mCode) + mProfile->secFunctionString(); } if (mModel->needCscFunction() && !mProfile->cscFunctionString().empty()) { - mCode += newLineIfNeeded() + mCode += newLineIfNeeded(mCode) + mProfile->cscFunctionString(); } if (mModel->needCotFunction() && !mProfile->cotFunctionString().empty()) { - mCode += newLineIfNeeded() + mCode += newLineIfNeeded(mCode) + mProfile->cotFunctionString(); } if (mModel->needSechFunction() && !mProfile->sechFunctionString().empty()) { - mCode += newLineIfNeeded() + mCode += newLineIfNeeded(mCode) + mProfile->sechFunctionString(); } if (mModel->needCschFunction() && !mProfile->cschFunctionString().empty()) { - mCode += newLineIfNeeded() + mCode += newLineIfNeeded(mCode) + mProfile->cschFunctionString(); } if (mModel->needCothFunction() && !mProfile->cothFunctionString().empty()) { - mCode += newLineIfNeeded() + mCode += newLineIfNeeded(mCode) + mProfile->cothFunctionString(); } if (mModel->needAsecFunction() && !mProfile->asecFunctionString().empty()) { - mCode += newLineIfNeeded() + mCode += newLineIfNeeded(mCode) + mProfile->asecFunctionString(); } if (mModel->needAcscFunction() && !mProfile->acscFunctionString().empty()) { - mCode += newLineIfNeeded() + mCode += newLineIfNeeded(mCode) + mProfile->acscFunctionString(); } if (mModel->needAcotFunction() && !mProfile->acotFunctionString().empty()) { - mCode += newLineIfNeeded() + mCode += newLineIfNeeded(mCode) + mProfile->acotFunctionString(); } if (mModel->needAsechFunction() && !mProfile->asechFunctionString().empty()) { - mCode += newLineIfNeeded() + mCode += newLineIfNeeded(mCode) + mProfile->asechFunctionString(); } if (mModel->needAcschFunction() && !mProfile->acschFunctionString().empty()) { - mCode += newLineIfNeeded() + mCode += newLineIfNeeded(mCode) + mProfile->acschFunctionString(); } if (mModel->needAcothFunction() && !mProfile->acothFunctionString().empty()) { - mCode += newLineIfNeeded() + mCode += newLineIfNeeded(mCode) + mProfile->acothFunctionString(); } } @@ -653,7 +469,7 @@ void Generator::GeneratorImpl::addInterfaceCreateDeleteArrayMethodsCode() { std::string code; - if (modelHasOdes() + if (mModelHasOdes && !mProfile->interfaceCreateStatesArrayMethodString().empty()) { code += mProfile->interfaceCreateStatesArrayMethodString(); } @@ -681,42 +497,42 @@ void Generator::GeneratorImpl::addInterfaceCreateDeleteArrayMethodsCode() } if (!code.empty()) { - mCode += newLineIfNeeded() + mCode += newLineIfNeeded(mCode) + code; } } void Generator::GeneratorImpl::addImplementationCreateDeleteArrayMethodsCode() { - if (modelHasOdes() + if (mModelHasOdes && !mProfile->implementationCreateStatesArrayMethodString().empty()) { - mCode += newLineIfNeeded() + mCode += newLineIfNeeded(mCode) + mProfile->implementationCreateStatesArrayMethodString(); } if (!mProfile->implementationCreateConstantsArrayMethodString().empty()) { - mCode += newLineIfNeeded() + mCode += newLineIfNeeded(mCode) + mProfile->implementationCreateConstantsArrayMethodString(); } if (!mProfile->implementationCreateComputedConstantsArrayMethodString().empty()) { - mCode += newLineIfNeeded() + mCode += newLineIfNeeded(mCode) + mProfile->implementationCreateComputedConstantsArrayMethodString(); } if (!mProfile->implementationCreateAlgebraicArrayMethodString().empty()) { - mCode += newLineIfNeeded() + mCode += newLineIfNeeded(mCode) + mProfile->implementationCreateAlgebraicArrayMethodString(); } if (mModel->hasExternalVariables() && !mProfile->implementationCreateExternalsArrayMethodString().empty()) { - mCode += newLineIfNeeded() + mCode += newLineIfNeeded(mCode) + mProfile->implementationCreateExternalsArrayMethodString(); } if (!mProfile->implementationDeleteArrayMethodString().empty()) { - mCode += newLineIfNeeded() + mCode += newLineIfNeeded(mCode) + mProfile->implementationDeleteArrayMethodString(); } } @@ -724,10 +540,10 @@ void Generator::GeneratorImpl::addImplementationCreateDeleteArrayMethodsCode() void Generator::GeneratorImpl::addExternalVariableMethodTypeDefinitionCode() { if (mModel->hasExternalVariables()) { - auto externalVariableMethodTypeDefinitionString = mProfile->externalVariableMethodTypeDefinitionString(modelHasOdes()); + auto externalVariableMethodTypeDefinitionString = mProfile->externalVariableMethodTypeDefinitionString(mModelHasOdes); if (!externalVariableMethodTypeDefinitionString.empty()) { - mCode += newLineIfNeeded() + mCode += newLineIfNeeded(mCode) + externalVariableMethodTypeDefinitionString; } } @@ -735,1050 +551,25 @@ void Generator::GeneratorImpl::addExternalVariableMethodTypeDefinitionCode() void Generator::GeneratorImpl::addRootFindingInfoObjectCode() { - if (modelHasNlas() - && !mProfile->rootFindingInfoObjectString(modelHasOdes(), mModel->hasExternalVariables()).empty()) { - mCode += newLineIfNeeded() - + mProfile->rootFindingInfoObjectString(modelHasOdes(), mModel->hasExternalVariables()); + if (mModelHasNlas + && !mProfile->rootFindingInfoObjectString(mModelHasOdes, mModel->hasExternalVariables()).empty()) { + mCode += newLineIfNeeded(mCode) + + mProfile->rootFindingInfoObjectString(mModelHasOdes, mModel->hasExternalVariables()); } } void Generator::GeneratorImpl::addExternNlaSolveMethodCode() { - if (modelHasNlas() + if (mModelHasNlas && !mProfile->externNlaSolveMethodString().empty()) { - mCode += newLineIfNeeded() + mCode += newLineIfNeeded(mCode) + mProfile->externNlaSolveMethodString(); } } -void Generator::GeneratorImpl::addNlaSystemsCode() -{ - if (modelHasNlas() - && !mProfile->objectiveFunctionMethodString(modelHasOdes(), mModel->hasExternalVariables()).empty() - && !mProfile->findRootMethodString(modelHasOdes(), mModel->hasExternalVariables()).empty() - && !mProfile->nlaSolveCallString(modelHasOdes(), mModel->hasExternalVariables()).empty()) { - // Note: only states and algebraic variables can be computed through an NLA system. Constants, computed - // constants, and external variables cannot, by definition, be computed through an NLA system. - - std::vector handledNlaEquations; - - for (const auto &equation : mModel->equations()) { - if ((equation->type() == AnalyserEquation::Type::NLA) - && (std::find(handledNlaEquations.begin(), handledNlaEquations.end(), equation) == handledNlaEquations.end())) { - std::string methodBody; - auto i = MAX_SIZE_T; - auto variables = libcellml::variables(equation); - - for (const auto &variable : variables) { - auto arrayString = (variable->type() == AnalyserVariable::Type::STATE) ? - mProfile->ratesArrayString() : - mProfile->algebraicArrayString(); - - methodBody += mProfile->indentString() - + arrayString + mProfile->openArrayString() + convertToString(variable->index()) + mProfile->closeArrayString() - + mProfile->equalityString() - + mProfile->uArrayString() + mProfile->openArrayString() + convertToString(++i) + mProfile->closeArrayString() - + mProfile->commandSeparatorString() + "\n"; - } - - methodBody += newLineIfNeeded(); - - i = MAX_SIZE_T; - - methodBody += mProfile->indentString() - + mProfile->fArrayString() + mProfile->openArrayString() + convertToString(++i) + mProfile->closeArrayString() - + mProfile->equalityString() - + generateCode(equation->ast()) - + mProfile->commandSeparatorString() + "\n"; - - handledNlaEquations.push_back(equation); - - for (const auto &nlaSibling : equation->nlaSiblings()) { - methodBody += mProfile->indentString() - + mProfile->fArrayString() + mProfile->openArrayString() + convertToString(++i) + mProfile->closeArrayString() - + mProfile->equalityString() - + generateCode(nlaSibling->ast()) - + mProfile->commandSeparatorString() + "\n"; - - handledNlaEquations.push_back(nlaSibling); - } - - mCode += newLineIfNeeded() - + replace(replace(mProfile->objectiveFunctionMethodString(modelHasOdes(), mModel->hasExternalVariables()), - "[INDEX]", convertToString(equation->nlaSystemIndex())), - "[CODE]", generateMethodBodyCode(methodBody)); - - methodBody = {}; - - i = MAX_SIZE_T; - - for (const auto &variable : variables) { - auto arrayString = (variable->type() == AnalyserVariable::Type::STATE) ? - mProfile->ratesArrayString() : - mProfile->algebraicArrayString(); - - methodBody += mProfile->indentString() - + mProfile->uArrayString() + mProfile->openArrayString() + convertToString(++i) + mProfile->closeArrayString() - + mProfile->equalityString() - + arrayString + mProfile->openArrayString() + convertToString(variable->index()) + mProfile->closeArrayString() - + mProfile->commandSeparatorString() + "\n"; - } - - auto variablesCount = variables.size(); - - methodBody += newLineIfNeeded() - + mProfile->indentString() - + replace(replace(mProfile->nlaSolveCallString(modelHasOdes(), mModel->hasExternalVariables()), - "[INDEX]", convertToString(equation->nlaSystemIndex())), - "[SIZE]", convertToString(variablesCount)); - - methodBody += newLineIfNeeded(); - - i = MAX_SIZE_T; - - for (const auto &variable : variables) { - auto arrayString = (variable->type() == AnalyserVariable::Type::STATE) ? - mProfile->ratesArrayString() : - mProfile->algebraicArrayString(); - - methodBody += mProfile->indentString() - + arrayString + mProfile->openArrayString() + convertToString(variable->index()) + mProfile->closeArrayString() - + mProfile->equalityString() - + mProfile->uArrayString() + mProfile->openArrayString() + convertToString(++i) + mProfile->closeArrayString() - + mProfile->commandSeparatorString() + "\n"; - } - - mCode += newLineIfNeeded() - + replace(replace(replace(mProfile->findRootMethodString(modelHasOdes(), mModel->hasExternalVariables()), - "[INDEX]", convertToString(equation->nlaSystemIndex())), - "[SIZE]", convertToString(variablesCount)), - "[CODE]", generateMethodBodyCode(methodBody)); - } - } - } -} - -std::string Generator::GeneratorImpl::generateMethodBodyCode(const std::string &methodBody) const -{ - return methodBody.empty() ? - mProfile->emptyMethodString().empty() ? - "" : - mProfile->indentString() + mProfile->emptyMethodString() : - methodBody; -} - -std::string generateDoubleCode(const std::string &value) -{ - if (value.find('.') != std::string::npos) { - return value; - } - - auto ePos = value.find('e'); - - if (ePos == std::string::npos) { - return value + ".0"; - } - - return value.substr(0, ePos) + ".0" + value.substr(ePos); -} - -std::string Generator::GeneratorImpl::generateDoubleOrConstantVariableNameCode(const VariablePtr &variable) const -{ - if (isCellMLReal(variable->initialValue())) { - return generateDoubleCode(variable->initialValue()); - } - - auto initialValueVariable = owningComponent(variable)->variable(variable->initialValue()); - auto analyserInitialValueVariable = analyserVariable(mModel, initialValueVariable); - - return mProfile->constantsArrayString() + mProfile->openArrayString() + convertToString(analyserInitialValueVariable->index()) + mProfile->closeArrayString(); -} - -std::string Generator::GeneratorImpl::generateVariableNameCode(const VariablePtr &variable, - bool state) const -{ - // Generate some code for a variable name, but only if we have a model. If - // we don't have a model, it means that we are using the generator from the - // analyser, in which case we just want to return the original name of the - // variable. - - if (mModel == nullptr) { - return variable->name(); - } - - auto analyserVariable = libcellml::analyserVariable(mModel, variable); - - if (analyserVariable->type() == AnalyserVariable::Type::VARIABLE_OF_INTEGRATION) { - return mProfile->voiString(); - } - - std::string arrayName; - - if (analyserVariable->type() == AnalyserVariable::Type::STATE) { - arrayName = state ? - mProfile->statesArrayString() : - mProfile->ratesArrayString(); - } else if (analyserVariable->type() == AnalyserVariable::Type::CONSTANT) { - arrayName = mProfile->constantsArrayString(); - } else if (analyserVariable->type() == AnalyserVariable::Type::COMPUTED_CONSTANT) { - arrayName = mProfile->computedConstantsArrayString(); - } else if (analyserVariable->type() == AnalyserVariable::Type::ALGEBRAIC) { - arrayName = mProfile->algebraicArrayString(); - } else { - arrayName = mProfile->externalArrayString(); - } - - return arrayName + mProfile->openArrayString() + convertToString(analyserVariable->index()) + mProfile->closeArrayString(); -} - -std::string Generator::GeneratorImpl::generateOperatorCode(const std::string &op, - const AnalyserEquationAstPtr &ast) const -{ - // Generate the code for the left and right branches of the given AST. - - std::string res; - auto astLeftChild = ast->leftChild(); - auto astRightChild = ast->rightChild(); - auto astLeftChildCode = generateCode(astLeftChild); - auto astRightChildCode = generateCode(astRightChild); - - // Determine whether parentheses should be added around the left and/or - // right piece of code, and this based on the precedence of the operators - // used in CellML, which are listed below from higher to lower precedence: - // 1. Parentheses [Left to right] - // 2. POWER (as an operator, not as a function, i.e. [Left to right] - // as in Matlab and not in C, for example) - // 3. Unary PLUS, Unary MINUS, NOT [Right to left] - // 4. TIMES, DIVIDE [Left to right] - // 5. PLUS, MINUS [Left to right] - // 6. LT, LEQ, GT, GEQ [Left to right] - // 7. EQ, NEQ [Left to right] - // 8. XOR (bitwise) [Left to right] - // 9. AND (logical) [Left to right] - // 10. OR (logical) [Left to right] - // 11. PIECEWISE (as an operator) [Right to left] - - if (isPlusOperator(ast)) { - if (isRelationalOperator(astLeftChild) - || isLogicalOperator(astLeftChild) - || isPiecewiseStatement(astLeftChild)) { - astLeftChildCode = "(" + astLeftChildCode + ")"; - } - - if (isRelationalOperator(astRightChild) - || isLogicalOperator(astRightChild) - || isPiecewiseStatement(astRightChild)) { - astRightChildCode = "(" + astRightChildCode + ")"; - } - } else if (isMinusOperator(ast)) { - if (isRelationalOperator(astLeftChild) - || isLogicalOperator(astLeftChild) - || isPiecewiseStatement(astLeftChild)) { - astLeftChildCode = "(" + astLeftChildCode + ")"; - } - - if (isNegativeNumber(astRightChild) - || isRelationalOperator(astRightChild) - || isLogicalOperator(astRightChild) - || isMinusOperator(astRightChild) - || isPiecewiseStatement(astRightChild) - || (astRightChildCode.rfind(mProfile->minusString(), 0) == 0)) { - astRightChildCode = "(" + astRightChildCode + ")"; - } else if (isPlusOperator(astRightChild)) { - if (astRightChild->rightChild() != nullptr) { - astRightChildCode = "(" + astRightChildCode + ")"; - } - } - } else if (isTimesOperator(ast)) { - if (isRelationalOperator(astLeftChild) - || isLogicalOperator(astLeftChild) - || isPiecewiseStatement(astLeftChild)) { - astLeftChildCode = "(" + astLeftChildCode + ")"; - } else if (isPlusOperator(astLeftChild) - || isMinusOperator(astLeftChild)) { - if (astLeftChild->rightChild() != nullptr) { - astLeftChildCode = "(" + astLeftChildCode + ")"; - } - } - - if (isRelationalOperator(astRightChild) - || isLogicalOperator(astRightChild) - || isPiecewiseStatement(astRightChild)) { - astRightChildCode = "(" + astRightChildCode + ")"; - } else if (isPlusOperator(astRightChild) - || isMinusOperator(astRightChild)) { - if (astRightChild->rightChild() != nullptr) { - astRightChildCode = "(" + astRightChildCode + ")"; - } - } - } else if (isDivideOperator(ast)) { - if (isRelationalOperator(astLeftChild) - || isLogicalOperator(astLeftChild) - || isPiecewiseStatement(astLeftChild)) { - astLeftChildCode = "(" + astLeftChildCode + ")"; - } else if (isPlusOperator(astLeftChild) - || isMinusOperator(astLeftChild)) { - if (astLeftChild->rightChild() != nullptr) { - astLeftChildCode = "(" + astLeftChildCode + ")"; - } - } - - if (isRelationalOperator(astRightChild) - || isLogicalOperator(astRightChild) - || isTimesOperator(astRightChild) - || isDivideOperator(astRightChild) - || isPiecewiseStatement(astRightChild)) { - astRightChildCode = "(" + astRightChildCode + ")"; - } else if (isPlusOperator(astRightChild) - || isMinusOperator(astRightChild)) { - if (astRightChild->rightChild() != nullptr) { - astRightChildCode = "(" + astRightChildCode + ")"; - } - } - } else if (isAndOperator(ast)) { - // Note: according to the precedence rules above, we only need to - // add parentheses around OR and PIECEWISE. However, it looks - // better/clearer to have some around some other operators - // (agreed, this is somewhat subjective). - - if (isRelationalOperator(astLeftChild) - || isOrOperator(astLeftChild) - || isXorOperator(astLeftChild) - || isPiecewiseStatement(astLeftChild)) { - astLeftChildCode = "(" + astLeftChildCode + ")"; - } else if (isPlusOperator(astLeftChild) - || isMinusOperator(astLeftChild)) { - if (astLeftChild->rightChild() != nullptr) { - astLeftChildCode = "(" + astLeftChildCode + ")"; - } - } else if (isPowerOperator(astLeftChild)) { - astLeftChildCode = "(" + astLeftChildCode + ")"; - } else if (isRootOperator(astLeftChild)) { - astLeftChildCode = "(" + astLeftChildCode + ")"; - } - - if (isRelationalOperator(astRightChild) - || isOrOperator(astRightChild) - || isXorOperator(astRightChild) - || isPiecewiseStatement(astRightChild)) { - astRightChildCode = "(" + astRightChildCode + ")"; - } else if (isPlusOperator(astRightChild) - || isMinusOperator(astRightChild)) { - if (astRightChild->rightChild() != nullptr) { - astRightChildCode = "(" + astRightChildCode + ")"; - } - } else if (isPowerOperator(astRightChild)) { - astRightChildCode = "(" + astRightChildCode + ")"; - } else if (isRootOperator(astRightChild)) { - astRightChildCode = "(" + astRightChildCode + ")"; - } - } else if (isOrOperator(ast)) { - // Note: according to the precedence rules above, we only need to - // add parentheses around PIECEWISE. However, it looks - // better/clearer to have some around some other operators - // (agreed, this is somewhat subjective). - - if (isRelationalOperator(astLeftChild) - || isAndOperator(astLeftChild) - || isXorOperator(astLeftChild) - || isPiecewiseStatement(astLeftChild)) { - astLeftChildCode = "(" + astLeftChildCode + ")"; - } else if (isPlusOperator(astLeftChild) - || isMinusOperator(astLeftChild)) { - if (astLeftChild->rightChild() != nullptr) { - astLeftChildCode = "(" + astLeftChildCode + ")"; - } - } else if (isPowerOperator(astLeftChild)) { - astLeftChildCode = "(" + astLeftChildCode + ")"; - } else if (isRootOperator(astLeftChild)) { - astLeftChildCode = "(" + astLeftChildCode + ")"; - } - - if (isRelationalOperator(astRightChild) - || isAndOperator(astRightChild) - || isXorOperator(astRightChild) - || isPiecewiseStatement(astRightChild)) { - astRightChildCode = "(" + astRightChildCode + ")"; - } else if (isPlusOperator(astRightChild) - || isMinusOperator(astRightChild)) { - if (astRightChild->rightChild() != nullptr) { - astRightChildCode = "(" + astRightChildCode + ")"; - } - } else if (isPowerOperator(astRightChild)) { - astRightChildCode = "(" + astRightChildCode + ")"; - } else if (isRootOperator(astRightChild)) { - astRightChildCode = "(" + astRightChildCode + ")"; - } - } else if (isXorOperator(ast)) { - // Note: according to the precedence rules above, we only need to - // add parentheses around AND, OR and PIECEWISE. However, it - // looks better/clearer to have some around some other - // operators (agreed, this is somewhat subjective). - - if (isRelationalOperator(astLeftChild) - || isAndOperator(astLeftChild) - || isOrOperator(astLeftChild) - || isPiecewiseStatement(astLeftChild)) { - astLeftChildCode = "(" + astLeftChildCode + ")"; - } else if (isPlusOperator(astLeftChild) - || isMinusOperator(astLeftChild)) { - if (astLeftChild->rightChild() != nullptr) { - astLeftChildCode = "(" + astLeftChildCode + ")"; - } - } else if (isPowerOperator(astLeftChild)) { - astLeftChildCode = "(" + astLeftChildCode + ")"; - } else if (isRootOperator(astLeftChild)) { - astLeftChildCode = "(" + astLeftChildCode + ")"; - } - - if (isRelationalOperator(astRightChild) - || isAndOperator(astRightChild) - || isOrOperator(astRightChild) - || isPiecewiseStatement(astRightChild)) { - astRightChildCode = "(" + astRightChildCode + ")"; - } else if (isPlusOperator(astRightChild) - || isMinusOperator(astRightChild)) { - if (astRightChild->rightChild() != nullptr) { - astRightChildCode = "(" + astRightChildCode + ")"; - } - } else if (isPowerOperator(astRightChild)) { - astRightChildCode = "(" + astRightChildCode + ")"; - } else if (isRootOperator(astRightChild)) { - astRightChildCode = "(" + astRightChildCode + ")"; - } - } else if (isPowerOperator(ast)) { - if (isRelationalOperator(astLeftChild) - || isLogicalOperator(astLeftChild) - || isMinusOperator(astLeftChild) - || isTimesOperator(astLeftChild) - || isDivideOperator(astLeftChild) - || isPiecewiseStatement(astLeftChild)) { - astLeftChildCode = "(" + astLeftChildCode + ")"; - } else if (isPlusOperator(astLeftChild)) { - if (astLeftChild->rightChild() != nullptr) { - astLeftChildCode = "(" + astLeftChildCode + ")"; - } - } - - if (isRelationalOperator(astRightChild) - || isLogicalOperator(astRightChild) - || isMinusOperator(astLeftChild) - || isTimesOperator(astRightChild) - || isDivideOperator(astRightChild) - || isPowerOperator(astRightChild) - || isRootOperator(astRightChild) - || isPiecewiseStatement(astRightChild)) { - astRightChildCode = "(" + astRightChildCode + ")"; - } else if (isPlusOperator(astRightChild)) { - if (astRightChild->rightChild() != nullptr) { - astRightChildCode = "(" + astRightChildCode + ")"; - } - } - } else if (isRootOperator(ast)) { - if (isRelationalOperator(astRightChild) - || isLogicalOperator(astRightChild) - || isMinusOperator(astRightChild) - || isTimesOperator(astRightChild) - || isDivideOperator(astRightChild) - || isPiecewiseStatement(astRightChild)) { - astRightChildCode = "(" + astRightChildCode + ")"; - } else if (isPlusOperator(astRightChild)) { - if (astRightChild->rightChild() != nullptr) { - astRightChildCode = "(" + astRightChildCode + ")"; - } - } - - auto astLeftChildLeftChild = astLeftChild->leftChild(); - - if (isRelationalOperator(astLeftChildLeftChild) - || isLogicalOperator(astLeftChildLeftChild) - || isMinusOperator(astLeftChildLeftChild) - || isTimesOperator(astLeftChildLeftChild) - || isDivideOperator(astLeftChildLeftChild) - || isPowerOperator(astLeftChildLeftChild) - || isRootOperator(astLeftChildLeftChild) - || isPiecewiseStatement(astLeftChildLeftChild)) { - astLeftChildCode = "(" + astLeftChildCode + ")"; - } else if (isPlusOperator(astLeftChildLeftChild)) { - if (astLeftChildLeftChild->rightChild() != nullptr) { - astLeftChildCode = "(" + astLeftChildCode + ")"; - } - } - - return astRightChildCode + op + "(1.0/" + astLeftChildCode + ")"; - } - - return astLeftChildCode + op + astRightChildCode; -} - -std::string Generator::GeneratorImpl::generateMinusUnaryCode(const AnalyserEquationAstPtr &ast) const -{ - // Generate the code for the left branch of the given AST. - - auto astLeftChild = ast->leftChild(); - auto code = generateCode(astLeftChild); - - // Determine whether parentheses should be added around the left code. - - if (isRelationalOperator(astLeftChild) - || isLogicalOperator(astLeftChild) - || isPlusOperator(astLeftChild) - || isMinusOperator(astLeftChild) - || isPiecewiseStatement(astLeftChild)) { - code = "(" + code + ")"; - } - - return mProfile->minusString() + code; -} - -std::string Generator::GeneratorImpl::generateOneParameterFunctionCode(const std::string &function, - const AnalyserEquationAstPtr &ast) const -{ - return function + "(" + generateCode(ast->leftChild()) + ")"; -} - -std::string Generator::GeneratorImpl::generateTwoParameterFunctionCode(const std::string &function, - const AnalyserEquationAstPtr &ast) const -{ - return function + "(" + generateCode(ast->leftChild()) + ", " + generateCode(ast->rightChild()) + ")"; -} - -std::string Generator::GeneratorImpl::generatePiecewiseIfCode(const std::string &condition, - const std::string &value) const -{ - return replace(replace(mProfile->hasConditionalOperator() ? - mProfile->conditionalOperatorIfString() : - mProfile->piecewiseIfString(), - "[CONDITION]", condition), - "[IF_STATEMENT]", value); -} - -std::string Generator::GeneratorImpl::generatePiecewiseElseCode(const std::string &value) const -{ - return replace(mProfile->hasConditionalOperator() ? - mProfile->conditionalOperatorElseString() : - mProfile->piecewiseElseString(), - "[ELSE_STATEMENT]", value); -} - -std::string Generator::GeneratorImpl::generateCode(const AnalyserEquationAstPtr &ast) const -{ - // Generate the code for the given AST. - // Note: AnalyserEquationAst::Type::BVAR is only relevant when there is no - // model (in which case we want to generate something like dx/dt, as - // is in the case of the analyser when we want to mention an equation) - // since otherwise we don't need to generate any code for it (since we - // will, instead, want to generate something like rates[0]). - - std::string code; - - switch (ast->type()) { - case AnalyserEquationAst::Type::EQUALITY: - code = generateOperatorCode(mProfile->equalityString(), ast); - - break; - case AnalyserEquationAst::Type::EQ: - if (mProfile->hasEqOperator()) { - code = generateOperatorCode(mProfile->eqString(), ast); - } else { - code = generateTwoParameterFunctionCode(mProfile->eqString(), ast); - } - - break; - case AnalyserEquationAst::Type::NEQ: - if (mProfile->hasNeqOperator()) { - code = generateOperatorCode(mProfile->neqString(), ast); - } else { - code = generateTwoParameterFunctionCode(mProfile->neqString(), ast); - } - - break; - case AnalyserEquationAst::Type::LT: - if (mProfile->hasLtOperator()) { - code = generateOperatorCode(mProfile->ltString(), ast); - } else { - code = generateTwoParameterFunctionCode(mProfile->ltString(), ast); - } - - break; - case AnalyserEquationAst::Type::LEQ: - if (mProfile->hasLeqOperator()) { - code = generateOperatorCode(mProfile->leqString(), ast); - } else { - code = generateTwoParameterFunctionCode(mProfile->leqString(), ast); - } - - break; - case AnalyserEquationAst::Type::GT: - if (mProfile->hasGtOperator()) { - code = generateOperatorCode(mProfile->gtString(), ast); - } else { - code = generateTwoParameterFunctionCode(mProfile->gtString(), ast); - } - - break; - case AnalyserEquationAst::Type::GEQ: - if (mProfile->hasGeqOperator()) { - code = generateOperatorCode(mProfile->geqString(), ast); - } else { - code = generateTwoParameterFunctionCode(mProfile->geqString(), ast); - } - - break; - case AnalyserEquationAst::Type::AND: - if (mProfile->hasAndOperator()) { - code = generateOperatorCode(mProfile->andString(), ast); - } else { - code = generateTwoParameterFunctionCode(mProfile->andString(), ast); - } - - break; - case AnalyserEquationAst::Type::OR: - if (mProfile->hasOrOperator()) { - code = generateOperatorCode(mProfile->orString(), ast); - } else { - code = generateTwoParameterFunctionCode(mProfile->orString(), ast); - } - - break; - case AnalyserEquationAst::Type::XOR: - if (mProfile->hasXorOperator()) { - code = generateOperatorCode(mProfile->xorString(), ast); - } else { - code = generateTwoParameterFunctionCode(mProfile->xorString(), ast); - } - - break; - case AnalyserEquationAst::Type::NOT: - if (mProfile->hasNotOperator()) { - code = mProfile->notString() + generateCode(ast->leftChild()); - } else { - code = generateOneParameterFunctionCode(mProfile->notString(), ast); - } - - break; - case AnalyserEquationAst::Type::PLUS: - if (ast->rightChild() != nullptr) { - code = generateOperatorCode(mProfile->plusString(), ast); - } else { - code = generateCode(ast->leftChild()); - } - - break; - case AnalyserEquationAst::Type::MINUS: - if (ast->rightChild() != nullptr) { - code = generateOperatorCode(mProfile->minusString(), ast); - } else { - code = generateMinusUnaryCode(ast); - } - - break; - case AnalyserEquationAst::Type::TIMES: - code = generateOperatorCode(mProfile->timesString(), ast); - - break; - case AnalyserEquationAst::Type::DIVIDE: - code = generateOperatorCode(mProfile->divideString(), ast); - - break; - case AnalyserEquationAst::Type::POWER: { - auto stringValue = generateCode(ast->rightChild()); - double doubleValue; - auto validConversion = convertToDouble(stringValue, doubleValue); - - if (validConversion && areEqual(doubleValue, 0.5)) { - code = generateOneParameterFunctionCode(mProfile->squareRootString(), ast); - } else if (validConversion && areEqual(doubleValue, 2.0) - && !mProfile->squareString().empty()) { - code = generateOneParameterFunctionCode(mProfile->squareString(), ast); - } else { - code = mProfile->hasPowerOperator() ? - generateOperatorCode(mProfile->powerString(), ast) : - mProfile->powerString() + "(" + generateCode(ast->leftChild()) + ", " + stringValue + ")"; - } - } break; - case AnalyserEquationAst::Type::ROOT: { - auto astRightChild = ast->rightChild(); - - if (astRightChild != nullptr) { - auto astLeftChild = ast->leftChild(); - double doubleValue; - - if (convertToDouble(generateCode(astLeftChild), doubleValue) - && areEqual(doubleValue, 2.0)) { - code = mProfile->squareRootString() + "(" + generateCode(astRightChild) + ")"; - } else { - if (mProfile->hasPowerOperator()) { - code = generateOperatorCode(mProfile->powerString(), ast); - } else { - auto rootValueAst = AnalyserEquationAst::create(); - - rootValueAst->setType(AnalyserEquationAst::Type::DIVIDE); - rootValueAst->setParent(ast); - - auto leftChild = AnalyserEquationAst::create(); - - leftChild->setType(AnalyserEquationAst::Type::CN); - leftChild->setValue("1.0"); - leftChild->setParent(rootValueAst); - - rootValueAst->setLeftChild(leftChild); - rootValueAst->setRightChild(astLeftChild->leftChild()); - - code = mProfile->powerString() + "(" + generateCode(astRightChild) + ", " + generateOperatorCode(mProfile->divideString(), rootValueAst) + ")"; - } - } - } else { - code = generateOneParameterFunctionCode(mProfile->squareRootString(), ast); - } - } break; - case AnalyserEquationAst::Type::ABS: - code = generateOneParameterFunctionCode(mProfile->absoluteValueString(), ast); - - break; - case AnalyserEquationAst::Type::EXP: - code = generateOneParameterFunctionCode(mProfile->exponentialString(), ast); - - break; - case AnalyserEquationAst::Type::LN: - code = generateOneParameterFunctionCode(mProfile->naturalLogarithmString(), ast); - - break; - case AnalyserEquationAst::Type::LOG: { - auto astRightChild = ast->rightChild(); - - if (astRightChild != nullptr) { - auto stringValue = generateCode(ast->leftChild()); - double doubleValue; - - if (convertToDouble(stringValue, doubleValue) - && areEqual(doubleValue, 10.0)) { - code = mProfile->commonLogarithmString() + "(" + generateCode(astRightChild) + ")"; - } else { - code = mProfile->naturalLogarithmString() + "(" + generateCode(astRightChild) + ")/" + mProfile->naturalLogarithmString() + "(" + stringValue + ")"; - } - } else { - code = generateOneParameterFunctionCode(mProfile->commonLogarithmString(), ast); - } - } break; - case AnalyserEquationAst::Type::CEILING: - code = generateOneParameterFunctionCode(mProfile->ceilingString(), ast); - - break; - case AnalyserEquationAst::Type::FLOOR: - code = generateOneParameterFunctionCode(mProfile->floorString(), ast); - - break; - case AnalyserEquationAst::Type::MIN: - code = generateTwoParameterFunctionCode(mProfile->minString(), ast); - - break; - case AnalyserEquationAst::Type::MAX: - code = generateTwoParameterFunctionCode(mProfile->maxString(), ast); - - break; - case AnalyserEquationAst::Type::REM: - code = generateTwoParameterFunctionCode(mProfile->remString(), ast); - - break; - case AnalyserEquationAst::Type::DIFF: - if (mModel != nullptr) { - code = generateCode(ast->rightChild()); - } else { - code = "d" + generateCode(ast->rightChild()) + "/d" + generateCode(ast->leftChild()); - } - - break; - case AnalyserEquationAst::Type::SIN: - code = generateOneParameterFunctionCode(mProfile->sinString(), ast); - - break; - case AnalyserEquationAst::Type::COS: - code = generateOneParameterFunctionCode(mProfile->cosString(), ast); - - break; - case AnalyserEquationAst::Type::TAN: - code = generateOneParameterFunctionCode(mProfile->tanString(), ast); - - break; - case AnalyserEquationAst::Type::SEC: - code = generateOneParameterFunctionCode(mProfile->secString(), ast); - - break; - case AnalyserEquationAst::Type::CSC: - code = generateOneParameterFunctionCode(mProfile->cscString(), ast); - - break; - case AnalyserEquationAst::Type::COT: - code = generateOneParameterFunctionCode(mProfile->cotString(), ast); - - break; - case AnalyserEquationAst::Type::SINH: - code = generateOneParameterFunctionCode(mProfile->sinhString(), ast); - - break; - case AnalyserEquationAst::Type::COSH: - code = generateOneParameterFunctionCode(mProfile->coshString(), ast); - - break; - case AnalyserEquationAst::Type::TANH: - code = generateOneParameterFunctionCode(mProfile->tanhString(), ast); - - break; - case AnalyserEquationAst::Type::SECH: - code = generateOneParameterFunctionCode(mProfile->sechString(), ast); - - break; - case AnalyserEquationAst::Type::CSCH: - code = generateOneParameterFunctionCode(mProfile->cschString(), ast); - - break; - case AnalyserEquationAst::Type::COTH: - code = generateOneParameterFunctionCode(mProfile->cothString(), ast); - - break; - case AnalyserEquationAst::Type::ASIN: - code = generateOneParameterFunctionCode(mProfile->asinString(), ast); - - break; - case AnalyserEquationAst::Type::ACOS: - code = generateOneParameterFunctionCode(mProfile->acosString(), ast); - - break; - case AnalyserEquationAst::Type::ATAN: - code = generateOneParameterFunctionCode(mProfile->atanString(), ast); - - break; - case AnalyserEquationAst::Type::ASEC: - code = generateOneParameterFunctionCode(mProfile->asecString(), ast); - - break; - case AnalyserEquationAst::Type::ACSC: - code = generateOneParameterFunctionCode(mProfile->acscString(), ast); - - break; - case AnalyserEquationAst::Type::ACOT: - code = generateOneParameterFunctionCode(mProfile->acotString(), ast); - - break; - case AnalyserEquationAst::Type::ASINH: - code = generateOneParameterFunctionCode(mProfile->asinhString(), ast); - - break; - case AnalyserEquationAst::Type::ACOSH: - code = generateOneParameterFunctionCode(mProfile->acoshString(), ast); - - break; - case AnalyserEquationAst::Type::ATANH: - code = generateOneParameterFunctionCode(mProfile->atanhString(), ast); - - break; - case AnalyserEquationAst::Type::ASECH: - code = generateOneParameterFunctionCode(mProfile->asechString(), ast); - - break; - case AnalyserEquationAst::Type::ACSCH: - code = generateOneParameterFunctionCode(mProfile->acschString(), ast); - - break; - case AnalyserEquationAst::Type::ACOTH: - code = generateOneParameterFunctionCode(mProfile->acothString(), ast); - - break; - case AnalyserEquationAst::Type::PIECEWISE: { - auto astRightChild = ast->rightChild(); - - if (astRightChild != nullptr) { - if (astRightChild->type() == AnalyserEquationAst::Type::PIECE) { - code = generateCode(ast->leftChild()) + generatePiecewiseElseCode(generateCode(astRightChild) + generatePiecewiseElseCode(mProfile->nanString())); - } else { - code = generateCode(ast->leftChild()) + generatePiecewiseElseCode(generateCode(astRightChild)); - } - } else { - code = generateCode(ast->leftChild()) + generatePiecewiseElseCode(mProfile->nanString()); - } - } break; - case AnalyserEquationAst::Type::PIECE: - code = generatePiecewiseIfCode(generateCode(ast->rightChild()), generateCode(ast->leftChild())); - - break; - case AnalyserEquationAst::Type::OTHERWISE: - code = generateCode(ast->leftChild()); - - break; - case AnalyserEquationAst::Type::CI: - code = generateVariableNameCode(ast->variable(), ast->parent()->type() != AnalyserEquationAst::Type::DIFF); - - break; - case AnalyserEquationAst::Type::CN: - code = generateDoubleCode(ast->value()); - - break; - case AnalyserEquationAst::Type::DEGREE: - case AnalyserEquationAst::Type::LOGBASE: - code = generateCode(ast->leftChild()); - - break; - case AnalyserEquationAst::Type::BVAR: - code = generateCode(ast->leftChild()); - - break; - case AnalyserEquationAst::Type::TRUE: - code = mProfile->trueString(); - - break; - case AnalyserEquationAst::Type::FALSE: - code = mProfile->falseString(); - - break; - case AnalyserEquationAst::Type::E: - code = mProfile->eString(); - - break; - case AnalyserEquationAst::Type::PI: - code = mProfile->piString(); - - break; - case AnalyserEquationAst::Type::INF: - code = mProfile->infString(); - - break; - default: // AnalyserEquationAst::Type::NAN. - code = mProfile->nanString(); - - break; - } - - return code; -} - -bool Generator::GeneratorImpl::isToBeComputedAgain(const AnalyserEquationPtr &equation) const -{ - // NLA and algebraic equations that are state/rate-based and external - // equations are to be computed again (in the computeVariables() method). - - switch (equation->type()) { - case AnalyserEquation::Type::NLA: - case AnalyserEquation::Type::ALGEBRAIC: - return equation->isStateRateBased(); - case AnalyserEquation::Type::EXTERNAL: - return true; - default: - return false; - } -} - -bool Generator::GeneratorImpl::isSomeConstant(const AnalyserEquationPtr &equation, - bool includeComputedConstants) const -{ - auto type = equation->type(); - - return (type == AnalyserEquation::Type::TRUE_CONSTANT) - || (!includeComputedConstants && (type == AnalyserEquation::Type::VARIABLE_BASED_CONSTANT)); -} - -std::string Generator::GeneratorImpl::generateZeroInitialisationCode(const AnalyserVariablePtr &variable) const -{ - return mProfile->indentString() - + generateVariableNameCode(variable->variable(), false) - + mProfile->equalityString() - + "0.0" - + mProfile->commandSeparatorString() + "\n"; -} - -std::string Generator::GeneratorImpl::generateInitialisationCode(const AnalyserVariablePtr &variable) const -{ - auto initialisingVariable = variable->initialisingVariable(); - auto scalingFactor = Generator::GeneratorImpl::scalingFactor(initialisingVariable); - std::string scalingFactorCode; - - if (!areNearlyEqual(scalingFactor, 1.0)) { - scalingFactorCode = generateDoubleCode(convertToString(scalingFactor)) + mProfile->timesString(); - } - - return mProfile->indentString() - + generateVariableNameCode(variable->variable()) - + mProfile->equalityString() - + scalingFactorCode + generateDoubleOrConstantVariableNameCode(initialisingVariable) - + mProfile->commandSeparatorString() + "\n"; -} - -std::string Generator::GeneratorImpl::generateEquationCode(const AnalyserEquationPtr &equation, - std::vector &remainingEquations, - std::vector &equationsForDependencies, - bool includeComputedConstants) -{ - std::string res; - - if (std::find(remainingEquations.begin(), remainingEquations.end(), equation) != remainingEquations.end()) { - // Stop tracking the equation and its NLA siblings, if any. - // Note: we need to do this as soon as possible to avoid recursive - // calls, something that would happen if we were to do this at the - // end of this if statement. - - remainingEquations.erase(std::find(remainingEquations.begin(), remainingEquations.end(), equation)); - - for (const auto &nlaSibling : equation->nlaSiblings()) { - remainingEquations.erase(std::find(remainingEquations.begin(), remainingEquations.end(), nlaSibling)); - } - - // Generate any dependency that this equation may have. - - if (!isSomeConstant(equation, includeComputedConstants)) { - for (const auto &dependency : equation->dependencies()) { - if ((dependency->type() != AnalyserEquation::Type::ODE) - && !isSomeConstant(dependency, includeComputedConstants) - && (equationsForDependencies.empty() - || isToBeComputedAgain(dependency) - || (std::find(equationsForDependencies.begin(), equationsForDependencies.end(), dependency) != equationsForDependencies.end()))) { - res += generateEquationCode(dependency, remainingEquations, equationsForDependencies, includeComputedConstants); - } - } - } - - // Generate the equation code itself, based on the equation type. - - switch (equation->type()) { - case AnalyserEquation::Type::EXTERNAL: - for (const auto &variable : variables(equation)) { - res += mProfile->indentString() - + generateVariableNameCode(variable->variable()) - + mProfile->equalityString() - + replace(mProfile->externalVariableMethodCallString(modelHasOdes()), - "[INDEX]", convertToString(variable->index())) - + mProfile->commandSeparatorString() + "\n"; - } - - break; - case AnalyserEquation::Type::NLA: - if (!mProfile->findRootCallString(modelHasOdes(), mModel->hasExternalVariables()).empty()) { - res += mProfile->indentString() - + replace(mProfile->findRootCallString(modelHasOdes(), mModel->hasExternalVariables()), - "[INDEX]", convertToString(equation->nlaSystemIndex())); - } - - break; - default: - res += mProfile->indentString() + generateCode(equation->ast()) + mProfile->commandSeparatorString() + "\n"; - - break; - } - } - - return res; -} - -std::string Generator::GeneratorImpl::generateEquationCode(const AnalyserEquationPtr &equation, - std::vector &remainingEquations) -{ - std::vector dummyEquationsForComputeVariables; - - return generateEquationCode(equation, remainingEquations, dummyEquationsForComputeVariables, true); -} - void Generator::GeneratorImpl::addInterfaceComputeModelMethodsCode() { - auto interfaceInitialiseVariablesMethodString = mProfile->interfaceInitialiseVariablesMethodString(modelHasOdes()); + auto interfaceInitialiseVariablesMethodString = mProfile->interfaceInitialiseVariablesMethodString(mModelHasOdes); std::string code; if (!interfaceInitialiseVariablesMethodString.empty()) { @@ -1791,12 +582,12 @@ void Generator::GeneratorImpl::addInterfaceComputeModelMethodsCode() auto interfaceComputeRatesMethodString = mProfile->interfaceComputeRatesMethodString(mModel->hasExternalVariables()); - if (modelHasOdes() + if (mModelHasOdes && !interfaceComputeRatesMethodString.empty()) { code += interfaceComputeRatesMethodString; } - auto interfaceComputeVariablesMethodString = mProfile->interfaceComputeVariablesMethodString(modelHasOdes(), + auto interfaceComputeVariablesMethodString = mProfile->interfaceComputeVariablesMethodString(mModelHasOdes, mModel->hasExternalVariables()); if (!interfaceComputeVariablesMethodString.empty()) { @@ -1804,179 +595,16 @@ void Generator::GeneratorImpl::addInterfaceComputeModelMethodsCode() } if (!code.empty()) { - mCode += newLineIfNeeded() + mCode += newLineIfNeeded(mCode) + code; } } -std::string Generator::GeneratorImpl::generateConstantInitialisationCode(const std::vector::iterator constant, - std::vector &remainingConstants) -{ - auto initialisingVariable = (*constant)->initialisingVariable(); - auto initialValue = initialisingVariable->initialValue(); - - if (!isCellMLReal(initialValue)) { - auto initialisingComponent = owningComponent(initialisingVariable); - auto crtConstant = std::find_if(remainingConstants.begin(), remainingConstants.end(), - [=](const AnalyserVariablePtr &av) -> bool { - return initialisingComponent->variable(initialValue) == av->variable(); - }); - - if (crtConstant != remainingConstants.end()) { - return generateConstantInitialisationCode(crtConstant, remainingConstants); - } - } - - auto code = generateInitialisationCode(*constant); - - remainingConstants.erase(constant); - - return code; -} - -void Generator::GeneratorImpl::addImplementationInitialiseVariablesMethodCode(std::vector &remainingEquations) -{ - auto implementationInitialiseVariablesMethodString = mProfile->implementationInitialiseVariablesMethodString(modelHasOdes()); - - if (!implementationInitialiseVariablesMethodString.empty()) { - // Initialise our states (after, if needed, initialising the constant on which it depends). - - std::string methodBody; - auto constants = mModel->constants(); - - for (const auto &state : mModel->states()) { - auto initialisingVariable = state->initialisingVariable(); - auto initialValue = initialisingVariable->initialValue(); - - if (!isCellMLReal(initialValue)) { - // The initial value references a constant. - - auto initialisingComponent = owningComponent(initialisingVariable); - auto constant = std::find_if(constants.begin(), constants.end(), - [=](const AnalyserVariablePtr &av) -> bool { - return initialisingComponent->variable(initialValue)->hasEquivalentVariable(av->variable()); - }); - - methodBody += generateConstantInitialisationCode(constant, constants); - } - - methodBody += generateInitialisationCode(state); - } - - // Use an initial guess of zero for rates computed using an NLA system - // (see the note below). - - for (const auto &state : mModel->states()) { - if (state->equation(0)->type() == AnalyserEquation::Type::NLA) { - methodBody += generateZeroInitialisationCode(state); - } - } - - // Initialise our (remaining) constants. - - while (!constants.empty()) { - methodBody += generateConstantInitialisationCode(constants.begin(), constants); - } - - // Initialise our computed constants that are initialised using an equation (e.g., x = 3 rather than x with an - // initial value of 3). - - auto equations = mModel->equations(); - - for (const auto &equation : equations) { - if (equation->type() == AnalyserEquation::Type::TRUE_CONSTANT) { - methodBody += generateEquationCode(equation, remainingEquations); - } - } - - // Initialise our algebraic variables that have an initial value. Also use an initial guess of zero for - // algebraic variables computed using an NLA system. - // Note: a variable which is the only unknown in an equation, but which is not on its own on either the LHS or - // RHS of that equation (e.g., x = y+z with x and y known and z unknown) is (currently) to be computed - // using an NLA system for which we need an initial guess. We use an initial guess of zero, which is fine - // since such an NLA system has only one solution. - - for (const auto &algebraic : mModel->algebraic()) { - if (algebraic->initialisingVariable() != nullptr) { - methodBody += generateInitialisationCode(algebraic); - } else if (algebraic->equation(0)->type() == AnalyserEquation::Type::NLA) { - methodBody += generateZeroInitialisationCode(algebraic); - } - } - - mCode += newLineIfNeeded() - + replace(implementationInitialiseVariablesMethodString, - "[CODE]", generateMethodBodyCode(methodBody)); - } -} - -void Generator::GeneratorImpl::addImplementationComputeComputedConstantsMethodCode(std::vector &remainingEquations) +void Generator::GeneratorImpl::addImplementationComputeModelMethodsCode() { - if (!mProfile->implementationComputeComputedConstantsMethodString().empty()) { - std::string methodBody; - - for (const auto &equation : mModel->equations()) { - if (equation->type() == AnalyserEquation::Type::VARIABLE_BASED_CONSTANT) { - methodBody += generateEquationCode(equation, remainingEquations); - } - } + auto generatorInterpreter = GeneratorInterpreter::create(mModel, mProfile, mCode); - mCode += newLineIfNeeded() - + replace(mProfile->implementationComputeComputedConstantsMethodString(), - "[CODE]", generateMethodBodyCode(methodBody)); - } -} - -void Generator::GeneratorImpl::addImplementationComputeRatesMethodCode(std::vector &remainingEquations) -{ - auto implementationComputeRatesMethodString = mProfile->implementationComputeRatesMethodString(mModel->hasExternalVariables()); - - if (modelHasOdes() - && !implementationComputeRatesMethodString.empty()) { - std::string methodBody; - - for (const auto &equation : mModel->equations()) { - // A rate is computed either through an ODE equation or through an - // NLA equation in case the rate is not on its own on either the LHS - // or RHS of the equation. - - auto variables = libcellml::variables(equation); - - if ((equation->type() == AnalyserEquation::Type::ODE) - || ((equation->type() == AnalyserEquation::Type::NLA) - && (variables.size() == 1) - && (variables[0]->type() == AnalyserVariable::Type::STATE))) { - methodBody += generateEquationCode(equation, remainingEquations); - } - } - - mCode += newLineIfNeeded() - + replace(implementationComputeRatesMethodString, - "[CODE]", generateMethodBodyCode(methodBody)); - } -} - -void Generator::GeneratorImpl::addImplementationComputeVariablesMethodCode(std::vector &remainingEquations) -{ - auto implementationComputeVariablesMethodString = mProfile->implementationComputeVariablesMethodString(modelHasOdes(), - mModel->hasExternalVariables()); - - if (!implementationComputeVariablesMethodString.empty()) { - std::string methodBody; - auto equations = mModel->equations(); - std::vector newRemainingEquations {std::begin(equations), std::end(equations)}; - - for (const auto &equation : equations) { - if ((std::find(remainingEquations.begin(), remainingEquations.end(), equation) != remainingEquations.end()) - || isToBeComputedAgain(equation)) { - methodBody += generateEquationCode(equation, newRemainingEquations, remainingEquations, false); - } - } - - mCode += newLineIfNeeded() - + replace(implementationComputeVariablesMethodString, - "[CODE]", generateMethodBodyCode(methodBody)); - } + mCode = generatorInterpreter->code(); } Generator::Generator() @@ -2012,6 +640,8 @@ AnalyserModelPtr Generator::model() void Generator::setModel(const AnalyserModelPtr &model) { mPimpl->mModel = model; + mPimpl->mModelHasOdes = modelHasOdes(model); + mPimpl->mModelHasNlas = modelHasNlas(model); } std::string Generator::interfaceCode() const @@ -2120,46 +750,19 @@ std::string Generator::implementationCode() const mPimpl->addRootFindingInfoObjectCode(); mPimpl->addExternNlaSolveMethodCode(); - mPimpl->addNlaSystemsCode(); - - // Add code for the implementation to initialise our variables. - - auto equations = mPimpl->mModel->equations(); - std::vector remainingEquations {std::begin(equations), std::end(equations)}; - - mPimpl->addImplementationInitialiseVariablesMethodCode(remainingEquations); - // Add code for the implementation to compute our computed constants. + // Add code for the implementation to compute the model. - mPimpl->addImplementationComputeComputedConstantsMethodCode(remainingEquations); - - // Add code for the implementation to compute our rates (and any variables - // on which they depend). - - mPimpl->addImplementationComputeRatesMethodCode(remainingEquations); - - // Add code for the implementation to compute our variables. - // Note: this method computes the remaining variables, i.e. the ones not - // needed to compute our rates, but also the variables that depend on - // the value of some states/rates and all the external variables. - // This method is typically called after having integrated a model, - // thus ensuring that variables that rely on the value of some - // states/rates are up to date. - - mPimpl->addImplementationComputeVariablesMethodCode(remainingEquations); + mPimpl->addImplementationComputeModelMethodsCode(); return mPimpl->mCode; } std::string Generator::equationCode(const AnalyserEquationAstPtr &ast, const GeneratorProfilePtr &profile) { - GeneratorPtr generator = libcellml::Generator::create(); - - if (profile != nullptr) { - generator->setProfile(profile); - } + auto generatorInterpreter = GeneratorInterpreter::create(ast, profile); - return generator->mPimpl->generateCode(ast); + return generatorInterpreter->code(); } std::string Generator::equationCode(const AnalyserEquationAstPtr &ast) diff --git a/src/generator_p.h b/src/generator_p.h index fce8d2e7d7..86dc616728 100644 --- a/src/generator_p.h +++ b/src/generator_p.h @@ -24,10 +24,6 @@ limitations under the License. namespace libcellml { -std::string generateDoubleCode(const std::string &value); - -AnalyserVariablePtr analyserVariable(const AnalyserModelPtr &model, const VariablePtr &variable); - /** * @brief The Generator::GeneratorImpl struct. * @@ -36,41 +32,20 @@ AnalyserVariablePtr analyserVariable(const AnalyserModelPtr &model, const Variab struct Generator::GeneratorImpl { AnalyserModelPtr mModel; - - std::string mCode; + bool mModelHasOdes = false; + bool mModelHasNlas = false; GeneratorProfilePtr mProfile = GeneratorProfile::create(); + std::string mCode; void reset(); - bool modelHasOdes() const; - bool modelHasNlas() const; - - double scalingFactor(const VariablePtr &variable) const; - - bool isNegativeNumber(const AnalyserEquationAstPtr &ast) const; - - bool isRelationalOperator(const AnalyserEquationAstPtr &ast) const; - bool isAndOperator(const AnalyserEquationAstPtr &ast) const; - bool isOrOperator(const AnalyserEquationAstPtr &ast) const; - bool isXorOperator(const AnalyserEquationAstPtr &ast) const; - bool isLogicalOperator(const AnalyserEquationAstPtr &ast) const; - bool isPlusOperator(const AnalyserEquationAstPtr &ast) const; - bool isMinusOperator(const AnalyserEquationAstPtr &ast) const; - bool isTimesOperator(const AnalyserEquationAstPtr &ast) const; - bool isDivideOperator(const AnalyserEquationAstPtr &ast) const; - bool isPowerOperator(const AnalyserEquationAstPtr &ast) const; - bool isRootOperator(const AnalyserEquationAstPtr &ast) const; - bool isPiecewiseStatement(const AnalyserEquationAstPtr &ast) const; - void updateVariableInfoSizes(size_t &componentSize, size_t &nameSize, size_t &unitsSize, const AnalyserVariablePtr &variable) const; bool modifiedProfile() const; - std::string newLineIfNeeded(); - void addOriginCommentCode(); void addInterfaceHeaderCode(); @@ -104,46 +79,9 @@ struct Generator::GeneratorImpl void addRootFindingInfoObjectCode(); void addExternNlaSolveMethodCode(); - void addNlaSystemsCode(); - - std::string generateMethodBodyCode(const std::string &methodBody) const; - - std::string generateDoubleOrConstantVariableNameCode(const VariablePtr &variable) const; - std::string generateVariableNameCode(const VariablePtr &variable, - bool state = true) const; - - std::string generateOperatorCode(const std::string &op, - const AnalyserEquationAstPtr &ast) const; - std::string generateMinusUnaryCode(const AnalyserEquationAstPtr &ast) const; - std::string generateOneParameterFunctionCode(const std::string &function, - const AnalyserEquationAstPtr &ast) const; - std::string generateTwoParameterFunctionCode(const std::string &function, - const AnalyserEquationAstPtr &ast) const; - std::string generatePiecewiseIfCode(const std::string &condition, - const std::string &value) const; - std::string generatePiecewiseElseCode(const std::string &value) const; - std::string generateCode(const AnalyserEquationAstPtr &ast) const; - - bool isToBeComputedAgain(const AnalyserEquationPtr &equation) const; - bool isSomeConstant(const AnalyserEquationPtr &equation, - bool includeComputedConstants) const; - - std::string generateZeroInitialisationCode(const AnalyserVariablePtr &variable) const; - std::string generateInitialisationCode(const AnalyserVariablePtr &variable) const; - std::string generateEquationCode(const AnalyserEquationPtr &equation, - std::vector &remainingEquations, - std::vector &equationsForDependencies, - bool includeComputedConstants); - std::string generateEquationCode(const AnalyserEquationPtr &equation, - std::vector &remainingEquations); void addInterfaceComputeModelMethodsCode(); - std::string generateConstantInitialisationCode(const std::vector::iterator constant, - std::vector &remainingConstants); - void addImplementationInitialiseVariablesMethodCode(std::vector &remainingEquations); - void addImplementationComputeComputedConstantsMethodCode(std::vector &remainingEquations); - void addImplementationComputeRatesMethodCode(std::vector &remainingEquations); - void addImplementationComputeVariablesMethodCode(std::vector &remainingEquations); + void addImplementationComputeModelMethodsCode(); }; } // namespace libcellml diff --git a/src/generatorinterpreter.cpp b/src/generatorinterpreter.cpp new file mode 100644 index 0000000000..5826d8b556 --- /dev/null +++ b/src/generatorinterpreter.cpp @@ -0,0 +1,1512 @@ +/* +Copyright libCellML Contributors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +#include "generatorinterpreter_p.h" + +#include "libcellml/analyserequationast.h" +#include "libcellml/analysermodel.h" +#include "libcellml/analyservariable.h" + +#include "utilities.h" + +namespace libcellml { + +GeneratorInterpreter::GeneratorInterpreterImpl::GeneratorInterpreterImpl(const AnalyserModelPtr &model, + const GeneratorProfilePtr &profile, + const std::string &code) +{ + initialise(model, profile, code); +} + +GeneratorInterpreter::GeneratorInterpreterImpl::GeneratorInterpreterImpl(const AnalyserEquationAstPtr &ast, + const GeneratorProfilePtr &profile) +{ + if (profile != nullptr) { + mProfile = profile; + } + + mCode = generateCode(ast); +} + +void GeneratorInterpreter::GeneratorInterpreterImpl::initialise(const AnalyserModelPtr &model, + const GeneratorProfilePtr &profile, + const std::string &code) +{ + mModel = model; + mModelHasOdes = modelHasOdes(model); + mModelHasNlas = modelHasNlas(model); + mProfile = profile; + mCode = code; + + // Add code for solving the NLA systems. + + addNlaSystemsCode(); + + // Add code for the implementation to initialise our variables. + + auto equations = mModel->equations(); + std::vector remainingEquations {std::begin(equations), std::end(equations)}; + + initialiseVariables(remainingEquations); + + // Add code for the implementation to compute our computed constants. + + computeComputedConstants(remainingEquations); + + // Add code for the implementation to compute our rates (and any variables on which they depend). + + computeRates(remainingEquations); + + // Add code for the implementation to compute our variables. + // Note: this method computes the remaining variables, i.e. the ones not needed to compute our rates, but also the + // variables that depend on the value of some states/rates and all the external variables. This method is + // typically called after having integrated a model, thus ensuring that variables that rely on the value of + // some states/rates are up to date. + + computeVariables(remainingEquations); +} + +bool modelHasOdes(const AnalyserModelPtr &model) +{ + switch (model->type()) { + case AnalyserModel::Type::ODE: + case AnalyserModel::Type::DAE: + return true; + default: + return false; + } +} + +bool modelHasNlas(const AnalyserModelPtr &model) +{ + switch (model->type()) { + case AnalyserModel::Type::NLA: + case AnalyserModel::Type::DAE: + return true; + default: + return false; + } +} + +AnalyserVariablePtr analyserVariable(const AnalyserModelPtr &model, const VariablePtr &variable) +{ + // Find and return the analyser variable associated with the given variable. + + AnalyserVariablePtr res; + auto modelVoi = model->voi(); + auto modelVoiVariable = (modelVoi != nullptr) ? modelVoi->variable() : nullptr; + + if ((modelVoiVariable != nullptr) + && model->areEquivalentVariables(variable, modelVoiVariable)) { + res = modelVoi; + } else { + // Normally, we would have something like: + // + // for (const auto &modelVariable : variables(model)) { + // if (model->areEquivalentVariables(variable, modelVariable->variable())) { + // res = modelVariable; + // + // break; + // } + // } + // + // but we always have variables, so llvm-cov will complain that the false branch of our for loop is never + // reached. The below code is a bit more verbose but at least it makes llvm-cov happy. + + auto modelVariables = variables(model); + auto modelVariable = modelVariables.begin(); + + do { + if (model->areEquivalentVariables(variable, (*modelVariable)->variable())) { + res = *modelVariable; + } else { + ++modelVariable; + } + } while (res == nullptr); + } + + return res; +} + +double GeneratorInterpreter::GeneratorInterpreterImpl::scalingFactor(const VariablePtr &variable) const +{ + // Return the scaling factor for the given variable, accounting for the fact that a constant may be initialised by + // another variable which initial value may be defined in a different component. + + auto analyserVariable = libcellml::analyserVariable(mModel, variable); + + if ((analyserVariable->type() == AnalyserVariable::Type::CONSTANT) + && !isCellMLReal(variable->initialValue())) { + auto initialValueVariable = owningComponent(variable)->variable(variable->initialValue()); + auto initialValueAnalyserVariable = libcellml::analyserVariable(mModel, initialValueVariable); + + if (owningComponent(variable) != owningComponent(initialValueAnalyserVariable->variable())) { + return Units::scalingFactor(initialValueVariable->units(), variable->units()); + } + } + + return Units::scalingFactor(analyserVariable->variable()->units(), variable->units()); +} + +bool GeneratorInterpreter::GeneratorInterpreterImpl::isNegativeNumber(const AnalyserEquationAstPtr &ast) const +{ + if (ast->type() == AnalyserEquationAst::Type::CN) { + double doubleValue; + + convertToDouble(ast->value(), doubleValue); + + return doubleValue < 0.0; + } + + return false; +} + +bool GeneratorInterpreter::GeneratorInterpreterImpl::isRelationalOperator(const AnalyserEquationAstPtr &ast) const +{ + switch (ast->type()) { + case AnalyserEquationAst::Type::EQ: + return mProfile->hasEqOperator(); + case AnalyserEquationAst::Type::NEQ: + return mProfile->hasNeqOperator(); + case AnalyserEquationAst::Type::LT: + return mProfile->hasLtOperator(); + case AnalyserEquationAst::Type::LEQ: + return mProfile->hasLeqOperator(); + case AnalyserEquationAst::Type::GT: + return mProfile->hasGtOperator(); + case AnalyserEquationAst::Type::GEQ: + return mProfile->hasGeqOperator(); + default: + return false; + } +} + +bool GeneratorInterpreter::GeneratorInterpreterImpl::isAndOperator(const AnalyserEquationAstPtr &ast) const +{ + return (ast->type() == AnalyserEquationAst::Type::AND) + && mProfile->hasAndOperator(); +} + +bool GeneratorInterpreter::GeneratorInterpreterImpl::isOrOperator(const AnalyserEquationAstPtr &ast) const +{ + return (ast->type() == AnalyserEquationAst::Type::OR) + && mProfile->hasOrOperator(); +} + +bool GeneratorInterpreter::GeneratorInterpreterImpl::isXorOperator(const AnalyserEquationAstPtr &ast) const +{ + return (ast->type() == AnalyserEquationAst::Type::XOR) + && mProfile->hasXorOperator(); +} + +bool GeneratorInterpreter::GeneratorInterpreterImpl::isLogicalOperator(const AnalyserEquationAstPtr &ast) const +{ + // Note: AnalyserEquationAst::Type::NOT is a unary logical operator, hence we don't include it here since this + // method is only used to determine whether parentheses should be added around some code. + + return isAndOperator(ast) || isOrOperator(ast) || isXorOperator(ast); +} + +bool GeneratorInterpreter::GeneratorInterpreterImpl::isPlusOperator(const AnalyserEquationAstPtr &ast) const +{ + return ast->type() == AnalyserEquationAst::Type::PLUS; +} + +bool GeneratorInterpreter::GeneratorInterpreterImpl::isMinusOperator(const AnalyserEquationAstPtr &ast) const +{ + return ast->type() == AnalyserEquationAst::Type::MINUS; +} + +bool GeneratorInterpreter::GeneratorInterpreterImpl::isTimesOperator(const AnalyserEquationAstPtr &ast) const +{ + return ast->type() == AnalyserEquationAst::Type::TIMES; +} + +bool GeneratorInterpreter::GeneratorInterpreterImpl::isDivideOperator(const AnalyserEquationAstPtr &ast) const +{ + return ast->type() == AnalyserEquationAst::Type::DIVIDE; +} + +bool GeneratorInterpreter::GeneratorInterpreterImpl::isPowerOperator(const AnalyserEquationAstPtr &ast) const +{ + return (ast->type() == AnalyserEquationAst::Type::POWER) + && mProfile->hasPowerOperator(); +} + +bool GeneratorInterpreter::GeneratorInterpreterImpl::isRootOperator(const AnalyserEquationAstPtr &ast) const +{ + return (ast->type() == AnalyserEquationAst::Type::ROOT) + && mProfile->hasPowerOperator(); +} + +bool GeneratorInterpreter::GeneratorInterpreterImpl::isPiecewiseStatement(const AnalyserEquationAstPtr &ast) const +{ + return (ast->type() == AnalyserEquationAst::Type::PIECEWISE) + && mProfile->hasConditionalOperator(); +} + +std::string newLineIfNeeded(const std::string &code) +{ + return code.empty() ? "" : "\n"; +} + +std::string GeneratorInterpreter::GeneratorInterpreterImpl::generateMethodBodyCode(const std::string &methodBody) const +{ + return methodBody.empty() ? + (mProfile->emptyMethodString().empty() ? + "" : + mProfile->indentString() + mProfile->emptyMethodString()) : + methodBody; +} + +std::string generateDoubleCode(const std::string &value) +{ + if (value.find('.') != std::string::npos) { + return value; + } + + auto ePos = value.find('e'); + + if (ePos == std::string::npos) { + return value + ".0"; + } + + return value.substr(0, ePos) + ".0" + value.substr(ePos); +} + +std::string GeneratorInterpreter::GeneratorInterpreterImpl::generateVariableNameCode(const VariablePtr &variable, + bool rate) const +{ + // Generate some code for a variable name, but only if we have a model. If we don't have a model, it means that we + // are using the generator from the analyser, in which case we just want to return the original name of the + // variable. + + if (mModel == nullptr) { + return variable->name(); + } + + auto analyserVariable = libcellml::analyserVariable(mModel, variable); + + if (analyserVariable->type() == AnalyserVariable::Type::VARIABLE_OF_INTEGRATION) { + return mProfile->voiString(); + } + + std::string arrayName; + + if (analyserVariable->type() == AnalyserVariable::Type::STATE) { + arrayName = rate ? + mProfile->ratesArrayString() : + mProfile->statesArrayString(); + } else if (analyserVariable->type() == AnalyserVariable::Type::CONSTANT) { + arrayName = mProfile->constantsArrayString(); + } else if (analyserVariable->type() == AnalyserVariable::Type::COMPUTED_CONSTANT) { + arrayName = mProfile->computedConstantsArrayString(); + } else if (analyserVariable->type() == AnalyserVariable::Type::ALGEBRAIC) { + arrayName = mProfile->algebraicArrayString(); + } else { + arrayName = mProfile->externalArrayString(); + } + + return arrayName + mProfile->openArrayString() + convertToString(analyserVariable->index()) + mProfile->closeArrayString(); +} + +std::string GeneratorInterpreter::GeneratorInterpreterImpl::generateOperatorCode(const std::string &op, + const AnalyserEquationAstPtr &ast) const +{ + // Generate the code for the left and right branches of the given AST. + + std::string res; + auto astLeftChild = ast->leftChild(); + auto astRightChild = ast->rightChild(); + auto leftCode = generateCode(astLeftChild); + auto rightCode = generateCode(astRightChild); + + // Determine whether parentheses should be added around the left and/or right piece of code, and this based on the + // precedence of the operators used in CellML, which are listed below from higher to lower precedence: + // 1. Parentheses [Left to right] + // 2. POWER (as an operator, not as a function, i.e. [Left to right] + // as in Matlab and not in C, for example) + // 3. Unary PLUS, Unary MINUS, NOT [Right to left] + // 4. TIMES, DIVIDE [Left to right] + // 5. PLUS, MINUS [Left to right] + // 6. LT, LEQ, GT, GEQ [Left to right] + // 7. EQ, NEQ [Left to right] + // 8. XOR (bitwise) [Left to right] + // 9. AND (logical) [Left to right] + // 10. OR (logical) [Left to right] + // 11. PIECEWISE (as an operator) [Right to left] + + if (isPlusOperator(ast)) { + if (isRelationalOperator(astLeftChild) + || isLogicalOperator(astLeftChild) + || isPiecewiseStatement(astLeftChild)) { + leftCode = "(" + leftCode + ")"; + } + + if (isRelationalOperator(astRightChild) + || isLogicalOperator(astRightChild) + || isPiecewiseStatement(astRightChild)) { + rightCode = "(" + rightCode + ")"; + } + } else if (isMinusOperator(ast)) { + if (isRelationalOperator(astLeftChild) + || isLogicalOperator(astLeftChild) + || isPiecewiseStatement(astLeftChild)) { + leftCode = "(" + leftCode + ")"; + } + + if (isNegativeNumber(astRightChild) + || isRelationalOperator(astRightChild) + || isLogicalOperator(astRightChild) + || isMinusOperator(astRightChild) + || isPiecewiseStatement(astRightChild) + || (rightCode.rfind(mProfile->minusString(), 0) == 0)) { + rightCode = "(" + rightCode + ")"; + } else if (isPlusOperator(astRightChild)) { + if (astRightChild->rightChild() != nullptr) { + rightCode = "(" + rightCode + ")"; + } + } + } else if (isTimesOperator(ast)) { + if (isRelationalOperator(astLeftChild) + || isLogicalOperator(astLeftChild) + || isPiecewiseStatement(astLeftChild)) { + leftCode = "(" + leftCode + ")"; + } else if (isPlusOperator(astLeftChild) + || isMinusOperator(astLeftChild)) { + if (astLeftChild->rightChild() != nullptr) { + leftCode = "(" + leftCode + ")"; + } + } + + if (isRelationalOperator(astRightChild) + || isLogicalOperator(astRightChild) + || isPiecewiseStatement(astRightChild)) { + rightCode = "(" + rightCode + ")"; + } else if (isPlusOperator(astRightChild) + || isMinusOperator(astRightChild)) { + if (astRightChild->rightChild() != nullptr) { + rightCode = "(" + rightCode + ")"; + } + } + } else if (isDivideOperator(ast)) { + if (isRelationalOperator(astLeftChild) + || isLogicalOperator(astLeftChild) + || isPiecewiseStatement(astLeftChild)) { + leftCode = "(" + leftCode + ")"; + } else if (isPlusOperator(astLeftChild) + || isMinusOperator(astLeftChild)) { + if (astLeftChild->rightChild() != nullptr) { + leftCode = "(" + leftCode + ")"; + } + } + + if (isRelationalOperator(astRightChild) + || isLogicalOperator(astRightChild) + || isTimesOperator(astRightChild) + || isDivideOperator(astRightChild) + || isPiecewiseStatement(astRightChild)) { + rightCode = "(" + rightCode + ")"; + } else if (isPlusOperator(astRightChild) + || isMinusOperator(astRightChild)) { + if (astRightChild->rightChild() != nullptr) { + rightCode = "(" + rightCode + ")"; + } + } + } else if (isAndOperator(ast)) { + // Note: according to the precedence rules above, we only need to add parentheses around OR and PIECEWISE. + // However, it looks better/clearer to have some around some other operators (agreed, this is somewhat + // subjective). + + if (isRelationalOperator(astLeftChild) + || isOrOperator(astLeftChild) + || isXorOperator(astLeftChild) + || isPiecewiseStatement(astLeftChild)) { + leftCode = "(" + leftCode + ")"; + } else if (isPlusOperator(astLeftChild) + || isMinusOperator(astLeftChild)) { + if (astLeftChild->rightChild() != nullptr) { + leftCode = "(" + leftCode + ")"; + } + } else if (isPowerOperator(astLeftChild)) { + leftCode = "(" + leftCode + ")"; + } else if (isRootOperator(astLeftChild)) { + leftCode = "(" + leftCode + ")"; + } + + if (isRelationalOperator(astRightChild) + || isOrOperator(astRightChild) + || isXorOperator(astRightChild) + || isPiecewiseStatement(astRightChild)) { + rightCode = "(" + rightCode + ")"; + } else if (isPlusOperator(astRightChild) + || isMinusOperator(astRightChild)) { + if (astRightChild->rightChild() != nullptr) { + rightCode = "(" + rightCode + ")"; + } + } else if (isPowerOperator(astRightChild)) { + rightCode = "(" + rightCode + ")"; + } else if (isRootOperator(astRightChild)) { + rightCode = "(" + rightCode + ")"; + } + } else if (isOrOperator(ast)) { + // Note: according to the precedence rules above, we only need to add parentheses around PIECEWISE. However, it + // looks better/clearer to have some around some other operators (agreed, this is somewhat subjective). + + if (isRelationalOperator(astLeftChild) + || isAndOperator(astLeftChild) + || isXorOperator(astLeftChild) + || isPiecewiseStatement(astLeftChild)) { + leftCode = "(" + leftCode + ")"; + } else if (isPlusOperator(astLeftChild) + || isMinusOperator(astLeftChild)) { + if (astLeftChild->rightChild() != nullptr) { + leftCode = "(" + leftCode + ")"; + } + } else if (isPowerOperator(astLeftChild)) { + leftCode = "(" + leftCode + ")"; + } else if (isRootOperator(astLeftChild)) { + leftCode = "(" + leftCode + ")"; + } + + if (isRelationalOperator(astRightChild) + || isAndOperator(astRightChild) + || isXorOperator(astRightChild) + || isPiecewiseStatement(astRightChild)) { + rightCode = "(" + rightCode + ")"; + } else if (isPlusOperator(astRightChild) + || isMinusOperator(astRightChild)) { + if (astRightChild->rightChild() != nullptr) { + rightCode = "(" + rightCode + ")"; + } + } else if (isPowerOperator(astRightChild)) { + rightCode = "(" + rightCode + ")"; + } else if (isRootOperator(astRightChild)) { + rightCode = "(" + rightCode + ")"; + } + } else if (isXorOperator(ast)) { + // Note: according to the precedence rules above, we only need to add parentheses around AND, OR and PIECEWISE. + // However, it looks better/clearer to have some around some other operators (agreed, this is somewhat + // subjective). + + if (isRelationalOperator(astLeftChild) + || isAndOperator(astLeftChild) + || isOrOperator(astLeftChild) + || isPiecewiseStatement(astLeftChild)) { + leftCode = "(" + leftCode + ")"; + } else if (isPlusOperator(astLeftChild) + || isMinusOperator(astLeftChild)) { + if (astLeftChild->rightChild() != nullptr) { + leftCode = "(" + leftCode + ")"; + } + } else if (isPowerOperator(astLeftChild)) { + leftCode = "(" + leftCode + ")"; + } else if (isRootOperator(astLeftChild)) { + leftCode = "(" + leftCode + ")"; + } + + if (isRelationalOperator(astRightChild) + || isAndOperator(astRightChild) + || isOrOperator(astRightChild) + || isPiecewiseStatement(astRightChild)) { + rightCode = "(" + rightCode + ")"; + } else if (isPlusOperator(astRightChild) + || isMinusOperator(astRightChild)) { + if (astRightChild->rightChild() != nullptr) { + rightCode = "(" + rightCode + ")"; + } + } else if (isPowerOperator(astRightChild)) { + rightCode = "(" + rightCode + ")"; + } else if (isRootOperator(astRightChild)) { + rightCode = "(" + rightCode + ")"; + } + } else if (isPowerOperator(ast)) { + if (isRelationalOperator(astLeftChild) + || isLogicalOperator(astLeftChild) + || isMinusOperator(astLeftChild) + || isTimesOperator(astLeftChild) + || isDivideOperator(astLeftChild) + || isPiecewiseStatement(astLeftChild)) { + leftCode = "(" + leftCode + ")"; + } else if (isPlusOperator(astLeftChild)) { + if (astLeftChild->rightChild() != nullptr) { + leftCode = "(" + leftCode + ")"; + } + } + + if (isRelationalOperator(astRightChild) + || isLogicalOperator(astRightChild) + || isMinusOperator(astLeftChild) + || isTimesOperator(astRightChild) + || isDivideOperator(astRightChild) + || isPowerOperator(astRightChild) + || isRootOperator(astRightChild) + || isPiecewiseStatement(astRightChild)) { + rightCode = "(" + rightCode + ")"; + } else if (isPlusOperator(astRightChild)) { + if (astRightChild->rightChild() != nullptr) { + rightCode = "(" + rightCode + ")"; + } + } + } else if (isRootOperator(ast)) { + if (isRelationalOperator(astRightChild) + || isLogicalOperator(astRightChild) + || isMinusOperator(astRightChild) + || isTimesOperator(astRightChild) + || isDivideOperator(astRightChild) + || isPiecewiseStatement(astRightChild)) { + rightCode = "(" + rightCode + ")"; + } else if (isPlusOperator(astRightChild)) { + if (astRightChild->rightChild() != nullptr) { + rightCode = "(" + rightCode + ")"; + } + } + + auto astLeftChildLeftChild = astLeftChild->leftChild(); + + if (isRelationalOperator(astLeftChildLeftChild) + || isLogicalOperator(astLeftChildLeftChild) + || isMinusOperator(astLeftChildLeftChild) + || isTimesOperator(astLeftChildLeftChild) + || isDivideOperator(astLeftChildLeftChild) + || isPowerOperator(astLeftChildLeftChild) + || isRootOperator(astLeftChildLeftChild) + || isPiecewiseStatement(astLeftChildLeftChild)) { + leftCode = "(" + leftCode + ")"; + } else if (isPlusOperator(astLeftChildLeftChild)) { + if (astLeftChildLeftChild->rightChild() != nullptr) { + leftCode = "(" + leftCode + ")"; + } + } + + return rightCode + op + "(1.0/" + leftCode + ")"; + } + + return leftCode + op + rightCode; +} + +std::string GeneratorInterpreter::GeneratorInterpreterImpl::generateMinusUnaryCode(const AnalyserEquationAstPtr &ast) const +{ + // Generate the code for the left branch of the given AST. + + auto astLeftChild = ast->leftChild(); + auto leftCode = generateCode(astLeftChild); + + // Determine whether parentheses should be added around the left code. + + if (isRelationalOperator(astLeftChild) + || isLogicalOperator(astLeftChild) + || isPlusOperator(astLeftChild) + || isMinusOperator(astLeftChild) + || isPiecewiseStatement(astLeftChild)) { + leftCode = "(" + leftCode + ")"; + } + + return mProfile->minusString() + leftCode; +} + +std::string GeneratorInterpreter::GeneratorInterpreterImpl::generateOneParameterFunctionCode(const std::string &function, + const AnalyserEquationAstPtr &ast) const +{ + return function + "(" + generateCode(ast->leftChild()) + ")"; +} + +std::string GeneratorInterpreter::GeneratorInterpreterImpl::generateTwoParameterFunctionCode(const std::string &function, + const AnalyserEquationAstPtr &ast) const +{ + auto leftCode = generateCode(ast->leftChild()); + auto rightCode = generateCode(ast->rightChild()); + + return function + "(" + leftCode + ", " + rightCode + ")"; +} + +std::string GeneratorInterpreter::GeneratorInterpreterImpl::generatePiecewiseIfCode(const std::string &condition, + const std::string &value) const +{ + return replace(replace(mProfile->hasConditionalOperator() ? + mProfile->conditionalOperatorIfString() : + mProfile->piecewiseIfString(), + "[CONDITION]", condition), + "[IF_STATEMENT]", value); +} + +std::string GeneratorInterpreter::GeneratorInterpreterImpl::generatePiecewiseElseCode(const std::string &value) const +{ + return replace(mProfile->hasConditionalOperator() ? + mProfile->conditionalOperatorElseString() : + mProfile->piecewiseElseString(), + "[ELSE_STATEMENT]", value); +} + +std::string GeneratorInterpreter::GeneratorInterpreterImpl::generateCode(const AnalyserEquationAstPtr &ast) const +{ + // Make sure that we have an AST to work on. + + if (ast == nullptr) { + return {}; + } + + // Generate the code for the given AST. + // Note: AnalyserEquationAst::Type::BVAR is only relevant when there is no model (in which case we want to generate + // something like dx/dt, as is in the case of the analyser when we want to mention an equation) since + // otherwise we don't need to generate any code for it (since we will, instead, want to generate something + // like rates[0]). + + std::string code; + + switch (ast->type()) { + case AnalyserEquationAst::Type::EQUALITY: + code = generateOperatorCode(mProfile->equalityString(), ast); + + break; + case AnalyserEquationAst::Type::EQ: + if (mProfile->hasEqOperator()) { + code = generateOperatorCode(mProfile->eqString(), ast); + } else { + code = generateTwoParameterFunctionCode(mProfile->eqString(), ast); + } + + break; + case AnalyserEquationAst::Type::NEQ: + if (mProfile->hasNeqOperator()) { + code = generateOperatorCode(mProfile->neqString(), ast); + } else { + code = generateTwoParameterFunctionCode(mProfile->neqString(), ast); + } + + break; + case AnalyserEquationAst::Type::LT: + if (mProfile->hasLtOperator()) { + code = generateOperatorCode(mProfile->ltString(), ast); + } else { + code = generateTwoParameterFunctionCode(mProfile->ltString(), ast); + } + + break; + case AnalyserEquationAst::Type::LEQ: + if (mProfile->hasLeqOperator()) { + code = generateOperatorCode(mProfile->leqString(), ast); + } else { + code = generateTwoParameterFunctionCode(mProfile->leqString(), ast); + } + + break; + case AnalyserEquationAst::Type::GT: + if (mProfile->hasGtOperator()) { + code = generateOperatorCode(mProfile->gtString(), ast); + } else { + code = generateTwoParameterFunctionCode(mProfile->gtString(), ast); + } + + break; + case AnalyserEquationAst::Type::GEQ: + if (mProfile->hasGeqOperator()) { + code = generateOperatorCode(mProfile->geqString(), ast); + } else { + code = generateTwoParameterFunctionCode(mProfile->geqString(), ast); + } + + break; + case AnalyserEquationAst::Type::AND: + if (mProfile->hasAndOperator()) { + code = generateOperatorCode(mProfile->andString(), ast); + } else { + code = generateTwoParameterFunctionCode(mProfile->andString(), ast); + } + + break; + case AnalyserEquationAst::Type::OR: + if (mProfile->hasOrOperator()) { + code = generateOperatorCode(mProfile->orString(), ast); + } else { + code = generateTwoParameterFunctionCode(mProfile->orString(), ast); + } + + break; + case AnalyserEquationAst::Type::XOR: + if (mProfile->hasXorOperator()) { + code = generateOperatorCode(mProfile->xorString(), ast); + } else { + code = generateTwoParameterFunctionCode(mProfile->xorString(), ast); + } + + break; + case AnalyserEquationAst::Type::NOT: + if (mProfile->hasNotOperator()) { + code = mProfile->notString() + generateCode(ast->leftChild()); + } else { + code = generateOneParameterFunctionCode(mProfile->notString(), ast); + } + + break; + case AnalyserEquationAst::Type::PLUS: + if (ast->rightChild() != nullptr) { + code = generateOperatorCode(mProfile->plusString(), ast); + } else { + code = generateCode(ast->leftChild()); + } + + break; + case AnalyserEquationAst::Type::MINUS: + code = (ast->rightChild() != nullptr) ? + generateOperatorCode(mProfile->minusString(), ast) : + generateMinusUnaryCode(ast); + + break; + case AnalyserEquationAst::Type::TIMES: + code = generateOperatorCode(mProfile->timesString(), ast); + + break; + case AnalyserEquationAst::Type::DIVIDE: + code = generateOperatorCode(mProfile->divideString(), ast); + + break; + case AnalyserEquationAst::Type::POWER: { + auto rightCode = generateCode(ast->rightChild()); + double doubleValue; + auto validConversion = convertToDouble(rightCode, doubleValue); + + if (validConversion && areEqual(doubleValue, 0.5)) { + code = mProfile->squareRootString() + "(" + generateCode(ast->leftChild()) + ")"; + } else if (validConversion && areEqual(doubleValue, 2.0) + && !mProfile->squareString().empty()) { + code = mProfile->squareString() + "(" + generateCode(ast->leftChild()) + ")"; + } else if (mProfile->hasPowerOperator()) { + code = generateOperatorCode(mProfile->powerString(), ast); + } else { + code = mProfile->powerString() + "(" + generateCode(ast->leftChild()) + ", " + rightCode + ")"; + } + } break; + case AnalyserEquationAst::Type::ROOT: { + auto astRightChild = ast->rightChild(); + + if (astRightChild != nullptr) { + auto astLeftChild = ast->leftChild(); + auto leftCode = generateCode(astLeftChild); + double doubleValue; + auto validConversion = convertToDouble(leftCode, doubleValue); + + if (validConversion && areEqual(doubleValue, 2.0)) { + code = mProfile->squareRootString() + "(" + generateCode(astRightChild) + ")"; + } else if (validConversion && areEqual(doubleValue, 0.5) + && !mProfile->squareString().empty()) { + code = mProfile->squareString() + "(" + generateCode(astRightChild) + ")"; + } else if (mProfile->hasPowerOperator()) { + code = generateOperatorCode(mProfile->powerString(), ast); + } else { + auto inverseValueAst = AnalyserEquationAst::create(); + + inverseValueAst->setType(AnalyserEquationAst::Type::DIVIDE); + inverseValueAst->setParent(ast); + + auto inverseValueAstLeftChild = AnalyserEquationAst::create(); + + inverseValueAstLeftChild->setType(AnalyserEquationAst::Type::CN); + inverseValueAstLeftChild->setValue("1.0"); + inverseValueAstLeftChild->setParent(inverseValueAst); + + inverseValueAst->setLeftChild(inverseValueAstLeftChild); + inverseValueAst->setRightChild(astLeftChild->leftChild()); + + code = mProfile->powerString() + "(" + generateCode(astRightChild) + ", " + generateOperatorCode(mProfile->divideString(), inverseValueAst) + ")"; + } + } else { + code = mProfile->squareRootString() + "(" + generateCode(ast->leftChild()) + ")"; + } + } break; + case AnalyserEquationAst::Type::ABS: + code = generateOneParameterFunctionCode(mProfile->absoluteValueString(), ast); + + break; + case AnalyserEquationAst::Type::EXP: + code = generateOneParameterFunctionCode(mProfile->exponentialString(), ast); + + break; + case AnalyserEquationAst::Type::LN: + code = generateOneParameterFunctionCode(mProfile->naturalLogarithmString(), ast); + + break; + case AnalyserEquationAst::Type::LOG: { + auto astRightChild = ast->rightChild(); + + if (astRightChild != nullptr) { + auto leftCode = generateCode(ast->leftChild()); + double doubleValue; + auto rightCode = generateCode(astRightChild); + + if (convertToDouble(leftCode, doubleValue) + && areEqual(doubleValue, 10.0)) { + code = mProfile->commonLogarithmString() + "(" + rightCode + ")"; + } else { + code = mProfile->naturalLogarithmString() + "(" + rightCode + ")/" + mProfile->naturalLogarithmString() + "(" + leftCode + ")"; + } + } else { + code = generateOneParameterFunctionCode(mProfile->commonLogarithmString(), ast); + } + } break; + case AnalyserEquationAst::Type::CEILING: + code = generateOneParameterFunctionCode(mProfile->ceilingString(), ast); + + break; + case AnalyserEquationAst::Type::FLOOR: + code = generateOneParameterFunctionCode(mProfile->floorString(), ast); + + break; + case AnalyserEquationAst::Type::MIN: + code = generateTwoParameterFunctionCode(mProfile->minString(), ast); + + break; + case AnalyserEquationAst::Type::MAX: + code = generateTwoParameterFunctionCode(mProfile->maxString(), ast); + + break; + case AnalyserEquationAst::Type::REM: + code = generateTwoParameterFunctionCode(mProfile->remString(), ast); + + break; + case AnalyserEquationAst::Type::DIFF: + if (mModel != nullptr) { + code = generateCode(ast->rightChild()); + } else { + code = "d" + generateCode(ast->rightChild()) + "/d" + generateCode(ast->leftChild()); + } + + break; + case AnalyserEquationAst::Type::SIN: + code = generateOneParameterFunctionCode(mProfile->sinString(), ast); + + break; + case AnalyserEquationAst::Type::COS: + code = generateOneParameterFunctionCode(mProfile->cosString(), ast); + + break; + case AnalyserEquationAst::Type::TAN: + code = generateOneParameterFunctionCode(mProfile->tanString(), ast); + + break; + case AnalyserEquationAst::Type::SEC: + code = generateOneParameterFunctionCode(mProfile->secString(), ast); + + break; + case AnalyserEquationAst::Type::CSC: + code = generateOneParameterFunctionCode(mProfile->cscString(), ast); + + break; + case AnalyserEquationAst::Type::COT: + code = generateOneParameterFunctionCode(mProfile->cotString(), ast); + + break; + case AnalyserEquationAst::Type::SINH: + code = generateOneParameterFunctionCode(mProfile->sinhString(), ast); + + break; + case AnalyserEquationAst::Type::COSH: + code = generateOneParameterFunctionCode(mProfile->coshString(), ast); + + break; + case AnalyserEquationAst::Type::TANH: + code = generateOneParameterFunctionCode(mProfile->tanhString(), ast); + + break; + case AnalyserEquationAst::Type::SECH: + code = generateOneParameterFunctionCode(mProfile->sechString(), ast); + + break; + case AnalyserEquationAst::Type::CSCH: + code = generateOneParameterFunctionCode(mProfile->cschString(), ast); + + break; + case AnalyserEquationAst::Type::COTH: + code = generateOneParameterFunctionCode(mProfile->cothString(), ast); + + break; + case AnalyserEquationAst::Type::ASIN: + code = generateOneParameterFunctionCode(mProfile->asinString(), ast); + + break; + case AnalyserEquationAst::Type::ACOS: + code = generateOneParameterFunctionCode(mProfile->acosString(), ast); + + break; + case AnalyserEquationAst::Type::ATAN: + code = generateOneParameterFunctionCode(mProfile->atanString(), ast); + + break; + case AnalyserEquationAst::Type::ASEC: + code = generateOneParameterFunctionCode(mProfile->asecString(), ast); + + break; + case AnalyserEquationAst::Type::ACSC: + code = generateOneParameterFunctionCode(mProfile->acscString(), ast); + + break; + case AnalyserEquationAst::Type::ACOT: + code = generateOneParameterFunctionCode(mProfile->acotString(), ast); + + break; + case AnalyserEquationAst::Type::ASINH: + code = generateOneParameterFunctionCode(mProfile->asinhString(), ast); + + break; + case AnalyserEquationAst::Type::ACOSH: + code = generateOneParameterFunctionCode(mProfile->acoshString(), ast); + + break; + case AnalyserEquationAst::Type::ATANH: + code = generateOneParameterFunctionCode(mProfile->atanhString(), ast); + + break; + case AnalyserEquationAst::Type::ASECH: + code = generateOneParameterFunctionCode(mProfile->asechString(), ast); + + break; + case AnalyserEquationAst::Type::ACSCH: + code = generateOneParameterFunctionCode(mProfile->acschString(), ast); + + break; + case AnalyserEquationAst::Type::ACOTH: + code = generateOneParameterFunctionCode(mProfile->acothString(), ast); + + break; + case AnalyserEquationAst::Type::PIECEWISE: { + auto astLeftChild = ast->leftChild(); + auto astRightChild = ast->rightChild(); + auto leftCode = generateCode(astLeftChild); + auto rightCode = generateCode(astRightChild); + + if (astRightChild != nullptr) { + if (astRightChild->type() == AnalyserEquationAst::Type::PIECE) { + code = leftCode + generatePiecewiseElseCode(rightCode + generatePiecewiseElseCode(mProfile->nanString())); + } else { + code = leftCode + generatePiecewiseElseCode(rightCode); + } + } else if (astLeftChild != nullptr) { + if (astLeftChild->type() == AnalyserEquationAst::Type::PIECE) { + code = leftCode + generatePiecewiseElseCode(mProfile->nanString()); + } else { + code = leftCode; + } + } else { + code = mProfile->nanString(); + } + } break; + case AnalyserEquationAst::Type::PIECE: { + auto leftCode = generateCode(ast->leftChild()); + auto rightCode = generateCode(ast->rightChild()); + + code = generatePiecewiseIfCode(rightCode, leftCode); + } break; + case AnalyserEquationAst::Type::OTHERWISE: { + code = generateCode(ast->leftChild()); + } break; + case AnalyserEquationAst::Type::CI: { + auto variable = ast->variable(); + bool rate = ast->parent()->type() == AnalyserEquationAst::Type::DIFF; + + code = generateVariableNameCode(variable, rate); + } break; + case AnalyserEquationAst::Type::CN: { + double doubleValue; + + convertToDouble(ast->value(), doubleValue); + + code = generateDoubleCode(ast->value()); + } break; + case AnalyserEquationAst::Type::DEGREE: + case AnalyserEquationAst::Type::LOGBASE: { + code = generateCode(ast->leftChild()); + } break; + case AnalyserEquationAst::Type::BVAR: { + code = generateCode(ast->leftChild()); + } break; + case AnalyserEquationAst::Type::TRUE: + code = mProfile->trueString(); + + break; + case AnalyserEquationAst::Type::FALSE: + code = mProfile->falseString(); + + break; + case AnalyserEquationAst::Type::E: + code = mProfile->eString(); + + break; + case AnalyserEquationAst::Type::PI: + code = mProfile->piString(); + + break; + case AnalyserEquationAst::Type::INF: + code = mProfile->infString(); + + break; + default: // AnalyserEquationAst::Type::NAN. + code = mProfile->nanString(); + + break; + } + + return code; +} + +bool GeneratorInterpreter::GeneratorInterpreterImpl::isToBeComputedAgain(const AnalyserEquationPtr &equation) const +{ + // NLA and algebraic equations that are state/rate-based and external equations are to be computed again (in the + // computeVariables() method). + + switch (equation->type()) { + case AnalyserEquation::Type::NLA: + case AnalyserEquation::Type::ALGEBRAIC: + return equation->isStateRateBased(); + case AnalyserEquation::Type::EXTERNAL: + return true; + default: + return false; + } +} + +bool GeneratorInterpreter::GeneratorInterpreterImpl::isSomeConstant(const AnalyserEquationPtr &equation, + bool includeComputedConstants) const +{ + auto type = equation->type(); + + return (type == AnalyserEquation::Type::TRUE_CONSTANT) + || (!includeComputedConstants && (type == AnalyserEquation::Type::VARIABLE_BASED_CONSTANT)); +} + +std::string GeneratorInterpreter::GeneratorInterpreterImpl::generateZeroInitialisationCode(const AnalyserVariablePtr &variable) +{ + bool rate = variable->type() == AnalyserVariable::Type::STATE; + + return mProfile->indentString() + + generateVariableNameCode(variable->variable(), rate) + + mProfile->equalityString() + + "0.0" + + mProfile->commandSeparatorString() + "\n"; +} + +std::string GeneratorInterpreter::GeneratorInterpreterImpl::generateInitialisationCode(const AnalyserVariablePtr &variable) +{ + // Determine whether the initialising variable has an initial value per se or if it is initialised by another + // variable. + + auto initialisingVariable = variable->initialisingVariable(); + std::string initialValueCode; + + if (isCellMLReal(initialisingVariable->initialValue())) { + initialValueCode = generateDoubleCode(initialisingVariable->initialValue()); + } else { + auto initialValueVariable = owningComponent(initialisingVariable)->variable(initialisingVariable->initialValue()); + auto analyserInitialValueVariable = analyserVariable(mModel, initialValueVariable); + + initialValueCode = mProfile->constantsArrayString() + mProfile->openArrayString() + convertToString(analyserInitialValueVariable->index()) + mProfile->closeArrayString(); + } + + // Determine the scaling factor, if any. + + auto scalingFactor = GeneratorInterpreter::GeneratorInterpreterImpl::scalingFactor(initialisingVariable); + + if (!areNearlyEqual(scalingFactor, 1.0)) { + initialValueCode = generateDoubleCode(convertToString(scalingFactor)) + mProfile->timesString() + initialValueCode; + } + + return mProfile->indentString() + + generateVariableNameCode(variable->variable()) + + mProfile->equalityString() + + initialValueCode + + mProfile->commandSeparatorString() + "\n"; +} + +std::string GeneratorInterpreter::GeneratorInterpreterImpl::generateEquationCode(const AnalyserEquationPtr &equation, + std::vector &remainingEquations, + std::vector &equationsForDependencies, + bool includeComputedConstants) +{ + std::string res; + + if (std::find(remainingEquations.begin(), remainingEquations.end(), equation) != remainingEquations.end()) { + // Stop tracking the equation and its NLA siblings, if any. + // Note: we need to do this as soon as possible to avoid recursive calls, something that would happen if we were + // to do this at the end of this if statement. + + remainingEquations.erase(std::find(remainingEquations.begin(), remainingEquations.end(), equation)); + + for (const auto &nlaSibling : equation->nlaSiblings()) { + remainingEquations.erase(std::find(remainingEquations.begin(), remainingEquations.end(), nlaSibling)); + } + + // Generate any dependency that this equation may have. + + if (!isSomeConstant(equation, includeComputedConstants)) { + for (const auto &dependency : equation->dependencies()) { + if ((dependency->type() != AnalyserEquation::Type::ODE) + && !isSomeConstant(dependency, includeComputedConstants) + && (equationsForDependencies.empty() + || isToBeComputedAgain(dependency) + || (std::find(equationsForDependencies.begin(), equationsForDependencies.end(), dependency) != equationsForDependencies.end()))) { + res += generateEquationCode(dependency, remainingEquations, equationsForDependencies, includeComputedConstants); + } + } + } + + // Generate the equation code itself, based on the equation type. + + switch (equation->type()) { + case AnalyserEquation::Type::EXTERNAL: + for (const auto &variable : variables(equation)) { + res += mProfile->indentString() + + generateVariableNameCode(variable->variable()) + + mProfile->equalityString() + + replace(mProfile->externalVariableMethodCallString(mModelHasOdes), + "[INDEX]", convertToString(variable->index())) + + mProfile->commandSeparatorString() + "\n"; + } + + break; + case AnalyserEquation::Type::NLA: + if (!mProfile->findRootCallString(mModelHasOdes, mModel->hasExternalVariables()).empty()) { + res += mProfile->indentString() + + replace(mProfile->findRootCallString(mModelHasOdes, mModel->hasExternalVariables()), + "[INDEX]", convertToString(equation->nlaSystemIndex())); + } + + break; + default: + res += mProfile->indentString() + generateCode(equation->ast()) + mProfile->commandSeparatorString() + "\n"; + + break; + } + } + + return res; +} + +std::string GeneratorInterpreter::GeneratorInterpreterImpl::generateEquationCode(const AnalyserEquationPtr &equation, + std::vector &remainingEquations) +{ + std::vector dummyEquationsForComputeVariables; + + return generateEquationCode(equation, remainingEquations, dummyEquationsForComputeVariables, true); +} + +void GeneratorInterpreter::GeneratorInterpreterImpl::addNlaSystemsCode() +{ + if (mModelHasNlas + && !mProfile->objectiveFunctionMethodString(mModelHasOdes, mModel->hasExternalVariables()).empty() + && !mProfile->findRootMethodString(mModelHasOdes, mModel->hasExternalVariables()).empty() + && !mProfile->nlaSolveCallString(mModelHasOdes, mModel->hasExternalVariables()).empty()) { + // Note: only states and algebraic variables can be computed through an NLA system. Constants, computed + // constants, and external variables cannot, by definition, be computed through an NLA system. + + std::vector handledNlaEquations; + + for (const auto &equation : mModel->equations()) { + if ((equation->type() == AnalyserEquation::Type::NLA) + && (std::find(handledNlaEquations.begin(), handledNlaEquations.end(), equation) == handledNlaEquations.end())) { + std::string methodBody; + auto i = MAX_SIZE_T; + auto variables = libcellml::variables(equation); + + for (const auto &variable : variables) { + auto arrayString = (variable->type() == AnalyserVariable::Type::STATE) ? + mProfile->ratesArrayString() : + mProfile->algebraicArrayString(); + + methodBody += mProfile->indentString() + + arrayString + mProfile->openArrayString() + convertToString(variable->index()) + mProfile->closeArrayString() + + mProfile->equalityString() + + mProfile->uArrayString() + mProfile->openArrayString() + convertToString(++i) + mProfile->closeArrayString() + + mProfile->commandSeparatorString() + "\n"; + } + + methodBody += newLineIfNeeded(mCode); + + i = MAX_SIZE_T; + + methodBody += mProfile->indentString() + + mProfile->fArrayString() + mProfile->openArrayString() + convertToString(++i) + mProfile->closeArrayString() + + mProfile->equalityString() + + generateCode(equation->ast()) + + mProfile->commandSeparatorString() + "\n"; + + handledNlaEquations.push_back(equation); + + for (const auto &nlaSibling : equation->nlaSiblings()) { + methodBody += mProfile->indentString() + + mProfile->fArrayString() + mProfile->openArrayString() + convertToString(++i) + mProfile->closeArrayString() + + mProfile->equalityString() + + generateCode(nlaSibling->ast()) + + mProfile->commandSeparatorString() + "\n"; + + handledNlaEquations.push_back(nlaSibling); + } + + mCode += newLineIfNeeded(mCode) + + replace(replace(mProfile->objectiveFunctionMethodString(mModelHasOdes, mModel->hasExternalVariables()), + "[INDEX]", convertToString(equation->nlaSystemIndex())), + "[CODE]", generateMethodBodyCode(methodBody)); + + methodBody = {}; + + i = MAX_SIZE_T; + + for (const auto &variable : variables) { + auto arrayString = (variable->type() == AnalyserVariable::Type::STATE) ? + mProfile->ratesArrayString() : + mProfile->algebraicArrayString(); + + methodBody += mProfile->indentString() + + mProfile->uArrayString() + mProfile->openArrayString() + convertToString(++i) + mProfile->closeArrayString() + + mProfile->equalityString() + + arrayString + mProfile->openArrayString() + convertToString(variable->index()) + mProfile->closeArrayString() + + mProfile->commandSeparatorString() + "\n"; + } + + auto variablesCount = variables.size(); + + methodBody += newLineIfNeeded(mCode) + + mProfile->indentString() + + replace(replace(mProfile->nlaSolveCallString(mModelHasOdes, mModel->hasExternalVariables()), + "[INDEX]", convertToString(equation->nlaSystemIndex())), + "[SIZE]", convertToString(variablesCount)); + + methodBody += newLineIfNeeded(mCode); + + i = MAX_SIZE_T; + + for (const auto &variable : variables) { + auto arrayString = (variable->type() == AnalyserVariable::Type::STATE) ? + mProfile->ratesArrayString() : + mProfile->algebraicArrayString(); + + methodBody += mProfile->indentString() + + arrayString + mProfile->openArrayString() + convertToString(variable->index()) + mProfile->closeArrayString() + + mProfile->equalityString() + + mProfile->uArrayString() + mProfile->openArrayString() + convertToString(++i) + mProfile->closeArrayString() + + mProfile->commandSeparatorString() + "\n"; + } + + mCode += newLineIfNeeded(mCode) + + replace(replace(replace(mProfile->findRootMethodString(mModelHasOdes, mModel->hasExternalVariables()), + "[INDEX]", convertToString(equation->nlaSystemIndex())), + "[SIZE]", convertToString(variablesCount)), + "[CODE]", generateMethodBodyCode(methodBody)); + } + } + } +} + +std::string GeneratorInterpreter::GeneratorInterpreterImpl::generateConstantInitialisationCode(const std::vector::iterator constant, + std::vector &remainingConstants) +{ + auto initialisingVariable = (*constant)->initialisingVariable(); + auto initialValue = initialisingVariable->initialValue(); + + if (!isCellMLReal(initialValue)) { + auto initialisingComponent = owningComponent(initialisingVariable); + auto crtConstant = std::find_if(remainingConstants.begin(), remainingConstants.end(), + [=](const AnalyserVariablePtr &av) -> bool { + return initialisingComponent->variable(initialValue) == av->variable(); + }); + + if (crtConstant != remainingConstants.end()) { + return generateConstantInitialisationCode(crtConstant, remainingConstants); + } + } + + auto code = generateInitialisationCode(*constant); + + remainingConstants.erase(constant); + + return code; +} + +void GeneratorInterpreter::GeneratorInterpreterImpl::initialiseVariables(std::vector &remainingEquations) +{ + auto implementationInitialiseVariablesMethodString = mProfile->implementationInitialiseVariablesMethodString(mModelHasOdes); + + if (!implementationInitialiseVariablesMethodString.empty()) { + // Initialise our states (after, if needed, initialising the constant on which it depends). + + std::string methodBody; + auto constants = mModel->constants(); + + for (const auto &state : mModel->states()) { + auto initialisingVariable = state->initialisingVariable(); + auto initialValue = initialisingVariable->initialValue(); + + if (!isCellMLReal(initialValue)) { + // The initial value references a constant. + + auto initialisingComponent = owningComponent(initialisingVariable); + auto constant = std::find_if(constants.begin(), constants.end(), + [=](const AnalyserVariablePtr &av) -> bool { + return initialisingComponent->variable(initialValue)->hasEquivalentVariable(av->variable()); + }); + + methodBody += generateConstantInitialisationCode(constant, constants); + } + + methodBody += generateInitialisationCode(state); + } + + // Use an initial guess of zero for rates computed using an NLA system (see the note below). + + for (const auto &state : mModel->states()) { + if (state->equation(0)->type() == AnalyserEquation::Type::NLA) { + methodBody += generateZeroInitialisationCode(state); + } + } + + // Initialise our (remaining) constants. + + while (!constants.empty()) { + methodBody += generateConstantInitialisationCode(constants.begin(), constants); + } + + // Initialise our computed constants that are initialised using an equation (e.g., x = 3 rather than x with an + // initial value of 3). + + auto equations = mModel->equations(); + + for (const auto &equation : equations) { + if (equation->type() == AnalyserEquation::Type::TRUE_CONSTANT) { + methodBody += generateEquationCode(equation, remainingEquations); + } + } + + // Initialise our algebraic variables that have an initial value. Also use an initial guess of zero for + // algebraic variables computed using an NLA system. + // Note: a variable which is the only unknown in an equation, but which is not on its own on either the LHS or + // RHS of that equation (e.g., x = y+z with x and y known and z unknown) is (currently) to be computed + // using an NLA system for which we need an initial guess. We use an initial guess of zero, which is fine + // since such an NLA system has only one solution. + + for (const auto &algebraic : mModel->algebraic()) { + if (algebraic->initialisingVariable() != nullptr) { + methodBody += generateInitialisationCode(algebraic); + } else if (algebraic->equation(0)->type() == AnalyserEquation::Type::NLA) { + methodBody += generateZeroInitialisationCode(algebraic); + } + } + + mCode += newLineIfNeeded(mCode) + + replace(implementationInitialiseVariablesMethodString, + "[CODE]", generateMethodBodyCode(methodBody)); + } +} + +void GeneratorInterpreter::GeneratorInterpreterImpl::computeComputedConstants(std::vector &remainingEquations) +{ + if (!mProfile->implementationComputeComputedConstantsMethodString().empty()) { + std::string methodBody; + + for (const auto &equation : mModel->equations()) { + if (equation->type() == AnalyserEquation::Type::VARIABLE_BASED_CONSTANT) { + methodBody += generateEquationCode(equation, remainingEquations); + } + } + + mCode += newLineIfNeeded(mCode) + + replace(mProfile->implementationComputeComputedConstantsMethodString(), + "[CODE]", generateMethodBodyCode(methodBody)); + } +} + +void GeneratorInterpreter::GeneratorInterpreterImpl::computeRates(std::vector &remainingEquations) +{ + auto implementationComputeRatesMethodString = mProfile->implementationComputeRatesMethodString(mModel->hasExternalVariables()); + + if (mModelHasOdes + && !implementationComputeRatesMethodString.empty()) { + std::string methodBody; + + for (const auto &equation : mModel->equations()) { + // A rate is computed either through an ODE equation or through an NLA equation in case the rate is not on + // its own on either the LHS or RHS of the equation. + + auto variables = libcellml::variables(equation); + + if ((equation->type() == AnalyserEquation::Type::ODE) + || ((equation->type() == AnalyserEquation::Type::NLA) + && (variables.size() == 1) + && (variables[0]->type() == AnalyserVariable::Type::STATE))) { + methodBody += generateEquationCode(equation, remainingEquations); + } + } + + mCode += newLineIfNeeded(mCode) + + replace(implementationComputeRatesMethodString, + "[CODE]", generateMethodBodyCode(methodBody)); + } +} + +void GeneratorInterpreter::GeneratorInterpreterImpl::computeVariables(std::vector &remainingEquations) +{ + auto implementationComputeVariablesMethodString = mProfile->implementationComputeVariablesMethodString(mModelHasOdes, + mModel->hasExternalVariables()); + + if (!implementationComputeVariablesMethodString.empty()) { + std::string methodBody; + auto equations = mModel->equations(); + std::vector newRemainingEquations {std::begin(equations), std::end(equations)}; + + for (const auto &equation : equations) { + if ((std::find(remainingEquations.begin(), remainingEquations.end(), equation) != remainingEquations.end()) + || isToBeComputedAgain(equation)) { + methodBody += generateEquationCode(equation, newRemainingEquations, remainingEquations, false); + } + } + + mCode += newLineIfNeeded(mCode) + + replace(implementationComputeVariablesMethodString, + "[CODE]", generateMethodBodyCode(methodBody)); + } +} + +GeneratorInterpreter::GeneratorInterpreter(const AnalyserModelPtr &model, const GeneratorProfilePtr &profile, + const std::string &code) + : mPimpl(new GeneratorInterpreterImpl(model, profile, code)) +{ +} + +GeneratorInterpreter::GeneratorInterpreter(const AnalyserEquationAstPtr &ast, const GeneratorProfilePtr &profile) + : mPimpl(new GeneratorInterpreterImpl(ast, profile)) +{ +} + +GeneratorInterpreter::~GeneratorInterpreter() +{ + delete mPimpl; +} + +GeneratorInterpreterPtr GeneratorInterpreter::create(const AnalyserModelPtr &model, const GeneratorProfilePtr &profile, + const std::string &code) noexcept +{ + return std::shared_ptr {new GeneratorInterpreter {model, profile, code}}; +} + +GeneratorInterpreterPtr GeneratorInterpreter::create(const AnalyserEquationAstPtr &ast, + const GeneratorProfilePtr &profile) noexcept +{ + return std::shared_ptr {new GeneratorInterpreter {ast, profile}}; +} + +std::string GeneratorInterpreter::code() const +{ + return mPimpl->mCode; +} + +} // namespace libcellml diff --git a/src/generatorinterpreter.h b/src/generatorinterpreter.h new file mode 100644 index 0000000000..9c54e13732 --- /dev/null +++ b/src/generatorinterpreter.h @@ -0,0 +1,92 @@ +/* +Copyright libCellML Contributors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +#pragma once + +#include "libcellml/analyserequation.h" + +namespace libcellml { + +class GeneratorInterpreter; /**< Forward declaration of GeneratorInterpreter class. */ +using GeneratorInterpreterPtr = std::shared_ptr; /**< Type definition for shared GeneratorInterpreter pointer. */ + +/** + * @brief The GeneratorInterpreter class. + * + * The GeneratorInterpreter class is used by the Generator and Interpreter classes to generate the code to compute a + * model. + */ +class GeneratorInterpreter +{ +public: + ~GeneratorInterpreter(); /**< Destructor, @private. */ + GeneratorInterpreter(const GeneratorInterpreter &rhs) = delete; /**< Copy constructor, @private. */ + GeneratorInterpreter(GeneratorInterpreter &&rhs) noexcept = delete; /**< Move constructor, @private. */ + GeneratorInterpreter &operator=(GeneratorInterpreter rhs) = delete; /**< Assignment operator, @private. */ + + /** + * @brief Create an @ref GeneratorInterpreter object. + * + * Factory method to create an @ref GeneratorInterpreter. Create a generator-interpreter with:: + * + * @code + * auto interpreterStatement = libcellml::GeneratorInterpreter::create(model, profile, code); + * @endcode + * + * @param model The model for which we want to generate the code to compute. + * @param profile The profile to be used to generate the code to compute. + * @param code The code that has already been generated. + * + * @return A smart pointer to an @ref GeneratorInterpreter object. + */ + static GeneratorInterpreterPtr create(const AnalyserModelPtr &model, const GeneratorProfilePtr &profile, + const std::string &code) noexcept; + + /** + * @brief Create an @ref GeneratorInterpreter object. + * + * Factory method to create an @ref GeneratorInterpreter. Create a generator-interpreter with:: + * + * @code + * auto interpreterStatement = libcellml::GeneratorInterpreter::create(profile); + * @endcode + * + * @param ast The AST for which we want to generate some code. + * @param profile The profile to be used to generate some code. + * + * @return A smart pointer to an @ref GeneratorInterpreter object. + */ + static GeneratorInterpreterPtr create(const AnalyserEquationAstPtr &ast, + const GeneratorProfilePtr &profile) noexcept; + + /** + * @brief Get the code to compute the model. + * + * Get the @c std::string code to compute the model. + * + * @return The @c std::string code to compute the model. + */ + std::string code() const; + +private: + GeneratorInterpreter(const AnalyserModelPtr &model, const GeneratorProfilePtr &profile, const std::string &code); /**< Constructor, @private. */ + GeneratorInterpreter(const AnalyserEquationAstPtr &ast, const GeneratorProfilePtr &profile); /**< Constructor, @private. */ + + struct GeneratorInterpreterImpl; + GeneratorInterpreterImpl *mPimpl; /**< Private member to implementation pointer, @private. */ +}; + +} // namespace libcellml diff --git a/src/generatorinterpreter_p.h b/src/generatorinterpreter_p.h new file mode 100644 index 0000000000..ff00b80187 --- /dev/null +++ b/src/generatorinterpreter_p.h @@ -0,0 +1,108 @@ +/* +Copyright libCellML Contributors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +#pragma once + +#include "generatorinterpreter.h" + +#include "libcellml/generatorprofile.h" + +namespace libcellml { + +bool modelHasOdes(const AnalyserModelPtr &model); +bool modelHasNlas(const AnalyserModelPtr &model); + +AnalyserVariablePtr analyserVariable(const AnalyserModelPtr &model, const VariablePtr &variable); + +std::string newLineIfNeeded(const std::string &code); + +std::string generateDoubleCode(const std::string &value); + +/** + * @brief The GeneratorInterpreter::GeneratorInterpreterImpl struct. + * + * The private implementation for the GeneratorInterpreter class. + */ +struct GeneratorInterpreter::GeneratorInterpreterImpl +{ + AnalyserModelPtr mModel; + bool mModelHasOdes = false; + bool mModelHasNlas = false; + + GeneratorProfilePtr mProfile = GeneratorProfile::create(); + std::string mCode; + + explicit GeneratorInterpreterImpl(const AnalyserModelPtr &model, const GeneratorProfilePtr &profile, + const std::string &code); + explicit GeneratorInterpreterImpl(const AnalyserEquationAstPtr &ast, const GeneratorProfilePtr &profile); + + void initialise(const AnalyserModelPtr &model, const GeneratorProfilePtr &profile, const std::string &code); + + double scalingFactor(const VariablePtr &variable) const; + + bool isNegativeNumber(const AnalyserEquationAstPtr &ast) const; + + bool isRelationalOperator(const AnalyserEquationAstPtr &ast) const; + bool isAndOperator(const AnalyserEquationAstPtr &ast) const; + bool isOrOperator(const AnalyserEquationAstPtr &ast) const; + bool isXorOperator(const AnalyserEquationAstPtr &ast) const; + bool isLogicalOperator(const AnalyserEquationAstPtr &ast) const; + bool isPlusOperator(const AnalyserEquationAstPtr &ast) const; + bool isMinusOperator(const AnalyserEquationAstPtr &ast) const; + bool isTimesOperator(const AnalyserEquationAstPtr &ast) const; + bool isDivideOperator(const AnalyserEquationAstPtr &ast) const; + bool isPowerOperator(const AnalyserEquationAstPtr &ast) const; + bool isRootOperator(const AnalyserEquationAstPtr &ast) const; + bool isPiecewiseStatement(const AnalyserEquationAstPtr &ast) const; + + std::string generateMethodBodyCode(const std::string &methodBody) const; + + std::string generateVariableNameCode(const VariablePtr &variable, + bool rate = false) const; + + std::string generateOperatorCode(const std::string &op, const AnalyserEquationAstPtr &ast) const; + std::string generateMinusUnaryCode(const AnalyserEquationAstPtr &ast) const; + std::string generateOneParameterFunctionCode(const std::string &function, const AnalyserEquationAstPtr &ast) const; + std::string generateTwoParameterFunctionCode(const std::string &function, const AnalyserEquationAstPtr &ast) const; + std::string generatePiecewiseIfCode(const std::string &condition, + const std::string &value) const; + std::string generatePiecewiseElseCode(const std::string &value) const; + std::string generateCode(const AnalyserEquationAstPtr &ast) const; + + bool isToBeComputedAgain(const AnalyserEquationPtr &equation) const; + bool isSomeConstant(const AnalyserEquationPtr &equation, + bool includeComputedConstants) const; + + std::string generateZeroInitialisationCode(const AnalyserVariablePtr &variable); + std::string generateInitialisationCode(const AnalyserVariablePtr &variable); + std::string generateEquationCode(const AnalyserEquationPtr &equation, + std::vector &remainingEquations, + std::vector &equationsForDependencies, + bool includeComputedConstants); + std::string generateEquationCode(const AnalyserEquationPtr &equation, + std::vector &remainingEquations); + + void addNlaSystemsCode(); + + std::string generateConstantInitialisationCode(const std::vector::iterator constant, + std::vector &remainingConstants); + void initialiseVariables(std::vector &remainingEquations); + void computeComputedConstants(std::vector &remainingEquations); + void computeRates(std::vector &remainingEquations); + void computeVariables(std::vector &remainingEquations); +}; + +} // namespace libcellml From becf20e92f16d60ba26a58db43341315e93533a2 Mon Sep 17 00:00:00 2001 From: Alan Garny Date: Tue, 22 Oct 2024 23:36:52 +1300 Subject: [PATCH 82/85] GeneratorProfile: slight math-related improvements. --- src/generatorprofile.cpp | 42 +++++++++----------------------- src/generatorprofilesha1values.h | 4 +-- 2 files changed, 14 insertions(+), 32 deletions(-) diff --git a/src/generatorprofile.cpp b/src/generatorprofile.cpp index 2d1a11d2f4..87843836fc 100644 --- a/src/generatorprofile.cpp +++ b/src/generatorprofile.cpp @@ -79,8 +79,8 @@ void GeneratorProfile::GeneratorProfileImpl::loadProfile(GeneratorProfile::Profi mCommonLogarithmString = "log10"; mCeilingString = "ceil"; mFloorString = "floor"; - mMinString = "min"; - mMaxString = "max"; + mMinString = "fmin"; + mMaxString = "fmax"; mRemString = "fmod"; mHasPowerOperator = false; @@ -123,7 +123,7 @@ void GeneratorProfile::GeneratorProfileImpl::loadProfile(GeneratorProfile::Profi mTrueString = "1.0"; mFalseString = "0.0"; - mEString = convertToString(exp(1.0)); + mEString = convertToString(M_E); mPiString = convertToString(M_PI); mInfString = "INFINITY"; mNanString = "NAN"; @@ -143,14 +143,8 @@ void GeneratorProfile::GeneratorProfileImpl::loadProfile(GeneratorProfile::Profi " return (x != 0.0) ^ (y != 0.0);\n" "}\n"; mNotFunctionString = ""; - mMinFunctionString = "double min(double x, double y)\n" - "{\n" - " return (x < y)?x:y;\n" - "}\n"; - mMaxFunctionString = "double max(double x, double y)\n" - "{\n" - " return (x > y)?x:y;\n" - "}\n"; + mMinFunctionString = ""; + mMaxFunctionString = ""; // Trigonometric functions. @@ -192,21 +186,15 @@ void GeneratorProfile::GeneratorProfileImpl::loadProfile(GeneratorProfile::Profi "}\n"; mAsechFunctionString = "double asech(double x)\n" "{\n" - " double oneOverX = 1.0/x;\n" - "\n" - " return log(oneOverX+sqrt(oneOverX*oneOverX-1.0));\n" + " return acosh(1.0/x);\n" "}\n"; mAcschFunctionString = "double acsch(double x)\n" "{\n" - " double oneOverX = 1.0/x;\n" - "\n" - " return log(oneOverX+sqrt(oneOverX*oneOverX+1.0));\n" + " return asinh(1.0/x);\n" "}\n"; mAcothFunctionString = "double acoth(double x)\n" "{\n" - " double oneOverX = 1.0/x;\n" - "\n" - " return 0.5*log((1.0+oneOverX)/(1.0-oneOverX));\n" + " return atanh(1.0/x);\n" "}\n"; // Miscellaneous. @@ -636,7 +624,7 @@ void GeneratorProfile::GeneratorProfileImpl::loadProfile(GeneratorProfile::Profi mTrueString = "1.0"; mFalseString = "0.0"; - mEString = convertToString(exp(1.0)); + mEString = convertToString(M_E); mPiString = convertToString(M_PI); mInfString = "inf"; mNanString = "nan"; @@ -711,19 +699,13 @@ void GeneratorProfile::GeneratorProfileImpl::loadProfile(GeneratorProfile::Profi " return atan(1.0/x)\n"; mAsechFunctionString = "\n" "def asech(x):\n" - " one_over_x = 1.0/x\n" - "\n" - " return log(one_over_x+sqrt(one_over_x*one_over_x-1.0))\n"; + " return acosh(1.0/x)\n"; mAcschFunctionString = "\n" "def acsch(x):\n" - " one_over_x = 1.0/x\n" - "\n" - " return log(one_over_x+sqrt(one_over_x*one_over_x+1.0))\n"; + " return asinh(1.0/x)\n"; mAcothFunctionString = "\n" "def acoth(x):\n" - " one_over_x = 1.0/x\n" - "\n" - " return 0.5*log((1.0+one_over_x)/(1.0-one_over_x))\n"; + " return atanh(1.0/x)\n"; // Miscellaneous. diff --git a/src/generatorprofilesha1values.h b/src/generatorprofilesha1values.h index 1bb721da23..6e870864e1 100644 --- a/src/generatorprofilesha1values.h +++ b/src/generatorprofilesha1values.h @@ -24,7 +24,7 @@ namespace libcellml { * The content of this file is generated, do not edit this file directly. * See docs/dev_utilities.rst for further information. */ -static const char C_GENERATOR_PROFILE_SHA1[] = "f0d3add475025d2d4b805747828dbaf2f1345b2f"; -static const char PYTHON_GENERATOR_PROFILE_SHA1[] = "35838d23a1b89fe47293f75e2684ba6d230cf4a8"; +static const char C_GENERATOR_PROFILE_SHA1[] = "e0be7345a3da30625ef6f2316ea4280323703566"; +static const char PYTHON_GENERATOR_PROFILE_SHA1[] = "dece9fc3241b5a84a4e1ab67972501af0e550b35"; } // namespace libcellml From a7e4f621b041b7527ba71f0e79639b305809db66 Mon Sep 17 00:00:00 2001 From: Alan Garny Date: Tue, 22 Oct 2024 23:42:39 +1300 Subject: [PATCH 83/85] Tests utils: some minor cleaning up. --- tests/test_utils.cpp | 32 ++++++++++++++++---------------- tests/test_utils.h | 1 + 2 files changed, 17 insertions(+), 16 deletions(-) diff --git a/tests/test_utils.cpp b/tests/test_utils.cpp index 0275c8483e..2025954e12 100644 --- a/tests/test_utils.cpp +++ b/tests/test_utils.cpp @@ -259,6 +259,22 @@ void expectEqualIssuesCellmlElementTypesLevelsReferenceRulesUrls(const std::vect } } +void expectEqualFileContents(const std::string &fileName, const std::string &fileContents) +{ + // Uncomment the below when you want to generate the expected file contents. + // #define NEW_GENERATOR + +#ifdef NEW_GENERATOR + std::ofstream file(resourcePath(fileName)); + + file << fileContents; + + file.close(); +#endif + + EXPECT_EQ(::fileContents(fileName), fileContents); +} + libcellml::ModelPtr createModel(const std::string &name) { libcellml::ModelPtr model = libcellml::Model::create(); @@ -416,19 +432,3 @@ void compareReset(const libcellml::ResetPtr &r1, const libcellml::ResetPtr &r2) EXPECT_EQ(r1->testValueId(), r2->testValueId()); EXPECT_EQ(r1->resetValueId(), r2->resetValueId()); } - -void expectEqualFileContents(const std::string &fileName, const std::string &fileContents) -{ - // Uncomment the below when you want to generate the expected file contents. - // #define NEW_GENERATOR - -#ifdef NEW_GENERATOR - std::ofstream file(resourcePath(fileName)); - - file << fileContents; - - file.close(); -#endif - - EXPECT_EQ(::fileContents(fileName), fileContents); -} diff --git a/tests/test_utils.h b/tests/test_utils.h index c89198426a..2390a07ee1 100644 --- a/tests/test_utils.h +++ b/tests/test_utils.h @@ -104,6 +104,7 @@ void TEST_EXPORT expectEqualIssuesCellmlElementTypesLevelsReferenceRulesUrls(con const std::vector &referenceRules, const std::vector &urls, const libcellml::LoggerPtr &logger); + void TEST_EXPORT expectEqualFileContents(const std::string &fileName, const std::string &fileContents); libcellml::ModelPtr TEST_EXPORT createModel(const std::string &name = ""); From a14384584700c73f0affade5061774d46cea9bb7 Mon Sep 17 00:00:00 2001 From: Alan Garny Date: Wed, 23 Oct 2024 00:27:04 +1300 Subject: [PATCH 84/85] Tests: various minor improvements. --- .../bindings/python/test_generator_profile.py | 14 +- tests/coverage/coverage.cpp | 41 +- tests/generator/generator.cpp | 69 +-- tests/generator/generatorprofile.cpp | 28 +- tests/resources/coverage/generator/model.c | 418 ++++++++--------- .../resources/coverage/generator/model.cellml | 307 ++++++++++++- .../generator/model.implementation.out | 397 ++++++++-------- tests/resources/coverage/generator/model.out | 365 ++++++++------- tests/resources/coverage/generator/model.py | 408 +++++++++-------- .../{model.modified.profile.c => model.xor.c} | 422 +++++++++--------- .../{model.modified.profile.h => model.xor.h} | 2 +- ...model.modified.profile.py => model.xor.py} | 412 +++++++++-------- .../generator/cellml_slc_example/model.c | 92 ++++ .../generator/cellml_slc_example/model.h | 32 ++ ...algebraic.c => model.algebraic.external.c} | 2 +- ...algebraic.h => model.algebraic.external.h} | 0 ...gebraic.py => model.algebraic.external.py} | 0 ...t.c => model.computed.constant.external.c} | 2 +- ...t.h => model.computed.constant.external.h} | 0 ...py => model.computed.constant.external.py} | 0 ...l.constant.c => model.constant.external.c} | 2 +- ...l.constant.h => model.constant.external.h} | 0 ...constant.py => model.constant.external.py} | 0 ...c => model.dependent.algebraic.external.c} | 2 +- ...h => model.dependent.algebraic.external.h} | 0 ... => model.dependent.algebraic.external.py} | 0 ...el.dependent.computed.constant.external.c} | 2 +- ...el.dependent.computed.constant.external.h} | 0 ...l.dependent.computed.constant.external.py} | 0 ....c => model.dependent.constant.external.c} | 2 +- ....h => model.dependent.constant.external.h} | 0 ...y => model.dependent.constant.external.py} | 0 ...ate.c => model.dependent.state.external.c} | 2 +- ...ate.h => model.dependent.state.external.h} | 0 ...e.py => model.dependent.state.external.py} | 0 .../{model.state.c => model.state.external.c} | 2 +- .../{model.state.h => model.state.external.h} | 0 ...model.state.py => model.state.external.py} | 0 ...ellml => model.unknown.vars.on.rhs.cellml} | 0 39 files changed, 1729 insertions(+), 1294 deletions(-) rename tests/resources/coverage/generator/{model.modified.profile.c => model.xor.c} (65%) rename tests/resources/coverage/generator/{model.modified.profile.h => model.xor.h} (98%) rename tests/resources/coverage/generator/{model.modified.profile.py => model.xor.py} (71%) create mode 100644 tests/resources/generator/cellml_slc_example/model.c create mode 100644 tests/resources/generator/cellml_slc_example/model.h rename tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/{model.algebraic.c => model.algebraic.external.c} (99%) rename tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/{model.algebraic.h => model.algebraic.external.h} (100%) rename tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/{model.algebraic.py => model.algebraic.external.py} (100%) rename tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/{model.computed.constant.c => model.computed.constant.external.c} (99%) rename tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/{model.computed.constant.h => model.computed.constant.external.h} (100%) rename tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/{model.computed.constant.py => model.computed.constant.external.py} (100%) rename tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/{model.constant.c => model.constant.external.c} (99%) rename tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/{model.constant.h => model.constant.external.h} (100%) rename tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/{model.constant.py => model.constant.external.py} (100%) rename tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/{model.dependent.algebraic.c => model.dependent.algebraic.external.c} (99%) rename tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/{model.dependent.algebraic.h => model.dependent.algebraic.external.h} (100%) rename tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/{model.dependent.algebraic.py => model.dependent.algebraic.external.py} (100%) rename tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/{model.dependent.computed.constant.c => model.dependent.computed.constant.external.c} (99%) rename tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/{model.dependent.computed.constant.h => model.dependent.computed.constant.external.h} (100%) rename tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/{model.dependent.computed.constant.py => model.dependent.computed.constant.external.py} (100%) rename tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/{model.dependent.constant.c => model.dependent.constant.external.c} (99%) rename tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/{model.dependent.constant.h => model.dependent.constant.external.h} (100%) rename tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/{model.dependent.constant.py => model.dependent.constant.external.py} (100%) rename tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/{model.dependent.state.c => model.dependent.state.external.c} (99%) rename tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/{model.dependent.state.h => model.dependent.state.external.h} (100%) rename tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/{model.dependent.state.py => model.dependent.state.external.py} (100%) rename tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/{model.state.c => model.state.external.c} (99%) rename tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/{model.state.h => model.state.external.h} (100%) rename tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/{model.state.py => model.state.external.py} (100%) rename tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/{model_unknown_vars_on_rhs.cellml => model.unknown.vars.on.rhs.cellml} (100%) diff --git a/tests/bindings/python/test_generator_profile.py b/tests/bindings/python/test_generator_profile.py index 54befa0120..0c6e4ec6c4 100644 --- a/tests/bindings/python/test_generator_profile.py +++ b/tests/bindings/python/test_generator_profile.py @@ -162,7 +162,7 @@ def test_acoth_function_string(self): g = GeneratorProfile() self.assertEqual( - 'double acoth(double x)\n{\n double oneOverX = 1.0/x;\n\n return 0.5*log((1.0+oneOverX)/(1.0-oneOverX));\n}\n', + 'double acoth(double x)\n{\n return atanh(1.0/x);\n}\n', g.acothFunctionString()) g.setAcothFunctionString(GeneratorProfileTestCase.VALUE) self.assertEqual(GeneratorProfileTestCase.VALUE, g.acothFunctionString()) @@ -200,7 +200,7 @@ def test_acsch_function_string(self): g = GeneratorProfile() self.assertEqual( - 'double acsch(double x)\n{\n double oneOverX = 1.0/x;\n\n return log(oneOverX+sqrt(oneOverX*oneOverX+1.0));\n}\n', + 'double acsch(double x)\n{\n return asinh(1.0/x);\n}\n', g.acschFunctionString()) g.setAcschFunctionString(GeneratorProfileTestCase.VALUE) self.assertEqual(GeneratorProfileTestCase.VALUE, g.acschFunctionString()) @@ -265,7 +265,7 @@ def test_asech_function_string(self): g = GeneratorProfile() self.assertEqual( - 'double asech(double x)\n{\n double oneOverX = 1.0/x;\n\n return log(oneOverX+sqrt(oneOverX*oneOverX-1.0));\n}\n', + 'double asech(double x)\n{\n return acosh(1.0/x);\n}\n', g.asechFunctionString()) g.setAsechFunctionString(GeneratorProfileTestCase.VALUE) self.assertEqual(GeneratorProfileTestCase.VALUE, g.asechFunctionString()) @@ -1285,7 +1285,7 @@ def test_max_function_string(self): g = GeneratorProfile() - self.assertEqual('double max(double x, double y)\n{\n return (x > y)?x:y;\n}\n', g.maxFunctionString()) + self.assertEqual('', g.maxFunctionString()) g.setMaxFunctionString(GeneratorProfileTestCase.VALUE) self.assertEqual(GeneratorProfileTestCase.VALUE, g.maxFunctionString()) @@ -1294,7 +1294,7 @@ def test_max_string(self): g = GeneratorProfile() - self.assertEqual('max', g.maxString()) + self.assertEqual('fmax', g.maxString()) g.setMaxString(GeneratorProfileTestCase.VALUE) self.assertEqual(GeneratorProfileTestCase.VALUE, g.maxString()) @@ -1303,7 +1303,7 @@ def test_min_function_string(self): g = GeneratorProfile() - self.assertEqual('double min(double x, double y)\n{\n return (x < y)?x:y;\n}\n', g.minFunctionString()) + self.assertEqual('', g.minFunctionString()) g.setMinFunctionString(GeneratorProfileTestCase.VALUE) self.assertEqual(GeneratorProfileTestCase.VALUE, g.minFunctionString()) @@ -1312,7 +1312,7 @@ def test_min_string(self): g = GeneratorProfile() - self.assertEqual('min', g.minString()) + self.assertEqual('fmin', g.minString()) g.setMinString(GeneratorProfileTestCase.VALUE) self.assertEqual(GeneratorProfileTestCase.VALUE, g.minString()) diff --git a/tests/coverage/coverage.cpp b/tests/coverage/coverage.cpp index 4e71511c89..9cbbd6fe8d 100644 --- a/tests/coverage/coverage.cpp +++ b/tests/coverage/coverage.cpp @@ -597,10 +597,10 @@ TEST(Coverage, generator) EXPECT_EQ(size_t(1), analyserModel->stateCount()); EXPECT_EQ(size_t(7), analyserModel->constantCount()); - EXPECT_EQ(size_t(199), analyserModel->computedConstantCount()); - EXPECT_EQ(size_t(2), analyserModel->algebraicCount()); + EXPECT_EQ(size_t(207), analyserModel->computedConstantCount()); + EXPECT_EQ(size_t(5), analyserModel->algebraicCount()); EXPECT_EQ(size_t(1), analyserModel->externalCount()); - EXPECT_EQ(size_t(203), analyserModel->equationCount()); + EXPECT_EQ(size_t(214), analyserModel->equationCount()); EXPECT_NE(nullptr, analyserModel->voi()); EXPECT_EQ(size_t(0), analyserModel->voi()->equationCount()); @@ -627,6 +627,7 @@ TEST(Coverage, generator) EXPECT_EQ(size_t(1), analyserModel->equation(0)->states().size()); EXPECT_NE(nullptr, analyserModel->equation(0)->state(0)); EXPECT_EQ(nullptr, analyserModel->equation(0)->state(analyserModel->equation(0)->stateCount())); + /*---GRY--- STILL NEEDED? EXPECT_NE(nullptr, analyserModel->equation(199)); EXPECT_NE(size_t(0), analyserModel->equation(199)->dependencyCount()); EXPECT_NE(size_t(0), analyserModel->equation(199)->dependencies().size()); @@ -649,6 +650,7 @@ TEST(Coverage, generator) EXPECT_EQ(nullptr, analyserModel->equation(199)->external(0)); EXPECT_EQ(nullptr, analyserModel->equation(199)->external(analyserModel->equation(199)->externalCount())); EXPECT_EQ(nullptr, analyserModel->equation(analyserModel->equationCount())); + */ for (const auto &equation : analyserModel->equations()) { checkAstTypeAsString(equation->ast()); @@ -666,9 +668,11 @@ TEST(Coverage, generator) EXPECT_NE(nullptr, analyserModel->constant(i)->initialisingVariable()); } + /*---GRY--- STILL NEEDED? for (size_t i = 0; i < analyserModel->algebraicCount(); ++i) { EXPECT_NE(nullptr, analyserModel->algebraic(i)->initialisingVariable()); } + */ EXPECT_EQ(nullptr, generator->model()); EXPECT_EQ(EMPTY_STRING, generator->interfaceCode()); @@ -682,20 +686,14 @@ TEST(Coverage, generator) auto profile = generator->profile(); - profile->setInterfaceCreateStatesArrayMethodString("double * createStatesVector();\n"); - profile->setImplementationCreateStatesArrayMethodString("double * createStatesVector()\n" - "{\n" - " double *res = (double *) malloc(STATE_COUNT*sizeof(double));\n" - "\n" - " for (size_t i = 0; i < STATE_COUNT; ++i) {\n" - " res[i] = NAN;\n" - " }\n" - "\n" - " return res;\n" - "}\n"); - - EXPECT_EQ_FILE_CONTENTS("coverage/generator/model.modified.profile.h", generator->interfaceCode()); - EXPECT_EQ_FILE_CONTENTS("coverage/generator/model.modified.profile.c", generator->implementationCode()); + profile->setXorString("XOR"); + profile->setXorFunctionString("double XOR(double x, double y)\n" + "{\n" + " return (x != 0.0) ^ (y != 0.0);\n" + "}\n"); + + EXPECT_EQ_FILE_CONTENTS("coverage/generator/model.xor.h", generator->interfaceCode()); + EXPECT_EQ_FILE_CONTENTS("coverage/generator/model.xor.c", generator->implementationCode()); profile = libcellml::GeneratorProfile::create(); @@ -847,12 +845,13 @@ TEST(Coverage, generator) EXPECT_EQ(EMPTY_STRING, generator->interfaceCode()); EXPECT_EQ_FILE_CONTENTS("coverage/generator/model.py", generator->implementationCode()); - profile->setImplementationCreateStatesArrayMethodString("\n" - "def create_states_vector():\n" - " return [nan]*STATE_COUNT\n"); + profile->setXorString("XOR_FUNC"); + profile->setXorFunctionString("\n" + "def XOR_FUNC(x, y):\n" + " return 1.0 if bool(x) ^ bool(y) else 0.0\n"); EXPECT_EQ(EMPTY_STRING, generator->interfaceCode()); - EXPECT_EQ_FILE_CONTENTS("coverage/generator/model.modified.profile.py", generator->implementationCode()); + EXPECT_EQ_FILE_CONTENTS("coverage/generator/model.xor.py", generator->implementationCode()); // Coverage for the case where mProfile is equal to nullptr in Generator. diff --git a/tests/generator/generator.cpp b/tests/generator/generator.cpp index d84acefb86..fbf3c7b684 100644 --- a/tests/generator/generator.cpp +++ b/tests/generator/generator.cpp @@ -1203,7 +1203,7 @@ TEST(Generator, hodgkinHuxleySquidAxonModel1952) TEST(Generator, hodgkinHuxleySquidAxonModel1952UnknownVarsOnRhs) { auto parser = libcellml::Parser::create(); - auto model = parser->parseModel(fileContents("generator/hodgkin_huxley_squid_axon_model_1952/model_unknown_vars_on_rhs.cellml")); + auto model = parser->parseModel(fileContents("generator/hodgkin_huxley_squid_axon_model_1952/model.unknown.vars.on.rhs.cellml")); EXPECT_EQ(size_t(0), parser->issueCount()); @@ -1253,16 +1253,16 @@ TEST(Generator, hodgkinHuxleySquidAxonModel1952WithStateVariableAsExternalVariab auto profile = generator->profile(); - profile->setInterfaceFileNameString("model.state.h"); + profile->setInterfaceFileNameString("model.state.external.h"); - EXPECT_EQ_FILE_CONTENTS("generator/hodgkin_huxley_squid_axon_model_1952/model.state.h", generator->interfaceCode()); - EXPECT_EQ_FILE_CONTENTS("generator/hodgkin_huxley_squid_axon_model_1952/model.state.c", generator->implementationCode()); + EXPECT_EQ_FILE_CONTENTS("generator/hodgkin_huxley_squid_axon_model_1952/model.state.external.h", generator->interfaceCode()); + EXPECT_EQ_FILE_CONTENTS("generator/hodgkin_huxley_squid_axon_model_1952/model.state.external.c", generator->implementationCode()); profile = libcellml::GeneratorProfile::create(libcellml::GeneratorProfile::Profile::PYTHON); generator->setProfile(profile); - EXPECT_EQ_FILE_CONTENTS("generator/hodgkin_huxley_squid_axon_model_1952/model.state.py", generator->implementationCode()); + EXPECT_EQ_FILE_CONTENTS("generator/hodgkin_huxley_squid_axon_model_1952/model.state.external.py", generator->implementationCode()); } TEST(Generator, hodgkinHuxleySquidAxonModel1952WithStateVariablesAsExternalVariablesIncludingOneDependingOnTheOther) @@ -1297,16 +1297,16 @@ TEST(Generator, hodgkinHuxleySquidAxonModel1952WithStateVariablesAsExternalVaria auto profile = generator->profile(); - profile->setInterfaceFileNameString("model.dependent.state.h"); + profile->setInterfaceFileNameString("model.dependent.state.external.h"); - EXPECT_EQ_FILE_CONTENTS("generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.h", generator->interfaceCode()); - EXPECT_EQ_FILE_CONTENTS("generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.c", generator->implementationCode()); + EXPECT_EQ_FILE_CONTENTS("generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.external.h", generator->interfaceCode()); + EXPECT_EQ_FILE_CONTENTS("generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.external.c", generator->implementationCode()); profile = libcellml::GeneratorProfile::create(libcellml::GeneratorProfile::Profile::PYTHON); generator->setProfile(profile); - EXPECT_EQ_FILE_CONTENTS("generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.py", generator->implementationCode()); + EXPECT_EQ_FILE_CONTENTS("generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.external.py", generator->implementationCode()); } TEST(Generator, hodgkinHuxleySquidAxonModel1952WithConstantAsExternalVariable) @@ -1334,16 +1334,16 @@ TEST(Generator, hodgkinHuxleySquidAxonModel1952WithConstantAsExternalVariable) auto profile = generator->profile(); - profile->setInterfaceFileNameString("model.constant.h"); + profile->setInterfaceFileNameString("model.constant.external.h"); - EXPECT_EQ_FILE_CONTENTS("generator/hodgkin_huxley_squid_axon_model_1952/model.constant.h", generator->interfaceCode()); - EXPECT_EQ_FILE_CONTENTS("generator/hodgkin_huxley_squid_axon_model_1952/model.constant.c", generator->implementationCode()); + EXPECT_EQ_FILE_CONTENTS("generator/hodgkin_huxley_squid_axon_model_1952/model.constant.external.h", generator->interfaceCode()); + EXPECT_EQ_FILE_CONTENTS("generator/hodgkin_huxley_squid_axon_model_1952/model.constant.external.c", generator->implementationCode()); profile = libcellml::GeneratorProfile::create(libcellml::GeneratorProfile::Profile::PYTHON); generator->setProfile(profile); - EXPECT_EQ_FILE_CONTENTS("generator/hodgkin_huxley_squid_axon_model_1952/model.constant.py", generator->implementationCode()); + EXPECT_EQ_FILE_CONTENTS("generator/hodgkin_huxley_squid_axon_model_1952/model.constant.external.py", generator->implementationCode()); } TEST(Generator, hodgkinHuxleySquidAxonModel1952WithConstantsAsExternalVariablesIncludingOneDependingOnTheOther) @@ -1377,16 +1377,16 @@ TEST(Generator, hodgkinHuxleySquidAxonModel1952WithConstantsAsExternalVariablesI auto profile = generator->profile(); - profile->setInterfaceFileNameString("model.dependent.constant.h"); + profile->setInterfaceFileNameString("model.dependent.constant.external.h"); - EXPECT_EQ_FILE_CONTENTS("generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.h", generator->interfaceCode()); - EXPECT_EQ_FILE_CONTENTS("generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.c", generator->implementationCode()); + EXPECT_EQ_FILE_CONTENTS("generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.external.h", generator->interfaceCode()); + EXPECT_EQ_FILE_CONTENTS("generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.external.c", generator->implementationCode()); profile = libcellml::GeneratorProfile::create(libcellml::GeneratorProfile::Profile::PYTHON); generator->setProfile(profile); - EXPECT_EQ_FILE_CONTENTS("generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.py", generator->implementationCode()); + EXPECT_EQ_FILE_CONTENTS("generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.external.py", generator->implementationCode()); } TEST(Generator, hodgkinHuxleySquidAxonModel1952WithComputedConstantAsExternalVariable) @@ -1414,16 +1414,16 @@ TEST(Generator, hodgkinHuxleySquidAxonModel1952WithComputedConstantAsExternalVar auto profile = generator->profile(); - profile->setInterfaceFileNameString("model.computed.constant.h"); + profile->setInterfaceFileNameString("model.computed.constant.external.h"); - EXPECT_EQ_FILE_CONTENTS("generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.h", generator->interfaceCode()); - EXPECT_EQ_FILE_CONTENTS("generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.c", generator->implementationCode()); + EXPECT_EQ_FILE_CONTENTS("generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.external.h", generator->interfaceCode()); + EXPECT_EQ_FILE_CONTENTS("generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.external.c", generator->implementationCode()); profile = libcellml::GeneratorProfile::create(libcellml::GeneratorProfile::Profile::PYTHON); generator->setProfile(profile); - EXPECT_EQ_FILE_CONTENTS("generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.py", generator->implementationCode()); + EXPECT_EQ_FILE_CONTENTS("generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.external.py", generator->implementationCode()); } TEST(Generator, hodgkinHuxleySquidAxonModel1952WithComputedConstantsAsExternalVariablesIncludingOneDependingOnTheOther) @@ -1457,16 +1457,16 @@ TEST(Generator, hodgkinHuxleySquidAxonModel1952WithComputedConstantsAsExternalVa auto profile = generator->profile(); - profile->setInterfaceFileNameString("model.dependent.computed.constant.h"); + profile->setInterfaceFileNameString("model.dependent.computed.constant.external.h"); - EXPECT_EQ_FILE_CONTENTS("generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.h", generator->interfaceCode()); - EXPECT_EQ_FILE_CONTENTS("generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.c", generator->implementationCode()); + EXPECT_EQ_FILE_CONTENTS("generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.external.h", generator->interfaceCode()); + EXPECT_EQ_FILE_CONTENTS("generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.external.c", generator->implementationCode()); profile = libcellml::GeneratorProfile::create(libcellml::GeneratorProfile::Profile::PYTHON); generator->setProfile(profile); - EXPECT_EQ_FILE_CONTENTS("generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.py", generator->implementationCode()); + EXPECT_EQ_FILE_CONTENTS("generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.external.py", generator->implementationCode()); } TEST(Generator, hodgkinHuxleySquidAxonModel1952WithAlgebraicVariableAsExternalVariable) @@ -1494,16 +1494,16 @@ TEST(Generator, hodgkinHuxleySquidAxonModel1952WithAlgebraicVariableAsExternalVa auto profile = generator->profile(); - profile->setInterfaceFileNameString("model.algebraic.h"); + profile->setInterfaceFileNameString("model.algebraic.external.h"); - EXPECT_EQ_FILE_CONTENTS("generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.h", generator->interfaceCode()); - EXPECT_EQ_FILE_CONTENTS("generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.c", generator->implementationCode()); + EXPECT_EQ_FILE_CONTENTS("generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.external.h", generator->interfaceCode()); + EXPECT_EQ_FILE_CONTENTS("generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.external.c", generator->implementationCode()); profile = libcellml::GeneratorProfile::create(libcellml::GeneratorProfile::Profile::PYTHON); generator->setProfile(profile); - EXPECT_EQ_FILE_CONTENTS("generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.py", generator->implementationCode()); + EXPECT_EQ_FILE_CONTENTS("generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.external.py", generator->implementationCode()); } TEST(Generator, hodgkinHuxleySquidAxonModel1952WithAlgebraicVariablesAsExternalVariablesIncludingOneDependingOnTheOther) @@ -1537,16 +1537,16 @@ TEST(Generator, hodgkinHuxleySquidAxonModel1952WithAlgebraicVariablesAsExternalV auto profile = generator->profile(); - profile->setInterfaceFileNameString("model.dependent.algebraic.h"); + profile->setInterfaceFileNameString("model.dependent.algebraic.external.h"); - EXPECT_EQ_FILE_CONTENTS("generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.h", generator->interfaceCode()); - EXPECT_EQ_FILE_CONTENTS("generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.c", generator->implementationCode()); + EXPECT_EQ_FILE_CONTENTS("generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.external.h", generator->interfaceCode()); + EXPECT_EQ_FILE_CONTENTS("generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.external.c", generator->implementationCode()); profile = libcellml::GeneratorProfile::create(libcellml::GeneratorProfile::Profile::PYTHON); generator->setProfile(profile); - EXPECT_EQ_FILE_CONTENTS("generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.py", generator->implementationCode()); + EXPECT_EQ_FILE_CONTENTS("generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.external.py", generator->implementationCode()); } TEST(Generator, hodgkinHuxleySquidAxonModel1952WithVariousExternalVariables) @@ -1972,6 +1972,9 @@ TEST(Generator, modelWithComplexUnitsOutOfScope) generator->setModel(analyserModel); + EXPECT_EQ_FILE_CONTENTS("generator/cellml_slc_example/model.h", generator->interfaceCode()); + EXPECT_EQ_FILE_CONTENTS("generator/cellml_slc_example/model.c", generator->implementationCode()); + auto profile = libcellml::GeneratorProfile::create(libcellml::GeneratorProfile::Profile::PYTHON); generator->setProfile(profile); diff --git a/tests/generator/generatorprofile.cpp b/tests/generator/generatorprofile.cpp index 1b8071fbf8..4339294f9e 100644 --- a/tests/generator/generatorprofile.cpp +++ b/tests/generator/generatorprofile.cpp @@ -88,8 +88,8 @@ TEST(GeneratorProfile, defaultArithmeticOperatorValues) EXPECT_EQ("log10", generatorProfile->commonLogarithmString()); EXPECT_EQ("ceil", generatorProfile->ceilingString()); EXPECT_EQ("floor", generatorProfile->floorString()); - EXPECT_EQ("min", generatorProfile->minString()); - EXPECT_EQ("max", generatorProfile->maxString()); + EXPECT_EQ("fmin", generatorProfile->minString()); + EXPECT_EQ("fmax", generatorProfile->maxString()); EXPECT_EQ("fmod", generatorProfile->remString()); EXPECT_EQ(false, generatorProfile->hasPowerOperator()); @@ -167,16 +167,8 @@ TEST(GeneratorProfile, defaultArithmeticFunctionValues) "}\n", generatorProfile->xorFunctionString()); EXPECT_EQ("", generatorProfile->notFunctionString()); - EXPECT_EQ("double min(double x, double y)\n" - "{\n" - " return (x < y)?x:y;\n" - "}\n", - generatorProfile->minFunctionString()); - EXPECT_EQ("double max(double x, double y)\n" - "{\n" - " return (x > y)?x:y;\n" - "}\n", - generatorProfile->maxFunctionString()); + EXPECT_EQ("", generatorProfile->minFunctionString()); + EXPECT_EQ("", generatorProfile->maxFunctionString()); } TEST(GeneratorProfile, defaultTrigonometricFunctionValues) @@ -230,23 +222,17 @@ TEST(GeneratorProfile, defaultTrigonometricFunctionValues) generatorProfile->acotFunctionString()); EXPECT_EQ("double asech(double x)\n" "{\n" - " double oneOverX = 1.0/x;\n" - "\n" - " return log(oneOverX+sqrt(oneOverX*oneOverX-1.0));\n" + " return acosh(1.0/x);\n" "}\n", generatorProfile->asechFunctionString()); EXPECT_EQ("double acsch(double x)\n" "{\n" - " double oneOverX = 1.0/x;\n" - "\n" - " return log(oneOverX+sqrt(oneOverX*oneOverX+1.0));\n" + " return asinh(1.0/x);\n" "}\n", generatorProfile->acschFunctionString()); EXPECT_EQ("double acoth(double x)\n" "{\n" - " double oneOverX = 1.0/x;\n" - "\n" - " return 0.5*log((1.0+oneOverX)/(1.0-oneOverX));\n" + " return atanh(1.0/x);\n" "}\n", generatorProfile->acothFunctionString()); } diff --git a/tests/resources/coverage/generator/model.c b/tests/resources/coverage/generator/model.c index b168f71788..dfefa277a5 100644 --- a/tests/resources/coverage/generator/model.c +++ b/tests/resources/coverage/generator/model.c @@ -10,8 +10,8 @@ const char LIBCELLML_VERSION[] = "0.6.0"; const size_t STATE_COUNT = 1; const size_t CONSTANT_COUNT = 7; -const size_t COMPUTED_CONSTANT_COUNT = 199; -const size_t ALGEBRAIC_COUNT = 2; +const size_t COMPUTED_CONSTANT_COUNT = 207; +const size_t ALGEBRAIC_COUNT = 5; const size_t EXTERNAL_COUNT = 1; const VariableInfo VOI_INFO = {"t", "second", "my_component"}; @@ -59,8 +59,6 @@ const VariableInfo COMPUTED_CONSTANT_INFO[] = { {"eqnAndParenthesesRightPower", "dimensionless", "my_component"}, {"eqnAndParenthesesRightRoot", "dimensionless", "my_component"}, {"eqnAndCoverageParentheses", "dimensionless", "my_component"}, - {"eqnOr", "dimensionless", "my_component"}, - {"eqnOrMultiple", "dimensionless", "my_component"}, {"eqnOrParentheses", "dimensionless", "my_component"}, {"eqnOrParenthesesLeftPlusWith", "dimensionless", "my_component"}, {"eqnOrParenthesesLeftPlusWithout", "dimensionless", "my_component"}, @@ -90,7 +88,6 @@ const VariableInfo COMPUTED_CONSTANT_INFO[] = { {"eqnXorParenthesesRightMinusWithout", "dimensionless", "my_component"}, {"eqnXorParenthesesRightPower", "dimensionless", "my_component"}, {"eqnXorParenthesesRightRoot", "dimensionless", "my_component"}, - {"eqnXorCoverageParentheses", "dimensionless", "my_component"}, {"eqnNot", "dimensionless", "my_component"}, {"eqnPlusMultiple", "dimensionless", "my_component"}, {"eqnPlusParentheses", "dimensionless", "my_component"}, @@ -147,6 +144,7 @@ const VariableInfo COMPUTED_CONSTANT_INFO[] = { {"eqnPowerParenthesesRightRoot", "dimensionless", "my_component"}, {"eqnRootSqrt", "dimensionless", "my_component"}, {"eqnRootSqrtOther", "dimensionless", "my_component"}, + {"eqnRootSqr", "dimensionless", "my_component"}, {"eqnRootCube", "dimensionless", "my_component"}, {"eqnRootCi", "dimensionless", "my_component"}, {"eqnRootParentheses", "dimensionless", "my_component"}, @@ -202,11 +200,16 @@ const VariableInfo COMPUTED_CONSTANT_INFO[] = { {"eqnArcsech", "dimensionless", "my_component"}, {"eqnArccsch", "dimensionless", "my_component"}, {"eqnArccoth", "dimensionless", "my_component"}, + {"eqnPiecewise", "dimensionless", "my_component"}, {"eqnPiecewisePiece", "dimensionless", "my_component"}, + {"eqnPiecewisePiece2", "dimensionless", "my_component"}, + {"eqnPiecewiseOtherwise", "dimensionless", "my_component"}, {"eqnPiecewisePieceOtherwise", "dimensionless", "my_component"}, {"eqnPiecewisePiecePiecePiece", "dimensionless", "my_component"}, + {"eqnPiecewisePiecePiecePiece2", "dimensionless", "my_component"}, {"eqnPiecewisePiecePiecePieceOtherwise", "dimensionless", "my_component"}, {"eqnWithPiecewise", "dimensionless", "my_component"}, + {"eqnWithPiecewise2", "dimensionless", "my_component"}, {"eqnCnInteger", "dimensionless", "my_component"}, {"eqnCnDouble", "dimensionless", "my_component"}, {"eqnCnIntegerWithExponent", "dimensionless", "my_component"}, @@ -219,20 +222,28 @@ const VariableInfo COMPUTED_CONSTANT_INFO[] = { {"eqnInfinity", "dimensionless", "my_component"}, {"eqnNotanumber", "dimensionless", "my_component"}, {"eqnCoverageForPlusOperator", "dimensionless", "my_component"}, + {"eqnCoverageForPlusOperator2", "dimensionless", "my_component"}, {"eqnCoverageForMinusOperator", "dimensionless", "my_component"}, + {"eqnCoverageForMinusOperator2", "dimensionless", "my_component"}, {"eqnCoverageForTimesOperator", "dimensionless", "my_component"}, + {"eqnCoverageForTimesOperator2", "dimensionless", "my_component"}, {"eqnCoverageForDivideOperator", "dimensionless", "my_component"}, + {"eqnCoverageForDivideOperator2", "dimensionless", "my_component"}, {"eqnCoverageForAndOperator", "dimensionless", "my_component"}, {"eqnCoverageForOrOperator", "dimensionless", "my_component"}, {"eqnCoverageForXorOperator", "dimensionless", "my_component"}, {"eqnCoverageForPowerOperator", "dimensionless", "my_component"}, {"eqnCoverageForRootOperator", "dimensionless", "my_component"}, {"eqnCoverageForMinusUnary", "dimensionless", "my_component"}, + {"eqnCoverageForMinusUnary2", "dimensionless", "my_component"}, {"eqnComputedConstant1", "dimensionless", "my_component"}, {"eqnComputedConstant2", "dimensionless", "my_component"} }; const VariableInfo ALGEBRAIC_INFO[] = { + {"eqnOr", "dimensionless", "my_component"}, + {"eqnOrMultiple", "dimensionless", "my_component"}, + {"eqnXorCoverageParentheses", "dimensionless", "my_component"}, {"eqnNlaVariable1", "dimensionless", "my_component"}, {"eqnNlaVariable2", "dimensionless", "my_component"} }; @@ -246,16 +257,6 @@ double xor(double x, double y) return (x != 0.0) ^ (y != 0.0); } -double min(double x, double y) -{ - return (x < y)?x:y; -} - -double max(double x, double y) -{ - return (x > y)?x:y; -} - double sec(double x) { return 1.0/cos(x); @@ -303,23 +304,17 @@ double acot(double x) double asech(double x) { - double oneOverX = 1.0/x; - - return log(oneOverX+sqrt(oneOverX*oneOverX-1.0)); + return acosh(1.0/x); } double acsch(double x) { - double oneOverX = 1.0/x; - - return log(oneOverX+sqrt(oneOverX*oneOverX+1.0)); + return asinh(1.0/x); } double acoth(double x) { - double oneOverX = 1.0/x; - - return 0.5*log((1.0+oneOverX)/(1.0-oneOverX)); + return atanh(1.0/x); } double * createStatesArray() @@ -405,11 +400,11 @@ void objectiveFunction0(double *u, double *f, void *data) double *algebraic = ((RootFindingInfo *) data)->algebraic; double *externals = ((RootFindingInfo *) data)->externals; - algebraic[0] = u[0]; - algebraic[1] = u[1]; + algebraic[3] = u[0]; + algebraic[4] = u[1]; - f[0] = algebraic[0]+algebraic[1]+states[0]-0.0; - f[1] = algebraic[0]-algebraic[1]-(computedConstants[197]+computedConstants[198]); + f[0] = algebraic[3]+algebraic[4]+states[0]-0.0; + f[1] = algebraic[3]-algebraic[4]-(computedConstants[205]+computedConstants[206]); } void findRoot0(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, double *externals) @@ -417,13 +412,13 @@ void findRoot0(double voi, double *states, double *rates, double *constants, dou RootFindingInfo rfi = { voi, states, rates, constants, computedConstants, algebraic, externals }; double u[2]; - u[0] = algebraic[0]; - u[1] = algebraic[1]; + u[0] = algebraic[3]; + u[1] = algebraic[4]; nlaSolve(objectiveFunction0, u, 2, &rfi); - algebraic[0] = u[0]; - algebraic[1] = u[1]; + algebraic[3] = u[0]; + algebraic[4] = u[1]; } void initialiseVariables(double *states, double *rates, double *constants, double *computedConstants, double *algebraic) @@ -436,20 +431,21 @@ void initialiseVariables(double *states, double *rates, double *constants, doubl constants[4] = 5.0; constants[5] = 6.0; constants[6] = 7.0; - computedConstants[176] = 123.0; - computedConstants[177] = 123.456789; - computedConstants[178] = 123.0e99; - computedConstants[179] = 123.456789e99; - computedConstants[181] = 1.0; - computedConstants[182] = 0.0; - computedConstants[183] = 2.71828182845905; - computedConstants[184] = 3.14159265358979; - computedConstants[185] = INFINITY; - computedConstants[186] = NAN; - computedConstants[197] = 1.0; - computedConstants[198] = 3.0; - algebraic[0] = 1.0; - algebraic[1] = 2.0; + computedConstants[169] = NAN; + computedConstants[179] = 123.0; + computedConstants[180] = 123.456789; + computedConstants[181] = 123.0e99; + computedConstants[182] = 123.456789e99; + computedConstants[184] = 1.0; + computedConstants[185] = 0.0; + computedConstants[186] = 2.71828182845905; + computedConstants[187] = 3.14159265358979; + computedConstants[188] = INFINITY; + computedConstants[189] = NAN; + computedConstants[205] = 1.0; + computedConstants[206] = 3.0; + algebraic[3] = 1.0; + algebraic[4] = 2.0; } void computeComputedConstants(double *constants, double *computedConstants) @@ -463,9 +459,9 @@ void computeComputedConstants(double *constants, double *computedConstants) computedConstants[6] = constants[0] <= constants[1]; computedConstants[7] = constants[0]/(constants[1] <= constants[2]); computedConstants[8] = constants[0] > constants[1]; - computedConstants[9] = constants[0]/(constants[1] > constants[2]); + computedConstants[9] = constants[0]/(constants[2] > constants[1]); computedConstants[10] = constants[0] >= constants[1]; - computedConstants[11] = constants[0]/(constants[1] >= constants[2]); + computedConstants[11] = constants[0]/(constants[2] >= constants[1]); computedConstants[12] = constants[0] && constants[1]; computedConstants[13] = constants[0] && constants[1] && constants[2]; computedConstants[14] = (constants[0] < constants[1]) && (constants[2] > constants[3]); @@ -482,165 +478,172 @@ void computeComputedConstants(double *constants, double *computedConstants) computedConstants[25] = (constants[0] < constants[1]) && pow(constants[2], constants[3]); computedConstants[26] = (constants[0] < constants[1]) && pow(constants[2], 1.0/constants[3]); computedConstants[27] = constants[0]/(constants[1] && constants[2]); - computedConstants[28] = constants[0] || constants[1]; - computedConstants[29] = constants[0] || constants[1] || constants[2]; - computedConstants[30] = (constants[0] < constants[1]) || (constants[2] > constants[3]); - computedConstants[31] = (constants[0]+constants[1]) || (constants[2] > constants[3]); - computedConstants[32] = constants[0] || (constants[1] > constants[2]); - computedConstants[33] = (constants[0]-constants[1]) || (constants[2] > constants[3]); - computedConstants[34] = -constants[0] || (constants[1] > constants[2]); - computedConstants[35] = pow(constants[0], constants[1]) || (constants[2] > constants[3]); - computedConstants[36] = pow(constants[0], 1.0/constants[1]) || (constants[2] > constants[3]); - computedConstants[37] = (constants[0] < constants[1]) || (constants[2]+constants[3]); - computedConstants[38] = (constants[0] < constants[1]) || constants[2]; - computedConstants[39] = (constants[0] < constants[1]) || (constants[2]-constants[3]); - computedConstants[40] = (constants[0] < constants[1]) || -constants[2]; - computedConstants[41] = (constants[0] < constants[1]) || pow(constants[2], constants[3]); - computedConstants[42] = (constants[0] < constants[1]) || pow(constants[2], 1.0/constants[3]); - computedConstants[43] = constants[0]/(constants[1] || constants[2]); - computedConstants[44] = xor(constants[0], constants[1]); - computedConstants[45] = xor(constants[0], xor(constants[1], constants[2])); - computedConstants[46] = xor(constants[0] < constants[1], constants[2] > constants[3]); - computedConstants[47] = xor(constants[0]+constants[1], constants[2] > constants[3]); - computedConstants[48] = xor(constants[0], constants[1] > constants[2]); - computedConstants[49] = xor(constants[0]-constants[1], constants[2] > constants[3]); - computedConstants[50] = xor(-constants[0], constants[1] > constants[2]); - computedConstants[51] = xor(pow(constants[0], constants[1]), constants[2] > constants[3]); - computedConstants[52] = xor(pow(constants[0], 1.0/constants[1]), constants[2] > constants[3]); - computedConstants[53] = xor(constants[0] < constants[1], constants[2]+constants[3]); - computedConstants[54] = xor(constants[0] < constants[1], constants[2]); - computedConstants[55] = xor(constants[0] < constants[1], constants[2]-constants[3]); - computedConstants[56] = xor(constants[0] < constants[1], -constants[2]); - computedConstants[57] = xor(constants[0] < constants[1], pow(constants[2], constants[3])); - computedConstants[58] = xor(constants[0] < constants[1], pow(constants[2], 1.0/constants[3])); - computedConstants[59] = constants[0]/xor(constants[1], constants[2]); - computedConstants[60] = !constants[0]; - computedConstants[61] = constants[0]+constants[1]+constants[2]; - computedConstants[62] = (constants[0] < constants[1])+(constants[2] > constants[3]); - computedConstants[63] = constants[0]; - computedConstants[64] = constants[0]-constants[1]; - computedConstants[65] = (constants[0] < constants[1])-(constants[2] > constants[3]); - computedConstants[66] = (constants[0] < constants[1])-(constants[2]+constants[3]); - computedConstants[67] = (constants[0] < constants[1])-constants[2]; - computedConstants[68] = constants[0]-(-constants[1]); - computedConstants[69] = constants[0]-(-constants[1]*constants[2]); - computedConstants[70] = -constants[0]; - computedConstants[71] = -(constants[0] < constants[1]); - computedConstants[72] = constants[0]*constants[1]; - computedConstants[73] = constants[0]*constants[1]*constants[2]; - computedConstants[74] = (constants[0] < constants[1])*(constants[2] > constants[3]); - computedConstants[75] = (constants[0]+constants[1])*(constants[2] > constants[3]); - computedConstants[76] = constants[0]*(constants[1] > constants[2]); - computedConstants[77] = (constants[0]-constants[1])*(constants[2] > constants[3]); - computedConstants[78] = -constants[0]*(constants[1] > constants[2]); - computedConstants[79] = (constants[0] < constants[1])*(constants[2]+constants[3]); - computedConstants[80] = (constants[0] < constants[1])*constants[2]; - computedConstants[81] = (constants[0] < constants[1])*(constants[2]-constants[3]); - computedConstants[82] = (constants[0] < constants[1])*-constants[2]; - computedConstants[83] = constants[0]/constants[1]; - computedConstants[84] = (constants[0] < constants[1])/(constants[3] > constants[2]); - computedConstants[85] = (constants[0]+constants[1])/(constants[3] > constants[2]); - computedConstants[86] = constants[0]/(constants[2] > constants[1]); - computedConstants[87] = (constants[0]-constants[1])/(constants[3] > constants[2]); - computedConstants[88] = -constants[0]/(constants[2] > constants[1]); - computedConstants[89] = (constants[0] < constants[1])/(constants[2]+constants[3]); - computedConstants[90] = (constants[0] < constants[1])/constants[2]; - computedConstants[91] = (constants[0] < constants[1])/(constants[2]-constants[3]); - computedConstants[92] = (constants[0] < constants[1])/-constants[2]; - computedConstants[93] = (constants[0] < constants[1])/(constants[2]*constants[3]); - computedConstants[94] = (constants[0] < constants[1])/(constants[2]/constants[3]); - computedConstants[95] = sqrt(constants[0]); - computedConstants[96] = pow(constants[0], 2.0); - computedConstants[97] = pow(constants[0], 3.0); - computedConstants[98] = pow(constants[0], constants[1]); - computedConstants[99] = pow(constants[0] <= constants[1], constants[2] >= constants[3]); - computedConstants[100] = pow(constants[0]+constants[1], constants[2] >= constants[3]); - computedConstants[101] = pow(constants[0], constants[1] >= constants[2]); - computedConstants[102] = pow(constants[0]-constants[1], constants[2] >= constants[3]); - computedConstants[103] = pow(-constants[0], constants[1] >= constants[2]); - computedConstants[104] = pow(constants[0]*constants[1], constants[2] >= constants[3]); - computedConstants[105] = pow(constants[0]/constants[1], constants[2] >= constants[3]); - computedConstants[106] = pow(constants[0] <= constants[1], constants[2]+constants[3]); - computedConstants[107] = pow(constants[0] <= constants[1], constants[2]); - computedConstants[108] = pow(constants[0] <= constants[1], constants[2]-constants[3]); - computedConstants[109] = pow(constants[0] <= constants[1], -constants[2]); - computedConstants[110] = pow(constants[0] <= constants[1], constants[2]*constants[3]); - computedConstants[111] = pow(constants[0] <= constants[1], constants[2]/constants[3]); - computedConstants[112] = pow(constants[0] <= constants[1], pow(constants[2], constants[3])); - computedConstants[113] = pow(constants[0] <= constants[1], pow(constants[2], 1.0/constants[3])); - computedConstants[114] = sqrt(constants[0]); - computedConstants[115] = sqrt(constants[0]); - computedConstants[116] = pow(constants[0], 1.0/3.0); - computedConstants[117] = pow(constants[0], 1.0/constants[1]); - computedConstants[118] = pow(constants[0] < constants[1], 1.0/(constants[3] > constants[2])); - computedConstants[119] = pow(constants[0]+constants[1], 1.0/(constants[3] > constants[2])); - computedConstants[120] = pow(constants[0], 1.0/(constants[2] > constants[1])); - computedConstants[121] = pow(constants[0]-constants[1], 1.0/(constants[3] > constants[2])); - computedConstants[122] = pow(-constants[0], 1.0/(constants[2] > constants[1])); - computedConstants[123] = pow(constants[0]*constants[1], 1.0/(constants[3] > constants[2])); - computedConstants[124] = pow(constants[0]/constants[1], 1.0/(constants[3] > constants[2])); - computedConstants[125] = pow(constants[0] < constants[1], 1.0/(constants[2]+constants[3])); - computedConstants[126] = pow(constants[0] < constants[1], 1.0/constants[2]); - computedConstants[127] = pow(constants[0] < constants[1], 1.0/(constants[2]-constants[3])); - computedConstants[128] = pow(constants[0] < constants[1], 1.0/-constants[2]); - computedConstants[129] = pow(constants[0] < constants[1], 1.0/(constants[2]*constants[3])); - computedConstants[130] = pow(constants[0] < constants[1], 1.0/(constants[2]/constants[3])); - computedConstants[131] = pow(constants[0] < constants[1], 1.0/pow(constants[2], constants[3])); - computedConstants[132] = pow(constants[0] < constants[1], 1.0/pow(constants[2], 1.0/constants[3])); - computedConstants[133] = fabs(constants[0]); - computedConstants[134] = exp(constants[0]); - computedConstants[135] = log(constants[0]); + computedConstants[28] = (constants[0] < constants[1]) || (constants[2] > constants[3]); + computedConstants[29] = (constants[0]+constants[1]) || (constants[2] > constants[3]); + computedConstants[30] = constants[0] || (constants[1] > constants[2]); + computedConstants[31] = (constants[0]-constants[1]) || (constants[2] > constants[3]); + computedConstants[32] = -constants[0] || (constants[1] > constants[2]); + computedConstants[33] = pow(constants[0], constants[1]) || (constants[2] > constants[3]); + computedConstants[34] = pow(constants[0], 1.0/constants[1]) || (constants[2] > constants[3]); + computedConstants[35] = (constants[0] < constants[1]) || (constants[2]+constants[3]); + computedConstants[36] = (constants[0] < constants[1]) || constants[2]; + computedConstants[37] = (constants[0] < constants[1]) || (constants[2]-constants[3]); + computedConstants[38] = (constants[0] < constants[1]) || -constants[2]; + computedConstants[39] = (constants[0] < constants[1]) || pow(constants[2], constants[3]); + computedConstants[40] = (constants[0] < constants[1]) || pow(constants[2], 1.0/constants[3]); + computedConstants[41] = constants[0]/(constants[1] || constants[2]); + computedConstants[42] = xor(constants[0], constants[1]); + computedConstants[43] = xor(constants[0], xor(constants[1], constants[2])); + computedConstants[44] = xor(constants[0] < constants[1], constants[2] > constants[3]); + computedConstants[45] = xor(constants[0]+constants[1], constants[2] > constants[3]); + computedConstants[46] = xor(constants[0], constants[1] > constants[2]); + computedConstants[47] = xor(constants[0]-constants[1], constants[2] > constants[3]); + computedConstants[48] = xor(-constants[0], constants[1] > constants[2]); + computedConstants[49] = xor(pow(constants[0], constants[1]), constants[2] > constants[3]); + computedConstants[50] = xor(pow(constants[0], 1.0/constants[1]), constants[2] > constants[3]); + computedConstants[51] = xor(constants[0] < constants[1], constants[2]+constants[3]); + computedConstants[52] = xor(constants[0] < constants[1], constants[2]); + computedConstants[53] = xor(constants[0] < constants[1], constants[2]-constants[3]); + computedConstants[54] = xor(constants[0] < constants[1], -constants[2]); + computedConstants[55] = xor(constants[0] < constants[1], pow(constants[2], constants[3])); + computedConstants[56] = xor(constants[0] < constants[1], pow(constants[2], 1.0/constants[3])); + computedConstants[57] = !constants[0]; + computedConstants[58] = constants[0]+constants[1]+constants[2]; + computedConstants[59] = (constants[0] < constants[1])+(constants[2] > constants[3]); + computedConstants[60] = constants[0]; + computedConstants[61] = constants[0]-constants[1]; + computedConstants[62] = (constants[0] < constants[1])-(constants[2] > constants[3]); + computedConstants[63] = (constants[0] < constants[1])-(constants[2]+constants[3]); + computedConstants[64] = (constants[0] < constants[1])-constants[2]; + computedConstants[65] = constants[0]-(-constants[1]); + computedConstants[66] = constants[0]-(-constants[1]*constants[2]); + computedConstants[67] = -constants[0]; + computedConstants[68] = -(constants[0] < constants[1]); + computedConstants[69] = constants[0]*constants[1]; + computedConstants[70] = constants[0]*constants[1]*constants[2]; + computedConstants[71] = (constants[0] < constants[1])*(constants[2] > constants[3]); + computedConstants[72] = (constants[0]+constants[1])*(constants[2] > constants[3]); + computedConstants[73] = constants[0]*(constants[1] > constants[2]); + computedConstants[74] = (constants[0]-constants[1])*(constants[2] > constants[3]); + computedConstants[75] = -constants[0]*(constants[1] > constants[2]); + computedConstants[76] = (constants[0] < constants[1])*(constants[2]+constants[3]); + computedConstants[77] = (constants[0] < constants[1])*constants[2]; + computedConstants[78] = (constants[0] < constants[1])*(constants[2]-constants[3]); + computedConstants[79] = (constants[0] < constants[1])*-constants[2]; + computedConstants[80] = constants[0]/constants[1]; + computedConstants[81] = (constants[0] < constants[1])/(constants[3] > constants[2]); + computedConstants[82] = (constants[0]+constants[1])/(constants[3] > constants[2]); + computedConstants[83] = constants[0]/(constants[2] > constants[1]); + computedConstants[84] = (constants[0]-constants[1])/(constants[3] > constants[2]); + computedConstants[85] = -constants[0]/(constants[2] > constants[1]); + computedConstants[86] = (constants[0] < constants[1])/(constants[2]+constants[3]); + computedConstants[87] = (constants[0] < constants[1])/constants[2]; + computedConstants[88] = (constants[0] < constants[1])/(constants[2]-constants[3]); + computedConstants[89] = (constants[0] < constants[1])/-constants[2]; + computedConstants[90] = (constants[0] < constants[1])/(constants[2]*constants[3]); + computedConstants[91] = (constants[0] < constants[1])/(constants[2]/constants[3]); + computedConstants[92] = sqrt(constants[0]); + computedConstants[93] = pow(constants[0], 2.0); + computedConstants[94] = pow(constants[0], 3.0); + computedConstants[95] = pow(constants[0], constants[1]); + computedConstants[96] = pow(constants[0] <= constants[1], constants[2] >= constants[3]); + computedConstants[97] = pow(constants[0]+constants[1], constants[2] >= constants[3]); + computedConstants[98] = pow(constants[0], constants[1] >= constants[2]); + computedConstants[99] = pow(constants[0]-constants[1], constants[2] >= constants[3]); + computedConstants[100] = pow(-constants[0], constants[1] >= constants[2]); + computedConstants[101] = pow(constants[0]*constants[1], constants[2] >= constants[3]); + computedConstants[102] = pow(constants[0]/constants[1], constants[2] >= constants[3]); + computedConstants[103] = pow(constants[0] <= constants[1], constants[2]+constants[3]); + computedConstants[104] = pow(constants[0] <= constants[1], constants[2]); + computedConstants[105] = pow(constants[0] <= constants[1], constants[2]-constants[3]); + computedConstants[106] = pow(constants[0] <= constants[1], -constants[2]); + computedConstants[107] = pow(constants[0] <= constants[1], constants[2]*constants[3]); + computedConstants[108] = pow(constants[0] <= constants[1], constants[2]/constants[3]); + computedConstants[109] = pow(constants[0] <= constants[1], pow(constants[2], constants[3])); + computedConstants[110] = pow(constants[0] <= constants[1], pow(constants[2], 1.0/constants[3])); + computedConstants[111] = sqrt(constants[0]); + computedConstants[112] = sqrt(constants[0]); + computedConstants[113] = pow(constants[0], 1.0/0.5); + computedConstants[114] = pow(constants[0], 1.0/3.0); + computedConstants[115] = pow(constants[0], 1.0/constants[1]); + computedConstants[116] = pow(constants[0] < constants[1], 1.0/(constants[3] > constants[2])); + computedConstants[117] = pow(constants[0]+constants[1], 1.0/(constants[3] > constants[2])); + computedConstants[118] = pow(constants[0], 1.0/(constants[2] > constants[1])); + computedConstants[119] = pow(constants[0]-constants[1], 1.0/(constants[3] > constants[2])); + computedConstants[120] = pow(-constants[0], 1.0/(constants[2] > constants[1])); + computedConstants[121] = pow(constants[0]*constants[1], 1.0/(constants[3] > constants[2])); + computedConstants[122] = pow(constants[0]/constants[1], 1.0/(constants[3] > constants[2])); + computedConstants[123] = pow(constants[0] < constants[1], 1.0/(constants[2]+constants[3])); + computedConstants[124] = pow(constants[0] < constants[1], 1.0/constants[2]); + computedConstants[125] = pow(constants[0] < constants[1], 1.0/(constants[2]-constants[3])); + computedConstants[126] = pow(constants[0] < constants[1], 1.0/-constants[2]); + computedConstants[127] = pow(constants[0] < constants[1], 1.0/(constants[2]*constants[3])); + computedConstants[128] = pow(constants[0] < constants[1], 1.0/(constants[2]/constants[3])); + computedConstants[129] = pow(constants[0] < constants[1], 1.0/pow(constants[2], constants[3])); + computedConstants[130] = pow(constants[0] < constants[1], 1.0/pow(constants[2], 1.0/constants[3])); + computedConstants[131] = fabs(constants[0]); + computedConstants[132] = exp(constants[0]); + computedConstants[133] = log(constants[0]); + computedConstants[134] = log10(constants[0]); + computedConstants[135] = log(constants[0])/log(2.0); computedConstants[136] = log10(constants[0]); - computedConstants[137] = log(constants[0])/log(2.0); - computedConstants[138] = log10(constants[0]); - computedConstants[139] = log(constants[0])/log(constants[1]); - computedConstants[140] = ceil(constants[0]); - computedConstants[141] = floor(constants[0]); - computedConstants[142] = min(constants[0], constants[1]); - computedConstants[143] = min(constants[0], min(constants[1], constants[2])); - computedConstants[144] = max(constants[0], constants[1]); - computedConstants[145] = max(constants[0], max(constants[1], constants[2])); - computedConstants[146] = fmod(constants[0], constants[1]); - computedConstants[147] = sin(constants[0]); - computedConstants[148] = cos(constants[0]); - computedConstants[149] = tan(constants[0]); - computedConstants[150] = sec(constants[0]); - computedConstants[151] = csc(constants[0]); - computedConstants[152] = cot(constants[0]); - computedConstants[153] = sinh(constants[0]); - computedConstants[154] = cosh(constants[0]); - computedConstants[155] = tanh(constants[0]); - computedConstants[156] = sech(constants[0]); - computedConstants[157] = csch(constants[0]); - computedConstants[158] = coth(constants[0]); - computedConstants[159] = asin(constants[0]); - computedConstants[160] = acos(constants[0]); - computedConstants[161] = atan(constants[0]); - computedConstants[162] = asec(constants[0]); - computedConstants[163] = acsc(constants[0]); - computedConstants[164] = acot(constants[0]); - computedConstants[165] = asinh(constants[0]); - computedConstants[166] = acosh(constants[0]); - computedConstants[167] = atanh(constants[0]/2.0); - computedConstants[168] = asech(constants[0]); - computedConstants[169] = acsch(constants[0]); - computedConstants[170] = acoth(2.0*constants[0]); - computedConstants[171] = (constants[0] > constants[1])?constants[0]:NAN; - computedConstants[172] = (constants[0] > constants[1])?constants[0]:constants[2]; - computedConstants[173] = (constants[0] > constants[1])?constants[0]:(constants[2] > constants[3])?constants[2]:(constants[4] > constants[5])?constants[4]:NAN; - computedConstants[174] = (constants[0] > constants[1])?constants[0]:(constants[2] > constants[3])?constants[2]:(constants[4] > constants[5])?constants[4]:constants[6]; - computedConstants[175] = 123.0+((constants[0] > constants[1])?constants[0]:NAN); - computedConstants[180] = constants[0]; - computedConstants[187] = (constants[0] && constants[1])+((constants[2] > constants[3])?constants[1]:NAN)+constants[4]+(constants[5] && constants[6]); - computedConstants[188] = (constants[0] && constants[1])-(((constants[2] > constants[3])?constants[1]:NAN)-(constants[4]-((constants[2] > constants[3])?constants[1]:NAN)))-(constants[5] && constants[6]); - computedConstants[189] = (constants[0] && constants[1])*((constants[2] > constants[3])?constants[1]:NAN)*constants[4]*((constants[2] > constants[3])?constants[1]:NAN)*(constants[5] && constants[6]); - computedConstants[190] = (constants[0] && constants[1])/(((constants[2] > constants[3])?constants[1]:NAN)/(constants[4]/((constants[2] > constants[3])?constants[1]:NAN))); - computedConstants[191] = (constants[0] || constants[1]) && xor(constants[0], constants[1]) && ((constants[2] > constants[3])?constants[1]:NAN) && constants[4] && ((constants[2] > constants[3])?constants[1]:NAN) && xor(constants[0], constants[1]) && (constants[0] || constants[1]); - computedConstants[192] = (constants[0] && constants[1]) || xor(constants[0], constants[1]) || ((constants[2] > constants[3])?constants[1]:NAN) || constants[4] || ((constants[2] > constants[3])?constants[1]:NAN) || xor(constants[0], constants[1]) || (constants[0] && constants[1]); - computedConstants[193] = xor(constants[0] && constants[1], xor(constants[0] || constants[1], xor((constants[2] > constants[3])?constants[1]:NAN, xor(xor(xor(constants[4], (constants[2] > constants[3])?constants[1]:NAN), constants[0] || constants[1]), constants[0] && constants[1])))); - computedConstants[194] = pow(constants[0] && constants[1], pow((constants[2] > constants[3])?constants[1]:NAN, pow(pow(constants[4], (constants[2] > constants[3])?constants[1]:NAN), constants[0] && constants[1]))); - computedConstants[195] = pow(pow(pow(constants[0] && constants[1], 1.0/pow((constants[2] > constants[3])?constants[1]:NAN, 1.0/constants[4])), 1.0/((constants[2] > constants[3])?constants[1]:NAN)), 1.0/(constants[0] && constants[1])); - computedConstants[196] = -(constants[0] && constants[1])+-((constants[2] > constants[3])?constants[1]:NAN); + computedConstants[137] = log(constants[0])/log(constants[1]); + computedConstants[138] = ceil(constants[0]); + computedConstants[139] = floor(constants[0]); + computedConstants[140] = fmin(constants[0], constants[1]); + computedConstants[141] = fmin(constants[0], fmin(constants[1], constants[2])); + computedConstants[142] = fmax(constants[0], constants[1]); + computedConstants[143] = fmax(constants[0], fmax(constants[1], constants[2])); + computedConstants[144] = fmod(constants[0], constants[1]); + computedConstants[145] = sin(constants[0]); + computedConstants[146] = cos(constants[0]); + computedConstants[147] = tan(constants[0]); + computedConstants[148] = sec(constants[0]); + computedConstants[149] = csc(constants[0]); + computedConstants[150] = cot(constants[0]); + computedConstants[151] = sinh(constants[0]); + computedConstants[152] = cosh(constants[0]); + computedConstants[153] = tanh(constants[0]); + computedConstants[154] = sech(constants[0]); + computedConstants[155] = csch(constants[0]); + computedConstants[156] = coth(constants[0]); + computedConstants[157] = asin(constants[0]); + computedConstants[158] = acos(constants[0]); + computedConstants[159] = atan(constants[0]); + computedConstants[160] = asec(constants[0]); + computedConstants[161] = acsc(constants[0]); + computedConstants[162] = acot(constants[0]); + computedConstants[163] = asinh(constants[0]); + computedConstants[164] = acosh(constants[0]); + computedConstants[165] = atanh(constants[0]/2.0); + computedConstants[166] = asech(constants[0]); + computedConstants[167] = acsch(constants[0]); + computedConstants[168] = acoth(2.0*constants[0]); + computedConstants[170] = (constants[0] > constants[1])?constants[0]:NAN; + computedConstants[171] = (constants[0] < constants[1])?constants[0]:NAN; + computedConstants[172] = constants[0]; + computedConstants[173] = (constants[0] > constants[1])?constants[0]:constants[2]; + computedConstants[174] = (constants[0] > constants[1])?constants[0]:(constants[2] > constants[3])?constants[2]:(constants[4] > constants[5])?constants[4]:NAN; + computedConstants[175] = (constants[0] < constants[1])?constants[0]:(constants[2] > constants[3])?constants[2]:(constants[4] > constants[5])?constants[4]:NAN; + computedConstants[176] = (constants[0] > constants[1])?constants[0]:(constants[2] > constants[3])?constants[2]:(constants[4] > constants[5])?constants[4]:constants[6]; + computedConstants[177] = 123.0+((constants[0] > constants[1])?constants[0]:NAN); + computedConstants[178] = 123.0+((constants[0] < constants[1])?constants[0]:NAN); + computedConstants[183] = constants[0]; + computedConstants[190] = (constants[0] && constants[1])+((constants[2] > constants[3])?constants[1]:NAN)+constants[4]+(constants[5] && constants[6]); + computedConstants[191] = (constants[0] && constants[1])+((constants[2] < constants[3])?constants[1]:NAN)+constants[4]+(constants[5] && constants[6]); + computedConstants[192] = (constants[0] && constants[1])-(((constants[2] > constants[3])?constants[1]:NAN)-(constants[4]-((constants[2] > constants[3])?constants[1]:NAN)))-(constants[5] && constants[6]); + computedConstants[193] = (constants[0] && constants[1])-(((constants[2] < constants[3])?constants[1]:NAN)-(constants[4]-((constants[2] < constants[3])?constants[1]:NAN)))-(constants[5] && constants[6]); + computedConstants[194] = (constants[0] && constants[1])*((constants[2] > constants[3])?constants[1]:NAN)*constants[4]*((constants[2] > constants[3])?constants[1]:NAN)*(constants[5] && constants[6]); + computedConstants[195] = (constants[0] && constants[1])*((constants[2] < constants[3])?constants[1]:NAN)*constants[4]*((constants[2] < constants[3])?constants[1]:NAN)*(constants[5] && constants[6]); + computedConstants[196] = (constants[0] && constants[1])/(((constants[2] > constants[3])?constants[1]:NAN)/(constants[4]/((constants[2] > constants[3])?constants[1]:NAN))); + computedConstants[197] = (constants[0] && constants[1])/(((constants[2] < constants[3])?constants[1]:NAN)/(constants[4]/((constants[2] < constants[3])?constants[1]:NAN))); + computedConstants[198] = (constants[0] || constants[1]) && xor(constants[0], constants[1]) && ((constants[2] > constants[3])?constants[1]:NAN) && constants[4] && ((constants[2] > constants[3])?constants[1]:NAN) && xor(constants[0], constants[1]) && (constants[0] || constants[1]); + computedConstants[199] = (constants[0] && constants[1]) || xor(constants[0], constants[1]) || ((constants[2] > constants[3])?constants[1]:NAN) || constants[4] || ((constants[2] > constants[3])?constants[1]:NAN) || xor(constants[0], constants[1]) || (constants[0] && constants[1]); + computedConstants[200] = xor(constants[0] && constants[1], xor(constants[0] || constants[1], xor((constants[2] > constants[3])?constants[1]:NAN, xor(xor(xor(constants[4], (constants[2] > constants[3])?constants[1]:NAN), constants[0] || constants[1]), constants[0] && constants[1])))); + computedConstants[201] = pow(constants[0] && constants[1], pow((constants[2] > constants[3])?constants[1]:NAN, pow(pow(constants[4], (constants[2] > constants[3])?constants[1]:NAN), constants[0] && constants[1]))); + computedConstants[202] = pow(pow(pow(constants[0] && constants[1], 1.0/pow((constants[2] > constants[3])?constants[1]:NAN, 1.0/constants[4])), 1.0/((constants[2] > constants[3])?constants[1]:NAN)), 1.0/(constants[0] && constants[1])); + computedConstants[203] = -(constants[0] && constants[1])+-((constants[2] > constants[3])?constants[1]:NAN); + computedConstants[204] = -(constants[0] && constants[1])+-((constants[2] < constants[3])?constants[1]:NAN); } void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, double *externals, ExternalVariable externalVariable) @@ -650,6 +653,9 @@ void computeRates(double voi, double *states, double *rates, double *constants, void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, double *externals, ExternalVariable externalVariable) { + algebraic[0] = states[0] || states[0]; + algebraic[1] = states[0] || states[0] || constants[0]; + algebraic[2] = constants[0]/xor(constants[1], states[0]); externals[0] = externalVariable(voi, states, rates, constants, computedConstants, algebraic, externals, 0); findRoot0(voi, states, rates, constants, computedConstants, algebraic, externals); } diff --git a/tests/resources/coverage/generator/model.cellml b/tests/resources/coverage/generator/model.cellml index 6a2574eed1..9ea2a4e296 100644 --- a/tests/resources/coverage/generator/model.cellml +++ b/tests/resources/coverage/generator/model.cellml @@ -129,6 +129,7 @@ + @@ -184,11 +185,16 @@ + + + + + @@ -201,15 +207,20 @@ + + + + + @@ -349,8 +360,8 @@ m - n o + n @@ -373,8 +384,8 @@ m - n o + n @@ -640,8 +651,8 @@ eqnOr - m - n + x + x @@ -649,9 +660,9 @@ eqnOrMultiple + x + x m - n - o @@ -1139,7 +1150,7 @@ n - o + x @@ -1984,6 +1995,17 @@ m + + + eqnRootSqr + + + + 0.5 + + m + + eqnRootCube @@ -2685,6 +2707,11 @@ + + + eqnPiecewise + + eqnPiecewisePiece @@ -2699,6 +2726,29 @@ + + + eqnPiecewisePiece2 + + + m + + + m + n + + + + + + + eqnPiecewiseOtherwise + + + m + + + eqnPiecewisePieceOtherwise @@ -2746,6 +2796,36 @@ + + + eqnPiecewisePiecePiecePiece2 + + + m + + + m + n + + + + o + + + o + p + + + + q + + + q + r + + + + eqnPiecewisePiecePiecePieceOtherwise @@ -2799,6 +2879,24 @@ + + + eqnWithPiecewise2 + + + 123 + + + m + + + m + n + + + + + @@ -2920,6 +3018,40 @@ + + + eqnCoverageForPlusOperator2 + + + + + + + m + n + + + + + + n + + + o + p + + + + q + + + + + r + s + + + eqnCoverageForMinusOperator @@ -2967,6 +3099,53 @@ + + + eqnCoverageForMinusOperator2 + + + + + + + m + n + + + + + + n + + + o + p + + + + + + q + + + n + + + o + p + + + + + + + + + r + s + + + eqnCoverageForTimesOperator @@ -3014,6 +3193,53 @@ + + + eqnCoverageForTimesOperator2 + + + + + + + m + n + + + + + + n + + + o + p + + + + + + q + + + n + + + o + p + + + + + + + + + r + s + + + eqnCoverageForDivideOperator @@ -3053,6 +3279,45 @@ + + + eqnCoverageForDivideOperator2 + + + + + m + n + + + + + + n + + + o + p + + + + + + q + + + n + + + o + p + + + + + + + eqnCoverageForAndOperator @@ -3372,6 +3637,34 @@ + + + eqnCoverageForMinusUnary2 + + + + + + + m + n + + + + + + + n + + + o + p + + + + + + diff --git a/tests/resources/coverage/generator/model.implementation.out b/tests/resources/coverage/generator/model.implementation.out index 2b2639f4b9..3ba38209d5 100644 --- a/tests/resources/coverage/generator/model.implementation.out +++ b/tests/resources/coverage/generator/model.implementation.out @@ -5,16 +5,6 @@ double xor(double x, double y) return (x != 0.0) ^ (y != 0.0); } -double min(double x, double y) -{ - return (x < y)?x:y; -} - -double max(double x, double y) -{ - return (x > y)?x:y; -} - double sec(double x) { return 1.0/cos(x); @@ -62,23 +52,17 @@ double acot(double x) double asech(double x) { - double oneOverX = 1.0/x; - - return log(oneOverX+sqrt(oneOverX*oneOverX-1.0)); + return acosh(1.0/x); } double acsch(double x) { - double oneOverX = 1.0/x; - - return log(oneOverX+sqrt(oneOverX*oneOverX+1.0)); + return asinh(1.0/x); } double acoth(double x) { - double oneOverX = 1.0/x; - - return 0.5*log((1.0+oneOverX)/(1.0-oneOverX)); + return atanh(1.0/x); } double * createStatesArray() @@ -164,11 +148,11 @@ void objectiveFunction0(double *u, double *f, void *data) double *algebraic = ((RootFindingInfo *) data)->algebraic; double *externals = ((RootFindingInfo *) data)->externals; - algebraic[0] = u[0]; - algebraic[1] = u[1]; + algebraic[3] = u[0]; + algebraic[4] = u[1]; - f[0] = algebraic[0]+algebraic[1]+states[0]-0.0; - f[1] = algebraic[0]-algebraic[1]-(computedConstants[197]+computedConstants[198]); + f[0] = algebraic[3]+algebraic[4]+states[0]-0.0; + f[1] = algebraic[3]-algebraic[4]-(computedConstants[205]+computedConstants[206]); } void findRoot0(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, double *externals) @@ -176,13 +160,13 @@ void findRoot0(double voi, double *states, double *rates, double *constants, dou RootFindingInfo rfi = { voi, states, rates, constants, computedConstants, algebraic, externals }; double u[2]; - u[0] = algebraic[0]; - u[1] = algebraic[1]; + u[0] = algebraic[3]; + u[1] = algebraic[4]; nlaSolve(objectiveFunction0, u, 2, &rfi); - algebraic[0] = u[0]; - algebraic[1] = u[1]; + algebraic[3] = u[0]; + algebraic[4] = u[1]; } void initialiseVariables(double *states, double *rates, double *constants, double *computedConstants, double *algebraic) @@ -195,20 +179,21 @@ void initialiseVariables(double *states, double *rates, double *constants, doubl constants[4] = 5.0; constants[5] = 6.0; constants[6] = 7.0; - computedConstants[176] = 123.0; - computedConstants[177] = 123.456789; - computedConstants[178] = 123.0e99; - computedConstants[179] = 123.456789e99; - computedConstants[181] = 1.0; - computedConstants[182] = 0.0; - computedConstants[183] = 2.71828182845905; - computedConstants[184] = 3.14159265358979; - computedConstants[185] = INFINITY; - computedConstants[186] = NAN; - computedConstants[197] = 1.0; - computedConstants[198] = 3.0; - algebraic[0] = 1.0; - algebraic[1] = 2.0; + computedConstants[169] = NAN; + computedConstants[179] = 123.0; + computedConstants[180] = 123.456789; + computedConstants[181] = 123.0e99; + computedConstants[182] = 123.456789e99; + computedConstants[184] = 1.0; + computedConstants[185] = 0.0; + computedConstants[186] = 2.71828182845905; + computedConstants[187] = 3.14159265358979; + computedConstants[188] = INFINITY; + computedConstants[189] = NAN; + computedConstants[205] = 1.0; + computedConstants[206] = 3.0; + algebraic[3] = 1.0; + algebraic[4] = 2.0; } void computeComputedConstants(double *constants, double *computedConstants) @@ -222,9 +207,9 @@ void computeComputedConstants(double *constants, double *computedConstants) computedConstants[6] = leq(constants[0], constants[1]); computedConstants[7] = constants[0]/leq(constants[1], constants[2]); computedConstants[8] = gt(constants[0], constants[1]); - computedConstants[9] = constants[0]/gt(constants[1], constants[2]); + computedConstants[9] = constants[0]/gt(constants[2], constants[1]); computedConstants[10] = geq(constants[0], constants[1]); - computedConstants[11] = constants[0]/geq(constants[1], constants[2]); + computedConstants[11] = constants[0]/geq(constants[2], constants[1]); computedConstants[12] = and(constants[0], constants[1]); computedConstants[13] = and(constants[0], and(constants[1], constants[2])); computedConstants[14] = and(lt(constants[0], constants[1]), gt(constants[2], constants[3])); @@ -241,165 +226,172 @@ void computeComputedConstants(double *constants, double *computedConstants) computedConstants[25] = and(lt(constants[0], constants[1]), pow(constants[2], constants[3])); computedConstants[26] = and(lt(constants[0], constants[1]), pow(constants[2], 1.0/constants[3])); computedConstants[27] = constants[0]/and(constants[1], constants[2]); - computedConstants[28] = or(constants[0], constants[1]); - computedConstants[29] = or(constants[0], or(constants[1], constants[2])); - computedConstants[30] = or(lt(constants[0], constants[1]), gt(constants[2], constants[3])); - computedConstants[31] = or(constants[0]+constants[1], gt(constants[2], constants[3])); - computedConstants[32] = or(constants[0], gt(constants[1], constants[2])); - computedConstants[33] = or(constants[0]-constants[1], gt(constants[2], constants[3])); - computedConstants[34] = or(-constants[0], gt(constants[1], constants[2])); - computedConstants[35] = or(pow(constants[0], constants[1]), gt(constants[2], constants[3])); - computedConstants[36] = or(pow(constants[0], 1.0/constants[1]), gt(constants[2], constants[3])); - computedConstants[37] = or(lt(constants[0], constants[1]), constants[2]+constants[3]); - computedConstants[38] = or(lt(constants[0], constants[1]), constants[2]); - computedConstants[39] = or(lt(constants[0], constants[1]), constants[2]-constants[3]); - computedConstants[40] = or(lt(constants[0], constants[1]), -constants[2]); - computedConstants[41] = or(lt(constants[0], constants[1]), pow(constants[2], constants[3])); - computedConstants[42] = or(lt(constants[0], constants[1]), pow(constants[2], 1.0/constants[3])); - computedConstants[43] = constants[0]/or(constants[1], constants[2]); - computedConstants[44] = xor(constants[0], constants[1]); - computedConstants[45] = xor(constants[0], xor(constants[1], constants[2])); - computedConstants[46] = xor(lt(constants[0], constants[1]), gt(constants[2], constants[3])); - computedConstants[47] = xor(constants[0]+constants[1], gt(constants[2], constants[3])); - computedConstants[48] = xor(constants[0], gt(constants[1], constants[2])); - computedConstants[49] = xor(constants[0]-constants[1], gt(constants[2], constants[3])); - computedConstants[50] = xor(-constants[0], gt(constants[1], constants[2])); - computedConstants[51] = xor(pow(constants[0], constants[1]), gt(constants[2], constants[3])); - computedConstants[52] = xor(pow(constants[0], 1.0/constants[1]), gt(constants[2], constants[3])); - computedConstants[53] = xor(lt(constants[0], constants[1]), constants[2]+constants[3]); - computedConstants[54] = xor(lt(constants[0], constants[1]), constants[2]); - computedConstants[55] = xor(lt(constants[0], constants[1]), constants[2]-constants[3]); - computedConstants[56] = xor(lt(constants[0], constants[1]), -constants[2]); - computedConstants[57] = xor(lt(constants[0], constants[1]), pow(constants[2], constants[3])); - computedConstants[58] = xor(lt(constants[0], constants[1]), pow(constants[2], 1.0/constants[3])); - computedConstants[59] = constants[0]/xor(constants[1], constants[2]); - computedConstants[60] = not(constants[0]); - computedConstants[61] = constants[0]+constants[1]+constants[2]; - computedConstants[62] = lt(constants[0], constants[1])+gt(constants[2], constants[3]); - computedConstants[63] = constants[0]; - computedConstants[64] = constants[0]-constants[1]; - computedConstants[65] = lt(constants[0], constants[1])-gt(constants[2], constants[3]); - computedConstants[66] = lt(constants[0], constants[1])-(constants[2]+constants[3]); - computedConstants[67] = lt(constants[0], constants[1])-constants[2]; - computedConstants[68] = constants[0]-(-constants[1]); - computedConstants[69] = constants[0]-(-constants[1]*constants[2]); - computedConstants[70] = -constants[0]; - computedConstants[71] = -lt(constants[0], constants[1]); - computedConstants[72] = constants[0]*constants[1]; - computedConstants[73] = constants[0]*constants[1]*constants[2]; - computedConstants[74] = lt(constants[0], constants[1])*gt(constants[2], constants[3]); - computedConstants[75] = (constants[0]+constants[1])*gt(constants[2], constants[3]); - computedConstants[76] = constants[0]*gt(constants[1], constants[2]); - computedConstants[77] = (constants[0]-constants[1])*gt(constants[2], constants[3]); - computedConstants[78] = -constants[0]*gt(constants[1], constants[2]); - computedConstants[79] = lt(constants[0], constants[1])*(constants[2]+constants[3]); - computedConstants[80] = lt(constants[0], constants[1])*constants[2]; - computedConstants[81] = lt(constants[0], constants[1])*(constants[2]-constants[3]); - computedConstants[82] = lt(constants[0], constants[1])*-constants[2]; - computedConstants[83] = constants[0]/constants[1]; - computedConstants[84] = lt(constants[0], constants[1])/gt(constants[3], constants[2]); - computedConstants[85] = (constants[0]+constants[1])/gt(constants[3], constants[2]); - computedConstants[86] = constants[0]/gt(constants[2], constants[1]); - computedConstants[87] = (constants[0]-constants[1])/gt(constants[3], constants[2]); - computedConstants[88] = -constants[0]/gt(constants[2], constants[1]); - computedConstants[89] = lt(constants[0], constants[1])/(constants[2]+constants[3]); - computedConstants[90] = lt(constants[0], constants[1])/constants[2]; - computedConstants[91] = lt(constants[0], constants[1])/(constants[2]-constants[3]); - computedConstants[92] = lt(constants[0], constants[1])/-constants[2]; - computedConstants[93] = lt(constants[0], constants[1])/(constants[2]*constants[3]); - computedConstants[94] = lt(constants[0], constants[1])/(constants[2]/constants[3]); - computedConstants[95] = sqrt(constants[0]); - computedConstants[96] = pow(constants[0], 2.0); - computedConstants[97] = pow(constants[0], 3.0); - computedConstants[98] = pow(constants[0], constants[1]); - computedConstants[99] = pow(leq(constants[0], constants[1]), geq(constants[2], constants[3])); - computedConstants[100] = pow(constants[0]+constants[1], geq(constants[2], constants[3])); - computedConstants[101] = pow(constants[0], geq(constants[1], constants[2])); - computedConstants[102] = pow(constants[0]-constants[1], geq(constants[2], constants[3])); - computedConstants[103] = pow(-constants[0], geq(constants[1], constants[2])); - computedConstants[104] = pow(constants[0]*constants[1], geq(constants[2], constants[3])); - computedConstants[105] = pow(constants[0]/constants[1], geq(constants[2], constants[3])); - computedConstants[106] = pow(leq(constants[0], constants[1]), constants[2]+constants[3]); - computedConstants[107] = pow(leq(constants[0], constants[1]), constants[2]); - computedConstants[108] = pow(leq(constants[0], constants[1]), constants[2]-constants[3]); - computedConstants[109] = pow(leq(constants[0], constants[1]), -constants[2]); - computedConstants[110] = pow(leq(constants[0], constants[1]), constants[2]*constants[3]); - computedConstants[111] = pow(leq(constants[0], constants[1]), constants[2]/constants[3]); - computedConstants[112] = pow(leq(constants[0], constants[1]), pow(constants[2], constants[3])); - computedConstants[113] = pow(leq(constants[0], constants[1]), pow(constants[2], 1.0/constants[3])); - computedConstants[114] = sqrt(constants[0]); - computedConstants[115] = sqrt(constants[0]); - computedConstants[116] = pow(constants[0], 1.0/3.0); - computedConstants[117] = pow(constants[0], 1.0/constants[1]); - computedConstants[118] = pow(lt(constants[0], constants[1]), 1.0/gt(constants[3], constants[2])); - computedConstants[119] = pow(constants[0]+constants[1], 1.0/gt(constants[3], constants[2])); - computedConstants[120] = pow(constants[0], 1.0/gt(constants[2], constants[1])); - computedConstants[121] = pow(constants[0]-constants[1], 1.0/gt(constants[3], constants[2])); - computedConstants[122] = pow(-constants[0], 1.0/gt(constants[2], constants[1])); - computedConstants[123] = pow(constants[0]*constants[1], 1.0/gt(constants[3], constants[2])); - computedConstants[124] = pow(constants[0]/constants[1], 1.0/gt(constants[3], constants[2])); - computedConstants[125] = pow(lt(constants[0], constants[1]), 1.0/(constants[2]+constants[3])); - computedConstants[126] = pow(lt(constants[0], constants[1]), 1.0/constants[2]); - computedConstants[127] = pow(lt(constants[0], constants[1]), 1.0/(constants[2]-constants[3])); - computedConstants[128] = pow(lt(constants[0], constants[1]), 1.0/-constants[2]); - computedConstants[129] = pow(lt(constants[0], constants[1]), 1.0/(constants[2]*constants[3])); - computedConstants[130] = pow(lt(constants[0], constants[1]), 1.0/(constants[2]/constants[3])); - computedConstants[131] = pow(lt(constants[0], constants[1]), 1.0/pow(constants[2], constants[3])); - computedConstants[132] = pow(lt(constants[0], constants[1]), 1.0/pow(constants[2], 1.0/constants[3])); - computedConstants[133] = fabs(constants[0]); - computedConstants[134] = exp(constants[0]); - computedConstants[135] = log(constants[0]); + computedConstants[28] = or(lt(constants[0], constants[1]), gt(constants[2], constants[3])); + computedConstants[29] = or(constants[0]+constants[1], gt(constants[2], constants[3])); + computedConstants[30] = or(constants[0], gt(constants[1], constants[2])); + computedConstants[31] = or(constants[0]-constants[1], gt(constants[2], constants[3])); + computedConstants[32] = or(-constants[0], gt(constants[1], constants[2])); + computedConstants[33] = or(pow(constants[0], constants[1]), gt(constants[2], constants[3])); + computedConstants[34] = or(pow(constants[0], 1.0/constants[1]), gt(constants[2], constants[3])); + computedConstants[35] = or(lt(constants[0], constants[1]), constants[2]+constants[3]); + computedConstants[36] = or(lt(constants[0], constants[1]), constants[2]); + computedConstants[37] = or(lt(constants[0], constants[1]), constants[2]-constants[3]); + computedConstants[38] = or(lt(constants[0], constants[1]), -constants[2]); + computedConstants[39] = or(lt(constants[0], constants[1]), pow(constants[2], constants[3])); + computedConstants[40] = or(lt(constants[0], constants[1]), pow(constants[2], 1.0/constants[3])); + computedConstants[41] = constants[0]/or(constants[1], constants[2]); + computedConstants[42] = xor(constants[0], constants[1]); + computedConstants[43] = xor(constants[0], xor(constants[1], constants[2])); + computedConstants[44] = xor(lt(constants[0], constants[1]), gt(constants[2], constants[3])); + computedConstants[45] = xor(constants[0]+constants[1], gt(constants[2], constants[3])); + computedConstants[46] = xor(constants[0], gt(constants[1], constants[2])); + computedConstants[47] = xor(constants[0]-constants[1], gt(constants[2], constants[3])); + computedConstants[48] = xor(-constants[0], gt(constants[1], constants[2])); + computedConstants[49] = xor(pow(constants[0], constants[1]), gt(constants[2], constants[3])); + computedConstants[50] = xor(pow(constants[0], 1.0/constants[1]), gt(constants[2], constants[3])); + computedConstants[51] = xor(lt(constants[0], constants[1]), constants[2]+constants[3]); + computedConstants[52] = xor(lt(constants[0], constants[1]), constants[2]); + computedConstants[53] = xor(lt(constants[0], constants[1]), constants[2]-constants[3]); + computedConstants[54] = xor(lt(constants[0], constants[1]), -constants[2]); + computedConstants[55] = xor(lt(constants[0], constants[1]), pow(constants[2], constants[3])); + computedConstants[56] = xor(lt(constants[0], constants[1]), pow(constants[2], 1.0/constants[3])); + computedConstants[57] = not(constants[0]); + computedConstants[58] = constants[0]+constants[1]+constants[2]; + computedConstants[59] = lt(constants[0], constants[1])+gt(constants[2], constants[3]); + computedConstants[60] = constants[0]; + computedConstants[61] = constants[0]-constants[1]; + computedConstants[62] = lt(constants[0], constants[1])-gt(constants[2], constants[3]); + computedConstants[63] = lt(constants[0], constants[1])-(constants[2]+constants[3]); + computedConstants[64] = lt(constants[0], constants[1])-constants[2]; + computedConstants[65] = constants[0]-(-constants[1]); + computedConstants[66] = constants[0]-(-constants[1]*constants[2]); + computedConstants[67] = -constants[0]; + computedConstants[68] = -lt(constants[0], constants[1]); + computedConstants[69] = constants[0]*constants[1]; + computedConstants[70] = constants[0]*constants[1]*constants[2]; + computedConstants[71] = lt(constants[0], constants[1])*gt(constants[2], constants[3]); + computedConstants[72] = (constants[0]+constants[1])*gt(constants[2], constants[3]); + computedConstants[73] = constants[0]*gt(constants[1], constants[2]); + computedConstants[74] = (constants[0]-constants[1])*gt(constants[2], constants[3]); + computedConstants[75] = -constants[0]*gt(constants[1], constants[2]); + computedConstants[76] = lt(constants[0], constants[1])*(constants[2]+constants[3]); + computedConstants[77] = lt(constants[0], constants[1])*constants[2]; + computedConstants[78] = lt(constants[0], constants[1])*(constants[2]-constants[3]); + computedConstants[79] = lt(constants[0], constants[1])*-constants[2]; + computedConstants[80] = constants[0]/constants[1]; + computedConstants[81] = lt(constants[0], constants[1])/gt(constants[3], constants[2]); + computedConstants[82] = (constants[0]+constants[1])/gt(constants[3], constants[2]); + computedConstants[83] = constants[0]/gt(constants[2], constants[1]); + computedConstants[84] = (constants[0]-constants[1])/gt(constants[3], constants[2]); + computedConstants[85] = -constants[0]/gt(constants[2], constants[1]); + computedConstants[86] = lt(constants[0], constants[1])/(constants[2]+constants[3]); + computedConstants[87] = lt(constants[0], constants[1])/constants[2]; + computedConstants[88] = lt(constants[0], constants[1])/(constants[2]-constants[3]); + computedConstants[89] = lt(constants[0], constants[1])/-constants[2]; + computedConstants[90] = lt(constants[0], constants[1])/(constants[2]*constants[3]); + computedConstants[91] = lt(constants[0], constants[1])/(constants[2]/constants[3]); + computedConstants[92] = sqrt(constants[0]); + computedConstants[93] = pow(constants[0], 2.0); + computedConstants[94] = pow(constants[0], 3.0); + computedConstants[95] = pow(constants[0], constants[1]); + computedConstants[96] = pow(leq(constants[0], constants[1]), geq(constants[2], constants[3])); + computedConstants[97] = pow(constants[0]+constants[1], geq(constants[2], constants[3])); + computedConstants[98] = pow(constants[0], geq(constants[1], constants[2])); + computedConstants[99] = pow(constants[0]-constants[1], geq(constants[2], constants[3])); + computedConstants[100] = pow(-constants[0], geq(constants[1], constants[2])); + computedConstants[101] = pow(constants[0]*constants[1], geq(constants[2], constants[3])); + computedConstants[102] = pow(constants[0]/constants[1], geq(constants[2], constants[3])); + computedConstants[103] = pow(leq(constants[0], constants[1]), constants[2]+constants[3]); + computedConstants[104] = pow(leq(constants[0], constants[1]), constants[2]); + computedConstants[105] = pow(leq(constants[0], constants[1]), constants[2]-constants[3]); + computedConstants[106] = pow(leq(constants[0], constants[1]), -constants[2]); + computedConstants[107] = pow(leq(constants[0], constants[1]), constants[2]*constants[3]); + computedConstants[108] = pow(leq(constants[0], constants[1]), constants[2]/constants[3]); + computedConstants[109] = pow(leq(constants[0], constants[1]), pow(constants[2], constants[3])); + computedConstants[110] = pow(leq(constants[0], constants[1]), pow(constants[2], 1.0/constants[3])); + computedConstants[111] = sqrt(constants[0]); + computedConstants[112] = sqrt(constants[0]); + computedConstants[113] = pow(constants[0], 1.0/0.5); + computedConstants[114] = pow(constants[0], 1.0/3.0); + computedConstants[115] = pow(constants[0], 1.0/constants[1]); + computedConstants[116] = pow(lt(constants[0], constants[1]), 1.0/gt(constants[3], constants[2])); + computedConstants[117] = pow(constants[0]+constants[1], 1.0/gt(constants[3], constants[2])); + computedConstants[118] = pow(constants[0], 1.0/gt(constants[2], constants[1])); + computedConstants[119] = pow(constants[0]-constants[1], 1.0/gt(constants[3], constants[2])); + computedConstants[120] = pow(-constants[0], 1.0/gt(constants[2], constants[1])); + computedConstants[121] = pow(constants[0]*constants[1], 1.0/gt(constants[3], constants[2])); + computedConstants[122] = pow(constants[0]/constants[1], 1.0/gt(constants[3], constants[2])); + computedConstants[123] = pow(lt(constants[0], constants[1]), 1.0/(constants[2]+constants[3])); + computedConstants[124] = pow(lt(constants[0], constants[1]), 1.0/constants[2]); + computedConstants[125] = pow(lt(constants[0], constants[1]), 1.0/(constants[2]-constants[3])); + computedConstants[126] = pow(lt(constants[0], constants[1]), 1.0/-constants[2]); + computedConstants[127] = pow(lt(constants[0], constants[1]), 1.0/(constants[2]*constants[3])); + computedConstants[128] = pow(lt(constants[0], constants[1]), 1.0/(constants[2]/constants[3])); + computedConstants[129] = pow(lt(constants[0], constants[1]), 1.0/pow(constants[2], constants[3])); + computedConstants[130] = pow(lt(constants[0], constants[1]), 1.0/pow(constants[2], 1.0/constants[3])); + computedConstants[131] = fabs(constants[0]); + computedConstants[132] = exp(constants[0]); + computedConstants[133] = log(constants[0]); + computedConstants[134] = log10(constants[0]); + computedConstants[135] = log(constants[0])/log(2.0); computedConstants[136] = log10(constants[0]); - computedConstants[137] = log(constants[0])/log(2.0); - computedConstants[138] = log10(constants[0]); - computedConstants[139] = log(constants[0])/log(constants[1]); - computedConstants[140] = ceil(constants[0]); - computedConstants[141] = floor(constants[0]); - computedConstants[142] = min(constants[0], constants[1]); - computedConstants[143] = min(constants[0], min(constants[1], constants[2])); - computedConstants[144] = max(constants[0], constants[1]); - computedConstants[145] = max(constants[0], max(constants[1], constants[2])); - computedConstants[146] = fmod(constants[0], constants[1]); - computedConstants[147] = sin(constants[0]); - computedConstants[148] = cos(constants[0]); - computedConstants[149] = tan(constants[0]); - computedConstants[150] = sec(constants[0]); - computedConstants[151] = csc(constants[0]); - computedConstants[152] = cot(constants[0]); - computedConstants[153] = sinh(constants[0]); - computedConstants[154] = cosh(constants[0]); - computedConstants[155] = tanh(constants[0]); - computedConstants[156] = sech(constants[0]); - computedConstants[157] = csch(constants[0]); - computedConstants[158] = coth(constants[0]); - computedConstants[159] = asin(constants[0]); - computedConstants[160] = acos(constants[0]); - computedConstants[161] = atan(constants[0]); - computedConstants[162] = asec(constants[0]); - computedConstants[163] = acsc(constants[0]); - computedConstants[164] = acot(constants[0]); - computedConstants[165] = asinh(constants[0]); - computedConstants[166] = acosh(constants[0]); - computedConstants[167] = atanh(constants[0]/2.0); - computedConstants[168] = asech(constants[0]); - computedConstants[169] = acsch(constants[0]); - computedConstants[170] = acoth(2.0*constants[0]); - computedConstants[171] = (gt(constants[0], constants[1]))?constants[0]:NAN; - computedConstants[172] = (gt(constants[0], constants[1]))?constants[0]:constants[2]; - computedConstants[173] = (gt(constants[0], constants[1]))?constants[0]:(gt(constants[2], constants[3]))?constants[2]:(gt(constants[4], constants[5]))?constants[4]:NAN; - computedConstants[174] = (gt(constants[0], constants[1]))?constants[0]:(gt(constants[2], constants[3]))?constants[2]:(gt(constants[4], constants[5]))?constants[4]:constants[6]; - computedConstants[175] = 123.0+((gt(constants[0], constants[1]))?constants[0]:NAN); - computedConstants[180] = constants[0]; - computedConstants[187] = and(constants[0], constants[1])+((gt(constants[2], constants[3]))?constants[1]:NAN)+constants[4]+and(constants[5], constants[6]); - computedConstants[188] = and(constants[0], constants[1])-(((gt(constants[2], constants[3]))?constants[1]:NAN)-(constants[4]-((gt(constants[2], constants[3]))?constants[1]:NAN)))-and(constants[5], constants[6]); - computedConstants[189] = and(constants[0], constants[1])*((gt(constants[2], constants[3]))?constants[1]:NAN)*constants[4]*((gt(constants[2], constants[3]))?constants[1]:NAN)*and(constants[5], constants[6]); - computedConstants[190] = and(constants[0], constants[1])/(((gt(constants[2], constants[3]))?constants[1]:NAN)/(constants[4]/((gt(constants[2], constants[3]))?constants[1]:NAN))); - computedConstants[191] = and(or(constants[0], constants[1]), and(xor(constants[0], constants[1]), and((gt(constants[2], constants[3]))?constants[1]:NAN, and(and(and(constants[4], (gt(constants[2], constants[3]))?constants[1]:NAN), xor(constants[0], constants[1])), or(constants[0], constants[1]))))); - computedConstants[192] = or(and(constants[0], constants[1]), or(xor(constants[0], constants[1]), or((gt(constants[2], constants[3]))?constants[1]:NAN, or(or(or(constants[4], (gt(constants[2], constants[3]))?constants[1]:NAN), xor(constants[0], constants[1])), and(constants[0], constants[1]))))); - computedConstants[193] = xor(and(constants[0], constants[1]), xor(or(constants[0], constants[1]), xor((gt(constants[2], constants[3]))?constants[1]:NAN, xor(xor(xor(constants[4], (gt(constants[2], constants[3]))?constants[1]:NAN), or(constants[0], constants[1])), and(constants[0], constants[1]))))); - computedConstants[194] = pow(and(constants[0], constants[1]), pow((gt(constants[2], constants[3]))?constants[1]:NAN, pow(pow(constants[4], (gt(constants[2], constants[3]))?constants[1]:NAN), and(constants[0], constants[1])))); - computedConstants[195] = pow(pow(pow(and(constants[0], constants[1]), 1.0/pow((gt(constants[2], constants[3]))?constants[1]:NAN, 1.0/constants[4])), 1.0/((gt(constants[2], constants[3]))?constants[1]:NAN)), 1.0/and(constants[0], constants[1])); - computedConstants[196] = -and(constants[0], constants[1])+-((gt(constants[2], constants[3]))?constants[1]:NAN); + computedConstants[137] = log(constants[0])/log(constants[1]); + computedConstants[138] = ceil(constants[0]); + computedConstants[139] = floor(constants[0]); + computedConstants[140] = fmin(constants[0], constants[1]); + computedConstants[141] = fmin(constants[0], fmin(constants[1], constants[2])); + computedConstants[142] = fmax(constants[0], constants[1]); + computedConstants[143] = fmax(constants[0], fmax(constants[1], constants[2])); + computedConstants[144] = fmod(constants[0], constants[1]); + computedConstants[145] = sin(constants[0]); + computedConstants[146] = cos(constants[0]); + computedConstants[147] = tan(constants[0]); + computedConstants[148] = sec(constants[0]); + computedConstants[149] = csc(constants[0]); + computedConstants[150] = cot(constants[0]); + computedConstants[151] = sinh(constants[0]); + computedConstants[152] = cosh(constants[0]); + computedConstants[153] = tanh(constants[0]); + computedConstants[154] = sech(constants[0]); + computedConstants[155] = csch(constants[0]); + computedConstants[156] = coth(constants[0]); + computedConstants[157] = asin(constants[0]); + computedConstants[158] = acos(constants[0]); + computedConstants[159] = atan(constants[0]); + computedConstants[160] = asec(constants[0]); + computedConstants[161] = acsc(constants[0]); + computedConstants[162] = acot(constants[0]); + computedConstants[163] = asinh(constants[0]); + computedConstants[164] = acosh(constants[0]); + computedConstants[165] = atanh(constants[0]/2.0); + computedConstants[166] = asech(constants[0]); + computedConstants[167] = acsch(constants[0]); + computedConstants[168] = acoth(2.0*constants[0]); + computedConstants[170] = (gt(constants[0], constants[1]))?constants[0]:NAN; + computedConstants[171] = (lt(constants[0], constants[1]))?constants[0]:NAN; + computedConstants[172] = constants[0]; + computedConstants[173] = (gt(constants[0], constants[1]))?constants[0]:constants[2]; + computedConstants[174] = (gt(constants[0], constants[1]))?constants[0]:(gt(constants[2], constants[3]))?constants[2]:(gt(constants[4], constants[5]))?constants[4]:NAN; + computedConstants[175] = (lt(constants[0], constants[1]))?constants[0]:(gt(constants[2], constants[3]))?constants[2]:(gt(constants[4], constants[5]))?constants[4]:NAN; + computedConstants[176] = (gt(constants[0], constants[1]))?constants[0]:(gt(constants[2], constants[3]))?constants[2]:(gt(constants[4], constants[5]))?constants[4]:constants[6]; + computedConstants[177] = 123.0+((gt(constants[0], constants[1]))?constants[0]:NAN); + computedConstants[178] = 123.0+((lt(constants[0], constants[1]))?constants[0]:NAN); + computedConstants[183] = constants[0]; + computedConstants[190] = and(constants[0], constants[1])+((gt(constants[2], constants[3]))?constants[1]:NAN)+constants[4]+and(constants[5], constants[6]); + computedConstants[191] = and(constants[0], constants[1])+((lt(constants[2], constants[3]))?constants[1]:NAN)+constants[4]+and(constants[5], constants[6]); + computedConstants[192] = and(constants[0], constants[1])-(((gt(constants[2], constants[3]))?constants[1]:NAN)-(constants[4]-((gt(constants[2], constants[3]))?constants[1]:NAN)))-and(constants[5], constants[6]); + computedConstants[193] = and(constants[0], constants[1])-(((lt(constants[2], constants[3]))?constants[1]:NAN)-(constants[4]-((lt(constants[2], constants[3]))?constants[1]:NAN)))-and(constants[5], constants[6]); + computedConstants[194] = and(constants[0], constants[1])*((gt(constants[2], constants[3]))?constants[1]:NAN)*constants[4]*((gt(constants[2], constants[3]))?constants[1]:NAN)*and(constants[5], constants[6]); + computedConstants[195] = and(constants[0], constants[1])*((lt(constants[2], constants[3]))?constants[1]:NAN)*constants[4]*((lt(constants[2], constants[3]))?constants[1]:NAN)*and(constants[5], constants[6]); + computedConstants[196] = and(constants[0], constants[1])/(((gt(constants[2], constants[3]))?constants[1]:NAN)/(constants[4]/((gt(constants[2], constants[3]))?constants[1]:NAN))); + computedConstants[197] = and(constants[0], constants[1])/(((lt(constants[2], constants[3]))?constants[1]:NAN)/(constants[4]/((lt(constants[2], constants[3]))?constants[1]:NAN))); + computedConstants[198] = and(or(constants[0], constants[1]), and(xor(constants[0], constants[1]), and((gt(constants[2], constants[3]))?constants[1]:NAN, and(and(and(constants[4], (gt(constants[2], constants[3]))?constants[1]:NAN), xor(constants[0], constants[1])), or(constants[0], constants[1]))))); + computedConstants[199] = or(and(constants[0], constants[1]), or(xor(constants[0], constants[1]), or((gt(constants[2], constants[3]))?constants[1]:NAN, or(or(or(constants[4], (gt(constants[2], constants[3]))?constants[1]:NAN), xor(constants[0], constants[1])), and(constants[0], constants[1]))))); + computedConstants[200] = xor(and(constants[0], constants[1]), xor(or(constants[0], constants[1]), xor((gt(constants[2], constants[3]))?constants[1]:NAN, xor(xor(xor(constants[4], (gt(constants[2], constants[3]))?constants[1]:NAN), or(constants[0], constants[1])), and(constants[0], constants[1]))))); + computedConstants[201] = pow(and(constants[0], constants[1]), pow((gt(constants[2], constants[3]))?constants[1]:NAN, pow(pow(constants[4], (gt(constants[2], constants[3]))?constants[1]:NAN), and(constants[0], constants[1])))); + computedConstants[202] = pow(pow(pow(and(constants[0], constants[1]), 1.0/pow((gt(constants[2], constants[3]))?constants[1]:NAN, 1.0/constants[4])), 1.0/((gt(constants[2], constants[3]))?constants[1]:NAN)), 1.0/and(constants[0], constants[1])); + computedConstants[203] = -and(constants[0], constants[1])+-((gt(constants[2], constants[3]))?constants[1]:NAN); + computedConstants[204] = -and(constants[0], constants[1])+-((lt(constants[2], constants[3]))?constants[1]:NAN); } void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, double *externals, ExternalVariable externalVariable) @@ -409,6 +401,9 @@ void computeRates(double voi, double *states, double *rates, double *constants, void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, double *externals, ExternalVariable externalVariable) { + algebraic[0] = or(states[0], states[0]); + algebraic[1] = or(states[0], or(states[0], constants[0])); + algebraic[2] = constants[0]/xor(constants[1], states[0]); externals[0] = externalVariable(voi, states, rates, constants, computedConstants, algebraic, externals, 0); findRoot0(voi, states, rates, constants, computedConstants, algebraic, externals); } diff --git a/tests/resources/coverage/generator/model.out b/tests/resources/coverage/generator/model.out index 84c6417ef6..326fdee8d4 100644 --- a/tests/resources/coverage/generator/model.out +++ b/tests/resources/coverage/generator/model.out @@ -2,16 +2,6 @@ #include "customheaderfile.h" -double min(double x, double y) -{ - return (x < y)?x:y; -} - -double max(double x, double y) -{ - return (x > y)?x:y; -} - double sec(double x) { return 1.0/cos(x); @@ -59,23 +49,17 @@ double acot(double x) double asech(double x) { - double oneOverX = 1.0/x; - - return log(oneOverX+sqrt(oneOverX*oneOverX-1.0)); + return acosh(1.0/x); } double acsch(double x) { - double oneOverX = 1.0/x; - - return log(oneOverX+sqrt(oneOverX*oneOverX+1.0)); + return asinh(1.0/x); } double acoth(double x) { - double oneOverX = 1.0/x; - - return 0.5*log((1.0+oneOverX)/(1.0-oneOverX)); + return atanh(1.0/x); } typedef struct { @@ -101,11 +85,11 @@ void objectiveFunction0(double *u, double *f, void *data) double *algebraic = ((RootFindingInfo *) data)->algebraic; double *externals = ((RootFindingInfo *) data)->externals; - algebraic[0] = u[0]; - algebraic[1] = u[1]; + algebraic[3] = u[0]; + algebraic[4] = u[1]; - f[0] = algebraic[0]+algebraic[1]+states[0]-0.0; - f[1] = algebraic[0]-algebraic[1]-(computedConstants[197]+computedConstants[198]); + f[0] = algebraic[3]+algebraic[4]+states[0]-0.0; + f[1] = algebraic[3]-algebraic[4]-(computedConstants[205]+computedConstants[206]); } void findRoot0(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, double *externals) @@ -113,13 +97,13 @@ void findRoot0(double voi, double *states, double *rates, double *constants, dou RootFindingInfo rfi = { voi, states, rates, constants, computedConstants, algebraic, externals }; double u[2]; - u[0] = algebraic[0]; - u[1] = algebraic[1]; + u[0] = algebraic[3]; + u[1] = algebraic[4]; nlaSolve(objectiveFunction0, u, 2, &rfi); - algebraic[0] = u[0]; - algebraic[1] = u[1]; + algebraic[3] = u[0]; + algebraic[4] = u[1]; } void computeComputedConstants(double *constants, double *computedConstants) @@ -133,9 +117,9 @@ void computeComputedConstants(double *constants, double *computedConstants) computedConstants[6] = constants[0] <= constants[1]; computedConstants[7] = constants[0]/(constants[1] <= constants[2]); computedConstants[8] = constants[0] > constants[1]; - computedConstants[9] = constants[0]/(constants[1] > constants[2]); + computedConstants[9] = constants[0]/(constants[2] > constants[1]); computedConstants[10] = constants[0] >= constants[1]; - computedConstants[11] = constants[0]/(constants[1] >= constants[2]); + computedConstants[11] = constants[0]/(constants[2] >= constants[1]); computedConstants[12] = constants[0] && constants[1]; computedConstants[13] = constants[0] && constants[1] && constants[2]; computedConstants[14] = (constants[0] < constants[1]) && (constants[2] > constants[3]); @@ -152,165 +136,172 @@ void computeComputedConstants(double *constants, double *computedConstants) computedConstants[25] = (constants[0] < constants[1]) && (constants[2]^^constants[3]); computedConstants[26] = (constants[0] < constants[1]) && (constants[2]^^(1.0/constants[3])); computedConstants[27] = constants[0]/(constants[1] && constants[2]); - computedConstants[28] = constants[0] || constants[1]; - computedConstants[29] = constants[0] || constants[1] || constants[2]; - computedConstants[30] = (constants[0] < constants[1]) || (constants[2] > constants[3]); - computedConstants[31] = (constants[0]+constants[1]) || (constants[2] > constants[3]); - computedConstants[32] = constants[0] || (constants[1] > constants[2]); - computedConstants[33] = (constants[0]-constants[1]) || (constants[2] > constants[3]); - computedConstants[34] = -constants[0] || (constants[1] > constants[2]); - computedConstants[35] = (constants[0]^^constants[1]) || (constants[2] > constants[3]); - computedConstants[36] = (constants[0]^^(1.0/constants[1])) || (constants[2] > constants[3]); - computedConstants[37] = (constants[0] < constants[1]) || (constants[2]+constants[3]); - computedConstants[38] = (constants[0] < constants[1]) || constants[2]; - computedConstants[39] = (constants[0] < constants[1]) || (constants[2]-constants[3]); - computedConstants[40] = (constants[0] < constants[1]) || -constants[2]; - computedConstants[41] = (constants[0] < constants[1]) || (constants[2]^^constants[3]); - computedConstants[42] = (constants[0] < constants[1]) || (constants[2]^^(1.0/constants[3])); - computedConstants[43] = constants[0]/(constants[1] || constants[2]); - computedConstants[44] = constants[0]^constants[1]; - computedConstants[45] = constants[0]^constants[1]^constants[2]; - computedConstants[46] = (constants[0] < constants[1])^(constants[2] > constants[3]); - computedConstants[47] = (constants[0]+constants[1])^(constants[2] > constants[3]); - computedConstants[48] = constants[0]^(constants[1] > constants[2]); - computedConstants[49] = (constants[0]-constants[1])^(constants[2] > constants[3]); - computedConstants[50] = -constants[0]^(constants[1] > constants[2]); - computedConstants[51] = (constants[0]^^constants[1])^(constants[2] > constants[3]); - computedConstants[52] = (constants[0]^^(1.0/constants[1]))^(constants[2] > constants[3]); - computedConstants[53] = (constants[0] < constants[1])^(constants[2]+constants[3]); - computedConstants[54] = (constants[0] < constants[1])^constants[2]; - computedConstants[55] = (constants[0] < constants[1])^(constants[2]-constants[3]); - computedConstants[56] = (constants[0] < constants[1])^-constants[2]; - computedConstants[57] = (constants[0] < constants[1])^(constants[2]^^constants[3]); - computedConstants[58] = (constants[0] < constants[1])^(constants[2]^^(1.0/constants[3])); - computedConstants[59] = constants[0]/(constants[1]^constants[2]); - computedConstants[60] = !constants[0]; - computedConstants[61] = constants[0]+constants[1]+constants[2]; - computedConstants[62] = (constants[0] < constants[1])+(constants[2] > constants[3]); - computedConstants[63] = constants[0]; - computedConstants[64] = constants[0]-constants[1]; - computedConstants[65] = (constants[0] < constants[1])-(constants[2] > constants[3]); - computedConstants[66] = (constants[0] < constants[1])-(constants[2]+constants[3]); - computedConstants[67] = (constants[0] < constants[1])-constants[2]; - computedConstants[68] = constants[0]-(-constants[1]); - computedConstants[69] = constants[0]-(-constants[1]*constants[2]); - computedConstants[70] = -constants[0]; - computedConstants[71] = -(constants[0] < constants[1]); - computedConstants[72] = constants[0]*constants[1]; - computedConstants[73] = constants[0]*constants[1]*constants[2]; - computedConstants[74] = (constants[0] < constants[1])*(constants[2] > constants[3]); - computedConstants[75] = (constants[0]+constants[1])*(constants[2] > constants[3]); - computedConstants[76] = constants[0]*(constants[1] > constants[2]); - computedConstants[77] = (constants[0]-constants[1])*(constants[2] > constants[3]); - computedConstants[78] = -constants[0]*(constants[1] > constants[2]); - computedConstants[79] = (constants[0] < constants[1])*(constants[2]+constants[3]); - computedConstants[80] = (constants[0] < constants[1])*constants[2]; - computedConstants[81] = (constants[0] < constants[1])*(constants[2]-constants[3]); - computedConstants[82] = (constants[0] < constants[1])*-constants[2]; - computedConstants[83] = constants[0]/constants[1]; - computedConstants[84] = (constants[0] < constants[1])/(constants[3] > constants[2]); - computedConstants[85] = (constants[0]+constants[1])/(constants[3] > constants[2]); - computedConstants[86] = constants[0]/(constants[2] > constants[1]); - computedConstants[87] = (constants[0]-constants[1])/(constants[3] > constants[2]); - computedConstants[88] = -constants[0]/(constants[2] > constants[1]); - computedConstants[89] = (constants[0] < constants[1])/(constants[2]+constants[3]); - computedConstants[90] = (constants[0] < constants[1])/constants[2]; - computedConstants[91] = (constants[0] < constants[1])/(constants[2]-constants[3]); - computedConstants[92] = (constants[0] < constants[1])/-constants[2]; - computedConstants[93] = (constants[0] < constants[1])/(constants[2]*constants[3]); - computedConstants[94] = (constants[0] < constants[1])/(constants[2]/constants[3]); - computedConstants[95] = sqrt(constants[0]); - computedConstants[96] = sqr(constants[0]); - computedConstants[97] = constants[0]^^3.0; - computedConstants[98] = constants[0]^^constants[1]; - computedConstants[99] = (constants[0] <= constants[1])^^(constants[2] >= constants[3]); - computedConstants[100] = (constants[0]+constants[1])^^(constants[2] >= constants[3]); - computedConstants[101] = constants[0]^^(constants[1] >= constants[2]); - computedConstants[102] = (constants[0]-constants[1])^^(constants[2] >= constants[3]); - computedConstants[103] = (-constants[0])^^(constants[1] >= constants[2]); - computedConstants[104] = (constants[0]*constants[1])^^(constants[2] >= constants[3]); - computedConstants[105] = (constants[0]/constants[1])^^(constants[2] >= constants[3]); - computedConstants[106] = (constants[0] <= constants[1])^^(constants[2]+constants[3]); - computedConstants[107] = (constants[0] <= constants[1])^^constants[2]; - computedConstants[108] = (constants[0] <= constants[1])^^constants[2]-constants[3]; - computedConstants[109] = (constants[0] <= constants[1])^^-constants[2]; - computedConstants[110] = (constants[0] <= constants[1])^^(constants[2]*constants[3]); - computedConstants[111] = (constants[0] <= constants[1])^^(constants[2]/constants[3]); - computedConstants[112] = (constants[0] <= constants[1])^^(constants[2]^^constants[3]); - computedConstants[113] = (constants[0] <= constants[1])^^(constants[2]^^(1.0/constants[3])); - computedConstants[114] = sqrt(constants[0]); - computedConstants[115] = sqrt(constants[0]); - computedConstants[116] = constants[0]^^(1.0/3.0); - computedConstants[117] = constants[0]^^(1.0/constants[1]); - computedConstants[118] = (constants[0] < constants[1])^^(1.0/(constants[3] > constants[2])); - computedConstants[119] = (constants[0]+constants[1])^^(1.0/(constants[3] > constants[2])); - computedConstants[120] = constants[0]^^(1.0/(constants[2] > constants[1])); - computedConstants[121] = (constants[0]-constants[1])^^(1.0/(constants[3] > constants[2])); - computedConstants[122] = (-constants[0])^^(1.0/(constants[2] > constants[1])); - computedConstants[123] = (constants[0]*constants[1])^^(1.0/(constants[3] > constants[2])); - computedConstants[124] = (constants[0]/constants[1])^^(1.0/(constants[3] > constants[2])); - computedConstants[125] = (constants[0] < constants[1])^^(1.0/(constants[2]+constants[3])); - computedConstants[126] = (constants[0] < constants[1])^^(1.0/constants[2]); - computedConstants[127] = (constants[0] < constants[1])^^(1.0/(constants[2]-constants[3])); - computedConstants[128] = (constants[0] < constants[1])^^(1.0/(-constants[2])); - computedConstants[129] = (constants[0] < constants[1])^^(1.0/(constants[2]*constants[3])); - computedConstants[130] = (constants[0] < constants[1])^^(1.0/(constants[2]/constants[3])); - computedConstants[131] = (constants[0] < constants[1])^^(1.0/(constants[2]^^constants[3])); - computedConstants[132] = (constants[0] < constants[1])^^(1.0/(constants[2]^^(1.0/constants[3]))); - computedConstants[133] = fabs(constants[0]); - computedConstants[134] = exp(constants[0]); - computedConstants[135] = log(constants[0]); + computedConstants[28] = (constants[0] < constants[1]) || (constants[2] > constants[3]); + computedConstants[29] = (constants[0]+constants[1]) || (constants[2] > constants[3]); + computedConstants[30] = constants[0] || (constants[1] > constants[2]); + computedConstants[31] = (constants[0]-constants[1]) || (constants[2] > constants[3]); + computedConstants[32] = -constants[0] || (constants[1] > constants[2]); + computedConstants[33] = (constants[0]^^constants[1]) || (constants[2] > constants[3]); + computedConstants[34] = (constants[0]^^(1.0/constants[1])) || (constants[2] > constants[3]); + computedConstants[35] = (constants[0] < constants[1]) || (constants[2]+constants[3]); + computedConstants[36] = (constants[0] < constants[1]) || constants[2]; + computedConstants[37] = (constants[0] < constants[1]) || (constants[2]-constants[3]); + computedConstants[38] = (constants[0] < constants[1]) || -constants[2]; + computedConstants[39] = (constants[0] < constants[1]) || (constants[2]^^constants[3]); + computedConstants[40] = (constants[0] < constants[1]) || (constants[2]^^(1.0/constants[3])); + computedConstants[41] = constants[0]/(constants[1] || constants[2]); + computedConstants[42] = constants[0]^constants[1]; + computedConstants[43] = constants[0]^constants[1]^constants[2]; + computedConstants[44] = (constants[0] < constants[1])^(constants[2] > constants[3]); + computedConstants[45] = (constants[0]+constants[1])^(constants[2] > constants[3]); + computedConstants[46] = constants[0]^(constants[1] > constants[2]); + computedConstants[47] = (constants[0]-constants[1])^(constants[2] > constants[3]); + computedConstants[48] = -constants[0]^(constants[1] > constants[2]); + computedConstants[49] = (constants[0]^^constants[1])^(constants[2] > constants[3]); + computedConstants[50] = (constants[0]^^(1.0/constants[1]))^(constants[2] > constants[3]); + computedConstants[51] = (constants[0] < constants[1])^(constants[2]+constants[3]); + computedConstants[52] = (constants[0] < constants[1])^constants[2]; + computedConstants[53] = (constants[0] < constants[1])^(constants[2]-constants[3]); + computedConstants[54] = (constants[0] < constants[1])^-constants[2]; + computedConstants[55] = (constants[0] < constants[1])^(constants[2]^^constants[3]); + computedConstants[56] = (constants[0] < constants[1])^(constants[2]^^(1.0/constants[3])); + computedConstants[57] = !constants[0]; + computedConstants[58] = constants[0]+constants[1]+constants[2]; + computedConstants[59] = (constants[0] < constants[1])+(constants[2] > constants[3]); + computedConstants[60] = constants[0]; + computedConstants[61] = constants[0]-constants[1]; + computedConstants[62] = (constants[0] < constants[1])-(constants[2] > constants[3]); + computedConstants[63] = (constants[0] < constants[1])-(constants[2]+constants[3]); + computedConstants[64] = (constants[0] < constants[1])-constants[2]; + computedConstants[65] = constants[0]-(-constants[1]); + computedConstants[66] = constants[0]-(-constants[1]*constants[2]); + computedConstants[67] = -constants[0]; + computedConstants[68] = -(constants[0] < constants[1]); + computedConstants[69] = constants[0]*constants[1]; + computedConstants[70] = constants[0]*constants[1]*constants[2]; + computedConstants[71] = (constants[0] < constants[1])*(constants[2] > constants[3]); + computedConstants[72] = (constants[0]+constants[1])*(constants[2] > constants[3]); + computedConstants[73] = constants[0]*(constants[1] > constants[2]); + computedConstants[74] = (constants[0]-constants[1])*(constants[2] > constants[3]); + computedConstants[75] = -constants[0]*(constants[1] > constants[2]); + computedConstants[76] = (constants[0] < constants[1])*(constants[2]+constants[3]); + computedConstants[77] = (constants[0] < constants[1])*constants[2]; + computedConstants[78] = (constants[0] < constants[1])*(constants[2]-constants[3]); + computedConstants[79] = (constants[0] < constants[1])*-constants[2]; + computedConstants[80] = constants[0]/constants[1]; + computedConstants[81] = (constants[0] < constants[1])/(constants[3] > constants[2]); + computedConstants[82] = (constants[0]+constants[1])/(constants[3] > constants[2]); + computedConstants[83] = constants[0]/(constants[2] > constants[1]); + computedConstants[84] = (constants[0]-constants[1])/(constants[3] > constants[2]); + computedConstants[85] = -constants[0]/(constants[2] > constants[1]); + computedConstants[86] = (constants[0] < constants[1])/(constants[2]+constants[3]); + computedConstants[87] = (constants[0] < constants[1])/constants[2]; + computedConstants[88] = (constants[0] < constants[1])/(constants[2]-constants[3]); + computedConstants[89] = (constants[0] < constants[1])/-constants[2]; + computedConstants[90] = (constants[0] < constants[1])/(constants[2]*constants[3]); + computedConstants[91] = (constants[0] < constants[1])/(constants[2]/constants[3]); + computedConstants[92] = sqrt(constants[0]); + computedConstants[93] = sqr(constants[0]); + computedConstants[94] = constants[0]^^3.0; + computedConstants[95] = constants[0]^^constants[1]; + computedConstants[96] = (constants[0] <= constants[1])^^(constants[2] >= constants[3]); + computedConstants[97] = (constants[0]+constants[1])^^(constants[2] >= constants[3]); + computedConstants[98] = constants[0]^^(constants[1] >= constants[2]); + computedConstants[99] = (constants[0]-constants[1])^^(constants[2] >= constants[3]); + computedConstants[100] = (-constants[0])^^(constants[1] >= constants[2]); + computedConstants[101] = (constants[0]*constants[1])^^(constants[2] >= constants[3]); + computedConstants[102] = (constants[0]/constants[1])^^(constants[2] >= constants[3]); + computedConstants[103] = (constants[0] <= constants[1])^^(constants[2]+constants[3]); + computedConstants[104] = (constants[0] <= constants[1])^^constants[2]; + computedConstants[105] = (constants[0] <= constants[1])^^constants[2]-constants[3]; + computedConstants[106] = (constants[0] <= constants[1])^^-constants[2]; + computedConstants[107] = (constants[0] <= constants[1])^^(constants[2]*constants[3]); + computedConstants[108] = (constants[0] <= constants[1])^^(constants[2]/constants[3]); + computedConstants[109] = (constants[0] <= constants[1])^^(constants[2]^^constants[3]); + computedConstants[110] = (constants[0] <= constants[1])^^(constants[2]^^(1.0/constants[3])); + computedConstants[111] = sqrt(constants[0]); + computedConstants[112] = sqrt(constants[0]); + computedConstants[113] = sqr(constants[0]); + computedConstants[114] = constants[0]^^(1.0/3.0); + computedConstants[115] = constants[0]^^(1.0/constants[1]); + computedConstants[116] = (constants[0] < constants[1])^^(1.0/(constants[3] > constants[2])); + computedConstants[117] = (constants[0]+constants[1])^^(1.0/(constants[3] > constants[2])); + computedConstants[118] = constants[0]^^(1.0/(constants[2] > constants[1])); + computedConstants[119] = (constants[0]-constants[1])^^(1.0/(constants[3] > constants[2])); + computedConstants[120] = (-constants[0])^^(1.0/(constants[2] > constants[1])); + computedConstants[121] = (constants[0]*constants[1])^^(1.0/(constants[3] > constants[2])); + computedConstants[122] = (constants[0]/constants[1])^^(1.0/(constants[3] > constants[2])); + computedConstants[123] = (constants[0] < constants[1])^^(1.0/(constants[2]+constants[3])); + computedConstants[124] = (constants[0] < constants[1])^^(1.0/constants[2]); + computedConstants[125] = (constants[0] < constants[1])^^(1.0/(constants[2]-constants[3])); + computedConstants[126] = (constants[0] < constants[1])^^(1.0/(-constants[2])); + computedConstants[127] = (constants[0] < constants[1])^^(1.0/(constants[2]*constants[3])); + computedConstants[128] = (constants[0] < constants[1])^^(1.0/(constants[2]/constants[3])); + computedConstants[129] = (constants[0] < constants[1])^^(1.0/(constants[2]^^constants[3])); + computedConstants[130] = (constants[0] < constants[1])^^(1.0/(constants[2]^^(1.0/constants[3]))); + computedConstants[131] = fabs(constants[0]); + computedConstants[132] = exp(constants[0]); + computedConstants[133] = log(constants[0]); + computedConstants[134] = log10(constants[0]); + computedConstants[135] = log(constants[0])/log(2.0); computedConstants[136] = log10(constants[0]); - computedConstants[137] = log(constants[0])/log(2.0); - computedConstants[138] = log10(constants[0]); - computedConstants[139] = log(constants[0])/log(constants[1]); - computedConstants[140] = ceil(constants[0]); - computedConstants[141] = floor(constants[0]); - computedConstants[142] = min(constants[0], constants[1]); - computedConstants[143] = min(constants[0], min(constants[1], constants[2])); - computedConstants[144] = max(constants[0], constants[1]); - computedConstants[145] = max(constants[0], max(constants[1], constants[2])); - computedConstants[146] = fmod(constants[0], constants[1]); - computedConstants[147] = sin(constants[0]); - computedConstants[148] = cos(constants[0]); - computedConstants[149] = tan(constants[0]); - computedConstants[150] = sec(constants[0]); - computedConstants[151] = csc(constants[0]); - computedConstants[152] = cot(constants[0]); - computedConstants[153] = sinh(constants[0]); - computedConstants[154] = cosh(constants[0]); - computedConstants[155] = tanh(constants[0]); - computedConstants[156] = sech(constants[0]); - computedConstants[157] = csch(constants[0]); - computedConstants[158] = coth(constants[0]); - computedConstants[159] = asin(constants[0]); - computedConstants[160] = acos(constants[0]); - computedConstants[161] = atan(constants[0]); - computedConstants[162] = asec(constants[0]); - computedConstants[163] = acsc(constants[0]); - computedConstants[164] = acot(constants[0]); - computedConstants[165] = asinh(constants[0]); - computedConstants[166] = acosh(constants[0]); - computedConstants[167] = atanh(constants[0]/2.0); - computedConstants[168] = asech(constants[0]); - computedConstants[169] = acsch(constants[0]); - computedConstants[170] = acoth(2.0*constants[0]); - computedConstants[171] = piecewise(constants[0] > constants[1], constants[0], NAN); - computedConstants[172] = piecewise(constants[0] > constants[1], constants[0], constants[2]); - computedConstants[173] = piecewise(constants[0] > constants[1], constants[0], piecewise(constants[2] > constants[3], constants[2], piecewise(constants[4] > constants[5], constants[4], NAN))); - computedConstants[174] = piecewise(constants[0] > constants[1], constants[0], piecewise(constants[2] > constants[3], constants[2], piecewise(constants[4] > constants[5], constants[4], constants[6]))); - computedConstants[175] = 123.0+piecewise(constants[0] > constants[1], constants[0], NAN); - computedConstants[180] = constants[0]; - computedConstants[187] = (constants[0] && constants[1])+piecewise(constants[2] > constants[3], constants[1], NAN)+constants[4]+(constants[5] && constants[6]); - computedConstants[188] = (constants[0] && constants[1])-(piecewise(constants[2] > constants[3], constants[1], NAN)-(constants[4]-piecewise(constants[2] > constants[3], constants[1], NAN)))-(constants[5] && constants[6]); - computedConstants[189] = (constants[0] && constants[1])*piecewise(constants[2] > constants[3], constants[1], NAN)*constants[4]*piecewise(constants[2] > constants[3], constants[1], NAN)*(constants[5] && constants[6]); - computedConstants[190] = (constants[0] && constants[1])/(piecewise(constants[2] > constants[3], constants[1], NAN)/(constants[4]/piecewise(constants[2] > constants[3], constants[1], NAN))); - computedConstants[191] = (constants[0] || constants[1]) && (constants[0]^constants[1]) && piecewise(constants[2] > constants[3], constants[1], NAN) && constants[4] && piecewise(constants[2] > constants[3], constants[1], NAN) && (constants[0]^constants[1]) && (constants[0] || constants[1]); - computedConstants[192] = (constants[0] && constants[1]) || (constants[0]^constants[1]) || piecewise(constants[2] > constants[3], constants[1], NAN) || constants[4] || piecewise(constants[2] > constants[3], constants[1], NAN) || (constants[0]^constants[1]) || (constants[0] && constants[1]); - computedConstants[193] = (constants[0] && constants[1])^(constants[0] || constants[1])^piecewise(constants[2] > constants[3], constants[1], NAN)^constants[4]^piecewise(constants[2] > constants[3], constants[1], NAN)^(constants[0] || constants[1])^(constants[0] && constants[1]); - computedConstants[194] = (constants[0] && constants[1])^^(piecewise(constants[2] > constants[3], constants[1], NAN)^^(constants[4]^^piecewise(constants[2] > constants[3], constants[1], NAN)^^(constants[0] && constants[1]))); - computedConstants[195] = (constants[0] && constants[1])^^(1.0/(piecewise(constants[2] > constants[3], constants[1], NAN)^^(1.0/constants[4])))^^(1.0/piecewise(constants[2] > constants[3], constants[1], NAN))^^(1.0/(constants[0] && constants[1])); - computedConstants[196] = -(constants[0] && constants[1])+-piecewise(constants[2] > constants[3], constants[1], NAN); + computedConstants[137] = log(constants[0])/log(constants[1]); + computedConstants[138] = ceil(constants[0]); + computedConstants[139] = floor(constants[0]); + computedConstants[140] = fmin(constants[0], constants[1]); + computedConstants[141] = fmin(constants[0], fmin(constants[1], constants[2])); + computedConstants[142] = fmax(constants[0], constants[1]); + computedConstants[143] = fmax(constants[0], fmax(constants[1], constants[2])); + computedConstants[144] = fmod(constants[0], constants[1]); + computedConstants[145] = sin(constants[0]); + computedConstants[146] = cos(constants[0]); + computedConstants[147] = tan(constants[0]); + computedConstants[148] = sec(constants[0]); + computedConstants[149] = csc(constants[0]); + computedConstants[150] = cot(constants[0]); + computedConstants[151] = sinh(constants[0]); + computedConstants[152] = cosh(constants[0]); + computedConstants[153] = tanh(constants[0]); + computedConstants[154] = sech(constants[0]); + computedConstants[155] = csch(constants[0]); + computedConstants[156] = coth(constants[0]); + computedConstants[157] = asin(constants[0]); + computedConstants[158] = acos(constants[0]); + computedConstants[159] = atan(constants[0]); + computedConstants[160] = asec(constants[0]); + computedConstants[161] = acsc(constants[0]); + computedConstants[162] = acot(constants[0]); + computedConstants[163] = asinh(constants[0]); + computedConstants[164] = acosh(constants[0]); + computedConstants[165] = atanh(constants[0]/2.0); + computedConstants[166] = asech(constants[0]); + computedConstants[167] = acsch(constants[0]); + computedConstants[168] = acoth(2.0*constants[0]); + computedConstants[170] = piecewise(constants[0] > constants[1], constants[0], NAN); + computedConstants[171] = piecewise(constants[0] < constants[1], constants[0], NAN); + computedConstants[172] = constants[0]; + computedConstants[173] = piecewise(constants[0] > constants[1], constants[0], constants[2]); + computedConstants[174] = piecewise(constants[0] > constants[1], constants[0], piecewise(constants[2] > constants[3], constants[2], piecewise(constants[4] > constants[5], constants[4], NAN))); + computedConstants[175] = piecewise(constants[0] < constants[1], constants[0], piecewise(constants[2] > constants[3], constants[2], piecewise(constants[4] > constants[5], constants[4], NAN))); + computedConstants[176] = piecewise(constants[0] > constants[1], constants[0], piecewise(constants[2] > constants[3], constants[2], piecewise(constants[4] > constants[5], constants[4], constants[6]))); + computedConstants[177] = 123.0+piecewise(constants[0] > constants[1], constants[0], NAN); + computedConstants[178] = 123.0+piecewise(constants[0] < constants[1], constants[0], NAN); + computedConstants[183] = constants[0]; + computedConstants[190] = (constants[0] && constants[1])+piecewise(constants[2] > constants[3], constants[1], NAN)+constants[4]+(constants[5] && constants[6]); + computedConstants[191] = (constants[0] && constants[1])+piecewise(constants[2] < constants[3], constants[1], NAN)+constants[4]+(constants[5] && constants[6]); + computedConstants[192] = (constants[0] && constants[1])-(piecewise(constants[2] > constants[3], constants[1], NAN)-(constants[4]-piecewise(constants[2] > constants[3], constants[1], NAN)))-(constants[5] && constants[6]); + computedConstants[193] = (constants[0] && constants[1])-(piecewise(constants[2] < constants[3], constants[1], NAN)-(constants[4]-piecewise(constants[2] < constants[3], constants[1], NAN)))-(constants[5] && constants[6]); + computedConstants[194] = (constants[0] && constants[1])*piecewise(constants[2] > constants[3], constants[1], NAN)*constants[4]*piecewise(constants[2] > constants[3], constants[1], NAN)*(constants[5] && constants[6]); + computedConstants[195] = (constants[0] && constants[1])*piecewise(constants[2] < constants[3], constants[1], NAN)*constants[4]*piecewise(constants[2] < constants[3], constants[1], NAN)*(constants[5] && constants[6]); + computedConstants[196] = (constants[0] && constants[1])/(piecewise(constants[2] > constants[3], constants[1], NAN)/(constants[4]/piecewise(constants[2] > constants[3], constants[1], NAN))); + computedConstants[197] = (constants[0] && constants[1])/(piecewise(constants[2] < constants[3], constants[1], NAN)/(constants[4]/piecewise(constants[2] < constants[3], constants[1], NAN))); + computedConstants[198] = (constants[0] || constants[1]) && (constants[0]^constants[1]) && piecewise(constants[2] > constants[3], constants[1], NAN) && constants[4] && piecewise(constants[2] > constants[3], constants[1], NAN) && (constants[0]^constants[1]) && (constants[0] || constants[1]); + computedConstants[199] = (constants[0] && constants[1]) || (constants[0]^constants[1]) || piecewise(constants[2] > constants[3], constants[1], NAN) || constants[4] || piecewise(constants[2] > constants[3], constants[1], NAN) || (constants[0]^constants[1]) || (constants[0] && constants[1]); + computedConstants[200] = (constants[0] && constants[1])^(constants[0] || constants[1])^piecewise(constants[2] > constants[3], constants[1], NAN)^constants[4]^piecewise(constants[2] > constants[3], constants[1], NAN)^(constants[0] || constants[1])^(constants[0] && constants[1]); + computedConstants[201] = (constants[0] && constants[1])^^(piecewise(constants[2] > constants[3], constants[1], NAN)^^(constants[4]^^piecewise(constants[2] > constants[3], constants[1], NAN)^^(constants[0] && constants[1]))); + computedConstants[202] = (constants[0] && constants[1])^^(1.0/(piecewise(constants[2] > constants[3], constants[1], NAN)^^(1.0/constants[4])))^^(1.0/piecewise(constants[2] > constants[3], constants[1], NAN))^^(1.0/(constants[0] && constants[1])); + computedConstants[203] = -(constants[0] && constants[1])+-piecewise(constants[2] > constants[3], constants[1], NAN); + computedConstants[204] = -(constants[0] && constants[1])+-piecewise(constants[2] < constants[3], constants[1], NAN); } void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, double *externals, ExternalVariable externalVariable) diff --git a/tests/resources/coverage/generator/model.py b/tests/resources/coverage/generator/model.py index d8a33ebfb8..acff4123de 100644 --- a/tests/resources/coverage/generator/model.py +++ b/tests/resources/coverage/generator/model.py @@ -9,8 +9,8 @@ STATE_COUNT = 1 CONSTANT_COUNT = 7 -COMPUTED_CONSTANT_COUNT = 199 -ALGEBRAIC_COUNT = 2 +COMPUTED_CONSTANT_COUNT = 207 +ALGEBRAIC_COUNT = 5 EXTERNAL_COUNT = 1 VOI_INFO = {"name": "t", "units": "second", "component": "my_component"} @@ -58,8 +58,6 @@ {"name": "eqnAndParenthesesRightPower", "units": "dimensionless", "component": "my_component"}, {"name": "eqnAndParenthesesRightRoot", "units": "dimensionless", "component": "my_component"}, {"name": "eqnAndCoverageParentheses", "units": "dimensionless", "component": "my_component"}, - {"name": "eqnOr", "units": "dimensionless", "component": "my_component"}, - {"name": "eqnOrMultiple", "units": "dimensionless", "component": "my_component"}, {"name": "eqnOrParentheses", "units": "dimensionless", "component": "my_component"}, {"name": "eqnOrParenthesesLeftPlusWith", "units": "dimensionless", "component": "my_component"}, {"name": "eqnOrParenthesesLeftPlusWithout", "units": "dimensionless", "component": "my_component"}, @@ -89,7 +87,6 @@ {"name": "eqnXorParenthesesRightMinusWithout", "units": "dimensionless", "component": "my_component"}, {"name": "eqnXorParenthesesRightPower", "units": "dimensionless", "component": "my_component"}, {"name": "eqnXorParenthesesRightRoot", "units": "dimensionless", "component": "my_component"}, - {"name": "eqnXorCoverageParentheses", "units": "dimensionless", "component": "my_component"}, {"name": "eqnNot", "units": "dimensionless", "component": "my_component"}, {"name": "eqnPlusMultiple", "units": "dimensionless", "component": "my_component"}, {"name": "eqnPlusParentheses", "units": "dimensionless", "component": "my_component"}, @@ -146,6 +143,7 @@ {"name": "eqnPowerParenthesesRightRoot", "units": "dimensionless", "component": "my_component"}, {"name": "eqnRootSqrt", "units": "dimensionless", "component": "my_component"}, {"name": "eqnRootSqrtOther", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnRootSqr", "units": "dimensionless", "component": "my_component"}, {"name": "eqnRootCube", "units": "dimensionless", "component": "my_component"}, {"name": "eqnRootCi", "units": "dimensionless", "component": "my_component"}, {"name": "eqnRootParentheses", "units": "dimensionless", "component": "my_component"}, @@ -201,11 +199,16 @@ {"name": "eqnArcsech", "units": "dimensionless", "component": "my_component"}, {"name": "eqnArccsch", "units": "dimensionless", "component": "my_component"}, {"name": "eqnArccoth", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnPiecewise", "units": "dimensionless", "component": "my_component"}, {"name": "eqnPiecewisePiece", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnPiecewisePiece2", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnPiecewiseOtherwise", "units": "dimensionless", "component": "my_component"}, {"name": "eqnPiecewisePieceOtherwise", "units": "dimensionless", "component": "my_component"}, {"name": "eqnPiecewisePiecePiecePiece", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnPiecewisePiecePiecePiece2", "units": "dimensionless", "component": "my_component"}, {"name": "eqnPiecewisePiecePiecePieceOtherwise", "units": "dimensionless", "component": "my_component"}, {"name": "eqnWithPiecewise", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnWithPiecewise2", "units": "dimensionless", "component": "my_component"}, {"name": "eqnCnInteger", "units": "dimensionless", "component": "my_component"}, {"name": "eqnCnDouble", "units": "dimensionless", "component": "my_component"}, {"name": "eqnCnIntegerWithExponent", "units": "dimensionless", "component": "my_component"}, @@ -218,20 +221,28 @@ {"name": "eqnInfinity", "units": "dimensionless", "component": "my_component"}, {"name": "eqnNotanumber", "units": "dimensionless", "component": "my_component"}, {"name": "eqnCoverageForPlusOperator", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnCoverageForPlusOperator2", "units": "dimensionless", "component": "my_component"}, {"name": "eqnCoverageForMinusOperator", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnCoverageForMinusOperator2", "units": "dimensionless", "component": "my_component"}, {"name": "eqnCoverageForTimesOperator", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnCoverageForTimesOperator2", "units": "dimensionless", "component": "my_component"}, {"name": "eqnCoverageForDivideOperator", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnCoverageForDivideOperator2", "units": "dimensionless", "component": "my_component"}, {"name": "eqnCoverageForAndOperator", "units": "dimensionless", "component": "my_component"}, {"name": "eqnCoverageForOrOperator", "units": "dimensionless", "component": "my_component"}, {"name": "eqnCoverageForXorOperator", "units": "dimensionless", "component": "my_component"}, {"name": "eqnCoverageForPowerOperator", "units": "dimensionless", "component": "my_component"}, {"name": "eqnCoverageForRootOperator", "units": "dimensionless", "component": "my_component"}, {"name": "eqnCoverageForMinusUnary", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnCoverageForMinusUnary2", "units": "dimensionless", "component": "my_component"}, {"name": "eqnComputedConstant1", "units": "dimensionless", "component": "my_component"}, {"name": "eqnComputedConstant2", "units": "dimensionless", "component": "my_component"} ] ALGEBRAIC_INFO = [ + {"name": "eqnOr", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnOrMultiple", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnXorCoverageParentheses", "units": "dimensionless", "component": "my_component"}, {"name": "eqnNlaVariable1", "units": "dimensionless", "component": "my_component"}, {"name": "eqnNlaVariable2", "units": "dimensionless", "component": "my_component"} ] @@ -326,21 +337,15 @@ def acot(x): def asech(x): - one_over_x = 1.0/x - - return log(one_over_x+sqrt(one_over_x*one_over_x-1.0)) + return acosh(1.0/x) def acsch(x): - one_over_x = 1.0/x - - return log(one_over_x+sqrt(one_over_x*one_over_x+1.0)) + return asinh(1.0/x) def acoth(x): - one_over_x = 1.0/x - - return 0.5*log((1.0+one_over_x)/(1.0-one_over_x)) + return atanh(1.0/x) def create_states_array(): @@ -375,23 +380,23 @@ def objective_function_0(u, f, data): algebraic = data[5] externals = data[6] - algebraic[0] = u[0] - algebraic[1] = u[1] + algebraic[3] = u[0] + algebraic[4] = u[1] - f[0] = algebraic[0]+algebraic[1]+states[0]-0.0 - f[1] = algebraic[0]-algebraic[1]-(computed_constants[197]+computed_constants[198]) + f[0] = algebraic[3]+algebraic[4]+states[0]-0.0 + f[1] = algebraic[3]-algebraic[4]-(computed_constants[205]+computed_constants[206]) def find_root_0(voi, states, rates, constants, computed_constants, algebraic, externals): u = [nan]*2 - u[0] = algebraic[0] - u[1] = algebraic[1] + u[0] = algebraic[3] + u[1] = algebraic[4] u = nla_solve(objective_function_0, u, 2, [voi, states, rates, constants, computed_constants, algebraic, externals]) - algebraic[0] = u[0] - algebraic[1] = u[1] + algebraic[3] = u[0] + algebraic[4] = u[1] def initialise_variables(states, rates, constants, computed_constants, algebraic): @@ -403,20 +408,21 @@ def initialise_variables(states, rates, constants, computed_constants, algebraic constants[4] = 5.0 constants[5] = 6.0 constants[6] = 7.0 - computed_constants[176] = 123.0 - computed_constants[177] = 123.456789 - computed_constants[178] = 123.0e99 - computed_constants[179] = 123.456789e99 - computed_constants[181] = 1.0 - computed_constants[182] = 0.0 - computed_constants[183] = 2.71828182845905 - computed_constants[184] = 3.14159265358979 - computed_constants[185] = inf - computed_constants[186] = nan - computed_constants[197] = 1.0 - computed_constants[198] = 3.0 - algebraic[0] = 1.0 - algebraic[1] = 2.0 + computed_constants[169] = nan + computed_constants[179] = 123.0 + computed_constants[180] = 123.456789 + computed_constants[181] = 123.0e99 + computed_constants[182] = 123.456789e99 + computed_constants[184] = 1.0 + computed_constants[185] = 0.0 + computed_constants[186] = 2.71828182845905 + computed_constants[187] = 3.14159265358979 + computed_constants[188] = inf + computed_constants[189] = nan + computed_constants[205] = 1.0 + computed_constants[206] = 3.0 + algebraic[3] = 1.0 + algebraic[4] = 2.0 def compute_computed_constants(constants, computed_constants): @@ -429,9 +435,9 @@ def compute_computed_constants(constants, computed_constants): computed_constants[6] = leq_func(constants[0], constants[1]) computed_constants[7] = constants[0]/leq_func(constants[1], constants[2]) computed_constants[8] = gt_func(constants[0], constants[1]) - computed_constants[9] = constants[0]/gt_func(constants[1], constants[2]) + computed_constants[9] = constants[0]/gt_func(constants[2], constants[1]) computed_constants[10] = geq_func(constants[0], constants[1]) - computed_constants[11] = constants[0]/geq_func(constants[1], constants[2]) + computed_constants[11] = constants[0]/geq_func(constants[2], constants[1]) computed_constants[12] = and_func(constants[0], constants[1]) computed_constants[13] = and_func(constants[0], and_func(constants[1], constants[2])) computed_constants[14] = and_func(lt_func(constants[0], constants[1]), gt_func(constants[2], constants[3])) @@ -448,165 +454,172 @@ def compute_computed_constants(constants, computed_constants): computed_constants[25] = and_func(lt_func(constants[0], constants[1]), pow(constants[2], constants[3])) computed_constants[26] = and_func(lt_func(constants[0], constants[1]), pow(constants[2], 1.0/constants[3])) computed_constants[27] = constants[0]/and_func(constants[1], constants[2]) - computed_constants[28] = or_func(constants[0], constants[1]) - computed_constants[29] = or_func(constants[0], or_func(constants[1], constants[2])) - computed_constants[30] = or_func(lt_func(constants[0], constants[1]), gt_func(constants[2], constants[3])) - computed_constants[31] = or_func(constants[0]+constants[1], gt_func(constants[2], constants[3])) - computed_constants[32] = or_func(constants[0], gt_func(constants[1], constants[2])) - computed_constants[33] = or_func(constants[0]-constants[1], gt_func(constants[2], constants[3])) - computed_constants[34] = or_func(-constants[0], gt_func(constants[1], constants[2])) - computed_constants[35] = or_func(pow(constants[0], constants[1]), gt_func(constants[2], constants[3])) - computed_constants[36] = or_func(pow(constants[0], 1.0/constants[1]), gt_func(constants[2], constants[3])) - computed_constants[37] = or_func(lt_func(constants[0], constants[1]), constants[2]+constants[3]) - computed_constants[38] = or_func(lt_func(constants[0], constants[1]), constants[2]) - computed_constants[39] = or_func(lt_func(constants[0], constants[1]), constants[2]-constants[3]) - computed_constants[40] = or_func(lt_func(constants[0], constants[1]), -constants[2]) - computed_constants[41] = or_func(lt_func(constants[0], constants[1]), pow(constants[2], constants[3])) - computed_constants[42] = or_func(lt_func(constants[0], constants[1]), pow(constants[2], 1.0/constants[3])) - computed_constants[43] = constants[0]/or_func(constants[1], constants[2]) - computed_constants[44] = xor_func(constants[0], constants[1]) - computed_constants[45] = xor_func(constants[0], xor_func(constants[1], constants[2])) - computed_constants[46] = xor_func(lt_func(constants[0], constants[1]), gt_func(constants[2], constants[3])) - computed_constants[47] = xor_func(constants[0]+constants[1], gt_func(constants[2], constants[3])) - computed_constants[48] = xor_func(constants[0], gt_func(constants[1], constants[2])) - computed_constants[49] = xor_func(constants[0]-constants[1], gt_func(constants[2], constants[3])) - computed_constants[50] = xor_func(-constants[0], gt_func(constants[1], constants[2])) - computed_constants[51] = xor_func(pow(constants[0], constants[1]), gt_func(constants[2], constants[3])) - computed_constants[52] = xor_func(pow(constants[0], 1.0/constants[1]), gt_func(constants[2], constants[3])) - computed_constants[53] = xor_func(lt_func(constants[0], constants[1]), constants[2]+constants[3]) - computed_constants[54] = xor_func(lt_func(constants[0], constants[1]), constants[2]) - computed_constants[55] = xor_func(lt_func(constants[0], constants[1]), constants[2]-constants[3]) - computed_constants[56] = xor_func(lt_func(constants[0], constants[1]), -constants[2]) - computed_constants[57] = xor_func(lt_func(constants[0], constants[1]), pow(constants[2], constants[3])) - computed_constants[58] = xor_func(lt_func(constants[0], constants[1]), pow(constants[2], 1.0/constants[3])) - computed_constants[59] = constants[0]/xor_func(constants[1], constants[2]) - computed_constants[60] = not_func(constants[0]) - computed_constants[61] = constants[0]+constants[1]+constants[2] - computed_constants[62] = lt_func(constants[0], constants[1])+gt_func(constants[2], constants[3]) - computed_constants[63] = constants[0] - computed_constants[64] = constants[0]-constants[1] - computed_constants[65] = lt_func(constants[0], constants[1])-gt_func(constants[2], constants[3]) - computed_constants[66] = lt_func(constants[0], constants[1])-(constants[2]+constants[3]) - computed_constants[67] = lt_func(constants[0], constants[1])-constants[2] - computed_constants[68] = constants[0]-(-constants[1]) - computed_constants[69] = constants[0]-(-constants[1]*constants[2]) - computed_constants[70] = -constants[0] - computed_constants[71] = -lt_func(constants[0], constants[1]) - computed_constants[72] = constants[0]*constants[1] - computed_constants[73] = constants[0]*constants[1]*constants[2] - computed_constants[74] = lt_func(constants[0], constants[1])*gt_func(constants[2], constants[3]) - computed_constants[75] = (constants[0]+constants[1])*gt_func(constants[2], constants[3]) - computed_constants[76] = constants[0]*gt_func(constants[1], constants[2]) - computed_constants[77] = (constants[0]-constants[1])*gt_func(constants[2], constants[3]) - computed_constants[78] = -constants[0]*gt_func(constants[1], constants[2]) - computed_constants[79] = lt_func(constants[0], constants[1])*(constants[2]+constants[3]) - computed_constants[80] = lt_func(constants[0], constants[1])*constants[2] - computed_constants[81] = lt_func(constants[0], constants[1])*(constants[2]-constants[3]) - computed_constants[82] = lt_func(constants[0], constants[1])*-constants[2] - computed_constants[83] = constants[0]/constants[1] - computed_constants[84] = lt_func(constants[0], constants[1])/gt_func(constants[3], constants[2]) - computed_constants[85] = (constants[0]+constants[1])/gt_func(constants[3], constants[2]) - computed_constants[86] = constants[0]/gt_func(constants[2], constants[1]) - computed_constants[87] = (constants[0]-constants[1])/gt_func(constants[3], constants[2]) - computed_constants[88] = -constants[0]/gt_func(constants[2], constants[1]) - computed_constants[89] = lt_func(constants[0], constants[1])/(constants[2]+constants[3]) - computed_constants[90] = lt_func(constants[0], constants[1])/constants[2] - computed_constants[91] = lt_func(constants[0], constants[1])/(constants[2]-constants[3]) - computed_constants[92] = lt_func(constants[0], constants[1])/-constants[2] - computed_constants[93] = lt_func(constants[0], constants[1])/(constants[2]*constants[3]) - computed_constants[94] = lt_func(constants[0], constants[1])/(constants[2]/constants[3]) - computed_constants[95] = sqrt(constants[0]) - computed_constants[96] = pow(constants[0], 2.0) - computed_constants[97] = pow(constants[0], 3.0) - computed_constants[98] = pow(constants[0], constants[1]) - computed_constants[99] = pow(leq_func(constants[0], constants[1]), geq_func(constants[2], constants[3])) - computed_constants[100] = pow(constants[0]+constants[1], geq_func(constants[2], constants[3])) - computed_constants[101] = pow(constants[0], geq_func(constants[1], constants[2])) - computed_constants[102] = pow(constants[0]-constants[1], geq_func(constants[2], constants[3])) - computed_constants[103] = pow(-constants[0], geq_func(constants[1], constants[2])) - computed_constants[104] = pow(constants[0]*constants[1], geq_func(constants[2], constants[3])) - computed_constants[105] = pow(constants[0]/constants[1], geq_func(constants[2], constants[3])) - computed_constants[106] = pow(leq_func(constants[0], constants[1]), constants[2]+constants[3]) - computed_constants[107] = pow(leq_func(constants[0], constants[1]), constants[2]) - computed_constants[108] = pow(leq_func(constants[0], constants[1]), constants[2]-constants[3]) - computed_constants[109] = pow(leq_func(constants[0], constants[1]), -constants[2]) - computed_constants[110] = pow(leq_func(constants[0], constants[1]), constants[2]*constants[3]) - computed_constants[111] = pow(leq_func(constants[0], constants[1]), constants[2]/constants[3]) - computed_constants[112] = pow(leq_func(constants[0], constants[1]), pow(constants[2], constants[3])) - computed_constants[113] = pow(leq_func(constants[0], constants[1]), pow(constants[2], 1.0/constants[3])) - computed_constants[114] = sqrt(constants[0]) - computed_constants[115] = sqrt(constants[0]) - computed_constants[116] = pow(constants[0], 1.0/3.0) - computed_constants[117] = pow(constants[0], 1.0/constants[1]) - computed_constants[118] = pow(lt_func(constants[0], constants[1]), 1.0/gt_func(constants[3], constants[2])) - computed_constants[119] = pow(constants[0]+constants[1], 1.0/gt_func(constants[3], constants[2])) - computed_constants[120] = pow(constants[0], 1.0/gt_func(constants[2], constants[1])) - computed_constants[121] = pow(constants[0]-constants[1], 1.0/gt_func(constants[3], constants[2])) - computed_constants[122] = pow(-constants[0], 1.0/gt_func(constants[2], constants[1])) - computed_constants[123] = pow(constants[0]*constants[1], 1.0/gt_func(constants[3], constants[2])) - computed_constants[124] = pow(constants[0]/constants[1], 1.0/gt_func(constants[3], constants[2])) - computed_constants[125] = pow(lt_func(constants[0], constants[1]), 1.0/(constants[2]+constants[3])) - computed_constants[126] = pow(lt_func(constants[0], constants[1]), 1.0/constants[2]) - computed_constants[127] = pow(lt_func(constants[0], constants[1]), 1.0/(constants[2]-constants[3])) - computed_constants[128] = pow(lt_func(constants[0], constants[1]), 1.0/-constants[2]) - computed_constants[129] = pow(lt_func(constants[0], constants[1]), 1.0/(constants[2]*constants[3])) - computed_constants[130] = pow(lt_func(constants[0], constants[1]), 1.0/(constants[2]/constants[3])) - computed_constants[131] = pow(lt_func(constants[0], constants[1]), 1.0/pow(constants[2], constants[3])) - computed_constants[132] = pow(lt_func(constants[0], constants[1]), 1.0/pow(constants[2], 1.0/constants[3])) - computed_constants[133] = fabs(constants[0]) - computed_constants[134] = exp(constants[0]) - computed_constants[135] = log(constants[0]) + computed_constants[28] = or_func(lt_func(constants[0], constants[1]), gt_func(constants[2], constants[3])) + computed_constants[29] = or_func(constants[0]+constants[1], gt_func(constants[2], constants[3])) + computed_constants[30] = or_func(constants[0], gt_func(constants[1], constants[2])) + computed_constants[31] = or_func(constants[0]-constants[1], gt_func(constants[2], constants[3])) + computed_constants[32] = or_func(-constants[0], gt_func(constants[1], constants[2])) + computed_constants[33] = or_func(pow(constants[0], constants[1]), gt_func(constants[2], constants[3])) + computed_constants[34] = or_func(pow(constants[0], 1.0/constants[1]), gt_func(constants[2], constants[3])) + computed_constants[35] = or_func(lt_func(constants[0], constants[1]), constants[2]+constants[3]) + computed_constants[36] = or_func(lt_func(constants[0], constants[1]), constants[2]) + computed_constants[37] = or_func(lt_func(constants[0], constants[1]), constants[2]-constants[3]) + computed_constants[38] = or_func(lt_func(constants[0], constants[1]), -constants[2]) + computed_constants[39] = or_func(lt_func(constants[0], constants[1]), pow(constants[2], constants[3])) + computed_constants[40] = or_func(lt_func(constants[0], constants[1]), pow(constants[2], 1.0/constants[3])) + computed_constants[41] = constants[0]/or_func(constants[1], constants[2]) + computed_constants[42] = xor_func(constants[0], constants[1]) + computed_constants[43] = xor_func(constants[0], xor_func(constants[1], constants[2])) + computed_constants[44] = xor_func(lt_func(constants[0], constants[1]), gt_func(constants[2], constants[3])) + computed_constants[45] = xor_func(constants[0]+constants[1], gt_func(constants[2], constants[3])) + computed_constants[46] = xor_func(constants[0], gt_func(constants[1], constants[2])) + computed_constants[47] = xor_func(constants[0]-constants[1], gt_func(constants[2], constants[3])) + computed_constants[48] = xor_func(-constants[0], gt_func(constants[1], constants[2])) + computed_constants[49] = xor_func(pow(constants[0], constants[1]), gt_func(constants[2], constants[3])) + computed_constants[50] = xor_func(pow(constants[0], 1.0/constants[1]), gt_func(constants[2], constants[3])) + computed_constants[51] = xor_func(lt_func(constants[0], constants[1]), constants[2]+constants[3]) + computed_constants[52] = xor_func(lt_func(constants[0], constants[1]), constants[2]) + computed_constants[53] = xor_func(lt_func(constants[0], constants[1]), constants[2]-constants[3]) + computed_constants[54] = xor_func(lt_func(constants[0], constants[1]), -constants[2]) + computed_constants[55] = xor_func(lt_func(constants[0], constants[1]), pow(constants[2], constants[3])) + computed_constants[56] = xor_func(lt_func(constants[0], constants[1]), pow(constants[2], 1.0/constants[3])) + computed_constants[57] = not_func(constants[0]) + computed_constants[58] = constants[0]+constants[1]+constants[2] + computed_constants[59] = lt_func(constants[0], constants[1])+gt_func(constants[2], constants[3]) + computed_constants[60] = constants[0] + computed_constants[61] = constants[0]-constants[1] + computed_constants[62] = lt_func(constants[0], constants[1])-gt_func(constants[2], constants[3]) + computed_constants[63] = lt_func(constants[0], constants[1])-(constants[2]+constants[3]) + computed_constants[64] = lt_func(constants[0], constants[1])-constants[2] + computed_constants[65] = constants[0]-(-constants[1]) + computed_constants[66] = constants[0]-(-constants[1]*constants[2]) + computed_constants[67] = -constants[0] + computed_constants[68] = -lt_func(constants[0], constants[1]) + computed_constants[69] = constants[0]*constants[1] + computed_constants[70] = constants[0]*constants[1]*constants[2] + computed_constants[71] = lt_func(constants[0], constants[1])*gt_func(constants[2], constants[3]) + computed_constants[72] = (constants[0]+constants[1])*gt_func(constants[2], constants[3]) + computed_constants[73] = constants[0]*gt_func(constants[1], constants[2]) + computed_constants[74] = (constants[0]-constants[1])*gt_func(constants[2], constants[3]) + computed_constants[75] = -constants[0]*gt_func(constants[1], constants[2]) + computed_constants[76] = lt_func(constants[0], constants[1])*(constants[2]+constants[3]) + computed_constants[77] = lt_func(constants[0], constants[1])*constants[2] + computed_constants[78] = lt_func(constants[0], constants[1])*(constants[2]-constants[3]) + computed_constants[79] = lt_func(constants[0], constants[1])*-constants[2] + computed_constants[80] = constants[0]/constants[1] + computed_constants[81] = lt_func(constants[0], constants[1])/gt_func(constants[3], constants[2]) + computed_constants[82] = (constants[0]+constants[1])/gt_func(constants[3], constants[2]) + computed_constants[83] = constants[0]/gt_func(constants[2], constants[1]) + computed_constants[84] = (constants[0]-constants[1])/gt_func(constants[3], constants[2]) + computed_constants[85] = -constants[0]/gt_func(constants[2], constants[1]) + computed_constants[86] = lt_func(constants[0], constants[1])/(constants[2]+constants[3]) + computed_constants[87] = lt_func(constants[0], constants[1])/constants[2] + computed_constants[88] = lt_func(constants[0], constants[1])/(constants[2]-constants[3]) + computed_constants[89] = lt_func(constants[0], constants[1])/-constants[2] + computed_constants[90] = lt_func(constants[0], constants[1])/(constants[2]*constants[3]) + computed_constants[91] = lt_func(constants[0], constants[1])/(constants[2]/constants[3]) + computed_constants[92] = sqrt(constants[0]) + computed_constants[93] = pow(constants[0], 2.0) + computed_constants[94] = pow(constants[0], 3.0) + computed_constants[95] = pow(constants[0], constants[1]) + computed_constants[96] = pow(leq_func(constants[0], constants[1]), geq_func(constants[2], constants[3])) + computed_constants[97] = pow(constants[0]+constants[1], geq_func(constants[2], constants[3])) + computed_constants[98] = pow(constants[0], geq_func(constants[1], constants[2])) + computed_constants[99] = pow(constants[0]-constants[1], geq_func(constants[2], constants[3])) + computed_constants[100] = pow(-constants[0], geq_func(constants[1], constants[2])) + computed_constants[101] = pow(constants[0]*constants[1], geq_func(constants[2], constants[3])) + computed_constants[102] = pow(constants[0]/constants[1], geq_func(constants[2], constants[3])) + computed_constants[103] = pow(leq_func(constants[0], constants[1]), constants[2]+constants[3]) + computed_constants[104] = pow(leq_func(constants[0], constants[1]), constants[2]) + computed_constants[105] = pow(leq_func(constants[0], constants[1]), constants[2]-constants[3]) + computed_constants[106] = pow(leq_func(constants[0], constants[1]), -constants[2]) + computed_constants[107] = pow(leq_func(constants[0], constants[1]), constants[2]*constants[3]) + computed_constants[108] = pow(leq_func(constants[0], constants[1]), constants[2]/constants[3]) + computed_constants[109] = pow(leq_func(constants[0], constants[1]), pow(constants[2], constants[3])) + computed_constants[110] = pow(leq_func(constants[0], constants[1]), pow(constants[2], 1.0/constants[3])) + computed_constants[111] = sqrt(constants[0]) + computed_constants[112] = sqrt(constants[0]) + computed_constants[113] = pow(constants[0], 1.0/0.5) + computed_constants[114] = pow(constants[0], 1.0/3.0) + computed_constants[115] = pow(constants[0], 1.0/constants[1]) + computed_constants[116] = pow(lt_func(constants[0], constants[1]), 1.0/gt_func(constants[3], constants[2])) + computed_constants[117] = pow(constants[0]+constants[1], 1.0/gt_func(constants[3], constants[2])) + computed_constants[118] = pow(constants[0], 1.0/gt_func(constants[2], constants[1])) + computed_constants[119] = pow(constants[0]-constants[1], 1.0/gt_func(constants[3], constants[2])) + computed_constants[120] = pow(-constants[0], 1.0/gt_func(constants[2], constants[1])) + computed_constants[121] = pow(constants[0]*constants[1], 1.0/gt_func(constants[3], constants[2])) + computed_constants[122] = pow(constants[0]/constants[1], 1.0/gt_func(constants[3], constants[2])) + computed_constants[123] = pow(lt_func(constants[0], constants[1]), 1.0/(constants[2]+constants[3])) + computed_constants[124] = pow(lt_func(constants[0], constants[1]), 1.0/constants[2]) + computed_constants[125] = pow(lt_func(constants[0], constants[1]), 1.0/(constants[2]-constants[3])) + computed_constants[126] = pow(lt_func(constants[0], constants[1]), 1.0/-constants[2]) + computed_constants[127] = pow(lt_func(constants[0], constants[1]), 1.0/(constants[2]*constants[3])) + computed_constants[128] = pow(lt_func(constants[0], constants[1]), 1.0/(constants[2]/constants[3])) + computed_constants[129] = pow(lt_func(constants[0], constants[1]), 1.0/pow(constants[2], constants[3])) + computed_constants[130] = pow(lt_func(constants[0], constants[1]), 1.0/pow(constants[2], 1.0/constants[3])) + computed_constants[131] = fabs(constants[0]) + computed_constants[132] = exp(constants[0]) + computed_constants[133] = log(constants[0]) + computed_constants[134] = log10(constants[0]) + computed_constants[135] = log(constants[0])/log(2.0) computed_constants[136] = log10(constants[0]) - computed_constants[137] = log(constants[0])/log(2.0) - computed_constants[138] = log10(constants[0]) - computed_constants[139] = log(constants[0])/log(constants[1]) - computed_constants[140] = ceil(constants[0]) - computed_constants[141] = floor(constants[0]) - computed_constants[142] = min(constants[0], constants[1]) - computed_constants[143] = min(constants[0], min(constants[1], constants[2])) - computed_constants[144] = max(constants[0], constants[1]) - computed_constants[145] = max(constants[0], max(constants[1], constants[2])) - computed_constants[146] = fmod(constants[0], constants[1]) - computed_constants[147] = sin(constants[0]) - computed_constants[148] = cos(constants[0]) - computed_constants[149] = tan(constants[0]) - computed_constants[150] = sec(constants[0]) - computed_constants[151] = csc(constants[0]) - computed_constants[152] = cot(constants[0]) - computed_constants[153] = sinh(constants[0]) - computed_constants[154] = cosh(constants[0]) - computed_constants[155] = tanh(constants[0]) - computed_constants[156] = sech(constants[0]) - computed_constants[157] = csch(constants[0]) - computed_constants[158] = coth(constants[0]) - computed_constants[159] = asin(constants[0]) - computed_constants[160] = acos(constants[0]) - computed_constants[161] = atan(constants[0]) - computed_constants[162] = asec(constants[0]) - computed_constants[163] = acsc(constants[0]) - computed_constants[164] = acot(constants[0]) - computed_constants[165] = asinh(constants[0]) - computed_constants[166] = acosh(constants[0]) - computed_constants[167] = atanh(constants[0]/2.0) - computed_constants[168] = asech(constants[0]) - computed_constants[169] = acsch(constants[0]) - computed_constants[170] = acoth(2.0*constants[0]) - computed_constants[171] = constants[0] if gt_func(constants[0], constants[1]) else nan - computed_constants[172] = constants[0] if gt_func(constants[0], constants[1]) else constants[2] - computed_constants[173] = constants[0] if gt_func(constants[0], constants[1]) else constants[2] if gt_func(constants[2], constants[3]) else constants[4] if gt_func(constants[4], constants[5]) else nan - computed_constants[174] = constants[0] if gt_func(constants[0], constants[1]) else constants[2] if gt_func(constants[2], constants[3]) else constants[4] if gt_func(constants[4], constants[5]) else constants[6] - computed_constants[175] = 123.0+(constants[0] if gt_func(constants[0], constants[1]) else nan) - computed_constants[180] = constants[0] - computed_constants[187] = and_func(constants[0], constants[1])+(constants[1] if gt_func(constants[2], constants[3]) else nan)+constants[4]+and_func(constants[5], constants[6]) - computed_constants[188] = and_func(constants[0], constants[1])-((constants[1] if gt_func(constants[2], constants[3]) else nan)-(constants[4]-(constants[1] if gt_func(constants[2], constants[3]) else nan)))-and_func(constants[5], constants[6]) - computed_constants[189] = and_func(constants[0], constants[1])*(constants[1] if gt_func(constants[2], constants[3]) else nan)*constants[4]*(constants[1] if gt_func(constants[2], constants[3]) else nan)*and_func(constants[5], constants[6]) - computed_constants[190] = and_func(constants[0], constants[1])/((constants[1] if gt_func(constants[2], constants[3]) else nan)/(constants[4]/(constants[1] if gt_func(constants[2], constants[3]) else nan))) - computed_constants[191] = and_func(or_func(constants[0], constants[1]), and_func(xor_func(constants[0], constants[1]), and_func(constants[1] if gt_func(constants[2], constants[3]) else nan, and_func(and_func(and_func(constants[4], constants[1] if gt_func(constants[2], constants[3]) else nan), xor_func(constants[0], constants[1])), or_func(constants[0], constants[1]))))) - computed_constants[192] = or_func(and_func(constants[0], constants[1]), or_func(xor_func(constants[0], constants[1]), or_func(constants[1] if gt_func(constants[2], constants[3]) else nan, or_func(or_func(or_func(constants[4], constants[1] if gt_func(constants[2], constants[3]) else nan), xor_func(constants[0], constants[1])), and_func(constants[0], constants[1]))))) - computed_constants[193] = xor_func(and_func(constants[0], constants[1]), xor_func(or_func(constants[0], constants[1]), xor_func(constants[1] if gt_func(constants[2], constants[3]) else nan, xor_func(xor_func(xor_func(constants[4], constants[1] if gt_func(constants[2], constants[3]) else nan), or_func(constants[0], constants[1])), and_func(constants[0], constants[1]))))) - computed_constants[194] = pow(and_func(constants[0], constants[1]), pow(constants[1] if gt_func(constants[2], constants[3]) else nan, pow(pow(constants[4], constants[1] if gt_func(constants[2], constants[3]) else nan), and_func(constants[0], constants[1])))) - computed_constants[195] = pow(pow(pow(and_func(constants[0], constants[1]), 1.0/pow(constants[1] if gt_func(constants[2], constants[3]) else nan, 1.0/constants[4])), 1.0/(constants[1] if gt_func(constants[2], constants[3]) else nan)), 1.0/and_func(constants[0], constants[1])) - computed_constants[196] = -and_func(constants[0], constants[1])+-(constants[1] if gt_func(constants[2], constants[3]) else nan) + computed_constants[137] = log(constants[0])/log(constants[1]) + computed_constants[138] = ceil(constants[0]) + computed_constants[139] = floor(constants[0]) + computed_constants[140] = min(constants[0], constants[1]) + computed_constants[141] = min(constants[0], min(constants[1], constants[2])) + computed_constants[142] = max(constants[0], constants[1]) + computed_constants[143] = max(constants[0], max(constants[1], constants[2])) + computed_constants[144] = fmod(constants[0], constants[1]) + computed_constants[145] = sin(constants[0]) + computed_constants[146] = cos(constants[0]) + computed_constants[147] = tan(constants[0]) + computed_constants[148] = sec(constants[0]) + computed_constants[149] = csc(constants[0]) + computed_constants[150] = cot(constants[0]) + computed_constants[151] = sinh(constants[0]) + computed_constants[152] = cosh(constants[0]) + computed_constants[153] = tanh(constants[0]) + computed_constants[154] = sech(constants[0]) + computed_constants[155] = csch(constants[0]) + computed_constants[156] = coth(constants[0]) + computed_constants[157] = asin(constants[0]) + computed_constants[158] = acos(constants[0]) + computed_constants[159] = atan(constants[0]) + computed_constants[160] = asec(constants[0]) + computed_constants[161] = acsc(constants[0]) + computed_constants[162] = acot(constants[0]) + computed_constants[163] = asinh(constants[0]) + computed_constants[164] = acosh(constants[0]) + computed_constants[165] = atanh(constants[0]/2.0) + computed_constants[166] = asech(constants[0]) + computed_constants[167] = acsch(constants[0]) + computed_constants[168] = acoth(2.0*constants[0]) + computed_constants[170] = constants[0] if gt_func(constants[0], constants[1]) else nan + computed_constants[171] = constants[0] if lt_func(constants[0], constants[1]) else nan + computed_constants[172] = constants[0] + computed_constants[173] = constants[0] if gt_func(constants[0], constants[1]) else constants[2] + computed_constants[174] = constants[0] if gt_func(constants[0], constants[1]) else constants[2] if gt_func(constants[2], constants[3]) else constants[4] if gt_func(constants[4], constants[5]) else nan + computed_constants[175] = constants[0] if lt_func(constants[0], constants[1]) else constants[2] if gt_func(constants[2], constants[3]) else constants[4] if gt_func(constants[4], constants[5]) else nan + computed_constants[176] = constants[0] if gt_func(constants[0], constants[1]) else constants[2] if gt_func(constants[2], constants[3]) else constants[4] if gt_func(constants[4], constants[5]) else constants[6] + computed_constants[177] = 123.0+(constants[0] if gt_func(constants[0], constants[1]) else nan) + computed_constants[178] = 123.0+(constants[0] if lt_func(constants[0], constants[1]) else nan) + computed_constants[183] = constants[0] + computed_constants[190] = and_func(constants[0], constants[1])+(constants[1] if gt_func(constants[2], constants[3]) else nan)+constants[4]+and_func(constants[5], constants[6]) + computed_constants[191] = and_func(constants[0], constants[1])+(constants[1] if lt_func(constants[2], constants[3]) else nan)+constants[4]+and_func(constants[5], constants[6]) + computed_constants[192] = and_func(constants[0], constants[1])-((constants[1] if gt_func(constants[2], constants[3]) else nan)-(constants[4]-(constants[1] if gt_func(constants[2], constants[3]) else nan)))-and_func(constants[5], constants[6]) + computed_constants[193] = and_func(constants[0], constants[1])-((constants[1] if lt_func(constants[2], constants[3]) else nan)-(constants[4]-(constants[1] if lt_func(constants[2], constants[3]) else nan)))-and_func(constants[5], constants[6]) + computed_constants[194] = and_func(constants[0], constants[1])*(constants[1] if gt_func(constants[2], constants[3]) else nan)*constants[4]*(constants[1] if gt_func(constants[2], constants[3]) else nan)*and_func(constants[5], constants[6]) + computed_constants[195] = and_func(constants[0], constants[1])*(constants[1] if lt_func(constants[2], constants[3]) else nan)*constants[4]*(constants[1] if lt_func(constants[2], constants[3]) else nan)*and_func(constants[5], constants[6]) + computed_constants[196] = and_func(constants[0], constants[1])/((constants[1] if gt_func(constants[2], constants[3]) else nan)/(constants[4]/(constants[1] if gt_func(constants[2], constants[3]) else nan))) + computed_constants[197] = and_func(constants[0], constants[1])/((constants[1] if lt_func(constants[2], constants[3]) else nan)/(constants[4]/(constants[1] if lt_func(constants[2], constants[3]) else nan))) + computed_constants[198] = and_func(or_func(constants[0], constants[1]), and_func(xor_func(constants[0], constants[1]), and_func(constants[1] if gt_func(constants[2], constants[3]) else nan, and_func(and_func(and_func(constants[4], constants[1] if gt_func(constants[2], constants[3]) else nan), xor_func(constants[0], constants[1])), or_func(constants[0], constants[1]))))) + computed_constants[199] = or_func(and_func(constants[0], constants[1]), or_func(xor_func(constants[0], constants[1]), or_func(constants[1] if gt_func(constants[2], constants[3]) else nan, or_func(or_func(or_func(constants[4], constants[1] if gt_func(constants[2], constants[3]) else nan), xor_func(constants[0], constants[1])), and_func(constants[0], constants[1]))))) + computed_constants[200] = xor_func(and_func(constants[0], constants[1]), xor_func(or_func(constants[0], constants[1]), xor_func(constants[1] if gt_func(constants[2], constants[3]) else nan, xor_func(xor_func(xor_func(constants[4], constants[1] if gt_func(constants[2], constants[3]) else nan), or_func(constants[0], constants[1])), and_func(constants[0], constants[1]))))) + computed_constants[201] = pow(and_func(constants[0], constants[1]), pow(constants[1] if gt_func(constants[2], constants[3]) else nan, pow(pow(constants[4], constants[1] if gt_func(constants[2], constants[3]) else nan), and_func(constants[0], constants[1])))) + computed_constants[202] = pow(pow(pow(and_func(constants[0], constants[1]), 1.0/pow(constants[1] if gt_func(constants[2], constants[3]) else nan, 1.0/constants[4])), 1.0/(constants[1] if gt_func(constants[2], constants[3]) else nan)), 1.0/and_func(constants[0], constants[1])) + computed_constants[203] = -and_func(constants[0], constants[1])+-(constants[1] if gt_func(constants[2], constants[3]) else nan) + computed_constants[204] = -and_func(constants[0], constants[1])+-(constants[1] if lt_func(constants[2], constants[3]) else nan) def compute_rates(voi, states, rates, constants, computed_constants, algebraic, externals, external_variable): @@ -614,5 +627,8 @@ def compute_rates(voi, states, rates, constants, computed_constants, algebraic, def compute_variables(voi, states, rates, constants, computed_constants, algebraic, externals, external_variable): + algebraic[0] = or_func(states[0], states[0]) + algebraic[1] = or_func(states[0], or_func(states[0], constants[0])) + algebraic[2] = constants[0]/xor_func(constants[1], states[0]) externals[0] = external_variable(voi, states, rates, constants, computed_constants, algebraic, externals, 0) find_root_0(voi, states, rates, constants, computed_constants, algebraic, externals) diff --git a/tests/resources/coverage/generator/model.modified.profile.c b/tests/resources/coverage/generator/model.xor.c similarity index 65% rename from tests/resources/coverage/generator/model.modified.profile.c rename to tests/resources/coverage/generator/model.xor.c index 6bbe6f4075..9861b1a292 100644 --- a/tests/resources/coverage/generator/model.modified.profile.c +++ b/tests/resources/coverage/generator/model.xor.c @@ -10,8 +10,8 @@ const char LIBCELLML_VERSION[] = "0.6.0"; const size_t STATE_COUNT = 1; const size_t CONSTANT_COUNT = 7; -const size_t COMPUTED_CONSTANT_COUNT = 199; -const size_t ALGEBRAIC_COUNT = 2; +const size_t COMPUTED_CONSTANT_COUNT = 207; +const size_t ALGEBRAIC_COUNT = 5; const size_t EXTERNAL_COUNT = 1; const VariableInfo VOI_INFO = {"t", "second", "my_component"}; @@ -59,8 +59,6 @@ const VariableInfo COMPUTED_CONSTANT_INFO[] = { {"eqnAndParenthesesRightPower", "dimensionless", "my_component"}, {"eqnAndParenthesesRightRoot", "dimensionless", "my_component"}, {"eqnAndCoverageParentheses", "dimensionless", "my_component"}, - {"eqnOr", "dimensionless", "my_component"}, - {"eqnOrMultiple", "dimensionless", "my_component"}, {"eqnOrParentheses", "dimensionless", "my_component"}, {"eqnOrParenthesesLeftPlusWith", "dimensionless", "my_component"}, {"eqnOrParenthesesLeftPlusWithout", "dimensionless", "my_component"}, @@ -90,7 +88,6 @@ const VariableInfo COMPUTED_CONSTANT_INFO[] = { {"eqnXorParenthesesRightMinusWithout", "dimensionless", "my_component"}, {"eqnXorParenthesesRightPower", "dimensionless", "my_component"}, {"eqnXorParenthesesRightRoot", "dimensionless", "my_component"}, - {"eqnXorCoverageParentheses", "dimensionless", "my_component"}, {"eqnNot", "dimensionless", "my_component"}, {"eqnPlusMultiple", "dimensionless", "my_component"}, {"eqnPlusParentheses", "dimensionless", "my_component"}, @@ -147,6 +144,7 @@ const VariableInfo COMPUTED_CONSTANT_INFO[] = { {"eqnPowerParenthesesRightRoot", "dimensionless", "my_component"}, {"eqnRootSqrt", "dimensionless", "my_component"}, {"eqnRootSqrtOther", "dimensionless", "my_component"}, + {"eqnRootSqr", "dimensionless", "my_component"}, {"eqnRootCube", "dimensionless", "my_component"}, {"eqnRootCi", "dimensionless", "my_component"}, {"eqnRootParentheses", "dimensionless", "my_component"}, @@ -202,11 +200,16 @@ const VariableInfo COMPUTED_CONSTANT_INFO[] = { {"eqnArcsech", "dimensionless", "my_component"}, {"eqnArccsch", "dimensionless", "my_component"}, {"eqnArccoth", "dimensionless", "my_component"}, + {"eqnPiecewise", "dimensionless", "my_component"}, {"eqnPiecewisePiece", "dimensionless", "my_component"}, + {"eqnPiecewisePiece2", "dimensionless", "my_component"}, + {"eqnPiecewiseOtherwise", "dimensionless", "my_component"}, {"eqnPiecewisePieceOtherwise", "dimensionless", "my_component"}, {"eqnPiecewisePiecePiecePiece", "dimensionless", "my_component"}, + {"eqnPiecewisePiecePiecePiece2", "dimensionless", "my_component"}, {"eqnPiecewisePiecePiecePieceOtherwise", "dimensionless", "my_component"}, {"eqnWithPiecewise", "dimensionless", "my_component"}, + {"eqnWithPiecewise2", "dimensionless", "my_component"}, {"eqnCnInteger", "dimensionless", "my_component"}, {"eqnCnDouble", "dimensionless", "my_component"}, {"eqnCnIntegerWithExponent", "dimensionless", "my_component"}, @@ -219,20 +222,28 @@ const VariableInfo COMPUTED_CONSTANT_INFO[] = { {"eqnInfinity", "dimensionless", "my_component"}, {"eqnNotanumber", "dimensionless", "my_component"}, {"eqnCoverageForPlusOperator", "dimensionless", "my_component"}, + {"eqnCoverageForPlusOperator2", "dimensionless", "my_component"}, {"eqnCoverageForMinusOperator", "dimensionless", "my_component"}, + {"eqnCoverageForMinusOperator2", "dimensionless", "my_component"}, {"eqnCoverageForTimesOperator", "dimensionless", "my_component"}, + {"eqnCoverageForTimesOperator2", "dimensionless", "my_component"}, {"eqnCoverageForDivideOperator", "dimensionless", "my_component"}, + {"eqnCoverageForDivideOperator2", "dimensionless", "my_component"}, {"eqnCoverageForAndOperator", "dimensionless", "my_component"}, {"eqnCoverageForOrOperator", "dimensionless", "my_component"}, {"eqnCoverageForXorOperator", "dimensionless", "my_component"}, {"eqnCoverageForPowerOperator", "dimensionless", "my_component"}, {"eqnCoverageForRootOperator", "dimensionless", "my_component"}, {"eqnCoverageForMinusUnary", "dimensionless", "my_component"}, + {"eqnCoverageForMinusUnary2", "dimensionless", "my_component"}, {"eqnComputedConstant1", "dimensionless", "my_component"}, {"eqnComputedConstant2", "dimensionless", "my_component"} }; const VariableInfo ALGEBRAIC_INFO[] = { + {"eqnOr", "dimensionless", "my_component"}, + {"eqnOrMultiple", "dimensionless", "my_component"}, + {"eqnXorCoverageParentheses", "dimensionless", "my_component"}, {"eqnNlaVariable1", "dimensionless", "my_component"}, {"eqnNlaVariable2", "dimensionless", "my_component"} }; @@ -241,21 +252,11 @@ const VariableInfo EXTERNAL_INFO[] = { {"eqnPlus", "dimensionless", "my_component"} }; -double xor(double x, double y) +double XOR(double x, double y) { return (x != 0.0) ^ (y != 0.0); } -double min(double x, double y) -{ - return (x < y)?x:y; -} - -double max(double x, double y) -{ - return (x > y)?x:y; -} - double sec(double x) { return 1.0/cos(x); @@ -303,26 +304,20 @@ double acot(double x) double asech(double x) { - double oneOverX = 1.0/x; - - return log(oneOverX+sqrt(oneOverX*oneOverX-1.0)); + return acosh(1.0/x); } double acsch(double x) { - double oneOverX = 1.0/x; - - return log(oneOverX+sqrt(oneOverX*oneOverX+1.0)); + return asinh(1.0/x); } double acoth(double x) { - double oneOverX = 1.0/x; - - return 0.5*log((1.0+oneOverX)/(1.0-oneOverX)); + return atanh(1.0/x); } -double * createStatesVector() +double * createStatesArray() { double *res = (double *) malloc(STATE_COUNT*sizeof(double)); @@ -405,11 +400,11 @@ void objectiveFunction0(double *u, double *f, void *data) double *algebraic = ((RootFindingInfo *) data)->algebraic; double *externals = ((RootFindingInfo *) data)->externals; - algebraic[0] = u[0]; - algebraic[1] = u[1]; + algebraic[3] = u[0]; + algebraic[4] = u[1]; - f[0] = algebraic[0]+algebraic[1]+states[0]-0.0; - f[1] = algebraic[0]-algebraic[1]-(computedConstants[197]+computedConstants[198]); + f[0] = algebraic[3]+algebraic[4]+states[0]-0.0; + f[1] = algebraic[3]-algebraic[4]-(computedConstants[205]+computedConstants[206]); } void findRoot0(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, double *externals) @@ -417,13 +412,13 @@ void findRoot0(double voi, double *states, double *rates, double *constants, dou RootFindingInfo rfi = { voi, states, rates, constants, computedConstants, algebraic, externals }; double u[2]; - u[0] = algebraic[0]; - u[1] = algebraic[1]; + u[0] = algebraic[3]; + u[1] = algebraic[4]; nlaSolve(objectiveFunction0, u, 2, &rfi); - algebraic[0] = u[0]; - algebraic[1] = u[1]; + algebraic[3] = u[0]; + algebraic[4] = u[1]; } void initialiseVariables(double *states, double *rates, double *constants, double *computedConstants, double *algebraic) @@ -436,20 +431,21 @@ void initialiseVariables(double *states, double *rates, double *constants, doubl constants[4] = 5.0; constants[5] = 6.0; constants[6] = 7.0; - computedConstants[176] = 123.0; - computedConstants[177] = 123.456789; - computedConstants[178] = 123.0e99; - computedConstants[179] = 123.456789e99; - computedConstants[181] = 1.0; - computedConstants[182] = 0.0; - computedConstants[183] = 2.71828182845905; - computedConstants[184] = 3.14159265358979; - computedConstants[185] = INFINITY; - computedConstants[186] = NAN; - computedConstants[197] = 1.0; - computedConstants[198] = 3.0; - algebraic[0] = 1.0; - algebraic[1] = 2.0; + computedConstants[169] = NAN; + computedConstants[179] = 123.0; + computedConstants[180] = 123.456789; + computedConstants[181] = 123.0e99; + computedConstants[182] = 123.456789e99; + computedConstants[184] = 1.0; + computedConstants[185] = 0.0; + computedConstants[186] = 2.71828182845905; + computedConstants[187] = 3.14159265358979; + computedConstants[188] = INFINITY; + computedConstants[189] = NAN; + computedConstants[205] = 1.0; + computedConstants[206] = 3.0; + algebraic[3] = 1.0; + algebraic[4] = 2.0; } void computeComputedConstants(double *constants, double *computedConstants) @@ -463,9 +459,9 @@ void computeComputedConstants(double *constants, double *computedConstants) computedConstants[6] = constants[0] <= constants[1]; computedConstants[7] = constants[0]/(constants[1] <= constants[2]); computedConstants[8] = constants[0] > constants[1]; - computedConstants[9] = constants[0]/(constants[1] > constants[2]); + computedConstants[9] = constants[0]/(constants[2] > constants[1]); computedConstants[10] = constants[0] >= constants[1]; - computedConstants[11] = constants[0]/(constants[1] >= constants[2]); + computedConstants[11] = constants[0]/(constants[2] >= constants[1]); computedConstants[12] = constants[0] && constants[1]; computedConstants[13] = constants[0] && constants[1] && constants[2]; computedConstants[14] = (constants[0] < constants[1]) && (constants[2] > constants[3]); @@ -482,165 +478,172 @@ void computeComputedConstants(double *constants, double *computedConstants) computedConstants[25] = (constants[0] < constants[1]) && pow(constants[2], constants[3]); computedConstants[26] = (constants[0] < constants[1]) && pow(constants[2], 1.0/constants[3]); computedConstants[27] = constants[0]/(constants[1] && constants[2]); - computedConstants[28] = constants[0] || constants[1]; - computedConstants[29] = constants[0] || constants[1] || constants[2]; - computedConstants[30] = (constants[0] < constants[1]) || (constants[2] > constants[3]); - computedConstants[31] = (constants[0]+constants[1]) || (constants[2] > constants[3]); - computedConstants[32] = constants[0] || (constants[1] > constants[2]); - computedConstants[33] = (constants[0]-constants[1]) || (constants[2] > constants[3]); - computedConstants[34] = -constants[0] || (constants[1] > constants[2]); - computedConstants[35] = pow(constants[0], constants[1]) || (constants[2] > constants[3]); - computedConstants[36] = pow(constants[0], 1.0/constants[1]) || (constants[2] > constants[3]); - computedConstants[37] = (constants[0] < constants[1]) || (constants[2]+constants[3]); - computedConstants[38] = (constants[0] < constants[1]) || constants[2]; - computedConstants[39] = (constants[0] < constants[1]) || (constants[2]-constants[3]); - computedConstants[40] = (constants[0] < constants[1]) || -constants[2]; - computedConstants[41] = (constants[0] < constants[1]) || pow(constants[2], constants[3]); - computedConstants[42] = (constants[0] < constants[1]) || pow(constants[2], 1.0/constants[3]); - computedConstants[43] = constants[0]/(constants[1] || constants[2]); - computedConstants[44] = xor(constants[0], constants[1]); - computedConstants[45] = xor(constants[0], xor(constants[1], constants[2])); - computedConstants[46] = xor(constants[0] < constants[1], constants[2] > constants[3]); - computedConstants[47] = xor(constants[0]+constants[1], constants[2] > constants[3]); - computedConstants[48] = xor(constants[0], constants[1] > constants[2]); - computedConstants[49] = xor(constants[0]-constants[1], constants[2] > constants[3]); - computedConstants[50] = xor(-constants[0], constants[1] > constants[2]); - computedConstants[51] = xor(pow(constants[0], constants[1]), constants[2] > constants[3]); - computedConstants[52] = xor(pow(constants[0], 1.0/constants[1]), constants[2] > constants[3]); - computedConstants[53] = xor(constants[0] < constants[1], constants[2]+constants[3]); - computedConstants[54] = xor(constants[0] < constants[1], constants[2]); - computedConstants[55] = xor(constants[0] < constants[1], constants[2]-constants[3]); - computedConstants[56] = xor(constants[0] < constants[1], -constants[2]); - computedConstants[57] = xor(constants[0] < constants[1], pow(constants[2], constants[3])); - computedConstants[58] = xor(constants[0] < constants[1], pow(constants[2], 1.0/constants[3])); - computedConstants[59] = constants[0]/xor(constants[1], constants[2]); - computedConstants[60] = !constants[0]; - computedConstants[61] = constants[0]+constants[1]+constants[2]; - computedConstants[62] = (constants[0] < constants[1])+(constants[2] > constants[3]); - computedConstants[63] = constants[0]; - computedConstants[64] = constants[0]-constants[1]; - computedConstants[65] = (constants[0] < constants[1])-(constants[2] > constants[3]); - computedConstants[66] = (constants[0] < constants[1])-(constants[2]+constants[3]); - computedConstants[67] = (constants[0] < constants[1])-constants[2]; - computedConstants[68] = constants[0]-(-constants[1]); - computedConstants[69] = constants[0]-(-constants[1]*constants[2]); - computedConstants[70] = -constants[0]; - computedConstants[71] = -(constants[0] < constants[1]); - computedConstants[72] = constants[0]*constants[1]; - computedConstants[73] = constants[0]*constants[1]*constants[2]; - computedConstants[74] = (constants[0] < constants[1])*(constants[2] > constants[3]); - computedConstants[75] = (constants[0]+constants[1])*(constants[2] > constants[3]); - computedConstants[76] = constants[0]*(constants[1] > constants[2]); - computedConstants[77] = (constants[0]-constants[1])*(constants[2] > constants[3]); - computedConstants[78] = -constants[0]*(constants[1] > constants[2]); - computedConstants[79] = (constants[0] < constants[1])*(constants[2]+constants[3]); - computedConstants[80] = (constants[0] < constants[1])*constants[2]; - computedConstants[81] = (constants[0] < constants[1])*(constants[2]-constants[3]); - computedConstants[82] = (constants[0] < constants[1])*-constants[2]; - computedConstants[83] = constants[0]/constants[1]; - computedConstants[84] = (constants[0] < constants[1])/(constants[3] > constants[2]); - computedConstants[85] = (constants[0]+constants[1])/(constants[3] > constants[2]); - computedConstants[86] = constants[0]/(constants[2] > constants[1]); - computedConstants[87] = (constants[0]-constants[1])/(constants[3] > constants[2]); - computedConstants[88] = -constants[0]/(constants[2] > constants[1]); - computedConstants[89] = (constants[0] < constants[1])/(constants[2]+constants[3]); - computedConstants[90] = (constants[0] < constants[1])/constants[2]; - computedConstants[91] = (constants[0] < constants[1])/(constants[2]-constants[3]); - computedConstants[92] = (constants[0] < constants[1])/-constants[2]; - computedConstants[93] = (constants[0] < constants[1])/(constants[2]*constants[3]); - computedConstants[94] = (constants[0] < constants[1])/(constants[2]/constants[3]); - computedConstants[95] = sqrt(constants[0]); - computedConstants[96] = pow(constants[0], 2.0); - computedConstants[97] = pow(constants[0], 3.0); - computedConstants[98] = pow(constants[0], constants[1]); - computedConstants[99] = pow(constants[0] <= constants[1], constants[2] >= constants[3]); - computedConstants[100] = pow(constants[0]+constants[1], constants[2] >= constants[3]); - computedConstants[101] = pow(constants[0], constants[1] >= constants[2]); - computedConstants[102] = pow(constants[0]-constants[1], constants[2] >= constants[3]); - computedConstants[103] = pow(-constants[0], constants[1] >= constants[2]); - computedConstants[104] = pow(constants[0]*constants[1], constants[2] >= constants[3]); - computedConstants[105] = pow(constants[0]/constants[1], constants[2] >= constants[3]); - computedConstants[106] = pow(constants[0] <= constants[1], constants[2]+constants[3]); - computedConstants[107] = pow(constants[0] <= constants[1], constants[2]); - computedConstants[108] = pow(constants[0] <= constants[1], constants[2]-constants[3]); - computedConstants[109] = pow(constants[0] <= constants[1], -constants[2]); - computedConstants[110] = pow(constants[0] <= constants[1], constants[2]*constants[3]); - computedConstants[111] = pow(constants[0] <= constants[1], constants[2]/constants[3]); - computedConstants[112] = pow(constants[0] <= constants[1], pow(constants[2], constants[3])); - computedConstants[113] = pow(constants[0] <= constants[1], pow(constants[2], 1.0/constants[3])); - computedConstants[114] = sqrt(constants[0]); - computedConstants[115] = sqrt(constants[0]); - computedConstants[116] = pow(constants[0], 1.0/3.0); - computedConstants[117] = pow(constants[0], 1.0/constants[1]); - computedConstants[118] = pow(constants[0] < constants[1], 1.0/(constants[3] > constants[2])); - computedConstants[119] = pow(constants[0]+constants[1], 1.0/(constants[3] > constants[2])); - computedConstants[120] = pow(constants[0], 1.0/(constants[2] > constants[1])); - computedConstants[121] = pow(constants[0]-constants[1], 1.0/(constants[3] > constants[2])); - computedConstants[122] = pow(-constants[0], 1.0/(constants[2] > constants[1])); - computedConstants[123] = pow(constants[0]*constants[1], 1.0/(constants[3] > constants[2])); - computedConstants[124] = pow(constants[0]/constants[1], 1.0/(constants[3] > constants[2])); - computedConstants[125] = pow(constants[0] < constants[1], 1.0/(constants[2]+constants[3])); - computedConstants[126] = pow(constants[0] < constants[1], 1.0/constants[2]); - computedConstants[127] = pow(constants[0] < constants[1], 1.0/(constants[2]-constants[3])); - computedConstants[128] = pow(constants[0] < constants[1], 1.0/-constants[2]); - computedConstants[129] = pow(constants[0] < constants[1], 1.0/(constants[2]*constants[3])); - computedConstants[130] = pow(constants[0] < constants[1], 1.0/(constants[2]/constants[3])); - computedConstants[131] = pow(constants[0] < constants[1], 1.0/pow(constants[2], constants[3])); - computedConstants[132] = pow(constants[0] < constants[1], 1.0/pow(constants[2], 1.0/constants[3])); - computedConstants[133] = fabs(constants[0]); - computedConstants[134] = exp(constants[0]); - computedConstants[135] = log(constants[0]); + computedConstants[28] = (constants[0] < constants[1]) || (constants[2] > constants[3]); + computedConstants[29] = (constants[0]+constants[1]) || (constants[2] > constants[3]); + computedConstants[30] = constants[0] || (constants[1] > constants[2]); + computedConstants[31] = (constants[0]-constants[1]) || (constants[2] > constants[3]); + computedConstants[32] = -constants[0] || (constants[1] > constants[2]); + computedConstants[33] = pow(constants[0], constants[1]) || (constants[2] > constants[3]); + computedConstants[34] = pow(constants[0], 1.0/constants[1]) || (constants[2] > constants[3]); + computedConstants[35] = (constants[0] < constants[1]) || (constants[2]+constants[3]); + computedConstants[36] = (constants[0] < constants[1]) || constants[2]; + computedConstants[37] = (constants[0] < constants[1]) || (constants[2]-constants[3]); + computedConstants[38] = (constants[0] < constants[1]) || -constants[2]; + computedConstants[39] = (constants[0] < constants[1]) || pow(constants[2], constants[3]); + computedConstants[40] = (constants[0] < constants[1]) || pow(constants[2], 1.0/constants[3]); + computedConstants[41] = constants[0]/(constants[1] || constants[2]); + computedConstants[42] = XOR(constants[0], constants[1]); + computedConstants[43] = XOR(constants[0], XOR(constants[1], constants[2])); + computedConstants[44] = XOR(constants[0] < constants[1], constants[2] > constants[3]); + computedConstants[45] = XOR(constants[0]+constants[1], constants[2] > constants[3]); + computedConstants[46] = XOR(constants[0], constants[1] > constants[2]); + computedConstants[47] = XOR(constants[0]-constants[1], constants[2] > constants[3]); + computedConstants[48] = XOR(-constants[0], constants[1] > constants[2]); + computedConstants[49] = XOR(pow(constants[0], constants[1]), constants[2] > constants[3]); + computedConstants[50] = XOR(pow(constants[0], 1.0/constants[1]), constants[2] > constants[3]); + computedConstants[51] = XOR(constants[0] < constants[1], constants[2]+constants[3]); + computedConstants[52] = XOR(constants[0] < constants[1], constants[2]); + computedConstants[53] = XOR(constants[0] < constants[1], constants[2]-constants[3]); + computedConstants[54] = XOR(constants[0] < constants[1], -constants[2]); + computedConstants[55] = XOR(constants[0] < constants[1], pow(constants[2], constants[3])); + computedConstants[56] = XOR(constants[0] < constants[1], pow(constants[2], 1.0/constants[3])); + computedConstants[57] = !constants[0]; + computedConstants[58] = constants[0]+constants[1]+constants[2]; + computedConstants[59] = (constants[0] < constants[1])+(constants[2] > constants[3]); + computedConstants[60] = constants[0]; + computedConstants[61] = constants[0]-constants[1]; + computedConstants[62] = (constants[0] < constants[1])-(constants[2] > constants[3]); + computedConstants[63] = (constants[0] < constants[1])-(constants[2]+constants[3]); + computedConstants[64] = (constants[0] < constants[1])-constants[2]; + computedConstants[65] = constants[0]-(-constants[1]); + computedConstants[66] = constants[0]-(-constants[1]*constants[2]); + computedConstants[67] = -constants[0]; + computedConstants[68] = -(constants[0] < constants[1]); + computedConstants[69] = constants[0]*constants[1]; + computedConstants[70] = constants[0]*constants[1]*constants[2]; + computedConstants[71] = (constants[0] < constants[1])*(constants[2] > constants[3]); + computedConstants[72] = (constants[0]+constants[1])*(constants[2] > constants[3]); + computedConstants[73] = constants[0]*(constants[1] > constants[2]); + computedConstants[74] = (constants[0]-constants[1])*(constants[2] > constants[3]); + computedConstants[75] = -constants[0]*(constants[1] > constants[2]); + computedConstants[76] = (constants[0] < constants[1])*(constants[2]+constants[3]); + computedConstants[77] = (constants[0] < constants[1])*constants[2]; + computedConstants[78] = (constants[0] < constants[1])*(constants[2]-constants[3]); + computedConstants[79] = (constants[0] < constants[1])*-constants[2]; + computedConstants[80] = constants[0]/constants[1]; + computedConstants[81] = (constants[0] < constants[1])/(constants[3] > constants[2]); + computedConstants[82] = (constants[0]+constants[1])/(constants[3] > constants[2]); + computedConstants[83] = constants[0]/(constants[2] > constants[1]); + computedConstants[84] = (constants[0]-constants[1])/(constants[3] > constants[2]); + computedConstants[85] = -constants[0]/(constants[2] > constants[1]); + computedConstants[86] = (constants[0] < constants[1])/(constants[2]+constants[3]); + computedConstants[87] = (constants[0] < constants[1])/constants[2]; + computedConstants[88] = (constants[0] < constants[1])/(constants[2]-constants[3]); + computedConstants[89] = (constants[0] < constants[1])/-constants[2]; + computedConstants[90] = (constants[0] < constants[1])/(constants[2]*constants[3]); + computedConstants[91] = (constants[0] < constants[1])/(constants[2]/constants[3]); + computedConstants[92] = sqrt(constants[0]); + computedConstants[93] = pow(constants[0], 2.0); + computedConstants[94] = pow(constants[0], 3.0); + computedConstants[95] = pow(constants[0], constants[1]); + computedConstants[96] = pow(constants[0] <= constants[1], constants[2] >= constants[3]); + computedConstants[97] = pow(constants[0]+constants[1], constants[2] >= constants[3]); + computedConstants[98] = pow(constants[0], constants[1] >= constants[2]); + computedConstants[99] = pow(constants[0]-constants[1], constants[2] >= constants[3]); + computedConstants[100] = pow(-constants[0], constants[1] >= constants[2]); + computedConstants[101] = pow(constants[0]*constants[1], constants[2] >= constants[3]); + computedConstants[102] = pow(constants[0]/constants[1], constants[2] >= constants[3]); + computedConstants[103] = pow(constants[0] <= constants[1], constants[2]+constants[3]); + computedConstants[104] = pow(constants[0] <= constants[1], constants[2]); + computedConstants[105] = pow(constants[0] <= constants[1], constants[2]-constants[3]); + computedConstants[106] = pow(constants[0] <= constants[1], -constants[2]); + computedConstants[107] = pow(constants[0] <= constants[1], constants[2]*constants[3]); + computedConstants[108] = pow(constants[0] <= constants[1], constants[2]/constants[3]); + computedConstants[109] = pow(constants[0] <= constants[1], pow(constants[2], constants[3])); + computedConstants[110] = pow(constants[0] <= constants[1], pow(constants[2], 1.0/constants[3])); + computedConstants[111] = sqrt(constants[0]); + computedConstants[112] = sqrt(constants[0]); + computedConstants[113] = pow(constants[0], 1.0/0.5); + computedConstants[114] = pow(constants[0], 1.0/3.0); + computedConstants[115] = pow(constants[0], 1.0/constants[1]); + computedConstants[116] = pow(constants[0] < constants[1], 1.0/(constants[3] > constants[2])); + computedConstants[117] = pow(constants[0]+constants[1], 1.0/(constants[3] > constants[2])); + computedConstants[118] = pow(constants[0], 1.0/(constants[2] > constants[1])); + computedConstants[119] = pow(constants[0]-constants[1], 1.0/(constants[3] > constants[2])); + computedConstants[120] = pow(-constants[0], 1.0/(constants[2] > constants[1])); + computedConstants[121] = pow(constants[0]*constants[1], 1.0/(constants[3] > constants[2])); + computedConstants[122] = pow(constants[0]/constants[1], 1.0/(constants[3] > constants[2])); + computedConstants[123] = pow(constants[0] < constants[1], 1.0/(constants[2]+constants[3])); + computedConstants[124] = pow(constants[0] < constants[1], 1.0/constants[2]); + computedConstants[125] = pow(constants[0] < constants[1], 1.0/(constants[2]-constants[3])); + computedConstants[126] = pow(constants[0] < constants[1], 1.0/-constants[2]); + computedConstants[127] = pow(constants[0] < constants[1], 1.0/(constants[2]*constants[3])); + computedConstants[128] = pow(constants[0] < constants[1], 1.0/(constants[2]/constants[3])); + computedConstants[129] = pow(constants[0] < constants[1], 1.0/pow(constants[2], constants[3])); + computedConstants[130] = pow(constants[0] < constants[1], 1.0/pow(constants[2], 1.0/constants[3])); + computedConstants[131] = fabs(constants[0]); + computedConstants[132] = exp(constants[0]); + computedConstants[133] = log(constants[0]); + computedConstants[134] = log10(constants[0]); + computedConstants[135] = log(constants[0])/log(2.0); computedConstants[136] = log10(constants[0]); - computedConstants[137] = log(constants[0])/log(2.0); - computedConstants[138] = log10(constants[0]); - computedConstants[139] = log(constants[0])/log(constants[1]); - computedConstants[140] = ceil(constants[0]); - computedConstants[141] = floor(constants[0]); - computedConstants[142] = min(constants[0], constants[1]); - computedConstants[143] = min(constants[0], min(constants[1], constants[2])); - computedConstants[144] = max(constants[0], constants[1]); - computedConstants[145] = max(constants[0], max(constants[1], constants[2])); - computedConstants[146] = fmod(constants[0], constants[1]); - computedConstants[147] = sin(constants[0]); - computedConstants[148] = cos(constants[0]); - computedConstants[149] = tan(constants[0]); - computedConstants[150] = sec(constants[0]); - computedConstants[151] = csc(constants[0]); - computedConstants[152] = cot(constants[0]); - computedConstants[153] = sinh(constants[0]); - computedConstants[154] = cosh(constants[0]); - computedConstants[155] = tanh(constants[0]); - computedConstants[156] = sech(constants[0]); - computedConstants[157] = csch(constants[0]); - computedConstants[158] = coth(constants[0]); - computedConstants[159] = asin(constants[0]); - computedConstants[160] = acos(constants[0]); - computedConstants[161] = atan(constants[0]); - computedConstants[162] = asec(constants[0]); - computedConstants[163] = acsc(constants[0]); - computedConstants[164] = acot(constants[0]); - computedConstants[165] = asinh(constants[0]); - computedConstants[166] = acosh(constants[0]); - computedConstants[167] = atanh(constants[0]/2.0); - computedConstants[168] = asech(constants[0]); - computedConstants[169] = acsch(constants[0]); - computedConstants[170] = acoth(2.0*constants[0]); - computedConstants[171] = (constants[0] > constants[1])?constants[0]:NAN; - computedConstants[172] = (constants[0] > constants[1])?constants[0]:constants[2]; - computedConstants[173] = (constants[0] > constants[1])?constants[0]:(constants[2] > constants[3])?constants[2]:(constants[4] > constants[5])?constants[4]:NAN; - computedConstants[174] = (constants[0] > constants[1])?constants[0]:(constants[2] > constants[3])?constants[2]:(constants[4] > constants[5])?constants[4]:constants[6]; - computedConstants[175] = 123.0+((constants[0] > constants[1])?constants[0]:NAN); - computedConstants[180] = constants[0]; - computedConstants[187] = (constants[0] && constants[1])+((constants[2] > constants[3])?constants[1]:NAN)+constants[4]+(constants[5] && constants[6]); - computedConstants[188] = (constants[0] && constants[1])-(((constants[2] > constants[3])?constants[1]:NAN)-(constants[4]-((constants[2] > constants[3])?constants[1]:NAN)))-(constants[5] && constants[6]); - computedConstants[189] = (constants[0] && constants[1])*((constants[2] > constants[3])?constants[1]:NAN)*constants[4]*((constants[2] > constants[3])?constants[1]:NAN)*(constants[5] && constants[6]); - computedConstants[190] = (constants[0] && constants[1])/(((constants[2] > constants[3])?constants[1]:NAN)/(constants[4]/((constants[2] > constants[3])?constants[1]:NAN))); - computedConstants[191] = (constants[0] || constants[1]) && xor(constants[0], constants[1]) && ((constants[2] > constants[3])?constants[1]:NAN) && constants[4] && ((constants[2] > constants[3])?constants[1]:NAN) && xor(constants[0], constants[1]) && (constants[0] || constants[1]); - computedConstants[192] = (constants[0] && constants[1]) || xor(constants[0], constants[1]) || ((constants[2] > constants[3])?constants[1]:NAN) || constants[4] || ((constants[2] > constants[3])?constants[1]:NAN) || xor(constants[0], constants[1]) || (constants[0] && constants[1]); - computedConstants[193] = xor(constants[0] && constants[1], xor(constants[0] || constants[1], xor((constants[2] > constants[3])?constants[1]:NAN, xor(xor(xor(constants[4], (constants[2] > constants[3])?constants[1]:NAN), constants[0] || constants[1]), constants[0] && constants[1])))); - computedConstants[194] = pow(constants[0] && constants[1], pow((constants[2] > constants[3])?constants[1]:NAN, pow(pow(constants[4], (constants[2] > constants[3])?constants[1]:NAN), constants[0] && constants[1]))); - computedConstants[195] = pow(pow(pow(constants[0] && constants[1], 1.0/pow((constants[2] > constants[3])?constants[1]:NAN, 1.0/constants[4])), 1.0/((constants[2] > constants[3])?constants[1]:NAN)), 1.0/(constants[0] && constants[1])); - computedConstants[196] = -(constants[0] && constants[1])+-((constants[2] > constants[3])?constants[1]:NAN); + computedConstants[137] = log(constants[0])/log(constants[1]); + computedConstants[138] = ceil(constants[0]); + computedConstants[139] = floor(constants[0]); + computedConstants[140] = fmin(constants[0], constants[1]); + computedConstants[141] = fmin(constants[0], fmin(constants[1], constants[2])); + computedConstants[142] = fmax(constants[0], constants[1]); + computedConstants[143] = fmax(constants[0], fmax(constants[1], constants[2])); + computedConstants[144] = fmod(constants[0], constants[1]); + computedConstants[145] = sin(constants[0]); + computedConstants[146] = cos(constants[0]); + computedConstants[147] = tan(constants[0]); + computedConstants[148] = sec(constants[0]); + computedConstants[149] = csc(constants[0]); + computedConstants[150] = cot(constants[0]); + computedConstants[151] = sinh(constants[0]); + computedConstants[152] = cosh(constants[0]); + computedConstants[153] = tanh(constants[0]); + computedConstants[154] = sech(constants[0]); + computedConstants[155] = csch(constants[0]); + computedConstants[156] = coth(constants[0]); + computedConstants[157] = asin(constants[0]); + computedConstants[158] = acos(constants[0]); + computedConstants[159] = atan(constants[0]); + computedConstants[160] = asec(constants[0]); + computedConstants[161] = acsc(constants[0]); + computedConstants[162] = acot(constants[0]); + computedConstants[163] = asinh(constants[0]); + computedConstants[164] = acosh(constants[0]); + computedConstants[165] = atanh(constants[0]/2.0); + computedConstants[166] = asech(constants[0]); + computedConstants[167] = acsch(constants[0]); + computedConstants[168] = acoth(2.0*constants[0]); + computedConstants[170] = (constants[0] > constants[1])?constants[0]:NAN; + computedConstants[171] = (constants[0] < constants[1])?constants[0]:NAN; + computedConstants[172] = constants[0]; + computedConstants[173] = (constants[0] > constants[1])?constants[0]:constants[2]; + computedConstants[174] = (constants[0] > constants[1])?constants[0]:(constants[2] > constants[3])?constants[2]:(constants[4] > constants[5])?constants[4]:NAN; + computedConstants[175] = (constants[0] < constants[1])?constants[0]:(constants[2] > constants[3])?constants[2]:(constants[4] > constants[5])?constants[4]:NAN; + computedConstants[176] = (constants[0] > constants[1])?constants[0]:(constants[2] > constants[3])?constants[2]:(constants[4] > constants[5])?constants[4]:constants[6]; + computedConstants[177] = 123.0+((constants[0] > constants[1])?constants[0]:NAN); + computedConstants[178] = 123.0+((constants[0] < constants[1])?constants[0]:NAN); + computedConstants[183] = constants[0]; + computedConstants[190] = (constants[0] && constants[1])+((constants[2] > constants[3])?constants[1]:NAN)+constants[4]+(constants[5] && constants[6]); + computedConstants[191] = (constants[0] && constants[1])+((constants[2] < constants[3])?constants[1]:NAN)+constants[4]+(constants[5] && constants[6]); + computedConstants[192] = (constants[0] && constants[1])-(((constants[2] > constants[3])?constants[1]:NAN)-(constants[4]-((constants[2] > constants[3])?constants[1]:NAN)))-(constants[5] && constants[6]); + computedConstants[193] = (constants[0] && constants[1])-(((constants[2] < constants[3])?constants[1]:NAN)-(constants[4]-((constants[2] < constants[3])?constants[1]:NAN)))-(constants[5] && constants[6]); + computedConstants[194] = (constants[0] && constants[1])*((constants[2] > constants[3])?constants[1]:NAN)*constants[4]*((constants[2] > constants[3])?constants[1]:NAN)*(constants[5] && constants[6]); + computedConstants[195] = (constants[0] && constants[1])*((constants[2] < constants[3])?constants[1]:NAN)*constants[4]*((constants[2] < constants[3])?constants[1]:NAN)*(constants[5] && constants[6]); + computedConstants[196] = (constants[0] && constants[1])/(((constants[2] > constants[3])?constants[1]:NAN)/(constants[4]/((constants[2] > constants[3])?constants[1]:NAN))); + computedConstants[197] = (constants[0] && constants[1])/(((constants[2] < constants[3])?constants[1]:NAN)/(constants[4]/((constants[2] < constants[3])?constants[1]:NAN))); + computedConstants[198] = (constants[0] || constants[1]) && XOR(constants[0], constants[1]) && ((constants[2] > constants[3])?constants[1]:NAN) && constants[4] && ((constants[2] > constants[3])?constants[1]:NAN) && XOR(constants[0], constants[1]) && (constants[0] || constants[1]); + computedConstants[199] = (constants[0] && constants[1]) || XOR(constants[0], constants[1]) || ((constants[2] > constants[3])?constants[1]:NAN) || constants[4] || ((constants[2] > constants[3])?constants[1]:NAN) || XOR(constants[0], constants[1]) || (constants[0] && constants[1]); + computedConstants[200] = XOR(constants[0] && constants[1], XOR(constants[0] || constants[1], XOR((constants[2] > constants[3])?constants[1]:NAN, XOR(XOR(XOR(constants[4], (constants[2] > constants[3])?constants[1]:NAN), constants[0] || constants[1]), constants[0] && constants[1])))); + computedConstants[201] = pow(constants[0] && constants[1], pow((constants[2] > constants[3])?constants[1]:NAN, pow(pow(constants[4], (constants[2] > constants[3])?constants[1]:NAN), constants[0] && constants[1]))); + computedConstants[202] = pow(pow(pow(constants[0] && constants[1], 1.0/pow((constants[2] > constants[3])?constants[1]:NAN, 1.0/constants[4])), 1.0/((constants[2] > constants[3])?constants[1]:NAN)), 1.0/(constants[0] && constants[1])); + computedConstants[203] = -(constants[0] && constants[1])+-((constants[2] > constants[3])?constants[1]:NAN); + computedConstants[204] = -(constants[0] && constants[1])+-((constants[2] < constants[3])?constants[1]:NAN); } void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, double *externals, ExternalVariable externalVariable) @@ -650,6 +653,9 @@ void computeRates(double voi, double *states, double *rates, double *constants, void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, double *externals, ExternalVariable externalVariable) { + algebraic[0] = states[0] || states[0]; + algebraic[1] = states[0] || states[0] || constants[0]; + algebraic[2] = constants[0]/XOR(constants[1], states[0]); externals[0] = externalVariable(voi, states, rates, constants, computedConstants, algebraic, externals, 0); findRoot0(voi, states, rates, constants, computedConstants, algebraic, externals); } diff --git a/tests/resources/coverage/generator/model.modified.profile.h b/tests/resources/coverage/generator/model.xor.h similarity index 98% rename from tests/resources/coverage/generator/model.modified.profile.h rename to tests/resources/coverage/generator/model.xor.h index 882fbaead8..93d1cdae9d 100644 --- a/tests/resources/coverage/generator/model.modified.profile.h +++ b/tests/resources/coverage/generator/model.xor.h @@ -26,7 +26,7 @@ extern const VariableInfo COMPUTED_CONSTANT_INFO[]; extern const VariableInfo ALGEBRAIC_INFO[]; extern const VariableInfo EXTERNAL_INFO[]; -double * createStatesVector(); +double * createStatesArray(); double * createConstantsArray(); double * createComputedConstantsArray(); double * createAlgebraicArray(); diff --git a/tests/resources/coverage/generator/model.modified.profile.py b/tests/resources/coverage/generator/model.xor.py similarity index 71% rename from tests/resources/coverage/generator/model.modified.profile.py rename to tests/resources/coverage/generator/model.xor.py index 8462eba392..8fc5da945f 100644 --- a/tests/resources/coverage/generator/model.modified.profile.py +++ b/tests/resources/coverage/generator/model.xor.py @@ -9,8 +9,8 @@ STATE_COUNT = 1 CONSTANT_COUNT = 7 -COMPUTED_CONSTANT_COUNT = 199 -ALGEBRAIC_COUNT = 2 +COMPUTED_CONSTANT_COUNT = 207 +ALGEBRAIC_COUNT = 5 EXTERNAL_COUNT = 1 VOI_INFO = {"name": "t", "units": "second", "component": "my_component"} @@ -58,8 +58,6 @@ {"name": "eqnAndParenthesesRightPower", "units": "dimensionless", "component": "my_component"}, {"name": "eqnAndParenthesesRightRoot", "units": "dimensionless", "component": "my_component"}, {"name": "eqnAndCoverageParentheses", "units": "dimensionless", "component": "my_component"}, - {"name": "eqnOr", "units": "dimensionless", "component": "my_component"}, - {"name": "eqnOrMultiple", "units": "dimensionless", "component": "my_component"}, {"name": "eqnOrParentheses", "units": "dimensionless", "component": "my_component"}, {"name": "eqnOrParenthesesLeftPlusWith", "units": "dimensionless", "component": "my_component"}, {"name": "eqnOrParenthesesLeftPlusWithout", "units": "dimensionless", "component": "my_component"}, @@ -89,7 +87,6 @@ {"name": "eqnXorParenthesesRightMinusWithout", "units": "dimensionless", "component": "my_component"}, {"name": "eqnXorParenthesesRightPower", "units": "dimensionless", "component": "my_component"}, {"name": "eqnXorParenthesesRightRoot", "units": "dimensionless", "component": "my_component"}, - {"name": "eqnXorCoverageParentheses", "units": "dimensionless", "component": "my_component"}, {"name": "eqnNot", "units": "dimensionless", "component": "my_component"}, {"name": "eqnPlusMultiple", "units": "dimensionless", "component": "my_component"}, {"name": "eqnPlusParentheses", "units": "dimensionless", "component": "my_component"}, @@ -146,6 +143,7 @@ {"name": "eqnPowerParenthesesRightRoot", "units": "dimensionless", "component": "my_component"}, {"name": "eqnRootSqrt", "units": "dimensionless", "component": "my_component"}, {"name": "eqnRootSqrtOther", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnRootSqr", "units": "dimensionless", "component": "my_component"}, {"name": "eqnRootCube", "units": "dimensionless", "component": "my_component"}, {"name": "eqnRootCi", "units": "dimensionless", "component": "my_component"}, {"name": "eqnRootParentheses", "units": "dimensionless", "component": "my_component"}, @@ -201,11 +199,16 @@ {"name": "eqnArcsech", "units": "dimensionless", "component": "my_component"}, {"name": "eqnArccsch", "units": "dimensionless", "component": "my_component"}, {"name": "eqnArccoth", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnPiecewise", "units": "dimensionless", "component": "my_component"}, {"name": "eqnPiecewisePiece", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnPiecewisePiece2", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnPiecewiseOtherwise", "units": "dimensionless", "component": "my_component"}, {"name": "eqnPiecewisePieceOtherwise", "units": "dimensionless", "component": "my_component"}, {"name": "eqnPiecewisePiecePiecePiece", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnPiecewisePiecePiecePiece2", "units": "dimensionless", "component": "my_component"}, {"name": "eqnPiecewisePiecePiecePieceOtherwise", "units": "dimensionless", "component": "my_component"}, {"name": "eqnWithPiecewise", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnWithPiecewise2", "units": "dimensionless", "component": "my_component"}, {"name": "eqnCnInteger", "units": "dimensionless", "component": "my_component"}, {"name": "eqnCnDouble", "units": "dimensionless", "component": "my_component"}, {"name": "eqnCnIntegerWithExponent", "units": "dimensionless", "component": "my_component"}, @@ -218,20 +221,28 @@ {"name": "eqnInfinity", "units": "dimensionless", "component": "my_component"}, {"name": "eqnNotanumber", "units": "dimensionless", "component": "my_component"}, {"name": "eqnCoverageForPlusOperator", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnCoverageForPlusOperator2", "units": "dimensionless", "component": "my_component"}, {"name": "eqnCoverageForMinusOperator", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnCoverageForMinusOperator2", "units": "dimensionless", "component": "my_component"}, {"name": "eqnCoverageForTimesOperator", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnCoverageForTimesOperator2", "units": "dimensionless", "component": "my_component"}, {"name": "eqnCoverageForDivideOperator", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnCoverageForDivideOperator2", "units": "dimensionless", "component": "my_component"}, {"name": "eqnCoverageForAndOperator", "units": "dimensionless", "component": "my_component"}, {"name": "eqnCoverageForOrOperator", "units": "dimensionless", "component": "my_component"}, {"name": "eqnCoverageForXorOperator", "units": "dimensionless", "component": "my_component"}, {"name": "eqnCoverageForPowerOperator", "units": "dimensionless", "component": "my_component"}, {"name": "eqnCoverageForRootOperator", "units": "dimensionless", "component": "my_component"}, {"name": "eqnCoverageForMinusUnary", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnCoverageForMinusUnary2", "units": "dimensionless", "component": "my_component"}, {"name": "eqnComputedConstant1", "units": "dimensionless", "component": "my_component"}, {"name": "eqnComputedConstant2", "units": "dimensionless", "component": "my_component"} ] ALGEBRAIC_INFO = [ + {"name": "eqnOr", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnOrMultiple", "units": "dimensionless", "component": "my_component"}, + {"name": "eqnXorCoverageParentheses", "units": "dimensionless", "component": "my_component"}, {"name": "eqnNlaVariable1", "units": "dimensionless", "component": "my_component"}, {"name": "eqnNlaVariable2", "units": "dimensionless", "component": "my_component"} ] @@ -273,7 +284,7 @@ def or_func(x, y): return 1.0 if bool(x) | bool(y) else 0.0 -def xor_func(x, y): +def XOR_FUNC(x, y): return 1.0 if bool(x) ^ bool(y) else 0.0 @@ -326,24 +337,18 @@ def acot(x): def asech(x): - one_over_x = 1.0/x - - return log(one_over_x+sqrt(one_over_x*one_over_x-1.0)) + return acosh(1.0/x) def acsch(x): - one_over_x = 1.0/x - - return log(one_over_x+sqrt(one_over_x*one_over_x+1.0)) + return asinh(1.0/x) def acoth(x): - one_over_x = 1.0/x - - return 0.5*log((1.0+one_over_x)/(1.0-one_over_x)) + return atanh(1.0/x) -def create_states_vector(): +def create_states_array(): return [nan]*STATE_COUNT @@ -375,23 +380,23 @@ def objective_function_0(u, f, data): algebraic = data[5] externals = data[6] - algebraic[0] = u[0] - algebraic[1] = u[1] + algebraic[3] = u[0] + algebraic[4] = u[1] - f[0] = algebraic[0]+algebraic[1]+states[0]-0.0 - f[1] = algebraic[0]-algebraic[1]-(computed_constants[197]+computed_constants[198]) + f[0] = algebraic[3]+algebraic[4]+states[0]-0.0 + f[1] = algebraic[3]-algebraic[4]-(computed_constants[205]+computed_constants[206]) def find_root_0(voi, states, rates, constants, computed_constants, algebraic, externals): u = [nan]*2 - u[0] = algebraic[0] - u[1] = algebraic[1] + u[0] = algebraic[3] + u[1] = algebraic[4] u = nla_solve(objective_function_0, u, 2, [voi, states, rates, constants, computed_constants, algebraic, externals]) - algebraic[0] = u[0] - algebraic[1] = u[1] + algebraic[3] = u[0] + algebraic[4] = u[1] def initialise_variables(states, rates, constants, computed_constants, algebraic): @@ -403,20 +408,21 @@ def initialise_variables(states, rates, constants, computed_constants, algebraic constants[4] = 5.0 constants[5] = 6.0 constants[6] = 7.0 - computed_constants[176] = 123.0 - computed_constants[177] = 123.456789 - computed_constants[178] = 123.0e99 - computed_constants[179] = 123.456789e99 - computed_constants[181] = 1.0 - computed_constants[182] = 0.0 - computed_constants[183] = 2.71828182845905 - computed_constants[184] = 3.14159265358979 - computed_constants[185] = inf - computed_constants[186] = nan - computed_constants[197] = 1.0 - computed_constants[198] = 3.0 - algebraic[0] = 1.0 - algebraic[1] = 2.0 + computed_constants[169] = nan + computed_constants[179] = 123.0 + computed_constants[180] = 123.456789 + computed_constants[181] = 123.0e99 + computed_constants[182] = 123.456789e99 + computed_constants[184] = 1.0 + computed_constants[185] = 0.0 + computed_constants[186] = 2.71828182845905 + computed_constants[187] = 3.14159265358979 + computed_constants[188] = inf + computed_constants[189] = nan + computed_constants[205] = 1.0 + computed_constants[206] = 3.0 + algebraic[3] = 1.0 + algebraic[4] = 2.0 def compute_computed_constants(constants, computed_constants): @@ -429,9 +435,9 @@ def compute_computed_constants(constants, computed_constants): computed_constants[6] = leq_func(constants[0], constants[1]) computed_constants[7] = constants[0]/leq_func(constants[1], constants[2]) computed_constants[8] = gt_func(constants[0], constants[1]) - computed_constants[9] = constants[0]/gt_func(constants[1], constants[2]) + computed_constants[9] = constants[0]/gt_func(constants[2], constants[1]) computed_constants[10] = geq_func(constants[0], constants[1]) - computed_constants[11] = constants[0]/geq_func(constants[1], constants[2]) + computed_constants[11] = constants[0]/geq_func(constants[2], constants[1]) computed_constants[12] = and_func(constants[0], constants[1]) computed_constants[13] = and_func(constants[0], and_func(constants[1], constants[2])) computed_constants[14] = and_func(lt_func(constants[0], constants[1]), gt_func(constants[2], constants[3])) @@ -448,165 +454,172 @@ def compute_computed_constants(constants, computed_constants): computed_constants[25] = and_func(lt_func(constants[0], constants[1]), pow(constants[2], constants[3])) computed_constants[26] = and_func(lt_func(constants[0], constants[1]), pow(constants[2], 1.0/constants[3])) computed_constants[27] = constants[0]/and_func(constants[1], constants[2]) - computed_constants[28] = or_func(constants[0], constants[1]) - computed_constants[29] = or_func(constants[0], or_func(constants[1], constants[2])) - computed_constants[30] = or_func(lt_func(constants[0], constants[1]), gt_func(constants[2], constants[3])) - computed_constants[31] = or_func(constants[0]+constants[1], gt_func(constants[2], constants[3])) - computed_constants[32] = or_func(constants[0], gt_func(constants[1], constants[2])) - computed_constants[33] = or_func(constants[0]-constants[1], gt_func(constants[2], constants[3])) - computed_constants[34] = or_func(-constants[0], gt_func(constants[1], constants[2])) - computed_constants[35] = or_func(pow(constants[0], constants[1]), gt_func(constants[2], constants[3])) - computed_constants[36] = or_func(pow(constants[0], 1.0/constants[1]), gt_func(constants[2], constants[3])) - computed_constants[37] = or_func(lt_func(constants[0], constants[1]), constants[2]+constants[3]) - computed_constants[38] = or_func(lt_func(constants[0], constants[1]), constants[2]) - computed_constants[39] = or_func(lt_func(constants[0], constants[1]), constants[2]-constants[3]) - computed_constants[40] = or_func(lt_func(constants[0], constants[1]), -constants[2]) - computed_constants[41] = or_func(lt_func(constants[0], constants[1]), pow(constants[2], constants[3])) - computed_constants[42] = or_func(lt_func(constants[0], constants[1]), pow(constants[2], 1.0/constants[3])) - computed_constants[43] = constants[0]/or_func(constants[1], constants[2]) - computed_constants[44] = xor_func(constants[0], constants[1]) - computed_constants[45] = xor_func(constants[0], xor_func(constants[1], constants[2])) - computed_constants[46] = xor_func(lt_func(constants[0], constants[1]), gt_func(constants[2], constants[3])) - computed_constants[47] = xor_func(constants[0]+constants[1], gt_func(constants[2], constants[3])) - computed_constants[48] = xor_func(constants[0], gt_func(constants[1], constants[2])) - computed_constants[49] = xor_func(constants[0]-constants[1], gt_func(constants[2], constants[3])) - computed_constants[50] = xor_func(-constants[0], gt_func(constants[1], constants[2])) - computed_constants[51] = xor_func(pow(constants[0], constants[1]), gt_func(constants[2], constants[3])) - computed_constants[52] = xor_func(pow(constants[0], 1.0/constants[1]), gt_func(constants[2], constants[3])) - computed_constants[53] = xor_func(lt_func(constants[0], constants[1]), constants[2]+constants[3]) - computed_constants[54] = xor_func(lt_func(constants[0], constants[1]), constants[2]) - computed_constants[55] = xor_func(lt_func(constants[0], constants[1]), constants[2]-constants[3]) - computed_constants[56] = xor_func(lt_func(constants[0], constants[1]), -constants[2]) - computed_constants[57] = xor_func(lt_func(constants[0], constants[1]), pow(constants[2], constants[3])) - computed_constants[58] = xor_func(lt_func(constants[0], constants[1]), pow(constants[2], 1.0/constants[3])) - computed_constants[59] = constants[0]/xor_func(constants[1], constants[2]) - computed_constants[60] = not_func(constants[0]) - computed_constants[61] = constants[0]+constants[1]+constants[2] - computed_constants[62] = lt_func(constants[0], constants[1])+gt_func(constants[2], constants[3]) - computed_constants[63] = constants[0] - computed_constants[64] = constants[0]-constants[1] - computed_constants[65] = lt_func(constants[0], constants[1])-gt_func(constants[2], constants[3]) - computed_constants[66] = lt_func(constants[0], constants[1])-(constants[2]+constants[3]) - computed_constants[67] = lt_func(constants[0], constants[1])-constants[2] - computed_constants[68] = constants[0]-(-constants[1]) - computed_constants[69] = constants[0]-(-constants[1]*constants[2]) - computed_constants[70] = -constants[0] - computed_constants[71] = -lt_func(constants[0], constants[1]) - computed_constants[72] = constants[0]*constants[1] - computed_constants[73] = constants[0]*constants[1]*constants[2] - computed_constants[74] = lt_func(constants[0], constants[1])*gt_func(constants[2], constants[3]) - computed_constants[75] = (constants[0]+constants[1])*gt_func(constants[2], constants[3]) - computed_constants[76] = constants[0]*gt_func(constants[1], constants[2]) - computed_constants[77] = (constants[0]-constants[1])*gt_func(constants[2], constants[3]) - computed_constants[78] = -constants[0]*gt_func(constants[1], constants[2]) - computed_constants[79] = lt_func(constants[0], constants[1])*(constants[2]+constants[3]) - computed_constants[80] = lt_func(constants[0], constants[1])*constants[2] - computed_constants[81] = lt_func(constants[0], constants[1])*(constants[2]-constants[3]) - computed_constants[82] = lt_func(constants[0], constants[1])*-constants[2] - computed_constants[83] = constants[0]/constants[1] - computed_constants[84] = lt_func(constants[0], constants[1])/gt_func(constants[3], constants[2]) - computed_constants[85] = (constants[0]+constants[1])/gt_func(constants[3], constants[2]) - computed_constants[86] = constants[0]/gt_func(constants[2], constants[1]) - computed_constants[87] = (constants[0]-constants[1])/gt_func(constants[3], constants[2]) - computed_constants[88] = -constants[0]/gt_func(constants[2], constants[1]) - computed_constants[89] = lt_func(constants[0], constants[1])/(constants[2]+constants[3]) - computed_constants[90] = lt_func(constants[0], constants[1])/constants[2] - computed_constants[91] = lt_func(constants[0], constants[1])/(constants[2]-constants[3]) - computed_constants[92] = lt_func(constants[0], constants[1])/-constants[2] - computed_constants[93] = lt_func(constants[0], constants[1])/(constants[2]*constants[3]) - computed_constants[94] = lt_func(constants[0], constants[1])/(constants[2]/constants[3]) - computed_constants[95] = sqrt(constants[0]) - computed_constants[96] = pow(constants[0], 2.0) - computed_constants[97] = pow(constants[0], 3.0) - computed_constants[98] = pow(constants[0], constants[1]) - computed_constants[99] = pow(leq_func(constants[0], constants[1]), geq_func(constants[2], constants[3])) - computed_constants[100] = pow(constants[0]+constants[1], geq_func(constants[2], constants[3])) - computed_constants[101] = pow(constants[0], geq_func(constants[1], constants[2])) - computed_constants[102] = pow(constants[0]-constants[1], geq_func(constants[2], constants[3])) - computed_constants[103] = pow(-constants[0], geq_func(constants[1], constants[2])) - computed_constants[104] = pow(constants[0]*constants[1], geq_func(constants[2], constants[3])) - computed_constants[105] = pow(constants[0]/constants[1], geq_func(constants[2], constants[3])) - computed_constants[106] = pow(leq_func(constants[0], constants[1]), constants[2]+constants[3]) - computed_constants[107] = pow(leq_func(constants[0], constants[1]), constants[2]) - computed_constants[108] = pow(leq_func(constants[0], constants[1]), constants[2]-constants[3]) - computed_constants[109] = pow(leq_func(constants[0], constants[1]), -constants[2]) - computed_constants[110] = pow(leq_func(constants[0], constants[1]), constants[2]*constants[3]) - computed_constants[111] = pow(leq_func(constants[0], constants[1]), constants[2]/constants[3]) - computed_constants[112] = pow(leq_func(constants[0], constants[1]), pow(constants[2], constants[3])) - computed_constants[113] = pow(leq_func(constants[0], constants[1]), pow(constants[2], 1.0/constants[3])) - computed_constants[114] = sqrt(constants[0]) - computed_constants[115] = sqrt(constants[0]) - computed_constants[116] = pow(constants[0], 1.0/3.0) - computed_constants[117] = pow(constants[0], 1.0/constants[1]) - computed_constants[118] = pow(lt_func(constants[0], constants[1]), 1.0/gt_func(constants[3], constants[2])) - computed_constants[119] = pow(constants[0]+constants[1], 1.0/gt_func(constants[3], constants[2])) - computed_constants[120] = pow(constants[0], 1.0/gt_func(constants[2], constants[1])) - computed_constants[121] = pow(constants[0]-constants[1], 1.0/gt_func(constants[3], constants[2])) - computed_constants[122] = pow(-constants[0], 1.0/gt_func(constants[2], constants[1])) - computed_constants[123] = pow(constants[0]*constants[1], 1.0/gt_func(constants[3], constants[2])) - computed_constants[124] = pow(constants[0]/constants[1], 1.0/gt_func(constants[3], constants[2])) - computed_constants[125] = pow(lt_func(constants[0], constants[1]), 1.0/(constants[2]+constants[3])) - computed_constants[126] = pow(lt_func(constants[0], constants[1]), 1.0/constants[2]) - computed_constants[127] = pow(lt_func(constants[0], constants[1]), 1.0/(constants[2]-constants[3])) - computed_constants[128] = pow(lt_func(constants[0], constants[1]), 1.0/-constants[2]) - computed_constants[129] = pow(lt_func(constants[0], constants[1]), 1.0/(constants[2]*constants[3])) - computed_constants[130] = pow(lt_func(constants[0], constants[1]), 1.0/(constants[2]/constants[3])) - computed_constants[131] = pow(lt_func(constants[0], constants[1]), 1.0/pow(constants[2], constants[3])) - computed_constants[132] = pow(lt_func(constants[0], constants[1]), 1.0/pow(constants[2], 1.0/constants[3])) - computed_constants[133] = fabs(constants[0]) - computed_constants[134] = exp(constants[0]) - computed_constants[135] = log(constants[0]) + computed_constants[28] = or_func(lt_func(constants[0], constants[1]), gt_func(constants[2], constants[3])) + computed_constants[29] = or_func(constants[0]+constants[1], gt_func(constants[2], constants[3])) + computed_constants[30] = or_func(constants[0], gt_func(constants[1], constants[2])) + computed_constants[31] = or_func(constants[0]-constants[1], gt_func(constants[2], constants[3])) + computed_constants[32] = or_func(-constants[0], gt_func(constants[1], constants[2])) + computed_constants[33] = or_func(pow(constants[0], constants[1]), gt_func(constants[2], constants[3])) + computed_constants[34] = or_func(pow(constants[0], 1.0/constants[1]), gt_func(constants[2], constants[3])) + computed_constants[35] = or_func(lt_func(constants[0], constants[1]), constants[2]+constants[3]) + computed_constants[36] = or_func(lt_func(constants[0], constants[1]), constants[2]) + computed_constants[37] = or_func(lt_func(constants[0], constants[1]), constants[2]-constants[3]) + computed_constants[38] = or_func(lt_func(constants[0], constants[1]), -constants[2]) + computed_constants[39] = or_func(lt_func(constants[0], constants[1]), pow(constants[2], constants[3])) + computed_constants[40] = or_func(lt_func(constants[0], constants[1]), pow(constants[2], 1.0/constants[3])) + computed_constants[41] = constants[0]/or_func(constants[1], constants[2]) + computed_constants[42] = XOR_FUNC(constants[0], constants[1]) + computed_constants[43] = XOR_FUNC(constants[0], XOR_FUNC(constants[1], constants[2])) + computed_constants[44] = XOR_FUNC(lt_func(constants[0], constants[1]), gt_func(constants[2], constants[3])) + computed_constants[45] = XOR_FUNC(constants[0]+constants[1], gt_func(constants[2], constants[3])) + computed_constants[46] = XOR_FUNC(constants[0], gt_func(constants[1], constants[2])) + computed_constants[47] = XOR_FUNC(constants[0]-constants[1], gt_func(constants[2], constants[3])) + computed_constants[48] = XOR_FUNC(-constants[0], gt_func(constants[1], constants[2])) + computed_constants[49] = XOR_FUNC(pow(constants[0], constants[1]), gt_func(constants[2], constants[3])) + computed_constants[50] = XOR_FUNC(pow(constants[0], 1.0/constants[1]), gt_func(constants[2], constants[3])) + computed_constants[51] = XOR_FUNC(lt_func(constants[0], constants[1]), constants[2]+constants[3]) + computed_constants[52] = XOR_FUNC(lt_func(constants[0], constants[1]), constants[2]) + computed_constants[53] = XOR_FUNC(lt_func(constants[0], constants[1]), constants[2]-constants[3]) + computed_constants[54] = XOR_FUNC(lt_func(constants[0], constants[1]), -constants[2]) + computed_constants[55] = XOR_FUNC(lt_func(constants[0], constants[1]), pow(constants[2], constants[3])) + computed_constants[56] = XOR_FUNC(lt_func(constants[0], constants[1]), pow(constants[2], 1.0/constants[3])) + computed_constants[57] = not_func(constants[0]) + computed_constants[58] = constants[0]+constants[1]+constants[2] + computed_constants[59] = lt_func(constants[0], constants[1])+gt_func(constants[2], constants[3]) + computed_constants[60] = constants[0] + computed_constants[61] = constants[0]-constants[1] + computed_constants[62] = lt_func(constants[0], constants[1])-gt_func(constants[2], constants[3]) + computed_constants[63] = lt_func(constants[0], constants[1])-(constants[2]+constants[3]) + computed_constants[64] = lt_func(constants[0], constants[1])-constants[2] + computed_constants[65] = constants[0]-(-constants[1]) + computed_constants[66] = constants[0]-(-constants[1]*constants[2]) + computed_constants[67] = -constants[0] + computed_constants[68] = -lt_func(constants[0], constants[1]) + computed_constants[69] = constants[0]*constants[1] + computed_constants[70] = constants[0]*constants[1]*constants[2] + computed_constants[71] = lt_func(constants[0], constants[1])*gt_func(constants[2], constants[3]) + computed_constants[72] = (constants[0]+constants[1])*gt_func(constants[2], constants[3]) + computed_constants[73] = constants[0]*gt_func(constants[1], constants[2]) + computed_constants[74] = (constants[0]-constants[1])*gt_func(constants[2], constants[3]) + computed_constants[75] = -constants[0]*gt_func(constants[1], constants[2]) + computed_constants[76] = lt_func(constants[0], constants[1])*(constants[2]+constants[3]) + computed_constants[77] = lt_func(constants[0], constants[1])*constants[2] + computed_constants[78] = lt_func(constants[0], constants[1])*(constants[2]-constants[3]) + computed_constants[79] = lt_func(constants[0], constants[1])*-constants[2] + computed_constants[80] = constants[0]/constants[1] + computed_constants[81] = lt_func(constants[0], constants[1])/gt_func(constants[3], constants[2]) + computed_constants[82] = (constants[0]+constants[1])/gt_func(constants[3], constants[2]) + computed_constants[83] = constants[0]/gt_func(constants[2], constants[1]) + computed_constants[84] = (constants[0]-constants[1])/gt_func(constants[3], constants[2]) + computed_constants[85] = -constants[0]/gt_func(constants[2], constants[1]) + computed_constants[86] = lt_func(constants[0], constants[1])/(constants[2]+constants[3]) + computed_constants[87] = lt_func(constants[0], constants[1])/constants[2] + computed_constants[88] = lt_func(constants[0], constants[1])/(constants[2]-constants[3]) + computed_constants[89] = lt_func(constants[0], constants[1])/-constants[2] + computed_constants[90] = lt_func(constants[0], constants[1])/(constants[2]*constants[3]) + computed_constants[91] = lt_func(constants[0], constants[1])/(constants[2]/constants[3]) + computed_constants[92] = sqrt(constants[0]) + computed_constants[93] = pow(constants[0], 2.0) + computed_constants[94] = pow(constants[0], 3.0) + computed_constants[95] = pow(constants[0], constants[1]) + computed_constants[96] = pow(leq_func(constants[0], constants[1]), geq_func(constants[2], constants[3])) + computed_constants[97] = pow(constants[0]+constants[1], geq_func(constants[2], constants[3])) + computed_constants[98] = pow(constants[0], geq_func(constants[1], constants[2])) + computed_constants[99] = pow(constants[0]-constants[1], geq_func(constants[2], constants[3])) + computed_constants[100] = pow(-constants[0], geq_func(constants[1], constants[2])) + computed_constants[101] = pow(constants[0]*constants[1], geq_func(constants[2], constants[3])) + computed_constants[102] = pow(constants[0]/constants[1], geq_func(constants[2], constants[3])) + computed_constants[103] = pow(leq_func(constants[0], constants[1]), constants[2]+constants[3]) + computed_constants[104] = pow(leq_func(constants[0], constants[1]), constants[2]) + computed_constants[105] = pow(leq_func(constants[0], constants[1]), constants[2]-constants[3]) + computed_constants[106] = pow(leq_func(constants[0], constants[1]), -constants[2]) + computed_constants[107] = pow(leq_func(constants[0], constants[1]), constants[2]*constants[3]) + computed_constants[108] = pow(leq_func(constants[0], constants[1]), constants[2]/constants[3]) + computed_constants[109] = pow(leq_func(constants[0], constants[1]), pow(constants[2], constants[3])) + computed_constants[110] = pow(leq_func(constants[0], constants[1]), pow(constants[2], 1.0/constants[3])) + computed_constants[111] = sqrt(constants[0]) + computed_constants[112] = sqrt(constants[0]) + computed_constants[113] = pow(constants[0], 1.0/0.5) + computed_constants[114] = pow(constants[0], 1.0/3.0) + computed_constants[115] = pow(constants[0], 1.0/constants[1]) + computed_constants[116] = pow(lt_func(constants[0], constants[1]), 1.0/gt_func(constants[3], constants[2])) + computed_constants[117] = pow(constants[0]+constants[1], 1.0/gt_func(constants[3], constants[2])) + computed_constants[118] = pow(constants[0], 1.0/gt_func(constants[2], constants[1])) + computed_constants[119] = pow(constants[0]-constants[1], 1.0/gt_func(constants[3], constants[2])) + computed_constants[120] = pow(-constants[0], 1.0/gt_func(constants[2], constants[1])) + computed_constants[121] = pow(constants[0]*constants[1], 1.0/gt_func(constants[3], constants[2])) + computed_constants[122] = pow(constants[0]/constants[1], 1.0/gt_func(constants[3], constants[2])) + computed_constants[123] = pow(lt_func(constants[0], constants[1]), 1.0/(constants[2]+constants[3])) + computed_constants[124] = pow(lt_func(constants[0], constants[1]), 1.0/constants[2]) + computed_constants[125] = pow(lt_func(constants[0], constants[1]), 1.0/(constants[2]-constants[3])) + computed_constants[126] = pow(lt_func(constants[0], constants[1]), 1.0/-constants[2]) + computed_constants[127] = pow(lt_func(constants[0], constants[1]), 1.0/(constants[2]*constants[3])) + computed_constants[128] = pow(lt_func(constants[0], constants[1]), 1.0/(constants[2]/constants[3])) + computed_constants[129] = pow(lt_func(constants[0], constants[1]), 1.0/pow(constants[2], constants[3])) + computed_constants[130] = pow(lt_func(constants[0], constants[1]), 1.0/pow(constants[2], 1.0/constants[3])) + computed_constants[131] = fabs(constants[0]) + computed_constants[132] = exp(constants[0]) + computed_constants[133] = log(constants[0]) + computed_constants[134] = log10(constants[0]) + computed_constants[135] = log(constants[0])/log(2.0) computed_constants[136] = log10(constants[0]) - computed_constants[137] = log(constants[0])/log(2.0) - computed_constants[138] = log10(constants[0]) - computed_constants[139] = log(constants[0])/log(constants[1]) - computed_constants[140] = ceil(constants[0]) - computed_constants[141] = floor(constants[0]) - computed_constants[142] = min(constants[0], constants[1]) - computed_constants[143] = min(constants[0], min(constants[1], constants[2])) - computed_constants[144] = max(constants[0], constants[1]) - computed_constants[145] = max(constants[0], max(constants[1], constants[2])) - computed_constants[146] = fmod(constants[0], constants[1]) - computed_constants[147] = sin(constants[0]) - computed_constants[148] = cos(constants[0]) - computed_constants[149] = tan(constants[0]) - computed_constants[150] = sec(constants[0]) - computed_constants[151] = csc(constants[0]) - computed_constants[152] = cot(constants[0]) - computed_constants[153] = sinh(constants[0]) - computed_constants[154] = cosh(constants[0]) - computed_constants[155] = tanh(constants[0]) - computed_constants[156] = sech(constants[0]) - computed_constants[157] = csch(constants[0]) - computed_constants[158] = coth(constants[0]) - computed_constants[159] = asin(constants[0]) - computed_constants[160] = acos(constants[0]) - computed_constants[161] = atan(constants[0]) - computed_constants[162] = asec(constants[0]) - computed_constants[163] = acsc(constants[0]) - computed_constants[164] = acot(constants[0]) - computed_constants[165] = asinh(constants[0]) - computed_constants[166] = acosh(constants[0]) - computed_constants[167] = atanh(constants[0]/2.0) - computed_constants[168] = asech(constants[0]) - computed_constants[169] = acsch(constants[0]) - computed_constants[170] = acoth(2.0*constants[0]) - computed_constants[171] = constants[0] if gt_func(constants[0], constants[1]) else nan - computed_constants[172] = constants[0] if gt_func(constants[0], constants[1]) else constants[2] - computed_constants[173] = constants[0] if gt_func(constants[0], constants[1]) else constants[2] if gt_func(constants[2], constants[3]) else constants[4] if gt_func(constants[4], constants[5]) else nan - computed_constants[174] = constants[0] if gt_func(constants[0], constants[1]) else constants[2] if gt_func(constants[2], constants[3]) else constants[4] if gt_func(constants[4], constants[5]) else constants[6] - computed_constants[175] = 123.0+(constants[0] if gt_func(constants[0], constants[1]) else nan) - computed_constants[180] = constants[0] - computed_constants[187] = and_func(constants[0], constants[1])+(constants[1] if gt_func(constants[2], constants[3]) else nan)+constants[4]+and_func(constants[5], constants[6]) - computed_constants[188] = and_func(constants[0], constants[1])-((constants[1] if gt_func(constants[2], constants[3]) else nan)-(constants[4]-(constants[1] if gt_func(constants[2], constants[3]) else nan)))-and_func(constants[5], constants[6]) - computed_constants[189] = and_func(constants[0], constants[1])*(constants[1] if gt_func(constants[2], constants[3]) else nan)*constants[4]*(constants[1] if gt_func(constants[2], constants[3]) else nan)*and_func(constants[5], constants[6]) - computed_constants[190] = and_func(constants[0], constants[1])/((constants[1] if gt_func(constants[2], constants[3]) else nan)/(constants[4]/(constants[1] if gt_func(constants[2], constants[3]) else nan))) - computed_constants[191] = and_func(or_func(constants[0], constants[1]), and_func(xor_func(constants[0], constants[1]), and_func(constants[1] if gt_func(constants[2], constants[3]) else nan, and_func(and_func(and_func(constants[4], constants[1] if gt_func(constants[2], constants[3]) else nan), xor_func(constants[0], constants[1])), or_func(constants[0], constants[1]))))) - computed_constants[192] = or_func(and_func(constants[0], constants[1]), or_func(xor_func(constants[0], constants[1]), or_func(constants[1] if gt_func(constants[2], constants[3]) else nan, or_func(or_func(or_func(constants[4], constants[1] if gt_func(constants[2], constants[3]) else nan), xor_func(constants[0], constants[1])), and_func(constants[0], constants[1]))))) - computed_constants[193] = xor_func(and_func(constants[0], constants[1]), xor_func(or_func(constants[0], constants[1]), xor_func(constants[1] if gt_func(constants[2], constants[3]) else nan, xor_func(xor_func(xor_func(constants[4], constants[1] if gt_func(constants[2], constants[3]) else nan), or_func(constants[0], constants[1])), and_func(constants[0], constants[1]))))) - computed_constants[194] = pow(and_func(constants[0], constants[1]), pow(constants[1] if gt_func(constants[2], constants[3]) else nan, pow(pow(constants[4], constants[1] if gt_func(constants[2], constants[3]) else nan), and_func(constants[0], constants[1])))) - computed_constants[195] = pow(pow(pow(and_func(constants[0], constants[1]), 1.0/pow(constants[1] if gt_func(constants[2], constants[3]) else nan, 1.0/constants[4])), 1.0/(constants[1] if gt_func(constants[2], constants[3]) else nan)), 1.0/and_func(constants[0], constants[1])) - computed_constants[196] = -and_func(constants[0], constants[1])+-(constants[1] if gt_func(constants[2], constants[3]) else nan) + computed_constants[137] = log(constants[0])/log(constants[1]) + computed_constants[138] = ceil(constants[0]) + computed_constants[139] = floor(constants[0]) + computed_constants[140] = min(constants[0], constants[1]) + computed_constants[141] = min(constants[0], min(constants[1], constants[2])) + computed_constants[142] = max(constants[0], constants[1]) + computed_constants[143] = max(constants[0], max(constants[1], constants[2])) + computed_constants[144] = fmod(constants[0], constants[1]) + computed_constants[145] = sin(constants[0]) + computed_constants[146] = cos(constants[0]) + computed_constants[147] = tan(constants[0]) + computed_constants[148] = sec(constants[0]) + computed_constants[149] = csc(constants[0]) + computed_constants[150] = cot(constants[0]) + computed_constants[151] = sinh(constants[0]) + computed_constants[152] = cosh(constants[0]) + computed_constants[153] = tanh(constants[0]) + computed_constants[154] = sech(constants[0]) + computed_constants[155] = csch(constants[0]) + computed_constants[156] = coth(constants[0]) + computed_constants[157] = asin(constants[0]) + computed_constants[158] = acos(constants[0]) + computed_constants[159] = atan(constants[0]) + computed_constants[160] = asec(constants[0]) + computed_constants[161] = acsc(constants[0]) + computed_constants[162] = acot(constants[0]) + computed_constants[163] = asinh(constants[0]) + computed_constants[164] = acosh(constants[0]) + computed_constants[165] = atanh(constants[0]/2.0) + computed_constants[166] = asech(constants[0]) + computed_constants[167] = acsch(constants[0]) + computed_constants[168] = acoth(2.0*constants[0]) + computed_constants[170] = constants[0] if gt_func(constants[0], constants[1]) else nan + computed_constants[171] = constants[0] if lt_func(constants[0], constants[1]) else nan + computed_constants[172] = constants[0] + computed_constants[173] = constants[0] if gt_func(constants[0], constants[1]) else constants[2] + computed_constants[174] = constants[0] if gt_func(constants[0], constants[1]) else constants[2] if gt_func(constants[2], constants[3]) else constants[4] if gt_func(constants[4], constants[5]) else nan + computed_constants[175] = constants[0] if lt_func(constants[0], constants[1]) else constants[2] if gt_func(constants[2], constants[3]) else constants[4] if gt_func(constants[4], constants[5]) else nan + computed_constants[176] = constants[0] if gt_func(constants[0], constants[1]) else constants[2] if gt_func(constants[2], constants[3]) else constants[4] if gt_func(constants[4], constants[5]) else constants[6] + computed_constants[177] = 123.0+(constants[0] if gt_func(constants[0], constants[1]) else nan) + computed_constants[178] = 123.0+(constants[0] if lt_func(constants[0], constants[1]) else nan) + computed_constants[183] = constants[0] + computed_constants[190] = and_func(constants[0], constants[1])+(constants[1] if gt_func(constants[2], constants[3]) else nan)+constants[4]+and_func(constants[5], constants[6]) + computed_constants[191] = and_func(constants[0], constants[1])+(constants[1] if lt_func(constants[2], constants[3]) else nan)+constants[4]+and_func(constants[5], constants[6]) + computed_constants[192] = and_func(constants[0], constants[1])-((constants[1] if gt_func(constants[2], constants[3]) else nan)-(constants[4]-(constants[1] if gt_func(constants[2], constants[3]) else nan)))-and_func(constants[5], constants[6]) + computed_constants[193] = and_func(constants[0], constants[1])-((constants[1] if lt_func(constants[2], constants[3]) else nan)-(constants[4]-(constants[1] if lt_func(constants[2], constants[3]) else nan)))-and_func(constants[5], constants[6]) + computed_constants[194] = and_func(constants[0], constants[1])*(constants[1] if gt_func(constants[2], constants[3]) else nan)*constants[4]*(constants[1] if gt_func(constants[2], constants[3]) else nan)*and_func(constants[5], constants[6]) + computed_constants[195] = and_func(constants[0], constants[1])*(constants[1] if lt_func(constants[2], constants[3]) else nan)*constants[4]*(constants[1] if lt_func(constants[2], constants[3]) else nan)*and_func(constants[5], constants[6]) + computed_constants[196] = and_func(constants[0], constants[1])/((constants[1] if gt_func(constants[2], constants[3]) else nan)/(constants[4]/(constants[1] if gt_func(constants[2], constants[3]) else nan))) + computed_constants[197] = and_func(constants[0], constants[1])/((constants[1] if lt_func(constants[2], constants[3]) else nan)/(constants[4]/(constants[1] if lt_func(constants[2], constants[3]) else nan))) + computed_constants[198] = and_func(or_func(constants[0], constants[1]), and_func(XOR_FUNC(constants[0], constants[1]), and_func(constants[1] if gt_func(constants[2], constants[3]) else nan, and_func(and_func(and_func(constants[4], constants[1] if gt_func(constants[2], constants[3]) else nan), XOR_FUNC(constants[0], constants[1])), or_func(constants[0], constants[1]))))) + computed_constants[199] = or_func(and_func(constants[0], constants[1]), or_func(XOR_FUNC(constants[0], constants[1]), or_func(constants[1] if gt_func(constants[2], constants[3]) else nan, or_func(or_func(or_func(constants[4], constants[1] if gt_func(constants[2], constants[3]) else nan), XOR_FUNC(constants[0], constants[1])), and_func(constants[0], constants[1]))))) + computed_constants[200] = XOR_FUNC(and_func(constants[0], constants[1]), XOR_FUNC(or_func(constants[0], constants[1]), XOR_FUNC(constants[1] if gt_func(constants[2], constants[3]) else nan, XOR_FUNC(XOR_FUNC(XOR_FUNC(constants[4], constants[1] if gt_func(constants[2], constants[3]) else nan), or_func(constants[0], constants[1])), and_func(constants[0], constants[1]))))) + computed_constants[201] = pow(and_func(constants[0], constants[1]), pow(constants[1] if gt_func(constants[2], constants[3]) else nan, pow(pow(constants[4], constants[1] if gt_func(constants[2], constants[3]) else nan), and_func(constants[0], constants[1])))) + computed_constants[202] = pow(pow(pow(and_func(constants[0], constants[1]), 1.0/pow(constants[1] if gt_func(constants[2], constants[3]) else nan, 1.0/constants[4])), 1.0/(constants[1] if gt_func(constants[2], constants[3]) else nan)), 1.0/and_func(constants[0], constants[1])) + computed_constants[203] = -and_func(constants[0], constants[1])+-(constants[1] if gt_func(constants[2], constants[3]) else nan) + computed_constants[204] = -and_func(constants[0], constants[1])+-(constants[1] if lt_func(constants[2], constants[3]) else nan) def compute_rates(voi, states, rates, constants, computed_constants, algebraic, externals, external_variable): @@ -614,5 +627,8 @@ def compute_rates(voi, states, rates, constants, computed_constants, algebraic, def compute_variables(voi, states, rates, constants, computed_constants, algebraic, externals, external_variable): + algebraic[0] = or_func(states[0], states[0]) + algebraic[1] = or_func(states[0], or_func(states[0], constants[0])) + algebraic[2] = constants[0]/XOR_FUNC(constants[1], states[0]) externals[0] = external_variable(voi, states, rates, constants, computed_constants, algebraic, externals, 0) find_root_0(voi, states, rates, constants, computed_constants, algebraic, externals) diff --git a/tests/resources/generator/cellml_slc_example/model.c b/tests/resources/generator/cellml_slc_example/model.c new file mode 100644 index 0000000000..1436a03f37 --- /dev/null +++ b/tests/resources/generator/cellml_slc_example/model.c @@ -0,0 +1,92 @@ +/* The content of this file was generated using the C profile of libCellML 0.6.0. */ + +#include "model.h" + +#include +#include + +const char VERSION[] = "0.6.0"; +const char LIBCELLML_VERSION[] = "0.6.0"; + +const size_t CONSTANT_COUNT = 9; +const size_t COMPUTED_CONSTANT_COUNT = 1; +const size_t ALGEBRAIC_COUNT = 0; + +const VariableInfo CONSTANT_INFO[] = { + {"E", "fmol", "SLC_template3_ss"}, + {"P_0", "per_fmol_sec4", "SLC_template3_ss"}, + {"q_Ao", "fmol", "SLC_template3_ss"}, + {"P_1", "per_fmol_sec4", "SLC_template3_ss"}, + {"q_Ai", "fmol", "SLC_template3_ss"}, + {"P_2", "per_fmol_sec3", "SLC_template3_ss"}, + {"P_5", "per_sec3", "SLC_template3_ss"}, + {"P_4", "per_fmol2_sec3", "SLC_template3_ss"}, + {"P_3", "per_fmol_sec3", "SLC_template3_ss"} +}; + +const VariableInfo COMPUTED_CONSTANT_INFO[] = { + {"v", "fmol_per_sec", "SLC_template3_ss"} +}; + +const VariableInfo ALGEBRAIC_INFO[] = { +}; + +double * createConstantsArray() +{ + double *res = (double *) malloc(CONSTANT_COUNT*sizeof(double)); + + for (size_t i = 0; i < CONSTANT_COUNT; ++i) { + res[i] = NAN; + } + + return res; +} + +double * createComputedConstantsArray() +{ + double *res = (double *) malloc(COMPUTED_CONSTANT_COUNT*sizeof(double)); + + for (size_t i = 0; i < COMPUTED_CONSTANT_COUNT; ++i) { + res[i] = NAN; + } + + return res; +} + +double * createAlgebraicArray() +{ + double *res = (double *) malloc(ALGEBRAIC_COUNT*sizeof(double)); + + for (size_t i = 0; i < ALGEBRAIC_COUNT; ++i) { + res[i] = NAN; + } + + return res; +} + +void deleteArray(double *array) +{ + free(array); +} + +void initialiseVariables(double *constants, double *computedConstants, double *algebraic) +{ + constants[0] = 1.1; + constants[1] = 21262500.0; + constants[2] = 150.0; + constants[3] = 3402000.0; + constants[4] = 2.0; + constants[5] = 2902500.0; + constants[6] = 810000.0; + constants[7] = 247140.0; + constants[8] = 2902500.0; +} + +void computeComputedConstants(double *constants, double *computedConstants) +{ + computedConstants[0] = constants[0]*(constants[1]*constants[2]-constants[3]*constants[4])/(constants[5]*constants[4]+constants[8]*constants[2]+constants[7]*constants[4]*constants[2]+constants[6]); +} + +void computeVariables(double *constants, double *computedConstants, double *algebraic) +{ +} diff --git a/tests/resources/generator/cellml_slc_example/model.h b/tests/resources/generator/cellml_slc_example/model.h new file mode 100644 index 0000000000..661f80fa6f --- /dev/null +++ b/tests/resources/generator/cellml_slc_example/model.h @@ -0,0 +1,32 @@ +/* The content of this file was generated using the C profile of libCellML 0.6.0. */ + +#pragma once + +#include + +extern const char VERSION[]; +extern const char LIBCELLML_VERSION[]; + +extern const size_t CONSTANT_COUNT; +extern const size_t COMPUTED_CONSTANT_COUNT; +extern const size_t ALGEBRAIC_COUNT; + +typedef struct { + char name[5]; + char units[15]; + char component[17]; +} VariableInfo; + +extern const VariableInfo CONSTANT_INFO[]; +extern const VariableInfo COMPUTED_CONSTANT_INFO[]; +extern const VariableInfo ALGEBRAIC_INFO[]; + +double * createConstantsArray(); +double * createComputedConstantsArray(); +double * createAlgebraicArray(); + +void deleteArray(double *array); + +void initialiseVariables(double *constants, double *computedConstants, double *algebraic); +void computeComputedConstants(double *constants, double *computedConstants); +void computeVariables(double *constants, double *computedConstants, double *algebraic); diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.external.c similarity index 99% rename from tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.c rename to tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.external.c index a7c7bbde73..0ff0c4489f 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.external.c @@ -1,6 +1,6 @@ /* The content of this file was generated using the C profile of libCellML 0.6.0. */ -#include "model.algebraic.h" +#include "model.algebraic.external.h" #include #include diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.external.h similarity index 100% rename from tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.h rename to tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.external.h diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.external.py similarity index 100% rename from tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.py rename to tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.algebraic.external.py diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.external.c similarity index 99% rename from tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.c rename to tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.external.c index 3c6887b968..5862270578 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.external.c @@ -1,6 +1,6 @@ /* The content of this file was generated using the C profile of libCellML 0.6.0. */ -#include "model.computed.constant.h" +#include "model.computed.constant.external.h" #include #include diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.external.h similarity index 100% rename from tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.h rename to tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.external.h diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.external.py similarity index 100% rename from tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.py rename to tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.external.py diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.external.c similarity index 99% rename from tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.c rename to tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.external.c index 12ff7e8eef..62631ccd62 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.external.c @@ -1,6 +1,6 @@ /* The content of this file was generated using the C profile of libCellML 0.6.0. */ -#include "model.constant.h" +#include "model.constant.external.h" #include #include diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.external.h similarity index 100% rename from tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.h rename to tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.external.h diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.external.py similarity index 100% rename from tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.py rename to tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.constant.external.py diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.external.c similarity index 99% rename from tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.c rename to tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.external.c index 7cd82fc2f7..e357c309c0 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.external.c @@ -1,6 +1,6 @@ /* The content of this file was generated using the C profile of libCellML 0.6.0. */ -#include "model.dependent.algebraic.h" +#include "model.dependent.algebraic.external.h" #include #include diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.external.h similarity index 100% rename from tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.h rename to tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.external.h diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.external.py similarity index 100% rename from tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.py rename to tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.algebraic.external.py diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.external.c similarity index 99% rename from tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.c rename to tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.external.c index 50c6630bd3..2948224f4d 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.external.c @@ -1,6 +1,6 @@ /* The content of this file was generated using the C profile of libCellML 0.6.0. */ -#include "model.dependent.computed.constant.h" +#include "model.dependent.computed.constant.external.h" #include #include diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.external.h similarity index 100% rename from tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.h rename to tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.external.h diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.external.py similarity index 100% rename from tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.py rename to tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.computed.constant.external.py diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.external.c similarity index 99% rename from tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.c rename to tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.external.c index 7ee290663e..55adde719b 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.external.c @@ -1,6 +1,6 @@ /* The content of this file was generated using the C profile of libCellML 0.6.0. */ -#include "model.dependent.constant.h" +#include "model.dependent.constant.external.h" #include #include diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.external.h similarity index 100% rename from tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.h rename to tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.external.h diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.external.py similarity index 100% rename from tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.py rename to tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.constant.external.py diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.external.c similarity index 99% rename from tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.c rename to tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.external.c index 56be82f194..b9bca59ba5 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.external.c @@ -1,6 +1,6 @@ /* The content of this file was generated using the C profile of libCellML 0.6.0. */ -#include "model.dependent.state.h" +#include "model.dependent.state.external.h" #include #include diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.external.h similarity index 100% rename from tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.h rename to tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.external.h diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.external.py similarity index 100% rename from tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.py rename to tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.dependent.state.external.py diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.c b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.external.c similarity index 99% rename from tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.c rename to tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.external.c index 3acf0bc178..0e3ca00d59 100644 --- a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.c +++ b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.external.c @@ -1,6 +1,6 @@ /* The content of this file was generated using the C profile of libCellML 0.6.0. */ -#include "model.state.h" +#include "model.state.external.h" #include #include diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.h b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.external.h similarity index 100% rename from tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.h rename to tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.external.h diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.py b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.external.py similarity index 100% rename from tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.py rename to tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.state.external.py diff --git a/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model_unknown_vars_on_rhs.cellml b/tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.unknown.vars.on.rhs.cellml similarity index 100% rename from tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model_unknown_vars_on_rhs.cellml rename to tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.unknown.vars.on.rhs.cellml From 5a3a19e8fc3df2becdfd95a5a4d2337060aa4540 Mon Sep 17 00:00:00 2001 From: Alan Garny Date: Wed, 23 Oct 2024 11:17:12 +1300 Subject: [PATCH 85/85] Tests: improved our coverage. --- tests/coverage/coverage.cpp | 55 +++++++++++-------------------------- 1 file changed, 16 insertions(+), 39 deletions(-) diff --git a/tests/coverage/coverage.cpp b/tests/coverage/coverage.cpp index 9cbbd6fe8d..e3f169f146 100644 --- a/tests/coverage/coverage.cpp +++ b/tests/coverage/coverage.cpp @@ -627,53 +627,30 @@ TEST(Coverage, generator) EXPECT_EQ(size_t(1), analyserModel->equation(0)->states().size()); EXPECT_NE(nullptr, analyserModel->equation(0)->state(0)); EXPECT_EQ(nullptr, analyserModel->equation(0)->state(analyserModel->equation(0)->stateCount())); - /*---GRY--- STILL NEEDED? - EXPECT_NE(nullptr, analyserModel->equation(199)); - EXPECT_NE(size_t(0), analyserModel->equation(199)->dependencyCount()); - EXPECT_NE(size_t(0), analyserModel->equation(199)->dependencies().size()); - EXPECT_NE(nullptr, analyserModel->equation(199)->dependency(0)); - EXPECT_EQ(nullptr, analyserModel->equation(199)->dependency(analyserModel->equation(199)->dependencyCount())); - EXPECT_EQ(size_t(1), analyserModel->equation(199)->nlaSiblingCount()); - EXPECT_EQ(size_t(1), analyserModel->equation(199)->nlaSiblings().size()); - EXPECT_NE(nullptr, analyserModel->equation(199)->nlaSibling(0)); - EXPECT_EQ(nullptr, analyserModel->equation(199)->nlaSibling(analyserModel->equation(199)->nlaSiblingCount())); - EXPECT_EQ(size_t(0), analyserModel->equation(199)->computedConstantCount()); - EXPECT_EQ(size_t(0), analyserModel->equation(199)->computedConstants().size()); - EXPECT_EQ(nullptr, analyserModel->equation(199)->computedConstant(0)); - EXPECT_EQ(nullptr, analyserModel->equation(199)->computedConstant(analyserModel->equation(199)->computedConstantCount())); - EXPECT_NE(size_t(0), analyserModel->equation(199)->algebraicCount()); - EXPECT_NE(size_t(0), analyserModel->equation(199)->algebraic().size()); - EXPECT_NE(nullptr, analyserModel->equation(199)->algebraic(0)); - EXPECT_EQ(nullptr, analyserModel->equation(199)->algebraic(analyserModel->equation(199)->algebraicCount())); - EXPECT_EQ(size_t(0), analyserModel->equation(199)->externalCount()); - EXPECT_EQ(size_t(0), analyserModel->equation(199)->externals().size()); - EXPECT_EQ(nullptr, analyserModel->equation(199)->external(0)); - EXPECT_EQ(nullptr, analyserModel->equation(199)->external(analyserModel->equation(199)->externalCount())); EXPECT_EQ(nullptr, analyserModel->equation(analyserModel->equationCount())); - */ for (const auto &equation : analyserModel->equations()) { + equation->dependencyCount(); + equation->dependency(0); + equation->dependency(equation->dependencyCount()); + equation->nlaSiblingCount(); + equation->nlaSibling(0); + equation->nlaSibling(equation->nlaSiblingCount()); + equation->computedConstantCount(); + equation->computedConstant(0); + equation->computedConstant(equation->computedConstantCount()); + equation->algebraicCount(); + equation->algebraic(0); + equation->algebraic(equation->algebraicCount()); + equation->externalCount(); + equation->external(0); + equation->external(equation->externalCount()); + checkAstTypeAsString(equation->ast()); } auto generator = libcellml::Generator::create(); - EXPECT_EQ(nullptr, analyserModel->voi()->initialisingVariable()); - - for (size_t i = 0; i < analyserModel->stateCount(); ++i) { - EXPECT_NE(nullptr, analyserModel->state(i)->initialisingVariable()); - } - - for (size_t i = 0; i < analyserModel->constantCount(); ++i) { - EXPECT_NE(nullptr, analyserModel->constant(i)->initialisingVariable()); - } - - /*---GRY--- STILL NEEDED? - for (size_t i = 0; i < analyserModel->algebraicCount(); ++i) { - EXPECT_NE(nullptr, analyserModel->algebraic(i)->initialisingVariable()); - } - */ - EXPECT_EQ(nullptr, generator->model()); EXPECT_EQ(EMPTY_STRING, generator->interfaceCode()); EXPECT_EQ(EMPTY_STRING, generator->implementationCode());