mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Use negative status to indicate --help, --print-properties, --print-parameters.
That is the documented convention and needed to be able to mark these runs as successful.
This commit is contained in:
parent
20ebdbe8e8
commit
9b650a9258
@ -104,6 +104,8 @@ static inline void registerAllParameters_(bool finalizeRegistration = true)
|
|||||||
*
|
*
|
||||||
* \param argc The number of command line arguments
|
* \param argc The number of command line arguments
|
||||||
* \param argv Array with the command line argument strings
|
* \param argv Array with the command line argument strings
|
||||||
|
* \return A negative value if --help or --print-properties was provided,
|
||||||
|
* a positive value for errors or 0 for success.
|
||||||
*/
|
*/
|
||||||
template <class TypeTag>
|
template <class TypeTag>
|
||||||
static inline int setupParameters_(int argc,
|
static inline int setupParameters_(int argc,
|
||||||
@ -129,7 +131,7 @@ static inline int setupParameters_(int argc,
|
|||||||
|
|
||||||
// fill the parameter tree with the options from the command line
|
// fill the parameter tree with the options from the command line
|
||||||
const auto& positionalParamCallback = Problem::handlePositionalParameter;
|
const auto& positionalParamCallback = Problem::handlePositionalParameter;
|
||||||
std::string helpPreamble = "";
|
std::string helpPreamble = ""; // print help if non-empty!
|
||||||
if (myRank == 0 && handleHelp)
|
if (myRank == 0 && handleHelp)
|
||||||
helpPreamble = Problem::helpPreamble(argc, argv);
|
helpPreamble = Problem::helpPreamble(argc, argv);
|
||||||
std::string s =
|
std::string s =
|
||||||
@ -138,7 +140,16 @@ static inline int setupParameters_(int argc,
|
|||||||
helpPreamble,
|
helpPreamble,
|
||||||
positionalParamCallback);
|
positionalParamCallback);
|
||||||
if (!s.empty())
|
if (!s.empty())
|
||||||
return /*status=*/1;
|
{
|
||||||
|
int status = 1, globalStatus = 1;
|
||||||
|
if (s == "Help called") // only on master process
|
||||||
|
status = globalStatus = -1; // Use negative values to indicate --help argument
|
||||||
|
#if HAVE_MPI
|
||||||
|
// Force -1 if the master process has that.
|
||||||
|
MPI_Allreduce(&status, &globalStatus, 1, MPI_INT, MPI_MIN, MPI_COMM_WORLD);
|
||||||
|
#endif
|
||||||
|
return globalStatus;
|
||||||
|
}
|
||||||
|
|
||||||
std::string paramFileName = EWOMS_GET_PARAM_(TypeTag, std::string, ParameterFile);
|
std::string paramFileName = EWOMS_GET_PARAM_(TypeTag, std::string, ParameterFile);
|
||||||
if (paramFileName != "") {
|
if (paramFileName != "") {
|
||||||
|
Loading…
Reference in New Issue
Block a user