PISM, A Parallel Ice Sheet Model  stable v2.1-1-g6902d5502 committed by Ed Bueler on 2023-12-20 08:38:27 -0800

◆ set_flag_from_option()

void pism::set_flag_from_option ( Config config,
const std::string &  option,
const std::string &  parameter_name 
)

Get a flag from a command-line option.

Set one flag parameter using command-line options.

Use the command-line option option to set the configuration parameter parameter_name.

When called as set_flag_from_option(config, "foo", "bar"),

sets the configuration parameter bar to true if

  • -foo is set (no argument)
  • -foo true is set
  • -foo True is set
  • -foo yes is set

sets the bar to false if

  • -foo false is set
  • -foo False is set
  • -foo no is set
  • `-no_foo is set.

-foo X with X not equal to yes, no, true, True, false, False results in an error.

Definition at line 459 of file ConfigInterface.cc.

References pism::options::ALLOW_EMPTY, pism::options::Bool(), CONFIG_USER, pism::Config::doc(), pism::Config::FORGET_THIS_USE, pism::RuntimeError::formatted(), pism::Config::get_flag(), pism::options::Option< T >::is_set(), member(), PISM_ERROR_LOCATION, pism::Config::set_flag(), and pism::options::Option< T >::value().

Referenced by set_parameter_from_options().