From 231692b533c3da896c57a0b17492d769989f75e6 Mon Sep 17 00:00:00 2001
From: Thomas Witkowski <thomas.witkowski@gmx.de>
Date: Tue, 9 Nov 2010 13:45:19 +0000
Subject: [PATCH] Work on arh reader-writer.

---
 AMDiS/libtool                  | 16 ++++++++--------
 AMDiS/src/ArhReader.cc         |  3 ++-
 AMDiS/src/Debug.cc             |  4 ++--
 AMDiS/src/Debug.h              |  2 +-
 AMDiS/src/MeshStructure.cc     | 19 +++++++++++++++----
 AMDiS/src/MeshStructure.h      |  3 ++-
 AMDiS/src/RefinementManager.cc |  1 -
 7 files changed, 30 insertions(+), 18 deletions(-)

diff --git a/AMDiS/libtool b/AMDiS/libtool
index 730f91e3..e3aa9300 100755
--- a/AMDiS/libtool
+++ b/AMDiS/libtool
@@ -128,7 +128,7 @@ old_postinstall_cmds="chmod 644 \$oldlib~\$RANLIB \$oldlib"
 old_postuninstall_cmds=""
 
 # A C compiler.
-LTCC="/usr/lib64/mpi/gcc/openmpi//bin/mpicc"
+LTCC="gcc"
 
 # LTCC compiler flags.
 LTCFLAGS="-g -O2"
@@ -259,7 +259,7 @@ LD="/usr/x86_64-suse-linux/bin/ld -m elf_x86_64"
 old_archive_cmds="\$AR \$AR_FLAGS \$oldlib\$oldobjs~\$RANLIB \$oldlib"
 
 # A language specific compiler.
-CC="/usr/lib64/mpi/gcc/openmpi//bin/mpicc"
+CC="gcc"
 
 # Is the compiler the GNU compiler?
 with_gcc=yes
@@ -274,7 +274,7 @@ wl="-Wl,"
 pic_flag=" -fPIC -DPIC"
 
 # Compiler flag to prevent dynamic linking.
-link_static_flag=""
+link_static_flag="-static"
 
 # Does compiler simultaneously support -c and -o options?
 compiler_c_o="yes"
@@ -8914,7 +8914,7 @@ LD="/usr/x86_64-suse-linux/bin/ld -m elf_x86_64"
 old_archive_cmds="\$AR \$AR_FLAGS \$oldlib\$oldobjs~\$RANLIB \$oldlib"
 
 # A language specific compiler.
-CC="/usr/lib64/mpi/gcc/openmpi//bin/mpicxx"
+CC="g++"
 
 # Is the compiler the GNU compiler?
 with_gcc=yes
@@ -8929,7 +8929,7 @@ wl="-Wl,"
 pic_flag=" -fPIC -DPIC"
 
 # Compiler flag to prevent dynamic linking.
-link_static_flag=""
+link_static_flag="-static"
 
 # Does compiler simultaneously support -c and -o options?
 compiler_c_o="yes"
@@ -9039,17 +9039,17 @@ file_list_spec=""
 hardcode_action=immediate
 
 # The directories searched by this compiler when creating a shared library.
-compiler_lib_search_dirs="/usr/lib64/mpi/gcc/openmpi/lib64 /usr/lib64/gcc/x86_64-suse-linux/4.5 /usr/lib64/gcc/x86_64-suse-linux/4.5/../../../../lib64 /lib/../lib64 /usr/lib/../lib64 /usr/lib64/gcc/x86_64-suse-linux/4.5/../../../../x86_64-suse-linux/lib /usr/lib64/gcc/x86_64-suse-linux/4.5/../../.."
+compiler_lib_search_dirs="/usr/lib64/gcc/x86_64-suse-linux/4.5 /usr/lib64/gcc/x86_64-suse-linux/4.5/../../../../lib64 /lib/../lib64 /usr/lib/../lib64 /usr/lib64/gcc/x86_64-suse-linux/4.5/../../../../x86_64-suse-linux/lib /usr/lib64/gcc/x86_64-suse-linux/4.5/../../.."
 
 # Dependencies to place before and after the objects being linked to
 # create a shared library.
 predep_objects="/usr/lib64/gcc/x86_64-suse-linux/4.5/../../../../lib64/crti.o /usr/lib64/gcc/x86_64-suse-linux/4.5/crtbeginS.o"
 postdep_objects="/usr/lib64/gcc/x86_64-suse-linux/4.5/crtendS.o /usr/lib64/gcc/x86_64-suse-linux/4.5/../../../../lib64/crtn.o"
 predeps=""
-postdeps="-lmpi_cxx -lmpi -lopen-rte -lopen-pal -ldl -lnsl -lutil -ldl -lstdc++ -lm -lgcc_s -lpthread -lc -lgcc_s"
+postdeps="-lstdc++ -lm -lgcc_s -lc -lgcc_s"
 
 # The library search path used internally by the compiler when linking
 # a shared library.
-compiler_lib_search_path="-L/usr/lib64/mpi/gcc/openmpi/lib64 -L/usr/lib64/gcc/x86_64-suse-linux/4.5 -L/usr/lib64/gcc/x86_64-suse-linux/4.5/../../../../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/usr/lib64/gcc/x86_64-suse-linux/4.5/../../../../x86_64-suse-linux/lib -L/usr/lib64/gcc/x86_64-suse-linux/4.5/../../.."
+compiler_lib_search_path="-L/usr/lib64/gcc/x86_64-suse-linux/4.5 -L/usr/lib64/gcc/x86_64-suse-linux/4.5/../../../../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/usr/lib64/gcc/x86_64-suse-linux/4.5/../../../../x86_64-suse-linux/lib -L/usr/lib64/gcc/x86_64-suse-linux/4.5/../../.."
 
 # ### END LIBTOOL TAG CONFIG: CXX
diff --git a/AMDiS/src/ArhReader.cc b/AMDiS/src/ArhReader.cc
index 47ab1a9a..02ca76ca 100644
--- a/AMDiS/src/ArhReader.cc
+++ b/AMDiS/src/ArhReader.cc
@@ -51,7 +51,8 @@ namespace AMDiS {
 
       MeshStructure elementStructure;
       elementStructure.init(structureCode, codeSize);
-      elementStructure.fitMeshToStructure(mesh, refManager, false, false, elIndex);
+      elementStructure.fitMeshToStructure(mesh, refManager, 
+					  false, false, elIndex, true);
 
       long nValuesPerVector = 0;
       file.read(reinterpret_cast<char*>(&nValuesPerVector), 4);
diff --git a/AMDiS/src/Debug.cc b/AMDiS/src/Debug.cc
index 627ee244..645bcf77 100644
--- a/AMDiS/src/Debug.cc
+++ b/AMDiS/src/Debug.cc
@@ -500,9 +500,9 @@ namespace AMDiS {
     }
 
 
-    void printElementRefinementSequenz(Mesh *mesh, Element *el)
+    void printElementRefinementSequence(Mesh *mesh, Element *el)
     {
-      FUNCNAME("printElementRefinementSequenz()");
+      FUNCNAME("printElementRefinementSequence()");
 
       int elIndex = el->getIndex();
       std::vector<int> refSeq;
diff --git a/AMDiS/src/Debug.h b/AMDiS/src/Debug.h
index f383789d..6c383162 100644
--- a/AMDiS/src/Debug.h
+++ b/AMDiS/src/Debug.h
@@ -137,7 +137,7 @@ namespace AMDiS {
 
     void printElementHierarchie(Mesh *mesh, int elIndex);    
 
-    void printElementRefinementSequenz(Mesh *mesh, Element *el);
+    void printElementRefinementSequence(Mesh *mesh, Element *el);
 
     int getLocalNeighbourIndex(Mesh *mesh, int elIndex, int neighIndex);
 
diff --git a/AMDiS/src/MeshStructure.cc b/AMDiS/src/MeshStructure.cc
index 93330cc8..6b35675c 100644
--- a/AMDiS/src/MeshStructure.cc
+++ b/AMDiS/src/MeshStructure.cc
@@ -6,6 +6,7 @@
 #include "Traverse.h"
 #include "ElInfo.h"
 #include "RefinementManager.h"
+#include "Debug.h"
 
 namespace AMDiS {
 
@@ -227,7 +228,8 @@ namespace AMDiS {
 					 RefinementManager *manager,
 					 bool checkPartition,
 					 bool debugMode,
-					 int macroElIndex) 
+					 int macroElIndex,
+					 bool ignoreFinerMesh) 
   {
     FUNCNAME("MeshStructure::fitMeshToStructure()");
 
@@ -249,8 +251,16 @@ namespace AMDiS {
       TEST_EXIT(cont)("unexpected structure code end!\n");
 
       if (isLeafElement()) {
-	TEST_EXIT(element->isLeaf())("mesh finer than code\n");
-      }
+	if (ignoreFinerMesh && !element->isLeaf()) {
+	  int level = elInfo->getLevel();
+	  while (elInfo && level >= elInfo->getLevel())
+	    elInfo = stack.traverseNext(elInfo);
+	} else {
+	  TEST_EXIT(element->isLeaf())
+	    ("Mesh is finer than strucutre code! (Element index: %d\n", 
+	     element->getIndex());	
+	}
+      } 
 
       if (element->isLeaf() && !isLeafElement()) {
 	MeshStructure *structure = new MeshStructure();
@@ -278,7 +288,8 @@ namespace AMDiS {
 	cont = nextElement();
       }
 
-      elInfo = stack.traverseNext(elInfo);
+      if (elInfo)
+	elInfo = stack.traverseNext(elInfo);
     }
 
     // refine mesh
diff --git a/AMDiS/src/MeshStructure.h b/AMDiS/src/MeshStructure.h
index 92ecc264..c50bb7df 100644
--- a/AMDiS/src/MeshStructure.h
+++ b/AMDiS/src/MeshStructure.h
@@ -111,7 +111,8 @@ namespace AMDiS {
 			    RefinementManager *manager,
 			    bool checkPartition = false,
 			    bool debugMode = false,
-			    int macroElIndex = -1);
+			    int macroElIndex = -1,
+			    bool ignoreFinerMesh = false);
 
     /// Prints the mesh structure code.
     void print(bool resetCode = true); 
diff --git a/AMDiS/src/RefinementManager.cc b/AMDiS/src/RefinementManager.cc
index 5cd4e94c..133151ad 100644
--- a/AMDiS/src/RefinementManager.cc
+++ b/AMDiS/src/RefinementManager.cc
@@ -93,7 +93,6 @@ namespace AMDiS {
 			   Mesh::CALL_LEAF_EL | Mesh::FILL_NEIGH | Mesh::FILL_BOUND);
     while (elInfo) {
       if (elInfo->getElement() == el) {
-	MSG("REFINE EL IN HERE\n");
 	refineFunction(elInfo);
 
 	TEST_EXIT(!doMoreRecursiveRefine)("Okay, this will not work in that way!\n");
-- 
GitLab