diff --git a/src/debug.cpp b/src/debug.cpp index f16c75456..8a7b330e6 100644 --- a/src/debug.cpp +++ b/src/debug.cpp @@ -29,8 +29,6 @@ limitations under the License. #include "commonutils.h" #include "utilities.h" -#include "libcellml/undefines.h" - namespace libcellml { std::string astAsCode(const AnalyserEquationAstPtr &ast) @@ -116,7 +114,7 @@ void printAnalyserModelEquations(const AnalyserModelPtr &model) Debug() << "\nNo algebraic variables"; } - if (eqn->algebraicCount() != 0) { + if (eqn->externalCount() != 0) { Debug() << "\nExternal variables:"; for (const auto &var : eqn->externals()) { @@ -150,7 +148,7 @@ void printAnalyserModelEquations(const AnalyserModelPtr &model) if (nlaSibling->ast() != nullptr) { Debug() << " - " << astAsCode(nlaSibling->ast()); } else if (nlaSibling->type() == AnalyserEquation::Type::EXTERNAL) { - Debug() << " - External equation for '" << nlaSibling->algebraic(0)->variable()->name() << "'"; + Debug() << " - External equation for '" << nlaSibling->external(0)->variable()->name() << "'"; } else { Debug() << " - ??? [" << AnalyserEquation::typeAsString(nlaSibling->type()) << "]"; } @@ -180,7 +178,7 @@ void printAnalyserModelVariables(const AnalyserModelPtr &model) if (eqn->ast() != nullptr) { Debug() << " - " << astAsCode(eqn->ast()); } else if (eqn->type() == AnalyserEquation::Type::EXTERNAL) { - Debug() << " - External equation for '" << eqn->algebraic(0)->variable()->name() << "'"; + Debug() << " - External equation for '" << eqn->external(0)->variable()->name() << "'"; } else { Debug() << " - ??? [" << AnalyserEquation::typeAsString(eqn->type()) << "]"; } diff --git a/src/generator.cpp b/src/generator.cpp index 9483d5869..38d25b7ee 100644 --- a/src/generator.cpp +++ b/src/generator.cpp @@ -484,11 +484,7 @@ void Generator::GeneratorImpl::doAddImplementationVariableInfoCode(const std::st void Generator::GeneratorImpl::addImplementationVariableInfoCode() { if (modelHasOdes()) { - std::vector variables; - - variables.push_back(mModel->voi()); - - doAddImplementationVariableInfoCode(mProfile->implementationVoiInfoString(), variables, true); + doAddImplementationVariableInfoCode(mProfile->implementationVoiInfoString(), {mModel->voi()}, true); } if (modelHasOdes()) { @@ -496,9 +492,7 @@ void Generator::GeneratorImpl::addImplementationVariableInfoCode() } doAddImplementationVariableInfoCode(mProfile->implementationConstantInfoString(), mModel->constants(), false); - doAddImplementationVariableInfoCode(mProfile->implementationComputedConstantInfoString(), mModel->computedConstants(), false); - doAddImplementationVariableInfoCode(mProfile->implementationAlgebraicInfoString(), mModel->algebraic(), false); if (mModel->hasExternalVariables()) { diff --git a/tests/bindings/javascript/analysermodel.test.js b/tests/bindings/javascript/analysermodel.test.js index 7c5ea9ada..3fe868c7a 100644 --- a/tests/bindings/javascript/analysermodel.test.js +++ b/tests/bindings/javascript/analysermodel.test.js @@ -76,6 +76,11 @@ describe("Analyser Model tests", () => { expect(am.algebraicVariables().size()).toBe(10) expect(am.algebraicVariable(2).variable().name()).toBe("i_K") }); + test('Checking Analyser Model external variables related API.', () => { + expect(am.externalCount()).toBe(0) + expect(am.externals().size()).toBe(0) + expect(am.external(0)).toBeNull() + }); test('Checking Analyser Model need* API.', () => { expect(am.needEqFunction()).toBe(false) expect(am.needNeqFunction()).toBe(false) diff --git a/tests/bindings/javascript/analyservariable.test.js b/tests/bindings/javascript/analyservariable.test.js index 802612656..aa9cbb501 100644 --- a/tests/bindings/javascript/analyservariable.test.js +++ b/tests/bindings/javascript/analyservariable.test.js @@ -40,6 +40,7 @@ describe("Analyser Variable tests", () => { expect(am.constantCount()).toBe(5) expect(am.computedConstantCount()).toBe(3) expect(am.algebraicCount()).toBe(10) + expect(am.externalCount()).toBe(0) }); test('Checking Analyser Variable type.', () => { const av = am.algebraicVariable(0)