From b7904dfa50f6bc3fc458241ff8033b8564132434 Mon Sep 17 00:00:00 2001
From: Karsten Rink <karsten.rink@ufz.de>
Date: Tue, 4 Sep 2012 09:32:08 +0200
Subject: [PATCH] testing static functions as friend functions; added another
 OpenMP loop in mesh class

---
 MeshLib/Mesh.cpp    | 8 +++++++-
 MeshLib/MshEditor.h | 2 +-
 MeshLib/Node.h      | 3 ++-
 3 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/MeshLib/Mesh.cpp b/MeshLib/Mesh.cpp
index c332dc66b73..4a97bee3a82 100644
--- a/MeshLib/Mesh.cpp
+++ b/MeshLib/Mesh.cpp
@@ -119,7 +119,13 @@ void Mesh::setDimension()
 void Mesh::setElementInformationForNodes()
 {
 	const size_t nElements (_elements.size());
-	for (unsigned i=0; i<nElements; i++)
+#ifdef _OPENMP
+	OPENMP_LOOP_TYPE i;
+	#pragma omp parallel for
+#else
+	unsigned i(0)
+#endif
+	for (i=0; i<nElements; i++)
 	{
 		const unsigned nNodes (_elements[i]->getNNodes());
 		for (unsigned j=0; j<nNodes; j++)
diff --git a/MeshLib/MshEditor.h b/MeshLib/MshEditor.h
index 083daba110d..3c3323e049a 100644
--- a/MeshLib/MshEditor.h
+++ b/MeshLib/MshEditor.h
@@ -39,7 +39,7 @@ public:
 	static void getSurfaceAreaForNodes(const MeshLib::Mesh* mesh, std::vector<double> &node_area_vec);
 
 	/// Removes the mesh nodes (and connected elements) given in the nodes-list from the mesh.
-	MeshLib::Mesh* removeMeshNodes(MeshLib::Mesh* mesh, const std::vector<size_t> &nodes);
+	static MeshLib::Mesh* removeMeshNodes(MeshLib::Mesh* mesh, const std::vector<size_t> &nodes);
 
 	/// Returns the surface nodes of a layered mesh.
 	static std::vector<GeoLib::PointWithID*> getSurfaceNodes(const MeshLib::Mesh &mesh);
diff --git a/MeshLib/Node.h b/MeshLib/Node.h
index cc996c11e46..05a50e56a94 100644
--- a/MeshLib/Node.h
+++ b/MeshLib/Node.h
@@ -19,6 +19,7 @@
 
 #include "PointWithID.h"
 #include "Mesh.h"
+#include "MshEditor.h"
 
 namespace MeshLib {
 
@@ -30,9 +31,9 @@ class Element;
 class Node : public GeoLib::PointWithID
 {
 	/* friend functions: */
+	friend MeshLib::Mesh* MshEditor::removeMeshNodes(MeshLib::Mesh* mesh, const std::vector<size_t> &nodes);
 	/* friend classes: */
 	friend class Mesh;
-	friend class MshEditor;
 	friend class MeshCoarsener;
 	friend class MshLayerMapper;
 
-- 
GitLab