From 5c44035b1b511aa7eb75f082fa3ebc797817a528 Mon Sep 17 00:00:00 2001
From: Thomas Witkowski <thomas.witkowski@gmx.de>
Date: Fri, 1 Jun 2012 08:46:17 +0000
Subject: [PATCH] Fixed some BDDCML issues.

---
 AMDiS/AMDISConfig.cmake.in         |  2 +-
 AMDiS/AMDISUse.cmake               |  2 +-
 AMDiS/CMakeLists.txt               |  4 ++++
 AMDiS/src/parallel/BddcMlSolver.cc | 25 ++++++++++++++++---------
 AMDiS/src/parallel/BddcMlSolver.h  |  2 ++
 5 files changed, 24 insertions(+), 11 deletions(-)

diff --git a/AMDiS/AMDISConfig.cmake.in b/AMDiS/AMDISConfig.cmake.in
index 7e106f27..48082712 100644
--- a/AMDiS/AMDISConfig.cmake.in
+++ b/AMDiS/AMDISConfig.cmake.in
@@ -149,7 +149,7 @@ if(AMDIS_NEED_PNG)
 		message(FATAL_ERROR "Could not find the PNG library")
 	endif()
 endif(AMDIS_NEED_PNG)
-	
+
 if(AMDIS_NEED_BDDCML)
 	set(AMDIS_BDDCML_PATH @BDDCML_PATH@)
 	list(APPEND AMDIS_INCLUDE_DIRS ${AMDIS_BDDCML_PATH})
diff --git a/AMDiS/AMDISUse.cmake b/AMDiS/AMDISUse.cmake
index 5023e47a..71a4f233 100644
--- a/AMDiS/AMDISUse.cmake
+++ b/AMDiS/AMDISUse.cmake
@@ -6,7 +6,7 @@ if(AMDIS_HAS_PARALLEL_DOMAIN)
 		list(APPEND AMDIS_COMPILEFLAGS ${MPI_COMPILE_FLAGS})
 		list(APPEND AMDIS_INCLUDE_DIRS ${MPI_INCLUDE_PATH})
 	endif(MPI_FOUND)
-	if(AMDIS_HAS_PARALLEL_DOMAIN STREQUAL "PETSC")
+	if(AMDIS_HAS_PARALLEL_DOMAIN STREQUAL "PETSC")		
 		set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${AMDIS_DIR})
 		set(PETSC_EXECUTABLE_RUNS ON)
 		find_package(PETSc REQUIRED)
diff --git a/AMDiS/CMakeLists.txt b/AMDiS/CMakeLists.txt
index ada20bcd..4e915476 100644
--- a/AMDiS/CMakeLists.txt
+++ b/AMDiS/CMakeLists.txt
@@ -327,6 +327,10 @@ if(ENABLE_BDDCML)
 		message(FATAL_ERROR "Could not find the BDDCML library")
 	endif()
 
+
+	find_file(BLOPEX_PATH blopex
+			      HINTS ENV CPATH
+			      DOC "Path to BLOPEX library.")
 endif(ENABLE_BDDCML)
 
 
diff --git a/AMDiS/src/parallel/BddcMlSolver.cc b/AMDiS/src/parallel/BddcMlSolver.cc
index fba64a46..6ad4bbdb 100644
--- a/AMDiS/src/parallel/BddcMlSolver.cc
+++ b/AMDiS/src/parallel/BddcMlSolver.cc
@@ -89,7 +89,8 @@ namespace AMDiS {
     MSG("nelem = %d\n", nelem);
 
     // global number of nodes
-    int nnod = meshDistributor->getNumberOverallDofs(feSpace);
+    ParallelDofMapping &dofMap = meshDistributor->getDofMap();
+    int nnod = dofMap[feSpace].nOverallDofs;
     
     MSG("nnod = %d\n", nnod);
 
@@ -150,14 +151,14 @@ namespace AMDiS {
     // array of indices of subdomain nodes in global numbering
     int isngn[nnods];
     for (int i = 0; i < nnods; i++)
-      isngn[i] = meshDistributor->mapDofToGlobal(feSpace, i);
+      isngn[i] = dofMap[feSpace][i].global; //meshDistributor->mapDofToGlobal(feSpace, i);
 
     // array of indices of subdomain variables in global numbering
     int isvgvn[ndofs];
     for (int j = 0; j < nnods; j++)
       for (int i = 0; i < nComponents; i++)
 	isvgvn[j * nComponents + i] = 
-	  meshDistributor->mapDofToGlobal(feSpace, j) * nComponents + i;
+	  dofMap[feSpace][j].global * nComponents + i;
 
     // array of indices of subdomain elements in global numbering
     int isegn[nelems];
@@ -367,6 +368,12 @@ namespace AMDiS {
   }
 
 
+  void BddcMlSolver::destroyVectorData()
+  {
+    FUNCNAME("BddcMlSolver::destroyVectorData()");
+  }
+
+
   void BddcMlSolver::addDofMatrix(DOFMatrix* dmat, 
 				  vector<int>& i_sparse, 
 				  vector<int>& j_sparse,
@@ -391,22 +398,22 @@ namespace AMDiS {
     typedef traits::range_generator<row, Matrix>::type cursor_type;
     typedef traits::range_generator<nz, cursor_type>::type icursor_type;
 
+    ParallelDofMapping &dofMap = meshDistributor->getDofMap();
+
     for (cursor_type cursor = begin<row>(dmat->getBaseMatrix()), 
 	   cend = end<row>(dmat->getBaseMatrix()); cursor != cend; ++cursor) {
       int rowIndex = 
-	meshDistributor->mapDofToGlobal(feSpace, *cursor) * nComponents +
-	ithRowComponent;
+	dofMap[feSpace][*cursor].global * nComponents + ithRowComponent;
 
       for (icursor_type icursor = begin<nz>(cursor), icend = end<nz>(cursor); 
 	   icursor != icend; ++icursor) {	
 	int colIndex = 
-	  meshDistributor->mapDofToGlobal(feSpace, col(*icursor)) * nComponents +
-	  ithColComponent;
+	  dofMap[feSpace][col(*icursor)].global * nComponents + ithColComponent;
 
 	double val = value(*icursor);
 	
-// 	i_sparse.push_back(rowIndex);
-// 	j_sparse.push_back(colIndex);
+	// 	i_sparse.push_back(rowIndex);
+	// 	j_sparse.push_back(colIndex);
 	i_sparse.push_back(*cursor * nComponents + ithRowComponent);
 	j_sparse.push_back(col(*icursor) * nComponents + ithColComponent);
 	a_sparse.push_back(val);
diff --git a/AMDiS/src/parallel/BddcMlSolver.h b/AMDiS/src/parallel/BddcMlSolver.h
index 73b95e6e..2dcb5853 100644
--- a/AMDiS/src/parallel/BddcMlSolver.h
+++ b/AMDiS/src/parallel/BddcMlSolver.h
@@ -49,6 +49,8 @@ namespace AMDiS {
 
     void destroyMatrixData();
 
+    void destroyVectorData();
+
   protected:
     void addDofMatrix(DOFMatrix* mat, 
 		      vector<int>& i_sparse, 
-- 
GitLab