Skip to content

Commit 526654a

Browse files
committed
add chebyshev and pipecg
1 parent a06a317 commit 526654a

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

core/solver/chebyshev.cpp

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44

55
#include "ginkgo/core/solver/chebyshev.hpp"
66

7+
#include <set>
8+
#include <string>
9+
710
#include <ginkgo/core/base/precision_dispatch.hpp>
811
#include <ginkgo/core/matrix/dense.hpp>
912
#include <ginkgo/core/solver/solver_base.hpp>
@@ -48,8 +51,9 @@ typename Chebyshev<ValueType>::parameters_type Chebyshev<ValueType>::parse(
4851
const config::type_descriptor& td_for_child)
4952
{
5053
auto params = solver::Chebyshev<ValueType>::build();
51-
common_solver_parse(params, config, context, td_for_child);
52-
if (auto& obj = config.get("foci")) {
54+
std::set<std::string> allowed_keys;
55+
common_solver_parse(params, config, context, td_for_child, allowed_keys);
56+
if (auto& obj = config::get_config_node(config, "foci", allowed_keys)) {
5357
auto arr = obj.get_array();
5458
if (arr.size() != 2) {
5559
GKO_INVALID_CONFIG_VALUE("foci", "must contain two elements");
@@ -58,10 +62,12 @@ typename Chebyshev<ValueType>::parameters_type Chebyshev<ValueType>::parse(
5862
gko::config::get_value<detail::coeff_type<ValueType>>(arr.at(0)),
5963
gko::config::get_value<detail::coeff_type<ValueType>>(arr.at(1)));
6064
}
61-
if (auto& obj = config.get("default_initial_guess")) {
65+
if (auto& obj = config::get_config_node(config, "default_initial_guess",
66+
allowed_keys)) {
6267
params.with_default_initial_guess(
6368
gko::config::get_value<solver::initial_guess_mode>(obj));
6469
}
70+
config::check_allowed_keys(config, allowed_keys);
6571
return params;
6672
}
6773

core/solver/pipe_cg.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44

55
#include "ginkgo/core/solver/pipe_cg.hpp"
66

7+
#include <set>
8+
#include <string>
9+
710
#include <ginkgo/core/base/exception.hpp>
811
#include <ginkgo/core/base/exception_helpers.hpp>
912
#include <ginkgo/core/base/executor.hpp>
@@ -40,7 +43,9 @@ typename PipeCg<ValueType>::parameters_type PipeCg<ValueType>::parse(
4043
const config::type_descriptor& td_for_child)
4144
{
4245
auto params = solver::PipeCg<ValueType>::build();
43-
common_solver_parse(params, config, context, td_for_child);
46+
std::set<std::string> allowed_keys;
47+
common_solver_parse(params, config, context, td_for_child, allowed_keys);
48+
config::check_allowed_keys(config, allowed_keys);
4449
return params;
4550
}
4651

0 commit comments

Comments
 (0)