53 std::vector<bool> marked_base_nodes(mesh.
getNodes().size(),
false);
54 for (
auto const org_element : org_elements)
56 for (std::size_t k = 0; k < org_element->getNumberOfBaseNodes(); ++k)
58 auto const& base_node = *org_element->getNode(k);
59 marked_base_nodes[base_node.getID()] =
true;
64 std::vector<MeshLib::Node*> new_mesh_nodes{
static_cast<std::size_t
>(
65 std::count(begin(marked_base_nodes), end(marked_base_nodes),
true))};
66 std::size_t base_node_cnt = 0;
67 auto const& org_nodes = mesh.
getNodes();
68 std::vector<std::size_t> base_node_map(org_nodes.size(), -1);
69 for (std::size_t k = 0; k < org_nodes.size(); ++k)
71 if (marked_base_nodes[k])
73 new_mesh_nodes[base_node_cnt] =
75 base_node_map[k] = base_node_cnt;
81 std::vector<MeshLib::Element*> vec_new_eles;
86 vec_new_eles.push_back(createLinearElement<MeshLib::Line>(
87 e, new_mesh_nodes, base_node_map));
91 vec_new_eles.push_back(createLinearElement<MeshLib::Quad>(
92 e, new_mesh_nodes, base_node_map));
96 vec_new_eles.push_back(createLinearElement<MeshLib::Tri>(
97 e, new_mesh_nodes, base_node_map));
101 vec_new_eles.push_back(createLinearElement<MeshLib::Hex>(
102 e, new_mesh_nodes, base_node_map));
106 vec_new_eles.push_back(createLinearElement<MeshLib::Tet>(
107 e, new_mesh_nodes, base_node_map));
111 OGS_FATAL(
"Mesh element type {:s} is not supported",
116 auto new_mesh = std::make_unique<MeshLib::Mesh>(
117 new_mesh_name, new_mesh_nodes, vec_new_eles,
120 std::vector<MeshLib::MeshItemType>(1,
130 auto double_property =
132 if (double_property ==
nullptr)
138 new_mesh->getProperties().createNewPropertyVector<
double>(
140 new_prop->resize(new_mesh->getNumberOfNodes() * n_src_comp);
142 for (std::size_t k = 0; k < org_nodes.size(); ++k)
144 if (!marked_base_nodes[k])
148 std::copy_n(double_property->begin() + k * n_src_comp,
150 new_prop->begin() + base_node_map[k] * n_src_comp);