From ad9d130fd4cf443a514b68f017e14e00089c04fb Mon Sep 17 00:00:00 2001
From: Thomas Witkowski <thomas.witkowski@gmx.de>
Date: Thu, 4 Feb 2010 14:24:03 +0000
Subject: [PATCH] Added some debug information and functions.

---
 AMDiS/libtool           |  6 +++---
 AMDiS/src/Debug.cc      | 16 ++++++++++++++++
 AMDiS/src/Debug.h       |  2 ++
 AMDiS/src/PeriodicBC.cc | 14 +++++++-------
 AMDiS/src/PeriodicBC.h  |  2 --
 AMDiS/src/ProblemVec.cc |  2 +-
 6 files changed, 29 insertions(+), 13 deletions(-)

diff --git a/AMDiS/libtool b/AMDiS/libtool
index f2a0b780..b33f6fac 100755
--- a/AMDiS/libtool
+++ b/AMDiS/libtool
@@ -44,7 +44,7 @@ available_tags=" CXX F77"
 
 # ### BEGIN LIBTOOL CONFIG
 
-# Libtool was configured on host p2q055:
+# Libtool was configured on host p1s122:
 
 # Shell to use when invoking shell scripts.
 SHELL="/bin/sh"
@@ -6760,7 +6760,7 @@ build_old_libs=`case $build_libtool_libs in yes) $echo no;; *) $echo yes;; esac`
 # End:
 # ### BEGIN LIBTOOL TAG CONFIG: CXX
 
-# Libtool was configured on host p2q055:
+# Libtool was configured on host p1s122:
 
 # Shell to use when invoking shell scripts.
 SHELL="/bin/sh"
@@ -7065,7 +7065,7 @@ include_expsyms=""
 
 # ### BEGIN LIBTOOL TAG CONFIG: F77
 
-# Libtool was configured on host p2q055:
+# Libtool was configured on host p1s122:
 
 # Shell to use when invoking shell scripts.
 SHELL="/bin/sh"
diff --git a/AMDiS/src/Debug.cc b/AMDiS/src/Debug.cc
index cbf8a68b..7f6cae6a 100644
--- a/AMDiS/src/Debug.cc
+++ b/AMDiS/src/Debug.cc
@@ -3,6 +3,7 @@
 #include "DOFVector.h"
 #include "MacroElement.h"
 #include "VtkWriter.h"
+#include "ElementFileWriter.h"
 
 namespace AMDiS {
 
@@ -175,6 +176,21 @@ namespace AMDiS {
 		  << it->second << std::endl;
     }
 
+    void writeElementIndexMesh(FiniteElemSpace *feSpace, std::string filename)
+    {
+      std::map<int, double> vec;    
+      TraverseStack stack;
+      ElInfo *elInfo = stack.traverseFirst(feSpace->getMesh(), -1, Mesh::CALL_LEAF_EL);
+      
+      while (elInfo) {		  
+	int index = elInfo->getElement()->getIndex();
+	vec[index] = index;
+	elInfo = stack.traverseNext(elInfo);
+      }
+
+      ElementFileWriter::writeFile(vec, feSpace, filename);
+    }
+
   } // namespace debug
   
 } // namespace AMDiS
diff --git a/AMDiS/src/Debug.h b/AMDiS/src/Debug.h
index 42cc34db..07e30a83 100644
--- a/AMDiS/src/Debug.h
+++ b/AMDiS/src/Debug.h
@@ -49,6 +49,8 @@ namespace AMDiS {
     void printInfoByDof(FiniteElemSpace *feSpace, DegreeOfFreedom dof);
 
     void printMatValuesStatistics(Matrix<DOFMatrix*> *mat);
+
+    void writeElementIndexMesh(FiniteElemSpace *feSpace, std::string filename);
   }
 }
 
diff --git a/AMDiS/src/PeriodicBC.cc b/AMDiS/src/PeriodicBC.cc
index 35396e73..3e989034 100644
--- a/AMDiS/src/PeriodicBC.cc
+++ b/AMDiS/src/PeriodicBC.cc
@@ -107,9 +107,6 @@ namespace AMDiS {
       
       TEST_EXIT(associated)("No associations for periodic boundary condition %d!\n",
 			    boundaryType);
-
-      const BasisFunction *basFcts = rowFESpace->getBasisFcts();
-      neighIndices = new DegreeOfFreedom[basFcts->getNumber()];
     }
   }
 
@@ -119,6 +116,8 @@ namespace AMDiS {
 					 const BoundaryType *localBound,
 					 int nBasFcts)
   {
+    FUNCNAME("PeriodicBC::fillBoundaryCondition()");
+
     if (matrix == masterMatrix) {
   
       int dim = rowFESpace->getMesh()->getDim();
@@ -132,6 +131,7 @@ namespace AMDiS {
 	Element *element = elInfo->getElement();
 	DimVec<DegreeOfFreedom> periodicDOFs(dim - 1, NO_INIT);
 	GeoIndex sideGeoIndex = INDEX_OF_DIM(dim - 1, dim);
+	std::vector<DegreeOfFreedom> neighIndices(num);
 
 	for (int side = 0; side < dim + 1; side++) {
 
@@ -143,6 +143,8 @@ namespace AMDiS {
 	    }
 
 	    Element *neigh = elInfo->getNeighbour(side);
+	    TEST_EXIT_DBG(neigh)("Wrong neighbour information at side %d!\n", side);
+
 	    basFcts->getLocalIndices(neigh, admin, neighIndices);
 
 	    int oppVertex = 0;
@@ -185,10 +187,8 @@ namespace AMDiS {
 
     TEST_EXIT(matrix)("no matrix\n");
 
-    if (matrix == masterMatrix) {
-      delete [] neighIndices;
-      masterMatrix = NULL;
-    }
+    if (matrix == masterMatrix)
+      masterMatrix = NULL;    
 
     using namespace mtl;
 
diff --git a/AMDiS/src/PeriodicBC.h b/AMDiS/src/PeriodicBC.h
index c58cb8ba..31a00116 100644
--- a/AMDiS/src/PeriodicBC.h
+++ b/AMDiS/src/PeriodicBC.h
@@ -107,8 +107,6 @@ namespace AMDiS {
 
     PeriodicDOFMapping *periodicDOFMapping;
 
-    DegreeOfFreedom *neighIndices;
-
     DOFMatrix *masterMatrix;
   };
 
diff --git a/AMDiS/src/ProblemVec.cc b/AMDiS/src/ProblemVec.cc
index b0415125..b9d69f28 100644
--- a/AMDiS/src/ProblemVec.cc
+++ b/AMDiS/src/ProblemVec.cc
@@ -641,7 +641,7 @@ namespace AMDiS {
 
     if (useGetBound)
       assembleFlag |= Mesh::FILL_BOUND;
-
+   
     traverseInfo.updateStatus();
 
     // Used to calculate the overall number of non zero entries.
-- 
GitLab