26 std::vector<std::unique_ptr<ProcessData>>
const& per_process_data,
27 std::vector<LocalCouplingParameters>
const& all_local_coupling_parameters)
31 for (
auto const& local_coupling_parameters : all_local_coupling_parameters)
33 for (
auto const& process_name : local_coupling_parameters.process_names)
36 per_process_data.begin(),
37 per_process_data.end(),
38 [&process_name](
auto const& process_data)
39 { return process_data->process_name == process_name; }))
42 "The given process name '{}' for the element "
43 "'time_loop/global_process_coupling/"
44 "local_coupling_processes/process_name' is not found "
45 "in the element 'time_loop/global_process_coupling/"
46 "local_coupling_processes/process_name' in the project "
57 std::vector<std::unique_ptr<ProcessData>>
const& per_process_data,
58 std::vector<LocalCouplingParameters>
const& all_local_coupling_parameters,
59 int const global_max_coupling_iterations,
60 std::vector<std::unique_ptr<NumLib::ConvergenceCriterion>>&
61 global_coupling_conv_criteria)
63 std::vector<CouplingNodeVariant> coupling_nodes;
65 for (
auto const& process_data : per_process_data)
67 auto const& process_name = process_data->process_name;
72 all_local_coupling_parameters.begin(),
73 all_local_coupling_parameters.end(),
74 [&process_name](
auto const& local_coupling_parameters)
76 auto const& process_names =
77 local_coupling_parameters.process_names;
78 return std::find(process_names.begin(), process_names.end(),
79 process_name) != process_names.end();
85 std::string
const used_process_name =
86 process_name.empty() ?
"not given" : process_name;
89 std::move(global_coupling_conv_criteria[process_data->process_id]),
90 global_max_coupling_iterations,
93 coupling_nodes.emplace_back(std::move(regular_node));
96 return coupling_nodes;
102 std::vector<std::unique_ptr<ProcessData>>
const& per_process_data,
103 std::vector<LocalCouplingParameters>
const& all_local_coupling_parameters,
104 int const global_max_coupling_iterations,
105 std::vector<std::unique_ptr<NumLib::ConvergenceCriterion>>&
106 global_coupling_conv_criteria)
108 std::vector<CouplingNodeVariant> coupling_nodes;
110 for (
auto const& local_coupling_parameters : all_local_coupling_parameters)
114 for (
auto const& local_process_name :
115 local_coupling_parameters.process_names)
117 if (
auto it = std::find_if(
118 per_process_data.begin(),
119 per_process_data.end(),
120 [&local_process_name](
auto const& process_data) {
121 return process_data->process_name == local_process_name;
123 it != per_process_data.end())
125 auto const& process_data = *it;
129 std::move(global_coupling_conv_criteria[process_data
131 local_coupling_parameters.max_iterations,
132 process_data->process_id};
135 std::move(regular_node));
138 coupling_nodes.emplace_back(std::move(root_node));
141 return coupling_nodes;
146 std::vector<std::unique_ptr<ProcessData>>
const& per_process_data,
147 std::vector<LocalCouplingParameters>
const& all_local_coupling_parameters,
148 int const global_max_coupling_iterations,
149 std::vector<std::unique_ptr<NumLib::ConvergenceCriterion>>&
150 global_coupling_conv_criteria)
153 all_local_coupling_parameters);
156 std::vector<CouplingNodeVariant> coupling_nodes =
158 per_process_data, all_local_coupling_parameters,
159 global_max_coupling_iterations, global_coupling_conv_criteria);
162 std::vector<CouplingNodeVariant> root_coupling_nodes =
164 global_max_coupling_iterations,
165 global_coupling_conv_criteria);
167 std::size_t
const num_coupling_nodes =
168 coupling_nodes.size() +
170 root_coupling_nodes.begin(),
171 root_coupling_nodes.end(),
173 [](std::size_t accumulated_sizes,
const auto& coupling_node)
175 return accumulated_sizes +
176 std::get<RootCouplingNode>(coupling_node)
177 .sub_coupling_nodes.size();
180 if (num_coupling_nodes != per_process_data.size())
183 "The number of all coupling nodes including sub-nodes is not "
184 "identical to the number of the processes! Please check the "
185 "element by tag global_process_coupling in the project file.");
188 if (coupling_nodes.empty())
190 coupling_nodes = std::move(root_coupling_nodes);
194 coupling_nodes.reserve(coupling_nodes.size() +
195 root_coupling_nodes.size());
197 std::move(std::begin(root_coupling_nodes),
198 std::end(root_coupling_nodes),
199 std::back_inserter(coupling_nodes));
202 return coupling_nodes;
209 std::vector<std::unique_ptr<ProcessData>>
const& per_process_data)
211 auto [global_coupling_conv_criteria, all_local_coupling_parameters,
214 if (per_process_data.size() != global_coupling_conv_criteria.size())
217 "The number of convergence criteria of the global "
218 "staggered coupling loop is not identical to the number of the "
219 "processes! Please check the element by tag "
220 "global_process_coupling in the project file.");
224 per_process_data, all_local_coupling_parameters,
225 max_coupling_iterations, global_coupling_conv_criteria);
227 return std::make_unique<StaggeredCoupling>(max_coupling_iterations,
228 std::move(coupling_nodes));
std::vector< CouplingNodeVariant > createCouplingNodes(std::vector< std::unique_ptr< ProcessData > > const &per_process_data, std::vector< LocalCouplingParameters > const &all_local_coupling_parameters, int const global_max_coupling_iterations, std::vector< std::unique_ptr< NumLib::ConvergenceCriterion > > &global_coupling_conv_criteria)
std::vector< CouplingNodeVariant > createRootCouplingNodes(std::vector< std::unique_ptr< ProcessData > > const &per_process_data, std::vector< LocalCouplingParameters > const &all_local_coupling_parameters, int const global_max_coupling_iterations, std::vector< std::unique_ptr< NumLib::ConvergenceCriterion > > &global_coupling_conv_criteria)
Create coupling nodes that have local-coupling nodes.
std::vector< CouplingNodeVariant > createRegularCouplingNodes(std::vector< std::unique_ptr< ProcessData > > const &per_process_data, std::vector< LocalCouplingParameters > const &all_local_coupling_parameters, int const global_max_coupling_iterations, std::vector< std::unique_ptr< NumLib::ConvergenceCriterion > > &global_coupling_conv_criteria)
Create coupling nodes that do not have local-coupling nodes.