ebos: handle positional parameters more robustly

previously, the exact behaviour was dependent on wheter the
--ecl-deck-file-name parameter was defined or not. now the positional
parameter is hopefully an exact alias for the value of --ecl-deck-file-name.
This commit is contained in:
Andreas Lauser 2018-08-10 17:32:46 +02:00
parent e7606d2afd
commit 0d864f8e71

View File

@ -92,6 +92,7 @@
#include <boost/date_time.hpp>
#include <set>
#include <vector>
#include <string>
#include <algorithm>
@ -394,7 +395,8 @@ public:
/*!
* \copydoc FvBaseProblem::handlePositionalParameter
*/
static int handlePositionalParameter(std::string& errorMsg,
static int handlePositionalParameter(std::set<std::string>& seenParams,
std::string& errorMsg,
int argc OPM_UNUSED,
const char** argv,
int paramIdx,
@ -403,12 +405,15 @@ public:
typedef typename GET_PROP(TypeTag, ParameterMetaData) ParamsMeta;
Dune::ParameterTree& tree = ParamsMeta::tree();
if (tree.hasKey("EclDeckFileName")) {
errorMsg = "File name of ECL specified multiple times";
if (seenParams.count("EclDeckFileName") > 0) {
errorMsg =
"Parameter 'EclDeckFileName' specified multiple times"
" as a command line parameter";
return 0;
}
tree["EclDeckFileName"] = argv[paramIdx];
seenParams.insert("EclDeckFileName");
return 1;
}