Skip to content

Commit

Permalink
Fix extra indentation in fcompare output (AMReX-Codes#3823)
Browse files Browse the repository at this point in the history
This PR fixes the column alignment when the plotfiles being compared
have missing variables or NaNs.

The previous code placed the padding spaces from `std::setw(50)` after
the newline, which showed up as extra indentation on the following line.
This moves the newlines to a separate string, so the padding only gets
applied to the message.
  • Loading branch information
yut23 authored Mar 19, 2024
1 parent 8afec3e commit c902981
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions Tools/Plotfile/fcompare.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -279,19 +279,23 @@ int main_main()
if (ivar_b[icomp_a] < 0) {
amrex::Print() << " " << std::setw(24) << std::left << names_a[icomp_a]
<< " " << std::setw(50)
<< "< variable not present in both files > \n";
<< "< variable not present in both files > "
<< "\n";
} else if (has_nan_a[icomp_a] && has_nan_b[icomp_a]) {
amrex::Print() << " " << std::setw(24) << std::left << names_a[icomp_a]
<< " " << std::setw(50)
<< "< NaN present in both A and B > \n";
<< "< NaN present in both A and B > "
<< "\n";
} else if (has_nan_a[icomp_a]) {
amrex::Print() << " " << std::setw(24) << std::left << names_a[icomp_a]
<< " " << std::setw(50)
<< "< NaN present in A > \n";
<< "< NaN present in A > "
<< "\n";
} else if (has_nan_b[icomp_a]) {
amrex::Print() << " " << std::setw(24) << std::left << names_b[icomp_a]
<< " " << std::setw(50)
<< "< NaN present in B > \n";
<< "< NaN present in B > "
<< "\n";
} else {
Real aerr = 0., rerr = 0.;
if (aerror[icomp_a] > 0.) {
Expand Down

0 comments on commit c902981

Please sign in to comment.