217 std::vector<MeshLib::Element*>
const all_bhe_elements =
222 DBUG(
"-> found total {:d} soil elements and {:d} BHE elements",
224 all_bhe_elements.size());
228 if (opt_material_ids ==
nullptr)
230 OGS_FATAL(
"Not able to get material IDs! ");
232 auto const& material_ids = *opt_material_ids;
234 auto const& bhe_material_ids =
235 getUniqueMaterialIds(material_ids, all_bhe_elements);
236 DBUG(
"-> found {:d} BHE material groups", bhe_material_ids.size());
239 std::vector<std::vector<MeshLib::Element*>> bhe_elements;
240 bhe_elements.resize(bhe_material_ids.size());
241 for (
unsigned bhe_id = 0; bhe_id < bhe_material_ids.size(); bhe_id++)
243 const auto bhe_mat_id = bhe_material_ids[bhe_id];
244 std::vector<MeshLib::Element*>& vec_elements = bhe_elements[bhe_id];
245 copy_if(begin(all_bhe_elements), end(all_bhe_elements),
246 back_inserter(vec_elements),
248 {
return material_ids[e->
getID()] == bhe_mat_id; });
249 DBUG(
"-> found {:d} elements on the BHE_{:d}", vec_elements.size(),
254 std::vector<std::vector<MeshLib::Node*>> bhe_nodes;
255 bhe_nodes.resize(bhe_material_ids.size());
256 for (
unsigned bhe_id = 0; bhe_id < bhe_material_ids.size(); bhe_id++)
258 std::vector<MeshLib::Node*>& vec_nodes = bhe_nodes[bhe_id];
261 for (
unsigned i = 0; i < e->getNumberOfNodes(); i++)
263 vec_nodes.push_back(
const_cast<MeshLib::Node*
>(e->getNode(i)));
269 DBUG(
"-> found {:d} nodes on the BHE_{:d}", vec_nodes.size(), bhe_id);
272 std::unordered_map<std::size_t, double> bhe_element_distances_from_wellhead;
273 std::vector<std::vector<MeshLib::Node*>> bhe_topology_ordered_nodes(
274 bhe_material_ids.size());
276 std::unordered_map<std::size_t, int> bhe_element_section_indices;
278 for (
unsigned bhe_id = 0; bhe_id < bhe_material_ids.size(); bhe_id++)
281 walkChainFromWellhead(bhe_elements[bhe_id], bhe_nodes[bhe_id]);
283 bhe_elements[bhe_id] = std::move(walk_result.ordered_elements);
284 bhe_topology_ordered_nodes[bhe_id] =
285 std::move(walk_result.ordered_nodes);
287 for (
auto const& [element_id, distance] :
288 walk_result.element_distances_from_wellhead)
290 bhe_element_distances_from_wellhead[element_id] = distance;
294 return {bhe_material_ids,
297 bhe_topology_ordered_nodes,
298 std::move(bhe_element_distances_from_wellhead),
299 std::move(bhe_element_section_indices)};