From d3414e950b9edbe406d466d31a44db09daf90f5c Mon Sep 17 00:00:00 2001
From: Norihiro Watanabe <norihiro.watanabe@ufz.de>
Date: Thu, 25 Sep 2014 12:21:54 +0200
Subject: [PATCH] use Element::isBoundaryElement()

---
 MeshGeoToolsLib/BoundaryElementsAlongPolyline.cpp |  9 +--------
 MeshGeoToolsLib/BoundaryElementsOnSurface.cpp     | 11 ++---------
 2 files changed, 3 insertions(+), 17 deletions(-)

diff --git a/MeshGeoToolsLib/BoundaryElementsAlongPolyline.cpp b/MeshGeoToolsLib/BoundaryElementsAlongPolyline.cpp
index a35dca0f875..a1c81763bb9 100644
--- a/MeshGeoToolsLib/BoundaryElementsAlongPolyline.cpp
+++ b/MeshGeoToolsLib/BoundaryElementsAlongPolyline.cpp
@@ -34,14 +34,7 @@ BoundaryElementsAlongPolyline::BoundaryElementsAlongPolyline(MeshLib::Mesh const
 	for (auto ele_id : ele_ids_near_ply) {
 		auto* e = _mesh.getElement(ele_id);
 		// skip internal elements
-		bool isOuterElement = false;
-		for (unsigned i=0; i<e->getNNeighbors(); i++) {
-			if (!e->getNeighbor(i)) {
-				isOuterElement = true;
-				break;
-			}
-		}
-		if (!isOuterElement)
+		if (!e->isBoundaryElement())
 			continue;
 		// find edges on the polyline
 		for (unsigned i=0; i<e->getNEdges(); i++) {
diff --git a/MeshGeoToolsLib/BoundaryElementsOnSurface.cpp b/MeshGeoToolsLib/BoundaryElementsOnSurface.cpp
index 5ebefefcaa5..e6ddc9241f5 100644
--- a/MeshGeoToolsLib/BoundaryElementsOnSurface.cpp
+++ b/MeshGeoToolsLib/BoundaryElementsOnSurface.cpp
@@ -26,18 +26,11 @@ BoundaryElementsOnSurface::BoundaryElementsOnSurface(MeshLib::Mesh const& mesh,
 	auto node_ids_on_sfc = mshNodeSearcher.getMeshNodeIDsAlongSurface(sfc);
 	auto ele_ids_near_sfc = MeshLib::getConnectedElementIDs(_mesh, node_ids_on_sfc);
 
-	// get a list of edges made of the nodes
+	// get a list of faces made of the nodes
 	for (auto ele_id : ele_ids_near_sfc) {
 		auto* e = _mesh.getElement(ele_id);
 		// skip internal elements
-		bool isOuterElement = false;
-		for (unsigned i=0; i<e->getNNeighbors(); i++) {
-			if (!e->getNeighbor(i)) {
-				isOuterElement = true;
-				break;
-			}
-		}
-		if (!isOuterElement)
+		if (!e->isBoundaryElement())
 			continue;
 		// find faces on surface
 		for (unsigned i=0; i<e->getNFaces(); i++) {
-- 
GitLab