31#include "neml2/base/Option.h"
32#include "neml2/misc/errors.h"
38class LabeledAxisAccessor;
43std::ostream &
operator<<(std::ostream & os,
const OptionSet & p);
69 void operator+=(const
OptionSet & source);
95 bool contains(
const std::string &)
const;
107 std::string
to_str()
const;
113 template <
typename T>
114 T
get(
const std::string &)
const;
125 template <
typename T, FType f = FType::NONE>
126 T &
set(
const std::string &);
135 template <
typename T>
138 template <
typename T>
142 using map_type = std::map<std::string, std::unique_ptr<OptionBase>, std::less<>>;
245 throw NEMLException(
"ERROR: no option named \"" +
name +
"\" found.\n\nKnown options:\n" +
252template <
typename T, FType F>
The accessor containing all the information needed to access an item in a LabeledAxis.
Definition LabeledAxisAccessor.h:56
Definition OptionBase.h:44
A custom map-like data structure. The keys are strings, and the values can be nonhomogeneously typed.
Definition OptionSet.h:51
map_type::iterator iterator
Option map iterator.
Definition OptionSet.h:144
map_type _values
Data structure to map names with values.
Definition OptionSet.h:233
T & set_buffer(const std::string &)
Convenient method to request a buffer.
Definition OptionSet.h:272
const std::string & name() const
A readonly reference to the option set's name.
Definition OptionSet.h:74
const std::string & type() const
A readonly reference to the option set's type.
Definition OptionSet.h:78
LabeledAxisAccessor & set_output(const std::string &)
Definition OptionSet.cxx:94
std::string to_str() const
Print the contents.
Definition OptionSet.cxx:143
T get(const std::string &) const
Definition OptionSet.h:242
map_type::const_iterator const_iterator
Constant option map iterator.
Definition OptionSet.h:146
std::map< std::string, std::unique_ptr< OptionBase >, std::less<> > map_type
The type of the map that we store internally.
Definition OptionSet.h:142
std::string & name()
A writable reference to the option set's name.
Definition OptionSet.h:76
LabeledAxisAccessor & set_input(const std::string &)
Definition OptionSet.cxx:88
std::string & type()
A writable reference to the option set's type.
Definition OptionSet.h:80
const std::string & doc() const
A readonly reference to the option set's docstring.
Definition OptionSet.h:86
const std::string & section() const
A readonly reference to the option set's section.
Definition OptionSet.h:90
T & set_parameter(const std::string &)
Convenient method to request a parameter.
Definition OptionSet.h:265
iterator begin()
Iterator pointing to the beginning of the set of options.
Definition OptionSet.cxx:189
iterator end()
Iterator pointing to the end of the set of options.
Definition OptionSet.cxx:201
const std::string & path() const
A readonly reference to the option set's path.
Definition OptionSet.h:82
std::string & doc()
A writable reference to the option set's docstring.
Definition OptionSet.h:88
bool user_specified(const std::string &name) const
Definition OptionSet.cxx:53
struct neml2::OptionSet::Metadata _metadata
void clear()
Clear internal data structures & frees any allocated memory.
Definition OptionSet.cxx:100
std::string & path()
A writable reference to the option set's path.
Definition OptionSet.h:84
std::string & section()
A writable reference to the option set's section.
Definition OptionSet.h:92
std::size_t size() const
Definition OptionSet.h:101
bool contains(const std::string &) const
Definition OptionSet.cxx:47
T & set(const std::string &)
Definition OptionSet.h:254
Definition DiagnosticsInterface.cxx:30
bool options_compatible(const OptionSet &opts, const OptionSet &additional_opts)
Definition OptionSet.cxx:34
std::string name(ElasticConstant p)
Definition ElasticityConverter.cxx:30
std::ostream & operator<<(std::ostream &os, const EnumSelection &es)
Definition EnumSelection.cxx:31