From 3f1c87ca474e4c1b40ea452f9ee1caacb020466b Mon Sep 17 00:00:00 2001
From: Thomas Witkowski <thomas.witkowski@gmx.de>
Date: Mon, 11 Apr 2011 15:18:00 +0000
Subject: [PATCH] Added some new debug functions.

---
 AMDiS/src/AdaptInstationary.cc | 10 +++++-----
 AMDiS/src/Debug.cc             | 18 ++++++++++++++++++
 AMDiS/src/Debug.h              |  2 ++
 AMDiS/src/Marker.cc            |  2 ++
 4 files changed, 27 insertions(+), 5 deletions(-)

diff --git a/AMDiS/src/AdaptInstationary.cc b/AMDiS/src/AdaptInstationary.cc
index 8f20a949..786e2468 100644
--- a/AMDiS/src/AdaptInstationary.cc
+++ b/AMDiS/src/AdaptInstationary.cc
@@ -154,15 +154,15 @@ namespace AMDiS {
       problemIteration->oneIteration(adaptInfo, NO_ADAPTION);
 
       adaptInfo->incTimestepIteration();
-   
+
       if (!fixedTimestep && 
 	  !adaptInfo->timeToleranceReached() &&
 	  adaptInfo->getTimestepIteration() <= adaptInfo->getMaxTimestepIteration() &&
 	  !(adaptInfo->getTimestep() <= adaptInfo->getMinTimestep())) {
-	  
-	  adaptInfo->setTime(adaptInfo->getTime() - adaptInfo->getTimestep());
-	  adaptInfo->setTimestep(adaptInfo->getTimestep() * timeDelta1);
-	  continue;
+  
+	adaptInfo->setTime(adaptInfo->getTime() - adaptInfo->getTimestep());
+	adaptInfo->setTimestep(adaptInfo->getTimestep() * timeDelta1);
+	continue;
       }
 
 
diff --git a/AMDiS/src/Debug.cc b/AMDiS/src/Debug.cc
index 23d3cc3d..ca4f4ff1 100644
--- a/AMDiS/src/Debug.cc
+++ b/AMDiS/src/Debug.cc
@@ -136,6 +136,24 @@ namespace AMDiS {
     }
 
 
+    void colorMeshByMacroIndex(Mesh *mesh, std::string filename)
+    {
+      FUNCNAME("debug::colorMeshByMacroIndex()");
+
+      std::map<int, double> vec;    
+      TraverseStack stack;
+      ElInfo *elInfo = stack.traverseFirst(mesh, -1, Mesh::CALL_LEAF_EL);
+      
+      while (elInfo) {		  
+	int index = elInfo->getElement()->getIndex();
+	vec[index] = elInfo->getMacroElement()->getIndex();
+	elInfo = stack.traverseNext(elInfo);
+      }
+
+      ElementFileWriter::writeFile(vec, mesh, filename);
+    }
+
+
     void colorDofVectorByLocalElementDofs(DOFVector<double>& vec, Element *el)
     {
       // === Get local indices of the given element. ===
diff --git a/AMDiS/src/Debug.h b/AMDiS/src/Debug.h
index bdabf133..3467f9b7 100644
--- a/AMDiS/src/Debug.h
+++ b/AMDiS/src/Debug.h
@@ -84,6 +84,8 @@ namespace AMDiS {
 
     void highlightElementIndexMesh(Mesh *mesh, int idx, std::string filename);
 
+    void colorMeshByMacroIndex(Mesh *mesh, std::string filename);
+
     void colorDofVectorByLocalElementDofs(DOFVector<double>& vec, Element *el);
     
     bool colorDofVectorByLocalElementDofs(DOFVector<double>& vec, 
diff --git a/AMDiS/src/Marker.cc b/AMDiS/src/Marker.cc
index eedc48e3..c918438f 100644
--- a/AMDiS/src/Marker.cc
+++ b/AMDiS/src/Marker.cc
@@ -72,6 +72,8 @@ namespace AMDiS {
 
   void Marker::markElement(AdaptInfo *adaptInfo, ElInfo *elInfo) 
   {
+    FUNCNAME("Marker::markElement()");
+
     Element *el = elInfo->getElement();
     double lError = el->getEstimation(row);
 
-- 
GitLab