29 std::vector<MeshLib::Node*> vec_new_nodes =
31 std::vector<MeshLib::Element*> vec_new_eles =
34 auto const material_ids = materialIDs(mesh);
35 assert(material_ids !=
nullptr);
36 int const max_matID = material_ids ? ranges::max(*material_ids) : 0;
38 auto const edgeLengths = minMaxEdgeLength(mesh.
getElements());
39 double const min_edge = edgeLengths.first;
41 std::vector<int> new_mat_ids;
42 const std::size_t n_ply(ply_vec.
size());
44 for (std::size_t k(0); k < n_ply; k++)
46 auto const*
const ply = ply_vec.
getVector()[k];
51 auto& vec_nodes_on_ply = mshNodesAlongPoly.
getNodeIDs();
52 if (vec_nodes_on_ply.empty())
56 INFO(
"No nodes found on polyline {:s}", ply_name);
61 for (std::size_t i = 0; i < vec_nodes_on_ply.size() - 1; i++)
63 std::array<MeshLib::Node*, 2> element_nodes;
64 element_nodes[0] = vec_new_nodes[vec_nodes_on_ply[i]];
65 element_nodes[1] = vec_new_nodes[vec_nodes_on_ply[i + 1]];
66 vec_new_eles.push_back(
68 new_mat_ids.push_back(max_matID + k + 1);
73 const std::string name = mesh.
getName() +
"_with_lines";
75 std::make_unique<MeshLib::Mesh>(name, vec_new_nodes, vec_new_eles,
77 auto new_material_ids =
78 new_mesh->getProperties().createNewPropertyVector<
int>(
80 if (!new_material_ids)
82 OGS_FATAL(
"Could not create MaterialIDs cell vector in new mesh.");
84 new_material_ids->reserve(new_mesh->getNumberOfElements());
85 if (material_ids !=
nullptr)
87 std::copy(begin(*material_ids), end(*material_ids),
88 std::back_inserter(*new_material_ids));
94 std::copy(begin(new_mat_ids), end(new_mat_ids),
95 std::back_inserter(*new_material_ids));