From cb511312b149c6cbcbb8325adfe4c4d0836c94cd Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Fri, 16 May 2025 10:41:39 +0200 Subject: [PATCH] start: sprinkle some const --- opm/models/utils/start.hh | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/opm/models/utils/start.hh b/opm/models/utils/start.hh index ed5fefd742..1fce187f6c 100644 --- a/opm/models/utils/start.hh +++ b/opm/models/utils/start.hh @@ -117,7 +117,7 @@ static inline int setupParameters_(int argc, if (myRank == 0 && handleHelp) { helpPreamble = Problem::helpPreamble(argc, argv); } - std::string s = + const std::string s = Parameters::parseCommandLineOptions(argc, argv, positionalParamCallback, @@ -216,7 +216,7 @@ static inline int start(int argc, char **argv, bool registerParams) int myRank = 0; try { - int paramStatus = + const int paramStatus = setupParameters_(argc, const_cast(argv), registerParams, @@ -244,7 +244,7 @@ static inline int start(int argc, char **argv, bool registerParams) } // read the initial time step and the end time - Scalar endTime = Parameters::Get>(); + const Scalar endTime = Parameters::Get>(); if (endTime < -1e50) { if (myRank == 0) { Parameters::printUsage(argv[0], std::cerr, @@ -253,7 +253,7 @@ static inline int start(int argc, char **argv, bool registerParams) return 1; } - Scalar initialTimeStepSize = Parameters::Get>(); + const Scalar initialTimeStepSize = Parameters::Get>(); if (initialTimeStepSize < -1e50) { if (myRank == 0) { Parameters::printUsage(argv[0], std::cerr, @@ -265,15 +265,15 @@ static inline int start(int argc, char **argv, bool registerParams) if (myRank == 0) { #ifdef EWOMS_VERSION - std::string versionString = EWOMS_VERSION; + const std::string versionString = EWOMS_VERSION; #else - std::string versionString = ""; + const std::string versionString; #endif const std::string briefDescription = Problem::briefDescription(); if (!briefDescription.empty()) { - std::string tmp = breakLines(briefDescription, - /*indentWidth=*/0, - getTtyWidth()); + const std::string tmp = breakLines(briefDescription, + /*indentWidth=*/0, + getTtyWidth()); std::cout << tmp << std::endl << std::endl; } else { @@ -283,9 +283,9 @@ static inline int start(int argc, char **argv, bool registerParams) } // print the parameters if requested - int printParams = Parameters::Get(); + const int printParams = Parameters::Get(); if (myRank == 0) { - std::string endParametersSeparator("# [end of parameters]\n"); + const std::string endParametersSeparator("# [end of parameters]\n"); if (printParams) { bool printSeparator = false; if (printParams == 1 || !isatty(fileno(stdout))) {