diff --git a/core/config/config_helper.hpp b/core/config/config_helper.hpp index 9de08a94ccd..18241deb49b 100644 --- a/core/config/config_helper.hpp +++ b/core/config/config_helper.hpp @@ -26,13 +26,14 @@ namespace gko { namespace config { -#define GKO_INVALID_CONFIG_VALUE(_entry, _value) \ - GKO_INVALID_STATE(_value + std::string(" is invalid for the entry ") + \ - _entry) +#define GKO_INVALID_CONFIG_VALUE(_entry, _value) \ + GKO_INVALID_STATE(std::string("The value >" + _value + \ + "< is invalid for the entry >" + _entry + \ + "<")) #define GKO_MISS_CONFIG_ENTRY(_entry) \ - GKO_INVALID_STATE(std::string("miss the entry ") + _entry) + GKO_INVALID_STATE(std::string("The entry >") + _entry + "< is missing") /** @@ -104,12 +105,11 @@ deferred_factory_parameter parse_or_get_factory(const pnode& config, const type_descriptor& td); template -inline deferred_factory_parameter get_specific_factory( - const pnode& config, const registry& context, const type_descriptor& td) +inline deferred_factory_parameter +parse_or_get_specific_factory(const pnode& config, const registry& context, + const type_descriptor& td) { using T_non_const = std::remove_const_t; - // static_assert(std::is_convertible::value, - // "only LinOpFactory"); deferred_factory_parameter ptr; if (config.get_tag() == pnode::tag_t::string) { @@ -297,6 +297,7 @@ inline std::shared_ptr get_strategy( } else if (str == "classical") { strategy_ptr = std::make_shared(); } + GKO_INVALID_CONFIG_VALUE("strategy", str); return std::move(strategy_ptr); } diff --git a/core/preconditioner/ic.cpp b/core/preconditioner/ic.cpp index 366e891f22c..8ee43b30c52 100644 --- a/core/preconditioner/ic.cpp +++ b/core/preconditioner/ic.cpp @@ -31,12 +31,12 @@ Ic::parse(const config::pnode& config, if (auto& obj = config.get("l_solver")) { params.with_l_solver( - gko::config::get_specific_factory(obj, context, - td_for_child)); + gko::config::parse_or_get_specific_factory( + obj, context, td_for_child)); } if (auto& obj = config.get("factorization")) { params.with_factorization( - gko::config::build_or_get_factory( + gko::config::parse_or_get_factory( obj, context, td_for_child)); } diff --git a/core/preconditioner/ilu.cpp b/core/preconditioner/ilu.cpp index 8248739dc51..bdc2d0e14cf 100644 --- a/core/preconditioner/ilu.cpp +++ b/core/preconditioner/ilu.cpp @@ -34,17 +34,17 @@ Ilu::parse( if (auto& obj = config.get("l_solver")) { params.with_l_solver( - gko::config::get_specific_factory(obj, context, - td_for_child)); + gko::config::parse_or_get_specific_factory( + obj, context, td_for_child)); } if (auto& obj = config.get("u_solver")) { params.with_u_solver( - gko::config::get_specific_factory(obj, context, - td_for_child)); + gko::config::parse_or_get_specific_factory( + obj, context, td_for_child)); } if (auto& obj = config.get("factorization")) { params.with_factorization( - gko::config::build_or_get_factory( + gko::config::parse_or_get_factory( obj, context, td_for_child)); } diff --git a/core/preconditioner/isai.cpp b/core/preconditioner/isai.cpp index e6cd16b872d..b10eec36691 100644 --- a/core/preconditioner/isai.cpp +++ b/core/preconditioner/isai.cpp @@ -114,7 +114,7 @@ Isai::parse( } if (auto& obj = config.get("excess_solver_factory")) { params.with_excess_solver_factory( - gko::config::build_or_get_factory( + gko::config::parse_or_get_factory( obj, context, td_for_child)); } if (auto& obj = config.get("excess_solver_reduction")) { diff --git a/core/test/config/preconditioner.cpp b/core/test/config/preconditioner.cpp index 5302e23249a..fadbdd4abdc 100644 --- a/core/test/config/preconditioner.cpp +++ b/core/test/config/preconditioner.cpp @@ -275,8 +275,6 @@ struct Jacobi param.with_max_block_stride(32u); config_map["skip_sorting"] = pnode{true}; param.with_skip_sorting(true); - // config_map["block_pointers"] = pnode{{{0}, {3}, {17}}}; - // param.with_block_pointers(gko::array(exec, {0, 3, 17})); config_map["storage_optimization"] = pnode{std::vector{pnode{0}, pnode{1}}}; param.with_storage_optimization(gko::precision_reduction(0, 1));