Index: /issm/trunk/src/c/toolkits/metis/metisincludes.h
===================================================================
--- /issm/trunk/src/c/toolkits/metis/metisincludes.h	(revision 9997)
+++ /issm/trunk/src/c/toolkits/metis/metisincludes.h	(revision 9998)
@@ -6,14 +6,15 @@
 #define _METIS_INCLUDES_H_
 
+#ifdef HAVE_CONFIG_H
+	#include <config.h>
+#else
+#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
+#endif
+
 /*Metis includes: */
 #include <metis.h>
 
-#ifdef __cplusplus
-extern "C" {
-#endif
-void METIS_PartMeshNodal(int *, int *, idxtype *, int *, int *, int *, int *, idxtype *, idxtype *);
-#ifdef __cplusplus
-}
-#endif
+/*our own patches: */
+#include "patches/metispatches.h"
 
 #endif
Index: /issm/trunk/src/c/toolkits/metis/patches/METIS_PartMeshNodalPatch.cpp
===================================================================
--- /issm/trunk/src/c/toolkits/metis/patches/METIS_PartMeshNodalPatch.cpp	(revision 9998)
+++ /issm/trunk/src/c/toolkits/metis/patches/METIS_PartMeshNodalPatch.cpp	(revision 9998)
@@ -0,0 +1,60 @@
+/*!\file METIS_PartMeshNodalPatch
+ * \brief common interface to Metis 4.0 and 5.0
+ */
+
+#include "../metisincludes.h"
+#include "../../../shared/shared.h"
+
+void METIS_PartMeshNodalPatch(int* pnumberofelements,int* pnumberofnodes, int* index, int* petype, int* pnumflag, int* pnum_procs, int* pedgecut, int* epart, int* npart){
+
+
+	#if _METIS_VERSION == 4
+	METIS_PartMeshNodalPatch(pnumberofelements,pnumberofnodes, index, petype, pnumflag, pnum_procs, pedgecut, epart, npart); /*Our interface originates in the Metis 4.0 version, hence identical calls*/
+	#endif
+
+	#if _METIS_VERSION == 5
+	/*This interface is heavily changed. More options, different way of meshing, etc ...: */ 
+	int i;
+
+	idx_t options[METIS_NOPTIONS];
+	idx_t objval;
+	idx_t* eptr=NULL;
+	idx_t  k=0;
+	real_t* tpwgts=NULL;
+
+
+	/*setup options: */
+	METIS_SetDefaultOptions(options);
+
+	options[METIS_OPTION_PTYPE]   = 1;
+	options[METIS_OPTION_OBJTYPE] = 0;
+	options[METIS_OPTION_CTYPE]   = 1;
+	options[METIS_OPTION_IPTYPE]  = 4;
+	options[METIS_OPTION_RTYPE]   = 1;
+	options[METIS_OPTION_DBGLVL]  = 0;
+	options[METIS_OPTION_UFACTOR] = 30;
+	options[METIS_OPTION_MINCONN] = 0;
+	options[METIS_OPTION_CONTIG]  = 0;
+	options[METIS_OPTION_SEED]    = -1;
+	options[METIS_OPTION_NITER]   = 10;
+	options[METIS_OPTION_NCUTS]   = 1;
+
+	/*create eptr: */
+	eptr=(idx_t*)xmalloc((*pnumberofelements+1)*sizeof(idx_t));
+	eptr[0]=0;
+	for(i=0;i<*pnumberofelements;i++){
+		k+=3;
+		eptr[i+1]=k;
+	}
+
+	/*create tpwgts: */
+	tpwgts=(real_t*)xmalloc(*pnum_procs*sizeof(real_t));
+	for(i=0;i<*pnum_procs;i++){
+		tpwgts[i]=1.0/(*pnum_procs);
+	}
+
+	METIS_PartMeshNodal(pnumberofelements,pnumberofnodes, eptr, index,
+			NULL, NULL, pnum_procs, tpwgts, options, &objval,
+			epart, npart);
+	#endif
+}
Index: /issm/trunk/src/c/toolkits/metis/patches/metispatches.h
===================================================================
--- /issm/trunk/src/c/toolkits/metis/patches/metispatches.h	(revision 9998)
+++ /issm/trunk/src/c/toolkits/metis/patches/metispatches.h	(revision 9998)
@@ -0,0 +1,32 @@
+/*\file metispatches.h
+ * \brief: our own patches for metis. Mainly to work through new apis from 4.0 to 5.0 version.
+ */
+
+#ifndef _METIS_PATCHES_H_
+#define _METIS_PATCHES_H_
+
+#ifdef HAVE_CONFIG_H
+	#include <config.h>
+#else
+#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
+#endif
+
+void METIS_PartMeshNodalPatch(int *, int *, int *, int *, int *, int *, int *, int *, int *); //Common interface we are using in ISSM.
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#if _METIS_VERSION_ == 4
+void METIS_PartMeshNodal(int *, int *, idxtype *, int *, int *, int *, int *, idxtype *, idxtype *);
+#endif
+#if _METIS_VERSION_ == 5
+int METIS_PartMeshNodal(idx_t*, idx_t*, idx_t*, idx_t*, idx_t*, idx_t*, idx_t*, real_t*, idx_t*, idx_t*, idx_t*, idx_t*);
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif
