Skip to content

Commit

Permalink
Generator: removed trackedExternalCount() and untrackedExternalCount().
Browse files Browse the repository at this point in the history
Indeed, we can't track/untrack an external variable, so we don't need those methods anymore.
  • Loading branch information
agarny committed Oct 29, 2024
1 parent ee16fc1 commit 18ac7f3
Show file tree
Hide file tree
Showing 6 changed files with 1 addition and 65 deletions.
22 changes: 0 additions & 22 deletions src/api/libcellml/generator.h
Original file line number Diff line number Diff line change
Expand Up @@ -273,28 +273,6 @@ class LIBCELLML_EXPORT Generator
*/
size_t untrackedAlgebraicCount(const AnalyserModelPtr &model);

/**
* @brief Get the number of tracked external variables in the given @p model.
*
* Get the number of tracked external variables in the given @p model.
*
* @param model The pointer to the @ref AnalyserModel for which to get the number of tracked external variables.
*
* @return The number of tracked external variables in the model.
*/
size_t trackedExternalCount(const AnalyserModelPtr &model);

/**
* @brief Get the number of untracked external variables in the given @p model.
*
* Get the number of untracked external variables in the given @p model.
*
* @param model The pointer to the @ref AnalyserModel for which to get the number of untracked external variables.
*
* @return The number of untracked external variables in the model.
*/
size_t untrackedExternalCount(const AnalyserModelPtr &model);

/**
* @brief Get the number of tracked variables in the given @p model.
*
Expand Down
6 changes: 0 additions & 6 deletions src/bindings/interface/generator.i
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,6 @@
%feature("docstring") libcellml::Generator::untrackedAlgebraicCount
"Returns the number of untracked algebraic variables in the given model.";

%feature("docstring") libcellml::Generator::trackedExternalCount
"Returns the number of tracked external variables in the given model.";

%feature("docstring") libcellml::Generator::untrackedExternalCount
"Returns the number of untracked external variables in the given model.";

%feature("docstring") libcellml::Generator::trackedVariableCount
"Returns the number of tracked variables in the given model.";

Expand Down
2 changes: 0 additions & 2 deletions src/bindings/javascript/generator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,6 @@ EMSCRIPTEN_BINDINGS(libcellml_generator)
.function("untrackedComputedConstantCount", &libcellml::Generator::untrackedComputedConstantCount)
.function("trackedAlgebraicCount", &libcellml::Generator::trackedAlgebraicCount)
.function("untrackedAlgebraicCount", &libcellml::Generator::untrackedAlgebraicCount)
.function("trackedExternalCount", &libcellml::Generator::trackedExternalCount)
.function("untrackedExternalCount", &libcellml::Generator::untrackedExternalCount)
.function("trackedVariableCount", &libcellml::Generator::trackedVariableCount)
.function("untrackedVariableCount", &libcellml::Generator::untrackedVariableCount)
.function("interfaceCode", &libcellml::Generator::interfaceCode)
Expand Down
30 changes: 1 addition & 29 deletions src/generator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -296,24 +296,6 @@ size_t Generator::GeneratorImpl::untrackedAlgebraicCount(const AnalyserModelPtr
return doTrackedVariableCount(model, model->algebraic(), false);
}

size_t Generator::GeneratorImpl::trackedExternalCount(const AnalyserModelPtr &model)
{
if (model == nullptr) {
return 0;
}

return doTrackedVariableCount(model, model->externals(), true);
}

size_t Generator::GeneratorImpl::untrackedExternalCount(const AnalyserModelPtr &model)
{
if (model == nullptr) {
return 0;
}

return doTrackedVariableCount(model, model->externals(), false);
}

size_t Generator::GeneratorImpl::trackedVariableCount(const AnalyserModelPtr &model)
{
if (model == nullptr) {
Expand Down Expand Up @@ -620,7 +602,7 @@ void Generator::GeneratorImpl::addStateAndVariableCountCode(const AnalyserModelP
code += interface ?
mProfile->interfaceExternalCountString() :
replace(mProfile->implementationExternalCountString(),
"[EXTERNAL_COUNT]", std::to_string(trackedExternalCount(model)));
"[EXTERNAL_COUNT]", std::to_string(model->externalCount()));
}

if (!code.empty()) {
Expand Down Expand Up @@ -2471,16 +2453,6 @@ size_t Generator::untrackedAlgebraicCount(const AnalyserModelPtr &model)
return mPimpl->untrackedAlgebraicCount(model);
}

size_t Generator::trackedExternalCount(const AnalyserModelPtr &model)
{
return mPimpl->trackedExternalCount(model);
}

size_t Generator::untrackedExternalCount(const AnalyserModelPtr &model)
{
return mPimpl->untrackedExternalCount(model);
}

size_t Generator::trackedVariableCount(const AnalyserModelPtr &model)
{
return mPimpl->trackedVariableCount(model);
Expand Down
3 changes: 0 additions & 3 deletions src/generator_p.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,6 @@ struct Generator::GeneratorImpl
size_t trackedAlgebraicCount(const AnalyserModelPtr &model);
size_t untrackedAlgebraicCount(const AnalyserModelPtr &model);

size_t trackedExternalCount(const AnalyserModelPtr &model);
size_t untrackedExternalCount(const AnalyserModelPtr &model);

size_t trackedVariableCount(const AnalyserModelPtr &model);
size_t untrackedVariableCount(const AnalyserModelPtr &model);

Expand Down
3 changes: 0 additions & 3 deletions tests/generator/generatortrackedvariables.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,6 @@ TEST(GeneratorTrackedVariables, noModelOrVariable)
EXPECT_EQ(size_t(0), generator->trackedAlgebraicCount(nullptr));
EXPECT_EQ(size_t(0), generator->untrackedAlgebraicCount(nullptr));

EXPECT_EQ(size_t(0), generator->trackedExternalCount(nullptr));
EXPECT_EQ(size_t(0), generator->untrackedExternalCount(nullptr));

EXPECT_EQ(size_t(0), generator->trackedVariableCount(nullptr));
EXPECT_EQ(size_t(0), generator->untrackedVariableCount(nullptr));
}
Expand Down

0 comments on commit 18ac7f3

Please sign in to comment.