29 std::vector<MeshLib::Node*> vec_new_nodes =
31 std::vector<MeshLib::Element*> vec_new_eles =
34 auto const material_ids = materialIDs(mesh);
37 ? *(std::max_element(begin(*material_ids), end(*material_ids)))
40 auto const edgeLengths = minMaxEdgeLength(mesh.
getElements());
41 double const min_edge = edgeLengths.first;
43 std::vector<int> new_mat_ids;
44 const std::size_t n_ply(ply_vec.
size());
46 for (std::size_t k(0); k < n_ply; k++)
48 auto const*
const ply = ply_vec.
getVector()[k];
53 auto& vec_nodes_on_ply = mshNodesAlongPoly.
getNodeIDs();
54 if (vec_nodes_on_ply.empty())
58 INFO(
"No nodes found on polyline {:s}", ply_name);
63 for (std::size_t i = 0; i < vec_nodes_on_ply.size() - 1; i++)
65 std::array<MeshLib::Node*, 2> element_nodes;
66 element_nodes[0] = vec_new_nodes[vec_nodes_on_ply[i]];
67 element_nodes[1] = vec_new_nodes[vec_nodes_on_ply[i + 1]];
68 vec_new_eles.push_back(
70 new_mat_ids.push_back(max_matID + k + 1);
75 const std::string name = mesh.
getName() +
"_with_lines";
77 std::make_unique<MeshLib::Mesh>(name, vec_new_nodes, vec_new_eles,
79 auto new_material_ids =
80 new_mesh->getProperties().createNewPropertyVector<
int>(
82 if (!new_material_ids)
84 OGS_FATAL(
"Could not create MaterialIDs cell vector in new mesh.");
86 new_material_ids->reserve(new_mesh->getNumberOfElements());
87 if (material_ids !=
nullptr)
89 std::copy(begin(*material_ids), end(*material_ids),
90 std::back_inserter(*new_material_ids));
96 std::copy(begin(new_mat_ids), end(new_mat_ids),
97 std::back_inserter(*new_material_ids));