Skip to content
Snippets Groups Projects
Commit be317d48 authored by Dmitri Naumov's avatar Dmitri Naumov
Browse files

[MeL] Generalize to-linear-mesh conversion.

Previously the conversion relied on the node numbering,
which is not necessary.
parent 05a1b686
No related branches found
No related tags found
No related merge requests found
...@@ -34,8 +34,20 @@ T_ELEMENT* createLinearElement(MeshLib::Element const* e, ...@@ -34,8 +34,20 @@ T_ELEMENT* createLinearElement(MeshLib::Element const* e,
auto** nodes = new MeshLib::Node*[n_base_nodes]; auto** nodes = new MeshLib::Node*[n_base_nodes];
for (unsigned i = 0; i < e->getNumberOfBaseNodes(); i++) for (unsigned i = 0; i < e->getNumberOfBaseNodes(); i++)
{ {
nodes[i] = auto const it = find_if(
const_cast<MeshLib::Node*>(vec_new_nodes[e->getNode(i)->getID()]); begin(vec_new_nodes), end(vec_new_nodes),
[node_i = e->getNode(i)](Node* const new_node) {
return *node_i ==
*new_node; // coordinate comparison up to epsilon
});
if (it == end(vec_new_nodes))
{
OGS_FATAL(
"A base node %d (with original global node id %d) not found in "
"the list for element %d.",
i, e->getNode(i)->getID(), e->getID());
}
nodes[i] = const_cast<MeshLib::Node*>(*it);
} }
return new T_ELEMENT(nodes); return new T_ELEMENT(nodes);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment