From 3ee08357dcdb66832df31dc8d62aa02ca6337f84 Mon Sep 17 00:00:00 2001
From: Thomas Witkowski <thomas.witkowski@gmx.de>
Date: Wed, 1 Oct 2008 09:11:28 +0000
Subject: [PATCH] * Small bugfixes

---
 AMDiS/src/SolutionDataStorage.h  | 16 ++++++++++++++++
 AMDiS/src/SolutionDataStorage.hh |  3 +--
 2 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/AMDiS/src/SolutionDataStorage.h b/AMDiS/src/SolutionDataStorage.h
index 8d64cc98..15319ac1 100644
--- a/AMDiS/src/SolutionDataStorage.h
+++ b/AMDiS/src/SolutionDataStorage.h
@@ -88,6 +88,22 @@ namespace AMDiS {
       feSpaces.empty();
     }
 
+    int addMemoryUsage(FiniteElemSpace* feSpace) {
+      memoryUsage += feSpace->getMesh()->calcMemoryUsage();
+    }
+
+    int addMemoryUsage(std::vector<FiniteElemSpace*> feSpaces) {
+      // Is used to determine equal meshes for different components.
+      std::vector<Mesh*> meshes;
+
+      for (int i = 0; i < static_cast<int>(feSpaces.size()); i++) {
+	if (find(meshes.begin(), meshes.end(), feSpaces[i]->getMesh()) != meshes.end()) {
+	  memoryUsage += feSpaces[i]->getMesh()->calcMemoryUsage();
+	  meshes.push_back(feSpaces[i]->getMesh());
+	}
+      }
+    }
+
     /** \brief
      * Deletes all pointers and empties all internal vectors.
      */
diff --git a/AMDiS/src/SolutionDataStorage.hh b/AMDiS/src/SolutionDataStorage.hh
index a725e2bf..62e810f1 100644
--- a/AMDiS/src/SolutionDataStorage.hh
+++ b/AMDiS/src/SolutionDataStorage.hh
@@ -36,8 +36,7 @@ namespace AMDiS {
     fixedFESpace = true;
     feSpaces.push_back(feSpace);
 
-    std::cout << "MESH = " << static_cast<double>(feSpace[0]->getMesh()->calcMemoryUsage()) / (1024.0 * 1024.0) << std::endl;
-    WAIT_REALLY;
+    addMemoryUsage(feSpace);
   }
 
   template<typename T>
-- 
GitLab