parameter system: add support for positional parameters

further, this cleans up the code of the parameter system and the
startup routines a bit and finally, it adds positional parameters
support to ebos as well as brief descriptions to ebos and the lens
problem.
This commit is contained in:
Andreas Lauser 2018-06-13 16:44:50 +02:00
parent 91c209eb09
commit 739a0ef0d0

View File

@ -295,6 +295,7 @@ template <class TypeTag>
class EclProblem : public GET_PROP_TYPE(TypeTag, BaseProblem)
{
typedef typename GET_PROP_TYPE(TypeTag, BaseProblem) ParentType;
typedef typename GET_PROP_TYPE(TypeTag, Problem) Implementation;
typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar;
typedef typename GET_PROP_TYPE(TypeTag, GridView) GridView;
@ -352,7 +353,6 @@ class EclProblem : public GET_PROP_TYPE(TypeTag, BaseProblem)
typedef typename GridView::template Codim<0>::Iterator ElementIterator;
struct RockParams {
Scalar referencePressure;
Scalar compressibility;
@ -379,6 +379,48 @@ public:
"The frequencies of which time steps are serialized to disk");
}
/*!
* \copydoc FvBaseProblem::handlePositionalParameter
*/
static int handlePositionalParameter(std::string& errorMsg,
int argc OPM_UNUSED,
const char** argv,
int paramIdx,
int posParamIdx OPM_UNUSED)
{
typedef typename GET_PROP(TypeTag, ParameterMetaData) ParamsMeta;
Dune::ParameterTree& tree = ParamsMeta::tree();
if (tree.hasKey("EclDeckFileName")) {
errorMsg = "File name of ECL specified multiple times";
return 0;
}
tree["EclDeckFileName"] = argv[paramIdx];
return 1;
}
/*!
* \copydoc FvBaseProblem::helpPreamble
*/
static std::string helpPreamble(int argc OPM_UNUSED,
const char **argv)
{
std::string desc = Implementation::briefDescription();
if (!desc.empty())
desc = desc + "\n";
return
"Usage: "+std::string(argv[0]) + " [OPTIONS] [ECL_DECK_FILENAME]\n"
+ desc;
}
/*!
* \copydoc FvBaseProblem::briefDescription
*/
static std::string briefDescription()
{ return "ebos, the Ecl Black-Oil reservoir Simulator. A program to process ECL input files."; }
/*!
* \copydoc Doxygen::defaultProblemConstructor
*/