From fb68f8d5114c104a676a9c67f53c3de0360385fd Mon Sep 17 00:00:00 2001
From: Thomas Witkowski <thomas.witkowski@gmx.de>
Date: Tue, 11 Aug 2009 15:43:47 +0000
Subject: [PATCH] Bugfix in petsc assembling.

---
 AMDiS/src/ParallelDomainBase.cc | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/AMDiS/src/ParallelDomainBase.cc b/AMDiS/src/ParallelDomainBase.cc
index 1acc732e..520bbf77 100644
--- a/AMDiS/src/ParallelDomainBase.cc
+++ b/AMDiS/src/ParallelDomainBase.cc
@@ -409,9 +409,10 @@ namespace AMDiS {
 	 it != recvDofs.end(); ++it) {
       int nSend = sendMatrixEntry[it->first].size();
 
-      if (nSend > 0)
+      if (nSend > 0) {
 	request[requestCounter++] = 
 	  mpiComm.Isend(sendBuffers[i], nSend * 2, MPI_INT, it->first, 0);
+      }
 
       i++;
     }
@@ -436,10 +437,10 @@ namespace AMDiS {
     }
 
     MPI::Request::Waitall(requestCounter, request);
-			
+
     for (int j = 0; j < static_cast<int>(sendBuffers.size()); j++)
       if (sendBuffers[j])
-	delete [] sendBuffers[j];
+ 	delete [] sendBuffers[j];
 
     i = 0;
     for (RankToDofContainer::iterator it = sendDofs.begin();
@@ -450,7 +451,7 @@ namespace AMDiS {
 	  int c = recvBuffers[i][j * 2 + 1];
 	  
 	  r -= rstart * nComponents;
-	  
+
 	  TEST_EXIT_DBG(r >= 0 && r < nRankRows)("Should not happen!\n");
 	  
 	  if (c < rstart * nComponents ||
@@ -460,6 +461,8 @@ namespace AMDiS {
 
 	delete [] recvBuffers[i];
       }
+
+      i++;
     }       	
 
     INFO(info, 8)("Fill petsc matrix 1 needed %.5f seconds\n", TIME_USED(first, clock()));
-- 
GitLab