flexiblesusy is hosted by Hepforge, IPPP Durham
FlexibleSUSY
composite_convergence_tester.cpp
Go to the documentation of this file.
1// ====================================================================
2// This file is part of FlexibleSUSY.
3//
4// FlexibleSUSY is free software: you can redistribute it and/or modify
5// it under the terms of the GNU General Public License as published
6// by the Free Software Foundation, either version 3 of the License,
7// or (at your option) any later version.
8//
9// FlexibleSUSY is distributed in the hope that it will be useful, but
10// WITHOUT ANY WARRANTY; without even the implied warranty of
11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12// General Public License for more details.
13//
14// You should have received a copy of the GNU General Public License
15// along with FlexibleSUSY. If not, see
16// <http://www.gnu.org/licenses/>.
17// ====================================================================
18
20#include <algorithm>
21
22namespace flexiblesusy {
23
43{
44 bool precision_reached = true;
45
46 for (auto ct: testers) {
47 const bool tester_result = ct->accuracy_goal_reached();
48 precision_reached = precision_reached && tester_result;
49 }
50
51 return precision_reached;
52}
53
55{
56 if (testers.empty())
57 return 0;
58
59 return (*std::max_element(testers.begin(), testers.end(),
60 [](const Convergence_tester* a,
61 const Convergence_tester* b) {
62 return a->max_iterations() < b->max_iterations();
63 }))->max_iterations();
64}
65
67{
68 for (auto ct: testers)
69 ct->restart();
70}
71
73{
74 if (t)
75 testers.push_back(t);
76}
77
78} // namespace flexiblesusy