From 8812f2ffacbbd6bba4f70118c8adb508e2c70c64 Mon Sep 17 00:00:00 2001
From: Thomas Fischer <thomas.fischer@ufz.de>
Date: Wed, 18 Mar 2015 10:21:03 +0100
Subject: [PATCH] [MeL/ME] Returning number of new cells instead of bool.

The number of new cells is used later on.
---
 MeshLib/MeshEditing/MeshRevision.cpp | 13 ++++++-------
 MeshLib/MeshEditing/MeshRevision.h   | 10 +++++++++-
 2 files changed, 15 insertions(+), 8 deletions(-)

diff --git a/MeshLib/MeshEditing/MeshRevision.cpp b/MeshLib/MeshEditing/MeshRevision.cpp
index b6d720f0f0c..0e6efb7f379 100644
--- a/MeshLib/MeshEditing/MeshRevision.cpp
+++ b/MeshLib/MeshEditing/MeshRevision.cpp
@@ -227,21 +227,20 @@ void MeshRevision::resetNodeIDs()
 		nodes[i]->setID(i);
 }
 
-bool MeshRevision::subdivideElement(
+std::size_t MeshRevision::subdivideElement(
 	MeshLib::Element const*const element,
 	std::vector<MeshLib::Node*> const& nodes,
 	std::vector<MeshLib::Element*> & elements) const
 {
-	unsigned n_new_elems (0);
 	if (element->getGeomType() == MeshElemType::QUAD)
-		n_new_elems = this->subdivideQuad(element, nodes, elements);
+		return this->subdivideQuad(element, nodes, elements);
 	else if (element->getGeomType() == MeshElemType::HEXAHEDRON)
-		n_new_elems = this->subdivideHex(element, nodes, elements);
+		return this->subdivideHex(element, nodes, elements);
 	else if (element->getGeomType() == MeshElemType::PYRAMID)
-		n_new_elems = this->subdividePyramid(element, nodes, elements);
+		return this->subdividePyramid(element, nodes, elements);
 	else if (element->getGeomType() == MeshElemType::PRISM)
-		n_new_elems = this->subdividePrism(element, nodes, elements);
-	return (n_new_elems > 0);
+		return this->subdividePrism(element, nodes, elements);
+	return 0;
 }
 
 void MeshRevision::reduceElement(MeshLib::Element const*const element,
diff --git a/MeshLib/MeshEditing/MeshRevision.h b/MeshLib/MeshEditing/MeshRevision.h
index 7c9b3ceb3de..621a476a04c 100644
--- a/MeshLib/MeshEditing/MeshRevision.h
+++ b/MeshLib/MeshEditing/MeshRevision.h
@@ -85,7 +85,15 @@ private:
 	void resetNodeIDs();
 
 	/// Subdivides an element if it has a face that is not coplanar
-	bool subdivideElement(MeshLib::Element const*const element, const std::vector<MeshLib::Node*> &nodes, std::vector<MeshLib::Element*> &elements) const;
+	/// @param element the element that will be subdivided
+	/// @param nodes vector containing the nodes the elements originated by the
+	/// subdivision are based on
+	/// @param elements vector of MeshLib::Elements; the elements originated by
+	/// the subdivision will be inserted into elements
+	/// @return the number of elements originated by the subdivision
+	std::size_t subdivideElement(MeshLib::Element const*const element,
+		std::vector<MeshLib::Node*> const& nodes,
+		std::vector<MeshLib::Element*> & elements) const;
 
 	// Revises an element by removing collapsed nodes, using the nodes vector from the result mesh.
 	void reduceElement(MeshLib::Element const*const element,
-- 
GitLab