From a96ae277cf06fa74b5879597dd1ffec8dc1df513 Mon Sep 17 00:00:00 2001
From: Jonathan Lambrechts <jonathan.lambrechts@uclouvain.be>
Date: Tue, 26 Oct 2010 15:08:58 +0000
Subject: [PATCH] dg : remove bug when compiled with HAVE_MPI=0

---
 Solver/dofManager.h          | 5 ++---
 Solver/linearSystemPETSc.cpp | 1 -
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/Solver/dofManager.h b/Solver/dofManager.h
index 542613c2a5..8b46b3d79c 100644
--- a/Solver/dofManager.h
+++ b/Solver/dofManager.h
@@ -302,7 +302,6 @@ class dofManager{
   inline void insertInSparsityPattern(const Dof &R, const Dof &C)
   {
     if (_isParallel && !_parallelFinalized) _parallelFinalize();
-    if (!_current->isAllocated()) _current->allocate(sizeOfR());
     std::map<Dof, int>::iterator itR = unknown.find(R);
     if (itR != unknown.end()){
       std::map<Dof, int>::iterator itC = unknown.find(C);
@@ -568,11 +567,11 @@ class dofManager{
 template<class T>
 void dofManager<T>::_parallelFinalize()
 {
+  _localSize = unknown.size();
 #ifdef HAVE_MPI
   int _numStart;
   int _numTotal;
   MPI_Status status;
-  _localSize = unknown.size();
   if (Msg::GetCommRank() == 0){
     _numStart = 0;
   }
@@ -584,7 +583,6 @@ void dofManager<T>::_parallelFinalize()
   MPI_Bcast(&_numTotal, 1, MPI_INT, Msg::GetCommSize()-1, MPI_COMM_WORLD);
   for (std::map <Dof, int> ::iterator it = unknown.begin(); it!= unknown.end(); it++)
     it->second += _numStart;
-  _parallelFinalized = true;
   std::vector<std::list<Dof> >  ghostedByProc;
   int *nRequest = new int[Msg::GetCommSize()];
   int *nRequested = new int[Msg::GetCommSize()];
@@ -662,6 +660,7 @@ void dofManager<T>::_parallelFinalize()
   delete [] reqSend1;
   delete [] reqRecv0;
 #endif
+  _parallelFinalized = true;
 }
 
 #endif
diff --git a/Solver/linearSystemPETSc.cpp b/Solver/linearSystemPETSc.cpp
index ada1607eb8..a3466d4a2f 100644
--- a/Solver/linearSystemPETSc.cpp
+++ b/Solver/linearSystemPETSc.cpp
@@ -135,7 +135,6 @@ void linearSystemPETScRegisterBindings(binding *b)
   cm->setDescription ("A new PETScBlock<PetscScalar> solver");
   cb->setParentClass<linearSystem<fullMatrix<PetscScalar> > >();
 #endif // FIXME
-
 }
 
 #endif // HAVE_PETSC
-- 
GitLab