20#ifndef _PISMCONFIGINTERFACE_H_
21#define _PISMCONFIGINTERFACE_H_
32#include "pism/util/Units.hh"
56 typedef std::shared_ptr<Config>
Ptr;
57 typedef std::shared_ptr<const Config>
ConstPtr;
83 void write(MPI_Comm com,
const std::string &
filename,
bool append =
true)
const;
89 bool is_set(
const std::string &name)
const;
96 typedef std::map<std::string, std::vector<double> >
Doubles;
100 double get_number(
const std::string &name,
const std::string &units,
103 std::vector<double>
get_numbers(
const std::string &name,
const std::string &units,
107 void set_numbers(
const std::string &name,
const std::vector<double> &values,
111 typedef std::map<std::string, std::string>
Strings;
118 typedef std::map<std::string, bool>
Flags;
121 std::set<std::string>
keys()
const;
126 std::string
doc(
const std::string ¶meter)
const;
127 std::string
units(
const std::string ¶meter)
const;
128 std::string
type(
const std::string ¶meter)
const;
129 std::string
option(
const std::string ¶meter)
const;
130 std::string
choices(
const std::string ¶meter)
const;
131 std::pair<bool, double>
valid_min(
const std::string ¶meter)
const;
132 std::pair<bool, double>
valid_max(
const std::string ¶meter)
const;
147 const std::vector<double> &values) = 0;
166 double get_number(
const std::string &name)
const;
167 double get_number(
const std::string &name,
const std::string &units)
const;
169 std::string
get_string(
const std::string &name)
const;
171 bool get_flag(
const std::string& name)
const;
190 const std::string &option,
const std::string ¶meter);
194 const std::string &option,
const std::string ¶meter);
198 const std::string &option,
const std::string ¶meter);
202 const std::string &option,
const std::string ¶meter,
203 const std::string &choices);
void reset_prefix(const std::string &prefix)
bool get_flag(const std::string &name) const
std::string get_string(const std::string &name) const
double get_number(const std::string &name) const
Config::ConstPtr m_config
virtual bool is_set_impl(const std::string &name) const =0
std::map< std::string, std::string > Strings
const std::set< std::string > & parameters_used() const
std::shared_ptr< Config > Ptr
bool is_set(const std::string &name) const
std::string choices(const std::string ¶meter) const
virtual Strings all_strings_impl() const =0
std::set< std::string > keys() const
std::pair< bool, double > valid_max(const std::string ¶meter) const
std::map< std::string, std::vector< double > > Doubles
void set_string(const std::string &name, const std::string &value, ConfigSettingFlag flag=CONFIG_FORCE)
double get_number(const std::string &name, UseFlag flag=REMEMBER_THIS_USE) const
virtual void set_numbers_impl(const std::string &name, const std::vector< double > &values)=0
std::vector< double > get_numbers(const std::string &name, UseFlag flag=REMEMBER_THIS_USE) const
virtual void read_impl(const File &nc)=0
std::shared_ptr< const Config > ConstPtr
virtual Flags all_flags_impl() const =0
virtual std::vector< double > get_numbers_impl(const std::string &name) const =0
const std::set< std::string > & parameters_set_by_user() const
virtual void set_flag_impl(const std::string &name, bool value)=0
void read(MPI_Comm com, const std::string &filename)
bool is_valid_number(const std::string &name) const
virtual void set_string_impl(const std::string &name, const std::string &value)=0
std::string units(const std::string ¶meter) const
void import_from(const Config &other)
void set_flag(const std::string &name, bool value, ConfigSettingFlag flag=CONFIG_FORCE)
virtual std::string get_string_impl(const std::string &name) const =0
std::map< std::string, bool > Flags
std::string get_string(const std::string &name, UseFlag flag=REMEMBER_THIS_USE) const
std::string type(const std::string ¶meter) const
virtual Doubles all_doubles_impl() const =0
virtual void set_number_impl(const std::string &name, double value)=0
void write(MPI_Comm com, const std::string &filename, bool append=true) const
bool get_flag(const std::string &name, UseFlag flag=REMEMBER_THIS_USE) const
void set_number(const std::string &name, double value, ConfigSettingFlag flag=CONFIG_FORCE)
std::string option(const std::string ¶meter) const
std::string filename() const
Returns the name of the file used to initialize the database.
Strings all_strings() const
virtual void write_impl(const File &nc) const =0
void set_numbers(const std::string &name, const std::vector< double > &values, ConfigSettingFlag flag=CONFIG_FORCE)
Doubles all_doubles() const
std::string doc(const std::string ¶meter) const
UseFlag
Flag used by get_...() methods.
std::pair< bool, double > valid_min(const std::string ¶meter) const
virtual double get_number_impl(const std::string &name) const =0
virtual bool get_flag_impl(const std::string &name) const =0
A class for storing and accessing PISM configuration flags and parameters.
High-level PISM I/O class.
std::shared_ptr< System > Ptr
Config::Ptr config_from_options(MPI_Comm com, const Logger &log, units::System::Ptr unit_system)
Create a configuration database using command-line options.
void set_number_from_option(units::System::Ptr unit_system, Config &config, const std::string &option, const std::string ¶meter)
Sets a configuration parameter from a command-line option.
void set_string_from_option(Config &config, const std::string &option, const std::string ¶meter)
Set one free-form string parameter using command-line options.
void set_config_from_options(units::System::Ptr unit_system, Config &config)
Set configuration parameters using command-line options.
void set_flag_from_option(Config &config, const std::string &option, const std::string ¶meter_name)
Get a flag from a command-line option.
ConfigSettingFlag
Flag used by set_...() methods.
void print_unused_parameters(const Logger &log, int verbosity_threshhold, const Config &config)
Report unused configuration parameters to stdout.
void set_keyword_from_option(Config &config, const std::string &option, const std::string ¶meter, const std::string &choices)
Set a keyword parameter from a command-line option.
void set_parameter_from_options(units::System::Ptr unit_system, Config &config, const std::string &name)
Set one parameter using command-line options.
void print_config(const Logger &log, int verbosity_threshhold, const Config &config)
Report configuration parameters to stdout.