Skip to content

Commit 51c4695

Browse files
authored
align fcompare behavior with particle_compare when metadata differ (#4724)
`fcompare` crashes when boxes differ. This is confusing when interpreting the output, since it does not indicate an actual crash. In contrast, `particle_compare` prints an error message and returns `EXIT_FAILURE` when metadata differ. This PR aligns fcompare with the behavior of `particle_compare`. Also fixes a copy-paste bug in the domain coverage check in fcompare.
1 parent 82fa0de commit 51c4695

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

Tools/Plotfile/fcompare.cpp

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,9 @@ int main_main()
176176
|| dx_a[1] != dx_b[1],
177177
|| dx_a[2] != dx_b[2] );
178178
if (not_match) {
179-
amrex::Abort("ERROR: grid dx does not match");
179+
amrex::Print() << "\n ERROR: grid dx does not match at level "
180+
<< ilev << '\n';
181+
return EXIT_FAILURE;
180182
}
181183
}
182184

@@ -207,12 +209,16 @@ int main_main()
207209
}
208210
bool grids_match = pf_a.boxArray(ilev) == pf_b.boxArray(ilev);
209211
if (!grids_match && !allow_diff_grids) {
210-
amrex::Abort("ERROR: grids do not match");
212+
amrex::Print() << "\n ERROR: grids do not match at level "
213+
<< ilev << '\n';
214+
return EXIT_FAILURE;
211215
} else if (!grids_match) {
212216
// do they cover the same domain?
213217
if (!pf_a.boxArray(ilev).contains(pf_b.boxArray(ilev)) ||
214-
!pf_a.boxArray(ilev).contains(pf_b.boxArray(ilev))) {
215-
amrex::Abort("ERROR: grids do not cover same domain");
218+
!pf_b.boxArray(ilev).contains(pf_a.boxArray(ilev))) {
219+
amrex::Print() << "\n ERROR: grids do not cover same domain at level "
220+
<< ilev << '\n';
221+
return EXIT_FAILURE;
216222
}
217223
}
218224

0 commit comments

Comments
 (0)