Skip to content

Commit bd6d67d

Browse files
committed
Analyser/Generator: some cleaning up around the libcellml namespace.
1 parent cc143c4 commit bd6d67d

File tree

4 files changed

+21
-21
lines changed

4 files changed

+21
-21
lines changed

src/analyser.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -766,7 +766,7 @@ void Analyser::AnalyserImpl::analyseNode(const XmlNodePtr &node,
766766
auto iter = mStandardUnits.find(unitsName);
767767

768768
if (iter == mStandardUnits.end()) {
769-
auto units = libcellml::Units::create(unitsName);
769+
auto units = Units::create(unitsName);
770770

771771
mCiCnUnits.emplace(ast, units);
772772
mStandardUnits.emplace(unitsName, units);

src/analyser_p.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ class Analyser::AnalyserImpl: public Logger::LoggerImpl
159159
AnalyserInternalVariablePtrs mInternalVariables;
160160
AnalyserInternalEquationPtrs mInternalEquations;
161161

162-
GeneratorProfilePtr mGeneratorProfile = libcellml::GeneratorProfile::create();
162+
GeneratorProfilePtr mGeneratorProfile = GeneratorProfile::create();
163163

164164
std::map<std::string, UnitsPtr> mStandardUnits;
165165
std::map<AnalyserEquationAstPtr, UnitsPtr> mCiCnUnits;

src/analyserequation.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ AnalyserEquationPtr AnalyserEquation::AnalyserEquationImpl::create()
3131

3232
bool AnalyserEquation::AnalyserEquationImpl::isEmptyDependency(const AnalyserEquationWeakPtr &dependency)
3333
{
34-
auto variables = libcellml::analyserVariables(dependency.lock());
34+
auto analyserVariables = libcellml::analyserVariables(dependency.lock());
3535

36-
if (std::any_of(variables.begin(), variables.end(), [](const auto &v) { return v != nullptr; })) {
36+
if (std::any_of(analyserVariables.begin(), analyserVariables.end(), [](const auto &av) { return av != nullptr; })) {
3737
return false;
3838
}
3939

src/generator.cpp

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -748,15 +748,15 @@ void Generator::GeneratorImpl::addNlaSystemsCode()
748748
&& (std::find(handledNlaEquations.begin(), handledNlaEquations.end(), equation) == handledNlaEquations.end())) {
749749
std::string methodBody;
750750
auto i = MAX_SIZE_T;
751-
auto variables = libcellml::analyserVariables(equation);
751+
auto analyserVariables = libcellml::analyserVariables(equation);
752752

753-
for (const auto &variable : variables) {
754-
auto arrayString = (variable->type() == AnalyserVariable::Type::STATE) ?
753+
for (const auto &analyserVariable : analyserVariables) {
754+
auto arrayString = (analyserVariable->type() == AnalyserVariable::Type::STATE) ?
755755
mProfile->ratesArrayString() :
756756
mProfile->algebraicVariablesArrayString();
757757

758758
methodBody += mProfile->indentString()
759-
+ arrayString + mProfile->openArrayString() + convertToString(variable->index()) + mProfile->closeArrayString()
759+
+ arrayString + mProfile->openArrayString() + convertToString(analyserVariable->index()) + mProfile->closeArrayString()
760760
+ mProfile->equalityString()
761761
+ mProfile->uArrayString() + mProfile->openArrayString() + convertToString(++i) + mProfile->closeArrayString()
762762
+ mProfile->commandSeparatorString() + "\n";
@@ -793,37 +793,37 @@ void Generator::GeneratorImpl::addNlaSystemsCode()
793793

794794
i = MAX_SIZE_T;
795795

796-
for (const auto &variable : variables) {
797-
auto arrayString = (variable->type() == AnalyserVariable::Type::STATE) ?
796+
for (const auto &analyserVariable : analyserVariables) {
797+
auto arrayString = (analyserVariable->type() == AnalyserVariable::Type::STATE) ?
798798
mProfile->ratesArrayString() :
799799
mProfile->algebraicVariablesArrayString();
800800

801801
methodBody += mProfile->indentString()
802802
+ mProfile->uArrayString() + mProfile->openArrayString() + convertToString(++i) + mProfile->closeArrayString()
803803
+ mProfile->equalityString()
804-
+ arrayString + mProfile->openArrayString() + convertToString(variable->index()) + mProfile->closeArrayString()
804+
+ arrayString + mProfile->openArrayString() + convertToString(analyserVariable->index()) + mProfile->closeArrayString()
805805
+ mProfile->commandSeparatorString() + "\n";
806806
}
807807

808-
auto variablesCount = variables.size();
808+
auto analyserVariablesCount = analyserVariables.size();
809809

810810
methodBody += newLineIfNeeded()
811811
+ mProfile->indentString()
812812
+ replace(replace(mProfile->nlaSolveCallString(modelHasOdes(), mModel->hasExternalVariables()),
813813
"[INDEX]", convertToString(equation->nlaSystemIndex())),
814-
"[SIZE]", convertToString(variablesCount));
814+
"[SIZE]", convertToString(analyserVariablesCount));
815815

816816
methodBody += newLineIfNeeded();
817817

818818
i = MAX_SIZE_T;
819819

820-
for (const auto &variable : variables) {
821-
auto arrayString = (variable->type() == AnalyserVariable::Type::STATE) ?
820+
for (const auto &analyserVariable : analyserVariables) {
821+
auto arrayString = (analyserVariable->type() == AnalyserVariable::Type::STATE) ?
822822
mProfile->ratesArrayString() :
823823
mProfile->algebraicVariablesArrayString();
824824

825825
methodBody += mProfile->indentString()
826-
+ arrayString + mProfile->openArrayString() + convertToString(variable->index()) + mProfile->closeArrayString()
826+
+ arrayString + mProfile->openArrayString() + convertToString(analyserVariable->index()) + mProfile->closeArrayString()
827827
+ mProfile->equalityString()
828828
+ mProfile->uArrayString() + mProfile->openArrayString() + convertToString(++i) + mProfile->closeArrayString()
829829
+ mProfile->commandSeparatorString() + "\n";
@@ -832,7 +832,7 @@ void Generator::GeneratorImpl::addNlaSystemsCode()
832832
mCode += newLineIfNeeded()
833833
+ replace(replace(replace(mProfile->findRootMethodString(modelHasOdes(), mModel->hasExternalVariables()),
834834
"[INDEX]", convertToString(equation->nlaSystemIndex())),
835-
"[SIZE]", convertToString(variablesCount)),
835+
"[SIZE]", convertToString(analyserVariablesCount)),
836836
"[CODE]", generateMethodBodyCode(methodBody));
837837
}
838838
}
@@ -1922,12 +1922,12 @@ void Generator::GeneratorImpl::addImplementationComputeRatesMethodCode(std::vect
19221922
// NLA equation in case the rate is not on its own on either the LHS
19231923
// or RHS of the equation.
19241924

1925-
auto variables = libcellml::analyserVariables(equation);
1925+
auto analyserVariables = libcellml::analyserVariables(equation);
19261926

19271927
if ((equation->type() == AnalyserEquation::Type::ODE)
19281928
|| ((equation->type() == AnalyserEquation::Type::NLA)
1929-
&& (variables.size() == 1)
1930-
&& (variables[0]->type() == AnalyserVariable::Type::STATE))) {
1929+
&& (analyserVariables.size() == 1)
1930+
&& (analyserVariables[0]->type() == AnalyserVariable::Type::STATE))) {
19311931
methodBody += generateEquationCode(equation, remainingEquations);
19321932
}
19331933
}
@@ -2136,7 +2136,7 @@ std::string Generator::implementationCode() const
21362136
std::string Generator::equationCode(const AnalyserEquationAstPtr &ast,
21372137
const GeneratorProfilePtr &generatorProfile)
21382138
{
2139-
GeneratorPtr generator = libcellml::Generator::create();
2139+
GeneratorPtr generator = Generator::create();
21402140

21412141
if (generatorProfile != nullptr) {
21422142
generator->setProfile(generatorProfile);

0 commit comments

Comments
 (0)