Index: issm/trunk/configs/astrid/configure.sh.petsc2
===================================================================
--- issm/trunk/configs/astrid/configure.sh.petsc2	(revision 10228)
+++ issm/trunk/configs/astrid/configure.sh.petsc2	(revision 10229)
@@ -5,3 +5,3 @@
 #mpich 1.0.2
 
-./configure --prefix=$ISSM_TIER --with-matlab-dir=$MATLAB_DIR --with-triangle-dir=$ISSM_TIER/externalpackages/triangle/install --with-metis-dir=$ISSM_TIER/externalpackages/metis/install --with-petsc-dir=$ISSM_TIER/externalpackages/petsc/install --with-mpi-include=$ISSM_TIER/externalpackages/mpich2/install/include  --with-mpi-lib="-L$ISSM_TIER/externalpackages/mpich2/install/lib/ -lmpich" --with-petsc-arch=$ISSM_ARCH --with-dakota-dir=$ISSM_TIER/externalpackages/dakota/install --with-blas-lapack-dir=$ISSM_TIER/externalpackages/petsc/install/externalpackages/fblaslapack/$ISSM_ARCH --with-plapack-lib="-L$ISSM_TIER/externalpackages/petsc/install/externalpackages/PLAPACKR32-hg/$ISSM_ARCH -lPLAPACK" --with-plapack-include="-I$ISSM_TIER/externalpackages/petsc/install/externalpackages/PLAPACKR32-hg/$ISSM_ARCH/INCLUDE" --with-blacs-dir=$ISSM_TIER/externalpackages/petsc/install/externalpackages/blacs-dev/$ISSM_ARCH --with-scalapack-dir=$ISSM_TIER/externalpackages/petsc/install/externalpackages/SCALAPACK/$ISSM_ARCH --with-mumps-dir=$ISSM_TIER/externalpackages/petsc/install/externalpackages/MUMPS_4.6.3/$ISSM_ARCH --with-fortran-lib="-L/usr/lib/gcc/x86_64-redhat-linux/4.1.1/ -lgfortran" --with-graphics-lib=/usr/lib64/libX11.so --with-cxxoptflags="-march=opteron -O2" --with-numthreads=32 --with-scotch-dir=$ISSM_TIER/externalpackages/scotch/install --with-chaco-dir=$ISSM_TIER/externalpackages/chaco/install --enable-debugging
+./configure --prefix=$ISSM_TIER --with-matlab-dir=$MATLAB_DIR --with-triangle-dir=$ISSM_TIER/externalpackages/triangle/install --with-metis-dir=$ISSM_TIER/externalpackages/metis/install --with-petsc-dir=$ISSM_TIER/externalpackages/petsc/install --with-mpi-include=$ISSM_TIER/externalpackages/mpich2/install/include  --with-mpi-lib="-L$ISSM_TIER/externalpackages/mpich2/install/lib/ -lmpich" --with-petsc-arch=$ISSM_ARCH --with-dakota-dir=$ISSM_TIER/externalpackages/dakota/install --with-blas-lapack-dir=$ISSM_TIER/externalpackages/petsc/install/externalpackages/fblaslapack/$ISSM_ARCH --with-plapack-lib="-L$ISSM_TIER/externalpackages/petsc/install/externalpackages/PLAPACKR32-hg/$ISSM_ARCH -lPLAPACK" --with-plapack-include="-I$ISSM_TIER/externalpackages/petsc/install/externalpackages/PLAPACKR32-hg/$ISSM_ARCH/INCLUDE" --with-blacs-dir=$ISSM_TIER/externalpackages/petsc/install/externalpackages/blacs-dev/$ISSM_ARCH --with-scalapack-dir=$ISSM_TIER/externalpackages/petsc/install/externalpackages/SCALAPACK/$ISSM_ARCH --with-mumps-dir=$ISSM_TIER/externalpackages/petsc/install/externalpackages/MUMPS_4.6.3/$ISSM_ARCH --with-fortran-lib="-L/usr/lib/gcc/x86_64-redhat-linux/4.1.1/ -lgfortran" --with-graphics-lib=/usr/lib64/libX11.so --with-cxxoptflags="-march=opteron -O2" --with-numthreads=32 --with-scotch-dir=$ISSM_TIER/externalpackages/scotch/install --with-chaco-dir=$ISSM_TIER/externalpackages/chaco/install --enable-debugging --with-shapelib-dir=$ISSM_TIER/externalpackages/shapelib/install\
Index: issm/trunk/etc/environment.sh
===================================================================
--- issm/trunk/etc/environment.sh	(revision 10228)
+++ issm/trunk/etc/environment.sh	(revision 10229)
@@ -218,2 +218,5 @@
 #CMAKE
 export PATH="$PATH:$CMAKE_DIR/bin"
+
+#SHAPELIB
+export PATH="$PATH:$SHAPELIB_DIR/exec"
Index: issm/trunk/etc/environment_variables.sh
===================================================================
--- issm/trunk/etc/environment_variables.sh	(revision 10228)
+++ issm/trunk/etc/environment_variables.sh	(revision 10229)
@@ -161,2 +161,4 @@
 CMAKE_DIR="$ISSM_TIER/externalpackages/cmake/install"
 
+#shapelib
+SHAPELIB_DIR="$ISSM_TIER/externalpackages/shapelib/install"
Index: issm/trunk/externalpackages/matlab/install.sh
===================================================================
--- issm/trunk/externalpackages/matlab/install.sh	(revision 10228)
+++ issm/trunk/externalpackages/matlab/install.sh	(revision 10229)
@@ -5,5 +5,7 @@
 
 #Select or create a new simlink
-ln -s /usr/local/pkgs/matlab-7.6/ install
+#ln -s /usr/local/pkgs/matlab-7.6/ install
+#ln -s /usr/local/matlab704  install
+ln -s /usr/local/matlab711  install
 #ln -s /usr/local/matlab712/ install
 #ln -s /usr/local/pkgs/matlab-7.6/ install
Index: issm/trunk/m4/issm_options.m4
===================================================================
--- issm/trunk/m4/issm_options.m4	(revision 10228)
+++ issm/trunk/m4/issm_options.m4	(revision 10229)
@@ -540,4 +540,27 @@
 	AC_MSG_RESULT($HAVE_SLEPC)
 	dnl }}}
+	dnl shapelib{{{1
+	AC_ARG_WITH([shapelib-dir],
+			  AS_HELP_STRING([--with-shapelib-dir = DIR],
+							 [shapelib root directory]),
+			  [SHAPELIB_ROOT=$withval],[SHAPELIB_ROOT=""])
+			  
+	AC_MSG_CHECKING(for Shapelib headers and libraries in $SHAPELIB_ROOT)
+	if test -d "$SHAPELIB_ROOT"; then
+
+
+		dnl defaults
+		HAVE_SHAPELIB=yes
+		SHAPELIBINCL=-I"$SHAPELIB_ROOT/include"
+		SHAPELIBLIB=-L"$SHAPELIB_ROOT/lib/ -lshape"
+
+		AC_DEFINE([_HAVE_SHAPELIB_],[1],[with Shapelib in ISSM src])
+		AC_SUBST([SHAPELIBINCL])
+		AC_SUBST([SHAPELIBLIB])
+	else
+		HAVE_SHAPELIB=no
+	fi
+	AC_MSG_RESULT($HAVE_SHAPELIB)
+	dnl }}}
 	dnl scalapack{{{1
 	AC_ARG_WITH([scalapack-dir],
Index: issm/trunk/src/c/Makefile.am
===================================================================
--- issm/trunk/src/c/Makefile.am	(revision 10228)
+++ issm/trunk/src/c/Makefile.am	(revision 10229)
@@ -1,3 +1,3 @@
-INCLUDES = @DAKOTAINCL@ @PETSCINCL@ @SLEPCINCL@ @MPIINCL@ @MATLABINCL@  @METISINCL@  @CHACOINCL@ @SCOTCHINCL@ @PLAPACKINCL@  @BLASLAPACKINCL@ @MKLINCL@ @MUMPSINCL@  @TRIANGLEINCL@ @HYPREINCL@ @MLINCL@ @TAOINCL@
+INCLUDES = @DAKOTAINCL@ @SHAPELIBINCL@ @PETSCINCL@ @SLEPCINCL@ @MPIINCL@ @MATLABINCL@  @METISINCL@  @CHACOINCL@ @SCOTCHINCL@ @PLAPACKINCL@  @BLASLAPACKINCL@ @MKLINCL@ @MUMPSINCL@  @TRIANGLEINCL@ @HYPREINCL@ @MLINCL@ @TAOINCL@
 
 #Library declaration {{{1
Index: issm/trunk/src/mex/Makefile.am
===================================================================
--- issm/trunk/src/mex/Makefile.am	(revision 10228)
+++ issm/trunk/src/mex/Makefile.am	(revision 10229)
@@ -1,3 +1,3 @@
-INCLUDES = @MATLABINCL@ @PETSCINCL@ @MPIINCL@ @METISINCL@ @TRIANGLEINCL@ @CHACOINCL@ @SCOTCHINCL@
+INCLUDES = @MATLABINCL@ @PETSCINCL@ @MPIINCL@ @METISINCL@ @TRIANGLEINCL@ @CHACOINCL@ @SCOTCHINCL@ @SHAPELIBINCL@
 EXEEXT=$(MEXEXT)
 
@@ -69,4 +69,5 @@
 				SparseToVector\
 				SpcNodes\
+				Shp2Kml\
 				UpdateConstraints\
 				SurfaceArea\
@@ -98,5 +99,5 @@
 #}}}
 #Flags and libraries {{{1
-LDADD =   $(TRIANGLELIB) ../c/libISSM.a $(PETSCLIB) $(FLIBS)  $(PLAPACKLIB)  $(MUMPSLIB) $(SCALAPACKLIB)  $(BLACSLIB)  $(HYPRELIB) $(MLLIB) $(DAKOTALIB) $(METISLIB) $(CHACOLIB) $(SCOTCHLIB) $(BLASLAPACKLIB)  $(MPILIB) $(MATHLIB) $(FORTRANLIB) $(GRAPHICSLIB) $(MULTITHREADINGLIB)
+LDADD =   $(TRIANGLELIB) ../c/libISSM.a $(PETSCLIB) $(FLIBS)  $(PLAPACKLIB)  $(MUMPSLIB) $(SCALAPACKLIB)  $(BLACSLIB)  $(HYPRELIB) $(MLLIB) $(DAKOTALIB) $(METISLIB) $(CHACOLIB) $(SCOTCHLIB) $(BLASLAPACKLIB)  $(MPILIB) $(MATHLIB) $(FORTRANLIB) $(GRAPHICSLIB) $(MULTITHREADINGLIB) $(SHAPELIBLIB)
 
 AM_LDFLAGS = $(MEXLINK)
@@ -308,4 +309,7 @@
 SpcNodes_SOURCES = SpcNodes/SpcNodes.cpp\
 			  SpcNodes/SpcNodes.h
+
+Shp2Kml_SOURCES = Shp2Kml/Shp2Kml.cpp\
+			  Shp2Kml/Shp2Kml.h
 
 UpdateConstraints_SOURCES = UpdateConstraints/UpdateConstraints.cpp\
Index: issm/trunk/src/mex/Shp2Kml/Shp2Kml.cpp
===================================================================
--- issm/trunk/src/mex/Shp2Kml/Shp2Kml.cpp	(revision 10229)
+++ issm/trunk/src/mex/Shp2Kml/Shp2Kml.cpp	(revision 10229)
@@ -0,0 +1,48 @@
+/*\file Shp2Kml.c
+ *\brief: build degrees of freedom for every node.
+ */
+
+#include "./Shp2Kml.h"
+
+
+void mexFunction( int nlhs, mxArray* plhs[], int nrhs, const mxArray* prhs[]){
+
+	/*input datasets: */
+	Nodes* nodes=NULL;
+	Parameters* parameters=NULL;
+	Constraints* constraints=NULL;
+	int      analysis_type;
+
+	/*Boot module: */
+	MODULEBOOT();
+
+	/*checks on arguments on the matlab side: */
+	CheckNumMatlabArguments(nlhs,NLHS,nrhs,NRHS,__FUNCT__,&Shp2KmlUsage);
+
+	/*Input datasets: */
+	FetchMatlabData((DataSet**)&nodes,NODESIN);
+	FetchMatlabData((DataSet**)&constraints,CONSTRAINTS);
+	FetchMatlabData(&parameters,PARAMETERS);
+	FetchMatlabData(&analysis_type,ANALYSISTYPE);
+	
+	/*!Generate internal degree of freedom numbers: */
+	SpcNodesx(nodes,constraints,parameters,analysis_type); 
+
+	/*write output datasets: */
+	WriteMatlabData(NODES,nodes);
+
+	/*Free ressources: */
+	delete nodes;
+	delete constraints;
+	delete parameters;
+
+	/*end module: */
+	MODULEEND();
+}
+
+void Shp2KmlUsage(void)
+{
+	_printf_(true,"\n");
+	_printf_(true,"   usage: [m.node]=%s(m.nodes,m.constraints,m.parameters);\n",__FUNCT__);
+	_printf_(true,"\n");
+}
Index: issm/trunk/src/mex/Shp2Kml/Shp2Kml.h
===================================================================
--- issm/trunk/src/mex/Shp2Kml/Shp2Kml.h	(revision 10229)
+++ issm/trunk/src/mex/Shp2Kml/Shp2Kml.h	(revision 10229)
@@ -0,0 +1,37 @@
+
+/*
+	Shp2Kml.h
+*/
+
+
+#ifndef _SHP2KML_H
+#define _SHP2KML_H
+
+/* local prototypes: */
+void Shp2KmlUsage(void);
+
+#include "../../c/modules/modules.h"
+#include "../../c/Container/Container.h"
+#include "../../c/shared/shared.h"
+
+#undef __FUNCT__ 
+#define __FUNCT__  "Shp2Kml"
+
+/* serial input macros: */
+#define NODESIN (mxArray*)prhs[0]
+#define CONSTRAINTS (mxArray*)prhs[1]
+#define PARAMETERS (mxArray*)prhs[2]
+#define ANALYSISTYPE (mxArray*)prhs[3]
+
+/* serial output macros: */
+#define NODES (mxArray**)&plhs[0]
+
+/* serial arg counts: */
+#undef NLHS
+#define NLHS  1
+#undef NRHS
+#define NRHS  4
+
+
+#endif  /* _SHP2KML_H */
+
