Skip to content

Commit

Permalink
Return non-zero if nans were found when using fnan. (AMReX-Codes#2704)
Browse files Browse the repository at this point in the history
  • Loading branch information
jrood-nrel authored Apr 9, 2022
1 parent 8c3c4c9 commit d70f70e
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions Tools/Plotfile/fnan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@

using namespace amrex;

void main_main()
int main_main()
{
const int narg = amrex::command_argument_count();
int has_nans = 0;

if (narg == 0) {
amrex::Print()
Expand All @@ -19,7 +20,7 @@ void main_main()
<< " This program takes a single plotfile and reports for each\n"
<< " variable whether there is a NaN."
<< std::endl;
return;
return 0;
}

const auto& fname = amrex::get_command_argument(1);
Expand Down Expand Up @@ -53,14 +54,17 @@ void main_main()
}
}
amrex::Print() << "\n";
has_nans = 1;
}
}
return has_nans;
}

int main (int argc, char* argv[])
{
amrex::SetVerbose(0);
amrex::Initialize(argc, argv, false);
main_main();
const int has_nans = main_main();
amrex::Finalize();
return has_nans;
}

0 comments on commit d70f70e

Please sign in to comment.