From 04249ebf2de92fd4127459c8ac9f47f4e0f8768e Mon Sep 17 00:00:00 2001
From: Thomas Witkowski <thomas.witkowski@gmx.de>
Date: Tue, 21 Dec 2010 20:41:19 +0000
Subject: [PATCH] Fixed several very small problems in parallel code, part II.

---
 AMDiS/src/Element.h                       |  6 +++--
 AMDiS/src/Element.hh                      | 32 +++++++++++++++++++++++
 AMDiS/src/parallel/ElementObjectData.h    |  9 ++++---
 AMDiS/src/parallel/ParMetisPartitioner.cc |  7 +++--
 4 files changed, 47 insertions(+), 7 deletions(-)
 create mode 100644 AMDiS/src/Element.hh

diff --git a/AMDiS/src/Element.h b/AMDiS/src/Element.h
index b2faa2be..d10d704e 100644
--- a/AMDiS/src/Element.h
+++ b/AMDiS/src/Element.h
@@ -216,8 +216,8 @@ namespace AMDiS {
     virtual DofFace getFace(int localFaceIndex) const = 0;
 
     /// Returns either vertex, edge or face of the element.
-    template<typename T>
-    T getObject(int index);      
+/*     template<typename T> */
+/*     T getObject(int index);       */
 
     /// Returns the number of parts of type i in this element
     virtual int getGeo(GeoIndex i) const = 0;
@@ -619,5 +619,7 @@ namespace AMDiS {
   void writeDotFile(Element *el, std::string filename, int maxLevels = -1);
 }
 
+#include "Element.hh"
+
 #endif  // AMDIS_ELEMENT_H
 
diff --git a/AMDiS/src/Element.hh b/AMDiS/src/Element.hh
new file mode 100644
index 00000000..53d46b77
--- /dev/null
+++ b/AMDiS/src/Element.hh
@@ -0,0 +1,32 @@
+//
+// Software License for AMDiS
+//
+// Copyright (c) 2010 Dresden University of Technology 
+// All rights reserved.
+// Authors: Simon Vey, Thomas Witkowski et al.
+//
+// This file is part of AMDiS
+//
+// See also license.opensource.txt in the distribution.
+
+
+namespace AMDiS {
+  
+//   template<>
+//   DegreeOfFreedom Element::getObject<DegreeOfFreedom>(int index)
+//   {
+//     return dof[index][0];
+//   }
+
+//   template<>
+//   DofEdge Element::getObject<DofEdge>(int index)
+//   {
+//     return getEdge(index);
+//   }
+
+//   template<>
+//   DofFace Element::getObject<DofFace>(int index)
+//   {
+//     return getFace(index);
+//   }
+}
diff --git a/AMDiS/src/parallel/ElementObjectData.h b/AMDiS/src/parallel/ElementObjectData.h
index 6ba200f8..317b9de8 100644
--- a/AMDiS/src/parallel/ElementObjectData.h
+++ b/AMDiS/src/parallel/ElementObjectData.h
@@ -90,7 +90,8 @@ namespace AMDiS {
 
     void addVertex(Element *el, int ith, BoundaryType bound = INTERIOR)
     {
-      DegreeOfFreedom vertex = el->getObject<DegreeOfFreedom>(ith);
+      //    DegreeOfFreedom vertex = el->getObject<DegreeOfFreedom>(ith);
+      DegreeOfFreedom vertex = el->getDof(ith, 0);
       int elIndex = el->getIndex();
       ElementObjectData elObj(elIndex, ith, bound);
 
@@ -101,7 +102,8 @@ namespace AMDiS {
 
     void addEdge(Element *el, int ith, BoundaryType bound = INTERIOR)
     {
-      DofEdge edge = el->getObject<DofEdge>(ith);
+      //      DofEdge edge = el->getObject<DofEdge>(ith);
+      DofEdge edge = el->getEdge(ith);
       int elIndex = el->getIndex();
       ElementObjectData elObj(elIndex, ith, bound);
 
@@ -112,7 +114,8 @@ namespace AMDiS {
 
     void addFace(Element *el, int ith, BoundaryType bound = INTERIOR)
     {
-      DofFace face = el->getObject<DofFace>(ith);
+      //      DofFace face = el->getObject<DofFace>(ith);
+      DofFace face = el->getFace(ith);
       int elIndex = el->getIndex();
       ElementObjectData elObj(elIndex, ith, bound);
 
diff --git a/AMDiS/src/parallel/ParMetisPartitioner.cc b/AMDiS/src/parallel/ParMetisPartitioner.cc
index abd56da6..51df6a8f 100644
--- a/AMDiS/src/parallel/ParMetisPartitioner.cc
+++ b/AMDiS/src/parallel/ParMetisPartitioner.cc
@@ -97,10 +97,13 @@ namespace AMDiS {
 
 	// write eind entries (element nodes)
 	for (int i = 0; i < dim + 1; i++) {
-	  if (mapLocalGlobal)
+	  if (mapLocalGlobal) {
+	    TEST_EXIT_DBG(mapLocalGlobal->count(element->getDof(i, 0)))
+	      ("Should not happen!\n");
 	    *ptr_eind = (*mapLocalGlobal)[element->getDof(i, 0)];
-	  else
+	  } else {
 	    *ptr_eind = element->getDof(i, 0);
+	  }
 
 	  ptr_eind++;
 	}
-- 
GitLab