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)); diff --git a/include/ginkgo/core/factorization/cholesky.hpp b/include/ginkgo/core/factorization/cholesky.hpp index 34cfb6aa8ed..e1799766b43 100644 --- a/include/ginkgo/core/factorization/cholesky.hpp +++ b/include/ginkgo/core/factorization/cholesky.hpp @@ -94,7 +94,7 @@ class Cholesky /** * Create the parameters from the property_tree. - * Because this is directly tied to the specific type. The value/index type + * Because this is directly tied to the specific type, the value/index type * settings within config are ignored and type_descriptor is only used * for children objects. * diff --git a/include/ginkgo/core/factorization/ic.hpp b/include/ginkgo/core/factorization/ic.hpp index 170297ffa0b..73afdf90464 100644 --- a/include/ginkgo/core/factorization/ic.hpp +++ b/include/ginkgo/core/factorization/ic.hpp @@ -106,7 +106,7 @@ class Ic : public Composition { /** * Create the parameters from the property_tree. - * Because this is directly tied to the specific type. The value/index type + * Because this is directly tied to the specific type, the value/index type * settings within config are ignored and type_descriptor is only used * for children objects. * diff --git a/include/ginkgo/core/factorization/ilu.hpp b/include/ginkgo/core/factorization/ilu.hpp index 785faadd65a..eb37b04b6a3 100644 --- a/include/ginkgo/core/factorization/ilu.hpp +++ b/include/ginkgo/core/factorization/ilu.hpp @@ -101,7 +101,7 @@ class Ilu : public Composition { /** * Create the parameters from the property_tree. - * Because this is directly tied to the specific type. The value/index type + * Because this is directly tied to the specific type, the value/index type * settings within config are ignored and type_descriptor is only used * for children objects. * diff --git a/include/ginkgo/core/factorization/lu.hpp b/include/ginkgo/core/factorization/lu.hpp index 9a4f2029970..6557d455577 100644 --- a/include/ginkgo/core/factorization/lu.hpp +++ b/include/ginkgo/core/factorization/lu.hpp @@ -124,7 +124,7 @@ class Lu /** * Create the parameters from the property_tree. - * Because this is directly tied to the specific type. The value/index type + * Because this is directly tied to the specific type, the value/index type * settings within config are ignored and type_descriptor is only used * for children objects. * diff --git a/include/ginkgo/core/factorization/par_ic.hpp b/include/ginkgo/core/factorization/par_ic.hpp index 1b49ce83edc..06288190785 100644 --- a/include/ginkgo/core/factorization/par_ic.hpp +++ b/include/ginkgo/core/factorization/par_ic.hpp @@ -139,7 +139,7 @@ class ParIc : public Composition { /** * Create the parameters from the property_tree. - * Because this is directly tied to the specific type. The value/index type + * Because this is directly tied to the specific type, the value/index type * settings within config are ignored and type_descriptor is only used * for children objects. * diff --git a/include/ginkgo/core/factorization/par_ict.hpp b/include/ginkgo/core/factorization/par_ict.hpp index 9d0b194a69a..509a7455051 100644 --- a/include/ginkgo/core/factorization/par_ict.hpp +++ b/include/ginkgo/core/factorization/par_ict.hpp @@ -188,7 +188,7 @@ class ParIct : public Composition { /** * Create the parameters from the property_tree. - * Because this is directly tied to the specific type. The value/index type + * Because this is directly tied to the specific type, the value/index type * settings within config are ignored and type_descriptor is only used * for children objects. * diff --git a/include/ginkgo/core/factorization/par_ilu.hpp b/include/ginkgo/core/factorization/par_ilu.hpp index 1497b8c3574..0db06813e79 100644 --- a/include/ginkgo/core/factorization/par_ilu.hpp +++ b/include/ginkgo/core/factorization/par_ilu.hpp @@ -137,7 +137,7 @@ class ParIlu : public Composition { /** * Create the parameters from the property_tree. - * Because this is directly tied to the specific type. The value/index type + * Because this is directly tied to the specific type, the value/index type * settings within config are ignored and type_descriptor is only used * for children objects. * diff --git a/include/ginkgo/core/factorization/par_ilut.hpp b/include/ginkgo/core/factorization/par_ilut.hpp index 24136b089a8..aa1948c6b8d 100644 --- a/include/ginkgo/core/factorization/par_ilut.hpp +++ b/include/ginkgo/core/factorization/par_ilut.hpp @@ -194,7 +194,7 @@ class ParIlut : public Composition { /** * Create the parameters from the property_tree. - * Because this is directly tied to the specific type. The value/index type + * Because this is directly tied to the specific type, the value/index type * settings within config are ignored and type_descriptor is only used * for children objects. * diff --git a/include/ginkgo/core/preconditioner/ic.hpp b/include/ginkgo/core/preconditioner/ic.hpp index e505d04731e..01364424a76 100644 --- a/include/ginkgo/core/preconditioner/ic.hpp +++ b/include/ginkgo/core/preconditioner/ic.hpp @@ -164,7 +164,7 @@ class Ic : public EnableLinOp>, public Transposable { /** * Create the parameters from the property_tree. - * Because this is directly tied to the specific type. The value/index type + * Because this is directly tied to the specific type, the value/index type * settings within config are ignored and type_descriptor is only used * for children objects. * diff --git a/include/ginkgo/core/preconditioner/ilu.hpp b/include/ginkgo/core/preconditioner/ilu.hpp index 3174b31cf0e..a94ee930946 100644 --- a/include/ginkgo/core/preconditioner/ilu.hpp +++ b/include/ginkgo/core/preconditioner/ilu.hpp @@ -207,7 +207,7 @@ class Ilu : public EnableLinOp< /** * Create the parameters from the property_tree. - * Because this is directly tied to the specific type. The value/index type + * Because this is directly tied to the specific type, the value/index type * settings within config are ignored and type_descriptor is only used * for children objects. * diff --git a/include/ginkgo/core/preconditioner/isai.hpp b/include/ginkgo/core/preconditioner/isai.hpp index 8d3fb044d49..4ef5b7da7d3 100644 --- a/include/ginkgo/core/preconditioner/isai.hpp +++ b/include/ginkgo/core/preconditioner/isai.hpp @@ -197,7 +197,7 @@ class Isai : public EnableLinOp>, /** * Create the parameters from the property_tree. - * Because this is directly tied to the specific type. The value/index type + * Because this is directly tied to the specific type, the value/index type * settings within config are ignored and type_descriptor is only used * for children objects. * diff --git a/include/ginkgo/core/preconditioner/jacobi.hpp b/include/ginkgo/core/preconditioner/jacobi.hpp index f6ee3de5de1..f5adbd94651 100644 --- a/include/ginkgo/core/preconditioner/jacobi.hpp +++ b/include/ginkgo/core/preconditioner/jacobi.hpp @@ -503,7 +503,7 @@ class Jacobi : public EnableLinOp>, /** * Create the parameters from the property_tree. - * Because this is directly tied to the specific type. The value/index type + * Because this is directly tied to the specific type, the value/index type * settings within config are ignored and type_descriptor is only used * for children objects. *