From 3e0ef04440b029b056ce260823b1a5df40f2fefa Mon Sep 17 00:00:00 2001
From: Dmitri Naumov <github@naumov.de>
Date: Sun, 27 May 2018 12:07:38 +0200
Subject: [PATCH] [MeL] getEdge and getFace use bulk elements id.

Before the id was (by default) set to std::size_t(-1).
---
 MeshLib/Elements/EdgeReturn.cpp    | 4 ++--
 MeshLib/Elements/HexRule20.cpp     | 2 +-
 MeshLib/Elements/HexRule8.cpp      | 2 +-
 MeshLib/Elements/PrismRule15.cpp   | 2 +-
 MeshLib/Elements/PrismRule6.cpp    | 2 +-
 MeshLib/Elements/PyramidRule13.cpp | 4 ++--
 MeshLib/Elements/PyramidRule5.cpp  | 4 ++--
 MeshLib/Elements/TetRule10.cpp     | 2 +-
 MeshLib/Elements/TetRule4.cpp      | 2 +-
 9 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/MeshLib/Elements/EdgeReturn.cpp b/MeshLib/Elements/EdgeReturn.cpp
index 350aad519ec..c5f34f7aa70 100644
--- a/MeshLib/Elements/EdgeReturn.cpp
+++ b/MeshLib/Elements/EdgeReturn.cpp
@@ -25,7 +25,7 @@ const Element* LinearEdgeReturn::getEdge(const Element* e, unsigned i)
         auto** nodes = new Node*[2];
         nodes[0] = const_cast<Node*>(e->getEdgeNode(i,0));
         nodes[1] = const_cast<Node*>(e->getEdgeNode(i,1));
-        return new Line(nodes);
+        return new Line(nodes, e->getID());
     }
     ERR("Error in MeshLib::Element::getEdge() - Index does not exist.");
     return nullptr;
@@ -39,7 +39,7 @@ const Element* QuadraticEdgeReturn::getEdge(const Element* e, unsigned i)
         nodes[0] = const_cast<Node*>(e->getEdgeNode(i,0));
         nodes[1] = const_cast<Node*>(e->getEdgeNode(i,1));
         nodes[2] = const_cast<Node*>(e->getEdgeNode(i,2));
-        return new Line3(nodes);
+        return new Line3(nodes, e->getID());
     }
     ERR("Error in MeshLib::Element::getEdge() - Index does not exist.");
     return nullptr;
diff --git a/MeshLib/Elements/HexRule20.cpp b/MeshLib/Elements/HexRule20.cpp
index 6d546930be5..3e00b96b897 100644
--- a/MeshLib/Elements/HexRule20.cpp
+++ b/MeshLib/Elements/HexRule20.cpp
@@ -50,7 +50,7 @@ const Element* HexRule20::getFace(const Element* e, unsigned i)
         std::array<Node*, 8> nodes;
         for (unsigned j=0; j<8; j++)
             nodes[j] = const_cast<Node*>(e->getNode(face_nodes[i][j]));
-        return new Quad8(nodes);
+        return new Quad8(nodes, e->getID());
     }
     ERR("Error in MeshLib::Element::getFace() - Index %d does not exist.", i);
     return nullptr;
diff --git a/MeshLib/Elements/HexRule8.cpp b/MeshLib/Elements/HexRule8.cpp
index 51ae299f698..03fc86b6fbc 100644
--- a/MeshLib/Elements/HexRule8.cpp
+++ b/MeshLib/Elements/HexRule8.cpp
@@ -54,7 +54,7 @@ const Element* HexRule8::getFace(const Element* e, unsigned i)
         std::array<Node*, 4> nodes;
         for (unsigned j=0; j<4; j++)
             nodes[j] = const_cast<Node*>(e->getNode(face_nodes[i][j]));
-        return new Quad(nodes);
+        return new Quad(nodes, e->getID());
     }
     ERR("Error in MeshLib::Element::getFace() - Index %d does not exist.", i);
     return nullptr;
diff --git a/MeshLib/Elements/PrismRule15.cpp b/MeshLib/Elements/PrismRule15.cpp
index 81f2c6892cd..88c25ecd48f 100644
--- a/MeshLib/Elements/PrismRule15.cpp
+++ b/MeshLib/Elements/PrismRule15.cpp
@@ -51,7 +51,7 @@ const Element* PrismRule15::getFace(const Element* e, unsigned i)
             nodes[j] = const_cast<Node*>(e->getNode(face_nodes[i][j]));
 
         if (i == 0 || i == 4)
-            return new Tri6(nodes);
+            return new Tri6(nodes, e->getID());
 
         return new Quad8(nodes);
     }
diff --git a/MeshLib/Elements/PrismRule6.cpp b/MeshLib/Elements/PrismRule6.cpp
index 4389307bd67..726aed3cd03 100644
--- a/MeshLib/Elements/PrismRule6.cpp
+++ b/MeshLib/Elements/PrismRule6.cpp
@@ -53,7 +53,7 @@ const Element* PrismRule6::getFace(const Element* e, unsigned i)
             nodes[j] = const_cast<Node*>(e->getNode(face_nodes[i][j]));
 
         if (i == 0 || i == 4)
-            return new Tri(nodes);
+            return new Tri(nodes, e->getID());
 
         return new Quad(nodes);
     }
diff --git a/MeshLib/Elements/PyramidRule13.cpp b/MeshLib/Elements/PyramidRule13.cpp
index 721c37d504c..5842f84e0b2 100644
--- a/MeshLib/Elements/PyramidRule13.cpp
+++ b/MeshLib/Elements/PyramidRule13.cpp
@@ -50,9 +50,9 @@ const Element* PyramidRule13::getFace(const Element* e, unsigned i)
             nodes[j] = const_cast<Node*>(e->getNode(face_nodes[i][j]));
 
         if (i < 4)
-            return new Tri6(nodes);
+            return new Tri6(nodes, e->getID());
 
-        return new Quad8(nodes);
+        return new Quad8(nodes, e->getID());
     }
     ERR("Error in MeshLib::Element::getFace() - Index %d does not exist.", i);
     return nullptr;
diff --git a/MeshLib/Elements/PyramidRule5.cpp b/MeshLib/Elements/PyramidRule5.cpp
index ef9c4be0256..2ce5d7caa98 100644
--- a/MeshLib/Elements/PyramidRule5.cpp
+++ b/MeshLib/Elements/PyramidRule5.cpp
@@ -52,9 +52,9 @@ const Element* PyramidRule5::getFace(const Element* e, unsigned i)
             nodes[j] = const_cast<Node*>(e->getNode(face_nodes[i][j]));
 
         if (i < 4)
-            return new Tri(nodes);
+            return new Tri(nodes, e->getID());
 
-        return new Quad(nodes);
+        return new Quad(nodes, e->getID());
     }
     ERR("Error in MeshLib::Element::getFace() - Index %d does not exist.", i);
     return nullptr;
diff --git a/MeshLib/Elements/TetRule10.cpp b/MeshLib/Elements/TetRule10.cpp
index d951a72ead8..7fb95daae33 100644
--- a/MeshLib/Elements/TetRule10.cpp
+++ b/MeshLib/Elements/TetRule10.cpp
@@ -44,7 +44,7 @@ const Element* TetRule10::getFace(const Element* e, unsigned i)
         std::array<Node*,6> nodes;
         for (unsigned j=0; j<6; j++)
             nodes[j] = const_cast<Node*>(e->getNode(face_nodes[i][j]));
-        return new Tri6(nodes);
+        return new Tri6(nodes, e->getID());
     }
     ERR("Error in MeshLib::Element::getFace() - Index %d does not exist.", i);
     return nullptr;
diff --git a/MeshLib/Elements/TetRule4.cpp b/MeshLib/Elements/TetRule4.cpp
index ad6ef7b2811..893781cb739 100644
--- a/MeshLib/Elements/TetRule4.cpp
+++ b/MeshLib/Elements/TetRule4.cpp
@@ -46,7 +46,7 @@ const Element* TetRule4::getFace(const Element* e, unsigned i)
         std::array<Node*,3> nodes;
         for (unsigned j=0; j<3; j++)
             nodes[j] = const_cast<Node*>(e->getNode(face_nodes[i][j]));
-        return new Tri(nodes);
+        return new Tri(nodes, e->getID());
     }
     ERR("Error in MeshLib::Element::getFace() - Index %d does not exist.", i);
     return nullptr;
-- 
GitLab