Index: /issm/trunk/externalpackages/scotch/Makefile.inc
===================================================================
--- /issm/trunk/externalpackages/scotch/Makefile.inc	(revision 3003)
+++ /issm/trunk/externalpackages/scotch/Makefile.inc	(revision 3003)
@@ -0,0 +1,26 @@
+EXE	=
+LIB	= .a
+OBJ	= .o
+MEX	= .mexa64
+
+MAKE	= make
+AR	= ar
+ARFLAGS	= -ruv
+CAT	= cat
+CCS	= gcc
+CCP     = mpicc
+CCD     = mpicc
+CCM	= mex
+#CFLAGS	= -m64 -O3 -std=c99 -DCOMMON_RANDOM_FIXED_SEED -DSCOTCH_RENAME -Du_int32_t=uint32_t -Du_int64_t=uint64_t -DCOMMON_TIMING_OLD -DMATLAB -fPIC -I/usr/local/pkgs/matlab-7.6/extern/include
+CFLAGS	= -m64 -O3 -std=c99 -DCOMMON_RANDOM_FIXED_SEED -DSCOTCH_RENAME -Du_int32_t=uint32_t -Du_int64_t=uint64_t -DCOMMON_TIMING_OLD -fPIC
+#LDFLAGS	= -lz -lm -lrt -L/usr/local/pkgs/matlab-7.6/bin/glnxa64 -lmex -lmat
+#LDFLAGS	= -lz -lm -lrt -Wl,-rpath-link,/usr/local/pkgs/matlab-7.6/bin/glnxa64 -L/usr/local/pkgs/matlab-7.6/bin/glnxa64 -lmex -lmat
+LDFLAGS	= -lz -lm -lrt
+MFLAGS	= -DCOMMON_RANDOM_FIXED_SEED -DSCOTCH_RENAME -Du_int32_t=uint32_t -Du_int64_t=uint64_t -DCOMMON_TIMING_OLD -DMATLAB -I/usr/local/pkgs/matlab-7.6/extern/include -largeArrayDims
+CP	= cp
+LEX	= flex
+LN	= ln
+MKDIR	= mkdir
+MV	= mv
+RANLIB	= ranlib
+YACC	= yacc
Index: /issm/trunk/externalpackages/scotch/gmap_mex.c
===================================================================
--- /issm/trunk/externalpackages/scotch/gmap_mex.c	(revision 3003)
+++ /issm/trunk/externalpackages/scotch/gmap_mex.c	(revision 3003)
@@ -0,0 +1,467 @@
+/* Copyright 2004,2007,2008 ENSEIRB, INRIA & CNRS
+**
+** This file is part of the Scotch software package for static mapping,
+** graph partitioning and sparse matrix ordering.
+**
+** This software is governed by the CeCILL-C license under French law
+** and abiding by the rules of distribution of free software. You can
+** use, modify and/or redistribute the software under the terms of the
+** CeCILL-C license as circulated by CEA, CNRS and INRIA at the following
+** URL: "http://www.cecill.info".
+** 
+** As a counterpart to the access to the source code and rights to copy,
+** modify and redistribute granted by the license, users are provided
+** only with a limited warranty and the software's author, the holder of
+** the economic rights, and the successive licensors have only limited
+** liability.
+** 
+** In this respect, the user's attention is drawn to the risks associated
+** with loading, using, modifying and/or developing or reproducing the
+** software by the user in light of its specific status of free software,
+** that may mean that it is complicated to manipulate, and that also
+** therefore means that it is reserved for developers and experienced
+** professionals having in-depth computer knowledge. Users are therefore
+** encouraged to load and test the software's suitability as regards
+** their requirements in conditions enabling the security of their
+** systems and/or data to be ensured and, more generally, to use and
+** operate it in the same conditions as regards security.
+** 
+** The fact that you are presently reading this means that you have had
+** knowledge of the CeCILL-C license and that you accept its terms.
+*/
+/************************************************************/
+/**                                                        **/
+/**   NAME       : gmap.c                                  **/
+/**                                                        **/
+/**   AUTHOR     : Francois PELLEGRINI                     **/
+/**                                                        **/
+/**   FUNCTION   : Part of a graph mapping software.       **/
+/**                This module contains the main function. **/
+/**                                                        **/
+/**   DATES      : # Version 0.0  : from : 05 jan 1993     **/
+/**                                 to     12 may 1993     **/
+/**                # Version 1.1  : from : 15 oct 1993     **/
+/**                                 to     15 oct 1993     **/
+/**                # Version 1.3  : from : 06 apr 1994     **/
+/**                                 to     18 may 1994     **/
+/**                # Version 2.0  : from : 06 jun 1994     **/
+/**                                 to     17 nov 1994     **/
+/**                # Version 2.1  : from : 07 apr 1995     **/
+/**                                 to     18 jun 1995     **/
+/**                # Version 3.0  : from : 01 jul 1995     **/
+/**                                 to     02 oct 1995     **/
+/**                # Version 3.1  : from : 07 nov 1995     **/
+/**                                 to     25 apr 1996     **/
+/**                # Version 3.2  : from : 24 sep 1996     **/
+/**                                 to     26 may 1998     **/
+/**                # Version 3.3  : from : 19 oct 1998     **/
+/**                                 to   : 30 mar 1999     **/
+/**                # Version 3.4  : from : 03 feb 2000     **/
+/**                                 to   : 03 feb 2000     **/
+/**                # Version 4.0  : from : 16 jan 2004     **/
+/**                                 to   : 27 dec 2004     **/
+/**                # Version 5.0  : from : 23 dec 2007     **/
+/**                                 to   : 18 jun 2008     **/
+/**                                                        **/
+/************************************************************/
+
+/*
+**  The defines and includes.
+*/
+
+#define GMAP
+
+#include "module.h"
+#include "common.h"
+#include "scotch.h"
+#include "gmap.h"
+
+/*
+**  The static variables.
+*/
+
+static int                  C_partNbr = 2;        /* Default number of parts     */
+static int                  C_paraNum = 0;        /* Number of parameters        */
+static int                  C_paraNbr = 0;        /* No parameters for mapping   */
+static int                  C_fileNum = 0;        /* Number of file in arg list  */
+static int                  C_fileNbr = 4;        /* Number of files for mapping */
+static File                 C_fileTab[C_FILENBR] = { /* File array               */
+                              { "-", NULL, "r" },
+                              { "-", NULL, "r" },
+                              { "-", NULL, "w" },
+                              { "-", NULL, "w" } };
+
+static const char *         C_usageList[] = {     /* Usage */
+  "gmap [<input source file> [<input target file> [<output mapping file> [<output log file>]]]] <options>",
+  "gpart [<nparts>] [<input source file> [<output mapping file> [<output log file>]]] <options>",
+  "  -h         : Display this help",
+  "  -m<strat>  : Set mapping strategy (see user's manual)",
+  "  -s<obj>    : Force unity weights on <obj>:",
+  "                 e  : edges",
+  "                 v  : vertices",
+  "  -V         : Print program version and copyright",
+  "  -v<verb>   : Set verbose mode to <verb>:",
+  "                 m  : mapping information",
+  "                 s  : strategy information",
+  "                 t  : timing information",
+  "",
+  "See default strategy with option '-vs'",
+  NULL };
+
+/******************************/
+/*                            */
+/* This is the main function. */
+/*                            */
+/******************************/
+
+void mexFunction( int nlhs,
+                  mxArray *plhs[],
+                  int nrhs,
+                  const mxArray *prhs[] )
+{
+  int                         argcm;
+  char                        argvm[21][257];
+  SCOTCH_Graph        grafdat;                    /* Source graph            */
+  SCOTCH_Num          grafflag;                   /* Source graph properties */
+  SCOTCH_Arch         archdat;                    /* Target architecture     */
+  SCOTCH_Strat        stradat;                    /* Mapping strategy        */
+  SCOTCH_Mapping      mapdat;                     /* Mapping data            */
+  Clock               runtime[2];                 /* Timing variables        */
+  SCOTCH_Num          nvert =0;
+  SCOTCH_Num          nedge2=0;
+  SCOTCH_Num*         adjir  =NULL;
+  SCOTCH_Num*         adjjc  =NULL;
+  mwIndex             *ir=NULL,*jc=NULL;
+  double              *vld=NULL,*vwd=NULL,*ewd=NULL,*apd=NULL;
+  SCOTCH_Num*         vertlab=NULL;
+  SCOTCH_Num*         vertwgt=NULL;
+  SCOTCH_Num*         edgewgt=NULL;
+  char                archtyp[256];
+  SCOTCH_Num          napar =0;
+  SCOTCH_Num*         archpar=NULL;
+  SCOTCH_Num          (*maptab)[2]=NULL;
+  double*             maptabm;
+  int                 flagval;
+  int                 i,j,k;
+
+/*  check static variables from previous runs  */
+
+  if (C_paraNum > 0 || C_fileNum > 0)
+    mexErrMsgTxt("gmap_mex still in memory -- clear gmap_mex and try again.\n");
+
+/*  load matlab argument list  */
+
+  if (!mxIsNumeric(prhs[0]) || (!mxIsEmpty(prhs[0]) && !mxIsSparse(prhs[0]))) {
+    mexPrintf("%s -- Adjacency matrix must be numeric and sparse.\n","gmap_mex");
+    mexErrMsgTxt(" ");
+  }
+  else {
+    nvert =mxGetM(prhs[0]);
+    nedge2=mxGetNzmax(prhs[0]);
+    ir    =mxGetIr(prhs[0]);
+    adjir = (SCOTCH_Num *) malloc(mxGetNzmax(prhs[0])*sizeof(SCOTCH_Num));
+    for (i=0; i<mxGetNzmax(prhs[0]); i++)
+      adjir[i]=(SCOTCH_Num)ir[i];
+    jc    =mxGetJc(prhs[0]);
+    adjjc = (SCOTCH_Num *) malloc((mxGetN(prhs[0])+1)*sizeof(SCOTCH_Num));
+    for (i=0; i<(mxGetN(prhs[0])+1); i++)
+      adjjc[i]=(SCOTCH_Num)jc[i];
+    mexPrintf("%s -- Adjacency matrix is of size %d by %d with %d non-zeroes.\n",
+              "gmap_mex",mxGetM(prhs[0]),mxGetN(prhs[0]),mxGetNzmax(prhs[0]));
+  }
+
+  if (!mxIsNumeric(prhs[1])) {
+    mexPrintf("%s -- Vertex label vector must be numeric.\n","gmap_mex");
+    mexErrMsgTxt(" ");
+  }
+  else {
+    vld=mxGetPr(prhs[1]);
+    vertlab = (SCOTCH_Num *) malloc(mxGetM(prhs[1])*mxGetN(prhs[1])*sizeof(SCOTCH_Num));
+    for (i=0; i<mxGetM(prhs[1])*mxGetN(prhs[1]); i++)
+      vertlab[i]=(SCOTCH_Num)vld[i];
+    mexPrintf("%s -- Vertex label vector is of size %d by %d.\n",
+              "gmap_mex",mxGetM(prhs[1]),mxGetN(prhs[1]));
+  }
+
+  if (!mxIsNumeric(prhs[2])) {
+    mexPrintf("%s -- Vertex weight vector must be numeric.\n","gmap_mex");
+    mexErrMsgTxt(" ");
+  }
+  else {
+    vwd=mxGetPr(prhs[2]);
+    vertwgt = (SCOTCH_Num *) malloc(mxGetM(prhs[2])*mxGetN(prhs[2])*sizeof(SCOTCH_Num));
+    for (i=0; i<mxGetM(prhs[2])*mxGetN(prhs[2]); i++)
+      vertwgt[i]=(SCOTCH_Num)vwd[i];
+    mexPrintf("%s -- Vertex weight vector is of size %d by %d.\n",
+              "gmap_mex",mxGetM(prhs[2]),mxGetN(prhs[2]));
+  }
+
+  if (!mxIsNumeric(prhs[3]) || (!mxIsEmpty(prhs[3]) && !mxIsSparse(prhs[3]))) {
+    mexPrintf("%s -- Edge weight matrix must be numeric and sparse.\n","gmap_mex");
+    mexErrMsgTxt(" ");
+  }
+  else {
+    ewd=mxGetPr(prhs[3]);
+    edgewgt = (SCOTCH_Num *) malloc(mxGetM(prhs[3])*sizeof(SCOTCH_Num));
+    for (i=0; i<mxGetNzmax(prhs[3]); i++)
+      edgewgt[i]=(SCOTCH_Num)ewd[i];
+    mexPrintf("%s -- Edge weight matrix is of size %d by %d with %d non-zeroes.\n",
+              "gmap_mex",mxGetM(prhs[3]),mxGetN(prhs[3]),mxGetNzmax(prhs[3]));
+  }
+
+  if (!mxIsChar(prhs[4])) {
+    mexPrintf("%s -- Architecture type must be character.\n","gmap_mex");
+    mexErrMsgTxt(" ");
+  }
+  else {
+    mxGetString(prhs[4],archtyp,255);
+    mexPrintf("%s -- Architecture type is \"%s\".\n",
+              "gmap_mex",archtyp);
+    archtyp[255] = '\0';
+  }
+
+  if (!mxIsNumeric(prhs[5])) {
+    mexPrintf("%s -- Architecture parameter vector must be numeric.\n","gmap_mex");
+    mexErrMsgTxt(" ");
+  }
+  else {
+    napar =mxGetM(prhs[5])*mxGetN(prhs[5]);
+    apd=mxGetPr(prhs[5]);
+    archpar = (SCOTCH_Num *) malloc(mxGetM(prhs[5])*mxGetN(prhs[5])*sizeof(SCOTCH_Num));
+    for (i=0; i<mxGetM(prhs[5])*mxGetN(prhs[5]); i++)
+      archpar[i]=(SCOTCH_Num)apd[i];
+    mexPrintf("%s -- Architecture parameter vector is of size %d by %d.\n",
+              "gmap_mex",mxGetM(prhs[5]),mxGetN(prhs[5]));
+  }
+
+  argcm=nrhs+1-6;
+  mexPrintf("argcm=%d\n",argcm);
+  strcpy(argvm[0],"gmap");
+  for (i=6; i<nrhs; i++)
+    if (!mxIsChar(prhs[i])) {
+      mexPrintf("%s -- prhs[%d] must be character.\n","gmap_mex",i);
+      mexErrMsgTxt(" ");
+    }
+    else
+      mxGetString(prhs[i],argvm[i-5],256);
+  for (i=0; i<argcm; i++)
+    mexPrintf("argvm[%d]=\"%s\"\n",i,argvm[i]);
+
+  flagval = C_FLAGNONE;                           /* Default behavior */
+  i = strlen (argvm[0]);
+  if ((i >= 5) && (strncmp (argvm[0] + i - 5, "gpart", 5) == 0)) {
+    flagval |= C_FLAGPART;
+    C_paraNbr = 1;                                /* One more parameter       */
+    C_fileNbr = 3;                                /* One less file to provide */
+    errorProg ("gpart");
+  }
+  else
+    errorProg ("gmap");
+
+  intRandInit ();
+
+  if ((argcm >= 2) && (argvm[1][0] == '?')) {       /* If need for help */
+    usagePrint (stdout, C_usageList);
+/*    return     (0); */
+    plhs[0]=mxCreateDoubleMatrix(1, 1, mxREAL);
+    *mxGetPr(plhs[0])=0.;
+    return;
+  }
+
+  grafflag = 0;                                   /* Use vertex and edge weights  */
+  SCOTCH_stratInit (&stradat);                    /* Set default mapping strategy */
+
+  printf("point 0: C_FILENBR=%d, C_fileNbr=%d, C_paraNbr=%d\n",
+         C_FILENBR,C_fileNbr,C_paraNbr);
+  for (i = 0; i < C_FILENBR; i ++)                /* Set default stream pointers */
+    C_fileTab[i].pntr = (C_fileTab[i].mode[0] == 'r') ? stdin : stdout;
+  for (i = 1; i < argcm; i ++) {                   /* Loop for all option codes                        */
+  printf("point 1: i=%d; C_fileNbr=%d, C_fileNum=%d, C_paraNbr=%d, C_paraNum=%d\n",
+         i,C_fileNbr,C_fileNum,C_paraNbr,C_paraNum);
+    if ((argvm[i][0] != '-') || (argvm[i][1] == '\0') || (argvm[i][1] == '.')) { /* If found a file name */
+  printf("point 2: i=%d; C_fileNbr=%d, C_fileNum=%d, C_paraNbr=%d, C_paraNum=%d\n",
+         i,C_fileNbr,C_fileNum,C_paraNbr,C_paraNum);
+      if (C_paraNum < C_paraNbr) {                /* If number of parameters not reached              */
+        if ((C_partNbr = atoi (argvm[i])) < 1)     /* Get the number of parts                          */
+          errorPrint ("main: invalid number of parts (\"%s\")", argvm[i]);
+        C_paraNum ++;
+        continue;                                 /* Process the other parameters */
+      }
+  printf("point 3: i=%d; C_fileNbr=%d, C_fileNum=%d, C_paraNbr=%d, C_paraNum=%d\n",
+         i,C_fileNbr,C_fileNum,C_paraNbr,C_paraNum);
+      if (C_fileNum < C_fileNbr)                  /* A file name has been given */
+        C_fileTab[C_fileNum ++].name = argvm[i];
+      else
+        errorPrint ("main: too many file names given");
+  printf("point 4: i=%d; C_fileNbr=%d, C_fileNum=%d, C_paraNbr=%d, C_paraNum=%d\n",
+         i,C_fileNbr,C_fileNum,C_paraNbr,C_paraNum);
+    }
+    else {                                        /* If found an option name */
+      switch (argvm[i][1]) {
+        case 'H' :                                /* Give the usage message */
+        case 'h' :
+          usagePrint (stdout, C_usageList);
+/*          return     (0); */
+          plhs[0]=mxCreateDoubleMatrix(1, 1, mxREAL);
+          *mxGetPr(plhs[0])=0.;
+          return;
+        case 'M' :
+        case 'm' :
+          SCOTCH_stratExit (&stradat);
+          SCOTCH_stratInit (&stradat);
+          SCOTCH_stratGraphMap (&stradat, &argvm[i][2]);
+          break;
+        case 'S' :
+        case 's' :                                /* Source graph parameters */
+          for (j = 2; argvm[i][j] != '\0'; j ++) {
+            switch (argvm[i][j]) {
+              case 'E' :
+              case 'e' :
+                grafflag |= 2;                    /* Do not load edge weights */
+                break;
+              case 'V' :
+              case 'v' :
+                grafflag |= 1;                    /* Do not load vertex weights */
+                break;
+              default :
+                errorPrint ("main: invalid source graph option (\"%c\")", argvm[i][j]);
+            }
+          }
+          break;
+        case 'V' :
+          fprintf (stderr, "gmap/gpart, version %s - F. Pellegrini\n", SCOTCH_VERSION);
+          fprintf (stderr, "Copyright 2004,2007,2008 ENSEIRB, INRIA & CNRS, France\n");
+          fprintf (stderr, "This software is libre/free software under CeCILL-C -- see the user's manual for more information\n");
+/*          return  (0); */
+          plhs[0]=mxCreateDoubleMatrix(1, 1, mxREAL);
+          *mxGetPr(plhs[0])=0.;
+          return;
+        case 'v' :                                /* Output control info */
+          for (j = 2; argvm[i][j] != '\0'; j ++) {
+            switch (argvm[i][j]) {
+              case 'M' :
+              case 'm' :
+                flagval |= C_FLAGVERBMAP;
+                break;
+              case 'S' :
+              case 's' :
+                flagval |= C_FLAGVERBSTR;
+                break;
+              case 'T' :
+              case 't' :
+                flagval |= C_FLAGVERBTIM;
+                break;
+              default :
+                errorPrint ("main: unprocessed parameter \"%c\" in \"%s\"", argvm[i][j], argvm[i]);
+            }
+          }
+          break;
+        default :
+          errorPrint ("main: unprocessed option (\"%s\")", argvm[i]);
+      }
+    }
+  }
+  printf("point 5\n");
+  if ((flagval & C_FLAGPART) != 0) {              /* If program run as the partitioner            */
+    C_fileTab[3].name = C_fileTab[2].name;        /* Put provided file names at their right place */
+    C_fileTab[2].name = C_fileTab[1].name;
+    C_fileTab[1].name = "-";
+  }
+  printf("point 6\n");
+
+  fileBlockOpen (C_fileTab, C_FILENBR);           /* Open all files */
+  for (i=0; i<C_FILENBR; i++)
+    mexPrintf("C_fileTab[%d]: name=\"%s\",pntr=%p,mode=\"%s\"\n",
+              i,C_fileTab[i].name,C_fileTab[i].pntr,C_fileTab[i].mode);
+  printf("point 7\n");
+
+  clockInit  (&runtime[0]);
+  clockStart (&runtime[0]);
+  printf("point 8\n");
+
+  SCOTCH_graphInit (&grafdat);                    /* Create graph structure         */
+  SCOTCH_graphLoad (&grafdat, C_filepntrsrcinp, -1, grafflag, nvert, nedge2, adjir, adjjc, vertlab, vertwgt, edgewgt); /* Read source graph */
+
+  printf("point 9\n");
+  SCOTCH_archInit (&archdat);                     /* Create architecture structure          */
+  if ((flagval & C_FLAGPART) != 0)                /* If program run as the partitioner      */
+    SCOTCH_archCmplt (&archdat, C_partNbr);       /* Create a complete graph of proper size */
+  else
+    SCOTCH_archLoad (&archdat, C_filepntrtgtinp, archtyp, napar, archpar); /* Read target architecture */
+  printf("point 10\n");
+
+  clockStop  (&runtime[0]);                       /* Get input time */
+  clockInit  (&runtime[1]);
+  clockStart (&runtime[1]);
+
+  SCOTCH_graphMapInit    (&grafdat, &mapdat, &archdat, NULL);
+  SCOTCH_graphMapCompute (&grafdat, &mapdat, &stradat); /* Perform mapping */
+  printf("point 11\n");
+
+  clockStop  (&runtime[1]);                       /* Get computation time */
+  clockStart (&runtime[0]);
+
+  SCOTCH_graphMapSave (&nvert, &maptab, &grafdat, &mapdat, C_filepntrmapout); /* Write mapping */
+
+/*  for (i=0; i<nvert; i++)
+    printf("maptab[%d][0]=%d, maptab[%d][1]=%d\n",
+           i,maptab[i][0],i,maptab[i][1]); */
+  if (maptab) {
+    plhs[1]=mxCreateDoubleMatrix(nvert, 2, mxREAL);
+    maptabm = mxGetPr(plhs[1]);
+    k=0;
+    for (j=0; j<2; j++)
+      for (i=0; i<nvert; i++)
+          maptabm[k++]=(double)maptab[i][j];
+    free(maptab);
+  }
+  printf("point 12\n");
+
+  clockStop (&runtime[0]);                        /* Get output time */
+
+  if (flagval & C_FLAGVERBSTR) {
+    fprintf (C_filepntrlogout, "S\tStrat=");
+    SCOTCH_stratSave (&stradat, C_filepntrlogout);
+    putc ('\n', C_filepntrlogout);
+  }
+  printf("point 13\n");
+  if (flagval & C_FLAGVERBTIM) {
+    fprintf (C_filepntrlogout, "T\tMapping\t\t%g\nT\tI/O\t\t%g\nT\tTotal\t\t%g\n",
+             (double) clockVal (&runtime[1]),
+             (double) clockVal (&runtime[0]),
+             (double) clockVal (&runtime[0]) +
+             (double) clockVal (&runtime[1]));
+  }
+  printf("point 14\n");
+  if (flagval & C_FLAGVERBMAP)
+    SCOTCH_graphMapView (&grafdat, &mapdat, C_filepntrlogout);
+  printf("point 15\n");
+
+  fileBlockClose (C_fileTab, C_FILENBR);          /* Always close explicitely to end eventual (un)compression tasks */
+
+  printf("point 16\n");
+  SCOTCH_graphMapExit (&grafdat, &mapdat);
+  printf("point 16a\n");
+  SCOTCH_graphExit    (&grafdat);
+  printf("point 16b\n");
+  SCOTCH_stratExit    (&stradat);
+  printf("point 16c\n");
+  SCOTCH_archExit     (&archdat);
+  printf("point 17\n");
+
+  if (archpar) free(archpar);
+  if (edgewgt) free(edgewgt);
+  if (vertwgt) free(vertwgt);
+  if (vertlab) free(vertlab);
+  if (adjjc) free(adjjc);
+  if (adjir) free(adjir);
+
+#ifdef COMMON_PTHREAD
+  pthread_exit ((void *) 0);                      /* Allow potential (un)compression tasks to complete */
+#endif /* COMMON_PTHREAD */
+  printf("point 18\n");
+/*  return (0); */
+  plhs[0]=mxCreateDoubleMatrix(1, 1, mxREAL);
+  *mxGetPr(plhs[0])=0.;
+  return;
+}
Index: /issm/trunk/externalpackages/scotch/install.sh
===================================================================
--- /issm/trunk/externalpackages/scotch/install.sh	(revision 3003)
+++ /issm/trunk/externalpackages/scotch/install.sh	(revision 3003)
@@ -0,0 +1,32 @@
+#!/bin/bash
+
+# Some cleanup
+rm -rf scotch_5.1
+rm -rf src 
+rm -rf install 
+
+# Create src and install directories
+mkdir src install 
+
+# Untar 
+tar -xvzf scotch_5.1.6.tar.gz
+
+# Move scotch to src directory
+mv scotch_5.1/* src
+rm -rf scotch_5.1
+
+# Apply patches (all at once, since many)
+# (written by diff -rc src ~/Libs/scotch_5.1 > scotch.patch)
+patch -p0 < scotch.patch
+
+# Build scotch
+cp Makefile.inc src/src
+cp gmap_mex.c src/src/scotch
+cd src/src
+make mexscotch
+# For stand-alone scotch modules, also execute below
+#make
+# Clean up
+make clean
+cd ../..
+
Index: /issm/trunk/externalpackages/scotch/scotch.patch
===================================================================
--- /issm/trunk/externalpackages/scotch/scotch.patch	(revision 3003)
+++ /issm/trunk/externalpackages/scotch/scotch.patch	(revision 3003)
@@ -0,0 +1,1677 @@
+Only in /home/jschierm/Libs/scotch_5.1: 3elt.log
+Only in /home/jschierm/Libs/scotch_5.1: 3elt.map
+Only in /home/jschierm/Libs/scotch_5.1: bin
+Only in /home/jschierm/Libs/scotch_5.1: diary
+Only in /home/jschierm/Libs/scotch_5.1: gmap.log
+Only in /home/jschierm/Libs/scotch_5.1: gmap.m
+Only in /home/jschierm/Libs/scotch_5.1: gmap.map
+Only in /home/jschierm/Libs/scotch_5.1/grf: 3elt.grf
+Only in src/grf: 3elt.grf.gz
+Only in /home/jschierm/Libs/scotch_5.1/grf: 3elt.xyz
+Only in src/grf: 3elt.xyz.gz
+Only in /home/jschierm/Libs/scotch_5.1/grf: 4elt2.grf
+Only in src/grf: 4elt2.grf.gz
+Only in /home/jschierm/Libs/scotch_5.1/grf: 4elt2.xyz
+Only in src/grf: 4elt2.xyz.gz
+Only in /home/jschierm/Libs/scotch_5.1/grf: 4elt.grf
+Only in src/grf: 4elt.grf.gz
+Only in /home/jschierm/Libs/scotch_5.1/grf: 4elt.xyz
+Only in src/grf: 4elt.xyz.gz
+Only in /home/jschierm/Libs/scotch_5.1/grf: bump.grf
+Only in src/grf: bump.grf.gz
+Only in /home/jschierm/Libs/scotch_5.1/grf: bump.xyz
+Only in src/grf: bump.xyz.gz
+Only in /home/jschierm/Libs/scotch_5.1: include
+Only in /home/jschierm/Libs/scotch_5.1: lib
+Only in /home/jschierm/Libs/scotch_5.1: ScotchGraphWrite.m
+Only in /home/jschierm/Libs/scotch_5.1: ScotchMapRead.m
+Only in /home/jschierm/Libs/scotch_5.1: ScotchRun.m
+Only in /home/jschierm/Libs/scotch_5.1: scotch_save.tar
+Only in /home/jschierm/Libs/scotch_5.1: ScotchTargetWrite.m
+diff -rc src/src/libscotch/arch.c /home/jschierm/Libs/scotch_5.1/src/libscotch/arch.c
+*** src/src/libscotch/arch.c	2008-09-27 07:48:01.000000000 -0700
+--- /home/jschierm/Libs/scotch_5.1/src/libscotch/arch.c	2010-02-10 11:08:45.873926805 -0800
+***************
+*** 173,187 ****
+  int
+  archLoad (
+  Arch * restrict const       archptr,
+! FILE * const                stream)
+  {
+    const ArchClass * restrict  class;              /* Pointer to architecture class */
+    char                        name[256];          /* Architecture name string      */
+  
+    if (fscanf (stream, "%255s", name) != 1) {      /* Read architecture name */
+      errorPrint ("archLoad: cannot load architecture type");
+      return     (1);
+    }
+    name[255] = '\0';                               /* Set end of string */
+  
+    if ((class = archClass (name)) == NULL) {       /* Get class from its name */
+--- 173,203 ----
+  int
+  archLoad (
+  Arch * restrict const       archptr,
+! FILE * const                stream
+! #ifdef MATLAB
+!                                   ,
+! const char *                archtyp,
+! const Anum                  napar,
+! const Anum *                archpar
+! #endif /* MATLAB */
+!                                    )
+  {
+    const ArchClass * restrict  class;              /* Pointer to architecture class */
+    char                        name[256];          /* Architecture name string      */
+  
++ #ifdef MATLAB
++   printf("archLoad - stream=%p; archtyp=\"%s\"\n",stream,archtyp);
++   printf("archLoad - napar=%d,archpar=%p\n",napar,archpar);
++ #endif /* MATLAB */
++ 
++ #ifndef MATLAB
+    if (fscanf (stream, "%255s", name) != 1) {      /* Read architecture name */
+      errorPrint ("archLoad: cannot load architecture type");
+      return     (1);
+    }
++ #else /* MATLAB */
++   strcpy(name,archtyp);
++ #endif /* MATLAB */
+    name[255] = '\0';                               /* Set end of string */
+  
+    if ((class = archClass (name)) == NULL) {       /* Get class from its name */
+***************
+*** 190,196 ****
+--- 206,216 ----
+    }
+  
+    if (class->archLoad != NULL) {                  /* If class has loading function */
++ #ifndef MATLAB
+      if (class->archLoad (&archptr->data, stream) != 0) { /* Load class data        */
++ #else /* MATLAB */
++     if (class->archLoad (&archptr->data, stream, napar, archpar) != 0) { /* Load class data        */
++ #endif /* MATLAB */
+        errorPrint ("archLoad: cannot load architecture data");
+        memset     (archptr, 0, sizeof (Arch));     /* Initialize architecture body */
+        return     (1);
+diff -rc src/src/libscotch/arch_cmplt.c /home/jschierm/Libs/scotch_5.1/src/libscotch/arch_cmplt.c
+*** src/src/libscotch/arch_cmplt.c	2008-05-22 06:44:41.000000000 -0700
+--- /home/jschierm/Libs/scotch_5.1/src/libscotch/arch_cmplt.c	2010-02-08 15:42:01.878691914 -0800
+***************
+*** 90,99 ****
+  int
+  archCmpltArchLoad (
+  ArchCmplt * restrict const  archptr,
+! FILE * restrict const       stream)
+  {
+    long                numnbr;
+  
+  #ifdef SCOTCH_DEBUG_ARCH1
+    if ((sizeof (ArchCmplt)    > sizeof (ArchDummy)) ||
+        (sizeof (ArchCmpltDom) > sizeof (ArchDomDummy))) {
+--- 90,109 ----
+  int
+  archCmpltArchLoad (
+  ArchCmplt * restrict const  archptr,
+! FILE * restrict const       stream
+! #ifdef MATLAB
+!                                   ,
+! const Anum                  napar,
+! const Anum *                archpar
+! #endif /* MATLAB */
+!                                    )
+  {
+    long                numnbr;
+  
++ #ifdef MATLAB
++   printf("archCmpltArchLoad - napar=%d,archpar=%p\n",napar,archpar);
++ #endif /* MATLAB */
++ 
+  #ifdef SCOTCH_DEBUG_ARCH1
+    if ((sizeof (ArchCmplt)    > sizeof (ArchDummy)) ||
+        (sizeof (ArchCmpltDom) > sizeof (ArchDomDummy))) {
+***************
+*** 102,109 ****
+--- 112,124 ----
+    }
+  #endif /* SCOTCH_DEBUG_ARCH1 */
+  
++ #ifndef MATLAB
+    if ((fscanf (stream, "%ld", &numnbr) != 1) ||
+        (numnbr < 1)) {
++ #else /* MATLAB */
++   if ((napar < 1) ||
++       ((numnbr=(long)archpar[0]) < 1)) {
++ #endif /* MATLAB */
+      errorPrint ("archCmpltArchLoad: bad input");
+      return     (1);
+    }
+diff -rc src/src/libscotch/arch_cmplt.h /home/jschierm/Libs/scotch_5.1/src/libscotch/arch_cmplt.h
+*** src/src/libscotch/arch_cmplt.h	2008-05-22 06:44:41.000000000 -0700
+--- /home/jschierm/Libs/scotch_5.1/src/libscotch/arch_cmplt.h	2010-02-08 15:24:01.543386538 -0800
+***************
+*** 87,93 ****
+--- 87,97 ----
+  #define static
+  #endif
+  
++ #ifndef MATLAB
+  int                         archCmpltArchLoad   (ArchCmplt * restrict const, FILE * restrict const);
++ #else /* MATLAB */
++ int                         archCmpltArchLoad   (ArchCmplt * restrict const, FILE * restrict const, const Anum, const Anum *);
++ #endif /* MATLAB */
+  int                         archCmpltArchSave   (const ArchCmplt * const, FILE * restrict const);
+  #define archCmpltArchFree           NULL
+  ArchDomNum                  archCmpltDomNum     (const ArchCmplt * const, const ArchCmpltDom * const);
+Only in /home/jschierm/Libs/scotch_5.1/src/libscotch: arch_cmplt_old.c
+Only in /home/jschierm/Libs/scotch_5.1/src/libscotch: arch_cmplt_old.h
+diff -rc src/src/libscotch/arch_cmpltw.c /home/jschierm/Libs/scotch_5.1/src/libscotch/arch_cmpltw.c
+*** src/src/libscotch/arch_cmpltw.c	2008-08-27 14:22:22.000000000 -0700
+--- /home/jschierm/Libs/scotch_5.1/src/libscotch/arch_cmpltw.c	2010-02-08 15:44:15.206851120 -0800
+***************
+*** 200,211 ****
+  int
+  archCmpltwArchLoad (
+  ArchCmpltw * restrict const  archptr,
+! FILE * restrict const       stream)
+  {
+    long                vertnbr;
+    Gnum                velosum;
+    Anum                vertnum;
+  
+  #ifdef SCOTCH_DEBUG_ARCH1
+    if ((sizeof (ArchCmpltw)    > sizeof (ArchDummy)) ||
+        (sizeof (ArchCmpltwDom) > sizeof (ArchDomDummy))) {
+--- 200,221 ----
+  int
+  archCmpltwArchLoad (
+  ArchCmpltw * restrict const  archptr,
+! FILE * restrict const       stream
+! #ifdef MATLAB
+!                                   ,
+! const Anum                  napar,
+! const Anum *                archpar
+! #endif /* MATLAB */
+!                                    )
+  {
+    long                vertnbr;
+    Gnum                velosum;
+    Anum                vertnum;
+  
++ #ifdef MATLAB
++   printf("archCmpltwArchLoad - napar=%d,archpar=%p\n",napar,archpar);
++ #endif /* MATLAB */
++ 
+  #ifdef SCOTCH_DEBUG_ARCH1
+    if ((sizeof (ArchCmpltw)    > sizeof (ArchDummy)) ||
+        (sizeof (ArchCmpltwDom) > sizeof (ArchDomDummy))) {
+***************
+*** 214,221 ****
+--- 224,236 ----
+    }
+  #endif /* SCOTCH_DEBUG_ARCH1 */
+  
++ #ifndef MATLAB
+    if ((fscanf (stream, "%ld", &vertnbr) != 1) ||
+        (vertnbr < 1)) {
++ #else /* MATLAB */
++   if ((napar < 1) ||
++       ((vertnbr=(long)archpar[0]) < 1)) {
++ #endif /* MATLAB */
+      errorPrint ("archCmpltwArchLoad: bad input (1)");
+      return     (1);
+    }
+***************
+*** 230,237 ****
+--- 245,257 ----
+      long                veloval;
+      Gnum                velotmp;
+  
++ #ifndef MATLAB
+      if ((fscanf (stream, "%ld", &veloval) != 1) ||
+          (veloval < 1)) {
++ #else /* MATLAB */
++     if ((napar < 1+(vertnum+1)) ||
++         ((veloval=(long)archpar[1+(vertnum+1)]) < 1)) {
++ #endif /* MATLAB */
+        errorPrint ("archCmpltwArchLoad: bad input (2)");
+        return     (1);
+      }
+diff -rc src/src/libscotch/arch_cmpltw.h /home/jschierm/Libs/scotch_5.1/src/libscotch/arch_cmpltw.h
+*** src/src/libscotch/arch_cmpltw.h	2008-05-22 06:44:41.000000000 -0700
+--- /home/jschierm/Libs/scotch_5.1/src/libscotch/arch_cmpltw.h	2010-02-09 11:44:11.147224781 -0800
+***************
+*** 86,92 ****
+--- 86,96 ----
+  #endif
+  
+  int                         archCmpltwArchBuild (ArchCmpltw * restrict const archptr, const Gnum, const Gnum * restrict const);
++ #ifndef MATLAB
+  int                         archCmpltwArchLoad  (ArchCmpltw * restrict const, FILE * restrict const);
++ #else /* MATLAB */
++ int                         archCmpltwArchLoad  (ArchCmpltw * restrict const, FILE * restrict const, const Anum, const Anum *);
++ #endif /* MATLAB */
+  int                         archCmpltwArchSave  (const ArchCmpltw * const, FILE * restrict const);
+  int                         archCmpltwArchFree  (ArchCmpltw * restrict const);
+  ArchDomNum                  archCmpltwDomNum    (const ArchCmpltw * const, const ArchCmpltwDom * const);
+Only in /home/jschierm/Libs/scotch_5.1/src/libscotch: arch_cmpltw_old.c
+Only in /home/jschierm/Libs/scotch_5.1/src/libscotch: arch_cmpltw_old.h
+diff -rc src/src/libscotch/arch_deco.c /home/jschierm/Libs/scotch_5.1/src/libscotch/arch_deco.c
+*** src/src/libscotch/arch_deco.c	2008-09-28 06:35:27.000000000 -0700
+--- /home/jschierm/Libs/scotch_5.1/src/libscotch/arch_deco.c	2010-02-08 15:46:23.549004027 -0800
+***************
+*** 211,217 ****
+  int
+  archDecoArchLoad (
+  ArchDeco * restrict const   archptr,
+! FILE * restrict const       stream)
+  {
+    INT                         decotype;           /* Type of decomposition                            */
+    INT                         termdomnbr;         /* Number of terminal domains (ie processors)       */
+--- 211,223 ----
+  int
+  archDecoArchLoad (
+  ArchDeco * restrict const   archptr,
+! FILE * restrict const       stream
+! #ifdef MATLAB
+!                                   ,
+! const Anum                  napar,
+! const Anum *                archpar
+! #endif /* MATLAB */
+!                                    )
+  {
+    INT                         decotype;           /* Type of decomposition                            */
+    INT                         termdomnbr;         /* Number of terminal domains (ie processors)       */
+***************
+*** 220,225 ****
+--- 226,237 ----
+    Anum * restrict             termdisttab;        /* Table of terminal-to-terminal distances          */
+    INT                         i, j;
+  
++ #ifdef MATLAB
++   printf("archDecoArchLoad - napar=%d,archpar=%p\n",napar,archpar);
++   errorPrint ("archDecoArchLoad - not yet converted to matlab matrices");
++   return     (1);
++ #endif /* MATLAB */
++ 
+  #ifdef SCOTCH_DEBUG_ARCH1
+    if ((sizeof (ArchDeco)    > sizeof (ArchDummy)) ||
+        (sizeof (ArchDecoDom) > sizeof (ArchDomDummy))) {
+diff -rc src/src/libscotch/arch_deco.h /home/jschierm/Libs/scotch_5.1/src/libscotch/arch_deco.h
+*** src/src/libscotch/arch_deco.h	2008-09-27 07:49:46.000000000 -0700
+--- /home/jschierm/Libs/scotch_5.1/src/libscotch/arch_deco.h	2010-02-08 15:25:21.216483840 -0800
+***************
+*** 113,119 ****
+--- 113,123 ----
+  #endif
+  
+  int                         archDecoArchBuild   (ArchDeco * const, const Anum, const Anum, const ArchDecoTermVert * const, const Anum  * const);
++ #ifndef MATLAB
+  int                         archDecoArchLoad    (ArchDeco * const, FILE * restrict const);
++ #else /* MATLAB */
++ int                         archDecoArchLoad    (ArchDeco * const, FILE * restrict const, const Anum, const Anum *);
++ #endif /* MATLAB */
+  int                         archDecoArchSave    (const ArchDeco * const, FILE * restrict const);
+  int                         archDecoArchFree    (ArchDeco * const);
+  Anum                        archDecoArchSize    (ArchDeco * const, const Anum);
+Only in /home/jschierm/Libs/scotch_5.1/src/libscotch: arch_deco_old.c
+Only in /home/jschierm/Libs/scotch_5.1/src/libscotch: arch_deco_old.h
+diff -rc src/src/libscotch/arch.h /home/jschierm/Libs/scotch_5.1/src/libscotch/arch.h
+*** src/src/libscotch/arch.h	2009-04-28 08:11:27.000000000 -0700
+--- /home/jschierm/Libs/scotch_5.1/src/libscotch/arch.h	2010-02-08 15:14:06.397653868 -0800
+***************
+*** 175,181 ****
+--- 175,185 ----
+  int                         archInit            (Arch * restrict const);
+  int                         archExit            (Arch * restrict const);
+  int                         archFree            (Arch * restrict const);
++ #ifndef MATLAB
+  int                         archLoad            (Arch * restrict const, FILE * const);
++ #else /* MATLAB */
++ int                         archLoad            (Arch * restrict const, FILE * const, const char *, const Anum, const Anum *);
++ #endif /* MATLAB */
+  int                         archSave            (const Arch * const, FILE * const);
+  char *                      archName            (const Arch * const);
+  const ArchClass *           archClass           (const char * const);
+diff -rc src/src/libscotch/arch_hcub.c /home/jschierm/Libs/scotch_5.1/src/libscotch/arch_hcub.c
+*** src/src/libscotch/arch_hcub.c	2008-05-22 06:44:41.000000000 -0700
+--- /home/jschierm/Libs/scotch_5.1/src/libscotch/arch_hcub.c	2010-02-08 15:48:09.189129642 -0800
+***************
+*** 88,95 ****
+  int
+  archHcubArchLoad (
+  ArchHcub * restrict const   archptr,
+! FILE * restrict const       stream)
+! {
+  #ifdef SCOTCH_DEBUG_ARCH1
+    if ((sizeof (ArchHcub)    > sizeof (ArchDummy)) ||
+        (sizeof (ArchHcubDom) > sizeof (ArchDomDummy))) {
+--- 88,105 ----
+  int
+  archHcubArchLoad (
+  ArchHcub * restrict const   archptr,
+! FILE * restrict const       stream
+! #ifdef MATLAB
+!                                   ,
+! const Anum                  napar,
+! const Anum *                archpar
+! #endif /* MATLAB */
+!                                    )
+! {
+! #ifdef MATLAB
+!   printf("archHcubArchLoad - napar=%d,archpar=%p\n",napar,archpar);
+! #endif /* MATLAB */
+! 
+  #ifdef SCOTCH_DEBUG_ARCH1
+    if ((sizeof (ArchHcub)    > sizeof (ArchDummy)) ||
+        (sizeof (ArchHcubDom) > sizeof (ArchDomDummy))) {
+***************
+*** 98,105 ****
+--- 108,120 ----
+    }
+  #endif /* SCOTCH_DEBUG_ARCH1 */
+  
++ #ifndef MATLAB
+    if ((intLoad (stream, &archptr->dimmax) != 1) ||
+        (archptr->dimmax < 1)                     ||
++ #else /* MATLAB */
++   if ((napar < 1)                        ||
++       ((archptr->dimmax=archpar[0]) < 1) ||
++ #endif /* MATLAB */
+        (archptr->dimmax > (sizeof (archptr->dimmax) << 3))) {
+      errorPrint ("archHcubArchLoad: bad input");
+      return     (1);
+diff -rc src/src/libscotch/arch_hcub.h /home/jschierm/Libs/scotch_5.1/src/libscotch/arch_hcub.h
+*** src/src/libscotch/arch_hcub.h	2008-05-22 06:44:41.000000000 -0700
+--- /home/jschierm/Libs/scotch_5.1/src/libscotch/arch_hcub.h	2010-02-08 15:26:06.864539511 -0800
+***************
+*** 85,91 ****
+--- 85,95 ----
+  #define static
+  #endif
+  
++ #ifndef MATLAB
+  int                         archHcubArchLoad    (ArchHcub * restrict const, FILE * restrict const);
++ #else /* MATLAB */
++ int                         archHcubArchLoad    (ArchHcub * restrict const, FILE * restrict const, const Anum, const Anum *);
++ #endif /* MATLAB */
+  int                         archHcubArchSave    (const ArchHcub * const, FILE * restrict const);
+  #define archHcubArchFree            NULL
+  ArchDomNum                  archHcubDomNum      (const ArchHcub * const, const ArchHcubDom * const);
+Only in /home/jschierm/Libs/scotch_5.1/src/libscotch: arch_hcub_old.c
+Only in /home/jschierm/Libs/scotch_5.1/src/libscotch: arch_hcub_old.h
+diff -rc src/src/libscotch/arch_mesh.c /home/jschierm/Libs/scotch_5.1/src/libscotch/arch_mesh.c
+*** src/src/libscotch/arch_mesh.c	2008-05-22 06:44:41.000000000 -0700
+--- /home/jschierm/Libs/scotch_5.1/src/libscotch/arch_mesh.c	2010-02-08 15:52:01.266404851 -0800
+***************
+*** 96,103 ****
+  int
+  archMesh2ArchLoad (
+  ArchMesh2 * restrict const  archptr,
+! FILE * restrict const       stream)
+! {
+  #ifdef SCOTCH_DEBUG_ARCH1
+    if ((sizeof (ArchMesh2)    > sizeof (ArchDummy)) ||
+        (sizeof (ArchMesh2Dom) > sizeof (ArchDomDummy))) {
+--- 96,113 ----
+  int
+  archMesh2ArchLoad (
+  ArchMesh2 * restrict const  archptr,
+! FILE * restrict const       stream
+! #ifdef MATLAB
+!                                   ,
+! const Anum                  napar,
+! const Anum *                archpar
+! #endif /* MATLAB */
+!                                    )
+! {
+! #ifdef MATLAB
+!   printf("archMesh2ArchLoad - napar=%d,archpar=%p\n",napar,archpar);
+! #endif /* MATLAB */
+! 
+  #ifdef SCOTCH_DEBUG_ARCH1
+    if ((sizeof (ArchMesh2)    > sizeof (ArchDummy)) ||
+        (sizeof (ArchMesh2Dom) > sizeof (ArchDomDummy))) {
+***************
+*** 106,114 ****
+--- 116,130 ----
+    }
+  #endif /* SCOTCH_DEBUG_ARCH1 */
+  
++ #ifndef MATLAB
+    if ((intLoad (stream, &archptr->c[0]) != 1) ||
+        (intLoad (stream, &archptr->c[1]) != 1) ||
+        (archptr->c[0] < 1) || (archptr->c[1] < 1)) {
++ #else /* MATLAB */
++   if ((napar < 2)                      ||
++       ((archptr->c[0]=archpar[0]) < 1) ||
++       ((archptr->c[1]=archpar[1]) < 1)) {
++ #endif /* MATLAB */
+      errorPrint ("archMesh2ArchLoad: bad input");
+      return     (1);
+    }
+***************
+*** 421,428 ****
+  int
+  archMesh3ArchLoad (
+  ArchMesh3 * restrict const  archptr,
+! FILE * restrict const       stream)
+! {
+  #ifdef SCOTCH_DEBUG_ARCH1
+    if ((sizeof (ArchMesh3)    > sizeof (ArchDummy)) ||
+        (sizeof (ArchMesh3Dom) > sizeof (ArchDomDummy))) {
+--- 437,454 ----
+  int
+  archMesh3ArchLoad (
+  ArchMesh3 * restrict const  archptr,
+! FILE * restrict const       stream
+! #ifdef MATLAB
+!                                   ,
+! const Anum                  napar,
+! const Anum *                archpar
+! #endif /* MATLAB */
+!                                    )
+! {
+! #ifdef MATLAB
+!   printf("archMesh3ArchLoad - napar=%d,archpar=%p\n",napar,archpar);
+! #endif /* MATLAB */
+! 
+  #ifdef SCOTCH_DEBUG_ARCH1
+    if ((sizeof (ArchMesh3)    > sizeof (ArchDummy)) ||
+        (sizeof (ArchMesh3Dom) > sizeof (ArchDomDummy))) {
+***************
+*** 431,440 ****
+--- 457,473 ----
+    }
+  #endif /* SCOTCH_DEBUG_ARCH1 */
+  
++ #ifndef MATLAB
+    if ((intLoad (stream, &archptr->c[0]) != 1) ||
+        (intLoad (stream, &archptr->c[1]) != 1) ||
+        (intLoad (stream, &archptr->c[2]) != 1) ||
+        (archptr->c[0] < 1) || (archptr->c[1] < 1) || (archptr->c[2] < 1)) {
++ #else /* MATLAB */
++   if ((napar < 3)                      ||
++       ((archptr->c[0]=archpar[0]) < 1) ||
++       ((archptr->c[1]=archpar[1]) < 1) ||
++       ((archptr->c[2]=archpar[2]) < 1)) {
++ #endif /* MATLAB */
+      errorPrint ("archMesh3ArchLoad: bad input");
+      return     (1);
+    }
+diff -rc src/src/libscotch/arch_mesh.h /home/jschierm/Libs/scotch_5.1/src/libscotch/arch_mesh.h
+*** src/src/libscotch/arch_mesh.h	2008-05-22 06:44:41.000000000 -0700
+--- /home/jschierm/Libs/scotch_5.1/src/libscotch/arch_mesh.h	2010-02-08 15:27:29.654640338 -0800
+***************
+*** 96,102 ****
+--- 96,106 ----
+  #define static
+  #endif
+  
++ #ifndef MATLAB
+  int                         archMesh2ArchLoad   (ArchMesh2 * restrict const, FILE * restrict const);
++ #else /* MATLAB */
++ int                         archMesh2ArchLoad   (ArchMesh2 * restrict const, FILE * restrict const, const Anum, const Anum *);
++ #endif /* MATLAB */
+  int                         archMesh2ArchSave   (const ArchMesh2 * const, FILE * restrict const);
+  #define archMesh2ArchFree           NULL
+  ArchDomNum                  archMesh2DomNum     (const ArchMesh2 * const, const ArchMesh2Dom * const);
+***************
+*** 114,120 ****
+--- 118,128 ----
+  int                         archMesh2DomMpiType (const ArchMesh2 * const, MPI_Datatype * const);
+  #endif /* SCOTCH_PTSCOTCH */
+  
++ #ifndef MATLAB
+  int                         archMesh3ArchLoad   (ArchMesh3 * restrict const, FILE * restrict const);
++ #else /* MATLAB */
++ int                         archMesh3ArchLoad   (ArchMesh3 * restrict const, FILE * restrict const, const Anum, const Anum *);
++ #endif /* MATLAB */
+  int                         archMesh3ArchSave   (const ArchMesh3 * const, FILE * restrict const);
+  #define archMesh3ArchFree           NULL
+  ArchDomNum                  archMesh3DomNum     (const ArchMesh3 * const, const ArchMesh3Dom * const);
+Only in /home/jschierm/Libs/scotch_5.1/src/libscotch: arch_mesh_old.c
+Only in /home/jschierm/Libs/scotch_5.1/src/libscotch: arch_mesh_old.h
+Only in /home/jschierm/Libs/scotch_5.1/src/libscotch: arch_old.c
+Only in /home/jschierm/Libs/scotch_5.1/src/libscotch: arch_old.h
+diff -rc src/src/libscotch/arch_tleaf.c /home/jschierm/Libs/scotch_5.1/src/libscotch/arch_tleaf.c
+*** src/src/libscotch/arch_tleaf.c	2008-05-22 06:44:41.000000000 -0700
+--- /home/jschierm/Libs/scotch_5.1/src/libscotch/arch_tleaf.c	2010-02-08 15:53:28.701508248 -0800
+***************
+*** 92,99 ****
+  int
+  archTleafArchLoad (
+  ArchTleaf * restrict const  archptr,
+! FILE * restrict const       stream)
+! {
+  #ifdef SCOTCH_DEBUG_ARCH1
+    if ((sizeof (ArchTleaf)    > sizeof (ArchDummy)) ||
+        (sizeof (ArchTleafDom) > sizeof (ArchDomDummy))) {
+--- 92,109 ----
+  int
+  archTleafArchLoad (
+  ArchTleaf * restrict const  archptr,
+! FILE * restrict const       stream
+! #ifdef MATLAB
+!                                   ,
+! const Anum                  napar,
+! const Anum *                archpar
+! #endif /* MATLAB */
+!                                    )
+! {
+! #ifdef MATLAB
+!   printf("archTleafArchLoad - napar=%d,archpar=%p\n",napar,archpar);
+! #endif /* MATLAB */
+! 
+  #ifdef SCOTCH_DEBUG_ARCH1
+    if ((sizeof (ArchTleaf)    > sizeof (ArchDummy)) ||
+        (sizeof (ArchTleafDom) > sizeof (ArchDomDummy))) {
+***************
+*** 102,107 ****
+--- 112,118 ----
+    }
+  #endif /* SCOTCH_DEBUG_ARCH1 */
+  
++ #ifndef MATLAB
+    if ((intLoad (stream, &archptr->leafdep) != 1) ||
+        (intLoad (stream, &archptr->clusdep) != 1) ||
+        (intLoad (stream, &archptr->linkval) != 1) ||
+***************
+*** 109,114 ****
+--- 120,132 ----
+        (archptr->clusdep < 0)                     ||
+        (archptr->clusdep > archptr->leafdep)      ||
+        (archptr->linkval < 1)) {
++ #else /* MATLAB */
++   if ((napar < 3)                            ||
++       ((archptr->leafdep=archpar[0]) < 1)    ||
++       ((archptr->clusdep=archpar[1]) < 0)    ||
++       ( archptr->clusdep > archptr->leafdep) ||
++       ((archptr->linkval=archpar[2]) < 1)) {
++ #endif /* MATLAB */
+      errorPrint ("archTleafArchLoad: bad input");
+      return     (1);
+    }
+diff -rc src/src/libscotch/arch_tleaf.h /home/jschierm/Libs/scotch_5.1/src/libscotch/arch_tleaf.h
+*** src/src/libscotch/arch_tleaf.h	2008-05-22 06:44:41.000000000 -0700
+--- /home/jschierm/Libs/scotch_5.1/src/libscotch/arch_tleaf.h	2010-02-08 15:28:10.269689735 -0800
+***************
+*** 89,95 ****
+--- 89,99 ----
+  #define static
+  #endif
+  
++ #ifndef MATLAB
+  int                         archTleafArchLoad   (ArchTleaf * restrict const, FILE * restrict const);
++ #else /* MATLAB */
++ int                         archTleafArchLoad   (ArchTleaf * restrict const, FILE * restrict const, const Anum, const Anum *);
++ #endif /* MATLAB */
+  int                         archTleafArchSave   (const ArchTleaf * const, FILE * restrict const);
+  #define archTleafArchFree           NULL
+  ArchDomNum                  archTleafDomNum     (const ArchTleaf * const, const ArchTleafDom * const);
+Only in /home/jschierm/Libs/scotch_5.1/src/libscotch: arch_tleaf_old.c
+Only in /home/jschierm/Libs/scotch_5.1/src/libscotch: arch_tleaf_old.h
+diff -rc src/src/libscotch/arch_torus.c /home/jschierm/Libs/scotch_5.1/src/libscotch/arch_torus.c
+*** src/src/libscotch/arch_torus.c	2008-05-22 06:44:41.000000000 -0700
+--- /home/jschierm/Libs/scotch_5.1/src/libscotch/arch_torus.c	2010-02-10 09:58:44.790706850 -0800
+***************
+*** 90,97 ****
+  int
+  archTorus2ArchLoad (
+  ArchTorus2 * restrict const archptr,
+! FILE * restrict const       stream)
+! {
+  #ifdef SCOTCH_DEBUG_ARCH1
+    if ((sizeof (ArchTorus2)    > sizeof (ArchDummy)) ||
+        (sizeof (ArchTorus2Dom) > sizeof (ArchDomDummy))) {
+--- 90,107 ----
+  int
+  archTorus2ArchLoad (
+  ArchTorus2 * restrict const archptr,
+! FILE * restrict const       stream
+! #ifdef MATLAB
+!                                   ,
+! const Anum                  napar,
+! const Anum *                archpar
+! #endif /* MATLAB */
+!                                    )
+! {
+! #ifdef MATLAB
+!   printf("archTorus2ArchLoad - napar=%d,archpar=%p\n",napar,archpar);
+! #endif /* MATLAB */
+! 
+  #ifdef SCOTCH_DEBUG_ARCH1
+    if ((sizeof (ArchTorus2)    > sizeof (ArchDummy)) ||
+        (sizeof (ArchTorus2Dom) > sizeof (ArchDomDummy))) {
+***************
+*** 100,108 ****
+--- 110,124 ----
+    }
+  #endif /* SCOTCH_DEBUG_ARCH1 */
+  
++ #ifndef MATLAB
+    if ((intLoad (stream, &archptr->c[0]) != 1) ||
+        (intLoad (stream, &archptr->c[1]) != 1) ||
+        (archptr->c[0] < 1) || (archptr->c[1] < 1)) {
++ #else /* MATLAB */
++   if ((napar < 2)                      ||
++       ((archptr->c[0]=archpar[0]) < 1) ||
++       ((archptr->c[1]=archpar[1]) < 1)) {
++ #endif /* MATLAB */
+      errorPrint ("archTorus2ArchLoad: bad input");
+      return     (1);
+    }
+***************
+*** 363,370 ****
+  int
+  archTorus3ArchLoad (
+  ArchTorus3 * restrict const archptr,
+! FILE * restrict const       stream)
+! {
+  #ifdef SCOTCH_DEBUG_ARCH1
+    if ((sizeof (ArchTorus3)    > sizeof (ArchDummy)) ||
+        (sizeof (ArchTorus3Dom) > sizeof (ArchDomDummy))) {
+--- 379,396 ----
+  int
+  archTorus3ArchLoad (
+  ArchTorus3 * restrict const archptr,
+! FILE * restrict const       stream
+! #ifdef MATLAB
+!                                   ,
+! const Anum                  napar,
+! const Anum *                archpar
+! #endif /* MATLAB */
+!                                    )
+! {
+! #ifdef MATLAB
+!   printf("archTorus3ArchLoad - napar=%d,archpar=%p\n",napar,archpar);
+! #endif /* MATLAB */
+! 
+  #ifdef SCOTCH_DEBUG_ARCH1
+    if ((sizeof (ArchTorus3)    > sizeof (ArchDummy)) ||
+        (sizeof (ArchTorus3Dom) > sizeof (ArchDomDummy))) {
+***************
+*** 373,382 ****
+--- 399,415 ----
+    }
+  #endif /* SCOTCH_DEBUG_ARCH1 */
+  
++ #ifndef MATLAB
+    if ((intLoad (stream, &archptr->c[0]) != 1) ||
+        (intLoad (stream, &archptr->c[1]) != 1) ||
+        (intLoad (stream, &archptr->c[2]) != 1) ||
+        (archptr->c[0] < 1) || (archptr->c[1] < 1) || (archptr->c[2] < 1)) {
++ #else /* MATLAB */
++   if ((napar < 3)                      ||
++       ((archptr->c[0]=archpar[0]) < 1) ||
++       ((archptr->c[1]=archpar[1]) < 1) ||
++       ((archptr->c[2]=archpar[2]) < 1)) {
++ #endif /* MATLAB */
+      errorPrint ("archTorus3ArchLoad: bad input");
+      return     (1);
+    }
+diff -rc src/src/libscotch/arch_torus.h /home/jschierm/Libs/scotch_5.1/src/libscotch/arch_torus.h
+*** src/src/libscotch/arch_torus.h	2008-05-22 06:44:41.000000000 -0700
+--- /home/jschierm/Libs/scotch_5.1/src/libscotch/arch_torus.h	2010-02-08 15:29:22.742777748 -0800
+***************
+*** 96,102 ****
+--- 96,106 ----
+  #define static
+  #endif
+  
++ #ifndef MATLAB
+  int                         archTorus2ArchLoad  (ArchTorus2 * restrict const, FILE * restrict const);
++ #else /* MATLAB */
++ int                         archTorus2ArchLoad  (ArchTorus2 * restrict const, FILE * restrict const, const Anum, const Anum *);
++ #endif /* MATLAB */
+  int                         archTorus2ArchSave  (const ArchTorus2 * const, FILE * restrict const);
+  #define archTorus2ArchFree          NULL
+  ArchDomNum                  archTorus2DomNum    (const ArchTorus2 * const, const ArchTorus2Dom * const);
+***************
+*** 114,120 ****
+--- 118,128 ----
+  int                         archTorus2DomMpiType (const ArchTorus2 * const, MPI_Datatype * const);
+  #endif /* SCOTCH_PTSCOTCH */
+  
++ #ifndef MATLAB
+  int                         archTorus3ArchLoad  (ArchTorus3 * restrict const, FILE * restrict const);
++ #else /* MATLAB */
++ int                         archTorus3ArchLoad  (ArchTorus3 * restrict const, FILE * restrict const, const Anum, const Anum *);
++ #endif /* MATLAB */
+  int                         archTorus3ArchSave  (const ArchTorus3 * const, FILE * restrict const);
+  #define archTorus3ArchFree          NULL
+  ArchDomNum                  archTorus3DomNum    (const ArchTorus3 * const, const ArchTorus3Dom * const);
+Only in /home/jschierm/Libs/scotch_5.1/src/libscotch: arch_torus_old.c
+Only in /home/jschierm/Libs/scotch_5.1/src/libscotch: arch_torus_old.h
+diff -rc src/src/libscotch/common.c /home/jschierm/Libs/scotch_5.1/src/libscotch/common.c
+*** src/src/libscotch/common.c	2008-05-22 06:44:41.000000000 -0700
+--- /home/jschierm/Libs/scotch_5.1/src/libscotch/common.c	2009-08-20 11:26:05.906946884 -0700
+***************
+*** 100,106 ****
+--- 100,112 ----
+  {
+    const char **       cptr;
+  
++ #ifndef MATLAB
+    fprintf (stream, "Usage is:\n");
+    for (cptr = data; *cptr != NULL; cptr ++)
+      fprintf (stream, "  %s\n", *cptr);
++ #else /* MATLAB */
++   mexPrintf ("Usage is:\n");
++   for (cptr = data; *cptr != NULL; cptr ++)
++     mexPrintf ("  %s\n", *cptr);
++ #endif /* MATLAB */
+  }
+diff -rc src/src/libscotch/common.h /home/jschierm/Libs/scotch_5.1/src/libscotch/common.h
+*** src/src/libscotch/common.h	2009-02-06 14:20:55.000000000 -0800
+--- /home/jschierm/Libs/scotch_5.1/src/libscotch/common.h	2009-08-25 10:12:42.449687289 -0700
+***************
+*** 66,71 ****
+--- 66,72 ----
+  #include            <stdio.h>
+  #include            <stdarg.h>
+  #include            <stdlib.h>
++ #include            <stdint.h>                    /* added for intptr_t */
+  #ifdef HAVE_MALLOC_H
+  #include            <malloc.h>                    /* Deprecated, but required on some old systems */
+  #endif /* HAVE_MALLOC_H */
+***************
+*** 88,93 ****
+--- 89,108 ----
+  #include            <pthread.h>
+  #endif /* ((defined COMMON_PTHREAD) || (defined SCOTCH_PTHREAD)) */
+  
++ #ifdef MATLAB
++     #include "mat.h"
++     #include "mex.h"
++     #include "matrix.h"
++ 
++     #define printf mexPrintf
++     #define fprintf(file,...) (file == stdout || file == stderr ? mexPrintf(__VA_ARGS__) : fprintf(file,__VA_ARGS__))
++     #define malloc mxMalloc
++     #define calloc mxCalloc
++     #define realloc mxRealloc
++     #define free mxFree
++     #define exit(status) mexErrMsgTxt("exit=" #status)
++ #endif
++ 
+  /*
+  **  Working definitions.
+  */
+Only in /home/jschierm/Libs/scotch_5.1/src/libscotch: common_old.c
+Only in /home/jschierm/Libs/scotch_5.1/src/libscotch: common_old.h
+diff -rc src/src/libscotch/dummysizes.c /home/jschierm/Libs/scotch_5.1/src/libscotch/dummysizes.c
+*** src/src/libscotch/dummysizes.c	2009-05-09 16:08:02.000000000 -0700
+--- /home/jschierm/Libs/scotch_5.1/src/libscotch/dummysizes.c	2009-08-20 10:23:00.204162919 -0700
+***************
+*** 267,271 ****
+--- 267,273 ----
+    }
+  #endif /* SCOTCH_DEBUG_MAIN1 */
+  
++ #ifndef MATLAB
+    exit (0);
++ #endif /* MATLAB */
+  }
+Only in /home/jschierm/Libs/scotch_5.1/src/libscotch: dummysizes_old.c
+diff -rc src/src/libscotch/graph.c /home/jschierm/Libs/scotch_5.1/src/libscotch/graph.c
+*** src/src/libscotch/graph.c	2008-05-22 06:44:42.000000000 -0700
+--- /home/jschierm/Libs/scotch_5.1/src/libscotch/graph.c	2009-12-11 11:17:23.319268242 -0800
+***************
+*** 135,141 ****
+      if ((grafptr->velotax != NULL) &&             /* Free graph tables             */
+          ((grafptr->flagval & GRAPHVERTGROUP) == 0))
+        memFree (grafptr->velotax + grafptr->baseval);
+!     if (grafptr->vlbltax != NULL)
+        memFree (grafptr->vlbltax + grafptr->baseval);
+      if ((grafptr->edlotax != NULL) &&
+          ((grafptr->flagval & GRAPHEDGEGROUP) == 0))
+--- 135,144 ----
+      if ((grafptr->velotax != NULL) &&             /* Free graph tables             */
+          ((grafptr->flagval & GRAPHVERTGROUP) == 0))
+        memFree (grafptr->velotax + grafptr->baseval);
+! /*  vlbltax must also check GRAPHVERTGROUP (jes, 12/11/09)  */
+! //    if (grafptr->vlbltax != NULL)
+!     if ((grafptr->vlbltax != NULL) &&
+!         ((grafptr->flagval & GRAPHVERTGROUP) == 0))
+        memFree (grafptr->vlbltax + grafptr->baseval);
+      if ((grafptr->edlotax != NULL) &&
+          ((grafptr->flagval & GRAPHEDGEGROUP) == 0))
+diff -rc src/src/libscotch/graph.h /home/jschierm/Libs/scotch_5.1/src/libscotch/graph.h
+*** src/src/libscotch/graph.h	2008-06-01 02:49:11.000000000 -0700
+--- /home/jschierm/Libs/scotch_5.1/src/libscotch/graph.h	2010-02-08 14:21:35.655766453 -0800
+***************
+*** 159,165 ****
+--- 159,169 ----
+  int                         graphInit           (Graph * const);
+  void                        graphExit           (Graph * const);
+  void                        graphFree           (Graph * const);
++ #ifndef MATLAB
+  int                         graphLoad           (Graph * const, FILE * const, const Gnum, const GraphFlag);
++ #else /* MATLAB */
++ int                         graphLoad           (Graph * const, FILE * const, const Gnum, const GraphFlag, const Gnum, const Gnum, const Gnum*, const Gnum*, const Gnum*, const Gnum*, const Gnum*);
++ #endif /* MATLAB */
+  int                         graphLoad2          (const Gnum, const Gnum, const Gnum * const, const Gnum * const, Gnum * restrict const, const Gnum, const Gnum * const);
+  int                         graphSave           (const Graph * const, FILE * const);
+  Gnum                        graphBase           (Graph * const, const Gnum);
+diff -rc src/src/libscotch/graph_io.c /home/jschierm/Libs/scotch_5.1/src/libscotch/graph_io.c
+*** src/src/libscotch/graph_io.c	2008-05-22 06:44:42.000000000 -0700
+--- /home/jschierm/Libs/scotch_5.1/src/libscotch/graph_io.c	2010-02-09 09:33:53.440543871 -0800
+***************
+*** 86,92 ****
+  Graph * restrict const      grafptr,              /* Graph structure to fill              */
+  FILE * const                stream,               /* Stream from which to read graph data */
+  const Gnum                  baseval,              /* Base value (-1 means keep file base) */
+! const GraphFlag             flagval)              /* Graph loading flags                  */
+  {
+    Gnum                edgenum;                    /* Number of edges really allocated */
+    Gnum                edgennd;
+--- 86,103 ----
+  Graph * restrict const      grafptr,              /* Graph structure to fill              */
+  FILE * const                stream,               /* Stream from which to read graph data */
+  const Gnum                  baseval,              /* Base value (-1 means keep file base) */
+! const GraphFlag             flagval               /* Graph loading flags                  */
+! #ifdef MATLAB
+!                                    ,
+! const Gnum                  nvert,
+! const Gnum                  nedge2,
+! const Gnum*                 adjir,
+! const Gnum*                 adjjc,
+! const Gnum*                 vertlab,
+! const Gnum*                 vertwgt,
+! const Gnum*                 edgewgt
+! #endif /* MATLAB */
+!                                    )
+  {
+    Gnum                edgenum;                    /* Number of edges really allocated */
+    Gnum                edgennd;
+***************
+*** 104,120 ****
+--- 115,141 ----
+    char                proptab[4];
+    Gnum                vertnum;
+  
++ #ifdef MATLAB
++   printf("graphLoad - stream=%p; nvert=%d,nedge2=%d\n",stream,nvert,nedge2);
++   printf("graphLoad - adjir=%p,adjjc=%p,vertlab=%p,vertwgt=%p,edgewgt=%p\n",
++          adjir,adjjc,vertlab,vertwgt,edgewgt);
++ #endif /* MATLAB */
+    memSet (grafptr, 0, sizeof (Graph));
+  
++ #ifndef MATLAB
+    if (intLoad (stream, &versval) != 1) {          /* Read version number */
+      errorPrint ("graphLoad: bad input (1)");
+      return     (1);
+    }
++ #else /* MATLAB */
++   versval=0;
++ #endif /* MATLAB */
+    if (versval != 0) {                             /* If version not zero */
+      errorPrint ("graphLoad: old-style graph format no longer supported");
+      return     (1);
+    }
+  
++ #ifndef MATLAB
+    if ((intLoad (stream, &grafptr->vertnbr) != 1) || /* Read rest of header */
+        (intLoad (stream, &grafptr->edgenbr) != 1) ||
+        (intLoad (stream, &baseadj)          != 1) ||
+***************
+*** 124,129 ****
+--- 145,159 ----
+      errorPrint ("graphLoad: bad input (2)");
+      return     (1);
+    }
++ #else /* MATLAB */
++   grafptr->vertnbr=nvert;
++   grafptr->edgenbr=nedge2;
++   baseadj=1;
++   propval=0;
++   if (vertlab) propval+=100;
++   if (edgewgt) propval+= 10;
++   if (vertwgt) propval+=  1;
++ #endif /* MATLAB */
+    sprintf (proptab, "%3.3d", (int) propval);      /* Compute file properties */
+    proptab[0] -= '0';                              /* Vertex labels flag      */
+    proptab[1] -= '0';                              /* Edge weights flag       */
+***************
+*** 140,145 ****
+--- 170,179 ----
+    }
+    if (proptab[0] != 0)                            /* If vertex labels, no base adjust */
+      baseadj = 0;
++ #ifdef MATLAB
++   printf("graphLoad - baseadj=%d,baseval=%d,grafptr->baseval=%d\n",
++          baseadj,baseval,grafptr->baseval);
++ #endif /* MATLAB */
+  
+    velonbr = ((proptab[2] != 0) && ((flagval & GRAPHIONOLOADVERT) == 0)) ? grafptr->vertnbr : 0;
+    vlblnbr = (proptab[0] != 0) ? grafptr->vertnbr : 0;
+***************
+*** 178,188 ****
+--- 212,226 ----
+      if (grafptr->vlbltax != NULL) {               /* If must read label               */
+        Gnum                vlblval;                /* Value where to read vertex label */
+  
++ #ifndef MATLAB
+        if (intLoad (stream, &vlblval) != 1) {      /* Read label data */
+          errorPrint ("graphLoad: bad input (3)");
+          graphFree  (grafptr);
+          return     (1);
+        }
++ #else /* MATLAB */
++       vlblval=vertlab[vertnum-grafptr->baseval];
++ #endif /* MATLAB */
+        grafptr->vlbltax[vertnum] = vlblval;
+        if (grafptr->vlbltax[vertnum] > vlblmax)    /* Get maximum vertex label */
+          vlblmax = grafptr->vlbltax[vertnum];
+***************
+*** 190,209 ****
+--- 228,257 ----
+      if (proptab[2] != 0) {                        /* If must read vertex load        */
+        Gnum                veloval;                /* Value where to read vertex load */
+  
++ #ifndef MATLAB
+        if (intLoad (stream, &veloval) != 1) {      /* Read vertex load data    */
+          errorPrint ("graphLoad: bad input (4)");
+          graphFree  (grafptr);
+          return     (1);
+        }
++ #else /* MATLAB */
++       veloval=vertwgt[vertnum-grafptr->baseval];
++ #endif /* MATLAB */
+        if (grafptr->velotax != NULL)
+          velosum                  +=
+          grafptr->velotax[vertnum] = veloval;
+      }
++ #ifndef MATLAB
+      if (intLoad (stream, &degrval) != 1) {        /* Read vertex degree */
+        errorPrint ("graphLoad: bad input (5)");
+        graphFree  (grafptr);
+        return     (1);
+      }
++ #else /* MATLAB */
++ //    printf("old degrval=%d; new degrval=%d\n",
++ //           degrval,adjjc[vertnum-grafptr->baseval+1]-adjjc[vertnum-grafptr->baseval]);
++     degrval=adjjc[vertnum-grafptr->baseval+1]-adjjc[vertnum-grafptr->baseval];
++ #endif /* MATLAB */
+      if (degrmax < degrval)                        /* Set maximum degree */
+        degrmax = degrval;
+  
+***************
+*** 219,238 ****
+--- 267,301 ----
+        if (proptab[1] != 0) {                      /* If must read edge load        */
+          Gnum                edloval;              /* Value where to read edge load */
+  
++ #ifndef MATLAB
+          if (intLoad (stream, &edloval) != 1) {    /* Read edge load data    */
+            errorPrint ("graphLoad: bad input (6)");
+            graphFree  (grafptr);
+            return     (1);
+          }
++ #else /* MATLAB */
++         edloval=edgewgt[edgenum-grafptr->baseval];
++ #endif /* MATLAB */
+          if (grafptr->edlotax != NULL)
+            edlosum                  +=
+            grafptr->edlotax[edgenum] = (Gnum) edloval;
+        }
++ #ifndef MATLAB
+        if (intLoad (stream, &edgeval) != 1) {      /* Read edge data */
+          errorPrint ("graphLoad: bad input (7)");
+          graphFree  (grafptr);
+          return     (1);
+        }
++ #else /* MATLAB */
++ //      printf("edgenum=%d: old edgeval=%d; new edgeval[%d]=%d\n",
++ //            edgenum,edgeval,edgenum-grafptr->baseval,adjir[edgenum-grafptr->baseval]+1);
++ /*  if vertex labels are supplied, they must be referenced  (jes, 1/05/10)  */
++ //      edgeval=adjir[edgenum-grafptr->baseval]+1;
++       if (vertlab)
++         edgeval=vertlab[adjir[edgenum-grafptr->baseval]  ];
++       else
++         edgeval=        adjir[edgenum-grafptr->baseval]+1;
++ #endif /* MATLAB */
+        grafptr->edgetax[edgenum] = edgeval + baseadj;
+      }
+    }
+***************
+*** 279,284 ****
+--- 342,351 ----
+    Gnum                vertnum;                    /* Number of current vertex        */
+    Gnum * restrict     indxtab;                    /* Vertex label/number index table */
+  
++ #ifdef MATLAB
++   printf("graphLoad2 - baseval=%d,vertnnd=%d,vlblmax=%d\n",
++          baseval,vertnnd,vlblmax);
++ #endif /* MATLAB */
+    if ((indxtab = (Gnum *) memAlloc ((vlblmax + 1) * sizeof (Gnum))) == NULL) {
+      errorPrint  ("graphLoad2: out of memory");
+      return      (1);
+***************
+*** 286,291 ****
+--- 353,362 ----
+  
+    memSet (indxtab, ~0, (vlblmax + 1) * sizeof (Gnum)); /* Assume labels not used */
+    for (vertnum = baseval; vertnum < vertnnd; vertnum ++) {
++ #ifdef MATLAB
++ //    printf("graphLoad2 - vertnum=%d; vlbltax=%d,indxtab=%d\n",
++ //           vertnum,vlbltax[vertnum],indxtab[vlbltax[vertnum]]);
++ #endif /* MATLAB */
+      if (indxtab[vlbltax[vertnum]] != ~0) {        /* If vertex label already used */
+        errorPrint  ("graphLoad2: duplicate vertex label");
+        memFree     (indxtab);
+***************
+*** 294,299 ****
+--- 365,374 ----
+      indxtab[vlbltax[vertnum]] = vertnum;          /* Set vertex number index */
+    }
+    for (vertnum = baseval; vertnum < vertnnd; vertnum ++) {
++ #ifdef MATLAB
++ //    printf("graphLoad2 - vertnum=%d; vlbltax=%d,indxtab=%d\n",
++ //           vertnum,vlbltax[vertnum],indxtab[vlbltax[vertnum]]);
++ #endif /* MATLAB */
+      Gnum                edgenum;                  /* Number of current edge */
+  
+      for (edgenum = verttax[vertnum]; edgenum < vendtax[vertnum]; edgenum ++) {
+***************
+*** 307,313 ****
+--- 382,396 ----
+          memFree    (indxtab);
+          return     (1);
+        }
++ #ifdef MATLAB
++ //      printf("graphLoad2 - edgenum=%d; old edgetax=%d,",
++ //             edgenum,edgetax[edgenum]);
++ #endif /* MATLAB */
+        edgetax[edgenum] = indxtab[edgetax[edgenum]]; /* Replace label by number */
++ #ifdef MATLAB
++ //      printf("new edgetax=%d\n",
++ //             edgetax[edgenum]);
++ #endif /* MATLAB */
+      }
+    }
+  
+Only in /home/jschierm/Libs/scotch_5.1/src/libscotch: graph_io_old.c
+Only in /home/jschierm/Libs/scotch_5.1/src/libscotch: graph_io_save.c
+diff -rc src/src/libscotch/graph_io_scot.c /home/jschierm/Libs/scotch_5.1/src/libscotch/graph_io_scot.c
+*** src/src/libscotch/graph_io_scot.c	2008-05-22 06:44:42.000000000 -0700
+--- /home/jschierm/Libs/scotch_5.1/src/libscotch/graph_io_scot.c	2010-02-08 14:40:05.279143819 -0800
+***************
+*** 89,95 ****
+--- 89,99 ----
+    int                           o;
+  
+    if (filesrcptr != NULL) {
++ #ifndef MATLAB
+      if (graphLoad (grafptr, filesrcptr, -1, 0) != 0)
++ #else /* MATLAB */
++     if (graphLoad (grafptr, filesrcptr, -1, 0, 0, 0, NULL, NULL, NULL, NULL, NULL) != 0)
++ #endif /* MATLAB */
+        return (1);
+    }
+  
+Only in /home/jschierm/Libs/scotch_5.1/src/libscotch: graph_io_scot_old.c
+Only in /home/jschierm/Libs/scotch_5.1/src/libscotch: graph_old.c
+Only in /home/jschierm/Libs/scotch_5.1/src/libscotch: graph_old.h
+diff -rc src/src/libscotch/library_arch.c /home/jschierm/Libs/scotch_5.1/src/libscotch/library_arch.c
+*** src/src/libscotch/library_arch.c	2008-05-22 06:44:42.000000000 -0700
+--- /home/jschierm/Libs/scotch_5.1/src/libscotch/library_arch.c	2010-02-08 15:41:48.114675458 -0800
+***************
+*** 120,128 ****
+  int
+  SCOTCH_archLoad (
+  SCOTCH_Arch * const         archptr,
+! FILE * const                stream)
+  {
+    return (archLoad ((Arch *) archptr, stream));
+  }
+  
+  /*+ This routine saves the given opaque
+--- 120,139 ----
+  int
+  SCOTCH_archLoad (
+  SCOTCH_Arch * const         archptr,
+! FILE * const                stream
+! #ifdef MATLAB
+!                                   ,
+! const char *                archtyp,
+! const SCOTCH_Num            napar,
+! const SCOTCH_Num *          archpar
+! #endif /* MATLAB */
+!                                    )
+  {
++ #ifndef MATLAB
+    return (archLoad ((Arch *) archptr, stream));
++ #else /* MATLAB */
++   return (archLoad ((Arch *) archptr, stream, archtyp, napar, archpar));
++ #endif /* MATLAB */
+  }
+  
+  /*+ This routine saves the given opaque
+diff -rc src/src/libscotch/library_arch_f.c /home/jschierm/Libs/scotch_5.1/src/libscotch/library_arch_f.c
+*** src/src/libscotch/library_arch_f.c	2008-05-22 06:44:42.000000000 -0700
+--- /home/jschierm/Libs/scotch_5.1/src/libscotch/library_arch_f.c	2010-02-08 15:57:30.991794029 -0800
+***************
+*** 121,127 ****
+--- 121,131 ----
+    }
+    setbuf (stream, NULL);                          /* Do not buffer on input */
+  
++ #ifndef MATLAB
+    o = SCOTCH_archLoad (archptr, stream);
++ #else /* MATLAB */
++   o = SCOTCH_archLoad (archptr, stream, "", 0, NULL);
++ #endif /* MATLAB */
+  
+    fclose (stream);                                /* This closes filenum too */
+  
+Only in /home/jschierm/Libs/scotch_5.1/src/libscotch: library_arch_f_old.c
+Only in /home/jschierm/Libs/scotch_5.1/src/libscotch: library_arch_old.c
+diff -rc src/src/libscotch/library_error_exit.c /home/jschierm/Libs/scotch_5.1/src/libscotch/library_error_exit.c
+*** src/src/libscotch/library_error_exit.c	2009-01-20 00:36:33.000000000 -0800
+--- /home/jschierm/Libs/scotch_5.1/src/libscotch/library_error_exit.c	2009-08-20 10:35:56.268159643 -0700
+***************
+*** 114,119 ****
+--- 114,120 ----
+    int                 proclocnum;
+  #endif /* SCOTCH_PTSCOTCH */
+  
++ #ifndef MATLAB
+    fprintf  (stderr, "%s", _SCOTCHerrorProgName);
+  #ifdef SCOTCH_PTSCOTCH
+    if ((MPI_Initialized (&proclocnum) == MPI_SUCCESS) &&
+***************
+*** 131,136 ****
+--- 132,155 ----
+    fprintf  (stderr, "\n");
+    fflush   (stderr);                              /* In case it has been set to buffered mode */
+  
++ #else /* MATLAB */
++   mexPrintf  ("%s", _SCOTCHerrorProgName);
++ #ifdef SCOTCH_PTSCOTCH
++   if ((MPI_Initialized (&proclocnum) == MPI_SUCCESS) &&
++       (proclocnum != 0)                              &&
++       (MPI_Comm_rank (MPI_COMM_WORLD, &proclocnum) == MPI_SUCCESS))
++     mexPrintf ("(%d): ", proclocnum);
++ #else /* SCOTCH_PTSCOTCH */
++   if (_SCOTCHerrorProgName[0] != '\0')
++     mexPrintf  (": ");
++ #endif /* SCOTCH_PTSCOTCH */
++   mexPrintf  ("ERROR: ");
++   va_start (errlist, errstr);
++   mexPrintf (errstr, errlist);             /* Print arguments */
++   va_end   (errlist);
++   mexPrintf  ("\n");
++ #endif /* MATLAB */
++ 
+  #ifdef SCOTCH_ERROR_SLEEP
+    sleep (SCOTCH_ERROR_SLEEP);                     /* Wait for messages to be propagated */
+  #endif /* SCOTCH_ERROR_SLEEP */
+***************
+*** 155,160 ****
+--- 174,180 ----
+    int                 proclocnum;
+  #endif /* SCOTCH_PTSCOTCH */
+  
++ #ifndef MATLAB
+    fprintf  (stderr, "%s", _SCOTCHerrorProgName);
+  #ifdef SCOTCH_PTSCOTCH
+    if ((MPI_Initialized (&proclocnum) == MPI_SUCCESS) &&
+***************
+*** 171,174 ****
+--- 191,212 ----
+    va_end   (errlist);
+    fprintf  (stderr, "\n");
+    fflush   (stderr);                              /* In case it has been set to buffered mode */
++ 
++ #else /* MATLAB */
++   mexPrintf  ("%s", _SCOTCHerrorProgName);
++ #ifdef SCOTCH_PTSCOTCH
++   if ((MPI_Initialized (&proclocnum) == MPI_SUCCESS) &&
++       (proclocnum != 0)                              &&
++       (MPI_Comm_rank (MPI_COMM_WORLD, &proclocnum) == MPI_SUCCESS))
++     mexPrintf ("(%d): ", proclocnum);
++ #else /* SCOTCH_PTSCOTCH */
++   if (_SCOTCHerrorProgName[0] != '\0')
++     mexPrintf  (": ");
++ #endif /* SCOTCH_PTSCOTCH */
++   mexPrintf  ("WARNING: ");
++   va_start (errlist, errstr);
++   mexPrintf (errstr, errlist);             /* Print arguments */
++   va_end   (errlist);
++   mexPrintf  ("\n");
++ #endif /* MATLAB */
+  }
+Only in /home/jschierm/Libs/scotch_5.1/src/libscotch: library_error_exit_old.c
+diff -rc src/src/libscotch/library_graph.c /home/jschierm/Libs/scotch_5.1/src/libscotch/library_graph.c
+*** src/src/libscotch/library_graph.c	2008-05-22 07:28:12.000000000 -0700
+--- /home/jschierm/Libs/scotch_5.1/src/libscotch/library_graph.c	2010-02-08 15:40:32.323584768 -0800
+***************
+*** 137,143 ****
+  SCOTCH_Graph * const        grafptr,
+  FILE * const                stream,
+  const SCOTCH_Num            baseval,
+! const SCOTCH_Num            flagval)
+  {
+    GraphFlag           srcgrafflag;                /* Graph flags */
+  
+--- 137,154 ----
+  SCOTCH_Graph * const        grafptr,
+  FILE * const                stream,
+  const SCOTCH_Num            baseval,
+! const SCOTCH_Num            flagval
+! #ifdef MATLAB
+!                                    ,
+! const SCOTCH_Num            nvert,
+! const SCOTCH_Num            nedge2,
+! const SCOTCH_Num*           adjir,
+! const SCOTCH_Num*           adjjc,
+! const SCOTCH_Num*           vertlab,
+! const SCOTCH_Num*           vertwgt,
+! const SCOTCH_Num*           edgewgt
+! #endif /* MATLAB */
+!                                    )
+  {
+    GraphFlag           srcgrafflag;                /* Graph flags */
+  
+***************
+*** 153,159 ****
+--- 164,174 ----
+    srcgrafflag = (((flagval & 1) != 0) ? GRAPHIONOLOADVERT : 0) +
+                  (((flagval & 2) != 0) ? GRAPHIONOLOADEDGE : 0);
+  
++ #ifndef MATLAB
+    return (graphLoad ((Graph * const) grafptr, stream, (Gnum) baseval, srcgrafflag));
++ #else /* MATLAB */
++   return (graphLoad ((Graph * const) grafptr, stream, (Gnum) baseval, srcgrafflag, (const Gnum) nvert, (const Gnum) nedge2, (const Gnum *) adjir, (const Gnum *) adjjc, (const Gnum *) vertlab, (const Gnum *) vertwgt, (const Gnum *) edgewgt));
++ #endif /* MATLAB */
+  }
+  
+  /*+ This routine saves the contents of the given
+diff -rc src/src/libscotch/library_graph_f.c /home/jschierm/Libs/scotch_5.1/src/libscotch/library_graph_f.c
+*** src/src/libscotch/library_graph_f.c	2008-05-22 06:44:43.000000000 -0700
+--- /home/jschierm/Libs/scotch_5.1/src/libscotch/library_graph_f.c	2010-02-08 14:42:47.845342853 -0800
+***************
+*** 136,142 ****
+--- 136,146 ----
+    }
+    setbuf (stream, NULL);                          /* Do not buffer on input */
+  
++ #ifndef MATLAB
+    o = SCOTCH_graphLoad (grafptr, stream, *baseptr, *flagptr);
++ #else /* MATLAB */
++   o = SCOTCH_graphLoad (grafptr, stream, *baseptr, *flagptr, 0, 0, NULL, NULL, NULL, NULL, NULL);
++ #endif /* MATLAB */
+  
+    fclose (stream);                                /* This closes filenum too */
+  
+Only in /home/jschierm/Libs/scotch_5.1/src/libscotch: library_graph_f_old.c
+diff -rc src/src/libscotch/library_graph_map.c /home/jschierm/Libs/scotch_5.1/src/libscotch/library_graph_map.c
+*** src/src/libscotch/library_graph_map.c	2008-09-28 04:04:05.000000000 -0700
+--- /home/jschierm/Libs/scotch_5.1/src/libscotch/library_graph_map.c	2010-02-08 14:48:10.401735571 -0800
+***************
+*** 182,192 ****
+--- 182,200 ----
+  
+  int
+  SCOTCH_graphMapSave (
++ #ifdef MATLAB
++ Gnum *pnvert,
++ Gnum (**pmaptab)[2],
++ #endif /* MATLAB */
+  const SCOTCH_Graph * const    grafptr,            /*+ Graph to order  +*/
+  const SCOTCH_Mapping * const  mappptr,            /*+ Mapping to save +*/
+  FILE * const                  stream)             /*+ Output stream   +*/
+  {
++ #ifndef MATLAB
+    return (mapSave (&((LibMapping *) mappptr)->m, ((Graph *) grafptr)->vlbltax, stream));
++ #else /* MATLAB */
++   return (mapSave (pnvert, pmaptab, &((LibMapping *) mappptr)->m, ((Graph *) grafptr)->vlbltax, stream));
++ #endif /* MATLAB */
+  }
+  
+  /*+ This routine computes a mapping
+diff -rc src/src/libscotch/library_graph_map_f.c /home/jschierm/Libs/scotch_5.1/src/libscotch/library_graph_map_f.c
+*** src/src/libscotch/library_graph_map_f.c	2008-06-28 03:44:26.000000000 -0700
+--- /home/jschierm/Libs/scotch_5.1/src/libscotch/library_graph_map_f.c	2010-02-08 15:01:51.742742812 -0800
+***************
+*** 183,189 ****
+--- 183,193 ----
+      return;
+    }
+  
++ #ifndef MATLAB
+    o = SCOTCH_graphMapSave (grafptr, mapptr, stream);
++ #else /* MATLAB */
++   o = SCOTCH_graphMapSave (NULL, NULL, grafptr, mapptr, stream);
++ #endif /* MATLAB */
+  
+    fclose (stream);                                /* This closes filenum too */
+  
+Only in /home/jschierm/Libs/scotch_5.1/src/libscotch: library_graph_map_f_old.c
+Only in /home/jschierm/Libs/scotch_5.1/src/libscotch: library_graph_map_old.c
+Only in /home/jschierm/Libs/scotch_5.1/src/libscotch: library_graph_old.c
+diff -rc src/src/libscotch/library.h /home/jschierm/Libs/scotch_5.1/src/libscotch/library.h
+*** src/src/libscotch/library.h	2009-05-09 16:08:03.000000000 -0700
+--- /home/jschierm/Libs/scotch_5.1/src/libscotch/library.h	2010-02-08 15:08:39.121250004 -0800
+***************
+*** 134,140 ****
+--- 134,144 ----
+  
+  int                         SCOTCH_archInit     (SCOTCH_Arch * const);
+  void                        SCOTCH_archExit     (SCOTCH_Arch * const);
++ #ifndef MATLAB
+  int                         SCOTCH_archLoad     (SCOTCH_Arch * const, FILE * const);
++ #else /* MATLAB */
++ int                         SCOTCH_archLoad     (SCOTCH_Arch * const, FILE * const, const char *, const SCOTCH_Num, const SCOTCH_Num *);
++ #endif /* MATLAB */
+  int                         SCOTCH_archSave     (const SCOTCH_Arch * const, FILE * const);
+  int                         SCOTCH_archBuild    (SCOTCH_Arch * const, const SCOTCH_Graph * const, const SCOTCH_Num, const SCOTCH_Num * const, const SCOTCH_Strat * const);
+  int                         SCOTCH_archCmplt    (SCOTCH_Arch * const, const SCOTCH_Num);
+***************
+*** 191,197 ****
+--- 195,205 ----
+  int                         SCOTCH_graphInit    (SCOTCH_Graph * const);
+  void                        SCOTCH_graphExit    (SCOTCH_Graph * const);
+  void                        SCOTCH_graphFree    (SCOTCH_Graph * const);
++ #ifndef MATLAB
+  int                         SCOTCH_graphLoad    (SCOTCH_Graph * const, FILE * const, const SCOTCH_Num, const SCOTCH_Num);
++ #else /* MATLAB */
++ int                         SCOTCH_graphLoad    (SCOTCH_Graph * const, FILE * const, const SCOTCH_Num, const SCOTCH_Num, const SCOTCH_Num, const SCOTCH_Num, const SCOTCH_Num *, const SCOTCH_Num *, const SCOTCH_Num *, const SCOTCH_Num *, const SCOTCH_Num *);
++ #endif /* MATLAB */
+  int                         SCOTCH_graphSave    (const SCOTCH_Graph * const, FILE * const);
+  int                         SCOTCH_graphBuild   (SCOTCH_Graph * const, const SCOTCH_Num, const SCOTCH_Num, const SCOTCH_Num * const, const SCOTCH_Num * const, const SCOTCH_Num * const, const SCOTCH_Num * const, const SCOTCH_Num, const SCOTCH_Num * const, const SCOTCH_Num * const);
+  SCOTCH_Num                  SCOTCH_graphBase    (SCOTCH_Graph * const, const SCOTCH_Num baseval);
+***************
+*** 210,216 ****
+--- 218,228 ----
+  int                         SCOTCH_graphMapInit (const SCOTCH_Graph * const, SCOTCH_Mapping * const, const SCOTCH_Arch * const, SCOTCH_Num * const);
+  void                        SCOTCH_graphMapExit (const SCOTCH_Graph * const, SCOTCH_Mapping * const);
+  int                         SCOTCH_graphMapLoad (const SCOTCH_Graph * const, const SCOTCH_Mapping * const, FILE * const);
++ #ifndef MATLAB
+  int                         SCOTCH_graphMapSave (const SCOTCH_Graph * const, const SCOTCH_Mapping * const, FILE * const);
++ #else /* MATLAB */
++ int                         SCOTCH_graphMapSave (SCOTCH_Num *, SCOTCH_Num (**)[2], const SCOTCH_Graph * const, const SCOTCH_Mapping * const, FILE * const);
++ #endif /* MATLAB */
+  int                         SCOTCH_graphMapView (const SCOTCH_Graph * const, const SCOTCH_Mapping * const, FILE * const);
+  int                         SCOTCH_graphMapCompute (const SCOTCH_Graph * const, SCOTCH_Mapping * const, const SCOTCH_Strat * const);
+  int                         SCOTCH_graphMap     (const SCOTCH_Graph * const, const SCOTCH_Arch * const, const SCOTCH_Strat * const, SCOTCH_Num * const);
+Only in /home/jschierm/Libs/scotch_5.1/src/libscotch: library_old.h
+diff -rc src/src/libscotch/Makefile /home/jschierm/Libs/scotch_5.1/src/libscotch/Makefile
+*** src/src/libscotch/Makefile	2009-05-09 16:08:04.000000000 -0700
+--- /home/jschierm/Libs/scotch_5.1/src/libscotch/Makefile	2010-02-10 10:20:55.219532741 -0800
+***************
+*** 49,55 ****
+  ##  Project rules.
+  ##
+  
+! .PHONY				:	ptscotch	scotch	ptinstall	install	clean	realclean
+  
+  scotch				:	clean
+  					$(MAKE) CC="$(CCS)" CCD="$(CCS)" SCOTCHLIB=scotch	\
+--- 49,55 ----
+  ##  Project rules.
+  ##
+  
+! .PHONY				:	ptscotch	scotch	mexscotch	ptinstall	install	clean	realclean
+  
+  scotch				:	clean
+  					$(MAKE) CC="$(CCS)" CCD="$(CCS)" SCOTCHLIB=scotch	\
+***************
+*** 68,73 ****
+--- 68,81 ----
+  					libptscotcherr$(LIB)								\
+  					libptscotcherrexit$(LIB)
+  
++ mexscotch			:	clean
++ 					$(MAKE) CFLAGS="$(CFLAGS) -DMATLAB -I/usr/local/pkgs/matlab-7.6/extern/include" CC="$(CCS)" CCD="$(CCS)" LDFLAGS="$(LDFLAGS) -Wl,-rpath-link,/usr/local/pkgs/matlab-7.6/bin/glnxa64 -L/usr/local/pkgs/matlab-7.6/bin/glnxa64 -lmex -lmat" SCOTCHLIB=scotch	\
++ 					scotch.h						\
++ 					scotchf.h						\
++ 					libscotch$(LIB)						\
++ 					libscotcherr$(LIB)					\
++ 					libscotcherrexit$(LIB)
++ 
+  install				:
+  					-$(CP) scotch.h scotchf.h $(includedir)
+  					-$(CP) libscotch$(LIB) libscotcherr*$(LIB) $(libdir)
+Only in /home/jschierm/Libs/scotch_5.1/src/libscotch: Makefile_old
+diff -rc src/src/libscotch/mapping.h /home/jschierm/Libs/scotch_5.1/src/libscotch/mapping.h
+*** src/src/libscotch/mapping.h	2008-10-27 08:27:47.000000000 -0700
+--- /home/jschierm/Libs/scotch_5.1/src/libscotch/mapping.h	2010-02-08 14:49:15.141814037 -0800
+***************
+*** 106,112 ****
+--- 106,116 ----
+  int                         mapInit2            (Mapping * restrict const, const Gnum, const Gnum, const Arch * restrict const, const ArchDom * restrict const);
+  void                        mapExit             (Mapping * const);
+  int                         mapLoad             (Mapping * restrict const, const Gnum * restrict const, FILE * restrict const);
++ #ifndef MATLAB
+  int                         mapSave             (const Mapping * restrict const, const Gnum * restrict const, FILE * restrict const);
++ #else /* MATLAB */
++ int                         mapSave             (Gnum *, Gnum (**)[2], const Mapping * restrict const, const Gnum * restrict const, FILE * restrict const);
++ #endif /* MATLAB */
+  int                         mapView             (const Mapping * restrict const, const Graph * restrict const, FILE * const);
+  
+  #undef static
+diff -rc src/src/libscotch/mapping_io.c /home/jschierm/Libs/scotch_5.1/src/libscotch/mapping_io.c
+*** src/src/libscotch/mapping_io.c	2008-05-22 06:44:43.000000000 -0700
+--- /home/jschierm/Libs/scotch_5.1/src/libscotch/mapping_io.c	2010-02-08 14:59:13.768544543 -0800
+***************
+*** 199,204 ****
+--- 199,208 ----
+  
+  int
+  mapSave (
++ #ifdef MATLAB
++ Gnum *pnvert,
++ Gnum (**pmaptab)[2],
++ #endif /* MATLAB */
+  const Mapping * restrict const  mappptr,
+  const Gnum * restrict const     vlbltab,
+  FILE * restrict const           stream)
+***************
+*** 206,226 ****
+    const Gnum * restrict vlbltax;
+    Gnum                  vertnum;
+  
+    vlbltax = (vlbltab != NULL) ? (vlbltab - mappptr->baseval) : NULL;
+  
+    if (fprintf (stream, "%ld\n", (long) mappptr->vertnbr) == EOF) {
+      errorPrint ("mapSave: bad output (1)");
+      return     (1);
+    }
+  
+    for (vertnum = mappptr->baseval; vertnum < (mappptr->vertnbr + mappptr->baseval); vertnum ++) {
+      if (fprintf (stream, "%ld\t%ld\n",
+!                  (long) ((vlbltax != NULL) ? vlbltax[vertnum] : vertnum),
+                   (long) archDomNum (&mappptr->archdat, &mappptr->domntab[mappptr->parttax[vertnum]])) == EOF) {
+        errorPrint ("mapSave: bad output (2)");
+        return     (1);
+      }
+    }
+  
+    return (0);
+  }
+--- 210,258 ----
+    const Gnum * restrict vlbltax;
+    Gnum                  vertnum;
+  
++ #ifdef MATLAB
++   printf("mapSave - stream=%p\n",stream);
++ #endif /* MATLAB */
+    vlbltax = (vlbltab != NULL) ? (vlbltab - mappptr->baseval) : NULL;
+  
++ #ifndef MATLAB
+    if (fprintf (stream, "%ld\n", (long) mappptr->vertnbr) == EOF) {
+      errorPrint ("mapSave: bad output (1)");
+      return     (1);
+    }
++ #else /* MATLAB */
++   if (pnvert) {
++     *pnvert=mappptr->vertnbr;
++     printf("mapSave - nvert=%d\n",*pnvert);
++   }
++   if (pmaptab) {
++     *pmaptab = (Gnum (*)[2]) malloc(mappptr->vertnbr*2*sizeof(Gnum));
++     printf("mapSave - maptab=%p\n",*pmaptab);
++   }
++ #endif /* MATLAB */
+  
++ #ifndef MATLAB
+    for (vertnum = mappptr->baseval; vertnum < (mappptr->vertnbr + mappptr->baseval); vertnum ++) {
+      if (fprintf (stream, "%ld\t%ld\n",
+! /*  not sure why, but need to offset vlbltax in other direction (jes, 12/11/09)  */
+! //                 (long) ((vlbltax != NULL) ? vlbltax[vertnum] : vertnum),
+!                  (long) ((vlbltax != NULL) ? vlbltax[vertnum+mappptr->baseval] : vertnum),
+                   (long) archDomNum (&mappptr->archdat, &mappptr->domntab[mappptr->parttax[vertnum]])) == EOF) {
+        errorPrint ("mapSave: bad output (2)");
+        return     (1);
+      }
+    }
++ #else /* MATLAB */
++   if (pmaptab && *pmaptab)
++     for (vertnum = mappptr->baseval; vertnum < (mappptr->vertnbr + mappptr->baseval); vertnum ++) {
++ /*  not sure why, but need to offset vlbltax in other direction (jes, 12/11/09)  */
++ //      (*pmaptab)[vertnum-mappptr->baseval][0]=((vlbltax != NULL) ? vlbltax[vertnum] : vertnum);
++       (*pmaptab)[vertnum-mappptr->baseval][0]=((vlbltax != NULL) ? vlbltax[vertnum+mappptr->baseval] : vertnum);
++       (*pmaptab)[vertnum-mappptr->baseval][1]=archDomNum (&mappptr->archdat, &mappptr->domntab[mappptr->parttax[vertnum]]);
++ //    printf("mapSave - vertnum=%d; vlbltax=%d,archDomNum=%d\n",
++ //           vertnum,((vlbltax != NULL) ? vlbltax[vertnum+mappptr->baseval] : -1),archDomNum (&mappptr->archdat, &mappptr->domntab[mappptr->parttax[vertnum]]));
++     }
++ #endif /* MATLAB */
+  
+    return (0);
+  }
+Only in /home/jschierm/Libs/scotch_5.1/src/libscotch: mapping_io_old.c
+Only in /home/jschierm/Libs/scotch_5.1/src/libscotch: mapping_old.h
+diff -rc src/src/libscotch/mesh_io_scot.c /home/jschierm/Libs/scotch_5.1/src/libscotch/mesh_io_scot.c
+*** src/src/libscotch/mesh_io_scot.c	2008-05-22 06:44:43.000000000 -0700
+--- /home/jschierm/Libs/scotch_5.1/src/libscotch/mesh_io_scot.c	2010-02-08 14:41:47.841269476 -0800
+***************
+*** 85,91 ****
+--- 85,95 ----
+    int                           o;
+  
+    if (filesrcptr != NULL) {
++ #ifndef MATLAB
+      if (graphLoad (meshptr, filesrcptr, -1, 0) != 0)
++ #else /* MATLAB */
++     if (graphLoad (meshptr, filesrcptr, -1, 0, 0, 0, NULL, NULL, NULL, NULL, NULL) != 0)
++ #endif /* MATLAB */
+        return (1);
+    }
+  
+Only in /home/jschierm/Libs/scotch_5.1/src/libscotch: mesh_io_scot_old.c
+Only in /home/jschierm/Libs/scotch_5.1/src/libscotch: scotch_old.h
+diff -rc src/src/Makefile /home/jschierm/Libs/scotch_5.1/src/Makefile
+*** src/src/Makefile	2008-09-15 05:50:51.000000000 -0700
+--- /home/jschierm/Libs/scotch_5.1/src/Makefile	2010-02-10 09:41:16.791255216 -0800
+***************
+*** 97,102 ****
+--- 97,106 ----
+  					(cd scotch ;         $(MAKE) VERSION=\"$(VERSION)\" ptscotch && $(MAKE) ptinstall)
+  					(cd libscotchmetis ; $(MAKE)                        ptscotch && $(MAKE) ptinstall)
+  
++ mexscotch			:	required
++ 					(cd libscotch ;      $(MAKE) VERSION=\"$(VERSION)\" mexscotch && $(MAKE) install)
++ 					(cd scotch ;         $(MAKE) VERSION=\"$(VERSION)\" mexscotch && $(MAKE) mexinstall)
++ 
+  install				:	required	$(bindir)	$(includedir)	$(libdir)	$(mandir)/man1
+  					-$(CP) -f ../bin/[agm]*$(EXE) $(bindir)
+  					-$(CP) -f ../include/*scotch*.h $(includedir)
+Only in /home/jschierm/Libs/scotch_5.1/src: Makefile.inc
+Only in /home/jschierm/Libs/scotch_5.1/src: Makefile_old
+Only in /home/jschierm/Libs/scotch_5.1/src: Makefile_old2.inc
+Only in /home/jschierm/Libs/scotch_5.1/src: Makefile_old3.inc
+Only in /home/jschierm/Libs/scotch_5.1/src: Makefile_old.inc
+Only in /home/jschierm/Libs/scotch_5.1/src: make.out
+Only in /home/jschierm/Libs/scotch_5.1/src/scotch: acpl.mexa64
+Only in /home/jschierm/Libs/scotch_5.1/src/scotch: amk_ccc.mexa64
+Only in /home/jschierm/Libs/scotch_5.1/src/scotch: amk_fft2.mexa64
+Only in /home/jschierm/Libs/scotch_5.1/src/scotch: amk_grf.mexa64
+Only in /home/jschierm/Libs/scotch_5.1/src/scotch: amk_hy.mexa64
+Only in /home/jschierm/Libs/scotch_5.1/src/scotch: amk_m2.mexa64
+Only in /home/jschierm/Libs/scotch_5.1/src/scotch: amk_p2.mexa64
+Only in /home/jschierm/Libs/scotch_5.1/src/scotch: atst.mexa64
+Only in /home/jschierm/Libs/scotch_5.1/src/scotch: gbase.mexa64
+Only in /home/jschierm/Libs/scotch_5.1/src/scotch: gcv.mexa64
+Only in /home/jschierm/Libs/scotch_5.1/src/scotch: gmap_mex.c
+Only in /home/jschierm/Libs/scotch_5.1/src/scotch: gmap_mex_old.c
+diff -rc src/src/scotch/Makefile /home/jschierm/Libs/scotch_5.1/src/scotch/Makefile
+*** src/src/scotch/Makefile	2009-04-27 02:19:43.000000000 -0700
+--- /home/jschierm/Libs/scotch_5.1/src/scotch/Makefile	2010-02-10 10:17:04.854221946 -0800
+***************
+*** 49,59 ****
+  %$(EXE)	:	%.c
+  		 		$(CC) $(CFLAGS) -I$(includedir) -I../libscotch -DSCOTCH_VERSION=\"$(VERSION)\" $(<) -o $(@) -L$(libdir) -l$(SCOTCHLIB) -l$(SCOTCHLIB)errexit $(LDFLAGS)
+  
+  ##
+  ##  Project rules.
+  ##
+  
+! .PHONY				:	ptscotch	scotch	ptinstall	install	clean	realclean
+  
+  scotch				:	clean
+  					$(MAKE) CC="$(CCS)" SCOTCHLIB=scotch	\
+--- 49,62 ----
+  %$(EXE)	:	%.c
+  		 		$(CC) $(CFLAGS) -I$(includedir) -I../libscotch -DSCOTCH_VERSION=\"$(VERSION)\" $(<) -o $(@) -L$(libdir) -l$(SCOTCHLIB) -l$(SCOTCHLIB)errexit $(LDFLAGS)
+  
++ %$(MEX)	:	%.c
++ 		 		$(CCM) $(MFLAGS) -I$(includedir) -I../libscotch -DSCOTCH_VERSION=\"$(VERSION)\" $(<) -o $(@) -L$(libdir) -l$(SCOTCHLIB) -l$(SCOTCHLIB)errexit $(LDFLAGS)
++ 
+  ##
+  ##  Project rules.
+  ##
+  
+! .PHONY				:	ptscotch	scotch	mexscotch	ptinstall	install	mexinstall	clean	realclean
+  
+  scotch				:	clean
+  					$(MAKE) CC="$(CCS)" SCOTCHLIB=scotch	\
+***************
+*** 94,99 ****
+--- 97,106 ----
+  					dgscat$(EXE)				\
+  					dgtst$(EXE)
+  
++ mexscotch			:	clean
++ 					$(MAKE) CFLAGS="$(CFLAGS) -DMATLAB -I/usr/local/pkgs/matlab-7.6/extern/include" CC="$(CCS)" LDFLAGS="$(LDFLAGS) -Wl,-rpath-link,/usr/local/pkgs/matlab-7.6/bin/glnxa64 -L/usr/local/pkgs/matlab-7.6/bin/glnxa64 -lmex -lmat" SCOTCHLIB=scotch	\
++ 					gmap_mex$(MEX)
++ 
+  install				:
+  					-$(CP) acpl$(EXE) amk_ccc$(EXE) amk_fft2$(EXE) amk_grf$(EXE) amk_hy$(EXE) amk_m2$(EXE) amk_p2$(EXE) atst$(EXE) gbase$(EXE) gcv$(EXE) gmap$(EXE) gmk_hy$(EXE) gmk_m2$(EXE) gmk_m3$(EXE) gmk_msh$(EXE) gmk_ub2$(EXE) gmtst$(EXE) gord$(EXE) gotst$(EXE) gout$(EXE) *gtst$(EXE) gscat$(EXE) mcv$(EXE) mmk_m2$(EXE) mmk_m3$(EXE) mord$(EXE) mtst$(EXE) $(bindir)
+  					-$(RM) $(bindir)/gpart$(EXE)
+***************
+*** 104,111 ****
+--- 111,122 ----
+  					-$(RM) $(bindir)/dgpart$(EXE)
+  					-$(LN) $(bindir)/dgmap$(EXE) $(bindir)/dgpart$(EXE)
+  
++ mexinstall			:
++ 					-$(CP) gmap_mex$(MEX) $(bindir)
++ 
+  clean				:
+  					-$(RM) *~ *$(OBJ) acpl$(EXE) amk_ccc$(EXE) amk_fft2$(EXE) amk_grf$(EXE) amk_hy$(EXE) amk_m2$(EXE) amk_p2$(EXE) atst$(EXE) gbase$(EXE) gcv$(EXE) *gmap$(EXE) gmk_hy$(EXE) gmk_m2$(EXE) gmk_m3$(EXE) gmk_msh$(EXE) gmk_ub2$(EXE) gmtst$(EXE) *gord$(EXE) gotst$(EXE) gout$(EXE) *gpart$(EXE) *gscat$(EXE) *gtst$(EXE) mcv$(EXE) mmk_m2$(EXE) mmk_m3$(EXE) mord$(EXE) mtst$(EXE)
++ 					-$(RM) gmap_mex$(MEX)
+  
+  realclean			:	clean
+  
+***************
+*** 365,367 ****
+--- 376,386 ----
+  					$(libdir)/libscotch$(LIB)		\
+  					$(libdir)/libscotcherrexit$(LIB)	\
+  					mtst.h
++ 
++ gmap_mex$(MEX)		:	gmap_mex.c					\
++ 					../libscotch/module.h			\
++ 					../libscotch/common.h			\
++ 					$(includedir)/scotch.h			\
++ 					$(libdir)/libscotch$(LIB)		\
++ 					$(libdir)/libscotcherrexit$(LIB)	\
++ 					gmap.h
+Only in /home/jschierm/Libs/scotch_5.1/src/scotch: Makefile_old
+Only in /home/jschierm/Libs/scotch_5.1/src/scotch: Makefile_old2
+Only in /home/jschierm/Libs/scotch_5.1/src/scotch: Makefile_old3
+Only in /home/jschierm/Libs/scotch_5.1/src: scotch_jes_notes.txt
+Only in /home/jschierm/Libs/scotch_5.1/src: scotch_README.txt
Index: /issm/trunk/externalpackages/scotch/scotch_jes_notes.txt
===================================================================
--- /issm/trunk/externalpackages/scotch/scotch_jes_notes.txt	(revision 3002)
+++ /issm/trunk/externalpackages/scotch/scotch_jes_notes.txt	(revision 3003)
@@ -276,3 +276,11 @@
 >         edgeval=        adjir[edgenum-grafptr->baseval]+1;
 
-
+2/08/10:
+
+- modified all changes to use the MATLAB compiler conditional, so that both mex and stand-alone modules could be built simultaneously
+
+2/10/10:
+
+- added mexscotch target to makefiles to separate mex from stand-alone modules
+- removed Matlab-specific switches from CFLAGS and LDFLAGS and added them to mexscotch target
+
