Index: /issm/trunk-jpl/src/c/toolkits/mpi/issmmpi.cpp
===================================================================
--- /issm/trunk-jpl/src/c/toolkits/mpi/issmmpi.cpp	(revision 24767)
+++ /issm/trunk-jpl/src/c/toolkits/mpi/issmmpi.cpp	(revision 24768)
@@ -1,4 +1,4 @@
 /* \file issmmpi.cpp
- * \brief: implementation of all the mpi wrappers that ISSM requires. The goal is to control 
+ * \brief: implementation of all the mpi wrappers that ISSM requires. The goal is to control
  * which MPI layer we are using at compile time: the standard mpi, the autodiff mpi or no mpi at all.
  */
@@ -14,4 +14,5 @@
 
 #include "./issmmpi.h"
+MpiTypes* mpiTypes;
 #include "../../shared/Numerics/types.h"
 
@@ -20,15 +21,15 @@
 size_t sizeHelper(ISSM_MPI_Datatype type) { /*{{{*/
 
-  switch(type) { 
-  case ISSM_MPI_CHAR: 
+  switch(type) {
+  case ISSM_MPI_CHAR:
     return sizeof(char);
     break;
-  case ISSM_MPI_DOUBLE: 
+  case ISSM_MPI_DOUBLE:
     return sizeof(double);
     break;
-  case ISSM_MPI_INT: 
+  case ISSM_MPI_INT:
     return sizeof(int);
     break;
-  default: 
+  default:
     assert(0);
     break;
@@ -61,10 +62,10 @@
 #else
 # ifdef _HAVE_AD_
-  if (sendtype==ISSM_MPI_DOUBLE) { 
+  if (sendtype==ISSM_MPI_DOUBLE) {
     IssmDouble* activeSendBuf=(IssmDouble*)sendbuf;
     IssmDouble* activeRecvBuf=(IssmDouble*)recvbuf;
     for(int i=0;i<sendcount;++i) activeRecvBuf[i]=activeSendBuf[i];
   }
-  else 
+  else
 # endif
     memcpy(recvbuf,sendbuf,sizeHelper(sendtype)*sendcount);
@@ -96,12 +97,12 @@
 # endif
 #else
-  assert(sendcount==recvcounts[0]); // we handle only identical representations 
+  assert(sendcount==recvcounts[0]); // we handle only identical representations
 # ifdef _HAVE_AD_
-  if (sendtype==ISSM_MPI_DOUBLE) { 
+  if (sendtype==ISSM_MPI_DOUBLE) {
     IssmDouble* activeSendBuf=(IssmDouble*)sendbuf;
     IssmDouble* activeRecvBuf=(IssmDouble*)(recvbuf)+displs[0];
     for(int i=0;i<sendcount;++i) activeRecvBuf[i]=activeSendBuf[i];
   }
-  else 
+  else
 # endif
     memcpy((char*)recvbuf+(sizeHelper(recvtype)*displs[0]),sendbuf,sizeHelper(sendtype)*sendcount);
@@ -130,10 +131,10 @@
 #else
 #ifdef _HAVE_AD_
-  if (datatype==ISSM_MPI_DOUBLE) { 
+  if (datatype==ISSM_MPI_DOUBLE) {
     IssmDouble* activeSendBuf=(IssmDouble*)sendbuf;
     IssmDouble* activeRecvBuf=(IssmDouble*)recvbuf;
     for(int i=0;i<count;++i) activeRecvBuf[i]=activeSendBuf[i];
   }
-  else 
+  else
 # endif
     memcpy(recvbuf,sendbuf,sizeHelper(datatype)*count);
@@ -147,5 +148,5 @@
 #if defined(_HAVE_AMPI_) &&  !defined(_WRAPPERS_)
   rc=AMPI_Barrier(comm);
-# else 
+# else
   rc=MPI_Barrier(comm);
 # endif
@@ -160,5 +161,5 @@
 #ifdef _HAVE_MPI_
 #if defined(_HAVE_AMPI_) &&  !defined(_WRAPPERS_)
-  rc=AMPI_Bcast(buffer, 
+  rc=AMPI_Bcast(buffer,
 		count,
 		datatype,
@@ -166,5 +167,5 @@
 		comm);
 # else
-  rc=MPI_Bcast(buffer, 
+  rc=MPI_Bcast(buffer,
 	       count,
 	       datatype,
@@ -172,6 +173,6 @@
 	       comm);
 # endif
-#else 
-// nothing to be done here 
+#else
+// nothing to be done here
 #endif
   return rc;
@@ -183,5 +184,5 @@
 #if defined(_HAVE_AMPI_) &&  !defined(_WRAPPERS_)
   assert(0); // to be implemented
-# else 
+# else
   rc=MPI_Comm_free(comm);
 # endif
@@ -261,10 +262,10 @@
 #else
 # ifdef _HAVE_AD_
-  if (sendtype==ISSM_MPI_DOUBLE) { 
+  if (sendtype==ISSM_MPI_DOUBLE) {
     IssmDouble* activeSendBuf=(IssmDouble*)sendbuf;
     IssmDouble* activeRecvBuf=(IssmDouble*)recvbuf;
     for(int i=0;i<sendcnt;++i) activeRecvBuf[i]=activeSendBuf[i];
   }
-  else 
+  else
 # endif
     memcpy(recvbuf,sendbuf,sizeHelper(sendtype)*sendcnt);
@@ -299,12 +300,12 @@
 # endif
 #else
-  assert(sendcnt==recvcnts[0]); // we handle only identical representations 
+  assert(sendcnt==recvcnts[0]); // we handle only identical representations
 #ifdef _HAVE_AD_
-  if (sendtype==ISSM_MPI_DOUBLE) { 
+  if (sendtype==ISSM_MPI_DOUBLE) {
     IssmDouble* activeSendBuf=(IssmDouble*)sendbuf;
     IssmDouble* activeRecvBuf=(IssmDouble*)(recvbuf)+displs[0];
     for(int i=0;i<sendcnt;++i) activeRecvBuf[i]=activeSendBuf[i];
   }
-  else 
+  else
 # endif
     memcpy((char*)recvbuf+(sizeHelper(recvtype)*displs[0]),sendbuf,sizeHelper(sendtype)*sendcnt);
@@ -340,5 +341,5 @@
 #ifdef _HAVE_MPI_
 #if defined(_HAVE_AMPI_) &&  !defined(_WRAPPERS_)
-  rc=AMPI_Recv(buf, 
+  rc=AMPI_Recv(buf,
 	       count,
 	       datatype,
@@ -351,5 +352,5 @@
 	       status);
 # else
-  rc=MPI_Recv(buf, 
+  rc=MPI_Recv(buf,
 	      count,
 	      datatype,
@@ -359,7 +360,7 @@
 	      status);
 # endif
-#else 
-// nothing to be done here 
-// as long as nobody tries to do anything with 'status' 
+#else
+// nothing to be done here
+// as long as nobody tries to do anything with 'status'
 // we won't do anything to it here either
 #endif
@@ -389,10 +390,10 @@
 #else
 # ifdef _HAVE_AD_
-  if (datatype==ISSM_MPI_DOUBLE) { 
+  if (datatype==ISSM_MPI_DOUBLE) {
     IssmDouble* activeSendBuf=(IssmDouble*)sendbuf;
     IssmDouble* activeRecvBuf=(IssmDouble*)recvbuf;
     for(int i=0;i<count;++i) activeRecvBuf[i]=activeSendBuf[i];
   }
-  else 
+  else
 # endif
     memcpy(recvbuf,sendbuf,sizeHelper(datatype)*count);
@@ -426,10 +427,10 @@
 #else
 # ifdef _HAVE_AD_
-  if (sendtype==ISSM_MPI_DOUBLE) { 
+  if (sendtype==ISSM_MPI_DOUBLE) {
     IssmDouble* activeSendBuf=(IssmDouble*)sendbuf;
     IssmDouble* activeRecvBuf=(IssmDouble*)recvbuf;
     for(int i=0;i<recvcnt;++i) activeRecvBuf[i]=activeSendBuf[i];
   }
-  else 
+  else
 # endif
     memcpy(recvbuf,sendbuf,sizeHelper(sendtype)*recvcnt);
@@ -464,12 +465,12 @@
 # endif
 #else
-  assert(sendcnts[0]==recvcnt); // we handle only identical representations 
+  assert(sendcnts[0]==recvcnt); // we handle only identical representations
 # ifdef _HAVE_AD_
-  if (sendtype==ISSM_MPI_DOUBLE) { 
+  if (sendtype==ISSM_MPI_DOUBLE) {
     IssmDouble* activeSendBuf=(IssmDouble*)(sendbuf)+displs[0];
     IssmDouble* activeRecvBuf=(IssmDouble*)recvbuf;
     for(int i=0;i<recvcnt;++i) activeRecvBuf[i]=activeSendBuf[i];
   }
-  else 
+  else
 # endif
     memcpy(recvbuf,(char*)sendbuf+(sizeHelper(sendtype)*displs[0]),sizeHelper(sendtype)*recvcnt);
@@ -482,5 +483,5 @@
 #ifdef _HAVE_MPI_
 #if defined(_HAVE_AMPI_) &&  !defined(_WRAPPERS_)
-  rc=AMPI_Send(buf, 
+  rc=AMPI_Send(buf,
 	       count,
 	       datatype,
@@ -492,5 +493,5 @@
 	       comm);
 # else
-  rc=MPI_Send(buf, 
+  rc=MPI_Send(buf,
 	      count,
 	      datatype,
@@ -499,6 +500,6 @@
 	      comm);
 # endif
-#else 
-// nothing to be done here 
+#else
+// nothing to be done here
 #endif
   return rc;
@@ -508,5 +509,5 @@
 #ifdef _HAVE_MPI_
 	return MPI_Wtime();
-#else 
+#else
 	assert(0); // to be implemented
 	return 0.0;
@@ -530,6 +531,6 @@
 rc=MPI_Comm_split(comm, color, key, newcomm);
 #endif
-#else 
-// nothing to be done here 
+#else
+// nothing to be done here
 #endif
   return rc;
@@ -544,6 +545,6 @@
 	rc=MPI_Intercomm_create(comm,local_leader,peer_comm,remote_leader,tag,newintercomm);
 #endif
-#else 
-	// nothing to be done here 
+#else
+	// nothing to be done here
 #endif
 	return rc;
Index: /issm/trunk-jpl/src/c/toolkits/mpi/issmmpi.h
===================================================================
--- /issm/trunk-jpl/src/c/toolkits/mpi/issmmpi.h	(revision 24767)
+++ /issm/trunk-jpl/src/c/toolkits/mpi/issmmpi.h	(revision 24768)
@@ -34,5 +34,5 @@
 			#include <codi/externals/codiMpiTypes.hpp>
 			using MpiTypes = CoDiMpiTypes<IssmDouble>;
-			MpiTypes* mpiTypes;
+			extern MpiTypes* mpiTypes;
 			#define AMPI_ADOUBLE mpiTypes->MPI_TYPE
 			#elif defined(_HAVE_ADOLC_)
