From 0207ff9d9d71a4a492c710dca22c5ba3172e4a8e Mon Sep 17 00:00:00 2001 From: Alan Garny Date: Fri, 12 Jul 2024 14:57:17 +1200 Subject: [PATCH] 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