5 #ifndef GKO_PUBLIC_CORE_STOP_COMBINED_HPP_
6 #define GKO_PUBLIC_CORE_STOP_COMBINED_HPP_
11 #include <ginkgo/core/stop/criterion.hpp>
43 std::vector<std::shared_ptr<const CriterionFactory>>
44 GKO_DEFERRED_FACTORY_VECTOR_PARAMETER(
criteria);
50 friend class ::gko::EnablePolymorphicObject<
52 friend class ::gko::enable_parameters_type<parameters_type, Factory>;
59 explicit Factory(std::shared_ptr<const ::gko::Executor> exec);
60 explicit Factory(std::shared_ptr<const ::gko::Executor> exec,
61 const parameters_type& parameters);
71 const parameters_type& get_parameters()
const {
return parameters_; }
74 bool check_impl(
uint8 stoppingId,
bool setFinalized,
75 array<stopping_status>* stop_status,
bool* one_changed,
76 const Updater&)
override;
78 explicit Combined(std::shared_ptr<const gko::Executor> exec);
80 explicit Combined(
const Factory* factory,
const CriterionArgs& args);
83 friend ::gko::stop::EnableDefaultCriterionFactory<Factory, Combined,
86 parameters_type parameters_;
88 std::vector<std::unique_ptr<Criterion>> criteria_{};
108 template <
typename FactoryContainer>
109 std::shared_ptr<const CriterionFactory>
combine(FactoryContainer&& factories)
111 switch (factories.size()) {
113 GKO_NOT_SUPPORTED(
nullptr);
115 if (factories[0] ==
nullptr) {
116 GKO_NOT_SUPPORTED(
nullptr);
120 if (factories[0] ==
nullptr) {
122 GKO_NOT_SUPPORTED(
nullptr);
124 auto exec = factories[0]->get_executor();
125 return Combined::build()
126 .with_criteria(std::forward<FactoryContainer>(factories))
137 #endif // GKO_PUBLIC_CORE_STOP_COMBINED_HPP_