Skip to content

Commit

Permalink
fcompare: fix logic error when comparing both rel/abs tolerances (AMR…
Browse files Browse the repository at this point in the history
…eX-Codes#1542)

PR AMReX-Codes#1537 introduced the option to allow tolerance checks on both absolute and
relative tolerances. However, the check used `and` instead of `or` to allow
tests to pass when either absolute or relative error was below user-specified
tolerance.

## Checklist

The proposed changes:
- [X] fix a bug or incorrect behavior in AMReX
- [ ] add new capabilities to AMReX
- [ ] changes answers in the test suite to more than roundoff level
- [ ] are likely to significantly affect the results of downstream AMReX users
- [ ] are described in the proposed changes to the AMReX documentation, if appropriate
  • Loading branch information
sayerhs authored Nov 16, 2020
1 parent 95b9779 commit 5076d33
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions Tools/Plotfile/fcompare.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -364,15 +364,12 @@ int main_main()
if (global_error == 0.0 and !any_nans) {
amrex::Print() << " PLOTFILE AGREE" << std::endl;
return EXIT_SUCCESS;
} else if ((abserr_for_global_rerror <= atol) &&
} else if ((abserr_for_global_rerror <= atol) ||
(global_rerror <= rtol)) {
amrex::Print() << " PLOTFILE AGREE to specified tolerances: "
<< "absolute = " << atol
<< " relative = " << rtol << std::endl;
return EXIT_SUCCESS;
} else if (global_rerror <= rtol) {
amrex::Print() << " PLOTFILE AGREE to relative tolerance " << rtol << std::endl;
return EXIT_SUCCESS;
} else {
return EXIT_FAILURE;
}
Expand Down

0 comments on commit 5076d33

Please sign in to comment.