Index: /issm/trunk-jpl/externalpackages/triangle/triangle.c.patch.matlab
===================================================================
--- /issm/trunk-jpl/externalpackages/triangle/triangle.c.patch.matlab	(revision 11948)
+++ /issm/trunk-jpl/externalpackages/triangle/triangle.c.patch.matlab	(revision 11948)
@@ -0,0 +1,164 @@
+0a1,10
+> /*Notes for the Ice code: 
+>  * to be able to compile Triangle within a mex function that can run within 
+>  * matlab, we had to change the allocation routine trimalloc, as well as the 
+>  * double precision activation in exactinit(); The rest is not changed. 
+>  * We also created the ice_makefile to compile Triangle into a library. */
+> #include <mat.h>
+> #include <matrix.h>
+> #define ANSI_DECLARATORS
+> #define NO_TIMER
+> 
+347a358
+> #ifndef _WIN_
+348a360
+> #endif
+641d652
+< 
+817a829,922
+> /*Some missing prototypes: */
+> int scale_expansion_zeroelim(int elen, REAL *e, REAL b, REAL *h);
+> int fast_expansion_sum_zeroelim(int elen, REAL *e, int flen, REAL *f, REAL *h);
+> void poolzero(struct memorypool *pool);
+> int triunsuitable(vertex triorg, vertex tridest, vertex triapex, REAL area);
+> triangle *triangletraverse(struct mesh *m);
+> void pooldeinit(struct memorypool *pool);
+> void printtriangle(struct mesh *m, struct behavior *b, struct otri *t);
+> VOID *poolalloc(struct memorypool *pool);
+> void enqueuebadtriang(struct mesh *m, struct behavior *b,
+>                       struct badtriang *badtri);
+> void triangulatepolygon(struct mesh *m, struct behavior *b,
+>                         struct otri *firstedge, struct otri *lastedge,
+>                         int edgecount, int doflip, int triflaws);
+> void triangledealloc(struct mesh *m, triangle *dyingtriangle);
+> void unflip(struct mesh *m, struct behavior *b, struct otri *flipedge);
+> void vertexmedian(vertex *sortarray, int arraysize, int median, int axis);
+> REAL counterclockwiseadapt(vertex pa, vertex pb, vertex pc, REAL detsum);
+> REAL incircleadapt(vertex pa, vertex pb, vertex pc, vertex pd, REAL permanent);
+> void enqueuebadtri(struct mesh *m, struct behavior *b, struct otri *enqtri,
+>                    REAL minedge, vertex enqapex, vertex enqorg, vertex enqdest);
+> void alternateaxes(vertex *sortarray, int arraysize, int axis);
+> REAL incircleadapt(vertex pa, vertex pb, vertex pc, vertex pd, REAL permanent);
+> void maketriangle(struct mesh *m, struct behavior *b, struct otri *newotri);
+> REAL counterclockwise(struct mesh *m, struct behavior *b,
+>                       vertex pa, vertex pb, vertex pc);
+> vertex vertextraverse(struct mesh *m);
+> void mergehulls(struct mesh *m, struct behavior *b, struct otri *farleft,
+>                 struct otri *innerleft, struct otri *innerright,
+>                 struct otri *farright, int axis);
+> REAL incircle(struct mesh *m, struct behavior *b,
+>               vertex pa, vertex pb, vertex pc, vertex pd);
+> void poolrestart(struct memorypool *pool);
+> void trifree(VOID *memptr);
+> struct splaynode *splay(struct mesh *m, struct splaynode *splaytree,
+>                         vertex searchpoint, struct otri *searchtri);
+> void eventheapdelete(struct event **heap, int heapsize, int eventnum);
+> void eventheapdelete(struct event **heap, int heapsize, int eventnum);
+> void flip(struct mesh *m, struct behavior *b, struct otri *flipedge);
+> void check4deadevent(struct otri *checktri, struct event **freeevents,
+>                      struct event **eventheap, int *heapsize);
+> REAL orient3d(struct mesh *m, struct behavior *b,
+>               vertex pa, vertex pb, vertex pc, vertex pd,
+>               REAL aheight, REAL bheight, REAL cheight, REAL dheight);
+> REAL circletop(struct mesh *m, vertex pa, vertex pb, vertex pc, REAL ccwabc);
+> void poolinit(struct memorypool *pool, int bytecount, int itemcount,
+>               int firstitemcount, int alignment);
+> void eventheapinsert(struct event **heap, int heapsize, struct event *newevent);
+> int rightofhyperbola(struct mesh *m, struct otri *fronttri, vertex newsite);
+> void insertsubseg(struct mesh *m, struct behavior *b, struct otri *tri,
+>                   int subsegmark);
+> int scoutsegment(struct mesh *m, struct behavior *b, struct otri *searchtri,
+>                  vertex endpoint2, int newmark);
+> vertex getvertex(struct mesh *m, struct behavior *b, int number);
+> void internalerror();
+> unsigned long randomnation(unsigned int choices);
+> struct splaynode *splayinsert(struct mesh *m, struct splaynode *splayroot,
+>                               struct otri *newkey, vertex searchpoint);
+> void delaunayfixup(struct mesh *m, struct behavior *b,
+>                    struct otri *fixuptri, int leftside);
+> void traversalinit(struct memorypool *pool);
+> enum insertvertexresult insertvertex(struct mesh *m, struct behavior *b,
+>                                      vertex newvertex, struct otri *searchtri,
+>                                      struct osub *splitseg,
+>                                      int segmentflaws, int triflaws);
+> void conformingedge(struct mesh *m, struct behavior *b,
+>                     vertex endpoint1, vertex endpoint2, int newmark);
+> enum finddirectionresult finddirection(struct mesh *m, struct behavior *b,
+>                                        struct otri *searchtri,
+>                                        vertex searchpoint);
+> VOID *traverse(struct memorypool *pool);
+> void deletevertex(struct mesh *m, struct behavior *b, struct otri *deltri);
+> void pooldealloc(struct memorypool *pool, VOID *dyingitem);
+> int checkseg4encroach(struct mesh *m, struct behavior *b,
+>                       struct osub *testsubseg);
+> void badsubsegdealloc(struct mesh *m, struct badsubseg *dyingseg);
+> void vertexdealloc(struct mesh *m, vertex dyingvertex);
+> void vertexsort(vertex *sortarray, int arraysize);
+> void tallyencs(struct mesh *m, struct behavior *b);
+> void splittriangle(struct mesh *m, struct behavior *b,
+>                    struct badtriang *badtri);
+> subseg *subsegtraverse(struct mesh *m);
+> enum locateresult locate(struct mesh *m, struct behavior *b,
+>                          vertex searchpoint, struct otri *searchtri);
+> void writenodes(struct mesh *m, struct behavior *b, REAL **pointlist,
+>                 REAL **pointattriblist, int **pointmarkerlist);
+> void writevoronoi(struct mesh *m, struct behavior *b, REAL **vpointlist,
+>                   REAL **vpointattriblist, int **vpointmarkerlist,
+>                   int **vedgelist, int **vedgemarkerlist, REAL **vnormlist);
+> void writeneighbors(struct mesh *m, struct behavior *b, int **neighborlist);
+> void testtriangle(struct mesh *m, struct behavior *b, struct otri *testtri);
+> void triangleinit(struct mesh *m);
+> 
+> 
+1408a1514
+> void triexit(int status);
+1410d1515
+< #ifdef ANSI_DECLARATORS
+1412,1416d1516
+< #else /* not ANSI_DECLARATORS */
+< void triexit(status)
+< int status;
+< #endif /* not ANSI_DECLARATORS */
+< 
+1421c1521
+< #ifdef ANSI_DECLARATORS
+---
+> VOID *trimalloc(int size);
+1423,1427d1522
+< #else /* not ANSI_DECLARATORS */
+< VOID *trimalloc(size)
+< int size;
+< #endif /* not ANSI_DECLARATORS */
+< 
+1431c1526,1527
+<   memptr = (VOID *) malloc((unsigned int) size);
+---
+>   memptr = (VOID *) mxMalloc((unsigned int) size);
+>   //memptr = (VOID *) malloc((unsigned int) size);
+1447c1543,1544
+<   free(memptr);
+---
+>   //free(memptr);
+>   mxFree(memptr);
+3665,3670c3762,3767
+< void printtriangle(struct mesh *m, struct behavior *b, struct otri *t)
+< #else /* not ANSI_DECLARATORS */
+< void printtriangle(m, b, t)
+< struct mesh *m;
+< struct behavior *b;
+< struct otri *t;
+---
+> void printtriangle(struct mesh *m, struct behavior *b, struct otri *t){
+> //#else /* not ANSI_DECLARATORS */
+> //void printtriangle(m, b, t)
+> //struct mesh *m;
+> //struct behavior *b;
+> //struct otri *t;
+3673c3770
+< {
+---
+> //{
+4910c5007
+<   _FPU_SETCW(cword);
+---
+>   //_FPU_SETCW(cword); //taken care of by Matlab
Index: /issm/trunk-jpl/externalpackages/triangle/triangle.c.patch.python
===================================================================
--- /issm/trunk-jpl/externalpackages/triangle/triangle.c.patch.python	(revision 11948)
+++ /issm/trunk-jpl/externalpackages/triangle/triangle.c.patch.python	(revision 11948)
@@ -0,0 +1,164 @@
+0a1,10
+> /*Notes for the Ice code: 
+>  * to be able to compile Triangle within a mex function that can run within 
+>  * matlab, we had to change the allocation routine trimalloc, as well as the 
+>  * double precision activation in exactinit(); The rest is not changed. 
+>  * We also created the ice_makefile to compile Triangle into a library. */
+> #include <mat.h>
+> #include <matrix.h>
+> #define ANSI_DECLARATORS
+> #define NO_TIMER
+> 
+347a358
+> #ifndef _WIN_
+348a360
+> #endif
+641d652
+< 
+817a829,922
+> /*Some missing prototypes: */
+> int scale_expansion_zeroelim(int elen, REAL *e, REAL b, REAL *h);
+> int fast_expansion_sum_zeroelim(int elen, REAL *e, int flen, REAL *f, REAL *h);
+> void poolzero(struct memorypool *pool);
+> int triunsuitable(vertex triorg, vertex tridest, vertex triapex, REAL area);
+> triangle *triangletraverse(struct mesh *m);
+> void pooldeinit(struct memorypool *pool);
+> void printtriangle(struct mesh *m, struct behavior *b, struct otri *t);
+> VOID *poolalloc(struct memorypool *pool);
+> void enqueuebadtriang(struct mesh *m, struct behavior *b,
+>                       struct badtriang *badtri);
+> void triangulatepolygon(struct mesh *m, struct behavior *b,
+>                         struct otri *firstedge, struct otri *lastedge,
+>                         int edgecount, int doflip, int triflaws);
+> void triangledealloc(struct mesh *m, triangle *dyingtriangle);
+> void unflip(struct mesh *m, struct behavior *b, struct otri *flipedge);
+> void vertexmedian(vertex *sortarray, int arraysize, int median, int axis);
+> REAL counterclockwiseadapt(vertex pa, vertex pb, vertex pc, REAL detsum);
+> REAL incircleadapt(vertex pa, vertex pb, vertex pc, vertex pd, REAL permanent);
+> void enqueuebadtri(struct mesh *m, struct behavior *b, struct otri *enqtri,
+>                    REAL minedge, vertex enqapex, vertex enqorg, vertex enqdest);
+> void alternateaxes(vertex *sortarray, int arraysize, int axis);
+> REAL incircleadapt(vertex pa, vertex pb, vertex pc, vertex pd, REAL permanent);
+> void maketriangle(struct mesh *m, struct behavior *b, struct otri *newotri);
+> REAL counterclockwise(struct mesh *m, struct behavior *b,
+>                       vertex pa, vertex pb, vertex pc);
+> vertex vertextraverse(struct mesh *m);
+> void mergehulls(struct mesh *m, struct behavior *b, struct otri *farleft,
+>                 struct otri *innerleft, struct otri *innerright,
+>                 struct otri *farright, int axis);
+> REAL incircle(struct mesh *m, struct behavior *b,
+>               vertex pa, vertex pb, vertex pc, vertex pd);
+> void poolrestart(struct memorypool *pool);
+> void trifree(VOID *memptr);
+> struct splaynode *splay(struct mesh *m, struct splaynode *splaytree,
+>                         vertex searchpoint, struct otri *searchtri);
+> void eventheapdelete(struct event **heap, int heapsize, int eventnum);
+> void eventheapdelete(struct event **heap, int heapsize, int eventnum);
+> void flip(struct mesh *m, struct behavior *b, struct otri *flipedge);
+> void check4deadevent(struct otri *checktri, struct event **freeevents,
+>                      struct event **eventheap, int *heapsize);
+> REAL orient3d(struct mesh *m, struct behavior *b,
+>               vertex pa, vertex pb, vertex pc, vertex pd,
+>               REAL aheight, REAL bheight, REAL cheight, REAL dheight);
+> REAL circletop(struct mesh *m, vertex pa, vertex pb, vertex pc, REAL ccwabc);
+> void poolinit(struct memorypool *pool, int bytecount, int itemcount,
+>               int firstitemcount, int alignment);
+> void eventheapinsert(struct event **heap, int heapsize, struct event *newevent);
+> int rightofhyperbola(struct mesh *m, struct otri *fronttri, vertex newsite);
+> void insertsubseg(struct mesh *m, struct behavior *b, struct otri *tri,
+>                   int subsegmark);
+> int scoutsegment(struct mesh *m, struct behavior *b, struct otri *searchtri,
+>                  vertex endpoint2, int newmark);
+> vertex getvertex(struct mesh *m, struct behavior *b, int number);
+> void internalerror();
+> unsigned long randomnation(unsigned int choices);
+> struct splaynode *splayinsert(struct mesh *m, struct splaynode *splayroot,
+>                               struct otri *newkey, vertex searchpoint);
+> void delaunayfixup(struct mesh *m, struct behavior *b,
+>                    struct otri *fixuptri, int leftside);
+> void traversalinit(struct memorypool *pool);
+> enum insertvertexresult insertvertex(struct mesh *m, struct behavior *b,
+>                                      vertex newvertex, struct otri *searchtri,
+>                                      struct osub *splitseg,
+>                                      int segmentflaws, int triflaws);
+> void conformingedge(struct mesh *m, struct behavior *b,
+>                     vertex endpoint1, vertex endpoint2, int newmark);
+> enum finddirectionresult finddirection(struct mesh *m, struct behavior *b,
+>                                        struct otri *searchtri,
+>                                        vertex searchpoint);
+> VOID *traverse(struct memorypool *pool);
+> void deletevertex(struct mesh *m, struct behavior *b, struct otri *deltri);
+> void pooldealloc(struct memorypool *pool, VOID *dyingitem);
+> int checkseg4encroach(struct mesh *m, struct behavior *b,
+>                       struct osub *testsubseg);
+> void badsubsegdealloc(struct mesh *m, struct badsubseg *dyingseg);
+> void vertexdealloc(struct mesh *m, vertex dyingvertex);
+> void vertexsort(vertex *sortarray, int arraysize);
+> void tallyencs(struct mesh *m, struct behavior *b);
+> void splittriangle(struct mesh *m, struct behavior *b,
+>                    struct badtriang *badtri);
+> subseg *subsegtraverse(struct mesh *m);
+> enum locateresult locate(struct mesh *m, struct behavior *b,
+>                          vertex searchpoint, struct otri *searchtri);
+> void writenodes(struct mesh *m, struct behavior *b, REAL **pointlist,
+>                 REAL **pointattriblist, int **pointmarkerlist);
+> void writevoronoi(struct mesh *m, struct behavior *b, REAL **vpointlist,
+>                   REAL **vpointattriblist, int **vpointmarkerlist,
+>                   int **vedgelist, int **vedgemarkerlist, REAL **vnormlist);
+> void writeneighbors(struct mesh *m, struct behavior *b, int **neighborlist);
+> void testtriangle(struct mesh *m, struct behavior *b, struct otri *testtri);
+> void triangleinit(struct mesh *m);
+> 
+> 
+1408a1514
+> void triexit(int status);
+1410d1515
+< #ifdef ANSI_DECLARATORS
+1412,1416d1516
+< #else /* not ANSI_DECLARATORS */
+< void triexit(status)
+< int status;
+< #endif /* not ANSI_DECLARATORS */
+< 
+1421c1521
+< #ifdef ANSI_DECLARATORS
+---
+> VOID *trimalloc(int size);
+1423,1427d1522
+< #else /* not ANSI_DECLARATORS */
+< VOID *trimalloc(size)
+< int size;
+< #endif /* not ANSI_DECLARATORS */
+< 
+1431c1526,1527
+<   memptr = (VOID *) malloc((unsigned int) size);
+---
+>   //memptr = (VOID *) mxMalloc((unsigned int) size);
+>   memptr = (VOID *) malloc((unsigned int) size);
+1447c1543,1544
+<   free(memptr);
+---
+>   free(memptr);
+>   //mxFree(memptr);
+3665,3670c3762,3767
+< void printtriangle(struct mesh *m, struct behavior *b, struct otri *t)
+< #else /* not ANSI_DECLARATORS */
+< void printtriangle(m, b, t)
+< struct mesh *m;
+< struct behavior *b;
+< struct otri *t;
+---
+> void printtriangle(struct mesh *m, struct behavior *b, struct otri *t){
+> //#else /* not ANSI_DECLARATORS */
+> //void printtriangle(m, b, t)
+> //struct mesh *m;
+> //struct behavior *b;
+> //struct otri *t;
+3673c3770
+< {
+---
+> //{
+4910c5007
+<   _FPU_SETCW(cword);
+---
+>   //_FPU_SETCW(cword); //taken care of by Matlab
