From 3161b4f54732b424591dccecd73b6662046d67fe Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Wed, 4 Sep 2024 18:50:12 +0200 Subject: [PATCH] ParameterSystem: add function to query if registration is open --- opm/models/utils/parametersystem.cpp | 5 +++++ opm/models/utils/parametersystem.hpp | 6 ++++++ opm/simulators/flow/FlowMain.hpp | 2 +- 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/opm/models/utils/parametersystem.cpp b/opm/models/utils/parametersystem.cpp index fecd600cc..af5079b9b 100644 --- a/opm/models/utils/parametersystem.cpp +++ b/opm/models/utils/parametersystem.cpp @@ -454,6 +454,11 @@ void reset() MetaData::clear(); } +bool IsRegistrationOpen() +{ + return MetaData::registrationOpen(); +} + void endRegistration() { if (!MetaData::registrationOpen()) { diff --git a/opm/models/utils/parametersystem.hpp b/opm/models/utils/parametersystem.hpp index e915c8b32..dbf3f2d6e 100644 --- a/opm/models/utils/parametersystem.hpp +++ b/opm/models/utils/parametersystem.hpp @@ -393,6 +393,12 @@ void Hide() detail::Hide_(detail::getParamName()); } +/*! + * \brief Query whether parameter registration is open or not. + * \return True if registration is open, false otherwise + */ +bool IsRegistrationOpen(); + /*! * \brief Indicate that all parameters are registered for a given type tag. * diff --git a/opm/simulators/flow/FlowMain.hpp b/opm/simulators/flow/FlowMain.hpp index b9727a85c..d60baa992 100644 --- a/opm/simulators/flow/FlowMain.hpp +++ b/opm/simulators/flow/FlowMain.hpp @@ -84,7 +84,7 @@ namespace Opm { // Read the command line parameters. Throws an exception if something goes wrong. static int setupParameters_(int argc, char** argv, Parallel::Communication comm) { - if (!Parameters::MetaData::registrationOpen()) { + if (!Parameters::IsRegistrationOpen()) { // We have already successfully run setupParameters_(). // For the dynamically chosen runs (as from the main flow // executable) we must run this function again with the