Skip to content

Commit 9676335

Browse files
Core Solver - Simplify configuration of log level usage
1 parent c1fdc5c commit 9676335

File tree

3 files changed

+13
-5
lines changed

3 files changed

+13
-5
lines changed

src/mmSolver/adjust/adjust_base.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1190,7 +1190,7 @@ MStatus solveFrames(
11901190
addFrameListToStringStream(validFrameList, ss);
11911191
MMSOLVER_MAYA_INFO("Valid Frames:" << ss.str());
11921192
} else if (!out_cmdResult.printStats.doNotSolve &&
1193-
(logLevel >= LogLevel::kVerbose)) {
1193+
(logLevel >= printNormalIterationsLogLevel)) {
11941194
MMSOLVER_MAYA_INFO(
11951195
"------------------------------------------------------------------"
11961196
"-------------");

src/mmSolver/adjust/adjust_data.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,14 @@ enum class LogLevel {
102102
kNumLogLevels,
103103
};
104104

105+
// The LogLevel that will print "normal" iterations to the terminal/Maya
106+
// Output Window.
107+
const LogLevel printNormalIterationsLogLevel = LogLevel::kVerbose;
108+
109+
// The LogLevel that will print "jacobian" iterations to the terminal/Maya
110+
// Output Window.
111+
const LogLevel printJacobianIterationsLogLevel = LogLevel::kDebug;
112+
105113
struct PrintStatOptions {
106114
// Do not actually solve anything, just stop after preparing to
107115
// solve, because we have already calculated all the data needed

src/mmSolver/adjust/adjust_solveFunc.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ void incrementNormalIteration(SolverData *userData) {
247247

248248
++userData->funcEvalNum;
249249
++userData->iterNum;
250-
if (userData->logLevel >= LogLevel::kVerbose) {
250+
if (userData->logLevel >= printNormalIterationsLogLevel) {
251251
MStreamUtils::stdErrorStream() << "Iteration ";
252252
MStreamUtils::stdErrorStream() << std::right << std::setfill('0')
253253
<< std::setw(4) << userData->iterNum;
@@ -265,7 +265,7 @@ void incrementJacobianIteration(SolverData *userData) {
265265

266266
++userData->funcEvalNum;
267267
++userData->jacIterNum;
268-
if (userData->logLevel >= LogLevel::kDebug) {
268+
if (userData->logLevel >= printJacobianIterationsLogLevel) {
269269
MStreamUtils::stdErrorStream() << "Jacobian ";
270270
MStreamUtils::stdErrorStream() << std::right << std::setfill('0')
271271
<< std::setw(4) << userData->jacIterNum;
@@ -711,14 +711,14 @@ int solveFunc(const int numberOfParameters, const int numberOfErrors,
711711
}
712712

713713
if (userData->isNormalCall) {
714-
if (userData->logLevel >= LogLevel::kVerbose) {
714+
if (userData->logLevel >= printNormalIterationsLogLevel) {
715715
char formatBuffer[128];
716716
sprintf(formatBuffer, " | error avg %8.4f min %8.4f max %8.4f",
717717
error_avg, error_min, error_max);
718718
MStreamUtils::stdErrorStream() << std::string(formatBuffer) << "\n";
719719
}
720720
} else {
721-
if (userData->logLevel >= LogLevel::kDebug) {
721+
if (userData->logLevel >= printJacobianIterationsLogLevel) {
722722
if (!userData->doCalcJacobian) {
723723
std::cerr << "\n";
724724
}

0 commit comments

Comments
 (0)