5 #ifndef GKO_PUBLIC_CORE_STOP_COMBINED_HPP_
6 #define GKO_PUBLIC_CORE_STOP_COMBINED_HPP_
12 #include <ginkgo/core/stop/criterion.hpp>
44 std::vector<std::shared_ptr<const CriterionFactory>>
45 GKO_DEFERRED_FACTORY_VECTOR_PARAMETER(
criteria);
51 friend class ::gko::EnablePolymorphicObject<
53 friend class ::gko::enable_parameters_type<parameters_type, Factory>;
60 explicit Factory(std::shared_ptr<const ::gko::Executor> exec);
61 explicit Factory(std::shared_ptr<const ::gko::Executor> exec,
62 const parameters_type& parameters);
72 const parameters_type& get_parameters()
const {
return parameters_; }
75 bool check_impl(
uint8 stoppingId,
bool setFinalized,
76 array<stopping_status>* stop_status,
bool* one_changed,
77 const Updater&)
override;
79 explicit Combined(std::shared_ptr<const gko::Executor> exec);
81 explicit Combined(
const Factory* factory,
const CriterionArgs& args);
84 friend ::gko::stop::EnableDefaultCriterionFactory<Factory, Combined,
87 parameters_type parameters_;
89 std::vector<std::unique_ptr<Criterion>> criteria_{};
109 template <
typename FactoryContainer>
110 std::shared_ptr<const CriterionFactory>
combine(FactoryContainer&& factories)
112 switch (factories.size()) {
114 GKO_NOT_SUPPORTED(
nullptr);
116 if (factories[0] ==
nullptr) {
117 GKO_NOT_SUPPORTED(
nullptr);
121 if (factories[0] ==
nullptr) {
123 GKO_NOT_SUPPORTED(
nullptr);
125 auto exec = factories[0]->get_executor();
126 return Combined::build()
127 .with_criteria(std::forward<FactoryContainer>(factories))
138 #endif // GKO_PUBLIC_CORE_STOP_COMBINED_HPP_