From 5b0b9f1020e85bb76ab5ee0dcdcb1942a3d6f507 Mon Sep 17 00:00:00 2001 From: Alan Garny Date: Thu, 4 Dec 2025 10:58:01 +1300 Subject: [PATCH 1/5] New version. --- VERSION.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION.txt b/VERSION.txt index c2ba9d207..524ef5293 100644 --- a/VERSION.txt +++ b/VERSION.txt @@ -1 +1 @@ -0.20251030.0 +0.20251204.0 From ecaf4f9336118873cdbcd936eec4a05df7b63647 Mon Sep 17 00:00:00 2001 From: Alan Garny Date: Thu, 4 Dec 2025 10:52:52 +1300 Subject: [PATCH 2/5] SedChangeAttribute: fixed a warning that we generate. --- src/sed/sedchangeattribute.cpp | 4 ++-- tests/api/solver/coveragetests.cpp | 4 ++-- tests/bindings/javascript/solver.coverage.test.js | 4 ++-- tests/bindings/python/test_solver_coverage.py | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/sed/sedchangeattribute.cpp b/src/sed/sedchangeattribute.cpp index 9b969b0b3..a885fdd4f 100644 --- a/src/sed/sedchangeattribute.cpp +++ b/src/sed/sedchangeattribute.cpp @@ -95,7 +95,7 @@ void SedChangeAttribute::Impl::apply(const SedInstanceTaskPtr &pInstanceTask, auto voiVariable {pAnalyserModel->voi()->variable()}; auto voiComponent {owningComponent(voiVariable)}; - addWarning(std::string("The variable of integration '").append(voiVariable->name()).append("' in component '").append(voiComponent->name()).append("'cannot be changed. Only state variables and constants can be changed.")); + addWarning(std::string("The variable of integration '").append(voiVariable->name()).append("' in component '").append(voiComponent->name()).append("' cannot be changed. Only state variables and constants can be changed.")); return; } @@ -155,7 +155,7 @@ void SedChangeAttribute::Impl::apply(const SedInstanceTaskPtr &pInstanceTask, } if (!isParameterSet) { - addWarning(std::string("The variable '").append(mComponentName).append("' in component '").append(mVariableName).append("'could not be found and therefore could not be changed.")); + addWarning(std::string("The variable '").append(mVariableName).append("' in component '").append(mComponentName).append("' could not be found and therefore could not be changed.")); } } diff --git a/tests/api/solver/coveragetests.cpp b/tests/api/solver/coveragetests.cpp index 016e19d2e..6e999d29e 100644 --- a/tests/api/solver/coveragetests.cpp +++ b/tests/api/solver/coveragetests.cpp @@ -23,8 +23,8 @@ limitations under the License. TEST(CoverageSolverTest, odeChanges) { static const libOpenCOR::ExpectedIssues EXPECTED_ISSUES {{ - {libOpenCOR::Issue::Type::WARNING, "Task instance | Change attribute: the variable of integration 'time' in component 'environment'cannot be changed. Only state variables and constants can be changed."}, - {libOpenCOR::Issue::Type::WARNING, "Task instance | Change attribute: the variable 'membrane' in component 'X'could not be found and therefore could not be changed."}, + {libOpenCOR::Issue::Type::WARNING, "Task instance | Change attribute: the variable of integration 'time' in component 'environment' cannot be changed. Only state variables and constants can be changed."}, + {libOpenCOR::Issue::Type::WARNING, "Task instance | Change attribute: the variable 'X' in component 'membrane' could not be found and therefore could not be changed."}, {libOpenCOR::Issue::Type::WARNING, "Task instance | Change attribute: the computed constant 'E_Na' in component 'sodium_channel' cannot be changed. Only state variables and constants can be changed."}, {libOpenCOR::Issue::Type::WARNING, "Task instance | Change attribute: the algebraic variable 'i_Stim' in component 'membrane' cannot be changed. Only state variables and constants can be changed."}, }}; diff --git a/tests/bindings/javascript/solver.coverage.test.js b/tests/bindings/javascript/solver.coverage.test.js index 55616e633..fb33d2087 100644 --- a/tests/bindings/javascript/solver.coverage.test.js +++ b/tests/bindings/javascript/solver.coverage.test.js @@ -54,11 +54,11 @@ test.describe('Solver coverage tests', () => { assertIssues(loc, instance, [ [ loc.Issue.Type.WARNING, - "Task instance | Change attribute: the variable of integration 'time' in component 'environment'cannot be changed. Only state variables and constants can be changed." + "Task instance | Change attribute: the variable of integration 'time' in component 'environment' cannot be changed. Only state variables and constants can be changed." ], [ loc.Issue.Type.WARNING, - "Task instance | Change attribute: the variable 'membrane' in component 'X'could not be found and therefore could not be changed." + "Task instance | Change attribute: the variable 'X' in component 'membrane' could not be found and therefore could not be changed." ], [ loc.Issue.Type.WARNING, diff --git a/tests/bindings/python/test_solver_coverage.py b/tests/bindings/python/test_solver_coverage.py index 8092a1901..50c4ee898 100644 --- a/tests/bindings/python/test_solver_coverage.py +++ b/tests/bindings/python/test_solver_coverage.py @@ -23,11 +23,11 @@ def test_ode_changes(): expected_issues = [ [ loc.Issue.Type.Warning, - "Task instance | Change attribute: the variable of integration 'time' in component 'environment'cannot be changed. Only state variables and constants can be changed.", + "Task instance | Change attribute: the variable of integration 'time' in component 'environment' cannot be changed. Only state variables and constants can be changed.", ], [ loc.Issue.Type.Warning, - "Task instance | Change attribute: the variable 'membrane' in component 'X'could not be found and therefore could not be changed.", + "Task instance | Change attribute: the variable 'X' in component 'membrane' could not be found and therefore could not be changed.", ], [ loc.Issue.Type.Warning, From 010c82810de12f32c4beef3ccccd69d097a5d6af Mon Sep 17 00:00:00 2001 From: Alan Garny Date: Thu, 4 Dec 2025 11:28:14 +1300 Subject: [PATCH 3/5] Sphinx: don't allow the use of Sphinx 9.0.0+. Indeed, that version is not compatible with `sphinx-copybutton` and `sphinx-inline-tabs`. --- .github/workflows/ci.yml | 2 +- cmake/environmentchecks.cmake | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f0f827808..d7b0b38a7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -399,7 +399,7 @@ jobs: run: uv pip install --system pytest pytest-html - name: Install Sphinx and some Sphinx packages if: ${{ matrix.documentation == 'ON' }} - run: uv pip install --system sphinx sphinx-copybutton sphinx-inline-tabs + run: uv pip install --system sphinx~=8.0 sphinx-copybutton sphinx-inline-tabs - name: Install Doxygen if: ${{ matrix.documentation == 'ON' }} run: | diff --git a/cmake/environmentchecks.cmake b/cmake/environmentchecks.cmake index c468bace0..ee527c669 100644 --- a/cmake/environmentchecks.cmake +++ b/cmake/environmentchecks.cmake @@ -281,9 +281,19 @@ endif() if(DOXYGEN_EXE AND PATCH_EXE AND PYTHON_EXE AND SPHINX_EXE) set(EXPECTED_DOXYGEN_VERSION 1.9.3) + set(UNSUPPORTED_SPHINX_VERSION 9.0.0) + + execute_process(COMMAND ${SPHINX_EXE} --version + OUTPUT_VARIABLE SPHINX_VERSION_OUTPUT + OUTPUT_STRIP_TRAILING_WHITESPACE + ERROR_QUIET) + + string(REGEX REPLACE "^sphinx-build ([0-9]+\\.[0-9]+\\.[0-9]+).*$" "\\1" SPHINX_VERSION "${SPHINX_VERSION_OUTPUT}") if(NOT DOXYGEN_VERSION VERSION_EQUAL EXPECTED_DOXYGEN_VERSION) set(DOCUMENTATION_AVAILABLE_ERROR_MESSAGE "Documentation is requested and Doxygen ${DOXYGEN_VERSION} was found, but version ${EXPECTED_DOXYGEN_VERSION} is needed.") + elseif(SPHINX_VERSION VERSION_GREATER_EQUAL UNSUPPORTED_SPHINX_VERSION) + set(DOCUMENTATION_AVAILABLE_ERROR_MESSAGE "Documentation is requested and Sphinx ${SPHINX_VERSION} was found, but version ${UNSUPPORTED_SPHINX_VERSION}+ is not supported." ) else() check_python_package(sphinx-copybutton PYTHON_SPHINX_COPY_BUTTON_AVAILABLE) check_python_package(sphinx-inline-tabs PYTHON_SPHINX_INLINE_TABS_AVAILABLE) From 4bcc8c5aa88916aa7ccd79da324217c0a6849dcc Mon Sep 17 00:00:00 2001 From: Alan Garny Date: Thu, 4 Dec 2025 11:32:53 +1300 Subject: [PATCH 4/5] modp_b64: upgraded to commit 5068510. --- extern/README.md | 2 +- extern/modp_b64/README.chromium | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/extern/README.md b/extern/README.md index 067b86f10..06df16d38 100644 --- a/extern/README.md +++ b/extern/README.md @@ -1,5 +1,5 @@ [libOpenCOR](https://opencor.ws/libopencor/index.html) relies on the following external projects: - [GoogleTest](https://github.com/google/googletest) [1.17.0](https://github.com/google/googletest/releases/tag/v1.17.0) -- [modp_b64](https://chromium.googlesource.com/chromium/src/third_party/modp_b64/) at commit [bcb074f](https://chromium.googlesource.com/chromium/src/third_party/modp_b64/+/bcb074f6614b4cbda45c9f87f968f6743266a52a) +- [modp_b64](https://chromium.googlesource.com/chromium/src/third_party/modp_b64/) at commit [5068510](https://chromium.googlesource.com/chromium/src/third_party/modp_b64/+/50685101d51ef9aabbd60c94f52d9e026d39c509) - [nanobind](https://github.com/wjakob/nanobind) [2.9.2](https://github.com/wjakob/nanobind/releases/tag/v2.9.2) diff --git a/extern/modp_b64/README.chromium b/extern/modp_b64/README.chromium index 98f8d016a..616d58441 100644 --- a/extern/modp_b64/README.chromium +++ b/extern/modp_b64/README.chromium @@ -3,6 +3,7 @@ Short Name: stringencoders URL: https://github.com/client9/stringencoders Version: 2.0.0 Revision: 26701a1c1fcb98ae43eefcaee23abc58459a6e59 +Update Mechanism: Static.HardFork (https://crbug.com/422922180) License: BSD-3-Clause License File: LICENSE Security Critical: yes From 623fbec7c4910a0fb05cc594522cefe9afbd9aeb Mon Sep 17 00:00:00 2001 From: Alan Garny Date: Thu, 4 Dec 2025 11:39:45 +1300 Subject: [PATCH 5/5] libCellML: upgraded to commit 7cc5bea. --- cmake/packages.cmake | 2 +- src/3rdparty/libCellML/CMakeLists.txt | 20 ++-- src/api/libopencor/sedinstancetask.h | 10 +- src/bindings/javascript/sed.cpp | 10 +- src/bindings/python/sed.cpp | 8 +- src/sed/sedchangeattribute.cpp | 6 +- src/sed/sedinstancetask.cpp | 58 ++++++------ src/sed/sedinstancetask_p.h | 8 +- src/support/cellml/cellmlfile.cpp | 2 +- src/support/cellml/cellmlfileruntime.cpp | 94 +++++++++---------- src/support/cellml/cellmlfileruntime.h | 12 +-- src/support/cellml/cellmlfileruntime_p.h | 12 +-- tests/api/sed/coveragetests.cpp | 16 ++-- tests/api/sed/instancetests.cpp | 4 +- tests/api/solver/coveragetests.cpp | 8 +- tests/api/solver/kinsoltests.cpp | 14 +-- .../bindings/javascript/res/res/libopencor.js | 4 +- .../bindings/javascript/sed.coverage.test.js | 20 ++-- .../bindings/javascript/sed.instance.test.js | 4 +- .../javascript/solver.coverage.test.js | 8 +- .../bindings/javascript/solver.kinsol.test.js | 14 +-- tests/bindings/javascript/utils.in.js | 4 +- tests/bindings/python/test_sed_coverage.py | 16 ++-- tests/bindings/python/test_sed_instance.py | 4 +- tests/bindings/python/test_solver_coverage.py | 14 ++- tests/bindings/python/test_solver_kinsol.py | 14 +-- tests/bindings/python/utils.in.py | 4 +- tests/install/bindings/python/test_install.py | 10 +- tests/install/src/main.cpp | 10 +- tests/support/cellml/runtimetests.cpp | 2 +- tests/utils.cpp | 4 +- 31 files changed, 210 insertions(+), 206 deletions(-) diff --git a/cmake/packages.cmake b/cmake/packages.cmake index 091c43a86..53777a7f7 100644 --- a/cmake/packages.cmake +++ b/cmake/packages.cmake @@ -195,7 +195,7 @@ function(retrieve_package PACKAGE_NAME PACKAGE_VERSION PACKAGE_REPOSITORY RELEAS if("${PACKAGE_NAME}" STREQUAL "libCellML") #---GRY--- USE THIS VERSION OF libCellML WHICH CORRESPONDS TO PR #1256 UNTIL IT GETS MERGED IN. - set(PACKAGE_URL "https://github.com/agarny/${PACKAGE_REPOSITORY}/releases/download/6d27883/${PACKAGE_FILE}") + set(PACKAGE_URL "https://github.com/agarny/${PACKAGE_REPOSITORY}/releases/download/7cc5bea/${PACKAGE_FILE}") endif() set(ATTEMPT 1) diff --git a/src/3rdparty/libCellML/CMakeLists.txt b/src/3rdparty/libCellML/CMakeLists.txt index b5e6aaa6d..73f1343bb 100644 --- a/src/3rdparty/libCellML/CMakeLists.txt +++ b/src/3rdparty/libCellML/CMakeLists.txt @@ -34,49 +34,49 @@ if(LIBOPENCOR_PREBUILT_LIBCELLML) if(EMSCRIPTEN) retrieve_package(${PACKAGE_NAME} ${PACKAGE_VERSION} ${PACKAGE_REPOSITORY} ${RELEASE_TAG} - f3087749522fb85a72d440180b9b4c3b5bf77eb4) + 5bee3b3c508fb274e084468243b43d9f83647beb) else() if(WIN32) if(RELEASE_MODE) if(INTEL_MODE) retrieve_package(${PACKAGE_NAME} ${PACKAGE_VERSION} ${PACKAGE_REPOSITORY} ${RELEASE_TAG} - b1bfb0c9d197e7b858f5f27f305bda5ae40a9ad7) + d277ce028be3806aa2514ba27ec4bed352faf069) else() retrieve_package(${PACKAGE_NAME} ${PACKAGE_VERSION} ${PACKAGE_REPOSITORY} ${RELEASE_TAG} - 4d06110bb96f71cff8f1fb0e0e463f94920f8fa9) + 388a936417a5681fbcf835bdda20e8ed0fbf3382) endif() else() if(INTEL_MODE) retrieve_package(${PACKAGE_NAME} ${PACKAGE_VERSION} ${PACKAGE_REPOSITORY} ${RELEASE_TAG} - 214b685fbaf9c616739ad8786800b75d59a47f8b) + c768d8c59db5ee4a07baa0fc61d7a8ccac4ea6db) else() retrieve_package(${PACKAGE_NAME} ${PACKAGE_VERSION} ${PACKAGE_REPOSITORY} ${RELEASE_TAG} - 0d6d70f9fdf7443d82016216a78be7d2acea2e7e) + 2fd521abaf83b480e5b07c746ae310be529faa7e) endif() endif() elseif(APPLE) if(INTEL_MODE) retrieve_package(${PACKAGE_NAME} ${PACKAGE_VERSION} ${PACKAGE_REPOSITORY} ${RELEASE_TAG} - 8ccd4a8a95a3b4b243d900746340f167d9f31075) + 055181384ac2e4e942603c6b1f3d0c20f439b523) else() retrieve_package(${PACKAGE_NAME} ${PACKAGE_VERSION} ${PACKAGE_REPOSITORY} ${RELEASE_TAG} - 72b1e4f2e4a2b76a0d45efced9ef96cbba263d66) + 847c024d893e3a1f73172e8f6d2e55136e46dd86) endif() else() if(INTEL_MODE) retrieve_package(${PACKAGE_NAME} ${PACKAGE_VERSION} ${PACKAGE_REPOSITORY} ${RELEASE_TAG} - 623866e3cf071f652fe778a22868b5c6917db6f9) + f8d847dffd74264a3074e742149dca0ab4c57653) else() retrieve_package(${PACKAGE_NAME} ${PACKAGE_VERSION} ${PACKAGE_REPOSITORY} ${RELEASE_TAG} - 9742ef210ca1cc88549b802c6f0fc5d1c0670f25) + 674bb536a67cc7e7d4afef553c843ac38d44d43f) endif() endif() endif() @@ -86,7 +86,7 @@ elseif(NOT ONLY_BUILD_JAVASCRIPT_THIRD_PARTY_LIBRARIES) build_package(${PACKAGE_NAME} URL # https://github.com/opencor/${PACKAGE_REPOSITORY}/archive/refs/tags/${RELEASE_TAG}.tar.gz - https://github.com/agarny/${PACKAGE_REPOSITORY}/archive/refs/tags/6d27883.tar.gz + https://github.com/agarny/${PACKAGE_REPOSITORY}/archive/refs/tags/7cc5bea.tar.gz DOWNLOAD_NO_PROGRESS ON CMAKE_ARGS -DBINDINGS_PYTHON=OFF diff --git a/src/api/libopencor/sedinstancetask.h b/src/api/libopencor/sedinstancetask.h index e4e953093..47e4b3c6f 100644 --- a/src/api/libopencor/sedinstancetask.h +++ b/src/api/libopencor/sedinstancetask.h @@ -288,7 +288,7 @@ class LIBOPENCOR_EXPORT SedInstanceTask: public Logger * @return The number of algebraic variables. */ - size_t algebraicCount() const; + size_t algebraicVariableCount() const; /** * @brief Get the values of the algebraic variable at the given index. @@ -300,10 +300,10 @@ class LIBOPENCOR_EXPORT SedInstanceTask: public Logger * @return The values of the algebraic variable, as a @c Doubles, if the index is valid, an empty vector otherwise. */ - Doubles algebraic(size_t pIndex) const; + Doubles algebraicVariable(size_t pIndex) const; #ifdef __EMSCRIPTEN__ - emscripten::val algebraicAsArray(size_t pIndex) const; + emscripten::val algebraicVariableAsArray(size_t pIndex) const; #endif /** @@ -317,7 +317,7 @@ class LIBOPENCOR_EXPORT SedInstanceTask: public Logger * otherwise. */ - std::string algebraicName(size_t pIndex) const; + std::string algebraicVariableName(size_t pIndex) const; /** * @brief Get the unit of the algebraic variable. @@ -330,7 +330,7 @@ class LIBOPENCOR_EXPORT SedInstanceTask: public Logger * otherwise. */ - std::string algebraicUnit(size_t pIndex) const; + std::string algebraicVariableUnit(size_t pIndex) const; private: class Impl; /**< Forward declaration of the implementation class, @private. */ diff --git a/src/bindings/javascript/sed.cpp b/src/bindings/javascript/sed.cpp index 7bcd621b8..d6f381742 100644 --- a/src/bindings/javascript/sed.cpp +++ b/src/bindings/javascript/sed.cpp @@ -120,11 +120,11 @@ void sedApi() .function("computedConstantAsArray", &libOpenCOR::SedInstanceTask::computedConstantAsArray) .function("computedConstantName", &libOpenCOR::SedInstanceTask::computedConstantName) .function("computedConstantUnit", &libOpenCOR::SedInstanceTask::computedConstantUnit) - .property("algebraicCount", &libOpenCOR::SedInstanceTask::algebraicCount) - .function("algebraic", &libOpenCOR::SedInstanceTask::algebraic) - .function("algebraicAsArray", &libOpenCOR::SedInstanceTask::algebraicAsArray) - .function("algebraicName", &libOpenCOR::SedInstanceTask::algebraicName) - .function("algebraicUnit", &libOpenCOR::SedInstanceTask::algebraicUnit); + .property("algebraicVariableCount", &libOpenCOR::SedInstanceTask::algebraicVariableCount) + .function("algebraicVariable", &libOpenCOR::SedInstanceTask::algebraicVariable) + .function("algebraicVariableAsArray", &libOpenCOR::SedInstanceTask::algebraicVariableAsArray) + .function("algebraicVariableName", &libOpenCOR::SedInstanceTask::algebraicVariableName) + .function("algebraicVariableUnit", &libOpenCOR::SedInstanceTask::algebraicVariableUnit); // SedModel API. diff --git a/src/bindings/python/sed.cpp b/src/bindings/python/sed.cpp index 2c640fc22..f19aebeab 100644 --- a/src/bindings/python/sed.cpp +++ b/src/bindings/python/sed.cpp @@ -124,10 +124,10 @@ void sedApi(nb::module_ &m) .def("computed_constant", &libOpenCOR::SedInstanceTask::computedConstant, "Return the values of a computed constant.") .def("computed_constant_name", &libOpenCOR::SedInstanceTask::computedConstantName, "Return the name of a computed constant.") .def("computed_constant_unit", &libOpenCOR::SedInstanceTask::computedConstantUnit, "Return the unit of a computed constant.") - .def_prop_ro("algebraic_count", &libOpenCOR::SedInstanceTask::algebraicCount, "Return the number of algebraic variables.") - .def("algebraic", &libOpenCOR::SedInstanceTask::algebraic, "Return the values of an algebraic variable.") - .def("algebraic_name", &libOpenCOR::SedInstanceTask::algebraicName, "Return the name of an algebraic variable.") - .def("algebraic_unit", &libOpenCOR::SedInstanceTask::algebraicUnit, "Return the unit of an algebraic variable."); + .def_prop_ro("algebraic_variable_count", &libOpenCOR::SedInstanceTask::algebraicVariableCount, "Return the number of algebraic variables.") + .def("algebraic_variable", &libOpenCOR::SedInstanceTask::algebraicVariable, "Return the values of an algebraic variable.") + .def("algebraic_variable_name", &libOpenCOR::SedInstanceTask::algebraicVariableName, "Return the name of an algebraic variable.") + .def("algebraic_variable_unit", &libOpenCOR::SedInstanceTask::algebraicVariableUnit, "Return the unit of an algebraic variable."); // SedModel API. diff --git a/src/sed/sedchangeattribute.cpp b/src/sed/sedchangeattribute.cpp index a885fdd4f..add084469 100644 --- a/src/sed/sedchangeattribute.cpp +++ b/src/sed/sedchangeattribute.cpp @@ -140,9 +140,9 @@ void SedChangeAttribute::Impl::apply(const SedInstanceTaskPtr &pInstanceTask, } if (!isParameterSet) { - for (size_t i {0}; i < pAnalyserModel->algebraicCount(); ++i) { - if (instanceTaskPimpl->algebraicName(i) == changeName) { - auto algebraicVariable {pAnalyserModel->algebraic()[i]->variable()}; + for (size_t i {0}; i < pAnalyserModel->algebraicVariableCount(); ++i) { + if (instanceTaskPimpl->algebraicVariableName(i) == changeName) { + auto algebraicVariable {pAnalyserModel->algebraicVariables()[i]->variable()}; auto algebraicComponent {owningComponent(algebraicVariable)}; addWarning(std::string("The algebraic variable '").append(algebraicVariable->name()).append("' in component '").append(algebraicComponent->name()).append("' cannot be changed. Only state variables and constants can be changed.")); diff --git a/src/sed/sedinstancetask.cpp b/src/sed/sedinstancetask.cpp index ead72e0da..e529a982d 100644 --- a/src/sed/sedinstancetask.cpp +++ b/src/sed/sedinstancetask.cpp @@ -96,7 +96,7 @@ SedInstanceTask::Impl::Impl(const SedAbstractTaskPtr &pTask) mConstantDoubles.resize(mAnalyserModel->constantCount(), NAN); mComputedConstantDoubles.resize(mAnalyserModel->computedConstantCount(), NAN); - mAlgebraicDoubles.resize(mAnalyserModel->algebraicCount(), NAN); + mAlgebraicDoubles.resize(mAnalyserModel->algebraicVariableCount(), NAN); mConstants = mConstantDoubles.data(); mComputedConstants = mComputedConstantDoubles.data(); @@ -104,7 +104,7 @@ SedInstanceTask::Impl::Impl(const SedAbstractTaskPtr &pTask) mResults.constants.resize(mAnalyserModel->constantCount(), {}); mResults.computedConstants.resize(mAnalyserModel->computedConstantCount(), {}); - mResults.algebraic.resize(mAnalyserModel->algebraicCount(), {}); + mResults.algebraic.resize(mAnalyserModel->algebraicVariableCount(), {}); } void SedInstanceTask::Impl::trackResults(size_t pIndex) @@ -124,7 +124,7 @@ void SedInstanceTask::Impl::trackResults(size_t pIndex) mResults.computedConstants[i][pIndex] = mComputedConstants[i]; // NOLINT } - for (size_t i {0}; i < mAnalyserModel->algebraicCount(); ++i) { + for (size_t i {0}; i < mAnalyserModel->algebraicVariableCount(); ++i) { mResults.algebraic[i][pIndex] = mAlgebraic[i]; // NOLINT } } @@ -157,15 +157,15 @@ void SedInstanceTask::Impl::initialise() mVoi = mSedUniformTimeCourse->pimpl()->mOutputStartTime; #ifdef __EMSCRIPTEN__ - mRuntime->initialiseVariablesForDifferentialModel(mStates, mRates, mConstants, mComputedConstants, mAlgebraic); + mRuntime->initialiseArraysForDifferentialModel(mStates, mRates, mConstants, mComputedConstants, mAlgebraic); #else - mRuntime->initialiseVariablesForDifferentialModel()(mStates, mRates, mConstants, mComputedConstants, mAlgebraic); + mRuntime->initialiseArraysForDifferentialModel()(mStates, mRates, mConstants, mComputedConstants, mAlgebraic); #endif } else { #ifdef __EMSCRIPTEN__ - mRuntime->initialiseVariablesForAlgebraicModel(mConstants, mComputedConstants, mAlgebraic); + mRuntime->initialiseArraysForAlgebraicModel(mConstants, mComputedConstants, mAlgebraic); #else - mRuntime->initialiseVariablesForAlgebraicModel()(mConstants, mComputedConstants, mAlgebraic); + mRuntime->initialiseArraysForAlgebraicModel()(mConstants, mComputedConstants, mAlgebraic); #endif } @@ -245,7 +245,7 @@ double SedInstanceTask::Impl::run() mResults.computedConstants[i].resize(resultsSize, NAN); } - for (size_t i {0}; i < mAnalyserModel->algebraicCount(); ++i) { + for (size_t i {0}; i < mAnalyserModel->algebraicVariableCount(); ++i) { mResults.algebraic[i].resize(resultsSize, NAN); } @@ -302,7 +302,7 @@ double SedInstanceTask::Impl::run() mResults.computedConstants[i].resize(1, mComputedConstants[i]); // NOLINT } - for (size_t i {0}; i < mAnalyserModel->algebraicCount(); ++i) { + for (size_t i {0}; i < mAnalyserModel->algebraicVariableCount(); ++i) { mResults.algebraic[i].resize(1, mAlgebraic[i]); // NOLINT } } @@ -467,36 +467,36 @@ std::string SedInstanceTask::Impl::computedConstantUnit(size_t pIndex) const return mAnalyserModel->computedConstants()[pIndex]->variable()->units()->name(); } -size_t SedInstanceTask::Impl::algebraicCount() const +size_t SedInstanceTask::Impl::algebraicVariableCount() const { - return mAnalyserModel->algebraicCount(); + return mAnalyserModel->algebraicVariableCount(); } -Doubles SedInstanceTask::Impl::algebraic(size_t pIndex) const +Doubles SedInstanceTask::Impl::algebraicVariable(size_t pIndex) const { - if (pIndex >= mAnalyserModel->algebraicCount()) { + if (pIndex >= mAnalyserModel->algebraicVariableCount()) { return {}; } return mResults.algebraic[pIndex]; } -std::string SedInstanceTask::Impl::algebraicName(size_t pIndex) const +std::string SedInstanceTask::Impl::algebraicVariableName(size_t pIndex) const { - if (pIndex >= mAnalyserModel->algebraicCount()) { + if (pIndex >= mAnalyserModel->algebraicVariableCount()) { return {}; } - return name(mAnalyserModel->algebraic()[pIndex]->variable()); + return name(mAnalyserModel->algebraicVariables()[pIndex]->variable()); } -std::string SedInstanceTask::Impl::algebraicUnit(size_t pIndex) const +std::string SedInstanceTask::Impl::algebraicVariableUnit(size_t pIndex) const { - if (pIndex >= mAnalyserModel->algebraicCount()) { + if (pIndex >= mAnalyserModel->algebraicVariableCount()) { return {}; } - return mAnalyserModel->algebraic()[pIndex]->variable()->units()->name(); + return mAnalyserModel->algebraicVariables()[pIndex]->variable()->units()->name(); } SedInstanceTask::SedInstanceTask(const SedAbstractTaskPtr &pTask) @@ -649,31 +649,31 @@ std::string SedInstanceTask::computedConstantUnit(size_t pIndex) const return pimpl()->computedConstantUnit(pIndex); } -size_t SedInstanceTask::algebraicCount() const +size_t SedInstanceTask::algebraicVariableCount() const { - return pimpl()->algebraicCount(); + return pimpl()->algebraicVariableCount(); } -Doubles SedInstanceTask::algebraic(size_t pIndex) const +Doubles SedInstanceTask::algebraicVariable(size_t pIndex) const { - return pimpl()->algebraic(pIndex); + return pimpl()->algebraicVariable(pIndex); } #ifdef __EMSCRIPTEN__ -emscripten::val SedInstanceTask::algebraicAsArray(size_t pIndex) const +emscripten::val SedInstanceTask::algebraicVariableAsArray(size_t pIndex) const { - return emscripten::val::array(algebraic(pIndex)); + return emscripten::val::array(algebraicVariable(pIndex)); } #endif -std::string SedInstanceTask::algebraicName(size_t pIndex) const +std::string SedInstanceTask::algebraicVariableName(size_t pIndex) const { - return pimpl()->algebraicName(pIndex); + return pimpl()->algebraicVariableName(pIndex); } -std::string SedInstanceTask::algebraicUnit(size_t pIndex) const +std::string SedInstanceTask::algebraicVariableUnit(size_t pIndex) const { - return pimpl()->algebraicUnit(pIndex); + return pimpl()->algebraicVariableUnit(pIndex); } } // namespace libOpenCOR diff --git a/src/sed/sedinstancetask_p.h b/src/sed/sedinstancetask_p.h index 5e547624b..f20c085cc 100644 --- a/src/sed/sedinstancetask_p.h +++ b/src/sed/sedinstancetask_p.h @@ -99,10 +99,10 @@ class SedInstanceTask::Impl: public Logger::Impl std::string computedConstantName(size_t pIndex) const; std::string computedConstantUnit(size_t pIndex) const; - size_t algebraicCount() const; - Doubles algebraic(size_t pIndex) const; - std::string algebraicName(size_t pIndex) const; - std::string algebraicUnit(size_t pIndex) const; + size_t algebraicVariableCount() const; + Doubles algebraicVariable(size_t pIndex) const; + std::string algebraicVariableName(size_t pIndex) const; + std::string algebraicVariableUnit(size_t pIndex) const; }; } // namespace libOpenCOR diff --git a/src/support/cellml/cellmlfile.cpp b/src/support/cellml/cellmlfile.cpp index 138967eb6..edb5978c8 100644 --- a/src/support/cellml/cellmlfile.cpp +++ b/src/support/cellml/cellmlfile.cpp @@ -50,7 +50,7 @@ CellmlFile::Impl::Impl(const FilePtr &pFile, const libcellml::ModelPtr &pModel, mAnalyser->analyseModel(mModel); - mAnalyserModel = mAnalyser->model(); + mAnalyserModel = mAnalyser->analyserModel(); if (mAnalyser->errorCount() != 0) { addIssues(mAnalyser, "Analyser"); diff --git a/src/support/cellml/cellmlfileruntime.cpp b/src/support/cellml/cellmlfileruntime.cpp index 5703766a9..dc0ecbfa1 100644 --- a/src/support/cellml/cellmlfileruntime.cpp +++ b/src/support/cellml/cellmlfileruntime.cpp @@ -101,23 +101,23 @@ intptr_t instantiateWebAssemblyModule(UnsignedChars pWasmModule, bool pDifferent const wasmInstanceFunctions = {}; if ($2) { - wasmInstanceFunctions.initialiseVariables = wasmInstance.exports.initialiseVariables; + wasmInstanceFunctions.initialiseArrays = wasmInstance.exports.initialiseArrays; wasmInstanceFunctions.computeComputedConstants = wasmInstance.exports.computeComputedConstants; wasmInstanceFunctions.computeRates = wasmInstance.exports.computeRates; wasmInstanceFunctions.computeVariables = wasmInstance.exports.computeVariables; - if ((wasmInstanceFunctions.initialiseVariables === undefined) + if ((wasmInstanceFunctions.initialiseArrays === undefined) || (wasmInstanceFunctions.computeComputedConstants === undefined) || (wasmInstanceFunctions.computeRates === undefined) || (wasmInstanceFunctions.computeVariables === undefined)) { throw new Error("The functions needed to compute the " + ($3 ? "ODE" : "DAE") + " model could not be retrieved."); } } else { - wasmInstanceFunctions.initialiseVariables = wasmInstance.exports.initialiseVariables; + wasmInstanceFunctions.initialiseArrays = wasmInstance.exports.initialiseArrays; wasmInstanceFunctions.computeComputedConstants = wasmInstance.exports.computeComputedConstants; wasmInstanceFunctions.computeVariables = wasmInstance.exports.computeVariables; - if ((wasmInstanceFunctions.initialiseVariables === undefined) + if ((wasmInstanceFunctions.initialiseArrays === undefined) || (wasmInstanceFunctions.computeComputedConstants === undefined) || (wasmInstanceFunctions.computeVariables === undefined)) { throw new Error("The functions needed to compute the " + ($4 ? "algebraic" : "NLA") + " model could not be retrieved."); @@ -194,20 +194,20 @@ CellmlFileRuntime::Impl::Impl(const CellmlFilePtr &pCellmlFile, const SolverNlaP generatorProfile->setImplementationStateCountString(""); generatorProfile->setImplementationConstantCountString(""); generatorProfile->setImplementationComputedConstantCountString(""); - generatorProfile->setImplementationAlgebraicCountString(""); - generatorProfile->setImplementationExternalCountString(""); + generatorProfile->setImplementationAlgebraicVariableCountString(""); + generatorProfile->setImplementationExternalVariableCountString(""); generatorProfile->setImplementationLibcellmlVersionString(""); generatorProfile->setImplementationVoiInfoString(""); generatorProfile->setImplementationStateInfoString(""); generatorProfile->setImplementationConstantInfoString(""); generatorProfile->setImplementationComputedConstantInfoString(""); - generatorProfile->setImplementationAlgebraicInfoString(""); - generatorProfile->setImplementationExternalInfoString(""); + generatorProfile->setImplementationAlgebraicVariableInfoString(""); + generatorProfile->setImplementationExternalVariableInfoString(""); generatorProfile->setImplementationCreateStatesArrayMethodString(""); generatorProfile->setImplementationCreateConstantsArrayMethodString(""); generatorProfile->setImplementationCreateComputedConstantsArrayMethodString(""); - generatorProfile->setImplementationCreateAlgebraicArrayMethodString(""); - generatorProfile->setImplementationCreateExternalsArrayMethodString(""); + generatorProfile->setImplementationCreateAlgebraicVariablesArrayMethodString(""); + generatorProfile->setImplementationCreateExternalVariablesArrayMethodString(""); generatorProfile->setImplementationDeleteArrayMethodString(""); static constexpr auto WITH_EXTERNAL_VARIABLES {false}; @@ -218,7 +218,7 @@ CellmlFileRuntime::Impl::Impl(const CellmlFilePtr &pCellmlFile, const SolverNlaP if (pNlaSolver != nullptr) { if (differentialModel) { generatorProfile->setFindRootMethodString(differentialModel, WITH_EXTERNAL_VARIABLES, - R"(void findRoot[INDEX](double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic) + R"(void findRoot[INDEX](double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraicVariables) { RootFindingInfo *rfi = (RootFindingInfo *) malloc(sizeof(RootFindingInfo)); double *u = (double *) malloc([SIZE] * sizeof(double)); @@ -228,7 +228,7 @@ CellmlFileRuntime::Impl::Impl(const CellmlFilePtr &pCellmlFile, const SolverNlaP rfi->rates = rates; rfi->constants = constants; rfi->computedConstants = computedConstants; - rfi->algebraic = algebraic; + rfi->algebraicVariables = algebraicVariables; [CODE] @@ -238,14 +238,14 @@ CellmlFileRuntime::Impl::Impl(const CellmlFilePtr &pCellmlFile, const SolverNlaP )"); } else { generatorProfile->setFindRootMethodString(differentialModel, WITH_EXTERNAL_VARIABLES, - R"(void findRoot[INDEX](double *constants, double *computedConstants, double *algebraic) + R"(void findRoot[INDEX](double *constants, double *computedConstants, double *algebraicVariables) { RootFindingInfo *rfi = (RootFindingInfo *) malloc(sizeof(RootFindingInfo)); double *u = (double *) malloc([SIZE] * sizeof(double)); rfi->constants = constants; rfi->computedConstants = computedConstants; - rfi->algebraic = algebraic; + rfi->algebraicVariables = algebraicVariables; [CODE] @@ -258,8 +258,8 @@ CellmlFileRuntime::Impl::Impl(const CellmlFilePtr &pCellmlFile, const SolverNlaP // Export our various methods. - generatorProfile->setImplementationInitialiseVariablesMethodString(differentialModel, - exportJavaScriptName("initialiseVariables").append(generatorProfile->implementationInitialiseVariablesMethodString(differentialModel))); + generatorProfile->setImplementationInitialiseArraysMethodString(differentialModel, + exportJavaScriptName("initialiseArrays").append(generatorProfile->implementationInitialiseArraysMethodString(differentialModel))); generatorProfile->setImplementationComputeComputedConstantsMethodString(differentialModel, exportJavaScriptName("computeComputedConstants").append(generatorProfile->implementationComputeComputedConstantsMethodString(differentialModel))); generatorProfile->setImplementationComputeRatesMethodString(WITH_EXTERNAL_VARIABLES, exportJavaScriptName("computeRates").append(generatorProfile->implementationComputeRatesMethodString(WITH_EXTERNAL_VARIABLES))); @@ -306,19 +306,17 @@ extern void nlaSolve(uintptr_t nlaSolverAddress, void (*objectiveFunction)(doubl #endif } - generator->setProfile(generatorProfile); - #ifdef __EMSCRIPTEN__ // Export our various objective functions. - auto implementationCode {generator->implementationCode(pCellmlFile->analyserModel())}; + auto implementationCode {generator->implementationCode(pCellmlFile->analyserModel(), generatorProfile)}; if (pNlaSolver != nullptr) { std::vector handledNlaSystemIndices; - for (const auto &equation : pCellmlFile->analyserModel()->equations()) { - if (equation->type() == libcellml::AnalyserEquation::Type::NLA) { - auto nlaSystemIndex {equation->nlaSystemIndex()}; + for (const auto &analyserEquation : pCellmlFile->analyserModel()->analyserEquations()) { + if (analyserEquation->type() == libcellml::AnalyserEquation::Type::NLA) { + auto nlaSystemIndex {analyserEquation->nlaSystemIndex()}; if (std::find(handledNlaSystemIndices.begin(), handledNlaSystemIndices.end(), nlaSystemIndex) == handledNlaSystemIndices.end()) { auto objectiveFunctionName {std::string("objectiveFunction").append(std::to_string(nlaSystemIndex))}; @@ -371,9 +369,9 @@ extern void nlaSolve(uintptr_t nlaSolverAddress, void (*objectiveFunction)(doubl mWasmInstanceFunctionsId = wasmInstanceFunctionsId; #else # ifdef CODE_COVERAGE_ENABLED - mCompiler->compile(generator->implementationCode(pCellmlFile->analyserModel())); + mCompiler->compile(generator->implementationCode(pCellmlFile->analyserModel(), generatorProfile)); # else - if (!mCompiler->compile(generator->implementationCode(pCellmlFile->analyserModel()))) { + if (!mCompiler->compile(generator->implementationCode(pCellmlFile->analyserModel(), generatorProfile))) { // The compilation failed, so add the issues it generated. addIssues(mCompiler, "Compiler"); @@ -403,13 +401,13 @@ extern void nlaSolve(uintptr_t nlaSolverAddress, void (*objectiveFunction)(doubl // Retrieve our algebraic/differential functions and make sure that we managed to retrieve them. if (differentialModel) { - mInitialiseVariablesForDifferentialModel = reinterpret_cast(mCompiler->function("initialiseVariables")); + mInitialiseArraysForDifferentialModel = reinterpret_cast(mCompiler->function("initialiseArrays")); mComputeComputedConstantsForDifferentialModel = reinterpret_cast(mCompiler->function("computeComputedConstants")); mComputeRates = reinterpret_cast(mCompiler->function("computeRates")); mComputeVariablesForDifferentialModel = reinterpret_cast(mCompiler->function("computeVariables")); # ifndef CODE_COVERAGE_ENABLED - if ((mInitialiseVariablesForDifferentialModel == nullptr) + if ((mInitialiseArraysForDifferentialModel == nullptr) || (mComputeComputedConstantsForDifferentialModel == nullptr) || (mComputeRates == nullptr) || (mComputeVariablesForDifferentialModel == nullptr)) { @@ -417,12 +415,12 @@ extern void nlaSolve(uintptr_t nlaSolverAddress, void (*objectiveFunction)(doubl } # endif } else { - mInitialiseVariablesForAlgebraicModel = reinterpret_cast(mCompiler->function("initialiseVariables")); + mInitialiseArraysForAlgebraicModel = reinterpret_cast(mCompiler->function("initialiseArrays")); mComputeComputedConstantsForAlgebraicModel = reinterpret_cast(mCompiler->function("computeComputedConstants")); mComputeVariablesForAlgebraicModel = reinterpret_cast(mCompiler->function("computeVariables")); # ifndef CODE_COVERAGE_ENABLED - if ((mInitialiseVariablesForAlgebraicModel == nullptr) + if ((mInitialiseArraysForAlgebraicModel == nullptr) || (mComputeComputedConstantsForAlgebraicModel == nullptr) || (mComputeVariablesForAlgebraicModel == nullptr)) { addError(std::string("The functions needed to compute the ").append((cellmlFileType == libcellml::AnalyserModel::Type::ALGEBRAIC) ? "algebraic" : "NLA").append(" model could not be retrieved.")); @@ -434,22 +432,22 @@ extern void nlaSolve(uintptr_t nlaSolverAddress, void (*objectiveFunction)(doubl } #ifdef __EMSCRIPTEN__ -EM_JS(void, jsInitialiseVariablesForAlgebraicModel, (intptr_t pWasmInstanceFunctionsId, double *pConstants, double *pComputedConstants, double *pAlgebraic), { - Module.wasmInstanceFunctions.get(pWasmInstanceFunctionsId).initialiseVariables(pConstants, pComputedConstants, pAlgebraic); +EM_JS(void, jsInitialiseArraysForAlgebraicModel, (intptr_t pWasmInstanceFunctionsId, double *pConstants, double *pComputedConstants, double *pAlgebraic), { + Module.wasmInstanceFunctions.get(pWasmInstanceFunctionsId).initialiseArrays(pConstants, pComputedConstants, pAlgebraic); }); -void CellmlFileRuntime::Impl::initialiseVariablesForAlgebraicModel(double *pConstants, double *pComputedConstants, double *pAlgebraic) const +void CellmlFileRuntime::Impl::initialiseArraysForAlgebraicModel(double *pConstants, double *pComputedConstants, double *pAlgebraic) const { - jsInitialiseVariablesForAlgebraicModel(mWasmInstanceFunctionsId, pConstants, pComputedConstants, pAlgebraic); + jsInitialiseArraysForAlgebraicModel(mWasmInstanceFunctionsId, pConstants, pComputedConstants, pAlgebraic); } -EM_JS(void, jsInitialiseVariablesForDifferentialModel, (intptr_t pWasmInstanceFunctionsId, double *pStates, double *pRates, double *pConstants, double *pComputedConstants, double *pAlgebraic), { - Module.wasmInstanceFunctions.get(pWasmInstanceFunctionsId).initialiseVariables(pStates, pRates, pConstants, pComputedConstants, pAlgebraic); +EM_JS(void, jsInitialiseArraysForDifferentialModel, (intptr_t pWasmInstanceFunctionsId, double *pStates, double *pRates, double *pConstants, double *pComputedConstants, double *pAlgebraic), { + Module.wasmInstanceFunctions.get(pWasmInstanceFunctionsId).initialiseArrays(pStates, pRates, pConstants, pComputedConstants, pAlgebraic); }); -void CellmlFileRuntime::Impl::initialiseVariablesForDifferentialModel(double *pStates, double *pRates, double *pConstants, double *pComputedConstants, double *pAlgebraic) const +void CellmlFileRuntime::Impl::initialiseArraysForDifferentialModel(double *pStates, double *pRates, double *pConstants, double *pComputedConstants, double *pAlgebraic) const { - jsInitialiseVariablesForDifferentialModel(mWasmInstanceFunctionsId, pStates, pRates, pConstants, pComputedConstants, pAlgebraic); + jsInitialiseArraysForDifferentialModel(mWasmInstanceFunctionsId, pStates, pRates, pConstants, pComputedConstants, pAlgebraic); } EM_JS(void, jsComputeComputedConstantsForAlgebraicModel, (intptr_t pWasmInstanceFunctionsId, double *pConstants, double *pComputedConstants, double *pAlgebraic), { @@ -497,14 +495,14 @@ void CellmlFileRuntime::Impl::computeVariablesForDifferentialModel(double pVoi, jsComputeVariablesForDifferentialModel(mWasmInstanceFunctionsId, pVoi, pStates, pRates, pConstants, pComputedConstants, pAlgebraic); } #else -CellmlFileRuntime::InitialiseVariablesForAlgebraicModel CellmlFileRuntime::Impl::initialiseVariablesForAlgebraicModel() const +CellmlFileRuntime::InitialiseArraysForAlgebraicModel CellmlFileRuntime::Impl::initialiseArraysForAlgebraicModel() const { - return mInitialiseVariablesForAlgebraicModel; + return mInitialiseArraysForAlgebraicModel; } -CellmlFileRuntime::InitialiseVariablesForDifferentialModel CellmlFileRuntime::Impl::initialiseVariablesForDifferentialModel() const +CellmlFileRuntime::InitialiseArraysForDifferentialModel CellmlFileRuntime::Impl::initialiseArraysForDifferentialModel() const { - return mInitialiseVariablesForDifferentialModel; + return mInitialiseArraysForDifferentialModel; } CellmlFileRuntime::ComputeComputedConstantsForAlgebraicModel CellmlFileRuntime::Impl::computeComputedConstantsForAlgebraicModel() const @@ -559,14 +557,14 @@ CellmlFileRuntimePtr CellmlFileRuntime::create(const CellmlFilePtr &pCellmlFile, } #ifdef __EMSCRIPTEN__ -void CellmlFileRuntime::initialiseVariablesForAlgebraicModel(double *pConstants, double *pComputedConstants, double *pAlgebraic) const +void CellmlFileRuntime::initialiseArraysForAlgebraicModel(double *pConstants, double *pComputedConstants, double *pAlgebraic) const { - pimpl()->initialiseVariablesForAlgebraicModel(pConstants, pComputedConstants, pAlgebraic); + pimpl()->initialiseArraysForAlgebraicModel(pConstants, pComputedConstants, pAlgebraic); } -void CellmlFileRuntime::initialiseVariablesForDifferentialModel(double *pStates, double *pRates, double *pConstants, double *pComputedConstants, double *pAlgebraic) const +void CellmlFileRuntime::initialiseArraysForDifferentialModel(double *pStates, double *pRates, double *pConstants, double *pComputedConstants, double *pAlgebraic) const { - pimpl()->initialiseVariablesForDifferentialModel(pStates, pRates, pConstants, pComputedConstants, pAlgebraic); + pimpl()->initialiseArraysForDifferentialModel(pStates, pRates, pConstants, pComputedConstants, pAlgebraic); } void CellmlFileRuntime::computeComputedConstantsForAlgebraicModel(double *pConstants, double *pComputedConstants, double *pAlgebraic) const @@ -594,14 +592,14 @@ void CellmlFileRuntime::computeVariablesForDifferentialModel(double pVoi, double pimpl()->computeVariablesForDifferentialModel(pVoi, pStates, pRates, pConstants, pComputedConstants, pAlgebraic); } #else -CellmlFileRuntime::InitialiseVariablesForAlgebraicModel CellmlFileRuntime::initialiseVariablesForAlgebraicModel() const +CellmlFileRuntime::InitialiseArraysForAlgebraicModel CellmlFileRuntime::initialiseArraysForAlgebraicModel() const { - return pimpl()->initialiseVariablesForAlgebraicModel(); + return pimpl()->initialiseArraysForAlgebraicModel(); } -CellmlFileRuntime::InitialiseVariablesForDifferentialModel CellmlFileRuntime::initialiseVariablesForDifferentialModel() const +CellmlFileRuntime::InitialiseArraysForDifferentialModel CellmlFileRuntime::initialiseArraysForDifferentialModel() const { - return pimpl()->initialiseVariablesForDifferentialModel(); + return pimpl()->initialiseArraysForDifferentialModel(); } CellmlFileRuntime::ComputeComputedConstantsForAlgebraicModel CellmlFileRuntime::computeComputedConstantsForAlgebraicModel() const diff --git a/src/support/cellml/cellmlfileruntime.h b/src/support/cellml/cellmlfileruntime.h index 5479deac1..ef020c73b 100644 --- a/src/support/cellml/cellmlfileruntime.h +++ b/src/support/cellml/cellmlfileruntime.h @@ -32,8 +32,8 @@ class CellmlFileRuntime: public Logger { public: #ifndef __EMSCRIPTEN__ - using InitialiseVariablesForAlgebraicModel = void (*)(double *pConstants, double *pComputedConstants, double *pAlgebraic); - using InitialiseVariablesForDifferentialModel = void (*)(double *pStates, double *pRates, double *pConstants, double *pComputedConstants, double *pAlgebraic); + using InitialiseArraysForAlgebraicModel = void (*)(double *pConstants, double *pComputedConstants, double *pAlgebraic); + using InitialiseArraysForDifferentialModel = void (*)(double *pStates, double *pRates, double *pConstants, double *pComputedConstants, double *pAlgebraic); using ComputeComputedConstantsForAlgebraicModel = void (*)(double *pConstants, double *pComputedConstants, double *pAlgebraic); using ComputeComputedConstantsForDifferentialModel = void (*)(double *pStates, double *pRates, double *pConstants, double *pComputedConstants, double *pAlgebraic); using ComputeRates = void (*)(double pVoi, double *pStates, double *pRates, double *pConstants, double *pComputedConstants, double *pAlgebraic); @@ -53,16 +53,16 @@ class CellmlFileRuntime: public Logger static CellmlFileRuntimePtr create(const CellmlFilePtr &pCellmlFile, const SolverNlaPtr &pNlaSolver); #ifdef __EMSCRIPTEN__ - void initialiseVariablesForAlgebraicModel(double *pConstants, double *pComputedConstants, double *pAlgebraic) const; - void initialiseVariablesForDifferentialModel(double *pStates, double *pRates, double *pConstants, double *pComputedConstants, double *pAlgebraic) const; + void initialiseArraysForAlgebraicModel(double *pConstants, double *pComputedConstants, double *pAlgebraic) const; + void initialiseArraysForDifferentialModel(double *pStates, double *pRates, double *pConstants, double *pComputedConstants, double *pAlgebraic) const; void computeComputedConstantsForAlgebraicModel(double *pConstants, double *pComputedConstants, double *pAlgebraic) const; void computeComputedConstantsForDifferentialModel(double *pStates, double *pRates, double *pConstants, double *pComputedConstants, double *pAlgebraic) const; void computeRates(double pVoi, double *pStates, double *pRates, double *pConstants, double *pComputedConstants, double *pAlgebraic) const; void computeVariablesForAlgebraicModel(double *pConstants, double *pComputedConstants, double *pAlgebraic) const; void computeVariablesForDifferentialModel(double pVoi, double *pStates, double *pRates, double *pConstants, double *pComputedConstants, double *pAlgebraic) const; #else - InitialiseVariablesForAlgebraicModel initialiseVariablesForAlgebraicModel() const; - InitialiseVariablesForDifferentialModel initialiseVariablesForDifferentialModel() const; + InitialiseArraysForAlgebraicModel initialiseArraysForAlgebraicModel() const; + InitialiseArraysForDifferentialModel initialiseArraysForDifferentialModel() const; ComputeComputedConstantsForAlgebraicModel computeComputedConstantsForAlgebraicModel() const; ComputeComputedConstantsForDifferentialModel computeComputedConstantsForDifferentialModel() const; ComputeRates computeRates() const; diff --git a/src/support/cellml/cellmlfileruntime_p.h b/src/support/cellml/cellmlfileruntime_p.h index a19939b06..e417924b1 100644 --- a/src/support/cellml/cellmlfileruntime_p.h +++ b/src/support/cellml/cellmlfileruntime_p.h @@ -34,8 +34,8 @@ class CellmlFileRuntime::Impl: public Logger::Impl #endif #ifndef __EMSCRIPTEN__ - InitialiseVariablesForAlgebraicModel mInitialiseVariablesForAlgebraicModel {nullptr}; - InitialiseVariablesForDifferentialModel mInitialiseVariablesForDifferentialModel {nullptr}; + InitialiseArraysForAlgebraicModel mInitialiseArraysForAlgebraicModel {nullptr}; + InitialiseArraysForDifferentialModel mInitialiseArraysForDifferentialModel {nullptr}; ComputeComputedConstantsForAlgebraicModel mComputeComputedConstantsForAlgebraicModel {nullptr}; ComputeComputedConstantsForDifferentialModel mComputeComputedConstantsForDifferentialModel {nullptr}; ComputeRates mComputeRates {nullptr}; @@ -46,16 +46,16 @@ class CellmlFileRuntime::Impl: public Logger::Impl explicit Impl(const CellmlFilePtr &pCellmlFile, const SolverNlaPtr &pNlaSolver); #ifdef __EMSCRIPTEN__ - void initialiseVariablesForAlgebraicModel(double *pConstants, double *pComputedConstants, double *pAlgebraic) const; - void initialiseVariablesForDifferentialModel(double *pStates, double *pRates, double *pConstants, double *pComputedConstants, double *pAlgebraic) const; + void initialiseArraysForAlgebraicModel(double *pConstants, double *pComputedConstants, double *pAlgebraic) const; + void initialiseArraysForDifferentialModel(double *pStates, double *pRates, double *pConstants, double *pComputedConstants, double *pAlgebraic) const; void computeComputedConstantsForAlgebraicModel(double *pConstants, double *pComputedConstants, double *pAlgebraic) const; void computeComputedConstantsForDifferentialModel(double *pStates, double *pRates, double *pConstants, double *pComputedConstants, double *pAlgebraic) const; void computeRates(double pVoi, double *pStates, double *pRates, double *pConstants, double *pComputedConstants, double *pAlgebraic) const; void computeVariablesForAlgebraicModel(double *pConstants, double *pComputedConstants, double *pAlgebraic) const; void computeVariablesForDifferentialModel(double pVoi, double *pStates, double *pRates, double *pConstants, double *pComputedConstants, double *pAlgebraic) const; #else - CellmlFileRuntime::InitialiseVariablesForAlgebraicModel initialiseVariablesForAlgebraicModel() const; - CellmlFileRuntime::InitialiseVariablesForDifferentialModel initialiseVariablesForDifferentialModel() const; + CellmlFileRuntime::InitialiseArraysForAlgebraicModel initialiseArraysForAlgebraicModel() const; + CellmlFileRuntime::InitialiseArraysForDifferentialModel initialiseArraysForDifferentialModel() const; CellmlFileRuntime::ComputeComputedConstantsForAlgebraicModel computeComputedConstantsForAlgebraicModel() const; CellmlFileRuntime::ComputeComputedConstantsForDifferentialModel computeComputedConstantsForDifferentialModel() const; CellmlFileRuntime::ComputeRates computeRates() const; diff --git a/tests/api/sed/coveragetests.cpp b/tests/api/sed/coveragetests.cpp index 935710e34..ecc00078f 100644 --- a/tests/api/sed/coveragetests.cpp +++ b/tests/api/sed/coveragetests.cpp @@ -469,13 +469,13 @@ TEST(CoverageSedTest, sedInstanceAndSedInstanceTaskDifferentialModel) EXPECT_EQ(instanceTask->computedConstantUnit(0), "millivolt"); EXPECT_EQ(instanceTask->computedConstantUnit(3), ""); - EXPECT_EQ(instanceTask->algebraicCount(), 10); - EXPECT_EQ(instanceTask->algebraic(0), NoDoubles); - EXPECT_EQ(instanceTask->algebraic(10), NoDoubles); - EXPECT_EQ(instanceTask->algebraicName(0), "membrane/i_Stim"); - EXPECT_EQ(instanceTask->algebraicName(10), ""); - EXPECT_EQ(instanceTask->algebraicUnit(0), "microA_per_cm2"); - EXPECT_EQ(instanceTask->algebraicUnit(10), ""); + EXPECT_EQ(instanceTask->algebraicVariableCount(), 10); + EXPECT_EQ(instanceTask->algebraicVariable(0), NoDoubles); + EXPECT_EQ(instanceTask->algebraicVariable(10), NoDoubles); + EXPECT_EQ(instanceTask->algebraicVariableName(0), "membrane/i_Stim"); + EXPECT_EQ(instanceTask->algebraicVariableName(10), ""); + EXPECT_EQ(instanceTask->algebraicVariableUnit(0), "microA_per_cm2"); + EXPECT_EQ(instanceTask->algebraicVariableUnit(10), ""); instance->run(); @@ -566,7 +566,7 @@ TEST(CoverageSedTest, math) EXPECT_EQ(instanceTask->constantCount(), 0); EXPECT_EQ(instanceTask->computedConstantCount(), 37); - EXPECT_EQ(instanceTask->algebraicCount(), 0); + EXPECT_EQ(instanceTask->algebraicVariableCount(), 0); instance->run(); diff --git a/tests/api/sed/instancetests.cpp b/tests/api/sed/instancetests.cpp index 55d2c02ca..721d11573 100644 --- a/tests/api/sed/instancetests.cpp +++ b/tests/api/sed/instancetests.cpp @@ -48,7 +48,7 @@ TEST(InstanceSedTest, overconstrainedCellmlFile) { static const libOpenCOR::ExpectedIssues EXPECTED_ISSUES {{ {libOpenCOR::Issue::Type::ERROR, "Task | Model: the CellML file is overconstrained."}, - {libOpenCOR::Issue::Type::ERROR, "Task | Model | CellML | Analyser: variable 'x' in component 'my_component' is computed more than once."}, + {libOpenCOR::Issue::Type::ERROR, "Task | Model | CellML | Analyser: variable 'x' in component 'my_component' is overconstrained."}, }}; auto file {libOpenCOR::File::create(libOpenCOR::resourcePath("api/sed/overconstrained.cellml"))}; @@ -76,7 +76,7 @@ TEST(InstanceSedTest, unsuitablyConstrainedCellmlFile) { static const libOpenCOR::ExpectedIssues EXPECTED_ISSUES {{ {libOpenCOR::Issue::Type::ERROR, "Task | Model: the CellML file is unsuitably constrained."}, - {libOpenCOR::Issue::Type::ERROR, "Task | Model | CellML | Analyser: variable 'y' in component 'my_component' is computed more than once."}, + {libOpenCOR::Issue::Type::ERROR, "Task | Model | CellML | Analyser: variable 'y' in component 'my_component' is overconstrained."}, {libOpenCOR::Issue::Type::ERROR, "Task | Model | CellML | Analyser: the type of variable 'x' in component 'my_component' is unknown."}, }}; diff --git a/tests/api/solver/coveragetests.cpp b/tests/api/solver/coveragetests.cpp index 6e999d29e..01bd034f1 100644 --- a/tests/api/solver/coveragetests.cpp +++ b/tests/api/solver/coveragetests.cpp @@ -75,9 +75,9 @@ TEST(CoverageSolverTest, algebraicChanges) EXPECT_EQ(instanceTask->rateCount(), 0); EXPECT_EQ(instanceTask->constantCount(), 1); EXPECT_EQ(instanceTask->computedConstantCount(), 1); - EXPECT_EQ(instanceTask->algebraicCount(), 3); + EXPECT_EQ(instanceTask->algebraicVariableCount(), 3); - EXPECT_NEAR(instanceTask->algebraic(0)[0], -28.14815, ABS_TOL); - EXPECT_NEAR(instanceTask->algebraic(1)[0], -13.18519, ABS_TOL); - EXPECT_NEAR(instanceTask->algebraic(2)[0], 33.33333, ABS_TOL); + EXPECT_NEAR(instanceTask->algebraicVariable(0)[0], -28.14815, ABS_TOL); + EXPECT_NEAR(instanceTask->algebraicVariable(1)[0], -13.18519, ABS_TOL); + EXPECT_NEAR(instanceTask->algebraicVariable(2)[0], 33.33333, ABS_TOL); } diff --git a/tests/api/solver/kinsoltests.cpp b/tests/api/solver/kinsoltests.cpp index 64055233a..a56010b3c 100644 --- a/tests/api/solver/kinsoltests.cpp +++ b/tests/api/solver/kinsoltests.cpp @@ -122,10 +122,10 @@ void expectNla1Solution(const libOpenCOR::SedInstanceTaskPtr &pInstanceTask) EXPECT_EQ(pInstanceTask->rateCount(), 0); EXPECT_EQ(pInstanceTask->constantCount(), 0); EXPECT_EQ(pInstanceTask->computedConstantCount(), 0); - EXPECT_EQ(pInstanceTask->algebraicCount(), 2); + EXPECT_EQ(pInstanceTask->algebraicVariableCount(), 2); - EXPECT_NEAR(pInstanceTask->algebraic(0)[0], 3.0, ABS_TOL); - EXPECT_NEAR(pInstanceTask->algebraic(1)[0], 7.0, ABS_TOL); + EXPECT_NEAR(pInstanceTask->algebraicVariable(0)[0], 3.0, ABS_TOL); + EXPECT_NEAR(pInstanceTask->algebraicVariable(1)[0], 7.0, ABS_TOL); } void expectNla2Solution(const libOpenCOR::SedInstanceTaskPtr &pInstanceTask) @@ -134,11 +134,11 @@ void expectNla2Solution(const libOpenCOR::SedInstanceTaskPtr &pInstanceTask) EXPECT_EQ(pInstanceTask->rateCount(), 0); EXPECT_EQ(pInstanceTask->constantCount(), 0); EXPECT_EQ(pInstanceTask->computedConstantCount(), 0); - EXPECT_EQ(pInstanceTask->algebraicCount(), 3); + EXPECT_EQ(pInstanceTask->algebraicVariableCount(), 3); - EXPECT_NEAR(pInstanceTask->algebraic(0)[0], 7.0, ABS_TOL); - EXPECT_NEAR(pInstanceTask->algebraic(1)[0], -5.0, ABS_TOL); - EXPECT_NEAR(pInstanceTask->algebraic(2)[0], 3.0, ABS_TOL); + EXPECT_NEAR(pInstanceTask->algebraicVariable(0)[0], 7.0, ABS_TOL); + EXPECT_NEAR(pInstanceTask->algebraicVariable(1)[0], -5.0, ABS_TOL); + EXPECT_NEAR(pInstanceTask->algebraicVariable(2)[0], 3.0, ABS_TOL); } } // namespace diff --git a/tests/bindings/javascript/res/res/libopencor.js b/tests/bindings/javascript/res/res/libopencor.js index 64dea7953..6d5be24b7 100644 --- a/tests/bindings/javascript/res/res/libopencor.js +++ b/tests/bindings/javascript/res/res/libopencor.js @@ -108,8 +108,8 @@ function populateAxis(axisId) { addAxisElement(axis, instanceTask.computedConstantName(i)); } - for (let i = 0; i < instanceTask.algebraicCount; ++i) { - addAxisElement(axis, instanceTask.algebraicName(i)); + for (let i = 0; i < instanceTask.algebraicVariableCount; ++i) { + addAxisElement(axis, instanceTask.algebraicVariableName(i)); } } diff --git a/tests/bindings/javascript/sed.coverage.test.js b/tests/bindings/javascript/sed.coverage.test.js index c85bd9c8f..8711b6395 100644 --- a/tests/bindings/javascript/sed.coverage.test.js +++ b/tests/bindings/javascript/sed.coverage.test.js @@ -446,15 +446,15 @@ test.describe('Sed coverage tests', () => { assert.strictEqual(instanceTask.computedConstantUnit(0), 'millivolt'); assert.strictEqual(instanceTask.computedConstantUnit(3), ''); - assert.strictEqual(instanceTask.algebraicCount, 10); - assert.strictEqual(instanceTask.algebraic(0).size(), 0); - assert.deepStrictEqual(instanceTask.algebraicAsArray(0), []); - assert.strictEqual(instanceTask.algebraic(10).size(), 0); - assert.deepStrictEqual(instanceTask.algebraicAsArray(10), []); - assert.strictEqual(instanceTask.algebraicName(0), 'membrane/i_Stim'); - assert.strictEqual(instanceTask.algebraicName(10), ''); - assert.strictEqual(instanceTask.algebraicUnit(0), 'microA_per_cm2'); - assert.strictEqual(instanceTask.algebraicUnit(10), ''); + assert.strictEqual(instanceTask.algebraicVariableCount, 10); + assert.strictEqual(instanceTask.algebraicVariable(0).size(), 0); + assert.deepStrictEqual(instanceTask.algebraicVariableAsArray(0), []); + assert.strictEqual(instanceTask.algebraicVariable(10).size(), 0); + assert.deepStrictEqual(instanceTask.algebraicVariableAsArray(10), []); + assert.strictEqual(instanceTask.algebraicVariableName(0), 'membrane/i_Stim'); + assert.strictEqual(instanceTask.algebraicVariableName(10), ''); + assert.strictEqual(instanceTask.algebraicVariableUnit(0), 'microA_per_cm2'); + assert.strictEqual(instanceTask.algebraicVariableUnit(10), ''); instance.run(); @@ -569,7 +569,7 @@ test.describe('Sed coverage tests', () => { assert.strictEqual(instanceTask.constantCount, 0); assert.strictEqual(instanceTask.computedConstantCount, 37); - assert.strictEqual(instanceTask.algebraicCount, 0); + assert.strictEqual(instanceTask.algebraicVariableCount, 0); instance.run(); diff --git a/tests/bindings/javascript/sed.instance.test.js b/tests/bindings/javascript/sed.instance.test.js index 150e10ed9..28288171d 100644 --- a/tests/bindings/javascript/sed.instance.test.js +++ b/tests/bindings/javascript/sed.instance.test.js @@ -106,7 +106,7 @@ test.describe('Sed instance tests', () => { [loc.Issue.Type.ERROR, 'Task | Model: the CellML file is overconstrained.'], [ loc.Issue.Type.ERROR, - "Task | Model | CellML | Analyser: variable 'x' in component 'my_component' is computed more than once." + "Task | Model | CellML | Analyser: variable 'x' in component 'my_component' is overconstrained." ] ]); }); @@ -140,7 +140,7 @@ test.describe('Sed instance tests', () => { [loc.Issue.Type.ERROR, 'Task | Model: the CellML file is unsuitably constrained.'], [ loc.Issue.Type.ERROR, - "Task | Model | CellML | Analyser: variable 'y' in component 'my_component' is computed more than once." + "Task | Model | CellML | Analyser: variable 'y' in component 'my_component' is overconstrained." ], [ loc.Issue.Type.ERROR, diff --git a/tests/bindings/javascript/solver.coverage.test.js b/tests/bindings/javascript/solver.coverage.test.js index fb33d2087..e170d2f03 100644 --- a/tests/bindings/javascript/solver.coverage.test.js +++ b/tests/bindings/javascript/solver.coverage.test.js @@ -108,10 +108,10 @@ test.describe('Solver coverage tests', () => { assert.strictEqual(instanceTask.rateCount, 0); assert.strictEqual(instanceTask.constantCount, 1); assert.strictEqual(instanceTask.computedConstantCount, 1); - assert.strictEqual(instanceTask.algebraicCount, 3); + assert.strictEqual(instanceTask.algebraicVariableCount, 3); - assertValue(instanceTask.algebraic(0).get(0), -28.14815, 5); - assertValue(instanceTask.algebraic(1).get(0), -13.18519, 5); - assertValue(instanceTask.algebraic(2).get(0), 33.33333, 5); + assertValue(instanceTask.algebraicVariable(0).get(0), -28.14815, 5); + assertValue(instanceTask.algebraicVariable(1).get(0), -13.18519, 5); + assertValue(instanceTask.algebraicVariable(2).get(0), 33.33333, 5); }); }); diff --git a/tests/bindings/javascript/solver.kinsol.test.js b/tests/bindings/javascript/solver.kinsol.test.js index 5214f8968..3a564823a 100644 --- a/tests/bindings/javascript/solver.kinsol.test.js +++ b/tests/bindings/javascript/solver.kinsol.test.js @@ -155,10 +155,10 @@ test.describe('Solver KINSOL tests', () => { assert.strictEqual(instanceTask.rateCount, 0); assert.strictEqual(instanceTask.constantCount, 0); assert.strictEqual(instanceTask.computedConstantCount, 0); - assert.strictEqual(instanceTask.algebraicCount, 2); + assert.strictEqual(instanceTask.algebraicVariableCount, 2); - assertValue(instanceTask.algebraic(0).get(0), 3.0, 5); - assertValue(instanceTask.algebraic(1).get(0), 7.0, 5); + assertValue(instanceTask.algebraicVariable(0).get(0), 3.0, 5); + assertValue(instanceTask.algebraicVariable(1).get(0), 7.0, 5); } function assertNla2Solution(instanceTask) { @@ -166,11 +166,11 @@ test.describe('Solver KINSOL tests', () => { assert.strictEqual(instanceTask.rateCount, 0); assert.strictEqual(instanceTask.constantCount, 0); assert.strictEqual(instanceTask.computedConstantCount, 0); - assert.strictEqual(instanceTask.algebraicCount, 3); + assert.strictEqual(instanceTask.algebraicVariableCount, 3); - assertValue(instanceTask.algebraic(0).get(0), 7.0, 5); - assertValue(instanceTask.algebraic(1).get(0), -5.0, 5); - assertValue(instanceTask.algebraic(2).get(0), 3.0, 5); + assertValue(instanceTask.algebraicVariable(0).get(0), 7.0, 5); + assertValue(instanceTask.algebraicVariable(1).get(0), -5.0, 5); + assertValue(instanceTask.algebraicVariable(2).get(0), 3.0, 5); } test('Solve', () => { diff --git a/tests/bindings/javascript/utils.in.js b/tests/bindings/javascript/utils.in.js index d73d3b992..f76711d32 100644 --- a/tests/bindings/javascript/utils.in.js +++ b/tests/bindings/javascript/utils.in.js @@ -157,8 +157,8 @@ export function assertValues( ); } - for (let i = 0; i < instanceTask.algebraicCount; ++i) { - assertValue(instanceTask.algebraicAsArray(i)[index], algebraicValues[i], algebraicPrecisions[i]); + for (let i = 0; i < instanceTask.algebraicVariableCount; ++i) { + assertValue(instanceTask.algebraicVariableAsArray(i)[index], algebraicValues[i], algebraicPrecisions[i]); } } diff --git a/tests/bindings/python/test_sed_coverage.py b/tests/bindings/python/test_sed_coverage.py index 458e35890..60b70a183 100644 --- a/tests/bindings/python/test_sed_coverage.py +++ b/tests/bindings/python/test_sed_coverage.py @@ -421,13 +421,13 @@ def test_sed_instance_and_sed_instance_task_differential_model(): assert instance_task.computed_constant_unit(0) == "millivolt" assert instance_task.computed_constant_unit(3) == "" - assert instance_task.algebraic_count == 10 - assert instance_task.algebraic(0) == [] - assert instance_task.algebraic(10) == [] - assert instance_task.algebraic_name(0) == "membrane/i_Stim" - assert instance_task.algebraic_name(10) == "" - assert instance_task.algebraic_unit(0) == "microA_per_cm2" - assert instance_task.algebraic_unit(10) == "" + assert instance_task.algebraic_variable_count == 10 + assert instance_task.algebraic_variable(0) == [] + assert instance_task.algebraic_variable(10) == [] + assert instance_task.algebraic_variable_name(0) == "membrane/i_Stim" + assert instance_task.algebraic_variable_name(10) == "" + assert instance_task.algebraic_variable_unit(0) == "microA_per_cm2" + assert instance_task.algebraic_variable_unit(10) == "" instance.run() @@ -593,7 +593,7 @@ def test_math(): assert instance_task.constant_count == 0 assert instance_task.computed_constant_count == 37 - assert instance_task.algebraic_count == 0 + assert instance_task.algebraic_variable_count == 0 instance.run() diff --git a/tests/bindings/python/test_sed_instance.py b/tests/bindings/python/test_sed_instance.py index ba35e93cc..2b2677639 100644 --- a/tests/bindings/python/test_sed_instance.py +++ b/tests/bindings/python/test_sed_instance.py @@ -60,7 +60,7 @@ def test_overconstrained_cellml_file(): ], [ loc.Issue.Type.Error, - "Task | Model | CellML | Analyser: variable 'x' in component 'my_component' is computed more than once.", + "Task | Model | CellML | Analyser: variable 'x' in component 'my_component' is overconstrained.", ], ] @@ -98,7 +98,7 @@ def test_unsuitable_constrained_cellml_file(): ], [ loc.Issue.Type.Error, - "Task | Model | CellML | Analyser: variable 'y' in component 'my_component' is computed more than once.", + "Task | Model | CellML | Analyser: variable 'y' in component 'my_component' is overconstrained.", ], [ loc.Issue.Type.Error, diff --git a/tests/bindings/python/test_solver_coverage.py b/tests/bindings/python/test_solver_coverage.py index 50c4ee898..c8af9e36f 100644 --- a/tests/bindings/python/test_solver_coverage.py +++ b/tests/bindings/python/test_solver_coverage.py @@ -84,8 +84,14 @@ def test_algebraic_changes(): assert instance_task.rate_count == 0 assert instance_task.constant_count == 1 assert instance_task.computed_constant_count == 1 - assert instance_task.algebraic_count == 3 + assert instance_task.algebraic_variable_count == 3 - assert instance_task.algebraic(0)[0] == pytest.approx(-28.14815, abs=ABS_TOL) - assert instance_task.algebraic(1)[0] == pytest.approx(-13.18519, abs=ABS_TOL) - assert instance_task.algebraic(2)[0] == pytest.approx(33.33333, abs=ABS_TOL) + assert instance_task.algebraic_variable(0)[0] == pytest.approx( + -28.14815, abs=ABS_TOL + ) + assert instance_task.algebraic_variable(1)[0] == pytest.approx( + -13.18519, abs=ABS_TOL + ) + assert instance_task.algebraic_variable(2)[0] == pytest.approx( + 33.33333, abs=ABS_TOL + ) diff --git a/tests/bindings/python/test_solver_kinsol.py b/tests/bindings/python/test_solver_kinsol.py index 557de6c9f..b00847bf4 100644 --- a/tests/bindings/python/test_solver_kinsol.py +++ b/tests/bindings/python/test_solver_kinsol.py @@ -132,10 +132,10 @@ def expect_nla1_solution(instance_task): assert instance_task.rate_count == 0 assert instance_task.constant_count == 0 assert instance_task.computed_constant_count == 0 - assert instance_task.algebraic_count == 2 + assert instance_task.algebraic_variable_count == 2 - assert instance_task.algebraic(0)[0] == pytest.approx(3.0, abs=ABS_TOL) - assert instance_task.algebraic(1)[0] == pytest.approx(7.0, abs=ABS_TOL) + assert instance_task.algebraic_variable(0)[0] == pytest.approx(3.0, abs=ABS_TOL) + assert instance_task.algebraic_variable(1)[0] == pytest.approx(7.0, abs=ABS_TOL) def expect_nla2_solution(instance_task): @@ -143,11 +143,11 @@ def expect_nla2_solution(instance_task): assert instance_task.rate_count == 0 assert instance_task.constant_count == 0 assert instance_task.computed_constant_count == 0 - assert instance_task.algebraic_count == 3 + assert instance_task.algebraic_variable_count == 3 - assert instance_task.algebraic(0)[0] == pytest.approx(7.0, abs=ABS_TOL) - assert instance_task.algebraic(1)[0] == pytest.approx(-5.0, abs=ABS_TOL) - assert instance_task.algebraic(2)[0] == pytest.approx(3.0, abs=ABS_TOL) + assert instance_task.algebraic_variable(0)[0] == pytest.approx(7.0, abs=ABS_TOL) + assert instance_task.algebraic_variable(1)[0] == pytest.approx(-5.0, abs=ABS_TOL) + assert instance_task.algebraic_variable(2)[0] == pytest.approx(3.0, abs=ABS_TOL) def test_solve(): diff --git a/tests/bindings/python/utils.in.py b/tests/bindings/python/utils.in.py index 0388e9b22..260531be7 100644 --- a/tests/bindings/python/utils.in.py +++ b/tests/bindings/python/utils.in.py @@ -125,9 +125,9 @@ def assert_values( computed_constant_abs_tols[i], ) - for i in range(instance_task.algebraic_count): + for i in range(instance_task.algebraic_variable_count): assert_value( - instance_task.algebraic(i)[index], + instance_task.algebraic_variable(i)[index], algebraic_values[i], algebraic_abs_tols[i], ) diff --git a/tests/install/bindings/python/test_install.py b/tests/install/bindings/python/test_install.py index 12d2ca92b..d976c87bc 100644 --- a/tests/install/bindings/python/test_install.py +++ b/tests/install/bindings/python/test_install.py @@ -33,7 +33,7 @@ print(f" - States and rates: {instance_task.state_count}") print(f" - Constants: {instance_task.constant_count}") print(f" - Computed constants: {instance_task.computed_constant_count}") - print(f" - Algebraic variables: {instance_task.algebraic_count}") + print(f" - Algebraic variables: {instance_task.algebraic_variable_count}") # Output the results of the simulation. @@ -62,9 +62,9 @@ end="", ) - for i in range(instance_task.algebraic_count): + for i in range(instance_task.algebraic_variable_count): print( - f", {instance_task.algebraic_name(i)} ({instance_task.algebraic_unit(i)})", + f", {instance_task.algebraic_variable_name(i)} ({instance_task.algebraic_variable_unit(i)})", end="", ) @@ -85,7 +85,7 @@ for i in range(instance_task.computed_constant_count): print(f", {instance_task.computed_constant(i)[j]}", end="") - for i in range(instance_task.algebraic_count): - print(f", {instance_task.algebraic(i)[j]}", end="") + for i in range(instance_task.algebraic_variable_count): + print(f", {instance_task.algebraic_variable(i)[j]}", end="") print("") diff --git a/tests/install/src/main.cpp b/tests/install/src/main.cpp index 6c38c5292..416904947 100644 --- a/tests/install/src/main.cpp +++ b/tests/install/src/main.cpp @@ -33,7 +33,7 @@ int main() std::cout << " - States and rates: " << instanceTask->stateCount() << "\n"; std::cout << " - Constants: " << instanceTask->constantCount() << "\n"; std::cout << " - Computed constants: " << instanceTask->computedConstantCount() << "\n"; - std::cout << " - Algebraic variables: " << instanceTask->algebraicCount() << "\n"; + std::cout << " - Algebraic variables: " << instanceTask->algebraicVariableCount() << "\n"; // Output the results of the simulation. @@ -58,8 +58,8 @@ int main() std::cout << "," << instanceTask->computedConstantName(i) << " (" << instanceTask->computedConstantUnit(i) << ")"; } - for (size_t i {0}; i < instanceTask->algebraicCount(); ++i) { - std::cout << "," << instanceTask->algebraicName(i) << " (" << instanceTask->algebraicUnit(i) << ")"; + for (size_t i {0}; i < instanceTask->algebraicVariableCount(); ++i) { + std::cout << "," << instanceTask->algebraicVariableName(i) << " (" << instanceTask->algebraicVariableUnit(i) << ")"; } std::cout << "\n"; @@ -83,8 +83,8 @@ int main() std::cout << "," << instanceTask->computedConstant(i)[j]; } - for (size_t i {0}; i < instanceTask->algebraicCount(); ++i) { - std::cout << "," << instanceTask->algebraic(i)[j]; + for (size_t i {0}; i < instanceTask->algebraicVariableCount(); ++i) { + std::cout << "," << instanceTask->algebraicVariable(i)[j]; } std::cout << "\n"; diff --git a/tests/support/cellml/runtimetests.cpp b/tests/support/cellml/runtimetests.cpp index 1c5a9503a..7ed3afe8e 100644 --- a/tests/support/cellml/runtimetests.cpp +++ b/tests/support/cellml/runtimetests.cpp @@ -33,7 +33,7 @@ TEST(RuntimeCellmlTest, invalidRuntimeBecauseOfAnalysisIssues) { static const libOpenCOR::ExpectedIssues expectedIssues {{ {libOpenCOR::Issue::Type::WARNING, "Analyser: the units in 'x = 1.0' in component 'my_component' are not equivalent. 'x' is in 'volt' (i.e. 'ampere^-1 x kilogram x metre^2 x second^-3') while '1.0' is 'dimensionless'."}, - {libOpenCOR::Issue::Type::ERROR, "Analyser: variable 'x' in component 'my_component' is computed more than once."}, + {libOpenCOR::Issue::Type::ERROR, "Analyser: variable 'x' in component 'my_component' is overconstrained."}, }}; auto file {libOpenCOR::File::create(libOpenCOR::resourcePath("support/cellml/model_with_analysis_issues.cellml"))}; diff --git a/tests/utils.cpp b/tests/utils.cpp index 8cb7f795a..e6a9055d1 100644 --- a/tests/utils.cpp +++ b/tests/utils.cpp @@ -82,8 +82,8 @@ void expectEqualValues(const SedInstanceTaskPtr &pInstanceTask, size_t pIndex, expectEqualValue(pInstanceTask->computedConstant(i)[pIndex], pComputedConstantValues[i], pComputedConstantAbsTols[i]); } - for (size_t i {0}; i < pInstanceTask->algebraicCount(); ++i) { - expectEqualValue(pInstanceTask->algebraic(i)[pIndex], pAlgebraicValues[i], pAlgebraicAbsTols[i]); + for (size_t i {0}; i < pInstanceTask->algebraicVariableCount(); ++i) { + expectEqualValue(pInstanceTask->algebraicVariable(i)[pIndex], pAlgebraicValues[i], pAlgebraicAbsTols[i]); } }