Index: /issm/trunk-jpl/configs/config-win64.sh
===================================================================
--- /issm/trunk-jpl/configs/config-win64.sh	(revision 19167)
+++ /issm/trunk-jpl/configs/config-win64.sh	(revision 19168)
@@ -3,5 +3,5 @@
 # Works on Win8, but should also work on 7.
 ./configure --prefix=$ISSM_DIR \
-	--with-vendor=MSVC-win64  \
+	--with-vendor=MSVC-Win64  \
 	--disable-static \
 	--enable-standalone-libraries \
Index: /issm/trunk-jpl/m4/issm_options.m4
===================================================================
--- /issm/trunk-jpl/m4/issm_options.m4	(revision 19167)
+++ /issm/trunk-jpl/m4/issm_options.m4	(revision 19168)
@@ -197,6 +197,6 @@
 			export CC=cl
 			export CXX=cccl
-			export CXXFLAGS="-DWIN32 -D_INTEL_WIN_ -EHsc"
-			export CFLAGS="-DWIN32 -D_INTEL_WIN_ -EHsc"
+			export CXXFLAGS="-DWIN32 -D_INTEL_WIN_ -D_HAVE_PETSC_MPI_ -EHsc"
+			export CFLAGS="-DWIN32 -D_INTEL_WIN_ -D_HAVE_PETSC_MPI_ -EHsc"
 			export AR="ar-lib lib"
 			export OS_LDFLAG="-Wl,"
@@ -963,5 +963,4 @@
 				else
 					PETSCLIB="-L$PETSC_ROOT/lib  -Wl,libpetsc.lib"
-					if test $PETSC_MAJOR -gt 3 || test $PETSC_MINOR -ge 3; then PETSCLIB+="  -Wl,libmetis.lib"; fi
 				fi
 				;;
@@ -990,5 +989,5 @@
 	dnl }}}
 	dnl metis{{{
-	if test "$HAVE_PETSC" = "yes" && test "x$PETSC_MAJOR" = "x3" && test $PETSC_MINOR -ge 3; then
+	if test "$HAVE_PETSC" = "yes" && test "x$PETSC_MAJOR" = "x3" && test $PETSC_MINOR -ge 3 && test $VENDOR != "MSVC-Win64"; then
 		dnl in petsc >=3.3, metis is provided
 		HAVE_METIS="yes"
Index: /issm/trunk-jpl/src/c/toolkits/mpi/issmmpi.h
===================================================================
--- /issm/trunk-jpl/src/c/toolkits/mpi/issmmpi.h	(revision 19167)
+++ /issm/trunk-jpl/src/c/toolkits/mpi/issmmpi.h	(revision 19168)
@@ -20,4 +20,6 @@
 	#ifdef _HAVE_AMPI_
 		#include <ampi/ampi.h>
+	#elif  _HAVE_PETSC_MPI_ // Petsc now hides there MPI header. It can be reached through Petsc.
+		#include <petsc.h>
 	#else 
 		#include <mpi.h>
Index: /issm/trunk-jpl/src/c/toolkits/petsc/objects/PetscMat.cpp
===================================================================
--- /issm/trunk-jpl/src/c/toolkits/petsc/objects/PetscMat.cpp	(revision 19167)
+++ /issm/trunk-jpl/src/c/toolkits/petsc/objects/PetscMat.cpp	(revision 19168)
@@ -42,5 +42,25 @@
 	MatSetSizes(this->matrix,m,n,M,N);
 	MatSetFromOptions(this->matrix);
-	PetscErrorCode ierr = MatMPIAIJSetPreallocation(this->matrix,0,d_nnz,0,o_nnz);
+
+	/* 
+	 * Versions of Petsc beyond 3.3 have changed the use of preallocation 
+	 * routines to distinguish between parallel builds and sequential. Since
+	 * our Windows builds are currently only sequential, we need to change
+	 * the way we use these functions.
+	 *
+	 * The following code computes the total number of non-zeroes per row of the
+	 * matrix in question. In parallel builds it is nescessary to kep track of 
+	 * diagonal non zeros and off-diagonal (d_nnz and o_nnz). Sequential does
+	 * not make that distinction.
+	*/
+	#ifdef _HAVE_PETSC_MPI_
+	 int* nnz = new int[M];
+	 for(int i = 0; i < M; i++)
+		 nnz[i] = o_nnz[i] + d_nnz[i];
+
+		PetscErrorCode ierr = MatSeqAIJSetPreallocation(this->matrix,0,nnz);
+	#else
+		PetscErrorCode ierr = MatMPIAIJSetPreallocation(this->matrix,0,d_nnz,0,o_nnz);
+	#endif
 	if(ierr) _error_("PETSc could not allocate matrix (probably not enough memory)");
 //	MatSetOption(this->matrix,MAT_NEW_NONZERO_ALLOCATION_ERR,PETSC_FALSE);
