1 #ifndef OMEGA_H_INPUT_HPP
2 #define OMEGA_H_INPUT_HPP
4 #include <Omega_h_defines.hpp>
5 #include <Omega_h_filesystem.hpp>
6 #include <Omega_h_mesh.hpp>
18 virtual ~
Input() =
default;
22 virtual void out_of_line_virtual_method();
25 std::string get_full_name(
Input const& input);
27 template <
class InputType>
28 bool is_type(
Input& input);
30 template <
class InputType>
31 InputType& as_type(
Input& input);
38 bool as(std::string& out)
const;
39 bool as(
bool& out)
const;
40 bool as(
double& out)
const;
41 bool as(
int& out)
const;
42 bool as(
long long& out)
const;
45 virtual void out_of_line_virtual_method();
51 std::map<std::string, std::shared_ptr<Input>>::const_iterator impl;
55 using value_type = std::string;
56 using difference_type =
typename decltype(impl)::difference_type;
57 using reference = std::string
const&;
58 using pointer = std::string
const*;
59 using iterator_category = std::bidirectional_iterator_tag;
63 reference operator*()
const noexcept;
64 pointer operator->()
const noexcept;
72 std::map<std::string, std::shared_ptr<Input>>
map;
76 void add(std::string
const& name, std::shared_ptr<Input>&& input);
77 template <
class InputType>
78 bool is_input(std::string
const& name);
79 template <
class ScalarType>
80 bool is(std::string
const& name);
81 bool is_map(std::string
const& name);
82 bool is_list(std::string
const& name);
83 Input& find_named_input(std::string
const& name);
84 template <
class InputType>
85 InputType& use_input(std::string
const& name);
86 template <
class ScalarType>
87 ScalarType get(std::string
const& name);
88 void set(std::string
const& name,
char const* value);
89 InputMap& get_map(std::string
const& name);
90 InputList& get_list(std::string
const& name);
91 template <
class ScalarType>
92 ScalarType get(std::string
const& name,
char const* default_value);
93 std::string
const& name(
Input const& input);
94 virtual void out_of_line_virtual_method();
97 void remove(std::string
const& name);
101 std::vector<std::shared_ptr<Input>> entries;
105 void add(std::shared_ptr<Input>&& input);
106 LO position(
Input const& input);
109 template <
class InputType>
111 template <
class InputType>
112 InputType& use_input(LO i);
113 template <
class ScalarType>
117 template <
class ScalarType>
118 ScalarType get(LO i);
121 virtual void out_of_line_virtual_method();
126 void update_class_sets(ClassSets* p_sets,
InputMap& pl);
128 void echo_input(std::ostream& stream,
Input& input);
130 void check_unused(
Input& input);
132 #define OMEGA_H_EXPL_INST(InputType) \
133 extern template bool is_type<InputType>(Input&); \
134 extern template InputType& as_type<InputType>(Input&); \
135 extern template bool InputMap::is_input<InputType>(std::string const& name); \
136 extern template InputType& InputMap::use_input<InputType>( \
137 std::string const& name); \
138 extern template bool InputList::is_input<InputType>(LO i); \
139 extern template InputType& InputList::use_input(LO i);
143 #undef OMEGA_H_EXPL_INST
145 #define OMEGA_H_EXPL_INST(ScalarType) \
146 extern template ScalarType InputScalar::get<ScalarType>() const; \
147 extern template bool InputMap::is<ScalarType>(std::string const& name); \
148 extern template ScalarType InputMap::get<ScalarType>( \
149 std::string const& name); \
150 extern template ScalarType InputMap::get<ScalarType>( \
151 std::string const& name, char const* default_value); \
152 extern template bool InputList::is<ScalarType>(LO i); \
153 extern template ScalarType InputList::get<ScalarType>(LO i);
154 OMEGA_H_EXPL_INST(std::string)
155 OMEGA_H_EXPL_INST(
bool)
156 OMEGA_H_EXPL_INST(
double)
157 OMEGA_H_EXPL_INST(
int)
158 OMEGA_H_EXPL_INST(
long long)
159 #undef OMEGA_H_EXPL_INST
Definition: Omega_h_filesystem.hpp:22
Definition: amr_mpi_test.cpp:6
Definition: Omega_h_rbtree.hpp:1039
Definition: Omega_h_rbtree.hpp:1013