From 3cc5f6a0c9f6f9f0c0ce7bf3f1b72f0b8928200a Mon Sep 17 00:00:00 2001
From: Christophe Geuzaine <cgeuzaine@ulg.ac.be>
Date: Wed, 19 Mar 2014 14:09:31 +0000
Subject: [PATCH] fix compile with Intel mpi

---
 Common/GmshMessage.cpp       | 11 ++++++-----
 Common/GmshRemote.cpp        | 25 +++++++++++++------------
 Solver/dofManager.cpp        |  3 ++-
 Solver/linearSystemPETSc.cpp |  3 ++-
 Solver/linearSystemPETSc.h   |  2 ++
 5 files changed, 25 insertions(+), 19 deletions(-)

diff --git a/Common/GmshMessage.cpp b/Common/GmshMessage.cpp
index 4fd087bacc..b2de8be27b 100644
--- a/Common/GmshMessage.cpp
+++ b/Common/GmshMessage.cpp
@@ -3,13 +3,18 @@
 // See the LICENSE.txt file for license information. Please report all
 // bugs and problems to the public mailing list <gmsh@geuz.org>.
 
+#include "GmshConfig.h"
+
+#if defined(HAVE_MPI)
+#include <mpi.h>
+#endif
+
 #include <stdlib.h>
 #include <stdio.h>
 #include <math.h>
 #include <string.h>
 #include <time.h>
 #include <sys/stat.h>
-#include "GmshConfig.h"
 #include "GmshMessage.h"
 #include "GmshSocket.h"
 #include "Gmsh.h"
@@ -24,10 +29,6 @@
 #include "onelab.h"
 #endif
 
-#if defined(HAVE_MPI)
-#include <mpi.h>
-#endif
-
 #if defined(HAVE_PETSC)
 #include <petsc.h>
 #endif
diff --git a/Common/GmshRemote.cpp b/Common/GmshRemote.cpp
index 4116c39cdc..83b12456d7 100644
--- a/Common/GmshRemote.cpp
+++ b/Common/GmshRemote.cpp
@@ -3,8 +3,20 @@
 // See the LICENSE.txt file for license information. Please report all
 // bugs and problems to the public mailing list <gmsh@geuz.org>.
 
-#include <sstream>
 #include "GmshConfig.h"
+
+#if defined(HAVE_MPI)
+#include <mpi.h>
+#define MPI_GMSH_COMPUTE_VIEW  1
+#define MPI_GMSH_DATA_READY    2
+#define MPI_GMSH_VARRAY        3
+#define MPI_GMSH_VARRAY_LEN    4
+#define MPI_GMSH_SHUTDOWN      5
+#define MPI_GMSH_PARSE_STRING  6
+#define MPI_GMSH_MERGE_FILE    7
+#endif
+
+#include <sstream>
 #include "GmshMessage.h"
 
 #if defined(HAVE_ONELAB) && defined(HAVE_POST)
@@ -19,17 +31,6 @@
 #include "PViewData.h"
 #include "PViewDataRemote.h"
 
-#if defined(HAVE_MPI)
-#include <mpi.h>
-#define MPI_GMSH_COMPUTE_VIEW  1
-#define MPI_GMSH_DATA_READY    2
-#define MPI_GMSH_VARRAY        3
-#define MPI_GMSH_VARRAY_LEN    4
-#define MPI_GMSH_SHUTDOWN      5
-#define MPI_GMSH_PARSE_STRING  6
-#define MPI_GMSH_MERGE_FILE    7
-#endif
-
 static void computeAndSendVertexArrays(GmshClient *client, bool compute=true)
 {
   for(unsigned int i = 0; i < PView::list.size(); i++){
diff --git a/Solver/dofManager.cpp b/Solver/dofManager.cpp
index 77222fcfdb..a6fff9bf31 100644
--- a/Solver/dofManager.cpp
+++ b/Solver/dofManager.cpp
@@ -3,13 +3,14 @@
 // See the LICENSE.txt file for license information. Please report all
 // bugs and problems to the public mailing list <gmsh@geuz.org>.
 
-#include <dofManager.h>
 #include "GmshConfig.h"
 
 #ifdef HAVE_MPI
 #include "mpi.h"
 #endif
 
+#include <dofManager.h>
+
 template<>
 void dofManager<double>::scatterSolution()
 {
diff --git a/Solver/linearSystemPETSc.cpp b/Solver/linearSystemPETSc.cpp
index 1bf23e9282..fd44f363e9 100644
--- a/Solver/linearSystemPETSc.cpp
+++ b/Solver/linearSystemPETSc.cpp
@@ -4,13 +4,14 @@
 // bugs and problems to the public mailing list <gmsh@geuz.org>.
 
 #include "GmshConfig.h"
+#include <string.h>
+
 #if defined(HAVE_PETSC)
 #include "petsc.h"
 #include "linearSystemPETSc.h"
 #include "fullMatrix.h"
 #include <stdlib.h>
 #include "GmshMessage.h"
-
 #include "linearSystemPETSc.hpp"
 
 template class linearSystemPETSc<double>;
diff --git a/Solver/linearSystemPETSc.h b/Solver/linearSystemPETSc.h
index 246746dddd..ec8b666b07 100644
--- a/Solver/linearSystemPETSc.h
+++ b/Solver/linearSystemPETSc.h
@@ -39,7 +39,9 @@
 #include "linearSystem.h"
 #include "sparsityPattern.h"
 #include "fullMatrix.h"
+#include <string.h>
 #include <vector>
+
 #if defined(HAVE_PETSC)
 
 #ifndef SWIG
-- 
GitLab